From 5050a2bfa008a86e995ff29be1cf03929f44af54 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:12:49 +0200 Subject: [PATCH 1/7] Fixed: Infinite loop when clicking on OK in profiles dialog, see #279 --HG-- branch : develop --- .../ryzom_installer/src/operationdialog.cpp | 24 +++++++++++++++---- .../ryzom_installer/src/operationdialog.h | 4 ++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index da7a2f52d..6ea65aeeb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -92,7 +92,7 @@ void COperationDialog::processNextStep() { if (operationShouldStop()) { - reject(); + rejectDelayed(); return; } @@ -184,7 +184,7 @@ void COperationDialog::processInstallNextStep() break; case Done: - accept(); + acceptDelayed(); break; default: @@ -253,6 +253,8 @@ void COperationDialog::updateAddRemoveComponents() void COperationDialog::processUpdateProfilesNextStep() { + m_currentOperation = tr("Update profiles"); + // for "update profiles" operations, we set installer to false when components are updated, // since we're not using this variable if (m_addComponents.installer && m_removeComponents.installer) @@ -344,6 +346,8 @@ void COperationDialog::processUpdateProfilesNextStep() } updateAddRemoveEntry(); + + acceptDelayed(); } void COperationDialog::processUninstallNextStep() @@ -369,7 +373,7 @@ void COperationDialog::processUninstallNextStep() else { // done - accept(); + acceptDelayed(); } } @@ -460,7 +464,7 @@ void COperationDialog::onProgressStop() m_button->progress()->hide(); #endif - reject(); + rejectDelayed(); } void COperationDialog::onProgressProgress(qint64 current, const QString &filename) @@ -1247,3 +1251,15 @@ void COperationDialog::renamePartFile() QFile::rename(partFile, finalFile); } } + +void COperationDialog::acceptDelayed() +{ + // wait 500ms before to call accept() + QTimer::singleShot(500, this, SLOT(accept())); +} + +void COperationDialog::rejectDelayed() +{ + // wait 500ms before to call reject() + QTimer::singleShot(500, this, SLOT(reject())); +} diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index e9966c4d2..d2172815c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -133,6 +133,10 @@ protected: void renamePartFile(); + // hacks to prevent an infinite loop + void acceptDelayed(); + void rejectDelayed(); + QWinTaskbarButton *m_button; CDownloader *m_downloader; From fb934818a7c43f12105682aac7f0f3f0ae46eb3f Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:13:20 +0200 Subject: [PATCH 2/7] Fixed: Only ask once if user want to uninstall Ryzom, see #279 --HG-- branch : develop --- .../tools/client/ryzom_installer/src/operationdialog.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 6ea65aeeb..5f3215e31 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -793,9 +793,14 @@ void COperationDialog::uninstallOldClient() if (button == QMessageBox::Yes) { + // remember the choice CConfigFile::getInstance()->setShouldUninstallOldClient(true); + // launch old uninstaller QDesktopServices::openUrl(QUrl::fromLocalFile(uninstaller)); + + // to not ask twice + CConfigFile::getInstance()->setUninstallingOldClient(true); } else { From 742f8ab2e40b05408b1a7fc5bf9f0f26b8d0f768 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:14:00 +0200 Subject: [PATCH 3/7] Changed: Disable button if executable not found, see #279 --HG-- branch : develop --- .../client/ryzom_installer/src/mainwindow.cpp | 26 +++++++++++++++++++ .../client/ryzom_installer/src/mainwindow.h | 1 + 2 files changed, 27 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index 55aa3b5bc..a36ed9b59 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -60,6 +60,7 @@ CMainWindow::CMainWindow():QMainWindow() setFixedHeight(height()); updateProfiles(); + updateButtons(); } CMainWindow::~CMainWindow() @@ -83,6 +84,28 @@ void CMainWindow::updateProfiles() profilesComboBox->setModel(new CProfilesModel(this)); } +void CMainWindow::updateButtons() +{ + int profileIndex = profilesComboBox->currentIndex(); + + if (profileIndex < 0) return; + + CConfigFile *config = CConfigFile::getInstance(); + + const CProfile &profile = config->getProfile(profileIndex); + const CServer &server = config->getServer(profile.server); + + // get full path of client executable + QString executable = profile.getClientFullPath(); + + playButton->setEnabled(!executable.isEmpty() && QFile::exists(executable)); + + // get full path of configuration executable + executable = server.getConfigurationFullPath(); + + configureButton->setEnabled(!executable.isEmpty() && QFile::exists(executable)); +} + void CMainWindow::onPlayClicked() { int profileIndex = profilesComboBox->currentIndex(); @@ -123,6 +146,7 @@ void CMainWindow::onConfigureClicked() const CProfile &profile = config->getProfile(profileIndex); const CServer &server = config->getServer(profile.server); + // get full path of configuration executable QString executable = server.getConfigurationFullPath(); if (executable.isEmpty() || !QFile::exists(executable)) return; @@ -262,4 +286,6 @@ void CMainWindow::onProfileChanged(int profileIndex) // load changelog m_downloader->getHtmlPageContent(config->expandVariables(server.displayUrl)); + + updateButtons(); } diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h index 0f7d88138..7449b2039 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h @@ -61,6 +61,7 @@ protected: void closeEvent(QCloseEvent *e); void updateProfiles(); + void updateButtons(); QWinTaskbarButton *m_button; CDownloader *m_downloader; From 7191bf1b41211f3d8de0a6bc214eab794e4db004 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:14:34 +0200 Subject: [PATCH 4/7] Changed: Disable Settings and Uninstall menus (only there for debugging purposes), see #279 --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index a36ed9b59..0f196a787 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -41,6 +41,11 @@ CMainWindow::CMainWindow():QMainWindow() connect(m_downloader, SIGNAL(htmlPageContent(QString)), SLOT(onHtmlPageContent(QString))); connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles())); + + // remove debug options + actionSettings->setVisible(false); + actionUninstall->setVisible(false); + connect(actionSettings, SIGNAL(triggered()), SLOT(onSettings())); connect(actionUninstall, SIGNAL(triggered()), SLOT(onUninstall())); connect(actionQuit, SIGNAL(triggered()), SLOT(onQuit())); From 75d3db65e8037606c9597f65b1fd369f4cf0f7e3 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:14:56 +0200 Subject: [PATCH 5/7] Fixed: Only ask once if user want to uninstall Ryzom, see #279 --HG-- branch : develop --- .../client/ryzom_installer/src/configfile.cpp | 15 +++++++++++++-- .../tools/client/ryzom_installer/src/configfile.h | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 7b3952a22..f23976cd9 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -27,7 +27,8 @@ CConfigFile *CConfigFile::s_instance = NULL; CConfigFile::CConfigFile(QObject *parent):QObject(parent), m_version(-1), - m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true) + m_defaultServerIndex(0), m_defaultProfileIndex(0), m_use64BitsClient(false), m_shouldUninstallOldClient(true), + m_uninstallingOldClient(false) { s_instance = this; @@ -461,6 +462,16 @@ void CConfigFile::setShouldUninstallOldClient(bool on) m_shouldUninstallOldClient = on; } +bool CConfigFile::uninstallingOldClient() const +{ + return m_uninstallingOldClient; +} + +void CConfigFile::setUninstallingOldClient(bool on) +{ + m_uninstallingOldClient = on; +} + QString CConfigFile::expandVariables(const QString &str) const { QString res = str; @@ -972,7 +983,7 @@ OperationStep CConfigFile::getInstallNextStep() const if (!settings.contains("InstallLocation")) return CreateAddRemoveEntry; #endif - if (m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) + if (!m_uninstallingOldClient && m_shouldUninstallOldClient && !getSrcServerDirectory().isEmpty() && QFile::exists(getSrcServerDirectory() + "/Uninstall.exe")) { return UninstallOldClient; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.h b/code/ryzom/tools/client/ryzom_installer/src/configfile.h index b2a4ae7e5..5c2a4dacc 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.h +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.h @@ -109,6 +109,9 @@ public: bool shouldUninstallOldClient() const; void setShouldUninstallOldClient(bool on); + bool uninstallingOldClient() const; + void setUninstallingOldClient(bool on); + QString expandVariables(const QString &str) const; QString getClientArch() const; @@ -147,6 +150,7 @@ private: QString m_srcDirectory; bool m_use64BitsClient; bool m_shouldUninstallOldClient; + bool m_uninstallingOldClient; QString m_language; QString m_defaultConfigPath; From cf5a1a5a85f13f3c13ac8e7dbc662e18749fdafb Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:15:31 +0200 Subject: [PATCH 6/7] Fixed: Browse buttons were freezing the application, see #279 --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 6a9662c4f..4658a3b99 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -86,6 +86,11 @@ int main(int argc, char *argv[]) _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif +#ifdef Q_OS_WIN + // to fix the bug with QFileDialog::getExistingDirectory hanging under Windows + CoInitialize(NULL); +#endif + NLMISC::CApplicationContext appContext; QApplication app(argc, argv); From ba5574624a5001607ab231cabc298c52b0829be1 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 14 Sep 2016 08:16:00 +0200 Subject: [PATCH 7/7] Fixed: Don't restart Installer if in Debug, see #279 --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index 4658a3b99..3d7ee1d1c 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -223,8 +223,10 @@ int main(int argc, char *argv[]) if (step == Done) { +#if defined(Q_OS_WIN) && !defined(_DEBUG) // restart Installer, so it could be copied in TEMP and allowed to update itself if (QProcess::startDetached(QApplication::applicationFilePath(), QApplication::arguments())) return 0; +#endif } }