svnno****@sourc*****
svnno****@sourc*****
2009年 7月 17日 (金) 00:23:28 JST
Revision: 2414 http://sourceforge.jp/projects/kita/svn/view?view=rev&revision=2414 Author: nogu Date: 2009-07-17 00:23:28 +0900 (Fri, 17 Jul 2009) Log Message: ----------- - adjust the size of subjectList - style fix Modified Paths: -------------- kita/branches/KITA-KDE4/kita/src/boardview.cpp kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp kita/branches/KITA-KDE4/kita/src/threadlistview.cpp Modified: kita/branches/KITA-KDE4/kita/src/boardview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-16 13:48:23 UTC (rev 2413) +++ kita/branches/KITA-KDE4/kita/src/boardview.cpp 2009-07-16 15:23:28 UTC (rev 2414) @@ -126,7 +126,7 @@ { m_hitList.clear(); m_nextHitIndex = 0; - m_prevquery = QStringList(""); + m_prevquery = QStringList(); } m_boardURL = url; @@ -137,7 +137,8 @@ /* get list of pointers of Thread classes */ QList<Kita::Thread*> oldLogList; QList<Kita::Thread*> threadList; - Kita::BoardManager::getThreadList(m_boardURL, m_showOldLogs, online, threadList, oldLogList); + Kita::BoardManager::getThreadList( + m_boardURL, m_showOldLogs, online, threadList, oldLogList); // reset list for (int i = 0, j = subjectList->rowCount(); i < j; i++) { @@ -152,9 +153,8 @@ int count = countNew + countOld; subjectList->setRowCount(count); for (int i = 0; i < count; i++) { - subjectList->setRowHeight(i, qMax(QFontMetrics(QFont()).height(), - SmallIcon("unread").height())); // TODO - Kita::Thread* thread = i < countNew ? threadList.at(i) : oldLogList.at(i - countNew); + Kita::Thread* thread + = i < countNew ? threadList.at(i) : oldLogList.at(i - countNew); KUrl datURL = thread->datURL(); for (int j = 0, k = subjectList->columnCount(); j < k; j++) { Kita::ThreadListViewItem* item = new Kita::ThreadListViewItem(j); @@ -192,6 +192,12 @@ loadLayout(); loadHeaderOnOff(); m_enableSizeChange = true; + for (int i = 0, j = subjectList->columnCount(); i < j; i++) { + subjectList->resizeColumnToContents(i); + } + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->resizeRowToContents(i); + } } /* public slot */ /* virtual */ @@ -258,7 +264,8 @@ /* if id == 0, this thread is old thread. */ /* private */ -void KitaBoardView::updateListViewItem(QTableWidgetItem* item, const KUrl& datURL, const QDateTime& current, int id, int order) +void KitaBoardView::updateListViewItem(QTableWidgetItem* item, + const KUrl& datURL, const QDateTime& current, int id, int order) { int row = item->row(); QDateTime since; @@ -387,24 +394,36 @@ deleteLog(threadURL); } else if (action == propertyAct) { QWidget* widget = new QWidget; - Kita::Ui::ThreadProperty* propertyWidget = new Kita::Ui::ThreadProperty; + Kita::Ui::ThreadProperty* propertyWidget + = new Kita::Ui::ThreadProperty; propertyWidget->setupUi(widget); propertyWidget->threadURLLabel->setText(threadURL); propertyWidget->datURLLabel->setText(datURL); - propertyWidget->threadNameLabel->setText(Kita::DatManager::threadName(datURL)); - propertyWidget->cachePathLabel->setText(Kita::DatManager::getCachePath(datURL)); - propertyWidget->indexPathLabel->setText(Kita::DatManager::getCacheIndexPath(datURL)); - propertyWidget->resNumLabel->setText(QString("%1").arg(Kita::DatManager::getResNum(datURL))); - propertyWidget->readNumLabel->setText(QString("%1").arg(Kita::DatManager::getReadNum(datURL))); - propertyWidget->viewPosLabel->setText(QString("%1").arg(Kita::DatManager::getViewPos(datURL))); + propertyWidget->threadNameLabel-> + setText(Kita::DatManager::threadName(datURL)); + propertyWidget->cachePathLabel-> + setText(Kita::DatManager::getCachePath(datURL)); + propertyWidget->indexPathLabel-> + setText(Kita::DatManager::getCacheIndexPath(datURL)); + propertyWidget->resNumLabel-> + setText(QString::number(Kita::DatManager::getResNum(datURL))); + propertyWidget->readNumLabel-> + setText(QString::number(Kita::DatManager::getReadNum(datURL))); + propertyWidget->viewPosLabel-> + setText(QString::number(Kita::DatManager::getViewPos(datURL))); - propertyWidget->idx_threadNameWithIndexLabel->setText(Kita::ThreadIndex::getSubject(datURL)); - propertyWidget->idx_resNumLabel->setText(QString("%1").arg(Kita::ThreadIndex::getResNum(datURL))); - propertyWidget->idx_readNumLabel->setText(QString("%1").arg(Kita::ThreadIndex::getReadNum(datURL))); - propertyWidget->idx_viewPosLabel->setText(QString("%1").arg(Kita::ThreadIndex::getViewPos(datURL))); + propertyWidget->idx_threadNameWithIndexLabel-> + setText(Kita::ThreadIndex::getSubject(datURL)); + propertyWidget->idx_resNumLabel-> + setText(QString::number(Kita::ThreadIndex::getResNum(datURL))); + propertyWidget->idx_readNumLabel-> + setText(QString::number(Kita::ThreadIndex::getReadNum(datURL))); + propertyWidget->idx_viewPosLabel-> + setText(QString::number(Kita::ThreadIndex::getViewPos(datURL))); - propertyWidget->cache_readNumLabel->setText(QString("%1").arg(KitaThreadInfo::readNum(datURL))); + propertyWidget->cache_readNumLabel-> + setText(QString::number(KitaThreadInfo::readNum(datURL))); widget->show(); } } @@ -425,7 +444,8 @@ if (! m_enableSizeChange) return ; if (autoResize()) return ; - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); // KConfig config(configPath); TODO // subjectList->saveLayout(&config, "Layout"); TODO } @@ -433,7 +453,8 @@ void KitaBoardView::loadLayout() { if (autoResize()) return ; - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); KConfig config(configPath); // subjectList->restoreLayout(&config, "Layout"); TODO } @@ -481,7 +502,8 @@ void KitaBoardView::saveHeaderOnOff() { - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); KConfig config(configPath); KConfigGroup group = config.group("Column"); @@ -496,13 +518,14 @@ void KitaBoardView::loadHeaderOnOff() { - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); KConfig config(configPath); KConfigGroup group = config.group("Column"); for (int i = Col_Begin; i <= Col_End; i++) { - bool isShown = group.readEntry(s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault); -// qDebug("%s: isShown %d", s_colAttr[i].keyName.latin1(), isShown); + bool isShown = group.readEntry( + s_colAttr[ i ].keyName, s_colAttr[ i ].showDefault); if (isShown) { showColumn(i); } else { @@ -513,7 +536,8 @@ bool KitaBoardView::autoResize() { - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); KConfig config(configPath); return config.group("Column").readEntry("AutoResize", true); @@ -521,7 +545,8 @@ void KitaBoardView::setAutoResize(bool flag) { - QString configPath = KStandardDirs::locateLocal("appdata", "subjectview.conf"); + QString configPath + = KStandardDirs::locateLocal("appdata", "subjectview.conf"); KConfig config(configPath); config.group("Column").writeEntry("AutoResize", flag); Modified: kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-16 13:48:23 UTC (rev 2413) +++ kita/branches/KITA-KDE4/kita/src/favoritelistview.cpp 2009-07-16 15:23:28 UTC (rev 2414) @@ -53,7 +53,7 @@ // clear m_hitList.clear(); m_nextHitIndex = 0; - m_prevquery = QStringList(""); + m_prevquery = QStringList(); for (int i = 0, j = subjectList->rowCount(); i < j; i++) { for (int k = 0, l = subjectList->columnCount(); k < l; k++) { @@ -90,6 +90,12 @@ subjectList->setItem(i, Col_DatURL, new QTableWidgetItem(datURL)); } subjectList->sortItems(Col_Board); + for (int i = 0, j = subjectList->columnCount(); i < j; i++) { + subjectList->resizeColumnToContents(i); + } + for (int i = 0, j = subjectList->rowCount(); i < j; i++) { + subjectList->resizeRowToContents(i); + } } /** Modified: kita/branches/KITA-KDE4/kita/src/threadlistview.cpp =================================================================== --- kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-16 13:48:23 UTC (rev 2413) +++ kita/branches/KITA-KDE4/kita/src/threadlistview.cpp 2009-07-16 15:23:28 UTC (rev 2414) @@ -52,7 +52,6 @@ subjectList->setShowGrid(false); subjectList->setSortingEnabled(true); subjectList->verticalHeader()->setVisible(false); - //QHeaderView* header = subjectList->horizontalHeader(); TODO QStringList labels; for (int i = Col_Begin; i <= Col_End; i++) { labels << i18n(s_colAttr[i].labelName); @@ -60,7 +59,6 @@ hideColumn(i); } } - //header->setStretchLastSection(true); subjectList->setHorizontalHeaderLabels(labels); connect(SearchCombo, SIGNAL(activated(int)),