mirror of
https://github.com/ioquake/launch.git
synced 2024-11-14 00:10:57 +00:00
Added "install" wizard page for selecting pak0.pk3 location and Q3A destination directory.
This commit is contained in:
parent
7bbffd9cfc
commit
37b0276f64
12 changed files with 201 additions and 18 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include "installwizard_installtype.h"
|
#include "installwizard_installtype.h"
|
||||||
#include "installwizard_locate.h"
|
#include "installwizard_locate.h"
|
||||||
#include "installwizard_eula.h"
|
#include "installwizard_eula.h"
|
||||||
|
#include "installwizard_install.h"
|
||||||
#include "installwizard_patch.h"
|
#include "installwizard_patch.h"
|
||||||
#include "installwizard_finished.h"
|
#include "installwizard_finished.h"
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
|
@ -30,6 +31,7 @@ InstallWizard::InstallWizard(QWidget *parent, Settings *settings) :
|
||||||
setPage(Page_Locate, new InstallWizard_LocatePage(this, settings));
|
setPage(Page_Locate, new InstallWizard_LocatePage(this, settings));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
setPage(Page_Install, new InstallWizard_Install());
|
||||||
setPage(Page_Eula, new InstallWizard_Eula());
|
setPage(Page_Eula, new InstallWizard_Eula());
|
||||||
setPage(Page_Patch, new InstallWizard_Patch());
|
setPage(Page_Patch, new InstallWizard_Patch());
|
||||||
setPage(Page_Finished, new InstallWizard_Finished());
|
setPage(Page_Finished, new InstallWizard_Finished());
|
||||||
|
|
|
@ -22,6 +22,7 @@ public:
|
||||||
{
|
{
|
||||||
Page_InstallType,
|
Page_InstallType,
|
||||||
Page_Locate,
|
Page_Locate,
|
||||||
|
Page_Install,
|
||||||
Page_Eula,
|
Page_Eula,
|
||||||
Page_Patch,
|
Page_Patch,
|
||||||
Page_Finished
|
Page_Finished
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Quake 3: Arena Install Wizard</string>
|
<string>Quake III Arena Install Wizard</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="imgs.qrc">
|
<iconset resource="imgs.qrc">
|
||||||
|
|
70
installwizard_install.cpp
Normal file
70
installwizard_install.cpp
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include "installwizard_install.h"
|
||||||
|
#include "ui_installwizard_install.h"
|
||||||
|
#include "installwizard.h"
|
||||||
|
|
||||||
|
InstallWizard_Install::InstallWizard_Install(QWidget *parent) :
|
||||||
|
QWizardPage(parent),
|
||||||
|
ui(new Ui::InstallWizard_Install)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
InstallWizard_Install::~InstallWizard_Install()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallWizard_Install::initializePage()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
// Use the same default install directory as the Q3A installer.
|
||||||
|
ui->txtDest->setText(QString(qgetenv("PROGRAMFILES").constData()) + QString("\\Quake III Arena"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
registerField("pak0*", ui->txtSource);
|
||||||
|
registerField("quake3Path*", ui->txtDest);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InstallWizard_Install::validatePage()
|
||||||
|
{
|
||||||
|
if (!QFileInfo::exists(ui->txtSource->text()))
|
||||||
|
{
|
||||||
|
QMessageBox::warning(wizard(), "Missing source", QString("Source file '%1' does not exist.").arg(ui->txtSource->text()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool InstallWizard_Install::isComplete() const
|
||||||
|
{
|
||||||
|
return !ui->txtSource->text().isEmpty() && !ui->txtDest->text().isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
int InstallWizard_Install::nextId() const
|
||||||
|
{
|
||||||
|
return InstallWizard::Page_Finished;
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallWizard_Install::on_btnBrowseSource_clicked()
|
||||||
|
{
|
||||||
|
const QString location = QFileDialog::getOpenFileName(wizard(), "Select pak0.pk3 location", QString(), "Quake III Arena Pak File (pak0.pk3)");
|
||||||
|
|
||||||
|
if (!location.isEmpty())
|
||||||
|
{
|
||||||
|
ui->txtSource->setText(location);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallWizard_Install::on_btnBrowseDest_clicked()
|
||||||
|
{
|
||||||
|
const QString location = QFileDialog::getExistingDirectory(this, tr("Select Quake III Arena Location"), ui->txtDest->text());
|
||||||
|
|
||||||
|
if (!location.isEmpty())
|
||||||
|
{
|
||||||
|
ui->txtDest->setText(location);
|
||||||
|
}
|
||||||
|
}
|
31
installwizard_install.h
Normal file
31
installwizard_install.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#ifndef INSTALLWIZARD_INSTALL_H
|
||||||
|
#define INSTALLWIZARD_INSTALL_H
|
||||||
|
|
||||||
|
#include <QWizardPage>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class InstallWizard_Install;
|
||||||
|
}
|
||||||
|
|
||||||
|
class InstallWizard_Install : public QWizardPage
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit InstallWizard_Install(QWidget *parent = 0);
|
||||||
|
~InstallWizard_Install();
|
||||||
|
virtual void initializePage();
|
||||||
|
virtual bool validatePage();
|
||||||
|
virtual bool isComplete() const;
|
||||||
|
virtual int nextId() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_btnBrowseSource_clicked();
|
||||||
|
|
||||||
|
void on_btnBrowseDest_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::InstallWizard_Install *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // INSTALLWIZARD_INSTALL_H
|
63
installwizard_install.ui
Normal file
63
installwizard_install.ui
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>InstallWizard_Install</class>
|
||||||
|
<widget class="QWizardPage" name="InstallWizard_Install">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>WizardPage</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Source (pak0.pk3):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtSource"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnBrowseSource">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Destination:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="txtDest"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnBrowseDest">
|
||||||
|
<property name="text">
|
||||||
|
<string>Browse...</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -1,5 +1,6 @@
|
||||||
#include "installwizard_installtype.h"
|
#include "installwizard_installtype.h"
|
||||||
#include "ui_installwizard_installtype.h"
|
#include "ui_installwizard_installtype.h"
|
||||||
|
#include "installwizard.h"
|
||||||
|
|
||||||
InstallWizard_InstallType::InstallWizard_InstallType(QWidget *parent) :
|
InstallWizard_InstallType::InstallWizard_InstallType(QWidget *parent) :
|
||||||
QWizardPage(parent),
|
QWizardPage(parent),
|
||||||
|
@ -9,7 +10,7 @@ InstallWizard_InstallType::InstallWizard_InstallType(QWidget *parent) :
|
||||||
|
|
||||||
#ifndef Q_OS_WIN32
|
#ifndef Q_OS_WIN32
|
||||||
ui->rbLocate->setEnabled(false);
|
ui->rbLocate->setEnabled(false);
|
||||||
ui->rbCD->setChecked(true);
|
ui->rbInstall->setChecked(true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,3 +18,21 @@ InstallWizard_InstallType::~InstallWizard_InstallType()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int InstallWizard_InstallType::nextId() const
|
||||||
|
{
|
||||||
|
if (ui->rbInstall->isChecked())
|
||||||
|
{
|
||||||
|
return InstallWizard::Page_Install;
|
||||||
|
}
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
else if (ui->rbLocate->isChecked())
|
||||||
|
{
|
||||||
|
return InstallWizard::Page_Locate;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Shouldn't happen.
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return InstallWizard::Page_Finished;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class InstallWizard_InstallType : public QWizardPage
|
||||||
public:
|
public:
|
||||||
explicit InstallWizard_InstallType(QWidget *parent = 0);
|
explicit InstallWizard_InstallType(QWidget *parent = 0);
|
||||||
~InstallWizard_InstallType();
|
~InstallWizard_InstallType();
|
||||||
|
virtual int nextId() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::InstallWizard_InstallType *ui;
|
Ui::InstallWizard_InstallType *ui;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbLocate">
|
<widget class="QRadioButton" name="rbLocate">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Locate an existing Quake 3: Arena installation</string>
|
<string>Locate an existing Quake III Arena installation</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -28,16 +28,9 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QRadioButton" name="rbCD">
|
<widget class="QRadioButton" name="rbInstall">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Install from CD</string>
|
<string>Install from CD or Steam</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="rbSteam">
|
|
||||||
<property name="text">
|
|
||||||
<string>Install from Steam</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -13,7 +13,6 @@ InstallWizard_LocatePage::InstallWizard_LocatePage(QWidget *parent, Settings *se
|
||||||
isQuake3PatchRequired(false)
|
isQuake3PatchRequired(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
registerField("quake3Path*", ui->txtLocation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InstallWizard_LocatePage::~InstallWizard_LocatePage()
|
InstallWizard_LocatePage::~InstallWizard_LocatePage()
|
||||||
|
@ -23,12 +22,13 @@ InstallWizard_LocatePage::~InstallWizard_LocatePage()
|
||||||
|
|
||||||
void InstallWizard_LocatePage::initializePage()
|
void InstallWizard_LocatePage::initializePage()
|
||||||
{
|
{
|
||||||
|
registerField("quake3Path*", ui->txtLocation);
|
||||||
ui->txtLocation->setText(settings->getQuakePath());
|
ui->txtLocation->setText(settings->getQuakePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallWizard_LocatePage::on_btnBrowse_clicked()
|
void InstallWizard_LocatePage::on_btnBrowse_clicked()
|
||||||
{
|
{
|
||||||
const QString location = QFileDialog::getExistingDirectory(this, tr("Select Quake 3: Arena Location"), settings->getQuakePath());
|
const QString location = QFileDialog::getExistingDirectory(this, tr("Select Quake III Arena Location"), settings->getQuakePath());
|
||||||
|
|
||||||
if (!location.isEmpty())
|
if (!location.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<string>WizardPage</string>
|
<string>WizardPage</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Locate Quake 3: Arena</string>
|
<string>Locate Quake III Arena</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
|
|
@ -20,7 +20,8 @@ SOURCES += main.cpp\
|
||||||
installwizard_installtype.cpp \
|
installwizard_installtype.cpp \
|
||||||
installwizard_finished.cpp \
|
installwizard_finished.cpp \
|
||||||
installwizard_patch.cpp \
|
installwizard_patch.cpp \
|
||||||
installwizard_eula.cpp
|
installwizard_eula.cpp \
|
||||||
|
installwizard_install.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
settings.h \
|
settings.h \
|
||||||
|
@ -29,7 +30,8 @@ HEADERS += mainwindow.h \
|
||||||
installwizard_installtype.h \
|
installwizard_installtype.h \
|
||||||
installwizard_finished.h \
|
installwizard_finished.h \
|
||||||
installwizard_patch.h \
|
installwizard_patch.h \
|
||||||
installwizard_eula.h
|
installwizard_eula.h \
|
||||||
|
installwizard_install.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
installwizard.ui \
|
installwizard.ui \
|
||||||
|
@ -37,7 +39,8 @@ FORMS += mainwindow.ui \
|
||||||
installwizard_installtype.ui \
|
installwizard_installtype.ui \
|
||||||
installwizard_finished.ui \
|
installwizard_finished.ui \
|
||||||
installwizard_patch.ui \
|
installwizard_patch.ui \
|
||||||
installwizard_eula.ui
|
installwizard_eula.ui \
|
||||||
|
installwizard_install.ui
|
||||||
|
|
||||||
OTHER_FILES += \
|
OTHER_FILES += \
|
||||||
README.md \
|
README.md \
|
||||||
|
|
Loading…
Reference in a new issue