Changed: Show Uninstall Wizard Dialog

--HG--
branch : develop
This commit is contained in:
kervala 2016-05-29 20:30:12 +02:00
parent 2deadcce5c
commit 0d3443e4dd
4 changed files with 89 additions and 1 deletions

View file

@ -19,6 +19,7 @@
#include "configfile.h" #include "configfile.h"
#include "migratewizarddialog.h" #include "migratewizarddialog.h"
#include "installwizarddialog.h" #include "installwizarddialog.h"
#include "uninstallwizarddialog.h"
#include "operationdialog.h" #include "operationdialog.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
@ -90,7 +91,62 @@ int main(int argc, char *argv[])
return 1; 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<int> selectedServers;
QVector<int> 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) if (step == CConfigFile::ShowMigrateWizard)
{ {

View file

@ -18,6 +18,8 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "downloader.h" #include "downloader.h"
#include "profilesdialog.h" #include "profilesdialog.h"
#include "uninstallwizarddialog.h"
#include "operationdialog.h"
#include "configfile.h" #include "configfile.h"
#include "config.h" #include "config.h"
#include "profilesmodel.h" #include "profilesmodel.h"
@ -38,6 +40,7 @@ CMainWindow::CMainWindow():QMainWindow()
connect(m_downloader, SIGNAL(htmlPageContent(QString)), SLOT(onHtmlPageContent(QString))); connect(m_downloader, SIGNAL(htmlPageContent(QString)), SLOT(onHtmlPageContent(QString)));
connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles())); connect(actionProfiles, SIGNAL(triggered()), SLOT(onProfiles()));
connect(actionUninstall, SIGNAL(triggered()), SLOT(onUninstall()));
connect(playButton, SIGNAL(clicked()), SLOT(onPlayClicked())); connect(playButton, SIGNAL(clicked()), SLOT(onPlayClicked()));
connect(configureButton, SIGNAL(clicked()), SLOT(onConfigureClicked())); 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() void CMainWindow::onAbout()
{ {
QString br("<br>"); QString br("<br>");

View file

@ -42,6 +42,7 @@ public slots:
void onConfigureClicked(); void onConfigureClicked();
void onProfiles(); void onProfiles();
void onUninstall();
void onAbout(); void onAbout();
void onAboutQt(); void onAboutQt();

View file

@ -2,6 +2,14 @@
<ui version="4.0"> <ui version="4.0">
<class>MainWindow</class> <class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow"> <widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>547</width>
<height>386</height>
</rect>
</property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -117,6 +125,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<addaction name="actionProfiles"/> <addaction name="actionProfiles"/>
<addaction name="actionDirectories"/> <addaction name="actionDirectories"/>
<addaction name="actionUninstall"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionQuit"/> <addaction name="actionQuit"/>
</widget> </widget>
@ -155,6 +164,11 @@ p, li { white-space: pre-wrap; }
<string>&amp;Quit</string> <string>&amp;Quit</string>
</property> </property>
</action> </action>
<action name="actionUninstall">
<property name="text">
<string>&amp;Uninstall</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="../res/resources.qrc"/> <include location="../res/resources.qrc"/>