Changed default section size.
This commit is contained in:
parent
1473a7453b
commit
55dcca35be
@ -30,6 +30,7 @@
|
||||
#define TRAY_ICON_BUBBLE_TIMEOUT 15000
|
||||
#define KEY_MESSAGES_VIEW "messages_view_column_"
|
||||
#define CLOSE_LOCK_TIMEOUT 3000
|
||||
#define MESSAGES_VIEW_DEFAULT_COL 170
|
||||
|
||||
#define APP_DB_INIT_FILE "db_init.sql"
|
||||
#define APP_DB_INIT_SPLIT "-- !\n"
|
||||
|
@ -105,6 +105,19 @@ void FeedMessageViewer::updateSelectedFeeds() {
|
||||
}
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed,
|
||||
int current,
|
||||
int total) {
|
||||
// Some feed got updated.
|
||||
// Now we should change some widgets (reload counts
|
||||
// of messages for the feed, update status bar and so on).
|
||||
|
||||
|
||||
// TODO: Don't update counts of all feeds here,
|
||||
// it is enough to update counts of update feed.
|
||||
m_feedsView->updateCountsOfAllFeeds(true);
|
||||
}
|
||||
|
||||
void FeedMessageViewer::onFeedUpdatesFinished() {
|
||||
// Updates of some feeds finished, unlock the lock.
|
||||
SystemFactory::getInstance()->applicationCloseLock()->unlock();
|
||||
@ -127,6 +140,16 @@ void FeedMessageViewer::createConnections() {
|
||||
connect(m_messagesView, SIGNAL(feedCountsChanged()),
|
||||
m_feedsView, SLOT(updateCountsOfSelectedFeeds()));
|
||||
|
||||
// Downloader connections.
|
||||
connect(m_feedDownloaderThread, SIGNAL(finished()),
|
||||
m_feedDownloaderThread, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(feedsUpdateRequested(QList<FeedsModelFeed*>)),
|
||||
m_feedDownloader, SLOT(updateFeeds(QList<FeedsModelFeed*>)));
|
||||
connect(m_feedDownloader, SIGNAL(finished()),
|
||||
this, SLOT(onFeedUpdatesFinished()));
|
||||
connect(m_feedDownloader, SIGNAL(progress(FeedsModelFeed*,int,int)),
|
||||
this, SLOT(onFeedUpdatesProgress(FeedsModelFeed*,int,int)));
|
||||
|
||||
// Toolbar forwardings.
|
||||
connect(FormMain::getInstance()->m_ui->m_actionSwitchImportanceOfSelectedMessages,
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(switchSelectedMessagesImportance()));
|
||||
@ -150,15 +173,6 @@ void FeedMessageViewer::createConnections() {
|
||||
SIGNAL(triggered()), m_messagesView, SLOT(setAllMessagesDeleted()));
|
||||
connect(FormMain::getInstance()->m_ui->m_actionUpdateSelectedFeeds,
|
||||
SIGNAL(triggered()), this, SLOT(updateSelectedFeeds()));
|
||||
|
||||
// Downloader connections.
|
||||
// TODO: Připravit spojení pro progress a finished.
|
||||
connect(m_feedDownloaderThread, SIGNAL(finished()),
|
||||
m_feedDownloaderThread, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(feedsUpdateRequested(QList<FeedsModelFeed*>)),
|
||||
m_feedDownloader, SLOT(updateFeeds(QList<FeedsModelFeed*>)));
|
||||
connect(m_feedDownloader, SIGNAL(finished()),
|
||||
this, SLOT(onFeedUpdatesFinished()));
|
||||
}
|
||||
|
||||
void FeedMessageViewer::initialize() {
|
||||
|
@ -34,6 +34,9 @@ class FeedMessageViewer : public TabContent {
|
||||
|
||||
public slots:
|
||||
void updateSelectedFeeds();
|
||||
|
||||
protected slots:
|
||||
void onFeedUpdatesProgress(FeedsModelFeed *feed, int current, int total);
|
||||
void onFeedUpdatesFinished();
|
||||
|
||||
protected:
|
||||
|
@ -38,17 +38,28 @@ QList<FeedsModelFeed *> FeedsView::allFeeds() const {
|
||||
return m_sourceModel->getAllFeeds();
|
||||
}
|
||||
|
||||
void FeedsView::updateCountsOfSelectedFeeds() {
|
||||
void FeedsView::updateCountsOfSelectedFeeds(bool update_total_too) {
|
||||
QList<FeedsModelFeed*> feeds = selectedFeeds();
|
||||
|
||||
foreach (FeedsModelFeed *feed, feeds) {
|
||||
feed->updateCounts();
|
||||
feed->updateCounts(update_total_too);
|
||||
}
|
||||
|
||||
// Make sure that selected view reloads changed indexes.
|
||||
m_sourceModel->reloadChangedLayout(m_proxyModel->mapListToSource(selectionModel()->selectedRows()));
|
||||
}
|
||||
|
||||
void FeedsView::updateCountsOfAllFeeds(bool update_total_too) {
|
||||
QList<FeedsModelFeed*> feeds = allFeeds();
|
||||
|
||||
foreach (FeedsModelFeed *feed, feeds) {
|
||||
feed->updateCounts(update_total_too);
|
||||
}
|
||||
|
||||
// Make sure that all views reloads its data.
|
||||
m_sourceModel->reloadWholeLayout();
|
||||
}
|
||||
|
||||
void FeedsView::setupAppearance() {
|
||||
#if QT_VERSION >= 0x050000
|
||||
// Setup column resize strategies.
|
||||
|
@ -24,8 +24,11 @@ class FeedsView : public QTreeView {
|
||||
QList<FeedsModelFeed*> allFeeds() const;
|
||||
|
||||
public slots:
|
||||
// Reloads count for selected feeds.
|
||||
void updateCountsOfSelectedFeeds();
|
||||
// Reloads counts for selected feeds.
|
||||
void updateCountsOfSelectedFeeds(bool update_total_too = true);
|
||||
|
||||
// Reloads counts for all feeds.
|
||||
void updateCountsOfAllFeeds(bool update_total_too = true);
|
||||
|
||||
protected:
|
||||
// Sets up appearance of this widget.
|
||||
|
@ -100,6 +100,7 @@ void MessagesView::setupAppearance() {
|
||||
hideColumn(MSG_DB_CONTENTS_INDEX);
|
||||
}
|
||||
|
||||
header()->setDefaultSectionSize(MESSAGES_VIEW_DEFAULT_COL);
|
||||
header()->setStretchLastSection(false);
|
||||
setUniformRowHeights(true);
|
||||
setAcceptDrops(false);
|
||||
@ -115,7 +116,7 @@ void MessagesView::setupAppearance() {
|
||||
// Make sure that initial sorting is that unread messages are visible
|
||||
// first.
|
||||
// NOTE: This can be rewritten so that it's changeable.
|
||||
sortByColumn(MSG_DB_READ_INDEX, Qt::AscendingOrder);
|
||||
sortByColumn(MSG_DB_DUPDATED_INDEX, Qt::AscendingOrder);
|
||||
}
|
||||
|
||||
void MessagesView::keyPressEvent(QKeyEvent *event) {
|
||||
|
@ -23,6 +23,7 @@ class MessagesView : public QTreeView {
|
||||
MessagesModel *sourceModel();
|
||||
|
||||
void createConnections();
|
||||
|
||||
public slots:
|
||||
// Loads un-deleted messages from selected feeds.
|
||||
void loadFeeds(const QList<int> &feed_ids);
|
||||
|
Loading…
x
Reference in New Issue
Block a user