From 59bab63f9ef62523906bb666e08147b99d6d2786 Mon Sep 17 00:00:00 2001 From: Martin Rotter Date: Wed, 25 May 2016 12:33:41 +0200 Subject: [PATCH] Removed "restart" feature. --- CMakeLists.txt | 4 ++-- resources/text/CHANGELOG | 7 ++++++ src/gui/dialogs/formmain.cpp | 7 ------ src/gui/dialogs/formmain.ui | 9 -------- .../dialogs/formrestoredatabasesettings.cpp | 9 +------- src/gui/dialogs/formrestoredatabasesettings.h | 7 ------ src/gui/dialogs/formsettings.cpp | 22 ++++++++----------- src/miscellaneous/application.cpp | 20 +---------------- src/miscellaneous/application.h | 4 ---- 9 files changed, 20 insertions(+), 69 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fed3b93a2..7e9b56628 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,8 +61,8 @@ project(rssguard) set(APP_NAME "RSS Guard") set(APP_LOW_NAME "rssguard") -set(APP_VERSION "3.2.4") -set(FILE_VERSION "3,2,4,0") +set(APP_VERSION "3.2.5") +set(FILE_VERSION "3,2,5,0") set(APP_AUTHOR "Martin Rotter") set(APP_URL "http://bitbucket.org/skunkos/rssguard") set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues") diff --git a/resources/text/CHANGELOG b/resources/text/CHANGELOG index 642eb4517..76cde007f 100755 --- a/resources/text/CHANGELOG +++ b/resources/text/CHANGELOG @@ -1,3 +1,10 @@ +3.2.5 +————— + +Fixed: + +▪ Removed "Restart" functionality, it was buggy and was causing a lot of internal problems, primarily with storing settings. + 3.2.4 ————— diff --git a/src/gui/dialogs/formmain.cpp b/src/gui/dialogs/formmain.cpp index e768095fb..7c497742b 100755 --- a/src/gui/dialogs/formmain.cpp +++ b/src/gui/dialogs/formmain.cpp @@ -96,7 +96,6 @@ QList FormMain::allActions() const { actions << m_ui->m_actionDownloadManager; actions << m_ui->m_actionRestoreDatabaseSettings; actions << m_ui->m_actionBackupDatabaseSettings; - actions << m_ui->m_actionRestart; actions << m_ui->m_actionQuit; actions << m_ui->m_actionFullscreen; actions << m_ui->m_actionAboutGuard; @@ -329,7 +328,6 @@ void FormMain::setupIcons() { m_ui->m_actionDownloadManager->setIcon(icon_theme_factory->fromTheme(QSL("emblem-downloads"))); m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme(QSL("emblem-system"))); m_ui->m_actionQuit->setIcon(icon_theme_factory->fromTheme(QSL("application-exit"))); - m_ui->m_actionRestart->setIcon(icon_theme_factory->fromTheme(QSL("view-refresh"))); m_ui->m_actionAboutGuard->setIcon(icon_theme_factory->fromTheme(QSL("help-about"))); m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("applications-internet"))); m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear"))); @@ -457,7 +455,6 @@ void FormMain::createConnections() { // Menu "File" connections. connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings())); connect(m_ui->m_actionRestoreDatabaseSettings, SIGNAL(triggered()), this, SLOT(restoreDatabaseSettings())); - connect(m_ui->m_actionRestart, SIGNAL(triggered()), qApp, SLOT(restart())); connect(m_ui->m_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); connect(m_ui->m_actionServiceAdd, SIGNAL(triggered()), this, SLOT(showAddAccountDialog())); @@ -488,10 +485,6 @@ void FormMain::backupDatabaseSettings() { void FormMain::restoreDatabaseSettings() { QScopedPointer form(new FormRestoreDatabaseSettings(this)); form->exec(); - - if (form->shouldRestart()) { - qApp->restart(); - } } void FormMain::changeEvent(QEvent *event) { diff --git a/src/gui/dialogs/formmain.ui b/src/gui/dialogs/formmain.ui index 191c09c09..1f8f2f5ad 100755 --- a/src/gui/dialogs/formmain.ui +++ b/src/gui/dialogs/formmain.ui @@ -58,7 +58,6 @@ - @@ -540,14 +539,6 @@ - - - &Restart - - - - - &Restore database/settings diff --git a/src/gui/dialogs/formrestoredatabasesettings.cpp b/src/gui/dialogs/formrestoredatabasesettings.cpp index 354f99691..9f9e52f82 100755 --- a/src/gui/dialogs/formrestoredatabasesettings.cpp +++ b/src/gui/dialogs/formrestoredatabasesettings.cpp @@ -26,19 +26,14 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent) - : QDialog(parent), m_ui(new Ui::FormRestoreDatabaseSettings), m_shouldRestart(false) { + : QDialog(parent), m_ui(new Ui::FormRestoreDatabaseSettings) { m_ui->setupUi(this); - m_btnRestart = m_ui->m_buttonBox->addButton(tr("Restart"), QDialogButtonBox::ActionRole); m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet.")); setWindowIcon(qApp->icons()->fromTheme(QSL("document-import"))); setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint); - connect(m_btnRestart, &QPushButton::clicked, this, [=]() { - m_shouldRestart = true; - close(); - }); connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder())); connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton())); connect(m_ui->m_groupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton())); @@ -63,7 +58,6 @@ void FormRestoreDatabaseSettings::performRestoration() { m_ui->m_listSettings->currentRow() >= 0 ? m_ui->m_listSettings->currentItem()->data(Qt::UserRole).toString() : QString()); - m_btnRestart->setEnabled(true); m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Restoration was initiated. Restart to proceed."), tr("You need to restart application for restoration process to finish.")); } @@ -74,7 +68,6 @@ void FormRestoreDatabaseSettings::performRestoration() { } void FormRestoreDatabaseSettings::checkOkButton() { - m_btnRestart->setEnabled(false); m_ui->m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!m_ui->m_lblSelectFolder->label()->text().isEmpty() && ((m_ui->m_groupDatabase->isChecked() && m_ui->m_listDatabase->currentRow() >= 0) || diff --git a/src/gui/dialogs/formrestoredatabasesettings.h b/src/gui/dialogs/formrestoredatabasesettings.h index 93cf608f9..fb1c2ba93 100755 --- a/src/gui/dialogs/formrestoredatabasesettings.h +++ b/src/gui/dialogs/formrestoredatabasesettings.h @@ -35,10 +35,6 @@ class FormRestoreDatabaseSettings : public QDialog { explicit FormRestoreDatabaseSettings(QWidget *parent = 0); virtual ~FormRestoreDatabaseSettings(); - bool shouldRestart() const { - return m_shouldRestart; - } - private slots: void performRestoration(); void checkOkButton(); @@ -46,9 +42,6 @@ class FormRestoreDatabaseSettings : public QDialog { private: QScopedPointer m_ui; - QPushButton *m_btnRestart; - - bool m_shouldRestart; }; #endif // FORMRESTOREDATABASESETTINGS_H diff --git a/src/gui/dialogs/formsettings.cpp b/src/gui/dialogs/formsettings.cpp index a833460d3..6edf1f7c9 100755 --- a/src/gui/dialogs/formsettings.cpp +++ b/src/gui/dialogs/formsettings.cpp @@ -335,18 +335,14 @@ bool FormSettings::doSaveCheck() { void FormSettings::promptForRestart() { if (!m_changedDataTexts.isEmpty()) { const QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(" • ")); - const QMessageBox::StandardButton clicked_button = MessageBox::show(this, - QMessageBox::Question, - tr("Critical settings were changed"), - tr("Some critical settings were changed and will be applied after the application gets restarted. " - "\n\nYou have to restart manually."), - tr("Do you want to restart now?"), - tr("List of changes:\n%1.").arg(changed_settings_description .join(QSL(",\n"))), - QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); - - if (clicked_button == QMessageBox::Yes) { - qApp->restart(); - } + MessageBox::show(this, + QMessageBox::Question, + tr("Critical settings were changed"), + tr("Some critical settings were changed and will be applied after the application gets restarted. " + "\n\nYou have to restart manually."), + QString(), + tr("List of changes:\n%1.").arg(changed_settings_description .join(QSL(",\n"))), + QMessageBox::Ok, QMessageBox::Ok); } } @@ -681,7 +677,7 @@ void FormSettings::saveGeneral() { m_settings->setValue(GROUP(General), General::RemoveTrolltechJunk, m_ui->m_checkRemoveTrolltechJunk->isChecked()); } -void FormSettings::loadInterface() { +void FormSettings::loadInterface() { // Load settings of tray icon. if (SystemTrayIcon::isSystemTrayAvailable()) { m_ui->m_grpTray->setChecked(m_settings->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool()); diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 3d7031880..7a5a92e12 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -42,7 +42,7 @@ Application::Application(const QString &id, int &argc, char **argv) : QtSingleApplication(id, argc, argv), m_updateFeedsLock(NULL), m_feedServices(QList()), m_userActions(QList()), m_mainForm(NULL), m_trayIcon(NULL), m_settings(NULL), m_system(NULL), m_skins(NULL), - m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(NULL), m_shouldRestart(false) { + m_localization(NULL), m_icons(NULL), m_database(NULL), m_downloadManager(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&))); @@ -280,22 +280,4 @@ void Application::onAboutToQuit() { // that some critical action can be processed right now. qDebug("Close lock timed-out."); } - - // Now, we can check if application should just quit or restart itself. - if (m_shouldRestart) { - finish(); - qDebug("Killing local peer connection to allow another instance to start."); - - if (QProcess::startDetached(QString("\"") + QDir::toNativeSeparators(applicationFilePath()) + QString("\""))) { - qDebug("New application instance was started."); - } - else { - qWarning("New application instance was not started successfully."); - } - } -} - -void Application::restart() { - m_shouldRestart = true; - quit(); } diff --git a/src/miscellaneous/application.h b/src/miscellaneous/application.h index 849ecef49..566477289 100755 --- a/src/miscellaneous/application.h +++ b/src/miscellaneous/application.h @@ -158,9 +158,6 @@ class Application : public QtSingleApplication { } public slots: - // Restarts the application. - void restart(); - // Processes incoming message from another RSS Guard instance. void processExecutionMessage(const QString &message); @@ -198,7 +195,6 @@ class Application : public QtSingleApplication { IconFactory *m_icons; DatabaseFactory *m_database; DownloadManager *m_downloadManager; - bool m_shouldRestart; }; #endif // APPLICATION_H