UI: Improve re-translating after language change.

This commit is contained in:
Nodir Temirkhodjaev 2019-10-21 20:45:06 +05:00
parent 71c5790124
commit 1bb4965f17
20 changed files with 172 additions and 318 deletions

View File

@ -279,6 +279,9 @@ bool FortManager::setupEngine()
return false;
}
connect(TranslationManager::instance(), &TranslationManager::languageChanged,
m_engine, &QQmlEngine::retranslate);
m_appWindow = qobject_cast<QWindow *>(rootObjects.first());
Q_ASSERT(m_appWindow);

View File

@ -166,8 +166,7 @@ T.SplitView {
RoundButtonTipSmall {
visible: selectFileEnabled
icon.source: "qrc:/images/folder_explore.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Select File")
tipText: qsTranslate("qml", "Select File")
onClicked: {
const area = textArea1.activeFocus ? textArea1 : textArea2;
const filter = qsTranslate("qml", "Programs (*.exe);;All files (*.*)");

View File

@ -27,22 +27,19 @@ Menu {
MenuItem {
icon.source: "qrc:/images/page_copy.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Copy")
text: qsTranslate("qml", "Copy")
enabled: textField && textField.selectedText
onTriggered: textField.copy()
}
MenuItem {
icon.source: "qrc:/images/cut.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Cut")
text: qsTranslate("qml", "Cut")
enabled: textField && textField.selectedText
onTriggered: textField.cut()
}
MenuItem {
icon.source: "qrc:/images/page_paste.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Paste")
text: qsTranslate("qml", "Paste")
enabled: textField && textField.canPaste
onTriggered: textField.paste()
}
@ -51,8 +48,7 @@ Menu {
MenuItem {
icon.source: "qrc:/images/textfield_rename.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Select All")
text: qsTranslate("qml", "Select All")
enabled: textField && textField.text
onTriggered: textField.selectAll()
}

View File

@ -16,13 +16,11 @@ BasePage {
TabButton {
icon.source: "qrc:/images/world.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Internet Addresses")
text: qsTranslate("qml", "Internet Addresses")
}
TabButton {
icon.source: "qrc:/images/world_link.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Allowed Internet Addresses")
text: qsTranslate("qml", "Allowed Internet Addresses")
}
}

View File

