Fixed #2 and some fixing.

This commit is contained in:
Martin Rotter 2014-04-07 08:21:55 +02:00
parent 12685b2df6
commit 8558395ba2
12 changed files with 317 additions and 74 deletions

View File

@ -294,6 +294,7 @@ set(APP_SOURCES
src/gui/comboboxwithstatus.cpp
src/gui/basetoolbar.cpp
src/gui/messagestoolbar.cpp
src/gui/feedstoolbar.cpp
src/gui/toolbareditor.cpp
# DYNAMIC-SHORTCUTS sources.
@ -371,6 +372,7 @@ set(APP_HEADERS
src/gui/comboboxwithstatus.h
src/gui/basetoolbar.h
src/gui/messagestoolbar.h
src/gui/feedstoolbar.h
src/gui/toolbareditor.h
# DYNAMIC-SHORTCUTS headers.

View File

@ -1,4 +1,21 @@
<body>
<center><h2>1.9.9.9</h2></center>
Fixed:
<ul>
<li>Various GUI and bug fixes.</li>
</ul>
Added:
<ul>
<li>Added option to adjust icons/buttons displayed in toolbars. See Settings/User interface/Toolbars dialog for more information.</li>
</ul>
Changed:
<ul>
</ul>
<hr/>
<center><h2>1.9.9.8</h2></center>
Fixed:

View File

@ -32,6 +32,7 @@
#include "gui/systemtrayicon.h"
#include "gui/messagebox.h"
#include "gui/messagestoolbar.h"
#include "gui/feedstoolbar.h"
#include <QVBoxLayout>
#include <QSplitter>
@ -52,7 +53,7 @@ FeedMessageViewer::FeedMessageViewer(QWidget *parent)
: TabContent(parent),
m_toolBarsEnabled(true),
m_listHeadersEnabled(true),
m_toolBarFeeds(new QToolBar(tr("Toolbar for feeds"), this)),
m_toolBarFeeds(new FeedsToolBar(tr("Toolbar for feeds"), this)),
m_toolBarMessages(new MessagesToolBar(tr("Toolbar for messages"), this)),
m_messagesView(new MessagesView(this)),
m_feedsView(new FeedsView(this)),
@ -301,17 +302,11 @@ void FeedMessageViewer::initialize() {
m_toolBarFeeds->setFloatable(false);
m_toolBarFeeds->setMovable(false);
m_toolBarFeeds->setAllowedAreas(Qt::TopToolBarArea);
m_toolBarFeeds->setToolButtonStyle(Qt::ToolButtonIconOnly);
// Add everything to toolbar.
m_toolBarFeeds->addAction(FormMain::instance()->m_ui->m_actionUpdateAllFeeds);
m_toolBarFeeds->addAction(FormMain::instance()->m_ui->m_actionMarkAllFeedsRead);
m_toolBarFeeds->addAction(FormMain::instance()->m_ui->m_actionClearAllFeeds);
m_toolBarFeeds->loadChangeableActions();
m_toolBarMessages->setFloatable(false);
m_toolBarMessages->setMovable(false);
m_toolBarMessages->setAllowedAreas(Qt::TopToolBarArea);
m_toolBarMessages->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_toolBarMessages->loadChangeableActions();
// Finish web/message browser setup.

View File

@ -26,6 +26,7 @@
class WebBrowser;
class MessagesView;
class MessagesToolBar;
class FeedsToolBar;
class FeedsView;
class FeedDownloader;
class FeedsModelFeed;
@ -55,6 +56,10 @@ class FeedMessageViewer : public TabContent {
return m_toolBarMessages;
}
inline FeedsToolBar *feedsToolBar() {
return m_toolBarFeeds;
}
// Loads/saves sizes and states of ALL
// underlying widgets, this contains primarily
// splitters, toolbar and views.
@ -110,7 +115,7 @@ class FeedMessageViewer : public TabContent {
private:
bool m_toolBarsEnabled;
bool m_listHeadersEnabled;
QToolBar *m_toolBarFeeds;
FeedsToolBar *m_toolBarFeeds;
MessagesToolBar *m_toolBarMessages;
QSplitter *m_feedSplitter;

65
src/gui/feedstoolbar.cpp Normal file
View File

@ -0,0 +1,65 @@
#include "gui/feedstoolbar.h"
#include "gui/formmain.h"
#include "miscellaneous/settings.h"
FeedsToolBar::FeedsToolBar(const QString &title, QWidget *parent) : BaseToolBar(title, parent) {
// Update right margin of filter textbox.
QMargins margins = contentsMargins();
margins.setRight(margins.right() + FILTER_RIGHT_MARGIN);
setContentsMargins(margins);
}
FeedsToolBar::~FeedsToolBar() {
}
QHash<QString, QAction *> FeedsToolBar::availableActions() const {
return FormMain::instance()->allActions();;
}
QList<QAction *> FeedsToolBar::changeableActions() const {
return actions();
}
void FeedsToolBar::saveChangeableActions(const QStringList &actions) {
Settings::instance()->setValue(APP_CFG_GUI, "feeds_toolbar", actions.join(","));
loadChangeableActions(actions);
}
void FeedsToolBar::loadChangeableActions() {
QStringList action_names = Settings::instance()->value(APP_CFG_GUI,
"feeds_toolbar",
"m_actionUpdateAllFeeds,m_actionMarkAllFeedsRead").toString().split(',',
QString::SkipEmptyParts);
loadChangeableActions(action_names);
}
void FeedsToolBar::loadChangeableActions(const QStringList &actions) {
QHash<QString, QAction*> available_actions = availableActions();
clear();
// Iterate action names and add respectable actions into the toolbar.
foreach (const QString &action_name, actions) {
if (available_actions.contains(action_name)) {
// Add existing standard action.
addAction(available_actions.value(action_name));
}
else if (action_name == SEPARATOR_ACTION_NAME) {
// Add new separator.
addSeparator();
}
else if (action_name == SPACER_ACTION_NAME) {
// Add new spacer.
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QAction *action = addWidget(spacer);
action->setIcon(IconFactory::instance()->fromTheme("application-search"));
action->setProperty("type", SPACER_ACTION_NAME);
action->setProperty("name", tr("Toolbar spacer"));
}
}
}

24
src/gui/feedstoolbar.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef FEEDSTOOLBAR_H
#define FEEDSTOOLBAR_H
#include "gui/basetoolbar.h"
class FeedsToolBar : public BaseToolBar {
public:
// Constructors and destructors.
explicit FeedsToolBar(const QString &title, QWidget *parent = 0);
virtual ~FeedsToolBar();
QHash<QString, QAction*> availableActions() const;
QList<QAction*> changeableActions() const;
void saveChangeableActions(const QStringList &actions);
void loadChangeableActions();
// Loads actions as specified by external actions list.
// NOTE: This is used primarily for reloading actions
// when they are changed from settings.
void loadChangeableActions(const QStringList &actions);
};
#endif // FEEDSTOOLBAR_H

View File

@ -33,6 +33,7 @@
#include "gui/systemtrayicon.h"
#include "gui/feedmessageviewer.h"
#include "gui/feedsview.h"
#include "gui/feedstoolbar.h"
#include "gui/formmain.h"
#include "gui/messagebox.h"
#include "gui/basetoolbar.h"
@ -135,6 +136,8 @@ FormSettings::FormSettings(QWidget *parent) : QDialog(parent), m_ui(new Ui::Form
this, SLOT(onMysqlDataStorageEdited()));
connect(m_ui->m_txtMysqlUsername->lineEdit(), SIGNAL(textEdited(QString)),
this, SLOT(onMysqlDataStorageEdited()));
connect(m_ui->m_cmbSelectToolBar, SIGNAL(currentIndexChanged(int)),
m_ui->m_stackedToolbars, SLOT(setCurrentIndex(int)));
// Load all settings.
loadGeneral();
@ -772,7 +775,8 @@ void FormSettings::loadInterface() {
Qt::ToolButtonIconOnly).toInt()));
// Load toolbars.
m_ui->widget->loadFromToolBar(FormMain::instance()->tabWidget()->feedMessageViewer()->messagesToolBar());
m_ui->m_editorFeedsToolbar->loadFromToolBar(FormMain::instance()->tabWidget()->feedMessageViewer()->feedsToolBar());
m_ui->m_editorMessagesToolbar->loadFromToolBar(FormMain::instance()->tabWidget()->feedMessageViewer()->messagesToolBar());
}
void FormSettings::saveInterface() {
@ -833,8 +837,8 @@ void FormSettings::saveInterface() {
settings->setValue(APP_CFG_GUI, "hide_tabbar_one_tab",
m_ui->m_hideTabBarIfOneTabVisible->isChecked());
m_ui->widget->saveToolBar();
m_ui->m_editorFeedsToolbar->saveToolBar();
m_ui->m_editorMessagesToolbar->saveToolBar();
FormMain::instance()->tabWidget()->checkTabBarVisibility();
FormMain::instance()->tabWidget()->feedMessageViewer()->refreshVisualProperties();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>808</width>
<height>410</height>
<width>820</width>
<height>427</height>
</rect>
</property>
<property name="windowTitle">
@ -364,8 +364,8 @@ Authors of this application are NOT responsible for lost data.</string>
<rect>
<x>0</x>
<y>0</y>
<width>558</width>
<height>337</height>
<width>570</width>
<height>354</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
@ -378,6 +378,9 @@ Authors of this application are NOT responsible for lost data.</string>
<string>Icons</string>
</property>
<layout class="QFormLayout" name="formLayout_8">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="m_lblIconTheme">
<property name="text">
@ -391,16 +394,6 @@ 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>
@ -578,9 +571,91 @@ Authors of this application are NOT responsible for lost data.</string>
<attribute name="title">
<string>Toolbars</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="ToolBarEditor" name="widget" native="true"/>
<layout class="QFormLayout" name="formLayout_18">
<item row="0" column="1">
<widget class="QComboBox" name="m_cmbToolbarButtonStyle"/>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="m_cmbSelectToolBar">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Toolbar for feeds list</string>
</property>
</item>
<item>
<property name="text">
<string>Toolbar for messages list</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QStackedWidget" name="m_stackedToolbars">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="m_pageFeedsToolbar">
<layout class="QHBoxLayout" name="horizontalLayout_13">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="ToolBarEditor" name="m_editorFeedsToolbar" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="m_pageMessagesToolbar">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="ToolBarEditor" name="m_editorMessagesToolbar" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Toolbar button style</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Select toolbar to edit</string>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -34,13 +34,16 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar* tool_bar) {
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
action_item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
action_item->setText(tr("Separator"));
action_item->setToolTip(tr("Separator"));
}
else if (action->property("type").isValid()) {
action_item->setData(Qt::UserRole, action->property("type").toString());
action_item->setText(action->property("name").toString());
action_item->setToolTip(action_item->text());
}
else {
action_item->setData(Qt::UserRole, action->objectName());
action_item->setToolTip(action->toolTip());
}
}
@ -53,14 +56,17 @@ void ToolBarEditor::loadFromToolBar(BaseToolBar* tool_bar) {
if (action->isSeparator()) {
action_item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
action_item->setText(tr("Separator"));
action_item->setToolTip(tr("Separator"));
action_item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
}
else if (action->property("type").isValid()) {
action_item->setData(Qt::UserRole, action->property("type").toString());
action_item->setText(action->property("name").toString());
action_item->setToolTip(action_item->text());
}
else {
action_item->setData(Qt::UserRole, action->objectName());
action_item->setToolTip(action->toolTip());
}
}
}
@ -98,6 +104,7 @@ void ToolBarEditor::insertSeparator() {
QListWidgetItem *item = new QListWidgetItem(tr("Separator"));
item->setData(Qt::UserRole, SEPARATOR_ACTION_NAME);
item->setToolTip(tr("Separator"));
item->setIcon(IconFactory::instance()->fromTheme("view-separator"));
if (current_row >= 0) {

View File

@ -26,6 +26,7 @@ class ToolBarEditor : public QWidget {
void saveToolBar();
private slots:
// Insert common controls.
void insertSpacer();
void insertSeparator();

View File

@ -26,13 +26,6 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Available actions</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -40,8 +33,21 @@
</property>
</widget>
</item>
<item row="1" column="0" rowspan="4">
<item row="0" column="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Available actions</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QListWidget" name="m_listActivatedActions">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
@ -57,51 +63,91 @@
<property name="defaultDropAction">
<enum>Qt::MoveAction</enum>
</property>
</widget>
</item>
<item row="1" column="2" rowspan="4">
<widget class="QListWidget" name="m_listAvailableActions">
<property name="showDropIndicator" stdset="0">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="dragEnabled">
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::MoveAction</enum>
</property>
</widget>
</item>
<item row="5" column="0" colspan="3">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="m_btnInsertSeparator">
<property name="text">
<string>Insert separator</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="m_btnInsertSeparator">
<property name="text">
<string>Insert separator</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="m_btnInsertSpacer">
<property name="text">
<string>Insert spacer</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="m_btnInsertSpacer">
<property name="text">
<string>Insert spacer</string>
<item row="1" column="2">
<widget class="QListWidget" name="m_listAvailableActions">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>true</bool>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropOverwriteMode">
<bool>false</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::MoveAction</enum>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="horizontalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="resizeMode">
<enum>QListView::Adjust</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
</item>

View File

@ -162,6 +162,8 @@ void WebBrowser::onLoadingProgress(int progress) {
}
void WebBrowser::onLoadingFinished(bool success) {
Q_UNUSED(success)
m_loadingProgress->hide();
}