Don't install the patch when installing from Steam.

This commit is contained in:
Jonathan Young 2014-05-15 16:40:17 +10:00
parent 294afa1066
commit 0837c47531
6 changed files with 34 additions and 7 deletions

View file

@ -11,7 +11,8 @@
InstallWizard::InstallWizard(QWidget *parent, Settings *settings) :
QWizard(parent),
ui(new Ui::InstallWizard),
settings(settings)
settings(settings),
isQuake3PatchRequired(false)
{
setOptions(QWizard::NoCancelButton | QWizard::HaveCustomButton1);
cancelButton = new QPushButton("Cancel");
@ -49,6 +50,16 @@ const QList<InstallWizard::CopyFile> &InstallWizard::getCopyFiles() const
return copyFiles;
}
bool InstallWizard::getIsQuake3PatchRequired() const
{
return isQuake3PatchRequired;
}
void InstallWizard::setIsQuake3PatchRequired(bool value)
{
isQuake3PatchRequired = value;
}
void InstallWizard::cancel()
{
if (currentId() == Page_Copy)

View file

@ -27,6 +27,9 @@ public:
void addCopyFile(const QString &source, const QString &dest);
const QList<CopyFile> &getCopyFiles() const;
bool getIsQuake3PatchRequired() const;
void setIsQuake3PatchRequired(bool value);
enum
{
Page_Setup,
@ -45,6 +48,7 @@ private:
QPushButton *cancelButton;
Settings *settings;
QList<CopyFile> copyFiles;
bool isQuake3PatchRequired;
};
#endif // INSTALLWIZARD_H

View file

@ -106,6 +106,16 @@ bool InstallWizard_Copy::isComplete() const
return isCopyFinished;
}
int InstallWizard_Copy::nextId() const
{
if (((InstallWizard *)wizard())->getIsQuake3PatchRequired())
{
return InstallWizard::Page_Patch;
}
return InstallWizard::Page_Finished;
}
void InstallWizard_Copy::cancel()
{
if (!isCopyFinished)

View file

@ -43,6 +43,7 @@ public:
~InstallWizard_Copy();
virtual void initializePage();
virtual bool isComplete() const;
virtual int nextId() const;
void cancel();
private slots:

View file

@ -10,8 +10,7 @@
InstallWizard_Setup::InstallWizard_Setup(QWidget *parent, Settings *settings) :
QWizardPage(parent),
ui(new Ui::InstallWizard_Setup),
settings(settings),
isQuake3PatchRequired(false)
settings(settings)
{
ui->setupUi(this);
@ -57,6 +56,9 @@ bool InstallWizard_Setup::validatePage()
return false;
}
// CD doesn't contain latest patch.
((InstallWizard *)wizard())->setIsQuake3PatchRequired(true);
// Copy page will copy baseq3/pak0.pk3.
((InstallWizard *)wizard())->addCopyFile(ui->txtInstallSource->text(), ui->txtInstallDest->text() + QString("/baseq3/pak0.pk3"));
registerField("quake3Path", ui->txtInstallDest);
@ -112,7 +114,7 @@ bool InstallWizard_Setup::validatePage()
if (!file.exists())
{
// pak1.pk3 doesn't exist, must be a fresh install.
isQuake3PatchRequired = true;
((InstallWizard *)wizard())->setIsQuake3PatchRequired(true);
registerField("quake3Path", ui->txtLocatePath);
return true;
}
@ -124,7 +126,7 @@ bool InstallWizard_Setup::validatePage()
}
const QByteArray hash = QCryptographicHash::hash(file.readAll(), QCryptographicHash::Md5).toHex();
isQuake3PatchRequired = (hash != "48911719d91be25adb957f2d325db4a0");
((InstallWizard *)wizard())->setIsQuake3PatchRequired(hash != "48911719d91be25adb957f2d325db4a0");
registerField("quake3Path", ui->txtLocatePath);
}
#endif
@ -161,7 +163,7 @@ int InstallWizard_Setup::nextId() const
#ifdef Q_OS_WIN32
else if (ui->stackPages->currentIndex() == Page_Locate)
{
if (isQuake3PatchRequired)
if (((InstallWizard *)wizard())->getIsQuake3PatchRequired())
{
return InstallWizard::Page_Eula;
}

View file

@ -59,7 +59,6 @@ private:
Ui::InstallWizard_Setup *ui;
Settings *settings;
bool isQuake3PatchRequired;
};
#endif // INSTALLWIZARD_INSTALLTYPE_H