Added blau skin, some refactoring.
This commit is contained in:
parent
36ed580f4d
commit
b1258d48fe
12
resources/skins/base/blau.xml
Normal file
12
resources/skins/base/blau.xml
Normal file
File diff suppressed because one or more lines are too long
BIN
resources/skins/base/images/checkbox.png
Normal file
BIN
resources/skins/base/images/checkbox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 343 B |
BIN
resources/skins/base/images/down_arrow.png
Normal file
BIN
resources/skins/base/images/down_arrow.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1008 B |
@ -13,6 +13,7 @@ Fixed:
|
|||||||
|
|
||||||
Added:
|
Added:
|
||||||
<ul>
|
<ul>
|
||||||
|
<li>Re-introduced "blau" (dark) skin.</li>
|
||||||
<li>Import/export dialog now offers "Check/uncheck all items" button.</li>
|
<li>Import/export dialog now offers "Check/uncheck all items" button.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
@ -215,52 +215,6 @@ void FormMain::display() {
|
|||||||
Application::alert(this);
|
Application::alert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormMain::onCommitData(QSessionManager &manager) {
|
|
||||||
qDebug("OS asked application to commit its data.");
|
|
||||||
|
|
||||||
manager.setRestartHint(QSessionManager::RestartNever);
|
|
||||||
manager.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormMain::onSaveState(QSessionManager &manager) {
|
|
||||||
qDebug("OS asked application to save its state.");
|
|
||||||
|
|
||||||
manager.setRestartHint(QSessionManager::RestartNever);
|
|
||||||
manager.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormMain::onAboutToQuit() {
|
|
||||||
// Make sure that we obtain close lock
|
|
||||||
// BEFORE even trying to quit the application.
|
|
||||||
bool locked_safely = qApp->closeLock()->tryLock(CLOSE_LOCK_TIMEOUT);
|
|
||||||
|
|
||||||
qApp->processEvents();
|
|
||||||
|
|
||||||
qDebug("Cleaning up resources and saving application state.");
|
|
||||||
m_ui->m_tabWidget->feedMessageViewer()->quit();
|
|
||||||
|
|
||||||
if (qApp->settings()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool()) {
|
|
||||||
m_ui->m_tabWidget->feedMessageViewer()->feedsView()->clearAllReadMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
qApp->database()->saveDatabase();
|
|
||||||
saveSize();
|
|
||||||
|
|
||||||
if (locked_safely) {
|
|
||||||
// Application obtained permission to close
|
|
||||||
// in a safety way.
|
|
||||||
qDebug("Close lock was obtained safely.");
|
|
||||||
|
|
||||||
// We locked the lock to exit peacefully, unlock it to avoid warnings.
|
|
||||||
qApp->closeLock()->unlock();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Request for write lock timed-out. This means
|
|
||||||
// that some critical action can be processed right now.
|
|
||||||
qDebug("Close lock timed-out.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void FormMain::setupIcons() {
|
void FormMain::setupIcons() {
|
||||||
IconFactory *icon_theme_factory = qApp->icons();
|
IconFactory *icon_theme_factory = qApp->icons();
|
||||||
|
|
||||||
@ -375,10 +329,6 @@ void FormMain::createConnections() {
|
|||||||
connect(m_statusBar->fullscreenSwitcher(), SIGNAL(toggled(bool)), m_ui->m_actionFullscreen, SLOT(setChecked(bool)));
|
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_actionFullscreen, SIGNAL(toggled(bool)), m_statusBar->fullscreenSwitcher(), SLOT(setChecked(bool)));
|
||||||
|
|
||||||
// Core connections.
|
|
||||||
connect(qApp, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&)));
|
|
||||||
connect(qApp, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(QSessionManager&)));
|
|
||||||
|
|
||||||
// Menu "File" connections.
|
// Menu "File" connections.
|
||||||
connect(m_ui->m_actionExportFeeds, SIGNAL(triggered()), this, SLOT(exportFeeds()));
|
connect(m_ui->m_actionExportFeeds, SIGNAL(triggered()), this, SLOT(exportFeeds()));
|
||||||
connect(m_ui->m_actionImportFeeds, SIGNAL(triggered()), this, SLOT(importFeeds()));
|
connect(m_ui->m_actionImportFeeds, SIGNAL(triggered()), this, SLOT(importFeeds()));
|
||||||
@ -398,9 +348,6 @@ void FormMain::createConnections() {
|
|||||||
connect(m_ui->m_actionReportBugGitHub, SIGNAL(triggered()), this, SLOT(reportABugOnGitHub()));
|
connect(m_ui->m_actionReportBugGitHub, SIGNAL(triggered()), this, SLOT(reportABugOnGitHub()));
|
||||||
connect(m_ui->m_actionReportBugBitBucket, SIGNAL(triggered()), this, SLOT(reportABugOnBitBucket()));
|
connect(m_ui->m_actionReportBugBitBucket, SIGNAL(triggered()), this, SLOT(reportABugOnBitBucket()));
|
||||||
|
|
||||||
// General connections.
|
|
||||||
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
|
|
||||||
|
|
||||||
// Menu "Web browser" connections.
|
// Menu "Web browser" connections.
|
||||||
connect(m_ui->m_tabWidget, SIGNAL(currentChanged(int)),
|
connect(m_ui->m_tabWidget, SIGNAL(currentChanged(int)),
|
||||||
this, SLOT(loadWebBrowserMenu(int)));
|
this, SLOT(loadWebBrowserMenu(int)));
|
||||||
|
@ -60,6 +60,10 @@ class FormMain : public QMainWindow {
|
|||||||
// for given actions.
|
// for given actions.
|
||||||
QList<QAction*> allActions();
|
QList<QAction*> allActions();
|
||||||
|
|
||||||
|
// Loads/saves visual state of the application.
|
||||||
|
void loadSize();
|
||||||
|
void saveSize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Creates all needed menus and sets them up.
|
// Creates all needed menus and sets them up.
|
||||||
void prepareMenus();
|
void prepareMenus();
|
||||||
@ -73,10 +77,6 @@ class FormMain : public QMainWindow {
|
|||||||
// Sets up proper icons for this widget.
|
// Sets up proper icons for this widget.
|
||||||
void setupIcons();
|
void setupIcons();
|
||||||
|
|
||||||
// Loads/saves visual state of the application.
|
|
||||||
void loadSize();
|
|
||||||
void saveSize();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
// Processes incoming message from another RSS Guard instance.
|
// Processes incoming message from another RSS Guard instance.
|
||||||
void processExecutionMessage(const QString &message);
|
void processExecutionMessage(const QString &message);
|
||||||
@ -97,13 +97,6 @@ class FormMain : public QMainWindow {
|
|||||||
void switchMainMenu();
|
void switchMainMenu();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// Last-minute reactors.
|
|
||||||
void onCommitData(QSessionManager &manager);
|
|
||||||
void onSaveState(QSessionManager &manager);
|
|
||||||
|
|
||||||
// Used for last-minute actions.
|
|
||||||
void onAboutToQuit();
|
|
||||||
|
|
||||||
// Loads web browser menu if user selects to change tabs.
|
// Loads web browser menu if user selects to change tabs.
|
||||||
void loadWebBrowserMenu(int index);
|
void loadWebBrowserMenu(int index);
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include "gui/messagebox.h"
|
#include "gui/messagebox.h"
|
||||||
#include "gui/formmain.h"
|
#include "gui/formmain.h"
|
||||||
|
|
||||||
|
#include <QSessionManager>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
|
||||||
@ -31,6 +32,9 @@ Application::Application(const QString &id, int &argc, char **argv)
|
|||||||
m_closeLock(NULL), m_userActions(QList<QAction*>()), m_mainForm(NULL),
|
m_closeLock(NULL), m_userActions(QList<QAction*>()), m_mainForm(NULL),
|
||||||
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
|
m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL),
|
||||||
m_localization(NULL), m_icons(NULL), m_database(NULL) {
|
m_localization(NULL), m_icons(NULL), m_database(NULL) {
|
||||||
|
connect(this, SIGNAL(aboutToQuit()), this, SLOT(onAboutToQuit()));
|
||||||
|
connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&)));
|
||||||
|
connect(this, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(QSessionManager&)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
@ -87,8 +91,7 @@ void Application::showGuiMessage(const QString& title, const QString& message,
|
|||||||
QSystemTrayIcon::MessageIcon message_type,
|
QSystemTrayIcon::MessageIcon message_type,
|
||||||
QWidget *parent, int duration) {
|
QWidget *parent, int duration) {
|
||||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||||
// TODO: Maybe show OSD instead if tray icon bubble,
|
// TODO: Maybe show OSD instead if tray icon bubble, depending on settings.
|
||||||
// depending on settings.
|
|
||||||
trayIcon()->showMessage(title, message, message_type, duration);
|
trayIcon()->showMessage(title, message, message_type, duration);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -96,3 +99,49 @@ void Application::showGuiMessage(const QString& title, const QString& message,
|
|||||||
MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message);
|
MessageBox::show(parent, (QMessageBox::Icon) message_type, title, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::onCommitData(QSessionManager &manager) {
|
||||||
|
qDebug("OS asked application to commit its data.");
|
||||||
|
|
||||||
|
manager.setRestartHint(QSessionManager::RestartNever);
|
||||||
|
manager.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onSaveState(QSessionManager &manager) {
|
||||||
|
qDebug("OS asked application to save its state.");
|
||||||
|
|
||||||
|
manager.setRestartHint(QSessionManager::RestartNever);
|
||||||
|
manager.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Application::onAboutToQuit() {
|
||||||
|
// Make sure that we obtain close lock
|
||||||
|
// BEFORE even trying to quit the application.
|
||||||
|
bool locked_safely = closeLock()->tryLock(CLOSE_LOCK_TIMEOUT);
|
||||||
|
|
||||||
|
processEvents();
|
||||||
|
|
||||||
|
qDebug("Cleaning up resources and saving application state.");
|
||||||
|
mainForm()->tabWidget()->feedMessageViewer()->quit();
|
||||||
|
|
||||||
|
if (settings()->value(APP_CFG_MESSAGES, "clear_read_on_exit", false).toBool()) {
|
||||||
|
mainForm()->tabWidget()->feedMessageViewer()->feedsView()->clearAllReadMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
database()->saveDatabase();
|
||||||
|
mainForm()->saveSize();
|
||||||
|
|
||||||
|
if (locked_safely) {
|
||||||
|
// Application obtained permission to close
|
||||||
|
// in a safety way.
|
||||||
|
qDebug("Close lock was obtained safely.");
|
||||||
|
|
||||||
|
// We locked the lock to exit peacefully, unlock it to avoid warnings.
|
||||||
|
closeLock()->unlock();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Request for write lock timed-out. This means
|
||||||
|
// that some critical action can be processed right now.
|
||||||
|
qDebug("Close lock timed-out.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -125,7 +125,6 @@ class Application : public QtSingleApplication {
|
|||||||
#else
|
#else
|
||||||
QString temp_directory = QDesktopServices::storageLocation(QDesktopServices::TempLocation);
|
QString temp_directory = QDesktopServices::storageLocation(QDesktopServices::TempLocation);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return temp_directory;
|
return temp_directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +145,12 @@ class Application : public QtSingleApplication {
|
|||||||
return static_cast<Application*>(QCoreApplication::instance());
|
return static_cast<Application*>(QCoreApplication::instance());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
// Last-minute reactors.
|
||||||
|
void onCommitData(QSessionManager &manager);
|
||||||
|
void onSaveState(QSessionManager &manager);
|
||||||
|
void onAboutToQuit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// This read-write lock is used by application on its close.
|
// This read-write lock is used by application on its close.
|
||||||
// Application locks this lock for WRITING.
|
// Application locks this lock for WRITING.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user