Toolbar cleanup & added option to switch toolbar style.

This commit is contained in:
Martin Rotter 2014-02-10 17:19:43 +01:00
parent 1ed4e02156
commit 9084361782
8 changed files with 77 additions and 15 deletions

View File

@ -111,7 +111,7 @@ void FeedMessageViewer::quit() {
}
void FeedMessageViewer::updateTrayIconStatus(int unread_messages,
int total_messages) {
int total_messages) {
Q_UNUSED(total_messages)
if (SystemTrayIcon::isSystemTrayActivated()) {
@ -129,7 +129,7 @@ void FeedMessageViewer::onFeedUpdatesProgress(FeedsModelFeed *feed,
// Some feed got updated.
m_feedsView->updateCountsOfParticularFeed(feed, true);
FormMain::instance()->statusBar()->showProgress((current * 100.0) / total,
tr("Updated feed '%1'").arg(feed->title()));
tr("Updated feed '%1'").arg(feed->title()));
}
void FeedMessageViewer::onFeedUpdatesFinished() {
@ -212,6 +212,8 @@ void FeedMessageViewer::createConnections() {
SIGNAL(triggered()), m_feedsView, SLOT(markSelectedFeedsUnread()));
connect(form_main->m_ui->m_actionClearSelectedFeeds,
SIGNAL(triggered()), m_feedsView, SLOT(clearSelectedFeeds()));
connect(form_main->m_ui->m_actionClearAllFeeds,
SIGNAL(triggered()), m_feedsView, SLOT(clearAllFeeds()));
connect(form_main->m_ui->m_actionUpdateSelectedFeedsCategories,
SIGNAL(triggered()), m_feedsView, SLOT(updateSelectedFeeds()));
connect(form_main->m_ui->m_actionUpdateAllFeeds,
@ -242,14 +244,9 @@ void FeedMessageViewer::initialize() {
// Add everything to toolbar.
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionUpdateAllFeeds);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkAllFeedsRead);
m_toolBar->addSeparator();
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionUpdateSelectedFeedsCategories);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionEditSelectedFeedCategory);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionDeleteSelectedFeedCategory);
m_toolBar->addSeparator();
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedFeedsAsRead);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionMarkSelectedFeedsAsUnread);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionClearSelectedFeeds);
m_toolBar->addAction(FormMain::instance()->m_ui->m_actionClearAllFeeds);
m_toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
// Finish web/message browser setup.
m_messagesBrowser->setNavigationBarVisible(false);
@ -257,6 +254,8 @@ void FeedMessageViewer::initialize() {
// Downloader setup.
qRegisterMetaType<QList<FeedsModelFeed*> >("QList<FeedsModelFeed*>");
m_feedDownloader->moveToThread(m_feedDownloaderThread);
refreshVisualProperties();
}
void FeedMessageViewer::initializeViews() {
@ -348,3 +347,9 @@ void FeedMessageViewer::vacuumDatabase() {
SystemFactory::instance()->applicationCloseLock()->unlock();
}
void FeedMessageViewer::refreshVisualProperties() {
m_toolBar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::instance()->value(APP_CFG_GUI,
"toolbar_style",
Qt::ToolButtonIconOnly).toInt()));
}

View File

