Fixed #158.
This commit is contained in:
parent
c25371eca7
commit
a889db4f6b
14 changed files with 234 additions and 57 deletions
|
@ -9,6 +9,7 @@ http://goo.gl/forms/GcvPYgS2a8
|
||||||
|
|
||||||
Added:
|
Added:
|
||||||
|
|
||||||
|
▪ Added experimental support for tweakable statusbar. (issue #158)
|
||||||
▪ Opening of download manager when new file download starts is now optional. (issue #165)
|
▪ Opening of download manager when new file download starts is now optional. (issue #165)
|
||||||
|
|
||||||
Fixed:
|
Fixed:
|
||||||
|
|
|
@ -35,7 +35,7 @@ BaseToolBar::~BaseToolBar() {
|
||||||
qDebug("Destroying BaseToolBar instance.");
|
qDebug("Destroying BaseToolBar instance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
QAction *BaseToolBar::findMatchingAction(const QString &action, const QList<QAction*> actions) const {
|
QAction *BaseBar::findMatchingAction(const QString &action, const QList<QAction*> actions) const {
|
||||||
foreach (QAction *act, actions) {
|
foreach (QAction *act, actions) {
|
||||||
if (act->objectName() == action) {
|
if (act->objectName() == action) {
|
||||||
return act;
|
return act;
|
||||||
|
|
|
@ -21,14 +21,8 @@
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
|
||||||
|
|
||||||
class BaseToolBar : public QToolBar {
|
class BaseBar {
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructors and destructors.
|
|
||||||
explicit BaseToolBar(const QString &title, QWidget *parent = 0);
|
|
||||||
virtual ~BaseToolBar();
|
|
||||||
|
|
||||||
// Returns all actions which can be added to the toolbar.
|
// Returns all actions which can be added to the toolbar.
|
||||||
virtual QList<QAction*> availableActions() const = 0;
|
virtual QList<QAction*> availableActions() const = 0;
|
||||||
|
|
||||||
|
@ -47,4 +41,13 @@ class BaseToolBar : public QToolBar {
|
||||||
QAction *findMatchingAction(const QString &action, const QList<QAction*> actions) const;
|
QAction *findMatchingAction(const QString &action, const QList<QAction*> actions) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class BaseToolBar : public QToolBar, public BaseBar {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructors and destructors.
|
||||||
|
explicit BaseToolBar(const QString &title, QWidget *parent = 0);
|
||||||
|
virtual ~BaseToolBar();
|
||||||
|
};
|
||||||
|
|
||||||
#endif // TOOLBAR_H
|
#endif // TOOLBAR_H
|
||||||
|
|
|
@ -83,6 +83,8 @@ FormMain::FormMain(QWidget *parent, Qt::WindowFlags f)
|
||||||
setupIcons();
|
setupIcons();
|
||||||
loadSize();
|
loadSize();
|
||||||
|
|
||||||
|
m_statusBar->loadChangeableActions();
|
||||||
|
|
||||||
// Initialize the web factory.
|
// Initialize the web factory.
|
||||||
WebFactory::instance()->loadState();
|
WebFactory::instance()->loadState();
|
||||||
}
|
}
|
||||||
|
@ -475,9 +477,6 @@ void FormMain::saveSize() {
|
||||||
|
|
||||||
void FormMain::createConnections() {
|
void FormMain::createConnections() {
|
||||||
// Status bar connections.
|
// Status bar connections.
|
||||||
connect(m_statusBar->fullscreenSwitcher(), SIGNAL(toggled(bool)), m_ui->m_actionFullscreen, SLOT(setChecked(bool)));
|
|
||||||
connect(m_ui->m_actionFullscreen, SIGNAL(toggled(bool)), m_statusBar->fullscreenSwitcher(), SLOT(setChecked(bool)));
|
|
||||||
|
|
||||||
connect(m_ui->m_menuAddItem, SIGNAL(aboutToShow()), this, SLOT(updateAddItemMenu()));
|
connect(m_ui->m_menuAddItem, SIGNAL(aboutToShow()), this, SLOT(updateAddItemMenu()));
|
||||||
connect(m_ui->m_menuRecycleBin, SIGNAL(aboutToShow()), this, SLOT(updateRecycleBinMenu()));
|
connect(m_ui->m_menuRecycleBin, SIGNAL(aboutToShow()), this, SLOT(updateRecycleBinMenu()));
|
||||||
connect(m_ui->m_menuAccounts, SIGNAL(aboutToShow()), this, SLOT(updateAccountsMenu()));
|
connect(m_ui->m_menuAccounts, SIGNAL(aboutToShow()), this, SLOT(updateAccountsMenu()));
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "gui/basetoolbar.h"
|
#include "gui/basetoolbar.h"
|
||||||
#include "gui/messagestoolbar.h"
|
#include "gui/messagestoolbar.h"
|
||||||
#include "gui/messagesview.h"
|
#include "gui/messagesview.h"
|
||||||
|
#include "gui/statusbar.h"
|
||||||
#include "gui/dialogs/formmain.h"
|
#include "gui/dialogs/formmain.h"
|
||||||
#include "dynamic-shortcuts/dynamicshortcuts.h"
|
#include "dynamic-shortcuts/dynamicshortcuts.h"
|
||||||
|
|
||||||
|
@ -803,6 +804,7 @@ void FormSettings::loadInterface() {
|
||||||
// Load toolbars.
|
// Load toolbars.
|
||||||
m_ui->m_editorFeedsToolbar->loadFromToolBar(qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsToolBar());
|
m_ui->m_editorFeedsToolbar->loadFromToolBar(qApp->mainForm()->tabWidget()->feedMessageViewer()->feedsToolBar());
|
||||||
m_ui->m_editorMessagesToolbar->loadFromToolBar(qApp->mainForm()->tabWidget()->feedMessageViewer()->messagesToolBar());
|
m_ui->m_editorMessagesToolbar->loadFromToolBar(qApp->mainForm()->tabWidget()->feedMessageViewer()->messagesToolBar());
|
||||||
|
m_ui->m_editorStatusbar->loadFromToolBar(qApp->mainForm()->statusBar());
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormSettings::saveInterface() {
|
void FormSettings::saveInterface() {
|
||||||
|
@ -858,6 +860,7 @@ void FormSettings::saveInterface() {
|
||||||
|
|
||||||
m_ui->m_editorFeedsToolbar->saveToolBar();
|
m_ui->m_editorFeedsToolbar->saveToolBar();
|
||||||
m_ui->m_editorMessagesToolbar->saveToolBar();
|
m_ui->m_editorMessagesToolbar->saveToolBar();
|
||||||
|
m_ui->m_editorStatusbar->saveToolBar();
|
||||||
|
|
||||||
qApp->mainForm()->tabWidget()->checkTabBarVisibility();
|
qApp->mainForm()->tabWidget()->checkTabBarVisibility();
|
||||||
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties();
|
qApp->mainForm()->tabWidget()->feedMessageViewer()->refreshVisualProperties();
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QStackedWidget" name="m_stackedSettings">
|
<widget class="QStackedWidget" name="m_stackedSettings">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>7</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="m_pageGeneral">
|
<widget class="QWidget" name="m_pageGeneral">
|
||||||
<layout class="QFormLayout" name="formLayout_5">
|
<layout class="QFormLayout" name="formLayout_5">
|
||||||
|
@ -417,8 +417,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>100</width>
|
<width>782</width>
|
||||||
<height>30</height>
|
<height>451</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
@ -495,8 +495,8 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>208</width>
|
<width>776</width>
|
||||||
<height>238</height>
|
<height>425</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
@ -782,6 +782,11 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||||
<string>Toolbar for messages list</string>
|
<string>Toolbar for messages list</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Statusbar</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
|
@ -833,6 +838,25 @@ Authors of this application are NOT responsible for lost data.</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="m_pageStatusbar">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_18">
|
||||||
|
<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_editorStatusbar" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
|
#include <QAction>
|
||||||
|
|
||||||
|
|
||||||
PlainToolButton::PlainToolButton(QWidget *parent) : QToolButton(parent), m_padding(0) {
|
PlainToolButton::PlainToolButton(QWidget *parent) : QToolButton(parent), m_padding(0) {
|
||||||
|
@ -39,9 +40,13 @@ void PlainToolButton::paintEvent(QPaintEvent *e) {
|
||||||
// Set padding.
|
// Set padding.
|
||||||
rect.adjust(m_padding, m_padding, -m_padding, -m_padding);
|
rect.adjust(m_padding, m_padding, -m_padding, -m_padding);
|
||||||
|
|
||||||
// Paint the icon.
|
if (isEnabled()) {
|
||||||
if (underMouse() || isChecked()) {
|
if (underMouse() || isChecked()) {
|
||||||
p.setOpacity(0.7);
|
p.setOpacity(0.7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
p.setOpacity(0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
icon().paint(&p, rect);
|
icon().paint(&p, rect);
|
||||||
|
@ -60,3 +65,13 @@ void PlainToolButton::setChecked(bool checked) {
|
||||||
QToolButton::setChecked(checked);
|
QToolButton::setChecked(checked);
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlainToolButton::reactOnActionChange(QAction *action) {
|
||||||
|
QAction *real_action = action == NULL ? qobject_cast<QAction*>(sender()) : action;
|
||||||
|
|
||||||
|
setEnabled(real_action->isEnabled());
|
||||||
|
setCheckable(real_action->isCheckable());
|
||||||
|
setChecked(real_action->isChecked());
|
||||||
|
setIcon(real_action->icon());
|
||||||
|
setToolTip(real_action->toolTip());
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ class PlainToolButton : public QToolButton {
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setChecked(bool checked);
|
void setChecked(bool checked);
|
||||||
|
void reactOnActionChange(QAction *action = NULL);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Custom look.
|
// Custom look.
|
||||||
|
|
|
@ -31,53 +31,146 @@
|
||||||
|
|
||||||
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
StatusBar::StatusBar(QWidget *parent) : QStatusBar(parent) {
|
||||||
setSizeGripEnabled(false);
|
setSizeGripEnabled(false);
|
||||||
setContentsMargins(0, 0, 0, 0);
|
setContentsMargins(2, 2, 2, 2);
|
||||||
|
|
||||||
m_adBlockIcon = new AdBlockIcon(this);
|
m_adBlockIcon = new AdBlockIcon(this);
|
||||||
m_adBlockIcon->activate();
|
m_adBlockIcon->activate();
|
||||||
|
m_adBlockIcon->setObjectName(QSL("m_adBlockIcon"));
|
||||||
|
|
||||||
// Initializations of widgets for status bar.
|
m_adBlockIconAction = new QAction(qApp->icons()->fromTheme("web-adblock"), tr("Adblock"), this);
|
||||||
m_fullscreenSwitcher = new PlainToolButton(this);
|
m_adBlockIconAction->setObjectName(QSL("m_adBlockIconAction"));
|
||||||
m_fullscreenSwitcher->setCheckable(true);
|
|
||||||
m_fullscreenSwitcher->setIcon(qApp->icons()->fromTheme(QSL("view-fullscreen")));
|
|
||||||
m_fullscreenSwitcher->setText(tr("Fullscreen mode"));
|
|
||||||
m_fullscreenSwitcher->setToolTip(tr("Switch application between fulscreen/normal states right from this status bar icon."));
|
|
||||||
|
|
||||||
m_barProgressFeeds = new QProgressBar(this);
|
m_barProgressFeeds = new QProgressBar(this);
|
||||||
m_barProgressFeeds->setTextVisible(false);
|
m_barProgressFeeds->setTextVisible(false);
|
||||||
m_barProgressFeeds->setFixedWidth(100);
|
m_barProgressFeeds->setFixedWidth(100);
|
||||||
m_barProgressFeeds->setVisible(false);
|
m_barProgressFeeds->setVisible(false);
|
||||||
|
m_barProgressFeeds->setObjectName(QSL("m_barProgressFeeds"));
|
||||||
|
|
||||||
|
m_barProgressFeedsAction = new QAction(qApp->icons()->fromTheme(QSL("folder-feed")), tr("Feed update progress bar"), this);
|
||||||
|
m_barProgressFeedsAction->setObjectName(QSL("m_barProgressFeedsAction"));
|
||||||
|
|
||||||
m_lblProgressFeeds = new QLabel(this);
|
m_lblProgressFeeds = new QLabel(this);
|
||||||
m_lblProgressFeeds->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
m_lblProgressFeeds->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
m_lblProgressFeeds->setVisible(false);
|
m_lblProgressFeeds->setVisible(false);
|
||||||
|
m_lblProgressFeeds->setObjectName(QSL("m_lblProgressFeeds"));
|
||||||
|
|
||||||
|
m_lblProgressFeedsAction = new QAction(qApp->icons()->fromTheme(QSL("folder-feed")), tr("Feed update label"), this);
|
||||||
|
m_lblProgressFeedsAction->setObjectName(QSL("m_lblProgressFeedsAction"));
|
||||||
|
|
||||||
m_barProgressDownload = new QProgressBar(this);
|
m_barProgressDownload = new QProgressBar(this);
|
||||||
m_barProgressDownload->setTextVisible(true);
|
m_barProgressDownload->setTextVisible(true);
|
||||||
m_barProgressDownload->setFixedWidth(100);
|
m_barProgressDownload->setFixedWidth(100);
|
||||||
m_barProgressDownload->setVisible(false);
|
m_barProgressDownload->setVisible(false);
|
||||||
|
m_barProgressDownload->setObjectName(QSL("m_barProgressDownload"));
|
||||||
|
|
||||||
|
m_barProgressDownloadAction = new QAction(qApp->icons()->fromTheme(QSL("download-manager")), tr("File download progress bar"), this);
|
||||||
|
m_barProgressDownloadAction->setObjectName(QSL("m_barProgressDownloadAction"));
|
||||||
|
|
||||||
m_lblProgressDownload = new QLabel(this);
|
m_lblProgressDownload = new QLabel(this);
|
||||||
m_lblProgressDownload->setText("Downloading files in background");
|
m_lblProgressDownload->setText("Downloading files in background");
|
||||||
m_lblProgressDownload->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
m_lblProgressDownload->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
m_lblProgressDownload->setVisible(false);
|
m_lblProgressDownload->setVisible(false);
|
||||||
|
m_lblProgressDownload->setObjectName(QSL("m_lblProgressDownload"));
|
||||||
|
|
||||||
|
m_lblProgressDownloadAction = new QAction(qApp->icons()->fromTheme(QSL("download-manager")), tr("File download label"), this);
|
||||||
|
m_lblProgressDownloadAction->setObjectName(QSL("m_lblProgressDownloadAction"));
|
||||||
|
|
||||||
m_lblProgressDownload->installEventFilter(this);
|
m_lblProgressDownload->installEventFilter(this);
|
||||||
m_barProgressDownload->installEventFilter(this);
|
m_barProgressDownload->installEventFilter(this);
|
||||||
|
|
||||||
// Add widgets.
|
|
||||||
addPermanentWidget(m_lblProgressFeeds);
|
|
||||||
addPermanentWidget(m_barProgressFeeds);
|
|
||||||
addPermanentWidget(m_lblProgressDownload);
|
|
||||||
addPermanentWidget(m_barProgressDownload);
|
|
||||||
addPermanentWidget(m_adBlockIcon);
|
|
||||||
addPermanentWidget(m_fullscreenSwitcher);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBar::~StatusBar() {
|
StatusBar::~StatusBar() {
|
||||||
|
clear();
|
||||||
qDebug("Destroying StatusBar instance.");
|
qDebug("Destroying StatusBar instance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QList<QAction*> StatusBar::availableActions() const {
|
||||||
|
QList<QAction*> actions = qApp->userActions();
|
||||||
|
|
||||||
|
// Now, add placeholder actions for custom stuff.
|
||||||
|
actions << m_adBlockIconAction << m_barProgressDownloadAction << m_barProgressFeedsAction <<
|
||||||
|
m_lblProgressDownloadAction << m_lblProgressFeedsAction;
|
||||||
|
|
||||||
|
return actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QAction*> StatusBar::changeableActions() const {
|
||||||
|
return actions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::saveChangeableActions(const QStringList &actions) {
|
||||||
|
qApp->settings()->setValue(GROUP(GUI), GUI::StatusbarActions, actions.join(QSL(",")));
|
||||||
|
loadChangeableActions(actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::loadChangeableActions() {
|
||||||
|
QStringList action_names = qApp->settings()->value(GROUP(GUI), SETTING(GUI::StatusbarActions)).toString().split(',',
|
||||||
|
QString::SkipEmptyParts);
|
||||||
|
|
||||||
|
loadChangeableActions(action_names);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::loadChangeableActions(const QStringList &action_names) {
|
||||||
|
clear();
|
||||||
|
|
||||||
|
QList<QAction*> available_actions = availableActions();
|
||||||
|
|
||||||
|
// Iterate action names and add respectable actions into the toolbar.
|
||||||
|
foreach (const QString &action_name, action_names) {
|
||||||
|
QAction *matching_action = findMatchingAction(action_name, available_actions);
|
||||||
|
QAction *action_to_add;
|
||||||
|
QWidget *widget_to_add;
|
||||||
|
|
||||||
|
if (matching_action == m_adBlockIconAction) {
|
||||||
|
widget_to_add = m_adBlockIcon;
|
||||||
|
action_to_add = m_adBlockIconAction;
|
||||||
|
|
||||||
|
widget_to_add->setVisible(true);
|
||||||
|
}
|
||||||
|
else if (matching_action == m_barProgressDownloadAction) {
|
||||||
|
widget_to_add = m_barProgressDownload;
|
||||||
|
action_to_add = m_barProgressDownloadAction;
|
||||||
|
|
||||||
|
widget_to_add->setVisible(false);
|
||||||
|
}
|
||||||
|
else if (matching_action == m_barProgressFeedsAction) {
|
||||||
|
widget_to_add = m_barProgressFeeds;
|
||||||
|
action_to_add = m_barProgressFeedsAction;
|
||||||
|
|
||||||
|
widget_to_add->setVisible(false);
|
||||||
|
}
|
||||||
|
else if (matching_action == m_lblProgressDownloadAction) {
|
||||||
|
widget_to_add = m_lblProgressDownload;
|
||||||
|
action_to_add = m_lblProgressDownloadAction;
|
||||||
|
|
||||||
|
widget_to_add->setVisible(false);
|
||||||
|
}
|
||||||
|
else if (matching_action == m_lblProgressFeedsAction) {
|
||||||
|
widget_to_add = m_lblProgressFeeds;
|
||||||
|
action_to_add = m_lblProgressFeedsAction;
|
||||||
|
|
||||||
|
widget_to_add->setVisible(false);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Add originally toolbar action.
|
||||||
|
PlainToolButton *tool_button = new PlainToolButton(this);
|
||||||
|
|
||||||
|
tool_button->reactOnActionChange(matching_action);
|
||||||
|
|
||||||
|
action_to_add = matching_action;
|
||||||
|
widget_to_add = tool_button;
|
||||||
|
|
||||||
|
matching_action->setProperty("should_remove", true);
|
||||||
|
connect(tool_button, SIGNAL(clicked(bool)), matching_action, SLOT(trigger()));
|
||||||
|
connect(matching_action, SIGNAL(changed()), tool_button, SLOT(reactOnActionChange()));
|
||||||
|
}
|
||||||
|
|
||||||
|
action_to_add->setProperty("widget", QVariant::fromValue((void*) widget_to_add));
|
||||||
|
addPermanentWidget(widget_to_add);
|
||||||
|
addAction(action_to_add);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool StatusBar::eventFilter(QObject *watched, QEvent *event) {
|
bool StatusBar::eventFilter(QObject *watched, QEvent *event) {
|
||||||
if (watched == m_lblProgressDownload || watched == m_barProgressDownload) {
|
if (watched == m_lblProgressDownload || watched == m_barProgressDownload) {
|
||||||
if (event->type() == QEvent::MouseButtonPress) {
|
if (event->type() == QEvent::MouseButtonPress) {
|
||||||
|
@ -88,12 +181,33 @@ bool StatusBar::eventFilter(QObject *watched, QEvent *event) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::showProgressFeeds(int progress, const QString &label) {
|
void StatusBar::clear() {
|
||||||
m_lblProgressFeeds->setVisible(true);
|
while (!actions().isEmpty()) {
|
||||||
m_barProgressFeeds->setVisible(true);
|
QAction *act = actions().at(0);
|
||||||
|
QWidget *widget = act->property("widget").isValid() ? static_cast<QWidget*>(act->property("widget").value<void*>()) : NULL;
|
||||||
|
bool should_remove = act->property("remove_widget").isValid();
|
||||||
|
|
||||||
m_lblProgressFeeds->setText(label);
|
if (widget != NULL) {
|
||||||
m_barProgressFeeds->setValue(progress);
|
removeWidget(widget);
|
||||||
|
widget->setVisible(false);
|
||||||
|
|
||||||
|
if (should_remove) {
|
||||||
|
widget->deleteLater();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
removeAction(act);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void StatusBar::showProgressFeeds(int progress, const QString &label) {
|
||||||
|
if (actions().contains(m_barProgressFeedsAction)) {
|
||||||
|
m_lblProgressFeeds->setVisible(true);
|
||||||
|
m_barProgressFeeds->setVisible(true);
|
||||||
|
|
||||||
|
m_lblProgressFeeds->setText(label);
|
||||||
|
m_barProgressFeeds->setValue(progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::clearProgressFeeds() {
|
void StatusBar::clearProgressFeeds() {
|
||||||
|
@ -102,11 +216,13 @@ void StatusBar::clearProgressFeeds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::showProgressDownload(int progress, const QString &tooltip) {
|
void StatusBar::showProgressDownload(int progress, const QString &tooltip) {
|
||||||
m_lblProgressDownload->setVisible(true);
|
if (actions().contains(m_barProgressDownloadAction)) {
|
||||||
m_barProgressDownload->setVisible(true);
|
m_lblProgressDownload->setVisible(true);
|
||||||
m_barProgressDownload->setValue(progress);
|
m_barProgressDownload->setVisible(true);
|
||||||
m_barProgressDownload->setToolTip(tooltip);
|
m_barProgressDownload->setValue(progress);
|
||||||
m_lblProgressDownload->setToolTip(tooltip);
|
m_barProgressDownload->setToolTip(tooltip);
|
||||||
|
m_lblProgressDownload->setToolTip(tooltip);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatusBar::clearProgressDownload() {
|
void StatusBar::clearProgressDownload() {
|
||||||
|
|
|
@ -20,13 +20,14 @@
|
||||||
|
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
|
|
||||||
|
#include "gui/basetoolbar.h"
|
||||||
|
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
class PlainToolButton;
|
class PlainToolButton;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class AdBlockIcon;
|
class AdBlockIcon;
|
||||||
|
|
||||||
class StatusBar : public QStatusBar {
|
class StatusBar : public QStatusBar, public BaseBar {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -34,13 +35,10 @@ class StatusBar : public QStatusBar {
|
||||||
explicit StatusBar(QWidget *parent = 0);
|
explicit StatusBar(QWidget *parent = 0);
|
||||||
virtual ~StatusBar();
|
virtual ~StatusBar();
|
||||||
|
|
||||||
inline PlainToolButton *fullscreenSwitcher() const {
|
QList<QAction*> availableActions() const;
|
||||||
return m_fullscreenSwitcher;
|
QList<QAction*> changeableActions() const;
|
||||||
}
|
void saveChangeableActions(const QStringList &actions);
|
||||||
|
void loadChangeableActions();
|
||||||
inline AdBlockIcon *adBlockIcon() {
|
|
||||||
return m_adBlockIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Progress bar operations
|
// Progress bar operations
|
||||||
|
@ -54,12 +52,23 @@ class StatusBar : public QStatusBar {
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void clear();
|
||||||
|
void loadChangeableActions(const QStringList &action_names);
|
||||||
|
|
||||||
QProgressBar *m_barProgressFeeds;
|
QProgressBar *m_barProgressFeeds;
|
||||||
|
QAction *m_barProgressFeedsAction;
|
||||||
|
|
||||||
QLabel *m_lblProgressFeeds;
|
QLabel *m_lblProgressFeeds;
|
||||||
|
QAction *m_lblProgressFeedsAction;
|
||||||
|
|
||||||
QProgressBar *m_barProgressDownload;
|
QProgressBar *m_barProgressDownload;
|
||||||
|
QAction *m_barProgressDownloadAction;
|
||||||
|
|
||||||
QLabel *m_lblProgressDownload;
|
QLabel *m_lblProgressDownload;
|
||||||
PlainToolButton *m_fullscreenSwitcher;
|
QAction *m_lblProgressDownloadAction;
|
||||||
|
|
||||||
AdBlockIcon* m_adBlockIcon;
|
AdBlockIcon* m_adBlockIcon;
|
||||||
|
QAction *m_adBlockIconAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // STATUSBAR_H
|
#endif // STATUSBAR_H
|
||||||
|
|
|
@ -49,7 +49,7 @@ ToolBarEditor::~ToolBarEditor() {
|
||||||
qDebug("Destroying ToolBarEditor instance.");
|
qDebug("Destroying ToolBarEditor instance.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBarEditor::loadFromToolBar(BaseToolBar *tool_bar) {
|
void ToolBarEditor::loadFromToolBar(BaseBar *tool_bar) {
|
||||||
m_toolBar = tool_bar;
|
m_toolBar = tool_bar;
|
||||||
|
|
||||||
QList<QAction*> activated_actions = m_toolBar->changeableActions();
|
QList<QAction*> activated_actions = m_toolBar->changeableActions();
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Ui {
|
||||||
class ToolBarEditor;
|
class ToolBarEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BaseToolBar;
|
class BaseBar;
|
||||||
|
|
||||||
class ToolBarEditor : public QWidget {
|
class ToolBarEditor : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -38,7 +38,7 @@ class ToolBarEditor : public QWidget {
|
||||||
virtual ~ToolBarEditor();
|
virtual ~ToolBarEditor();
|
||||||
|
|
||||||
// Toolbar operations.
|
// Toolbar operations.
|
||||||
void loadFromToolBar(BaseToolBar *tool_bar);
|
void loadFromToolBar(BaseBar *tool_bar);
|
||||||
void saveToolBar();
|
void saveToolBar();
|
||||||
|
|
||||||
inline QListWidget *activeItemsWidget() const {
|
inline QListWidget *activeItemsWidget() const {
|
||||||
|
@ -68,7 +68,7 @@ class ToolBarEditor : public QWidget {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::ToolBarEditor> m_ui;
|
QScopedPointer<Ui::ToolBarEditor> m_ui;
|
||||||
BaseToolBar *m_toolBar;
|
BaseBar *m_toolBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TOOLBAREDITOR_H
|
#endif // TOOLBAREDITOR_H
|
||||||
|
|
|
@ -84,6 +84,9 @@ DVALUE(Qt::ToolButtonStyle) GUI::ToolbarStyleDef = Qt::ToolButtonIconOnly;
|
||||||
DKEY GUI::FeedsToolbarActions = "feeds_toolbar";
|
DKEY GUI::FeedsToolbarActions = "feeds_toolbar";
|
||||||
DVALUE(char*) GUI::FeedsToolbarActionsDef = "m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionMarkAllItemsRead";
|
DVALUE(char*) GUI::FeedsToolbarActionsDef = "m_actionUpdateAllItems,m_actionStopRunningItemsUpdate,m_actionMarkAllItemsRead";
|
||||||
|
|
||||||
|
DKEY GUI::StatusbarActions = "status_bar";
|
||||||
|
DVALUE(char*) GUI::StatusbarActionsDef = "m_lblProgressFeedsAction,m_barProgressFeedsAction,m_actionUpdateAllItems,m_actionUpdateSelectedItems,m_actionStopRunningItemsUpdate,m_adBlockIconAction,m_actionFullscreen,m_actionQuit";
|
||||||
|
|
||||||
DKEY GUI::MainWindowInitialSize = "window_size";
|
DKEY GUI::MainWindowInitialSize = "window_size";
|
||||||
DKEY GUI::MainWindowInitialPosition = "window_position";
|
DKEY GUI::MainWindowInitialPosition = "window_position";
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,9 @@ namespace GUI {
|
||||||
KEY FeedsToolbarActions;
|
KEY FeedsToolbarActions;
|
||||||
VALUE(char*) FeedsToolbarActionsDef;
|
VALUE(char*) FeedsToolbarActionsDef;
|
||||||
|
|
||||||
|
KEY StatusbarActions;
|
||||||
|
VALUE(char*) StatusbarActionsDef;
|
||||||
|
|
||||||
KEY MainWindowInitialSize;
|
KEY MainWindowInitialSize;
|
||||||
KEY MainWindowInitialPosition;
|
KEY MainWindowInitialPosition;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue