Some refactoring.
This commit is contained in:
parent
1c8358999e
commit
b7b80ab888
@ -151,25 +151,6 @@ void FormMain::prepareMenus() {
|
||||
}
|
||||
}
|
||||
|
||||
void FormMain::processExecutionMessage(const QString &message) {
|
||||
qDebug("Received '%s' execution message from another application instance.",
|
||||
qPrintable(message));
|
||||
|
||||
if (message == APP_IS_RUNNING) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qApp->trayIcon()->showMessage(APP_NAME,
|
||||
tr("Application is already running."),
|
||||
QSystemTrayIcon::Information,
|
||||
TRAY_ICON_BUBBLE_TIMEOUT);
|
||||
}
|
||||
|
||||
display();
|
||||
}
|
||||
else if (message == APP_QUIT_INSTANCE) {
|
||||
qApp->quit();
|
||||
}
|
||||
}
|
||||
|
||||
void FormMain::quit() {
|
||||
qDebug("Quitting the application.");
|
||||
qApp->quit();
|
||||
|
@ -78,9 +78,6 @@ class FormMain : public QMainWindow {
|
||||
void setupIcons();
|
||||
|
||||
public slots:
|
||||
// Processes incoming message from another RSS Guard instance.
|
||||
void processExecutionMessage(const QString &message);
|
||||
|
||||
// Quits the application.
|
||||
void quit();
|
||||
|
||||
|
@ -115,7 +115,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
// Setup single-instance behavior.
|
||||
QObject::connect(&application, SIGNAL(messageReceived(QString)),
|
||||
&main_window, SLOT(processExecutionMessage(QString)));
|
||||
&application, SLOT(processExecutionMessage(QString)));
|
||||
|
||||
// Enter global event loop.
|
||||
return Application::exec();
|
||||
|
@ -57,6 +57,25 @@ IconFactory *Application::icons() {
|
||||
return m_icons;
|
||||
}
|
||||
|
||||
void Application::processExecutionMessage(const QString &message) {
|
||||
qDebug("Received '%s' execution message from another application instance.",
|
||||
qPrintable(message));
|
||||
|
||||
if (message == APP_IS_RUNNING) {
|
||||
if (SystemTrayIcon::isSystemTrayActivated()) {
|
||||
qApp->trayIcon()->showMessage(APP_NAME,
|
||||
tr("Application is already running."),
|
||||
QSystemTrayIcon::Information,
|
||||
TRAY_ICON_BUBBLE_TIMEOUT);
|
||||
}
|
||||
|
||||
mainForm()->display();
|
||||
}
|
||||
else if (message == APP_QUIT_INSTANCE) {
|
||||
quit();
|
||||
}
|
||||
}
|
||||
|
||||
SystemTrayIcon *Application::trayIcon() {
|
||||
if (m_trayIcon == NULL) {
|
||||
m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm);
|
||||
|
@ -145,6 +145,10 @@ class Application : public QtSingleApplication {
|
||||
return static_cast<Application*>(QCoreApplication::instance());
|
||||
}
|
||||
|
||||
public slots:
|
||||
// Processes incoming message from another RSS Guard instance.
|
||||
void processExecutionMessage(const QString &message);
|
||||
|
||||
private slots:
|
||||
// Last-minute reactors.
|
||||
void onCommitData(QSessionManager &manager);
|
||||
|
Loading…
x
Reference in New Issue
Block a user