summaryrefslogtreecommitdiffstats
path: root/application/pages/global/LanguagePage.cpp
blob: ae3168ccd6ce9948e06547d61f268aaab5c47bba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "LanguagePage.h"

#include "widgets/LanguageSelectionWidget.h"
#include <QVBoxLayout>

LanguagePage::LanguagePage(QWidget* parent) :
    QWidget(parent)
{
    setObjectName(QStringLiteral("languagePage"));
    auto layout = new QVBoxLayout(this);
    mainWidget = new LanguageSelectionWidget(this);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(mainWidget);
    retranslate();
}

LanguagePage::~LanguagePage()
{
}

bool LanguagePage::apply()
{
    applySettings();
    return true;
}

void LanguagePage::applySettings()
{
    auto settings = MMC->settings();
    QString key = mainWidget->getSelectedLanguageKey();
    settings->set("Language", key);
}

void LanguagePage::loadSettings()
{
    // NIL
}

void LanguagePage::retranslate()
{
    mainWidget->retranslate();
}

void LanguagePage::changeEvent(QEvent* event)
{
    if (event->type() == QEvent::LanguageChange)
    {
        retranslate();
    }
    QWidget::changeEvent(event);
}