forked from teamnwah/openmw-tes3coop
Some minor fixes
This commit is contained in:
parent
6916c0bc94
commit
755c99df3c
7 changed files with 36 additions and 40 deletions
|
@ -16,7 +16,7 @@ Wizard::ComponentSelectionPage::ComponentSelectionPage(MainWizard *wizard) :
|
|||
setCommitPage(true);
|
||||
setButtonText(QWizard::CommitButton, tr("&Install"));
|
||||
|
||||
registerField("installation.components", componentsList);
|
||||
registerField(QLatin1String("installation.components"), componentsList);
|
||||
|
||||
connect(componentsList, SIGNAL(itemChanged(QListWidgetItem *)),
|
||||
this, SLOT(updateButton(QListWidgetItem *)));
|
||||
|
@ -25,7 +25,7 @@ Wizard::ComponentSelectionPage::ComponentSelectionPage(MainWizard *wizard) :
|
|||
|
||||
void Wizard::ComponentSelectionPage::updateButton(QListWidgetItem *item)
|
||||
{
|
||||
if (field("installation.new").toBool() == true)
|
||||
if (field(QLatin1String("installation.new")).toBool() == true)
|
||||
return; // Morrowind is always checked here
|
||||
|
||||
bool unchecked = true;
|
||||
|
@ -53,13 +53,13 @@ void Wizard::ComponentSelectionPage::initializePage()
|
|||
{
|
||||
componentsList->clear();
|
||||
|
||||
QString path(field("installation.path").toString());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
|
||||
QListWidgetItem *morrowindItem = new QListWidgetItem(QLatin1String("Morrowind"));
|
||||
QListWidgetItem *tribunalItem = new QListWidgetItem(QLatin1String("Tribunal"));
|
||||
QListWidgetItem *bloodmoonItem = new QListWidgetItem(QLatin1String("Bloodmoon"));
|
||||
|
||||
if (field("installation.new").toBool() == true)
|
||||
if (field(QLatin1String("installation.new")).toBool() == true)
|
||||
{
|
||||
morrowindItem->setFlags(morrowindItem->flags() & !Qt::ItemIsEnabled & Qt::ItemIsUserCheckable);
|
||||
morrowindItem->setData(Qt::CheckStateRole, Qt::Checked);
|
||||
|
@ -111,12 +111,12 @@ void Wizard::ComponentSelectionPage::initializePage()
|
|||
|
||||
bool Wizard::ComponentSelectionPage::validatePage()
|
||||
{
|
||||
QStringList components(field("installation.components").toStringList());
|
||||
QString path(field("installation.path").toString());
|
||||
QStringList components(field(QLatin1String("installation.components")).toStringList());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
|
||||
qDebug() << components << path << mWizard->mInstallations[path];
|
||||
|
||||
if (field("installation.new").toBool() == false) {
|
||||
if (field(QLatin1String("installation.new")).toBool() == false) {
|
||||
if (components.contains(QLatin1String("Tribunal")) && !components.contains(QLatin1String("Bloodmoon")))
|
||||
{
|
||||
if (mWizard->mInstallations[path]->hasBloodmoon)
|
||||
|
|
|
@ -13,9 +13,15 @@ Wizard::ConclusionPage::ConclusionPage(MainWizard *wizard) :
|
|||
|
||||
void Wizard::ConclusionPage::initializePage()
|
||||
{
|
||||
// Write the path to openmw.cfg
|
||||
if (field(QLatin1String("installation.new")).toBool() == true) {
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
mWizard->addInstallation(path);
|
||||
}
|
||||
|
||||
if (!mWizard->mError)
|
||||
{
|
||||
if (field("installation.new").toBool() == true)
|
||||
if (field(QLatin1String("installation.new")).toBool() == true)
|
||||
{
|
||||
textLabel->setText(tr("<html><head/><body><p>The OpenMW Wizard successfully installed Morrowind on your computer.</p> \
|
||||
<p>Click Finish to close the Wizard.</p></body></html>"));
|
||||
|
|
|
@ -82,7 +82,7 @@ bool Wizard::ExistingInstallationPage::validatePage()
|
|||
// It can be missing entirely
|
||||
// Or failed to be detected due to the target being a symlink
|
||||
|
||||
QString path(field("installation.path").toString());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
QFile file(mWizard->mInstallations[path]->iniPath);
|
||||
|
||||
if (!file.exists()) {
|
||||
|
@ -131,7 +131,7 @@ bool Wizard::ExistingInstallationPage::isComplete() const
|
|||
|
||||
int Wizard::ExistingInstallationPage::nextId() const
|
||||
{
|
||||
QString path(field("installation.path").toString());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
|
||||
if (path.isEmpty())
|
||||
return MainWizard::Page_LanguageSelection;
|
||||
|
|
|
@ -131,30 +131,20 @@ bool Wizard::IniSettings::writeFile(const QString &path, QTextStream &stream)
|
|||
|
||||
int index = buffer.lastIndexOf(section);
|
||||
if (index != -1) {
|
||||
// Append the new keys to the bottom of the section
|
||||
// Look for the next section
|
||||
index = buffer.indexOf(QLatin1Char('['), index + 1);
|
||||
|
||||
if (index == -1 )
|
||||
{
|
||||
// Beginning of next section not found, we are at the last section
|
||||
if (buffer.lastIndexOf(QLatin1String("\n")) > (buffer.lastIndexOf(section) + section.length())) {
|
||||
// There is a newline after the section
|
||||
index = buffer.lastIndexOf(QLatin1String("\n")) - 1;
|
||||
buffer.insert(index - 2, QString("\n%1=%2").arg(key, i.value().toString()));
|
||||
mSettings.remove(i.key());
|
||||
continue;
|
||||
} else {
|
||||
// No newline found, or the last newline is before the last section
|
||||
// Append the key to the bottom of the file
|
||||
buffer.append(QString("\n%1=%2").arg(key, i.value().toString()));
|
||||
mSettings.remove(i.key());
|
||||
continue;
|
||||
}
|
||||
if (index == -1 ) {
|
||||
// We are at the last section, append it to the bottom of the file
|
||||
buffer.append(QString("\n%1=%2").arg(key, i.value().toString()));
|
||||
mSettings.remove(i.key());
|
||||
continue;
|
||||
} else {
|
||||
// Not at last section, add the key at the index
|
||||
buffer.insert(index - 1, QString("\n%1=%2").arg(key, i.value().toString()));
|
||||
mSettings.remove(i.key());
|
||||
}
|
||||
|
||||
// Add the key at the index
|
||||
buffer.insert(index - 1, QString("\n%1=%2").arg(key, i.value().toString()));
|
||||
mSettings.remove(i.key());
|
||||
} else {
|
||||
// Add the section to the end of the file, because it's not found
|
||||
buffer.append(QString("\n%1\n").arg(section));
|
||||
|
|
|
@ -20,8 +20,8 @@ Wizard::InstallationPage::InstallationPage(MainWizard *wizard) :
|
|||
|
||||
void Wizard::InstallationPage::initializePage()
|
||||
{
|
||||
QString path(field("installation.path").toString());
|
||||
QStringList components(field("installation.components").toStringList());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
QStringList components(field(QLatin1String("installation.components")).toStringList());
|
||||
|
||||
logTextEdit->appendPlainText(QString("Installing to %1").arg(path));
|
||||
logTextEdit->appendPlainText(QString("Installing %1.").arg(components.join(", ")));
|
||||
|
@ -32,7 +32,7 @@ void Wizard::InstallationPage::initializePage()
|
|||
// That way installing all three components would yield 300%
|
||||
// When one component is done the bar will be filled by 33%
|
||||
|
||||
if (field("installation.new").toBool() == true) {
|
||||
if (field(QLatin1String("installation.new")).toBool() == true) {
|
||||
installProgressBar->setMaximum((components.count() * 100));
|
||||
} else {
|
||||
if (components.contains(QLatin1String("Tribunal"))
|
||||
|
@ -49,8 +49,8 @@ void Wizard::InstallationPage::initializePage()
|
|||
|
||||
void Wizard::InstallationPage::startInstallation()
|
||||
{
|
||||
QStringList components(field("installation.components").toStringList());
|
||||
QString path(field("installation.path").toString());
|
||||
QStringList components(field(QLatin1String("installation.components")).toStringList());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
|
||||
QThread *thread = new QThread();
|
||||
mUnshield = new UnshieldWorker();
|
||||
|
@ -86,7 +86,7 @@ void Wizard::InstallationPage::startInstallation()
|
|||
connect(mUnshield, SIGNAL(requestFileDialog(Wizard::Component)),
|
||||
this, SLOT(showFileDialog(Wizard::Component)), Qt::QueuedConnection);
|
||||
|
||||
if (field("installation.new").toBool() == true)
|
||||
if (field(QLatin1String("installation.new")).toBool() == true)
|
||||
{
|
||||
// Always install Morrowind
|
||||
mUnshield->setInstallComponent(Wizard::Component_Morrowind, true);
|
||||
|
@ -117,7 +117,7 @@ void Wizard::InstallationPage::startInstallation()
|
|||
mUnshield->setPath(path);
|
||||
|
||||
// Set the right codec to use for Morrowind.ini
|
||||
QString language(field("installation.language").toString());
|
||||
QString language(field(QLatin1String("installation.language")).toString());
|
||||
|
||||
if (language == QLatin1String("Polish")) {
|
||||
mUnshield->setIniCodec(QTextCodec::codecForName("windows-1250"));
|
||||
|
|
|
@ -27,7 +27,7 @@ void Wizard::InstallationTargetPage::initializePage()
|
|||
|
||||
bool Wizard::InstallationTargetPage::validatePage()
|
||||
{
|
||||
QString path(field("installation.path").toString());
|
||||
QString path(field(QLatin1String("installation.path")).toString());
|
||||
|
||||
qDebug() << "Validating path: " << path;
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ Wizard::MethodSelectionPage::MethodSelectionPage(MainWizard *wizard) :
|
|||
{
|
||||
setupUi(this);
|
||||
|
||||
registerField("installation.new", newLocationRadioButton);
|
||||
registerField(QLatin1String("installation.new"), newLocationRadioButton);
|
||||
}
|
||||
|
||||
int Wizard::MethodSelectionPage::nextId() const
|
||||
{
|
||||
if (field("installation.new").toBool() == true) {
|
||||
if (field(QLatin1String("installation.new")).toBool() == true) {
|
||||
return MainWizard::Page_InstallationTarget;
|
||||
} else {
|
||||
return MainWizard::Page_ExistingInstallation;
|
||||
|
|
Loading…
Reference in a new issue