mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-27 14:37:04 +00:00
Merge branch 'issue-2766-warn_user_if_old_MW_version_installed' into 'master'
Issue 2766 Warn user of old MW version detected See merge request OpenMW/openmw!1748
This commit is contained in:
commit
517bca803c
@ -76,6 +76,7 @@ Programmers
|
|||||||
Eduard Cot (trombonecot)
|
Eduard Cot (trombonecot)
|
||||||
Eli2
|
Eli2
|
||||||
Emanuel Guével (potatoesmaster)
|
Emanuel Guével (potatoesmaster)
|
||||||
|
Eris Caffee (eris)
|
||||||
eroen
|
eroen
|
||||||
escondida
|
escondida
|
||||||
Evgeniy Mineev (sandstranger)
|
Evgeniy Mineev (sandstranger)
|
||||||
|
@ -114,6 +114,7 @@
|
|||||||
Feature #1465: "Reset" argument for AI functions
|
Feature #1465: "Reset" argument for AI functions
|
||||||
Feature #2491: Ability to make OpenMW "portable"
|
Feature #2491: Ability to make OpenMW "portable"
|
||||||
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
|
Feature #2554: Modifying an object triggers the instances table to scroll to the corresponding record
|
||||||
|
Feature #2766: Warn user if their version of Morrowind is not the latest.
|
||||||
Feature #2780: A way to see current OpenMW version in the console
|
Feature #2780: A way to see current OpenMW version in the console
|
||||||
Feature #3245: Grid and angle snapping for the OpenMW-CS
|
Feature #3245: Grid and angle snapping for the OpenMW-CS
|
||||||
Feature #3616: Allow Zoom levels on the World Map
|
Feature #3616: Allow Zoom levels on the World Map
|
||||||
|
@ -570,7 +570,7 @@ void Launcher::MainDialog::play()
|
|||||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||||
msgBox.setText(tr("<br><b>You do not have a game file selected.</b><br><br> \
|
msgBox.setText(tr("<br><b>You do not have a game file selected.</b><br><br> \
|
||||||
OpenMW will not start without a game file selected.<br>"));
|
OpenMW will not start without a game file selected.<br>"));
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,11 @@ void Wizard::ExistingInstallationPage::on_browseButton_clicked()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!versionIsOK(info.absolutePath()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString path(QDir::toNativeSeparators(info.absolutePath()));
|
QString path(QDir::toNativeSeparators(info.absolutePath()));
|
||||||
QList<QListWidgetItem*> items = installationsList->findItems(path, Qt::MatchExactly);
|
QList<QListWidgetItem*> items = installationsList->findItems(path, Qt::MatchExactly);
|
||||||
|
|
||||||
@ -165,3 +170,36 @@ int Wizard::ExistingInstallationPage::nextId() const
|
|||||||
{
|
{
|
||||||
return MainWizard::Page_LanguageSelection;
|
return MainWizard::Page_LanguageSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Wizard::ExistingInstallationPage::versionIsOK(QString directory_name)
|
||||||
|
{
|
||||||
|
QDir directory = QDir(directory_name);
|
||||||
|
QFileInfoList infoList = directory.entryInfoList(QStringList(QString("Morrowind.bsa")));
|
||||||
|
if (infoList.size() == 1)
|
||||||
|
{
|
||||||
|
qint64 actualFileSize = infoList.at(0).size();
|
||||||
|
const qint64 expectedFileSize = 310459500; // Size of Morrowind.bsa in Steam and GOG editions.
|
||||||
|
|
||||||
|
if (actualFileSize == expectedFileSize)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(QObject::tr("Most recent Morrowind not detected"));
|
||||||
|
msgBox.setIcon(QMessageBox::Warning);
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
|
msgBox.setText(QObject::tr("<br><b>There may be a more recent version of Morrowind available.</b><br><br>\
|
||||||
|
Do you wish to continue anyway?<br>"));
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
if (ret == QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "ui_existinginstallationpage.h"
|
#include "ui_existinginstallationpage.h"
|
||||||
|
|
||||||
|
#include <components/config/gamesettings.hpp>
|
||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
class MainWizard;
|
class MainWizard;
|
||||||
@ -25,9 +27,10 @@ namespace Wizard
|
|||||||
private:
|
private:
|
||||||
MainWizard *mWizard;
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
bool versionIsOK(QString directory_name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void initializePage() override;
|
void initializePage() override;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::InstallationPage::InstallationPage(QWidget *parent) :
|
Wizard::InstallationPage::InstallationPage(QWidget *parent, Config::GameSettings &gameSettings) :
|
||||||
QWizardPage(parent)
|
QWizardPage(parent),
|
||||||
|
mGameSettings(gameSettings)
|
||||||
{
|
{
|
||||||
mWizard = qobject_cast<MainWizard*>(parent);
|
mWizard = qobject_cast<MainWizard*>(parent);
|
||||||
|
|
||||||
@ -18,7 +19,7 @@ Wizard::InstallationPage::InstallationPage(QWidget *parent) :
|
|||||||
mFinished = false;
|
mFinished = false;
|
||||||
|
|
||||||
mThread = new QThread();
|
mThread = new QThread();
|
||||||
mUnshield = new UnshieldWorker();
|
mUnshield = new UnshieldWorker(mGameSettings.value("morrowind-bsa-filesize").toLongLong());
|
||||||
mUnshield->moveToThread(mThread);
|
mUnshield->moveToThread(mThread);
|
||||||
|
|
||||||
connect(mThread, SIGNAL(started()),
|
connect(mThread, SIGNAL(started()),
|
||||||
@ -47,6 +48,10 @@ Wizard::InstallationPage::InstallationPage(QWidget *parent) :
|
|||||||
|
|
||||||
connect(mUnshield, SIGNAL(requestFileDialog(Wizard::Component)),
|
connect(mUnshield, SIGNAL(requestFileDialog(Wizard::Component)),
|
||||||
this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection);
|
this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
connect(mUnshield, SIGNAL(requestOldVersionDialog()),
|
||||||
|
this, SLOT(showOldVersionDialog())
|
||||||
|
, Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wizard::InstallationPage::~InstallationPage()
|
Wizard::InstallationPage::~InstallationPage()
|
||||||
@ -181,6 +186,34 @@ void Wizard::InstallationPage::showFileDialog(Wizard::Component component)
|
|||||||
mUnshield->setDiskPath(path);
|
mUnshield->setDiskPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wizard::InstallationPage::showOldVersionDialog()
|
||||||
|
{
|
||||||
|
logTextEdit->appendHtml(tr("<p>Detected old version of component Morrowind.</p>"));
|
||||||
|
mWizard->addLogText(tr("Detected old version of component Morrowind."));
|
||||||
|
|
||||||
|
QMessageBox msgBox;
|
||||||
|
msgBox.setWindowTitle(tr("Morrowind Installation"));
|
||||||
|
msgBox.setIcon(QMessageBox::Information);
|
||||||
|
msgBox.setText(QObject::tr("There may be a more recent version of Morrowind available.<br><br>Do you wish to continue anyway?"));
|
||||||
|
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||||
|
msgBox.setDefaultButton(QMessageBox::No);
|
||||||
|
|
||||||
|
int ret = msgBox.exec();
|
||||||
|
if (ret == QMessageBox::No)
|
||||||
|
{
|
||||||
|
logTextEdit->appendHtml(tr("<p><br/><span style=\"color:red;\"> \
|
||||||
|
<b>Error: The installation was aborted by the user</b></span></p>"));
|
||||||
|
|
||||||
|
mWizard->addLogText(QLatin1String("Error: The installation was aborted by the user"));
|
||||||
|
mWizard->mError = true;
|
||||||
|
|
||||||
|
emit completeChanged();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mUnshield->wakeAll();
|
||||||
|
}
|
||||||
|
|
||||||
void Wizard::InstallationPage::installationFinished()
|
void Wizard::InstallationPage::installationFinished()
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "unshield/unshieldworker.hpp"
|
#include "unshield/unshieldworker.hpp"
|
||||||
#include "ui_installationpage.h"
|
#include "ui_installationpage.h"
|
||||||
#include "inisettings.hpp"
|
#include "inisettings.hpp"
|
||||||
|
#include <components/config/gamesettings.hpp>
|
||||||
|
|
||||||
class QThread;
|
class QThread;
|
||||||
|
|
||||||
@ -19,7 +20,7 @@ namespace Wizard
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InstallationPage(QWidget *parent);
|
InstallationPage(QWidget *parent, Config::GameSettings &gameSettings);
|
||||||
~InstallationPage() override;
|
~InstallationPage() override;
|
||||||
|
|
||||||
int nextId() const override;
|
int nextId() const override;
|
||||||
@ -34,8 +35,11 @@ namespace Wizard
|
|||||||
|
|
||||||
void startInstallation();
|
void startInstallation();
|
||||||
|
|
||||||
|
Config::GameSettings &mGameSettings;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showFileDialog(Wizard::Component component);
|
void showFileDialog(Wizard::Component component);
|
||||||
|
void showOldVersionDialog();
|
||||||
|
|
||||||
void installationFinished();
|
void installationFinished();
|
||||||
void installationError(const QString &text, const QString &details);
|
void installationError(const QString &text, const QString &details);
|
||||||
|
@ -325,7 +325,7 @@ void Wizard::MainWizard::setupPages()
|
|||||||
setPage(Page_InstallationTarget, new InstallationTargetPage(this, mCfgMgr));
|
setPage(Page_InstallationTarget, new InstallationTargetPage(this, mCfgMgr));
|
||||||
setPage(Page_ComponentSelection, new ComponentSelectionPage(this));
|
setPage(Page_ComponentSelection, new ComponentSelectionPage(this));
|
||||||
#ifdef OPENMW_USE_UNSHIELD
|
#ifdef OPENMW_USE_UNSHIELD
|
||||||
setPage(Page_Installation, new InstallationPage(this));
|
setPage(Page_Installation, new InstallationPage(this, mGameSettings));
|
||||||
#endif
|
#endif
|
||||||
setPage(Page_Import, new ImportPage(this));
|
setPage(Page_Import, new ImportPage(this));
|
||||||
setPage(Page_Conclusion, new ConclusionPage(this));
|
setPage(Page_Conclusion, new ConclusionPage(this));
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
|
|
||||||
Wizard::UnshieldWorker::UnshieldWorker(QObject *parent) :
|
Wizard::UnshieldWorker::UnshieldWorker(qint64 expectedMorrowindBsaSize, QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
|
mExpectedMorrowindBsaSize(expectedMorrowindBsaSize),
|
||||||
mIniSettings()
|
mIniSettings()
|
||||||
{
|
{
|
||||||
unshield_set_log_level(0);
|
unshield_set_log_level(0);
|
||||||
@ -159,6 +160,11 @@ void Wizard::UnshieldWorker::setIniCodec(QTextCodec *codec)
|
|||||||
mIniCodec = codec;
|
mIniCodec = codec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wizard::UnshieldWorker::wakeAll()
|
||||||
|
{
|
||||||
|
mWait.wakeAll();
|
||||||
|
}
|
||||||
|
|
||||||
bool Wizard::UnshieldWorker::setupSettings()
|
bool Wizard::UnshieldWorker::setupSettings()
|
||||||
{
|
{
|
||||||
// Create Morrowind.ini settings map
|
// Create Morrowind.ini settings map
|
||||||
@ -478,6 +484,18 @@ bool Wizard::UnshieldWorker::setupComponent(Component component)
|
|||||||
// Check if we have correct archive, other archives have Morrowind.bsa too
|
// Check if we have correct archive, other archives have Morrowind.bsa too
|
||||||
if (tribunalFound == bloodmoonFound)
|
if (tribunalFound == bloodmoonFound)
|
||||||
{
|
{
|
||||||
|
qint64 actualFileSize = getMorrowindBsaFileSize(file);
|
||||||
|
if (actualFileSize != mExpectedMorrowindBsaSize)
|
||||||
|
{
|
||||||
|
QReadLocker readLock(&mLock);
|
||||||
|
emit requestOldVersionDialog();
|
||||||
|
mWait.wait(&mLock);
|
||||||
|
if (mStopped)
|
||||||
|
{
|
||||||
|
qDebug() << "We are asked to stop !!";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
cabFile = file;
|
cabFile = file;
|
||||||
found = true; // We have a GoTY disk or a Morrowind-only disk
|
found = true; // We have a GoTY disk or a Morrowind-only disk
|
||||||
}
|
}
|
||||||
@ -492,6 +510,11 @@ bool Wizard::UnshieldWorker::setupComponent(Component component)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cabFile.isEmpty())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
emit textChanged(tr("Failed to find a valid archive containing %1.bsa! Retrying.").arg(name));
|
emit textChanged(tr("Failed to find a valid archive containing %1.bsa! Retrying.").arg(name));
|
||||||
@ -939,3 +962,42 @@ bool Wizard::UnshieldWorker::findInCab(const QString &fileName, const QString &c
|
|||||||
unshield_close(unshield);
|
unshield_close(unshield);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t Wizard::UnshieldWorker::getMorrowindBsaFileSize(const QString &cabFile)
|
||||||
|
{
|
||||||
|
QString fileName = QString("Morrowind.bsa");
|
||||||
|
QByteArray array(cabFile.toUtf8());
|
||||||
|
|
||||||
|
Unshield *unshield;
|
||||||
|
unshield = unshield_open(array.constData());
|
||||||
|
|
||||||
|
if (!unshield)
|
||||||
|
{
|
||||||
|
emit error(tr("Failed to open InstallShield Cabinet File."), tr("Opening %1 failed.").arg(cabFile));
|
||||||
|
unshield_close(unshield);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < unshield_file_group_count(unshield); ++i)
|
||||||
|
{
|
||||||
|
UnshieldFileGroup *group = unshield_file_group_get(unshield, i);
|
||||||
|
|
||||||
|
for (size_t j = group->first_file; j <= group->last_file; ++j)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (unshield_file_is_valid(unshield, j))
|
||||||
|
{
|
||||||
|
QString current(QString::fromUtf8(unshield_file_name(unshield, j)));
|
||||||
|
if (current.toLower() == fileName.toLower())
|
||||||
|
{
|
||||||
|
size_t fileSize = unshield_file_size(unshield, j);
|
||||||
|
unshield_close(unshield);
|
||||||
|
return fileSize; // File is found!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unshield_close(unshield);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include "../inisettings.hpp"
|
#include "../inisettings.hpp"
|
||||||
|
|
||||||
|
#include <components/config/gamesettings.hpp>
|
||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
@ -26,7 +27,7 @@ namespace Wizard
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UnshieldWorker(QObject *parent = nullptr);
|
UnshieldWorker(qint64 expectedMorrowindBsaSize, QObject *parent = nullptr);
|
||||||
~UnshieldWorker() override;
|
~UnshieldWorker() override;
|
||||||
|
|
||||||
void stopWorker();
|
void stopWorker();
|
||||||
@ -38,6 +39,8 @@ namespace Wizard
|
|||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setIniPath(const QString &path);
|
void setIniPath(const QString &path);
|
||||||
|
|
||||||
|
void wakeAll();
|
||||||
|
|
||||||
QString getPath();
|
QString getPath();
|
||||||
QString getIniPath();
|
QString getIniPath();
|
||||||
|
|
||||||
@ -45,8 +48,9 @@ namespace Wizard
|
|||||||
|
|
||||||
bool setupSettings();
|
bool setupSettings();
|
||||||
|
|
||||||
private:
|
size_t getMorrowindBsaFileSize(const QString &cabFile);
|
||||||
|
|
||||||
|
private:
|
||||||
bool writeSettings();
|
bool writeSettings();
|
||||||
|
|
||||||
bool getInstallComponent(Component component);
|
bool getInstallComponent(Component component);
|
||||||
@ -95,6 +99,8 @@ namespace Wizard
|
|||||||
|
|
||||||
bool mStopped;
|
bool mStopped;
|
||||||
|
|
||||||
|
qint64 mExpectedMorrowindBsaSize;
|
||||||
|
|
||||||
QString mPath;
|
QString mPath;
|
||||||
QString mIniPath;
|
QString mIniPath;
|
||||||
QString mDiskPath;
|
QString mDiskPath;
|
||||||
@ -113,6 +119,7 @@ namespace Wizard
|
|||||||
signals:
|
signals:
|
||||||
void finished();
|
void finished();
|
||||||
void requestFileDialog(Wizard::Component component);
|
void requestFileDialog(Wizard::Component component);
|
||||||
|
void requestOldVersionDialog();
|
||||||
|
|
||||||
void textChanged(const QString &text);
|
void textChanged(const QString &text);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user