From 3f8b95eab26fb49c0b7ddc37603e422eb0fd532c Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 29 May 2016 20:30:12 +0200 Subject: [PATCH] Changed: Show Uninstall Wizard Dialog --- .../tools/client/ryzom_installer/src/main.cpp | 58 ++++++++++++++++++- .../client/ryzom_installer/src/mainwindow.cpp | 17 ++++++ .../client/ryzom_installer/src/mainwindow.h | 1 + .../client/ryzom_installer/ui/mainwindow.ui | 14 +++++ 4 files changed, 89 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/main.cpp b/code/ryzom/tools/client/ryzom_installer/src/main.cpp index b0d0e90ec..31f247a8f 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/main.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/main.cpp @@ -19,6 +19,7 @@ #include "configfile.h" #include "migratewizarddialog.h" #include "installwizarddialog.h" +#include "uninstallwizarddialog.h" #include "operationdialog.h" #include "nel/misc/path.h" @@ -90,7 +91,62 @@ int main(int argc, char *argv[]) return 1; } - bool displayMainWindow = true; + // use product name from installer.ini + if (!config.getProductName().isEmpty()) QApplication::setApplicationName(config.getProductName()); + + // define commandline arguments + QCommandLineParser parser; +// parser.setApplicationDescription(DESCRIPTION); + parser.addHelpOption(); + parser.addVersionOption(); + + // root, username and password are optional because they can be saved in settings file + QCommandLineOption uninstallOption(QStringList() << "u" << "uninstall", QApplication::tr("Uninstall")); + parser.addOption(uninstallOption); + + QCommandLineOption silentOption(QStringList() << "s" << "silent", QApplication::tr("Silent mode")); + parser.addOption(silentOption); + + // process the actual command line arguments given by the user + parser.process(app); + + if (parser.isSet(uninstallOption)) + { + QVector selectedServers; + QVector selectedProfiles; + bool selectedInstaller = true; + + // add all servers by default + for (int i = 0; i < config.getServersCount(); ++i) + { + selectedServers << i; + } + + // show uninstall wizard dialog if not in silent mode + if (!parser.isSet(silentOption)) + { + CUninstallWizardDialog dialog; + + if (dialog.exec()) + { + selectedServers = dialog.getSelectedServers(); + selectedProfiles = dialog.getSelectedProfiles(); + selectedInstaller = dialog.isInstallerSelected(); + } + } + + { + COperationDialog dialog; + + dialog.setOperation(COperationDialog::OperationUninstall); + + // TODO: set all components to uninstall + + if (dialog.exec()) return 0; + } + + return 1; + } if (step == CConfigFile::ShowMigrateWizard) { diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp index ff70f3376..21e1af181 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.cpp @@ -18,6 +18,8 @@ #include "mainwindow.h" #include "downloader.h" #include "profilesdialog.h" +#include "uninstallwizarddialog.h" +#include "operationdialog.h" #include "configfile.h" #include "config.h" #include "profilesmodel.h" @@ -38,6 +40,7 @@ CMainWindow::CMainWindow():QMainWindow() connect(m_downloader, SIGNAL(htmlPageContent(QString)), SLOT(onHtmlPageContent(QString))); connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles())); + connect(actionUninstall, SIGNAL(triggered()), SLOT(onUninstall())); connect(playButton, SIGNAL(clicked()), SLOT(onPlayClicked())); connect(configureButton, SIGNAL(clicked()), SLOT(onConfigureClicked())); @@ -124,6 +127,20 @@ void CMainWindow::onProfiles() } } +void CMainWindow::onUninstall() +{ + CUninstallWizardDialog dialog(this); + + if (dialog.exec()) + { + COperationDialog dialog(&dialog); + + dialog.setOperation(COperationDialog::OperationUninstall); + + dialog.exec(); + } +} + void CMainWindow::onAbout() { QString br("
"); diff --git a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h index bbc9121cd..fbd4ec1aa 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h +++ b/code/ryzom/tools/client/ryzom_installer/src/mainwindow.h @@ -42,6 +42,7 @@ public slots: void onConfigureClicked(); void onProfiles(); + void onUninstall(); void onAbout(); void onAboutQt(); diff --git a/code/ryzom/tools/client/ryzom_installer/ui/mainwindow.ui b/code/ryzom/tools/client/ryzom_installer/ui/mainwindow.ui index ed8188a1d..e687996b3 100644 --- a/code/ryzom/tools/client/ryzom_installer/ui/mainwindow.ui +++ b/code/ryzom/tools/client/ryzom_installer/ui/mainwindow.ui @@ -2,6 +2,14 @@ MainWindow + + + 0 + 0 + 547 + 386 + + 0 @@ -117,6 +125,7 @@ p, li { white-space: pre-wrap; } + @@ -155,6 +164,11 @@ p, li { white-space: pre-wrap; } &Quit + + + &Uninstall + +