@ -46,6 +46,9 @@ class FeedMessageViewer : public TabContent {
public slots:
void vacuumDatabase();
// Reloads some changeable visual settings.
void refreshVisualProperties();
protected slots:
// Updates counts of messages for example in tray icon.
void updateTrayIconStatus(int unread_messages, int total_messages);

View File

@ -191,10 +191,21 @@ void FeedsView::setSelectedFeedsClearStatus(int clear) {
emit feedsNeedToBeReloaded(1);
}
void FeedsView::setAllFeedsClearStatus(int clear) {
m_sourceModel->markFeedsDeleted(allFeeds(), clear, 0);
updateCountsOfAllFeeds();
emit feedsNeedToBeReloaded(1);
}
void FeedsView::clearSelectedFeeds() {
setSelectedFeedsClearStatus(1);
}
void FeedsView::clearAllFeeds() {
setAllFeedsClearStatus(1);
}
void FeedsView::addNewStandardCategory() {
if (!SystemFactory::instance()->applicationCloseLock()->tryLock()) {
// Lock was not obtained because

View File

@ -71,7 +71,9 @@ class FeedsView : public QTreeView {
// Feed clearers.
void setSelectedFeedsClearStatus(int clear);
void setAllFeedsClearStatus(int clear);
void clearSelectedFeeds();
void clearAllFeeds();
void clearAllReadMessages();
// Base manipulators.

View File

@ -241,6 +241,7 @@ void FormMain::setupIcons() {
m_ui->m_actionUpdateAllFeeds->setIcon(icon_theme_factory->fromTheme("item-update-all"));
m_ui->m_actionUpdateSelectedFeedsCategories->setIcon(icon_theme_factory->fromTheme("item-update-selected"));
m_ui->m_actionClearSelectedFeeds->setIcon(icon_theme_factory->fromTheme("mail-remove"));
m_ui->m_actionClearAllFeeds->setIcon(icon_theme_factory->fromTheme("mail-remove"));
m_ui->m_actionDeleteSelectedFeedCategory->setIcon(icon_theme_factory->fromTheme("item-remove"));
m_ui->m_actionDeleteSelectedMessages->setIcon(icon_theme_factory->fromTheme("mail-remove"));
m_ui->m_actionAddStandardCategory->setIcon(icon_theme_factory->fromTheme("item-new"));

View File

@ -114,6 +114,7 @@
<addaction name="separator"/>
<addaction name="m_actionViewSelectedItemsNewspaperMode"/>
<addaction name="m_actionMarkAllFeedsRead"/>
<addaction name="m_actionClearAllFeeds"/>
<addaction name="m_actionMarkSelectedFeedsAsRead"/>
<addaction name="m_actionMarkSelectedFeedsAsUnread"/>
<addaction name="m_actionClearSelectedFeeds"/>
@ -467,6 +468,17 @@
<string>Hides or shows the list of feeds/categories.</string>
</property>
</action>
<action name="m_actionClearAllFeeds">
<property name="text">
<string>Clear all items</string>
</property>
<property name="toolTip">
<string>Remove all messages from all feeds.</string>
</property>
<property name="shortcut">
<string notr="true"/>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -675,11 +675,28 @@ void FormSettings::loadInterface() {
m_ui->m_hideTabBarIfOneTabVisible->setChecked(settings->value(APP_CFG_GUI,
"hide_tabbar_one_tab",
true).toBool());
// Load toolbar button style.
m_ui->m_cmbToolbarButtonStyle->addItem(tr("icon only"), Qt::ToolButtonIconOnly);
m_ui->m_cmbToolbarButtonStyle->addItem(tr("text only"), Qt::ToolButtonTextOnly);
m_ui->m_cmbToolbarButtonStyle->addItem(tr("text beside icon"), Qt::ToolButtonTextBesideIcon);
m_ui->m_cmbToolbarButtonStyle->addItem(tr("text under icon"), Qt::ToolButtonTextUnderIcon);
m_ui->m_cmbToolbarButtonStyle->addItem(tr("follow OS style"), Qt::ToolButtonFollowStyle);
m_ui->m_cmbToolbarButtonStyle->setCurrentIndex(m_ui->m_cmbToolbarButtonStyle->findData(Settings::instance()->value(APP_CFG_GUI,
"toolbar_style",
Qt::ToolButtonIconOnly).toInt()));
}
void FormSettings::saveInterface() {
Settings *settings = Settings::instance();
// Save toolbar.
Settings::instance()->setValue(APP_CFG_GUI,
"toolbar_style",
m_ui->m_cmbToolbarButtonStyle->itemData(m_ui->m_cmbToolbarButtonStyle->currentIndex()));
// Save tray icon.
if (SystemTrayIcon::isSystemTrayAvailable()) {
settings->setValue(APP_CFG_GUI, "use_tray_icon",
@ -727,4 +744,5 @@ void FormSettings::saveInterface() {
m_ui->m_hideTabBarIfOneTabVisible->isChecked());
FormMain::instance()->tabWidget()->checkTabBarVisibility();
FormMain::instance()->tabWidget()->feedMessageViewer()->refreshVisualProperties();
}

View File

@ -17,7 +17,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="m_stackedSettings">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="m_pageGeneral">
<layout class="QFormLayout" name="formLayout_5">
@ -289,8 +289,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>564</width>
<height>363</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
@ -367,8 +367,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>167</width>
<height>219</height>
<width>558</width>
<height>337</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -394,6 +394,16 @@ Authors of this application are NOT responsible for lost data.</string>
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbIconTheme"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_cmbToolbarButtonStyle"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Toolbar button style</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>