Skip to content

An OpenMW mod that lets you play the whole Elder Scrolls III: Morrowind as a top-down isometric game — with full online co-op or MMO modes.

C++
1.5 KB
Raw Blame
#include "languageselectionpage.hpp"

#include <components/misc/scalableicon.hpp>

#include "mainwizard.hpp"

Wizard::LanguageSelectionPage::LanguageSelectionPage(QWidget* parent)
    : QWizardPage(parent)
{
    mWizard = qobject_cast<MainWizard*>(parent);

    setupUi(this);

    flagIcon->setIcon(Misc::ScalableIcon::load(":preferences-desktop-locale"));

    registerField(QStringLiteral("installation.language"), languageComboBox, "currentData", "currentDataChanged");

    const QList<std::pair<QString, QString>> languages = { { tr("English"), QStringLiteral("English") },
        { tr("French"), QStringLiteral("French") }, { tr("German"), QStringLiteral("German") },
        { tr("Italian"), QStringLiteral("Italian") }, { tr("Polish"), QStringLiteral("Polish") },
        { tr("Russian"), QStringLiteral("Russian") }, { tr("Spanish"), QStringLiteral("Spanish") } };

    for (const auto& [localizedName, name] : languages)
    {
        languageComboBox->addItem(localizedName, name);
    }
}

int Wizard::LanguageSelectionPage::nextId() const
{
    if (!field(QStringLiteral("installation.retailDisc")).toBool())
    {
        const QString path(field(QStringLiteral("installation.path")).toString());
        if (!path.isEmpty())
        {
            const MainWizard::Installation& installation = mWizard->mInstallations[path];
            if (installation.hasMorrowind && installation.hasTribunal && installation.hasBloodmoon)
                return MainWizard::Page_Import;
        }
    }

    return MainWizard::Page_ComponentSelection;
}