PrismLauncher/launcher/setupwizard/LanguageWizardPage.cpp

49 lines
1.1 KiB
C++
Raw Normal View History

2017-01-05 03:05:08 +00:00
#include "LanguageWizardPage.h"
#include <MultiMC.h>
#include <translations/TranslationsModel.h>
#include "widgets/LanguageSelectionWidget.h"
2017-01-05 03:05:08 +00:00
#include <QVBoxLayout>
LanguageWizardPage::LanguageWizardPage(QWidget *parent)
2018-07-15 13:51:05 +01:00
: BaseWizardPage(parent)
2017-01-05 03:05:08 +00:00
{
2018-07-15 13:51:05 +01:00
setObjectName(QStringLiteral("languagePage"));
auto layout = new QVBoxLayout(this);
mainWidget = new LanguageSelectionWidget(this);
layout->setContentsMargins(0,0,0,0);
layout->addWidget(mainWidget);
2017-01-05 03:05:08 +00:00
retranslate();
2017-01-05 03:05:08 +00:00
}
LanguageWizardPage::~LanguageWizardPage()
{
}
bool LanguageWizardPage::wantsRefreshButton()
{
2018-07-15 13:51:05 +01:00
return true;
2017-01-05 03:05:08 +00:00
}
void LanguageWizardPage::refresh()
{
2018-07-15 13:51:05 +01:00
auto translations = MMC->translations();
translations->downloadIndex();
2017-01-05 03:05:08 +00:00
}
bool LanguageWizardPage::validatePage()
{
2018-07-15 13:51:05 +01:00
auto settings = MMC->settings();
QString key = mainWidget->getSelectedLanguageKey();
2018-07-15 13:51:05 +01:00
settings->set("Language", key);
return true;
2017-01-05 03:05:08 +00:00
}
void LanguageWizardPage::retranslate()
{
2018-07-15 13:51:05 +01:00
setTitle(tr("Language"));
setSubTitle(tr("Select the language to use in MultiMC"));
mainWidget->retranslate();
2017-01-05 03:05:08 +00:00
}