OSDN Git Service

refactoring.
authorikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 3 Aug 2003 14:01:14 +0000 (14:01 +0000)
committerikemo <ikemo@56b19765-1e22-0410-a548-a0f45d66c51a>
Sun, 3 Aug 2003 14:01:14 +0000 (14:01 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/kita/kita/trunk@450 56b19765-1e22-0410-a548-a0f45d66c51a

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

index 399d5b9..9a44315 100644 (file)
@@ -22,7 +22,7 @@ enum FavoriteListViewRows {
   Row_Icon,
   Row_Subject,
   Row_ResNum,
-  Row_Vested,
+  Row_Read,
   Row_Unread,
   Row_DatName,
   Row_DatURL
@@ -35,7 +35,7 @@ FavoriteListView::FavoriteListView(QWidget* parent, const char *name)
   addColumn("");
   addColumn(i18n("Title"));
   addColumn(i18n("ResNum"));
-  addColumn(i18n("Vested"));
+  addColumn(i18n("ReadNum"));
   addColumn(i18n("Unread"));
   addColumn(i18n("Dat"));
 
index 31a5a12..3896753 100644 (file)
@@ -453,7 +453,7 @@ void KitaMainWindow::slotOpenURLRequest(const KURL& url, const KParts::URLArgs&)
 
 void KitaMainWindow::updateThreadCache( const Kita::Thread& thread )
 {
-  KitaCacheInfo::getInstance()->setVestedNum( thread.datURL(), thread.resNum() );
+  KitaCacheInfo::getInstance()->setReadNum( thread.datURL(), thread.resNum() );
   KitaCacheInfo::getInstance()->setResNum( thread.datURL(), thread.resNum() );
 }
 
index 4ecfd9f..0564704 100644 (file)
@@ -17,7 +17,7 @@
 
 KitaCacheInfo* KitaCacheInfo::instance = 0;
 
-KitaCacheInfo::KitaCacheInfo() : m_vestedDict()
+KitaCacheInfo::KitaCacheInfo() : m_readDict()
 {
 }
 
@@ -33,19 +33,19 @@ KitaCacheInfo* KitaCacheInfo::getInstance()
   return instance;
 }
 
-int KitaCacheInfo::getVestedNum(const KURL& url)
+int KitaCacheInfo::readNum(const KURL& url)
 {
   QString key = url.prettyURL();
-  if(m_vestedDict.contains(key)) {
-    return m_vestedDict[key];
+  if( m_readDict.contains(key) ) {
+    return m_readDict[key];
   } else {
     return 0;
   }
 }
 
-void KitaCacheInfo::setVestedNum(const KURL& url, int num)
+void KitaCacheInfo::setReadNum(const KURL& url, int num)
 {
-  m_vestedDict.insert(url.prettyURL(), num);
+  m_readDict.insert(url.prettyURL(), num);
 }
 
 int KitaCacheInfo::resNum( const KURL& url )
@@ -65,12 +65,12 @@ void KitaCacheInfo::setResNum( const KURL& url, int num )
 
 QDataStream& operator<<(QDataStream& s, KitaCacheInfo& c)
 {
-  s << c.m_vestedDict;
+  s << c.m_readDict;
   return s;
 }
 
 QDataStream& operator>>(QDataStream& s, KitaCacheInfo& c)
 {
-  s >> c.m_vestedDict;
+  s >> c.m_readDict;
   return s;
 }
index 174db7d..bedd9bc 100644 (file)
@@ -23,8 +23,8 @@ class KitaCacheInfo
 {
 public:
   static KitaCacheInfo* getInstance();
-  void setVestedNum(const KURL& url, int num);
-  int getVestedNum(const KURL& url);
+  void setReadNum(const KURL& url, int num);
+  int readNum(const KURL& url);
   void setResNum( const KURL& url, int num );
   int resNum( const KURL& url );
   friend QDataStream& operator<<(QDataStream& s, KitaCacheInfo& c);
@@ -32,7 +32,7 @@ public:
 private:
   KitaCacheInfo();
   ~KitaCacheInfo();
-  QMap<QString, int> m_vestedDict;
+  QMap<QString, int> m_readDict;
   QMap<QString, int> m_resNumDict;
   static KitaCacheInfo* instance;
 };
index 2ca7759..20a7ae6 100644 (file)
@@ -40,7 +40,7 @@ enum SubjectViewRows {
   Row_Icon,
   Row_Subject,
   Row_ResNum,
-  Row_Vested,
+  Row_Read,
   Row_Unread,
   Row_DatName,
   Row_DatURL
@@ -58,7 +58,7 @@ KitaSubjectView::KitaSubjectView(QWidget *parent, const char *name)
   subjectList->addColumn("");
   subjectList->addColumn(i18n("Title"));
   subjectList->addColumn(i18n("ResNum"));
-  subjectList->addColumn(i18n("Vested"));
+  subjectList->addColumn(i18n("ReadNum"));
   subjectList->addColumn(i18n("Unread"));
   subjectList->addColumn(i18n("Dat"));
 
@@ -92,7 +92,7 @@ void KitaSubjectView::loadThread( int, QListViewItem* item )
 
   Kita::Thread* thread = new Kita::Thread( m_board, datURL,
                                            item->text( Row_Subject ),
-                                           item->text( Row_Vested ).toInt() );
+                                           item->text( Row_Read ).toInt() );
 
   emit signalShowThread( *thread );
 }
@@ -117,14 +117,14 @@ void KitaSubjectView::loadBoard(const Kita::Board& board)
   for(unsigned i=0; i<threadList.count(); i++) {
     Kita::Thread* thread = threadList.at(i);
 
-    int vested = cache->getVestedNum(thread->datURL());
+    int readNum = cache->readNum(thread->datURL());
     new KListViewItem(subjectList,
                       QString("%1").arg(i+1, 4),
                       "",
                       thread->name(),
                       QString("%1").arg(thread->resNum(), 4),
-                      (vested > 0) ? QString::number(vested) : QString(""),
-                      (vested > 0 && thread->resNum() != vested) ? QString::number(thread->resNum() - vested) : QString(""),
+                      (readNum > 0) ? QString::number(readNum) : QString(""),
+                      (readNum > 0 && thread->resNum() != readNum) ? QString::number(thread->resNum() - readNum) : QString(""),
                       thread->datURL().fileName(),
                       thread->datURL().prettyURL());
   }
@@ -235,9 +235,9 @@ void KitaSubjectView::updateThread(const Kita::Thread& updated_thread)
   for(QListViewItem* item = subjectList->firstChild(); item; item = item->nextSibling() ) {
     if( item->text(Row_DatURL) == updated_thread.datURL().prettyURL() ) {
       int resNum = item->text( Row_ResNum ).toInt();
-      int vested = updated_thread.resNum();
-      item->setText( Row_Vested, QString::number( vested ) );
-      item->setText( Row_Unread, vested > 0 && resNum != vested ? QString::number(resNum - vested) : QString(""));
+      int readNum = updated_thread.resNum();
+      item->setText( Row_Read, QString::number( readNum ) );
+      item->setText( Row_Unread, readNum > 0 && resNum != readNum ? QString::number(resNum - readNum) : QString(""));
     }
   }
 }
@@ -259,7 +259,7 @@ void KitaSubjectView::slotContextMenuRequested( QListViewItem* item, const QPoin
 
   Kita::Thread thread( m_board, datURL );
   thread.setName( item->text( Row_Subject ) );
-  thread.setResNum( item->text( Row_Vested ).toInt() );
+  thread.setResNum( item->text( Row_Read ).toInt() );
 
   QClipboard* clipboard = QApplication::clipboard();