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