mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-16 11:06:46 +00:00
Re-added support for GoTY disks and added a messagebox, displayed when done
This commit is contained in:
parent
8db333c8d0
commit
3fd88aca59
2 changed files with 65 additions and 68 deletions
|
@ -4,6 +4,7 @@
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
#include "inisettings.hpp"
|
#include "inisettings.hpp"
|
||||||
|
@ -135,49 +136,6 @@ void Wizard::InstallationPage::startInstallation()
|
||||||
thread->start();
|
thread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//void Wizard::InstallationPage::installAddons()
|
|
||||||
//{
|
|
||||||
// qDebug() << "component finished";
|
|
||||||
|
|
||||||
// QStringList components(field("installation.components").toStringList());
|
|
||||||
|
|
||||||
// if (components.contains(QLatin1String("Tribunal")) && !mUnshield->tribunalDone())
|
|
||||||
// {
|
|
||||||
// QString fileName = QFileDialog::getOpenFileName(
|
|
||||||
// this,
|
|
||||||
// tr("Select Tribunal installation file"),
|
|
||||||
// QDir::rootPath(),
|
|
||||||
// tr("InstallShield header files (*.hdr)"));
|
|
||||||
|
|
||||||
// if (fileName.isEmpty()) {
|
|
||||||
// qDebug() << "Cancel was clicked!";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// QFileInfo info(fileName);
|
|
||||||
// mUnshield->installTribunal(info.absolutePath());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (components.contains(QLatin1String("Bloodmoon")) && !mUnshield->bloodmoonDone())
|
|
||||||
// {
|
|
||||||
// QString fileName = QFileDialog::getOpenFileName(
|
|
||||||
// this,
|
|
||||||
// tr("Select Bloodmoon installation file"),
|
|
||||||
// QDir::rootPath(),
|
|
||||||
// tr("InstallShield header files (*.hdr)"));
|
|
||||||
|
|
||||||
// if (fileName.isEmpty()) {
|
|
||||||
// qDebug() << "Cancel was clicked!";
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// QFileInfo info(fileName);
|
|
||||||
// mUnshield->installBloodmoon(info.absolutePath());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
void Wizard::InstallationPage::showFileDialog(const QString &component)
|
void Wizard::InstallationPage::showFileDialog(const QString &component)
|
||||||
{
|
{
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
@ -215,6 +173,15 @@ void Wizard::InstallationPage::showFileDialog(const QString &component)
|
||||||
void Wizard::InstallationPage::installationFinished()
|
void Wizard::InstallationPage::installationFinished()
|
||||||
{
|
{
|
||||||
qDebug() << "finished!";
|
qDebug() << "finished!";
|
||||||
|
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(tr("Installation finished"));
|
||||||
|
msgBox.setIcon(QMessageBox::Information);
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
msgBox.setText(tr("Installation completed sucessfully!"));
|
||||||
|
|
||||||
|
msgBox.exec();
|
||||||
|
|
||||||
mFinished = true;
|
mFinished = true;
|
||||||
emit completeChanged();
|
emit completeChanged();
|
||||||
|
|
||||||
|
|
|
@ -389,6 +389,19 @@ void Wizard::UnshieldWorker::extract()
|
||||||
{
|
{
|
||||||
while (!getTribunalDone())
|
while (!getTribunalDone())
|
||||||
{
|
{
|
||||||
|
QDir tribunal(disk);
|
||||||
|
|
||||||
|
if (!tribunal.cd(QLatin1String("Tribunal"))) {
|
||||||
|
qDebug() << "not found on cd!";
|
||||||
|
QReadLocker locker(&mLock);
|
||||||
|
emit requestFileDialog(QLatin1String("Tribunal"));
|
||||||
|
mWait.wait(&mLock);
|
||||||
|
|
||||||
|
} else if (tribunal.exists(QLatin1String("data1.hdr"))) {
|
||||||
|
qDebug() << "Exists! " << tribunal.absolutePath();
|
||||||
|
setTribunalPath(tribunal.absolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
if (getTribunalPath().isEmpty()) {
|
if (getTribunalPath().isEmpty()) {
|
||||||
qDebug() << "request file dialog";
|
qDebug() << "request file dialog";
|
||||||
QReadLocker locker(&mLock);
|
QReadLocker locker(&mLock);
|
||||||
|
@ -396,10 +409,12 @@ void Wizard::UnshieldWorker::extract()
|
||||||
mWait.wait(&mLock);
|
mWait.wait(&mLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getTribunalPath().isEmpty()) {
|
// Make sure the dir is up-to-date
|
||||||
disk.setPath(getTribunalPath());
|
tribunal.setPath(getTribunalPath());
|
||||||
|
|
||||||
if (!findFile(disk.absoluteFilePath(QLatin1String("data1.hdr")), QLatin1String("Tribunal.bsa")))
|
if (!getTribunalPath().isEmpty()) {
|
||||||
|
|
||||||
|
if (!findFile(tribunal.absoluteFilePath(QLatin1String("data1.hdr")), QLatin1String("Tribunal.bsa")))
|
||||||
{
|
{
|
||||||
qDebug() << "found";
|
qDebug() << "found";
|
||||||
QReadLocker locker(&mLock);
|
QReadLocker locker(&mLock);
|
||||||
|
@ -421,6 +436,21 @@ void Wizard::UnshieldWorker::extract()
|
||||||
{
|
{
|
||||||
while (!getBloodmoonDone())
|
while (!getBloodmoonDone())
|
||||||
{
|
{
|
||||||
|
QDir bloodmoon(disk);
|
||||||
|
|
||||||
|
qDebug() << "Test!: " << bloodmoon.absolutePath();
|
||||||
|
|
||||||
|
if (!bloodmoon.cd(QLatin1String("Bloodmoon"))) {
|
||||||
|
qDebug() << "not found on cd!";
|
||||||
|
QReadLocker locker(&mLock);
|
||||||
|
emit requestFileDialog(QLatin1String("Bloodmoon"));
|
||||||
|
mWait.wait(&mLock);
|
||||||
|
|
||||||
|
} else if (bloodmoon.exists(QLatin1String("data1.hdr"))) {
|
||||||
|
qDebug() << "Exists! " << bloodmoon.absolutePath();
|
||||||
|
setBloodmoonPath(bloodmoon.absolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
if (getBloodmoonPath().isEmpty()) {
|
if (getBloodmoonPath().isEmpty()) {
|
||||||
qDebug() << "request file dialog";
|
qDebug() << "request file dialog";
|
||||||
QReadLocker locker(&mLock);
|
QReadLocker locker(&mLock);
|
||||||
|
@ -428,10 +458,10 @@ void Wizard::UnshieldWorker::extract()
|
||||||
mWait.wait(&mLock);
|
mWait.wait(&mLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getBloodmoonPath().isEmpty()) {
|
// Make sure the dir is up-to-date
|
||||||
disk.setPath(getBloodmoonPath());
|
bloodmoon.setPath(getBloodmoonPath());
|
||||||
|
|
||||||
if (!findFile(disk.absoluteFilePath(QLatin1String("data1.hdr")), QLatin1String("Bloodmoon.bsa")))
|
if (!findFile(bloodmoon.absoluteFilePath(QLatin1String("data1.hdr")), QLatin1String("Bloodmoon.bsa")))
|
||||||
{
|
{
|
||||||
QReadLocker locker(&mLock);
|
QReadLocker locker(&mLock);
|
||||||
emit requestFileDialog(QLatin1String("Bloodmoon"));
|
emit requestFileDialog(QLatin1String("Bloodmoon"));
|
||||||
|
@ -446,17 +476,20 @@ void Wizard::UnshieldWorker::extract()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// Remove the temporary directory
|
||||||
|
removeDirectory(mPath + QDir::separator() + QLatin1String("extract-temp"));
|
||||||
|
|
||||||
|
// Fill the progress bar
|
||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
||||||
if (mInstallMorrowind)
|
if (getInstallMorrowind())
|
||||||
total = 100;
|
total = 100;
|
||||||
|
|
||||||
if (mInstallTribunal)
|
if (getInstallTribunal())
|
||||||
total = total + 100;
|
total = total + 100;
|
||||||
|
|
||||||
if (mInstallBloodmoon)
|
if (getInstallBloodmoon())
|
||||||
total = total + 100;
|
total = total + 100;
|
||||||
|
|
||||||
emit textChanged(tr("Installation finished!"));
|
emit textChanged(tr("Installation finished!"));
|
||||||
|
@ -523,8 +556,6 @@ bool Wizard::UnshieldWorker::installMorrowind()
|
||||||
|
|
||||||
QFileInfo info(iniPath);
|
QFileInfo info(iniPath);
|
||||||
|
|
||||||
qDebug() << info.absoluteFilePath() << getPath();
|
|
||||||
|
|
||||||
if (info.exists()) {
|
if (info.exists()) {
|
||||||
emit textChanged(tr("Extracting: Morrowind.ini"));
|
emit textChanged(tr("Extracting: Morrowind.ini"));
|
||||||
moveFile(info.absoluteFilePath(), getPath() + QDir::separator() + QLatin1String("Morrowind.ini"));
|
moveFile(info.absoluteFilePath(), getPath() + QDir::separator() + QLatin1String("Morrowind.ini"));
|
||||||
|
@ -579,7 +610,8 @@ bool Wizard::UnshieldWorker::installTribunal()
|
||||||
// TODO: Throw error;
|
// TODO: Throw error;
|
||||||
// Move the files from the temporary path to the destination folder
|
// Move the files from the temporary path to the destination folder
|
||||||
emit textChanged(tr("Moving installation files"));
|
emit textChanged(tr("Moving installation files"));
|
||||||
if (!moveDirectory(temp.absoluteFilePath(QLatin1String("Data Files")), getPath())) {
|
if (!moveDirectory(temp.absoluteFilePath(QLatin1String("Data Files")), getPath()))
|
||||||
|
{
|
||||||
qDebug() << "failed to move files!";
|
qDebug() << "failed to move files!";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -687,8 +719,6 @@ bool Wizard::UnshieldWorker::extractFile(Unshield *unshield, const QString &outp
|
||||||
if (getTribunalDone())
|
if (getTribunalDone())
|
||||||
progress = progress + 100;
|
progress = progress + 100;
|
||||||
|
|
||||||
qDebug() << progress << counter << unshield_file_count(unshield);
|
|
||||||
|
|
||||||
emit textChanged(tr("Extracting: %1").arg(QString::fromLatin1(unshield_file_name(unshield, index))));
|
emit textChanged(tr("Extracting: %1").arg(QString::fromLatin1(unshield_file_name(unshield, index))));
|
||||||
emit progressChanged(progress);
|
emit progressChanged(progress);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue