2017-01-05 08:35:08 +05:30
|
|
|
#include "LanguageWizardPage.h"
|
2021-11-20 20:52:22 +05:30
|
|
|
#include <Application.h>
|
2017-01-05 08:35:08 +05:30
|
|
|
#include <translations/TranslationsModel.h>
|
|
|
|
|
2021-11-22 08:25:16 +05:30
|
|
|
#include "ui/widgets/LanguageSelectionWidget.h"
|
2017-01-05 08:35:08 +05:30
|
|
|
#include <QVBoxLayout>
|
2021-10-18 04:17:02 +05:30
|
|
|
#include <BuildConfig.h>
|
2017-01-05 08:35:08 +05:30
|
|
|
|
|
|
|
LanguageWizardPage::LanguageWizardPage(QWidget *parent)
|
2018-07-15 18:21:05 +05:30
|
|
|
: BaseWizardPage(parent)
|
2017-01-05 08:35:08 +05:30
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
setObjectName(QStringLiteral("languagePage"));
|
2019-01-09 09:08:35 +05:30
|
|
|
auto layout = new QVBoxLayout(this);
|
|
|
|
mainWidget = new LanguageSelectionWidget(this);
|
|
|
|
layout->setContentsMargins(0,0,0,0);
|
|
|
|
layout->addWidget(mainWidget);
|
2017-01-05 08:35:08 +05:30
|
|
|
|
2019-01-09 09:08:35 +05:30
|
|
|
retranslate();
|
2017-01-05 08:35:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
LanguageWizardPage::~LanguageWizardPage()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool LanguageWizardPage::wantsRefreshButton()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
return true;
|
2017-01-05 08:35:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void LanguageWizardPage::refresh()
|
|
|
|
{
|
2021-11-20 20:52:22 +05:30
|
|
|
auto translations = APPLICATION->translations();
|
2018-07-15 18:21:05 +05:30
|
|
|
translations->downloadIndex();
|
2017-01-05 08:35:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
bool LanguageWizardPage::validatePage()
|
|
|
|
{
|
2021-11-20 20:52:22 +05:30
|
|
|
auto settings = APPLICATION->settings();
|
2019-01-09 09:08:35 +05:30
|
|
|
QString key = mainWidget->getSelectedLanguageKey();
|
2018-07-15 18:21:05 +05:30
|
|
|
settings->set("Language", key);
|
|
|
|
return true;
|
2017-01-05 08:35:08 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
void LanguageWizardPage::retranslate()
|
|
|
|
{
|
2018-07-15 18:21:05 +05:30
|
|
|
setTitle(tr("Language"));
|
2021-10-18 04:17:02 +05:30
|
|
|
setSubTitle(tr("Select the language to use in %1").arg(BuildConfig.LAUNCHER_NAME));
|
2019-01-09 09:08:35 +05:30
|
|
|
mainWidget->retranslate();
|
2017-01-05 08:35:08 +05:30
|
|
|
}
|