OSDN Git Service

show kidoku-num(still in progress, part2)
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 31 Mar 2003 23:40:41 +0000 (23:40 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Mon, 31 Mar 2003 23:40:41 +0000 (23:40 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@133 56b19765-1e22-0410-a548-a0f45d66c51a

kita/src/kita.cpp
kita/src/kita.h
kita/src/kitacacheinfo.cpp
kita/src/kitacacheinfo.h
kita/src/kitasubjectview.cpp
kita/src/kitasubjectview.h

index 8ae3bbf..5b50a35 100644 (file)
@@ -343,5 +343,10 @@ void Kita::setupCache()
 
 void Kita::slotSetVestedNum(const KURL& threadURL, int resNum)
 {
-  qDebug("%s = %d", threadURL.prettyURL().latin1(), resNum);
+  m_cache->setVestedNum(threadURL, resNum);
+}
+
+KitaCacheInfo* Kita::getCache()
+{
+  return m_cache;
 }
index 32399a8..810d7ec 100644 (file)
@@ -52,6 +52,7 @@ public:
      * Use this method to load whatever file/URL you have
      */
     void load(const KURL& url);
+  KitaCacheInfo* getCache();
 
 protected:
     /**
index 45c4695..4f95ae6 100644 (file)
@@ -2,22 +2,24 @@
 
 #include <kurl.h>
 
-#include <qdict.h>
+#include <qmap.h>
 
 KitaCacheInfo::KitaCacheInfo()
 {
+  m_vestedDict = new QMap<QString, int>();
 }
 
 KitaCacheInfo::~KitaCacheInfo()
 {
+  delete m_vestedDict;
 }
 
-int KitaCacheInfo::getVestedNum(KURL& url)
+int KitaCacheInfo::getVestedNum(const KURL& url)
 {
-  return m_vestedDict[url.prettyURL()];
+  return 0;
 }
 
-void KitaCacheInfo::setVestedNum(KURL& url, int num)
+void KitaCacheInfo::setVestedNum(const KURL& url, int num)
 {
-  m_vestedDict.insert(url.prettyURL(), num);
+  m_vestedDict->insert(url.prettyURL(), num);
 }
index 8a511f5..fb51abe 100644 (file)
@@ -15,10 +15,10 @@ class KitaCacheInfo
 public:
   KitaCacheInfo();
   ~KitaCacheInfo();
-  void setVestedNum(KURL& url, int num);
-  int getVestedNum(KURL& url);
+  void setVestedNum(const KURL& url, int num);
+  int getVestedNum(const KURL& url);
 private:
-  QMap<QString, int> m_vestedDict;
+  QMap<QString, int>* m_vestedDict;
 };
 
 #endif
index bb176d9..ef4151f 100644 (file)
@@ -27,6 +27,7 @@
  
 #include "kitasubjectview.h"
 #include "kita.h"
+#include "kitacacheinfo.h"
 
 enum SubjectViewRows {
   Row_ID,
@@ -40,6 +41,7 @@ enum SubjectViewRows {
 KitaSubjectView::KitaSubjectView(QWidget *parent, const char *name)
   : KitaSubjectViewBase(parent, name)
 {
+  m_parent = static_cast<Kita*>(parent);
   {
     SearchButton->setPixmap( SmallIcon("find") );
     HideButton->setPixmap( SmallIcon("filter") );
@@ -109,6 +111,8 @@ void KitaSubjectView::slotLoadBoard(const KURL& url, const QString& boardName)
     QString line;
     int row=1;
 
+    KitaCacheInfo* cache = m_parent->getCache();
+
     while((line = stream.readLine()) != QString::null) {
       int pos = regexp.search(line);
       if(pos != -1) {
index 7026665..4175d96 100644 (file)
@@ -35,6 +35,7 @@ public slots:
   void slotLoadBoard(const KURL& url, const QString& boardName);
   void slotHideButton(bool on);
 private: // Private attributes
+  Kita* m_parent;
   KURL m_boardURL;
   QString m_boardName;
   void insertSearchCombo();