mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-11-20 08:10:11 +00:00
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#include "LanguageWizardPage.h"
|
|
#include <Application.h>
|
|
#include <translations/TranslationsModel.h>
|
|
|
|
#include "ui/widgets/LanguageSelectionWidget.h"
|
|
#include <QVBoxLayout>
|
|
#include <BuildConfig.h>
|
|
|
|
LanguageWizardPage::LanguageWizardPage(QWidget *parent)
|
|
: BaseWizardPage(parent)
|
|
{
|
|
setObjectName(QStringLiteral("languagePage"));
|
|
auto layout = new QVBoxLayout(this);
|
|
mainWidget = new LanguageSelectionWidget(this);
|
|
layout->setContentsMargins(0,0,0,0);
|
|
layout->addWidget(mainWidget);
|
|
|
|
retranslate();
|
|
}
|
|
|
|
LanguageWizardPage::~LanguageWizardPage()
|
|
{
|
|
}
|
|
|
|
bool LanguageWizardPage::wantsRefreshButton()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
void LanguageWizardPage::refresh()
|
|
{
|
|
auto translations = APPLICATION->translations();
|
|
translations->downloadIndex();
|
|
}
|
|
|
|
bool LanguageWizardPage::validatePage()
|
|
{
|
|
auto settings = APPLICATION->settings();
|
|
QString key = mainWidget->getSelectedLanguageKey();
|
|
settings->set("Language", key);
|
|
return true;
|
|
}
|
|
|
|
void LanguageWizardPage::retranslate()
|
|
{
|
|
setTitle(tr("Language"));
|
|
setSubTitle(tr("Select the language to use in %1").arg(BuildConfig.LAUNCHER_NAME));
|
|
mainWidget->retranslate();
|
|
}
|