@ -61,21 +61,18 @@ BasePage {
TextFieldFrame {
id: editGroupName
enabled: appGroupsCount < 16
placeholderText: translationManager.trTrigger
&& qsTranslate("qml", "Group Name")
placeholderText: qsTranslate("qml", "Group Name")
}
Button {
enabled: editGroupName.text
icon.source: "qrc:/images/application_add.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Add Group")
text: qsTranslate("qml", "Add Group")
onClicked: addAppGroup()
}
RoundButtonTip {
enabled: editGroupName.text && appsColumn.enabled
icon.source: "qrc:/images/application_edit.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Rename Group")
tipText: qsTranslate("qml", "Rename Group")
onClicked: renameAppGroup()
}
@ -86,8 +83,7 @@ BasePage {
CheckBox {
id: cbBlockAll
enabled: !cbAllowAll.checked || checked
text: translationManager.trTrigger
&& qsTranslate("qml", "Block All")
text: qsTranslate("qml", "Block All")
checked: firewallConf.appBlockAll
onToggled: {
firewallConf.appBlockAll = checked;
@ -98,8 +94,7 @@ BasePage {
CheckBox {
id: cbAllowAll
enabled: !cbBlockAll.checked || checked
text: translationManager.trTrigger
&& qsTranslate("qml", "Allow All")
text: qsTranslate("qml", "Allow All")
checked: firewallConf.appAllowAll
onToggled: {
firewallConf.appAllowAll = checked;

View File

@ -36,19 +36,16 @@ BasePage {
ButtonMenu {
enabled: appListView.count
icon.source: "qrc:/images/bin_empty.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Clear…")
text: qsTranslate("qml", "Clear…")
MenuItem {
enabled: appListView.currentIndex >= 0
text: translationManager.trTrigger
&& qsTranslate("qml", "Remove Application")
text: qsTranslate("qml", "Remove Application")
onTriggered: appBlockedModel.remove(
appListView.currentIndex)
}
MenuItem {
text: translationManager.trTrigger
&& qsTranslate("qml", "Clear All")
text: qsTranslate("qml", "Clear All")
onTriggered: {
appListView.currentIndex = -1;
appBlockedModel.clear();
@ -60,32 +57,27 @@ BasePage {
ButtonMenu {
enabled: appListView.count
icon.source: "qrc:/images/page_copy.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Copy…")
text: qsTranslate("qml", "Copy…")
MenuItem {
enabled: !!currentAppPath
text: translationManager.trTrigger
&& qsTranslate("qml", "Application Path")
text: qsTranslate("qml", "Application Path")
onTriggered: guiUtil.setClipboardData(currentAppPath)
}
MenuItem {
enabled: !!currentIpText
text: translationManager.trTrigger
&& qsTranslate("qml", "IP Address")
text: qsTranslate("qml", "IP Address")
onTriggered: guiUtil.setClipboardData(currentIpText)
}
MenuItem {
enabled: !!currentHostName
text: translationManager.trTrigger
&& qsTranslate("qml", "Host name")
text: qsTranslate("qml", "Host name")
onTriggered: guiUtil.setClipboardData(currentHostName)
}
}
CheckBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Show host names")
text: qsTranslate("qml", "Show host names")
checked: firewallConf.resolveAddress
onToggled: {
if (firewallConf.resolveAddress === checked)
@ -103,8 +95,7 @@ BasePage {
Switch {
font.weight: Font.DemiBold
text: translationManager.trTrigger
&& qsTranslate("qml", "Show Blocked Applications")
text: qsTranslate("qml", "Show Blocked Applications")
checked: firewallConf.logBlocked
onToggled: {
if (firewallConf.logBlocked === checked)

View File

@ -77,33 +77,27 @@ Page {
TabButton {
icon.source: "qrc:/images/cog.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Options")
text: qsTranslate("qml", "Options")
}
TabButton {
icon.source: "qrc:/images/link.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "IPv4 Addresses")
text: qsTranslate("qml", "IPv4 Addresses")
}
TabButton {
icon.source: "qrc:/images/application_double.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Applications")
text: qsTranslate("qml", "Applications")
}
TabButton {
icon.source: "qrc:/images/application_error.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Blocked")
text: qsTranslate("qml", "Blocked")
}
TabButton {
icon.source: "qrc:/images/chart_line.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Statistics")
text: qsTranslate("qml", "Statistics")
}
TabButton {
icon.source: "qrc:/images/clock.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Schedule")
text: qsTranslate("qml", "Schedule")
}
}
@ -128,8 +122,7 @@ Page {
RowLayout {
LinkButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Logs")
text: qsTranslate("qml", "Logs")
tipText: path
onClicked: Qt.openUrlExternally("file:///" + path)
readonly property string path: fortSettings.logsPath
@ -138,8 +131,7 @@ Page {
VSeparator {}
LinkButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Profile")
text: qsTranslate("qml", "Profile")
tipText: path
onClicked: Qt.openUrlExternally("file:///" + path)
readonly property string path: fortSettings.profilePath
@ -148,8 +140,7 @@ Page {
VSeparator {}
LinkButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Statistics")
text: qsTranslate("qml", "Statistics")
tipText: path
onClicked: Qt.openUrlExternally("file:///" + path)
readonly property string path: fortSettings.statPath
@ -158,8 +149,7 @@ Page {
VSeparator {}
LinkButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Releases")
text: qsTranslate("qml", "Releases")
tipText: link
onClicked: Qt.openUrlExternally(link)
readonly property string link: fortSettings.appUpdatesUrl
@ -173,21 +163,18 @@ Page {
Button {
enabled: confFlagsEdited || confEdited || othersEdited
icon.source: "qrc:/images/tick.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "OK")
text: qsTranslate("qml", "OK")
onClicked: mainPage.save(true)
}
Button {
enabled: confFlagsEdited || confEdited || othersEdited
icon.source: "qrc:/images/accept.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Apply")
text: qsTranslate("qml", "Apply")
onClicked: mainPage.save(false)
}
Button {
icon.source: "qrc:/images/cancel.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Cancel")
text: qsTranslate("qml", "Cancel")
onClicked: closeWindow()
}
}

View File

@ -45,15 +45,13 @@ BasePage {
CheckBox {
id: cbStart
text: translationManager.trTrigger
&& qsTranslate("qml", "Start with Windows")
text: qsTranslate("qml", "Start with Windows")
checked: fortSettings.startWithWindows
onToggled: setIniEdited()
}
CheckBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Stop traffic when Fort Firewall is not running")
text: qsTranslate("qml", "Stop traffic when Fort Firewall is not running")
checked: firewallConf.provBoot
onToggled: {
firewallConf.provBoot = checked;
@ -68,8 +66,7 @@ BasePage {
CheckBox {
id: cbFilterEnabled
width: Math.max(implicitWidth, cbStopTraffic.implicitWidth)
text: translationManager.trTrigger
&& qsTranslate("qml", "Filter Enabled")
text: qsTranslate("qml", "Filter Enabled")
checked: firewallConf.filterEnabled
onToggled: {
firewallConf.filterEnabled = checked;
@ -79,8 +76,7 @@ BasePage {
}
CheckBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Filter Local Addresses")
text: qsTranslate("qml", "Filter Local Addresses")
checked: firewallConf.filterLocals
onToggled: {
firewallConf.filterLocals = checked;
@ -96,8 +92,7 @@ BasePage {
CheckBox {
id: cbStopTraffic
width: cbFilterEnabled.width
text: translationManager.trTrigger
&& qsTranslate("qml", "Stop Traffic")
text: qsTranslate("qml", "Stop Traffic")
checked: firewallConf.stopTraffic
onToggled: {
firewallConf.stopTraffic = checked;
@ -107,8 +102,7 @@ BasePage {
}
CheckBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Stop Internet Traffic")
text: qsTranslate("qml", "Stop Internet Traffic")
checked: firewallConf.stopInetTraffic
onToggled: {
firewallConf.stopInetTraffic = checked;
@ -120,8 +114,7 @@ BasePage {
CheckBox {
id: cbHotKeys
text: translationManager.trTrigger
&& qsTranslate("qml", "Hot Keys")
text: qsTranslate("qml", "Hot Keys")
checked: fortSettings.hotKeyEnabled
onToggled: setIniEdited()
}
@ -131,8 +124,7 @@ BasePage {
CheckBox {
id: cbPassword
text: translationManager.trTrigger
&& qsTranslate("qml", "Password:")
text: qsTranslate("qml", "Password:")
checked: fortSettings.hasPassword
onToggled: {
if (!checked) {
@ -151,10 +143,9 @@ BasePage {
echoMode: TextInput.Password
passwordMaskDelay: 300
readOnly: fortSettings.hasPassword || !cbPassword.checked
placeholderText: translationManager.trTrigger
&& (fortSettings.hasPassword
? qsTranslate("qml", "Installed")
: qsTranslate("qml", "Not Installed"))
placeholderText: (fortSettings.hasPassword
? qsTranslate("qml", "Installed")
: qsTranslate("qml", "Not Installed"))
}
}
@ -163,8 +154,7 @@ BasePage {
Label {
anchors.verticalCenter: parent.verticalCenter
text: translationManager.trTrigger
&& qsTranslate("qml", "Language:")
text: qsTranslate("qml", "Language:")
}
ComboBox {
width: Math.max(implicitWidth, 180)
@ -198,17 +188,15 @@ BasePage {
}
Label {
font.weight: Font.Bold
text: translationManager.trTrigger
&& qsTranslate("qml", "Driver:")
text: qsTranslate("qml", "Driver:")
}
Label {
width: Math.min(implicitWidth, 300)
wrapMode: Text.Wrap
text: translationManager.trTrigger
&& (driverManager.isDeviceOpened
? (driverManager.errorMessage
|| qsTranslate("qml", "Installed"))
: qsTranslate("qml", "Not Installed"))
text: (driverManager.isDeviceOpened
? (driverManager.errorMessage
|| qsTranslate("qml", "Installed"))
: qsTranslate("qml", "Not Installed"))
}
}
@ -216,13 +204,11 @@ BasePage {
Layout.alignment: Qt.AlignHCenter
spacing: 10
DelayButtonControl {
text: translationManager.trTrigger
&& qsTranslate("qml", "Install")
text: qsTranslate("qml", "Install")
onDelayClicked: fortManager.installDriver()
}
DelayButtonControl {
text: translationManager.trTrigger
&& qsTranslate("qml", "Remove")
text: qsTranslate("qml", "Remove")
onDelayClicked: fortManager.removeDriver()
}
}

View File

@ -25,17 +25,15 @@ BasePage {
3, 1, 6, 12, 24, 24 * 7, 24 * 30
]
readonly property var taskIntervalNames:
translationManager.trTrigger
&& [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Hourly"),
qsTranslate("qml", "Each 6 hours"),
qsTranslate("qml", "Each 12 hours"),
qsTranslate("qml", "Daily"),
qsTranslate("qml", "Weekly"),
qsTranslate("qml", "Monthly")
]
readonly property var taskIntervalNames: [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Hourly"),
qsTranslate("qml", "Each 6 hours"),
qsTranslate("qml", "Each 12 hours"),
qsTranslate("qml", "Daily"),
qsTranslate("qml", "Weekly"),
qsTranslate("qml", "Monthly")
]
property bool scheduleEdited
@ -73,25 +71,21 @@ BasePage {
}
Label {
width: taskCellWidths[1]
text: translationManager.trTrigger
&& qsTranslate("qml", "Name")
text: qsTranslate("qml", "Name")
}
Label {
width: taskCellWidths[2]
text: translationManager.trTrigger
&& qsTranslate("qml", "Interval, hours")
text: qsTranslate("qml", "Interval, hours")
}
Label {
width: taskCellWidths[3]
horizontalAlignment: Text.AlignHCenter
text: translationManager.trTrigger
&& qsTranslate("qml", "Last Run")
text: qsTranslate("qml", "Last Run")
}
Label {
width: taskCellWidths[4]
horizontalAlignment: Text.AlignHCenter
text: translationManager.trTrigger
&& qsTranslate("qml", "Last Success")
text: qsTranslate("qml", "Last Success")
}
Item {
width: taskCellWidths[5]

View File

@ -27,16 +27,14 @@ BasePage {
trafsContainer.width * 0.22
]
readonly property var trafUnitNames:
translationManager.trTrigger
&& [
qsTranslate("qml", "Adaptive"),
qsTranslate("qml", "Bytes"),
qsTranslate("qml", "KiB"),
qsTranslate("qml", "MiB"),
qsTranslate("qml", "GiB"),
qsTranslate("qml", "TiB")
]
readonly property var trafUnitNames: [
qsTranslate("qml", "Adaptive"),
qsTranslate("qml", "Bytes"),
qsTranslate("qml", "KiB"),
qsTranslate("qml", "MiB"),
qsTranslate("qml", "GiB"),
qsTranslate("qml", "TiB")
]
property bool graphEdited
@ -66,32 +64,27 @@ BasePage {
RoundButtonTip {
enabled: appListView.count
icon.source: "qrc:/images/arrow_refresh.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Refresh")
tipText: qsTranslate("qml", "Refresh")
onClicked: trafListModel.refresh()
}
ButtonMenu {
enabled: appListView.count
icon.source: "qrc:/images/bin_empty.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Clear…")
text: qsTranslate("qml", "Clear…")
MenuItem {
enabled: appListView.currentIndex > 0
text: translationManager.trTrigger
&& qsTranslate("qml", "Remove Application")
text: qsTranslate("qml", "Remove Application")
onTriggered: appStatModel.remove(
appListView.currentIndex)
}
MenuItem {
text: translationManager.trTrigger
&& qsTranslate("qml", "Reset Total")
text: qsTranslate("qml", "Reset Total")
onTriggered: trafListModel.resetAppTotals()
}
MenuItem {
text: translationManager.trTrigger
&& qsTranslate("qml", "Clear All")
text: qsTranslate("qml", "Clear All")
onTriggered: {
appListView.currentIndex = 0;
appStatModel.clear();
@ -115,8 +108,7 @@ BasePage {
Label {
anchors.verticalCenter: parent.verticalCenter
text: translationManager.trTrigger
&& qsTranslate("qml", "Units:")
text: qsTranslate("qml", "Units:")
}
ComboBox {
@ -145,8 +137,7 @@ BasePage {
Switch {
id: cbShowBlockedApps
font.weight: Font.DemiBold
text: translationManager.trTrigger
&& qsTranslate("qml", "Collect Traffic Statistics")
text: qsTranslate("qml", "Collect Traffic Statistics")
checked: firewallConf.logStat
onToggled: {
if (firewallConf.logStat === checked)
@ -176,8 +167,7 @@ BasePage {
model: appStatModel
emptyText: translationManager.trTrigger
&& qsTranslate("qml", "All")
emptyText: qsTranslate("qml", "All")
emptyIcon: "qrc:/images/application_double.png"
}
@ -193,20 +183,16 @@ BasePage {
Layout.fillWidth: true
TabButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Hourly", "Stat")
text: qsTranslate("qml", "Hourly", "Stat")
}
TabButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Daily", "Stat")
text: qsTranslate("qml", "Daily", "Stat")
}
TabButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Monthly", "Stat")
text: qsTranslate("qml", "Monthly", "Stat")
}
TabButton {
text: translationManager.trTrigger
&& qsTranslate("qml", "Total", "Stat")
text: qsTranslate("qml", "Total", "Stat")
}
}
@ -216,23 +202,19 @@ BasePage {
Label {
width: trafCellWidths[0]
text: translationManager.trTrigger
&& qsTranslate("qml", "Date")
text: qsTranslate("qml", "Date")
}
Label {
width: trafCellWidths[1]
text: translationManager.trTrigger
&& qsTranslate("qml", "Download")
text: qsTranslate("qml", "Download")
}
Label {
width: trafCellWidths[2]
text: translationManager.trTrigger
&& qsTranslate("qml", "Upload")
text: qsTranslate("qml", "Upload")
}
Label {
width: trafCellWidths[3]
text: translationManager.trTrigger
&& qsTranslate("qml", "Sum")
text: qsTranslate("qml", "Sum")
}
}
@ -254,8 +236,7 @@ BasePage {
delegate: Label {
fontSizeMode: Text.Fit
text: translationManager.trTrigger
&& model.display
text: model.display
}
onRowsChanged: {

View File

@ -12,14 +12,10 @@ TextArea2SplitBox {
textArea1: includeAddresses.textArea
textArea2: excludeAddresses.textArea
textMoveAllFrom1To2: translationManager.trTrigger
&& qsTranslate("qml", "Move All Lines to 'Exclude'")
textMoveAllFrom2To1: translationManager.trTrigger
&& qsTranslate("qml", "Move All Lines to 'Include'")
textMoveSelectedFrom1To2: translationManager.trTrigger
&& qsTranslate("qml", "Move Selected Lines to 'Exclude'")
textMoveSelectedFrom2To1: translationManager.trTrigger
&& qsTranslate("qml", "Move Selected Lines to 'Include'")
textMoveAllFrom1To2: qsTranslate("qml", "Move All Lines to 'Exclude'")
textMoveAllFrom2To1: qsTranslate("qml", "Move All Lines to 'Include'")
textMoveSelectedFrom1To2: qsTranslate("qml", "Move Selected Lines to 'Exclude'")
textMoveSelectedFrom2To1: qsTranslate("qml", "Move Selected Lines to 'Include'")
settingsPropName: "windowAddrSplit"
@ -29,14 +25,12 @@ TextArea2SplitBox {
SplitView.minimumWidth: 250
title {
text: translationManager.trTrigger
&& qsTranslate("qml", "Include")
text: qsTranslate("qml", "Include")
}
checkBoxAll {
enabled: !excludeAddresses.checkBoxAll.checked
|| checkBoxAll.checked
text: translationManager.trTrigger
&& qsTranslate("qml", "Include All")
text: qsTranslate("qml", "Include All")
}
useAll: addressGroup.includeAll
@ -55,14 +49,12 @@ TextArea2SplitBox {
SplitView.minimumWidth: 250
title {
text: translationManager.trTrigger
&& qsTranslate("qml", "Exclude")
text: qsTranslate("qml", "Exclude")
}
checkBoxAll {
enabled: !includeAddresses.checkBoxAll.checked
|| checkBoxAll.checked
text: translationManager.trTrigger
&& qsTranslate("qml", "Exclude All")
text: qsTranslate("qml", "Exclude All")
}
useAll: addressGroup.excludeAll

View File

@ -43,11 +43,8 @@ ColumnLayout {
clip: true
textArea {
placeholderText:
translationManager.trTrigger && (
qsTranslate("qml", "# Examples:")
+ '\n' + netUtil.localIpv4Networks().join('\n')
)
placeholderText: qsTranslate("qml", "# Examples:")
+ '\n' + netUtil.localIpv4Networks().join('\n')
text: ipText
}

View File

@ -13,20 +13,17 @@ ColumnLayout {
RowLayout {
RoundButtonTip {
icon.source: "qrc:/images/application_delete.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Remove Group")
tipText: qsTranslate("qml", "Remove Group")
onClicked: removeAppGroup(index)
}
RoundButtonTip {
icon.source: "qrc:/images/resultset_previous.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Move left")
tipText: qsTranslate("qml", "Move left")
onClicked: moveAppGroup(index, -1)
}
RoundButtonTip {
icon.source: "qrc:/images/resultset_next.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Move right")
tipText: qsTranslate("qml", "Move right")
onClicked: moveAppGroup(index, 1)
}
@ -44,8 +41,7 @@ ColumnLayout {
CheckBox {
id: cbEnabled
text: translationManager.trTrigger
&& qsTranslate("qml", "Enabled")
text: qsTranslate("qml", "Enabled")
checked: appGroup.enabled
onToggled: {
appGroup.enabled = checked;
@ -59,8 +55,7 @@ ColumnLayout {
enabled: cbEnabled.checked
checkBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "period, hours:")
text: qsTranslate("qml", "period, hours:")
checked: appGroup.periodEnabled
onToggled: {
appGroup.periodEnabled = checkBox.checked;
@ -95,14 +90,10 @@ ColumnLayout {
textArea1: blockApps.textArea
textArea2: allowApps.textArea
textMoveAllFrom1To2: translationManager.trTrigger
&& qsTranslate("qml", "Move All Lines to 'Allow'")
textMoveAllFrom2To1: translationManager.trTrigger
&& qsTranslate("qml", "Move All Lines to 'Block'")
textMoveSelectedFrom1To2: translationManager.trTrigger
&& qsTranslate("qml", "Move Selected Lines to 'Allow'")
textMoveSelectedFrom2To1: translationManager.trTrigger
&& qsTranslate("qml", "Move Selected Lines to 'Block'")
textMoveAllFrom1To2: qsTranslate("qml", "Move All Lines to 'Allow'")
textMoveAllFrom2To1: qsTranslate("qml", "Move All Lines to 'Block'")
textMoveSelectedFrom1To2: qsTranslate("qml", "Move Selected Lines to 'Allow'")
textMoveSelectedFrom2To1: qsTranslate("qml", "Move Selected Lines to 'Block'")
selectFileEnabled: true
@ -114,8 +105,7 @@ ColumnLayout {
SplitView.minimumWidth: 150
title {
text: translationManager.trTrigger
&& qsTranslate("qml", "Block")
text: qsTranslate("qml", "Block")
}
textArea {
@ -137,20 +127,16 @@ ColumnLayout {
SplitView.minimumWidth: 150
title {
text: translationManager.trTrigger
&& qsTranslate("qml", "Allow")
text: qsTranslate("qml", "Allow")
}
textArea {
placeholderText:
translationManager.trTrigger && (
qsTranslate("qml", "# Examples:")
+ "\nSystem"
+ "\nC:\\Program Files (x86)\\Microsoft\\Skype for Desktop\\Skype.exe"
+ "\n\n"
+ qsTranslate("qml", "# All programs in the sub-path:")
+ "\nC:\\Git\\"
)
placeholderText: qsTranslate("qml", "# Examples:")
+ "\nSystem"
+ "\nC:\\Program Files (x86)\\Microsoft\\Skype for Desktop\\Skype.exe"
+ "\n\n"
+ qsTranslate("qml", "# All programs in the sub-path:")
+ "\nC:\\Git\\"
text: appGroup.allowText
}

View File

@ -7,8 +7,7 @@ import com.fortfirewall 1.0
ButtonPopup {
icon.source: "qrc:/images/application_key.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Options…")
text: qsTranslate("qml", "Options…")
readonly property var speedLimitValues: [
10, 0, 20, 30, 50, 75, 100, 150, 200, 300, 500, 900,
@ -17,8 +16,7 @@ ButtonPopup {
]
readonly property var speedLimitNames: {
var list = translationManager.trTrigger
&& [qsTranslate("qml", "Custom"),
var list = [qsTranslate("qml", "Custom"),
qsTranslate("qml", "Disabled")];
const n = speedLimitValues.length;
@ -37,8 +35,7 @@ ButtonPopup {
names: speedLimitNames
values: speedLimitValues
checkBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Download speed limit, KiB/s:")
text: qsTranslate("qml", "Download speed limit, KiB/s:")
checked: appGroup.limitInEnabled
onToggled: {
appGroup.limitInEnabled = checkBox.checked;
@ -62,8 +59,7 @@ ButtonPopup {
names: speedLimitNames
values: speedLimitValues
checkBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Upload speed limit, KiB/s:")
text: qsTranslate("qml", "Upload speed limit, KiB/s:")
checked: appGroup.limitOutEnabled
onToggled: {
appGroup.limitOutEnabled = checkBox.checked;
@ -86,8 +82,7 @@ ButtonPopup {
HSeparator {}
CheckBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Fragment first TCP packet")
text: qsTranslate("qml", "Fragment first TCP packet")
checked: appGroup.fragmentPacket
onToggled: {
appGroup.fragmentPacket = checked;

View File

@ -16,8 +16,7 @@ RowLayout {
RoundButtonTip {
icon.source: "qrc:/images/page_copy.png"
tipText: translationManager.trTrigger
&& qsTranslate("qml", "Copy Path")
tipText: qsTranslate("qml", "Copy Path")
onClicked: guiUtil.setClipboardData(appPath)
}
@ -27,8 +26,7 @@ RowLayout {
anchors.verticalCenter: parent.verticalCenter
width: Math.min(implicitWidth, parent.width)
elide: Text.ElideLeft
tipText: (translationManager.trTrigger
&& qsTranslate("qml", "Open Folder"))
tipText: qsTranslate("qml", "Open Folder")
+ (truncated ? "<br/>" + text : "")
text: appPath
onClicked: osUtil.openFolder(appPath)

View File

@ -7,8 +7,7 @@ import com.fortfirewall 1.0
ButtonPopup {
icon.source: "qrc:/images/chart_bar.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Graph…")
text: qsTranslate("qml", "Graph…")
function save() {
fortSettings.graphWindowAlwaysOnTop = cbAlwaysOnTop.checked;
@ -35,32 +34,28 @@ ButtonPopup {
ColumnLayout {
CheckBox {
id: cbAlwaysOnTop
text: translationManager.trTrigger
&& qsTranslate("qml", "Always on top")
text: qsTranslate("qml", "Always on top")
checked: fortSettings.graphWindowAlwaysOnTop
onToggled: setGraphEdited()
}
CheckBox {
id: cbFrameless
text: translationManager.trTrigger
&& qsTranslate("qml", "Frameless")
text: qsTranslate("qml", "Frameless")
checked: fortSettings.graphWindowFrameless
onToggled: setGraphEdited()
}
CheckBox {
id: cbClickThrough
text: translationManager.trTrigger
&& qsTranslate("qml", "Click through")
text: qsTranslate("qml", "Click through")
checked: fortSettings.graphWindowClickThrough
onToggled: setGraphEdited()
}
CheckBox {
id: cbHideOnHover
text: translationManager.trTrigger
&& qsTranslate("qml", "Hide on hover")
text: qsTranslate("qml", "Hide on hover")
checked: fortSettings.graphWindowHideOnHover
onToggled: setGraphEdited()
}
@ -69,8 +64,7 @@ ButtonPopup {
LabelSpinRow {
id: rowOpacity
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Opacity, %")) + ":"
label.text: qsTranslate("qml", "Opacity, %") + ":"
field {
from: 0
to: 100
@ -81,8 +75,7 @@ ButtonPopup {
LabelSpinRow {
id: rowHoverOpacity
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Hover opacity, %")) + ":"
label.text: qsTranslate("qml", "Hover opacity, %") + ":"
field {
from: 0
to: 100
@ -93,8 +86,7 @@ ButtonPopup {
LabelSpinRow {
id: rowMaxSeconds
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Max seconds")) + ":"
label.text: qsTranslate("qml", "Max seconds") + ":"
field {
from: 0
to: 9999
@ -113,56 +105,49 @@ ButtonPopup {
ColumnLayout {
LabelColorRow {
id: rowColor
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Background")) + ":"
label.text: qsTranslate("qml", "Background") + ":"
defaultColor: fortSettings.graphWindowColor
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowColorIn
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Download")) + ":"
label.text: qsTranslate("qml", "Download") + ":"
defaultColor: fortSettings.graphWindowColorIn
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowColorOut
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Upload")) + ":"
label.text: qsTranslate("qml", "Upload") + ":"
defaultColor: fortSettings.graphWindowColorOut
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowAxisColor
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Axis")) + ":"
label.text: qsTranslate("qml", "Axis") + ":"
defaultColor: fortSettings.graphWindowAxisColor
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowTickLabelColor
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Tick label")) + ":"
label.text: qsTranslate("qml", "Tick label") + ":"
defaultColor: fortSettings.graphWindowTickLabelColor
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowLabelColor
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Label")) + ":"
label.text: qsTranslate("qml", "Label") + ":"
defaultColor: fortSettings.graphWindowLabelColor
onColorEdited: setGraphEdited()
}
LabelColorRow {
id: rowGridColor
label.text: (translationManager.trTrigger
&& qsTranslate("qml", "Grid")) + ":"
label.text: qsTranslate("qml", "Grid") + ":"
defaultColor: fortSettings.graphWindowGridColor
onColorEdited: setGraphEdited()
}

View File

@ -7,38 +7,33 @@ import com.fortfirewall 1.0
ButtonPopup {
icon.source: "qrc:/images/database_save.png"
text: translationManager.trTrigger
&& qsTranslate("qml", "Options…")
text: qsTranslate("qml", "Options…")
readonly property var trafKeepDayValues: [
60, -1, 90, 180, 365, 365 * 3
]
readonly property var trafKeepDayNames:
translationManager.trTrigger
&& [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Forever"),
qsTranslate("qml", "3 months"),
qsTranslate("qml", "6 months"),
qsTranslate("qml", "1 year"),
qsTranslate("qml", "3 years")
]
readonly property var trafKeepDayNames: [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Forever"),
qsTranslate("qml", "3 months"),
qsTranslate("qml", "6 months"),
qsTranslate("qml", "1 year"),
qsTranslate("qml", "3 years")
]
readonly property var trafKeepMonthValues: [
2, -1, 3, 6, 12, 36
]
readonly property var trafKeepMonthNames:
translationManager.trTrigger
&& [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Forever"),
qsTranslate("qml", "3 months"),
qsTranslate("qml", "6 months"),
qsTranslate("qml", "1 year"),
qsTranslate("qml", "3 years")
]
readonly property var trafKeepMonthNames: [
qsTranslate("qml", "Custom"),
qsTranslate("qml", "Forever"),
qsTranslate("qml", "3 months"),
qsTranslate("qml", "6 months"),
qsTranslate("qml", "1 year"),
qsTranslate("qml", "3 years")
]
readonly property var quotaValues: [
10, 0, 100, 500, 1024, 8 * 1024, 10 * 1024, 30 * 1024,
@ -46,8 +41,7 @@ ButtonPopup {
]
readonly property var quotaNames: {
var list = translationManager.trTrigger
&& [qsTranslate("qml", "Custom"),
var list = [qsTranslate("qml", "Custom"),
qsTranslate("qml", "Disabled")];
const n = quotaValues.length;
@ -64,8 +58,7 @@ ButtonPopup {
ColumnLayout {
SpinPeriodRow {
checkBox {
text: translationManager.trTrigger
&& qsTranslate("qml", "Active period, hours:")
text: qsTranslate("qml", "Active period, hours:")
checked: firewallConf.activePeriodEnabled
onToggled: {
firewallConf.activePeriodEnabled = checkBox.checked;
@ -101,8 +94,7 @@ ButtonPopup {
}
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Month starts on:")
text: qsTranslate("qml", "Month starts on:")
}
field {
from: 1
@ -123,8 +115,7 @@ ButtonPopup {
values: trafKeepDayValues
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Keep days for 'Hourly':")
text: qsTranslate("qml", "Keep days for 'Hourly':")
}
field {
from: -1
@ -142,8 +133,7 @@ ButtonPopup {
values: trafKeepDayValues
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Keep days for 'Daily':")
text: qsTranslate("qml", "Keep days for 'Daily':")
}
field {
from: -1
@ -161,8 +151,7 @@ ButtonPopup {
values: trafKeepMonthValues
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Keep months for 'Monthly':")
text: qsTranslate("qml", "Keep months for 'Monthly':")
}
field {
from: -1
@ -182,8 +171,7 @@ ButtonPopup {
values: quotaValues
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Day's Quota, MiB:")
text: qsTranslate("qml", "Day's Quota, MiB:")
}
field {
from: 0
@ -202,8 +190,7 @@ ButtonPopup {
values: quotaValues
checkBox {
indicator: null
text: translationManager.trTrigger
&& qsTranslate("qml", "Month's Quota, MiB:")
text: qsTranslate("qml", "Month's Quota, MiB:")
}
field {
from: 0

View File

@ -37,8 +37,7 @@ Row {
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
fontSizeMode: Text.Fit
text: translationManager.trTrigger
&& taskInfo.title
text: taskInfo.title
}
SpinCombo {
@ -89,9 +88,8 @@ Row {
height: width
icon.source: taskInfo.running ? "qrc:/images/cancel.png"
: "qrc:/images/run.png"
tipText: translationManager.trTrigger
&& (taskInfo.running ? qsTranslate("qml", "Cancel")
: qsTranslate("qml", "Run"))
tipText: taskInfo.running ? qsTranslate("qml", "Cancel")
: qsTranslate("qml", "Run")
onClicked: taskInfo.running ? taskInfo.abort()
: taskInfo.run()
}

View File

@ -86,14 +86,11 @@ bool TranslationManager::switchLanguage(int language)
QLocale::setDefault(m_locale);
uninstallTranslator(m_language);
installTranslator(language, m_locale);
m_language = language;
emit languageChanged(m_language);
installTranslator(m_language, m_locale);
refreshTranslations();
return true;
}
@ -143,11 +140,6 @@ QTranslator *TranslationManager::loadTranslator(int language, const QLocale &loc
return translator;
}
void TranslationManager::refreshTranslations()
{
emit trTriggerChanged();
}
QString TranslationManager::i18nDir()
{
return FileUtil::appBinLocation() + "/i18n";

View File

@ -13,7 +13,6 @@ QT_FORWARD_DECLARE_CLASS(QTranslator)
class TranslationManager : public QObject
{
Q_OBJECT
Q_PROPERTY(bool trTrigger READ trTrigger NOTIFY trTriggerChanged)
Q_PROPERTY(int language READ language WRITE switchLanguage NOTIFY languageChanged)
Q_PROPERTY(QStringList naturalLabels READ naturalLabels CONSTANT)
@ -25,8 +24,6 @@ protected:
public:
static TranslationManager *instance();
bool trTrigger() const { return true; }
int language() const { return m_language; }
QString localeName() const { return m_locale.name(); }
@ -35,15 +32,12 @@ public:
int getLanguageByName(const QString &localeName) const;
signals:
void trTriggerChanged();
void languageChanged(int language);
public slots:
bool switchLanguage(int language = 0);
bool switchLanguageByName(const QString &localeName);
void refreshTranslations();
private:
void setupTranslation();