added language selection and russian translation
This commit is contained in:
parent
8f2fd157ae
commit
dbe2d95370
5 changed files with 156 additions and 7 deletions
|
|
@ -26,9 +26,9 @@ CoreController::CoreController(const QSharedPointer<VpnConnection> &vpnConnectio
|
|||
|
||||
initNotificationHandler();
|
||||
|
||||
// auto locale = m_settings->getAppLanguage();
|
||||
// m_translator.reset(new QTranslator());
|
||||
// updateTranslator(locale);
|
||||
auto locale = m_settings->getAppLanguage();
|
||||
m_translator.reset(new QTranslator());
|
||||
updateTranslator(locale);
|
||||
}
|
||||
|
||||
void CoreController::initModels()
|
||||
|
|
|
|||
|
|
@ -267,6 +267,7 @@
|
|||
<file>ui/qml/DefaultVpn/Controls/BusyIndicatorType.qml</file>
|
||||
<file>images/controls/connect-button.svg</file>
|
||||
<file>fonts/VelaSans-GX.ttf</file>
|
||||
<file>ui/qml/DefaultVpn/Pages/PageSettingsLanguage.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/countriesFlags">
|
||||
<file>images/flagKit/ZW.svg</file>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ namespace PageLoader
|
|||
PageSettingsBackup,
|
||||
PageSettingsAbout,
|
||||
PageSettingsLogging,
|
||||
PageSettingsLanguage,
|
||||
PageSettingsSplitTunneling,
|
||||
PageSettingsAppSplitTunneling,
|
||||
PageSettingsKillSwitch,
|
||||
|
|
|
|||
|
|
@ -48,6 +48,56 @@ Page {
|
|||
Layout.rightMargin: 8
|
||||
spacing: 2
|
||||
|
||||
RadioButton {
|
||||
id: languageRadioButton
|
||||
Layout.fillWidth: true
|
||||
background: Rectangle {
|
||||
anchors.fill: parent
|
||||
radius: 8
|
||||
color: languageRadioButton.hovered ? Style.color.gray1 : Style.color.transparent
|
||||
}
|
||||
|
||||
indicator: Item { }
|
||||
|
||||
contentItem: RowLayout {
|
||||
id: content
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
implicitHeight: content.implicitHeight
|
||||
|
||||
Header3TextType {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: 8
|
||||
Layout.topMargin: 19
|
||||
Layout.bottomMargin: 19
|
||||
|
||||
text: qsTr("Language")
|
||||
color: languageRadioButton.hovered ? Style.color.gray9 : Style.color.black
|
||||
}
|
||||
|
||||
Image {
|
||||
Layout.rightMargin: 8
|
||||
source: "qrc:/images/controls/chevron-right.svg"
|
||||
|
||||
layer {
|
||||
enabled: true
|
||||
effect: ColorOverlay {
|
||||
color: Style.color.black
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onClicked: PageController.goToPage(PageEnum.PageSettingsLanguage)
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: languageRadioButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
|
||||
RadioButton {
|
||||
id: loggingRadioButton
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -60,11 +110,11 @@ Page {
|
|||
indicator: Item { }
|
||||
|
||||
contentItem: RowLayout {
|
||||
id: content
|
||||
id: content2
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitHeight: content2.implicitHeight
|
||||
|
||||
Header3TextType {
|
||||
Layout.fillWidth: true
|
||||
|
|
@ -110,7 +160,7 @@ Page {
|
|||
indicator: Item { }
|
||||
|
||||
contentItem: RowLayout {
|
||||
id: content2
|
||||
id: content3
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
97
client/ui/qml/DefaultVpn/Pages/PageSettingsLanguage.qml
Normal file
97
client/ui/qml/DefaultVpn/Pages/PageSettingsLanguage.qml
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
import PageEnum 1.0
|
||||
import Config 1.0
|
||||
|
||||
import "../Components"
|
||||
import "../Controls"
|
||||
import "../Controls/TextTypes"
|
||||
|
||||
Page {
|
||||
id: root
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
||||
RowLayout {
|
||||
Layout.leftMargin: 8
|
||||
Layout.rightMargin: 8
|
||||
Layout.topMargin: 8
|
||||
|
||||
WhiteButtonNoBorder {
|
||||
id: backButton
|
||||
imageSource: "qrc:/images/controls/arrow-left.svg"
|
||||
onClicked: PageController.closePage()
|
||||
}
|
||||
}
|
||||
|
||||
Header1TextType {
|
||||
Layout.topMargin: 8
|
||||
Layout.leftMargin: 16
|
||||
Layout.rightMargin: 16
|
||||
Layout.fillWidth: true
|
||||
text: qsTr("Select Language")
|
||||
horizontalAlignment: Qt.AlignLeft
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
ButtonGroup {
|
||||
id: languageButtonGroup
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: languageListView
|
||||
|
||||
Layout.topMargin: 16
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
model: LanguageModel
|
||||
currentIndex: LanguageModel.currentLanguageIndex
|
||||
spacing: 8
|
||||
|
||||
ScrollBar.vertical: ScrollBar {}
|
||||
|
||||
delegate: Item {
|
||||
id: languageItem
|
||||
required property string languageName
|
||||
required property int languageIndex
|
||||
required property int index
|
||||
|
||||
width: languageListView.width
|
||||
height: 60
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: radioButton.checked ? Style.color.gray1 : Style.color.transparent
|
||||
radius: 8
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
|
||||
RadioButton {
|
||||
id: radioButton
|
||||
ButtonGroup.group: languageButtonGroup
|
||||
checked: languageIndex === LanguageModel.currentLanguageIndex
|
||||
|
||||
text: languageName
|
||||
font.pixelSize: 18
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
||||
onClicked: {
|
||||
if (languageIndex !== LanguageModel.currentLanguageIndex) {
|
||||
LanguageModel.changeLanguage(languageIndex);
|
||||
PageController.closePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue