2017-01-05 03:05:08 +00:00
|
|
|
#include "LanguageWizardPage.h"
|
2021-11-20 15:22:22 +00:00
|
|
|
#include <Application.h>
|
2017-01-05 03:05:08 +00:00
|
|
|
#include <translations/TranslationsModel.h>
|
|
|
|
|
2021-11-22 02:55:16 +00:00
|
|
|
#include "ui/widgets/LanguageSelectionWidget.h"
|
2017-01-05 03:05:08 +00:00
|
|
|
#include <QVBoxLayout>
|
2021-10-17 22:47:02 +00:00
|
|
|
#include <BuildConfig.h>
|
2017-01-05 03:05:08 +00:00
|
|
|
|
|
|
|
LanguageWizardPage::LanguageWizardPage(QWidget *parent)
|
2018-07-15 12:51:05 +00:00
|
|
|
: BaseWizardPage(parent)
|
2017-01-05 03:05:08 +00:00
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
setObjectName(QStringLiteral("languagePage"));
|
2019-01-09 03:38:35 +00:00
|
|
|
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
|
|
|
|
2019-01-09 03:38:35 +00:00
|
|
|
retranslate();
|
2017-01-05 03:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
LanguageWizardPage::~LanguageWizardPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LanguageWizardPage::wantsRefreshButton()
|
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
return true;
|
2017-01-05 03:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LanguageWizardPage::refresh()
|
|
|
|
{
|
2021-11-20 15:22:22 +00:00
|
|
|
auto translations = APPLICATION->translations();
|
2018-07-15 12:51:05 +00:00
|
|
|
translations->downloadIndex();
|
2017-01-05 03:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool LanguageWizardPage::validatePage()
|
|
|
|
{
|
2021-11-20 15:22:22 +00:00
|
|
|
auto settings = APPLICATION->settings();
|
2019-01-09 03:38:35 +00:00
|
|
|
QString key = mainWidget->getSelectedLanguageKey();
|
2018-07-15 12:51:05 +00:00
|
|
|
settings->set("Language", key);
|
|
|
|
return true;
|
2017-01-05 03:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void LanguageWizardPage::retranslate()
|
|
|
|
{
|
2018-07-15 12:51:05 +00:00
|
|
|
setTitle(tr("Language"));
|
2021-10-17 22:47:02 +00:00
|
|
|
setSubTitle(tr("Select the language to use in %1").arg(BuildConfig.LAUNCHER_NAME));
|
2019-01-09 03:38:35 +00:00
|
|
|
mainWidget->retranslate();
|
2017-01-05 03:05:08 +00:00
|
|
|
}
|