Removed "restart" feature.

This commit is contained in:
Martin Rotter 2016-05-25 12:33:41 +02:00
parent 72fe4be1c7
commit 59bab63f9e
9 changed files with 20 additions and 69 deletions

View File

@ -61,8 +61,8 @@ project(rssguard)
set(APP_NAME "RSS Guard") set(APP_NAME "RSS Guard")
set(APP_LOW_NAME "rssguard") set(APP_LOW_NAME "rssguard")
set(APP_VERSION "3.2.4") set(APP_VERSION "3.2.5")
set(FILE_VERSION "3,2,4,0") set(FILE_VERSION "3,2,5,0")
set(APP_AUTHOR "Martin Rotter") set(APP_AUTHOR "Martin Rotter")
set(APP_URL "http://bitbucket.org/skunkos/rssguard") set(APP_URL "http://bitbucket.org/skunkos/rssguard")
set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues") set(APP_URL_ISSUES "http://bitbucket.org/skunkos/rssguard/issues")

View File

@ -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 3.2.4
————— —————

View File

@ -96,7 +96,6 @@ QList<QAction*> FormMain::allActions() const {
actions << m_ui->m_actionDownloadManager; actions << m_ui->m_actionDownloadManager;
actions << m_ui->m_actionRestoreDatabaseSettings; actions << m_ui->m_actionRestoreDatabaseSettings;
actions << m_ui->m_actionBackupDatabaseSettings; actions << m_ui->m_actionBackupDatabaseSettings;
actions << m_ui->m_actionRestart;
actions << m_ui->m_actionQuit; actions << m_ui->m_actionQuit;
actions << m_ui->m_actionFullscreen; actions << m_ui->m_actionFullscreen;
actions << m_ui->m_actionAboutGuard; 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_actionDownloadManager->setIcon(icon_theme_factory->fromTheme(QSL("emblem-downloads")));
m_ui->m_actionSettings->setIcon(icon_theme_factory->fromTheme(QSL("emblem-system"))); 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_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_actionAboutGuard->setIcon(icon_theme_factory->fromTheme(QSL("help-about")));
m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("applications-internet"))); m_ui->m_actionCheckForUpdates->setIcon(icon_theme_factory->fromTheme(QSL("applications-internet")));
m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear"))); m_ui->m_actionCleanupDatabase->setIcon(icon_theme_factory->fromTheme(QSL("edit-clear")));
@ -457,7 +455,6 @@ void FormMain::createConnections() {
// Menu "File" connections. // Menu "File" connections.
connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings())); connect(m_ui->m_actionBackupDatabaseSettings, SIGNAL(triggered()), this, SLOT(backupDatabaseSettings()));
connect(m_ui->m_actionRestoreDatabaseSettings, SIGNAL(triggered()), this, SLOT(restoreDatabaseSettings())); 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_actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(m_ui->m_actionServiceAdd, SIGNAL(triggered()), this, SLOT(showAddAccountDialog())); connect(m_ui->m_actionServiceAdd, SIGNAL(triggered()), this, SLOT(showAddAccountDialog()));
@ -488,10 +485,6 @@ void FormMain::backupDatabaseSettings() {
void FormMain::restoreDatabaseSettings() { void FormMain::restoreDatabaseSettings() {
QScopedPointer<FormRestoreDatabaseSettings> form(new FormRestoreDatabaseSettings(this)); QScopedPointer<FormRestoreDatabaseSettings> form(new FormRestoreDatabaseSettings(this));
form->exec(); form->exec();
if (form->shouldRestart()) {
qApp->restart();
}
} }
void FormMain::changeEvent(QEvent *event) { void FormMain::changeEvent(QEvent *event) {

View File

@ -58,7 +58,6 @@
<addaction name="m_actionRestoreDatabaseSettings"/> <addaction name="m_actionRestoreDatabaseSettings"/>
<addaction name="m_actionBackupDatabaseSettings"/> <addaction name="m_actionBackupDatabaseSettings"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="m_actionRestart"/>
<addaction name="m_actionQuit"/> <addaction name="m_actionQuit"/>
</widget> </widget>
<widget class="QMenu" name="m_menuHelp"> <widget class="QMenu" name="m_menuHelp">
@ -540,14 +539,6 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
</action> </action>
<action name="m_actionRestart">
<property name="text">
<string>&amp;Restart</string>
</property>
<property name="shortcut">
<string notr="true"/>
</property>
</action>
<action name="m_actionRestoreDatabaseSettings"> <action name="m_actionRestoreDatabaseSettings">
<property name="text"> <property name="text">
<string>&amp;Restore database/settings</string> <string>&amp;Restore database/settings</string>

View File

@ -26,19 +26,14 @@
FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent) 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_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.")); m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
setWindowIcon(qApp->icons()->fromTheme(QSL("document-import"))); setWindowIcon(qApp->icons()->fromTheme(QSL("document-import")));
setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint); 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_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton())); connect(m_ui->m_groupDatabase, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
connect(m_ui->m_groupSettings, 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->currentRow() >= 0 ?
m_ui->m_listSettings->currentItem()->data(Qt::UserRole).toString() : m_ui->m_listSettings->currentItem()->data(Qt::UserRole).toString() :
QString()); QString());
m_btnRestart->setEnabled(true);
m_ui->m_lblResult->setStatus(WidgetWithStatus::Ok, tr("Restoration was initiated. Restart to proceed."), 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.")); tr("You need to restart application for restoration process to finish."));
} }
@ -74,7 +68,6 @@ void FormRestoreDatabaseSettings::performRestoration() {
} }
void FormRestoreDatabaseSettings::checkOkButton() { 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_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!m_ui->m_lblSelectFolder->label()->text().isEmpty() &&
((m_ui->m_groupDatabase->isChecked() && ((m_ui->m_groupDatabase->isChecked() &&
m_ui->m_listDatabase->currentRow() >= 0) || m_ui->m_listDatabase->currentRow() >= 0) ||

View File

@ -35,10 +35,6 @@ class FormRestoreDatabaseSettings : public QDialog {
explicit FormRestoreDatabaseSettings(QWidget *parent = 0); explicit FormRestoreDatabaseSettings(QWidget *parent = 0);
virtual ~FormRestoreDatabaseSettings(); virtual ~FormRestoreDatabaseSettings();
bool shouldRestart() const {
return m_shouldRestart;
}
private slots: private slots:
void performRestoration(); void performRestoration();
void checkOkButton(); void checkOkButton();
@ -46,9 +42,6 @@ class FormRestoreDatabaseSettings : public QDialog {
private: private:
QScopedPointer<Ui::FormRestoreDatabaseSettings> m_ui; QScopedPointer<Ui::FormRestoreDatabaseSettings> m_ui;
QPushButton *m_btnRestart;
bool m_shouldRestart;
}; };
#endif // FORMRESTOREDATABASESETTINGS_H #endif // FORMRESTOREDATABASESETTINGS_H

View File

@ -335,18 +335,14 @@ bool FormSettings::doSaveCheck() {
void FormSettings::promptForRestart() { void FormSettings::promptForRestart() {
if (!m_changedDataTexts.isEmpty()) { if (!m_changedDataTexts.isEmpty()) {
const QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8("")); const QStringList changed_settings_description = m_changedDataTexts.replaceInStrings(QRegExp(QSL("^")), QString::fromUtf8(""));
const QMessageBox::StandardButton clicked_button = MessageBox::show(this, MessageBox::show(this,
QMessageBox::Question, QMessageBox::Question,
tr("Critical settings were changed"), tr("Critical settings were changed"),
tr("Some critical settings were changed and will be applied after the application gets restarted. " tr("Some critical settings were changed and will be applied after the application gets restarted. "
"\n\nYou have to restart manually."), "\n\nYou have to restart manually."),
tr("Do you want to restart now?"), QString(),
tr("List of changes:\n%1.").arg(changed_settings_description .join(QSL(",\n"))), tr("List of changes:\n%1.").arg(changed_settings_description .join(QSL(",\n"))),
QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); QMessageBox::Ok, QMessageBox::Ok);
if (clicked_button == QMessageBox::Yes) {
qApp->restart();
}
} }
} }
@ -681,7 +677,7 @@ void FormSettings::saveGeneral() {
m_settings->setValue(GROUP(General), General::RemoveTrolltechJunk, m_ui->m_checkRemoveTrolltechJunk->isChecked()); m_settings->setValue(GROUP(General), General::RemoveTrolltechJunk, m_ui->m_checkRemoveTrolltechJunk->isChecked());
} }
void FormSettings::loadInterface() { void FormSettings::loadInterface() {
// Load settings of tray icon. // Load settings of tray icon.
if (SystemTrayIcon::isSystemTrayAvailable()) { if (SystemTrayIcon::isSystemTrayAvailable()) {
m_ui->m_grpTray->setChecked(m_settings->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool()); m_ui->m_grpTray->setChecked(m_settings->value(GROUP(GUI), SETTING(GUI::UseTrayIcon)).toBool());

View File

@ -42,7 +42,7 @@ Application::Application(const QString &id, int &argc, char **argv)
: QtSingleApplication(id, argc, argv), : QtSingleApplication(id, argc, argv),
m_updateFeedsLock(NULL), m_feedServices(QList<ServiceEntryPoint*>()), m_userActions(QList<QAction*>()), m_mainForm(NULL), m_updateFeedsLock(NULL), m_feedServices(QList<ServiceEntryPoint*>()), 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_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(aboutToQuit()), this, SLOT(onAboutToQuit()));
connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&))); connect(this, SIGNAL(commitDataRequest(QSessionManager&)), this, SLOT(onCommitData(QSessionManager&)));
connect(this, SIGNAL(saveStateRequest(QSessionManager&)), this, SLOT(onSaveState(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. // that some critical action can be processed right now.
qDebug("Close lock timed-out."); 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();
} }

View File

@ -158,9 +158,6 @@ class Application : public QtSingleApplication {
} }
public slots: public slots:
// Restarts the application.
void restart();
// 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);
@ -198,7 +195,6 @@ class Application : public QtSingleApplication {
IconFactory *m_icons; IconFactory *m_icons;
DatabaseFactory *m_database; DatabaseFactory *m_database;
DownloadManager *m_downloadManager; DownloadManager *m_downloadManager;
bool m_shouldRestart;
}; };
#endif // APPLICATION_H #endif // APPLICATION_H