mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-11 06:40:34 +00:00
WIP: Working on the installation selection and added the ui for the language page
This commit is contained in:
parent
0e1d3237fe
commit
d7f9604140
@ -1,14 +1,115 @@
|
|||||||
#include "componentselectionpage.hpp"
|
#include "componentselectionpage.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QAbstractButton>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::ComponentSelectionPage::ComponentSelectionPage(QWidget *parent) :
|
Wizard::ComponentSelectionPage::ComponentSelectionPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
setCommitPage(true);
|
||||||
|
setButtonText(QWizard::CommitButton, tr("&Install"));
|
||||||
|
|
||||||
|
connect(componentsList, SIGNAL(itemChanged(QListWidgetItem*)),
|
||||||
|
this, SLOT(updateButton(QListWidgetItem*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::ComponentSelectionPage::updateButton(QListWidgetItem *item)
|
||||||
|
{
|
||||||
|
if (field("installation.new").toBool() == true)
|
||||||
|
return; // Morrowind is always checked here
|
||||||
|
|
||||||
|
bool unchecked = true;
|
||||||
|
|
||||||
|
for (int i =0; i < componentsList->count(); ++i) {
|
||||||
|
QListWidgetItem *item = componentsList->item(i);
|
||||||
|
|
||||||
|
qDebug() << "item is " << item->text();
|
||||||
|
|
||||||
|
if (!item)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (item->checkState() == Qt::Checked) {
|
||||||
|
unchecked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unchecked) {
|
||||||
|
setCommitPage(false);
|
||||||
|
setButtonText(QWizard::NextButton, tr("&Skip"));
|
||||||
|
} else {
|
||||||
|
setCommitPage(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::ComponentSelectionPage::initializePage()
|
||||||
|
{
|
||||||
|
componentsList->clear();
|
||||||
|
|
||||||
|
QString path = field("installation.path").toString();
|
||||||
|
|
||||||
|
QListWidgetItem *morrowindItem = new QListWidgetItem(QString("Morrowind"));
|
||||||
|
QListWidgetItem *tribunalItem = new QListWidgetItem(QString("Tribunal"));
|
||||||
|
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QString("Bloodmoon"));
|
||||||
|
|
||||||
|
if (field("installation.new").toBool() == true)
|
||||||
|
{
|
||||||
|
morrowindItem->setFlags(morrowindItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
|
||||||
|
morrowindItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
componentsList->addItem(morrowindItem);
|
||||||
|
|
||||||
|
tribunalItem->setFlags(tribunalItem->flags() | Qt::ItemIsUserCheckable);
|
||||||
|
tribunalItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
componentsList->addItem(tribunalItem);
|
||||||
|
|
||||||
|
bloodmoonItem->setFlags(bloodmoonItem->flags() | Qt::ItemIsUserCheckable);
|
||||||
|
bloodmoonItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
componentsList->addItem(bloodmoonItem);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (mWizard->mInstallations[path]->hasMorrowind == true) {
|
||||||
|
morrowindItem->setText(tr("Morrowind\t\t(installed)"));
|
||||||
|
morrowindItem->setFlags(morrowindItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
|
||||||
|
morrowindItem->setData(Qt::CheckStateRole, Qt::Unchecked);
|
||||||
|
} else {
|
||||||
|
morrowindItem->setText(tr("Morrowind"));
|
||||||
|
morrowindItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentsList->addItem(morrowindItem);
|
||||||
|
|
||||||
|
if (mWizard->mInstallations[path]->hasTribunal == true) {
|
||||||
|
tribunalItem->setText(tr("Tribunal\t\t(installed)"));
|
||||||
|
tribunalItem->setFlags(tribunalItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
|
||||||
|
tribunalItem->setData(Qt::CheckStateRole, Qt::Unchecked);
|
||||||
|
} else {
|
||||||
|
tribunalItem->setText(tr("Tribunal"));
|
||||||
|
tribunalItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentsList->addItem(tribunalItem);
|
||||||
|
|
||||||
|
if (mWizard->mInstallations[path]->hasBloodmoon == true) {
|
||||||
|
bloodmoonItem->setText(tr("Bloodmoon\t\t(installed)"));
|
||||||
|
bloodmoonItem->setFlags(bloodmoonItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
|
||||||
|
bloodmoonItem->setData(Qt::CheckStateRole, Qt::Unchecked);
|
||||||
|
} else {
|
||||||
|
bloodmoonItem->setText(tr("Bloodmoon"));
|
||||||
|
bloodmoonItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentsList->addItem(bloodmoonItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wizard::ComponentSelectionPage::nextId() const
|
int Wizard::ComponentSelectionPage::nextId() const
|
||||||
{
|
{
|
||||||
return MainWizard::Page_Installation;
|
if (isCommitPage())
|
||||||
|
return MainWizard::Page_Installation;
|
||||||
|
|
||||||
|
return MainWizard::Page_Import;
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,25 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class ComponentSelectionPage : public QWizardPage, private Ui::ComponentSelectionPage
|
class ComponentSelectionPage : public QWizardPage, private Ui::ComponentSelectionPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ComponentSelectionPage(QWidget *parent = 0);
|
ComponentSelectionPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateButton(QListWidgetItem *item);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,28 @@
|
|||||||
#include "conclusionpage.hpp"
|
#include "conclusionpage.hpp"
|
||||||
|
|
||||||
Wizard::ConclusionPage::ConclusionPage(QWidget *parent) :
|
#include <QDebug>
|
||||||
QWizardPage(parent)
|
|
||||||
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
|
Wizard::ConclusionPage::ConclusionPage(MainWizard *wizard) :
|
||||||
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wizard::ConclusionPage::initializePage()
|
||||||
|
{
|
||||||
|
if (field("installation.new").toBool() == true)
|
||||||
|
{
|
||||||
|
textLabel->setText(tr("The OpenMW Wizard successfully installed Morrowind on your computer.\n\n") +
|
||||||
|
tr("Click Finish to close the Wizard."));
|
||||||
|
} else {
|
||||||
|
textLabel->setText(tr("The OpenMW Wizard successfully modified your existing Morrowind installation.\n\n") +
|
||||||
|
tr("Click Finish to close the Wizard."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int Wizard::ConclusionPage::nextId() const
|
int Wizard::ConclusionPage::nextId() const
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -7,15 +7,22 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class ConclusionPage : public QWizardPage, private Ui::ConclusionPage
|
class ConclusionPage : public QWizardPage, private Ui::ConclusionPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ConclusionPage(QWidget *parent = 0);
|
ConclusionPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,105 @@
|
|||||||
#include "existinginstallationpage.hpp"
|
#include "existinginstallationpage.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::ExistingInstallationPage::ExistingInstallationPage(QWidget *parent) :
|
Wizard::ExistingInstallationPage::ExistingInstallationPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
connect(detectedList, SIGNAL(currentTextChanged(QString)),
|
||||||
|
this, SLOT(textChanged(QString)));
|
||||||
|
|
||||||
|
connect(detectedList,SIGNAL(itemSelectionChanged()),
|
||||||
|
this, SIGNAL(completeChanged()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::ExistingInstallationPage::on_browseButton_clicked()
|
||||||
|
{
|
||||||
|
QString selectedFile = QFileDialog::getOpenFileName(
|
||||||
|
this,
|
||||||
|
tr("Select master file"),
|
||||||
|
QDir::currentPath(),
|
||||||
|
QString(tr("Morrowind master file (*.esm)")),
|
||||||
|
NULL,
|
||||||
|
QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
|
QFileInfo info(selectedFile);
|
||||||
|
if (!info.exists())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDir dir(info.absolutePath());
|
||||||
|
if (!dir.cdUp())
|
||||||
|
return; // Cannot move out of the Data Files directory
|
||||||
|
|
||||||
|
QString path = QDir::toNativeSeparators(dir.absolutePath());
|
||||||
|
QList<QListWidgetItem*> items = detectedList->findItems(path, Qt::MatchExactly);
|
||||||
|
|
||||||
|
if (items.isEmpty())
|
||||||
|
{
|
||||||
|
// Path is not yet in the list, add it
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(path);
|
||||||
|
detectedList->addItem(item);
|
||||||
|
detectedList->setCurrentItem(item); // Select it too
|
||||||
|
} else {
|
||||||
|
detectedList->setCurrentItem(items.first());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::ExistingInstallationPage::textChanged(const QString &text)
|
||||||
|
{
|
||||||
|
// Set the installation path manually, as registerField doesn't work
|
||||||
|
if (!text.isEmpty())
|
||||||
|
wizard()->setField("installation.path", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::ExistingInstallationPage::initializePage()
|
||||||
|
{
|
||||||
|
|
||||||
|
QStringList paths = mWizard->mInstallations.keys();
|
||||||
|
|
||||||
|
if (paths.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
detectedList->clear();
|
||||||
|
|
||||||
|
foreach (const QString &path, paths) {
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(path);
|
||||||
|
detectedList->addItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Wizard::ExistingInstallationPage::isComplete() const
|
||||||
|
{
|
||||||
|
if (detectedList->selectionModel()->hasSelection()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wizard::ExistingInstallationPage::nextId() const
|
int Wizard::ExistingInstallationPage::nextId() const
|
||||||
{
|
{
|
||||||
return MainWizard::Page_ComponentSelection;
|
QString path = field("installation.path").toString();
|
||||||
|
|
||||||
|
if (path.isEmpty())
|
||||||
|
return MainWizard::Page_ComponentSelection;
|
||||||
|
|
||||||
|
if (!mWizard->mInstallations.contains(path))
|
||||||
|
return MainWizard::Page_ComponentSelection;
|
||||||
|
|
||||||
|
if (mWizard->mInstallations[path]->hasMorrowind == true &&
|
||||||
|
mWizard->mInstallations[path]->hasTribunal == true &&
|
||||||
|
mWizard->mInstallations[path]->hasBloodmoon == true)
|
||||||
|
{
|
||||||
|
return MainWizard::Page_Import;
|
||||||
|
} else {
|
||||||
|
return MainWizard::Page_ComponentSelection;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,27 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class ExistingInstallationPage : public QWizardPage, private Ui::ExistingInstallationPage
|
class ExistingInstallationPage : public QWizardPage, private Ui::ExistingInstallationPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ExistingInstallationPage(QWidget *parent = 0);
|
ExistingInstallationPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
virtual bool isComplete() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_browseButton_clicked();
|
||||||
|
void textChanged(const QString &text);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::ImportPage::ImportPage(QWidget *parent) :
|
Wizard::ImportPage::ImportPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,19 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class ImportPage : public QWizardPage, private Ui::ImportPage
|
class ImportPage : public QWizardPage, private Ui::ImportPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ImportPage(QWidget *parent = 0);
|
ImportPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,22 @@
|
|||||||
#include "installationpage.hpp"
|
#include "installationpage.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::InstallationPage::InstallationPage(QWidget *parent) :
|
Wizard::InstallationPage::InstallationPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Wizard::InstallationPage::initializePage()
|
||||||
|
{
|
||||||
|
qDebug() << "installing to: " << field("installation.path").toString();
|
||||||
|
logTextEdit->setText(QString("Installing to %1").arg(field("installation.path").toString()));
|
||||||
|
}
|
||||||
|
|
||||||
int Wizard::InstallationPage::nextId() const
|
int Wizard::InstallationPage::nextId() const
|
||||||
{
|
{
|
||||||
return MainWizard::Page_Import;
|
return MainWizard::Page_Import;
|
||||||
|
@ -7,15 +7,22 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class InstallationPage : public QWizardPage, private Ui::InstallationPage
|
class InstallationPage : public QWizardPage, private Ui::InstallationPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InstallationPage(QWidget *parent = 0);
|
InstallationPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,40 @@
|
|||||||
#include "installationtargetpage.hpp"
|
#include "installationtargetpage.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::InstallationTargetPage::InstallationTargetPage(QWidget *parent) :
|
Wizard::InstallationTargetPage::InstallationTargetPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
registerField("installation.path*", targetLineEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::InstallationTargetPage::initializePage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::InstallationTargetPage::on_browseButton_clicked()
|
||||||
|
{
|
||||||
|
QString selectedPath = QFileDialog::getExistingDirectory(
|
||||||
|
this,
|
||||||
|
tr("Select where to install Morrowind"),
|
||||||
|
QDir::currentPath(),
|
||||||
|
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
|
||||||
|
qDebug() << selectedPath;
|
||||||
|
QFileInfo info(selectedPath);
|
||||||
|
if (!info.exists())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (info.isWritable())
|
||||||
|
targetLineEdit->setText(info.absoluteFilePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wizard::InstallationTargetPage::nextId() const
|
int Wizard::InstallationTargetPage::nextId() const
|
||||||
|
@ -7,15 +7,25 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class InstallationTargetPage : public QWizardPage, private Ui::InstallationTargetPage
|
class InstallationTargetPage : public QWizardPage, private Ui::InstallationTargetPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
InstallationTargetPage(QWidget *parent = 0);
|
InstallationTargetPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void on_browseButton_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::IntroPage::IntroPage(QWidget *parent) :
|
Wizard::IntroPage::IntroPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
|
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,18 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class IntroPage : public QWizardPage, private Ui::IntroPage
|
class IntroPage : public QWizardPage, private Ui::IntroPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
IntroPage(QWidget *parent = 0);
|
IntroPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "intropage.hpp"
|
#include "intropage.hpp"
|
||||||
#include "methodselectionpage.hpp"
|
#include "methodselectionpage.hpp"
|
||||||
#include "existinginstallationpage.hpp"
|
#include "existinginstallationpage.hpp"
|
||||||
@ -19,18 +23,67 @@ Wizard::MainWizard::MainWizard(QWidget *parent) :
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
setWindowTitle(tr("OpenMW Wizard"));
|
setWindowTitle(tr("OpenMW Wizard"));
|
||||||
|
setupInstallations();
|
||||||
setupPages();
|
setupPages();
|
||||||
|
|
||||||
|
QDir dir("/home/pvdk/data");
|
||||||
|
QFileInfo info(dir.absoluteFilePath("../Morrowind.ini"));
|
||||||
|
|
||||||
|
qDebug() << "exists? " << info.exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Wizard::MainWizard::setupInstallations()
|
||||||
|
{
|
||||||
|
// TODO: detect existing installations
|
||||||
|
QStringList paths;
|
||||||
|
paths << QString("/home/pvdk/.wine/drive_c/Program Files/Bethesda Softworks/Morrowind");
|
||||||
|
paths << QString("/home/pvdk/openmw/Data Files");
|
||||||
|
paths << QString("/usr/games/morrowind");
|
||||||
|
|
||||||
|
foreach (const QString &path, paths)
|
||||||
|
{
|
||||||
|
Installation* install = new Installation();
|
||||||
|
|
||||||
|
install->hasMorrowind = (findFiles(QString("Morrowind"), path));
|
||||||
|
install->hasTribunal = true;
|
||||||
|
install->hasBloodmoon = false;
|
||||||
|
|
||||||
|
mInstallations.insert(QDir::toNativeSeparators(path), install);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wizard::MainWizard::setupPages()
|
void Wizard::MainWizard::setupPages()
|
||||||
{
|
{
|
||||||
setPage(Page_Intro, new IntroPage);
|
setPage(Page_Intro, new IntroPage(this));
|
||||||
setPage(Page_MethodSelection, new MethodSelectionPage);
|
setPage(Page_MethodSelection, new MethodSelectionPage(this));
|
||||||
setPage(Page_ExistingInstallation, new ExistingInstallationPage);
|
setPage(Page_ExistingInstallation, new ExistingInstallationPage(this));
|
||||||
setPage(Page_InstallationTarget, new InstallationTargetPage);
|
setPage(Page_InstallationTarget, new InstallationTargetPage(this));
|
||||||
setPage(Page_ComponentSelection, new ComponentSelectionPage);
|
setPage(Page_ComponentSelection, new ComponentSelectionPage(this));
|
||||||
setPage(Page_Installation, new InstallationPage);
|
setPage(Page_Installation, new InstallationPage(this));
|
||||||
setPage(Page_Import, new ImportPage);
|
setPage(Page_Import, new ImportPage(this));
|
||||||
setPage(Page_Conclusion, new ConclusionPage);
|
setPage(Page_Conclusion, new ConclusionPage(this));
|
||||||
setStartId(Page_Intro);
|
setStartId(Page_Intro);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Wizard::MainWizard::findFiles(const QString &name, const QString &path)
|
||||||
|
{
|
||||||
|
QDir dir(path);
|
||||||
|
|
||||||
|
if (!dir.exists())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!dir.cd(QString("Data Files")))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
qDebug() << "name: " << name + QString(".esm") << dir.absolutePath();
|
||||||
|
|
||||||
|
// TODO: add MIME handling to make sure the files are real
|
||||||
|
if (dir.exists(name + QString(".esm")) && dir.exists(name + QString(".bsa")))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define MAINWIZARD_HPP
|
#define MAINWIZARD_HPP
|
||||||
|
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
|
#include <QMap>
|
||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
@ -11,6 +12,12 @@ namespace Wizard
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
struct Installation {
|
||||||
|
bool hasMorrowind;
|
||||||
|
bool hasTribunal;
|
||||||
|
bool hasBloodmoon;
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
Page_Intro,
|
Page_Intro,
|
||||||
Page_MethodSelection,
|
Page_MethodSelection,
|
||||||
@ -24,8 +31,14 @@ namespace Wizard
|
|||||||
|
|
||||||
MainWizard(QWidget *parent = 0);
|
MainWizard(QWidget *parent = 0);
|
||||||
|
|
||||||
|
static bool findFiles(const QString &name, const QString &path);
|
||||||
|
QMap<QString, Installation*> mInstallations;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setupInstallations();
|
||||||
void setupPages();
|
void setupPages();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,23 @@
|
|||||||
#include "methodselectionpage.hpp"
|
#include "methodselectionpage.hpp"
|
||||||
|
#include <QDebug>
|
||||||
#include "mainwizard.hpp"
|
#include "mainwizard.hpp"
|
||||||
|
|
||||||
Wizard::MethodSelectionPage::MethodSelectionPage(QWidget *parent) :
|
Wizard::MethodSelectionPage::MethodSelectionPage(MainWizard *wizard) :
|
||||||
QWizardPage(parent)
|
QWizardPage(wizard),
|
||||||
|
mWizard(wizard)
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
|
registerField("installation.new", newLocationRadioButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Wizard::MethodSelectionPage::nextId() const
|
int Wizard::MethodSelectionPage::nextId() const
|
||||||
{
|
{
|
||||||
if (newLocationRadioButton->isChecked()) {
|
if (newLocationRadioButton->isChecked()) {
|
||||||
|
//wizard()->setField("installation.new", true);
|
||||||
return MainWizard::Page_InstallationTarget;
|
return MainWizard::Page_InstallationTarget;
|
||||||
} else {
|
} else {
|
||||||
|
//wizard()->setField("installation.new", false);
|
||||||
return MainWizard::Page_ExistingInstallation;
|
return MainWizard::Page_ExistingInstallation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,19 @@
|
|||||||
|
|
||||||
namespace Wizard
|
namespace Wizard
|
||||||
{
|
{
|
||||||
|
class MainWizard;
|
||||||
|
|
||||||
class MethodSelectionPage : public QWizardPage, private Ui::MethodSelectionPage
|
class MethodSelectionPage : public QWizardPage, private Ui::MethodSelectionPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MethodSelectionPage(QWidget *parent = 0);
|
MethodSelectionPage(MainWizard *wizard);
|
||||||
|
|
||||||
int nextId() const;
|
int nextId() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
MainWizard *mWizard;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>398</width>
|
||||||
<height>300</height>
|
<height>298</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -20,9 +20,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="textLabel">
|
<widget class="QLabel" name="textLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>The OpenMW Wizard successfully installed Morrowind on your computer.
|
<string>Placeholder</string>
|
||||||
|
|
||||||
Click Finish to close the Wizard.</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>396</width>
|
||||||
<height>300</height>
|
<height>296</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="detectedLabel">
|
<widget class="QLabel" name="detectedLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Detected Installations:</string>
|
<string>Detected installations:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -33,6 +33,9 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>No existing installations detected</string>
|
<string>No existing installations detected</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="flags">
|
||||||
|
<set>NoItemFlags</set>
|
||||||
|
</property>
|
||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
72
files/ui/wizard/languageselectionpage.ui
Normal file
72
files/ui/wizard/languageselectionpage.ui
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>WizardPage</class>
|
||||||
|
<widget class="QWizardPage" name="WizardPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>398</width>
|
||||||
|
<height>298</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>WizardPage</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="folderIconLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p><img src=":/icons/tango/48x48/preferences-desktop-locale.png"/></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="infoLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>What is the language of the Morrowind installation?</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>230</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../../wizard/wizard.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -1,7 +1,8 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<RCC>
|
||||||
<qresource prefix="icons/tango">
|
<qresource prefix="icons/tango">
|
||||||
|
<file alias="48x48/preferences-desktop-locale.png">icons/tango/48x48/preferences-desktop-locale.png</file>
|
||||||
<file alias="index.theme">icons/tango/index.theme</file>
|
<file alias="index.theme">icons/tango/index.theme</file>
|
||||||
<file alias="48x48/folder.png">icons/tango/48x48/folder.png</file>
|
<file alias="48x48/folder.png">icons/tango/48x48/folder.png</file>
|
||||||
<file alias="48x48/system-installer.png">icons/tango/48x48/system-installer.png</file>
|
<file alias="48x48/system-installer.png">icons/tango/48x48/system-installer.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user