mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 21:32:42 +00:00
Fixed some problems with the launcher and the wizard
This commit is contained in:
parent
a390dde818
commit
6348af586e
@ -36,7 +36,7 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config:
|
|||||||
this, SLOT(updateOkButton(QString)));
|
this, SLOT(updateOkButton(QString)));
|
||||||
|
|
||||||
buildView();
|
buildView();
|
||||||
setupDataFiles();
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::buildView()
|
void Launcher::DataFilesPage::buildView()
|
||||||
@ -67,7 +67,7 @@ void Launcher::DataFilesPage::buildView()
|
|||||||
this, SLOT (slotProfileChangedByUser(QString, QString)));
|
this, SLOT (slotProfileChangedByUser(QString, QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher::DataFilesPage::setupDataFiles()
|
bool Launcher::DataFilesPage::loadSettings()
|
||||||
{
|
{
|
||||||
QStringList paths = mGameSettings.getDataDirs();
|
QStringList paths = mGameSettings.getDataDirs();
|
||||||
|
|
||||||
@ -79,12 +79,6 @@ void Launcher::DataFilesPage::setupDataFiles()
|
|||||||
if (!mDataLocal.isEmpty())
|
if (!mDataLocal.isEmpty())
|
||||||
mSelector->addFiles(mDataLocal);
|
mSelector->addFiles(mDataLocal);
|
||||||
|
|
||||||
loadSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Launcher::DataFilesPage::loadSettings()
|
|
||||||
{
|
|
||||||
QStringList paths = mGameSettings.getDataDirs();
|
|
||||||
paths.insert (0, mDataLocal);
|
paths.insert (0, mDataLocal);
|
||||||
PathIterator pathIterator (paths);
|
PathIterator pathIterator (paths);
|
||||||
|
|
||||||
|
@ -41,8 +41,6 @@ namespace Launcher
|
|||||||
void saveSettings(const QString &profile = "");
|
void saveSettings(const QString &profile = "");
|
||||||
bool loadSettings();
|
bool loadSettings();
|
||||||
|
|
||||||
void setupDataFiles();
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void signalProfileChanged (int index);
|
void signalProfileChanged (int index);
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Launcher::MainDialog mainWin;
|
Launcher::MainDialog mainWin;
|
||||||
|
|
||||||
if (!mainWin.setup()) {
|
if (!mainWin.showFirstRunDialog())
|
||||||
return 0;
|
return 0;
|
||||||
//mainWin.show();
|
|
||||||
}/* else {
|
// if (!mainWin.setup())
|
||||||
return 0;
|
// return 0;
|
||||||
}*/
|
|
||||||
|
|
||||||
int returnValue = app.exec();
|
int returnValue = app.exec();
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
|
@ -164,6 +164,11 @@ void Launcher::MainDialog::createPages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Launcher::MainDialog::showFirstRunDialog()
|
bool Launcher::MainDialog::showFirstRunDialog()
|
||||||
|
{
|
||||||
|
if (!setupLauncherSettings())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true"))
|
||||||
{
|
{
|
||||||
QMessageBox msgBox;
|
QMessageBox msgBox;
|
||||||
msgBox.setWindowTitle(tr("First run"));
|
msgBox.setWindowTitle(tr("First run"));
|
||||||
@ -173,10 +178,12 @@ bool Launcher::MainDialog::showFirstRunDialog()
|
|||||||
<p>It is recommended to run the Installation Wizard.</p> \
|
<p>It is recommended to run the Installation Wizard.</p> \
|
||||||
<p>The Wizard will let you select an existing Morrowind installation, \
|
<p>The Wizard will let you select an existing Morrowind installation, \
|
||||||
or install Morrowind for OpenMW to use.</p></body></html>"));
|
or install Morrowind for OpenMW to use.</p></body></html>"));
|
||||||
|
|
||||||
QAbstractButton *wizardButton =
|
QAbstractButton *wizardButton =
|
||||||
msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?!
|
msgBox.addButton(tr("Run &Installation Wizard"), QMessageBox::AcceptRole); // ActionRole doesn't work?!
|
||||||
QAbstractButton *skipButton =
|
QAbstractButton *skipButton =
|
||||||
msgBox.addButton(tr("Skip"), QMessageBox::RejectRole);
|
msgBox.addButton(tr("Skip"), QMessageBox::RejectRole);
|
||||||
|
|
||||||
Q_UNUSED(skipButton); // Surpress compiler unused warning
|
Q_UNUSED(skipButton); // Surpress compiler unused warning
|
||||||
|
|
||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
@ -189,16 +196,13 @@ bool Launcher::MainDialog::showFirstRunDialog()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
show();
|
return setup();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Launcher::MainDialog::setup()
|
bool Launcher::MainDialog::setup()
|
||||||
{
|
{
|
||||||
if (!setupLauncherSettings())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!setupGameSettings())
|
if (!setupGameSettings())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -214,17 +218,7 @@ bool Launcher::MainDialog::setup()
|
|||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
// Check if we need to run the wizard
|
show();
|
||||||
if (mLauncherSettings.value(QString("General/firstrun"), QString("true")) == QLatin1String("true"))
|
|
||||||
{
|
|
||||||
if (!showFirstRunDialog()) {
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
show(); // Show ourselves if the wizard is not being run
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,6 +623,9 @@ void Launcher::MainDialog::wizardFinished(int exitCode, QProcess::ExitStatus exi
|
|||||||
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
if (exitCode != 0 || exitStatus == QProcess::CrashExit)
|
||||||
return qApp->quit();
|
return qApp->quit();
|
||||||
|
|
||||||
|
if (!setup())
|
||||||
|
return;
|
||||||
|
|
||||||
reloadSettings();
|
reloadSettings();
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
@ -15,14 +15,16 @@ Wizard::ExistingInstallationPage::ExistingInstallationPage(QWidget *parent) :
|
|||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
// Add a placeholder item to the list of installations
|
||||||
|
QListWidgetItem *emptyItem = new QListWidgetItem(tr("No existing installations detected"));
|
||||||
|
emptyItem->setFlags(Qt::NoItemFlags);
|
||||||
|
|
||||||
|
installationsList->insertItem(0, emptyItem);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::ExistingInstallationPage::initializePage()
|
void Wizard::ExistingInstallationPage::initializePage()
|
||||||
{
|
{
|
||||||
QListWidgetItem *emptyItem = new QListWidgetItem(tr("No existing installations detected"));
|
|
||||||
emptyItem->setFlags(Qt::NoItemFlags);
|
|
||||||
installationsList->addItem(emptyItem);
|
|
||||||
|
|
||||||
// Add the available installation paths
|
// Add the available installation paths
|
||||||
QStringList paths(mWizard->mInstallations.keys());
|
QStringList paths(mWizard->mInstallations.keys());
|
||||||
|
|
||||||
@ -35,6 +37,8 @@ void Wizard::ExistingInstallationPage::initializePage()
|
|||||||
|
|
||||||
foreach (const QString &path, paths) {
|
foreach (const QString &path, paths) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(path);
|
QListWidgetItem *item = new QListWidgetItem(path);
|
||||||
|
|
||||||
|
if (installationsList->findItems(path, Qt::MatchExactly).isEmpty())
|
||||||
installationsList->addItem(item);
|
installationsList->addItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,6 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
|
|||||||
setWindowIcon(QIcon(QLatin1String(":/images/openmw-wizard.png")));
|
setWindowIcon(QIcon(QLatin1String(":/images/openmw-wizard.png")));
|
||||||
setMinimumWidth(550);
|
setMinimumWidth(550);
|
||||||
|
|
||||||
// This prevents initializePage() being called multiple times
|
|
||||||
setOption(QWizard::IndependentPages);
|
|
||||||
|
|
||||||
// Set the property for comboboxes to the text instead of index
|
// Set the property for comboboxes to the text instead of index
|
||||||
setDefaultProperty("QComboBox", "currentText", "currentIndexChanged");
|
setDefaultProperty("QComboBox", "currentText", "currentIndexChanged");
|
||||||
|
|
||||||
@ -283,9 +280,6 @@ void Wizard::MainWizard::runSettingsImporter()
|
|||||||
|
|
||||||
if (!mImporterInvoker->startProcess(QLatin1String("mwiniimport"), arguments, false))
|
if (!mImporterInvoker->startProcess(QLatin1String("mwiniimport"), arguments, false))
|
||||||
return qApp->quit();
|
return qApp->quit();
|
||||||
|
|
||||||
// Re-read the game settings
|
|
||||||
setupGameSettings();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::MainWizard::addInstallation(const QString &path)
|
void Wizard::MainWizard::addInstallation(const QString &path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user