mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:36:09 +00:00
UI: OptionsPage: Show driver's state; allow to install/remove the driver.
This commit is contained in:
parent
3cbc330568
commit
dd521ba81b
@ -17,6 +17,11 @@
|
||||
"${ROOT}/src/ui/i18n | *.qm |"
|
||||
]
|
||||
},
|
||||
"${TARGET}/driver": {
|
||||
"fort": [
|
||||
"${ROOT}/src/driver/scripts | *.bat *.lnk |"
|
||||
]
|
||||
},
|
||||
"${TARGET}/imports": {
|
||||
"common": [
|
||||
"${QTPATH}/qml/QtQuick.2 | *.dll *.qmltypes qmldir | *d.dll"
|
||||
|
@ -6,7 +6,7 @@
|
||||
md %TARGET_PATH%
|
||||
cd %TARGET_PATH%
|
||||
del /Q /F qt*.* FortFirewall.exe
|
||||
rd /Q /S i18n imports plugins scripts
|
||||
rd /Q /S driver\scripts i18n imports plugins scripts
|
||||
cd ..
|
||||
|
||||
powershell.exe -executionpolicy remotesigned -file setup-deployment.ps1 %TARGET_PATH% %*
|
||||
|
11
src/driver/scripts/execute-cmd.bat
Normal file
11
src/driver/scripts/execute-cmd.bat
Normal file
@ -0,0 +1,11 @@
|
||||
@rem Execute the command
|
||||
|
||||
@cd %~dp0
|
||||
@echo off
|
||||
|
||||
set "SystemPath=%SystemRoot%\System32"
|
||||
if defined PROGRAMFILES(X86) (
|
||||
if exist %SystemRoot%\Sysnative\* set "SystemPath=%SystemRoot%\Sysnative"
|
||||
)
|
||||
|
||||
%SystemPath%\cmd.exe /C start /W %1
|
53
src/driver/scripts/install.bat
Normal file
53
src/driver/scripts/install.bat
Normal file
@ -0,0 +1,53 @@
|
||||
@rem Install driver
|
||||
|
||||
@set DISPNAME=Fort Firewall
|
||||
|
||||
@set ARCH=32
|
||||
@if defined PROGRAMFILES(X86) @set ARCH=64
|
||||
|
||||
@set BASENAME=fortfw
|
||||
@set FILENAME=%BASENAME%%ARCH%.sys
|
||||
@set SRCPATH=%~dp0..\%FILENAME%
|
||||
@set DSTPATH=%SystemRoot%\System32\drivers\%BASENAME%.sys
|
||||
|
||||
|
||||
@rem Copy driver to system storage
|
||||
@if exist "%DSTPATH%" (
|
||||
@echo Error: Driver already installed. Uninstall it first
|
||||
@set RCODE=1
|
||||
@goto EXIT
|
||||
)
|
||||
|
||||
copy "%SRCPATH%" "%DSTPATH%"
|
||||
@if ERRORLEVEL 1 (
|
||||
@echo Error: Cannot copy driver to system
|
||||
@set RCODE=%ERRORLEVEL%
|
||||
@goto EXIT
|
||||
)
|
||||
|
||||
|
||||
@rem Create service
|
||||
sc create %BASENAME% binPath= "%DSTPATH%" type= kernel start= auto depend= BFE DisplayName= "%DISPNAME%"
|
||||
@if ERRORLEVEL 1 (
|
||||
@echo Error: Cannot create a service
|
||||
@set RCODE=%ERRORLEVEL%
|
||||
@goto EXIT
|
||||
)
|
||||
|
||||
sc start %BASENAME%
|
||||
@if ERRORLEVEL 1 (
|
||||
@echo Error: Cannot start the service
|
||||
@set RCODE=%ERRORLEVEL%
|
||||
@goto EXIT
|
||||
)
|
||||
|
||||
|
||||
@set RCODE=0
|
||||
@goto EXIT
|
||||
|
||||
:EXIT
|
||||
@echo End execution... Error Code = %RCODE%
|
||||
@if %RCODE% neq 0 (
|
||||
@pause
|
||||
)
|
||||
@exit /b %RCODE%
|
8
src/driver/scripts/reinstall.bat
Normal file
8
src/driver/scripts/reinstall.bat
Normal file
@ -0,0 +1,8 @@
|
||||
@rem Re-install driver
|
||||
|
||||
@cd %~dp0
|
||||
@echo off
|
||||
|
||||
%COMSPEC% /C uninstall.bat
|
||||
|
||||
install.bat
|
BIN
src/driver/scripts/reinstall.lnk
Normal file
BIN
src/driver/scripts/reinstall.lnk
Normal file
Binary file not shown.
33
src/driver/scripts/uninstall.bat
Normal file
33
src/driver/scripts/uninstall.bat
Normal file
@ -0,0 +1,33 @@
|
||||
@rem Uninstall driver
|
||||
|
||||
@set DISPNAME=Fort Firewall
|
||||
|
||||
@set BASENAME=fortfw
|
||||
@set DSTPATH=%SystemRoot%\System32\drivers\%BASENAME%.sys
|
||||
|
||||
|
||||
@rem Close the "Services" list window
|
||||
taskkill /F /IM mmc.exe
|
||||
|
||||
@rem Stop the service
|
||||
net stop %BASENAME%
|
||||
|
||||
@rem Remove the service
|
||||
sc delete %BASENAME%
|
||||
@if ERRORLEVEL 1 (
|
||||
@echo Error: Cannot delete the service
|
||||
@set RCODE=%ERRORLEVEL%
|
||||
@rem @goto EXIT
|
||||
)
|
||||
|
||||
|
||||
@rem Remove driver from system storage
|
||||
Del "%DSTPATH%"
|
||||
|
||||
|
||||
@set RCODE=0
|
||||
@goto EXIT
|
||||
|
||||
:EXIT
|
||||
@echo End execution... Error Code = %RCODE%
|
||||
@exit /b %RCODE%
|
BIN
src/driver/scripts/uninstall.lnk
Normal file
BIN
src/driver/scripts/uninstall.lnk
Normal file
Binary file not shown.
@ -50,17 +50,23 @@ bool DriverManager::isDeviceOpened() const
|
||||
|
||||
bool DriverManager::openDevice()
|
||||
{
|
||||
if (!m_device->open(FortCommon::deviceName())) {
|
||||
const bool res = m_device->open(FortCommon::deviceName());
|
||||
if (!res) {
|
||||
setErrorMessage(OsUtil::lastErrorMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
emit isDeviceOpenedChanged();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DriverManager::closeDevice()
|
||||
{
|
||||
return m_device->close();
|
||||
const bool res = m_device->close();
|
||||
|
||||
emit isDeviceOpenedChanged();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool DriverManager::validate()
|
||||
@ -121,12 +127,22 @@ bool DriverManager::writeData(quint32 code, QByteArray &buf, int size)
|
||||
}
|
||||
|
||||
void DriverManager::reinstallDriver()
|
||||
{
|
||||
executeCommand("reinstall.lnk");
|
||||
}
|
||||
|
||||
void DriverManager::uninstallDriver()
|
||||
{
|
||||
executeCommand("uninstall.lnk");
|
||||
}
|
||||
|
||||
void DriverManager::executeCommand(const QString &fileName)
|
||||
{
|
||||
const QString binPath = FileUtil::toNativeSeparators(
|
||||
FileUtil::appBinLocation());
|
||||
|
||||
const QString cmdPath = qEnvironmentVariable("COMSPEC");
|
||||
const QString scriptPath = binPath + "\\driver\\scripts\\reinstall-lnk.bat";
|
||||
const QString scriptPath = binPath + "\\driver\\scripts\\execute-cmd.bat";
|
||||
|
||||
QProcess::execute(cmdPath, QStringList() << "/C" << scriptPath);
|
||||
QProcess::execute(cmdPath, QStringList() << "/C" << scriptPath << fileName);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ class DriverManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
|
||||
Q_PROPERTY(bool isDeviceOpened READ isDeviceOpened NOTIFY isDeviceOpenedChanged)
|
||||
|
||||
public:
|
||||
explicit DriverManager(QObject *parent = nullptr);
|
||||
@ -23,9 +24,11 @@ public:
|
||||
bool isDeviceOpened() const;
|
||||
|
||||
static void reinstallDriver();
|
||||
static void uninstallDriver();
|
||||
|
||||
signals:
|
||||
void errorMessageChanged();
|
||||
void isDeviceOpenedChanged();
|
||||
|
||||
public slots:
|
||||
bool openDevice();
|
||||
@ -44,6 +47,8 @@ private:
|
||||
|
||||
bool writeData(quint32 code, QByteArray &buf, int size);
|
||||
|
||||
static void executeCommand(const QString &fileName);
|
||||
|
||||
private:
|
||||
Device *m_device;
|
||||
DriverWorker *m_driverWorker;
|
||||
|
@ -21,6 +21,9 @@
|
||||
<file>images/link.png</file>
|
||||
<file>images/page_copy.png</file>
|
||||
<file>images/page_paste.png</file>
|
||||
<file>images/plugin.png</file>
|
||||
<file>images/plugin_disabled.png</file>
|
||||
<file>images/plugin_error.png</file>
|
||||
<file>images/resultset_next.png</file>
|
||||
<file>images/resultset_previous.png</file>
|
||||
<file>images/run.png</file>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<qresource prefix="/">
|
||||
<file>qml/controls/ButtonMenu.qml</file>
|
||||
<file>qml/controls/ButtonPopup.qml</file>
|
||||
<file>qml/controls/DelayButtonControl.qml</file>
|
||||
<file>qml/controls/HSeparator.qml</file>
|
||||
<file>qml/controls/LabelColorRow.qml</file>
|
||||
<file>qml/controls/LabelSpinRow.qml</file>
|
||||
|
@ -62,6 +62,7 @@ FortManager::FortManager(FortSettings *fortSettings,
|
||||
{
|
||||
setupLogger();
|
||||
setupDatabaseManager();
|
||||
|
||||
setupLogManager();
|
||||
setupDriver();
|
||||
|
||||
@ -80,6 +81,7 @@ FortManager::~FortManager()
|
||||
removeHotKeys();
|
||||
|
||||
closeDriver();
|
||||
closeLogManager();
|
||||
}
|
||||
|
||||
void FortManager::registerQmlTypes()
|
||||
@ -119,28 +121,35 @@ void FortManager::registerQmlTypes()
|
||||
qmlRegisterType<StringUtil>("com.fortfirewall", 1, 0, "StringUtil");
|
||||
}
|
||||
|
||||
void FortManager::installDriver()
|
||||
{
|
||||
closeDriver();
|
||||
|
||||
m_driverManager->reinstallDriver();
|
||||
|
||||
if (setupDriver()) {
|
||||
updateDriverConf(m_firewallConf);
|
||||
}
|
||||
}
|
||||
|
||||
void FortManager::removeDriver()
|
||||
{
|
||||
closeDriver();
|
||||
|
||||
m_driverManager->uninstallDriver();
|
||||
}
|
||||
|
||||
bool FortManager::setupDriver()
|
||||
{
|
||||
bool opened = m_driverManager->openDevice();
|
||||
|
||||
// Try to (re)install the driver in portable mode
|
||||
if (m_fortSettings->isPortable()
|
||||
&& !(opened && m_driverManager->validate())) {
|
||||
if (opened) {
|
||||
m_driverManager->closeDevice();
|
||||
}
|
||||
if (!m_driverManager->validate()) {
|
||||
m_driverManager->closeDevice();
|
||||
|
||||
m_driverManager->reinstallDriver();
|
||||
|
||||
opened = m_driverManager->openDevice();
|
||||
opened = false;
|
||||
}
|
||||
|
||||
if (!opened) {
|
||||
showErrorBox("Setup Driver: " + m_driverManager->errorMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return opened;
|
||||
}
|
||||
|
||||
void FortManager::closeDriver()
|
||||
@ -148,6 +157,15 @@ void FortManager::closeDriver()
|
||||
updateLogManager(false);
|
||||
|
||||
m_driverManager->closeDevice();
|
||||
}
|
||||
|
||||
void FortManager::setupLogManager()
|
||||
{
|
||||
m_logManager->initialize();
|
||||
}
|
||||
|
||||
void FortManager::closeLogManager()
|
||||
{
|
||||
m_logManager->close();
|
||||
}
|
||||
|
||||
@ -169,11 +187,6 @@ void FortManager::setupLogger()
|
||||
updateLogger();
|
||||
}
|
||||
|
||||
void FortManager::setupLogManager()
|
||||
{
|
||||
m_logManager->initialize();
|
||||
}
|
||||
|
||||
void FortManager::setupTranslationManager()
|
||||
{
|
||||
TranslationManager::instance()->switchLanguageByName(
|
||||
@ -201,6 +214,7 @@ bool FortManager::setupEngine()
|
||||
|
||||
QQmlContext *context = m_engine->rootContext();
|
||||
context->setContextProperty("fortManager", this);
|
||||
context->setContextProperty("driverManager", m_driverManager);
|
||||
context->setContextProperty("translationManager", TranslationManager::instance());
|
||||
|
||||
m_engine->load(QUrl("qrc:/qml/main.qml"));
|
||||
@ -486,8 +500,6 @@ bool FortManager::updateDriverConf(FirewallConf *conf, bool onlyFlags)
|
||||
|
||||
if (res) {
|
||||
updateDatabaseManager(conf);
|
||||
} else {
|
||||
showErrorBox("Update Driver Conf: " + m_driverManager->errorMessage());
|
||||
}
|
||||
|
||||
updateLogManager(true);
|
||||
|
@ -47,6 +47,9 @@ signals:
|
||||
void firewallConfToEditChanged();
|
||||
|
||||
public slots:
|
||||
void installDriver();
|
||||
void removeDriver();
|
||||
|
||||
void launch();
|
||||
|
||||
void showTrayIcon();
|
||||
@ -90,10 +93,12 @@ private:
|
||||
bool setupDriver();
|
||||
void closeDriver();
|
||||
|
||||
void setupLogManager();
|
||||
void closeLogManager();
|
||||
|
||||
void setupDatabaseManager();
|
||||
|
||||
void setupLogger();
|
||||
void setupLogManager();
|
||||
|
||||
void setupTranslationManager();
|
||||
|
||||
|
Binary file not shown.
@ -50,42 +50,42 @@
|
||||
<context>
|
||||
<name>FortManager</name>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="369"/>
|
||||
<location filename="../fortmanager.cpp" line="383"/>
|
||||
<source>Password input</source>
|
||||
<translation>Ввод пароля</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="369"/>
|
||||
<location filename="../fortmanager.cpp" line="383"/>
|
||||
<source>Please enter the password</source>
|
||||
<translation>Наберите пароль пожалуйста</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="596"/>
|
||||
<location filename="../fortmanager.cpp" line="608"/>
|
||||
<source>Options</source>
|
||||
<translation>Опции</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="601"/>
|
||||
<location filename="../fortmanager.cpp" line="613"/>
|
||||
<source>Traffic Graph</source>
|
||||
<translation>График трафика</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="611"/>
|
||||
<location filename="../fortmanager.cpp" line="623"/>
|
||||
<source>Filter Enabled</source>
|
||||
<translation>Фильтр включен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="618"/>
|
||||
<location filename="../fortmanager.cpp" line="630"/>
|
||||
<source>Stop Traffic</source>
|
||||
<translation>Остановить трафик</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="625"/>
|
||||
<location filename="../fortmanager.cpp" line="637"/>
|
||||
<source>Stop Internet Traffic</source>
|
||||
<translation>Остановить Интернет трафик</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../fortmanager.cpp" line="653"/>
|
||||
<location filename="../fortmanager.cpp" line="665"/>
|
||||
<source>Quit</source>
|
||||
<translation>Выйти</translation>
|
||||
</message>
|
||||
@ -371,7 +371,7 @@
|
||||
<translation>Статистика</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="132"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="135"/>
|
||||
<source>Password:</source>
|
||||
<translation>Пароль:</translation>
|
||||
</message>
|
||||
@ -396,55 +396,72 @@
|
||||
<translation>Выйти</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="46"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="49"/>
|
||||
<source>Start with Windows</source>
|
||||
<translation>Запускать вместе с Windows</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="53"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="56"/>
|
||||
<source>Stop traffic when Fort Firewall is not running</source>
|
||||
<translation>Остановить трафик, когда Fort Firewall не запущен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="69"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="72"/>
|
||||
<source>Filter Enabled</source>
|
||||
<translation>Фильтр включен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="80"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="83"/>
|
||||
<source>Filter Local Addresses</source>
|
||||
<translation>Фильтр локальных адресов</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="97"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="100"/>
|
||||
<source>Stop Traffic</source>
|
||||
<translation>Остановить трафик</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="108"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="111"/>
|
||||
<source>Stop Internet Traffic</source>
|
||||
<translation>Остановить Интернет трафик</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="121"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="124"/>
|
||||
<source>Hot Keys</source>
|
||||
<translation>Горячие клавиши</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="153"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="156"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="209"/>
|
||||
<source>Installed</source>
|
||||
<translation>Установлен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="154"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="157"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="210"/>
|
||||
<source>Not Installed</source>
|
||||
<translation>Не установлен</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="164"/>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="167"/>
|
||||
<source>Language:</source>
|
||||
<translation>Язык:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="201"/>
|
||||
<source>Driver:</source>
|
||||
<translation>Драйвер:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="219"/>
|
||||
<source>Install</source>
|
||||
<translation>Установить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/OptionsPage.qml" line="224"/>
|
||||
<source>Remove</source>
|
||||
<translation>Удалить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qml/pages/MainPage.qml" line="132"/>
|
||||
<source>Logs</source>
|
||||
|
BIN
src/ui/images/plugin.png
Normal file
BIN
src/ui/images/plugin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 591 B |
BIN
src/ui/images/plugin_disabled.png
Normal file
BIN
src/ui/images/plugin_disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 347 B |
BIN
src/ui/images/plugin_error.png
Normal file
BIN
src/ui/images/plugin_error.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 702 B |
@ -11,8 +11,7 @@
|
||||
#include "util/osutil.h"
|
||||
|
||||
#define FORT_ERROR_INSTANCE 1
|
||||
#define FORT_ERROR_DEVICE 2
|
||||
#define FORT_ERROR_CONTROL 3
|
||||
#define FORT_ERROR_CONTROL 2
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -52,14 +51,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
FortManager fortManager(&fortSettings);
|
||||
|
||||
// Error: Cannot open the driver device
|
||||
if (!fortManager.driverManager()->isDeviceOpened()) {
|
||||
QMessageBox::critical(nullptr, QString(),
|
||||
"Cannot open the driver device!");
|
||||
return FORT_ERROR_DEVICE;
|
||||
}
|
||||
|
||||
fortManager.launch();
|
||||
|
||||
// Process control requests from clients
|
||||
|
22
src/ui/qml/controls/DelayButtonControl.qml
Normal file
22
src/ui/qml/controls/DelayButtonControl.qml
Normal file
@ -0,0 +1,22 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
DelayButton {
|
||||
|
||||
signal delayClicked()
|
||||
|
||||
property bool isActivated: false
|
||||
|
||||
onPressed: {
|
||||
isActivated = false;
|
||||
}
|
||||
onActivated: {
|
||||
isActivated = true;
|
||||
}
|
||||
onReleased: {
|
||||
if (isActivated) {
|
||||
delayClicked();
|
||||
checked = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -36,144 +36,197 @@ BasePage {
|
||||
Frame {
|
||||
anchors.fill: parent
|
||||
|
||||
ColumnLayout {
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 10
|
||||
|
||||
CheckBox {
|
||||
id: cbStart
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Start with Windows")
|
||||
checked: fortSettings.startWithWindows
|
||||
onToggled: setIniEdited()
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop traffic when Fort Firewall is not running")
|
||||
checked: firewallConf.provBoot
|
||||
onToggled: {
|
||||
firewallConf.provBoot = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 20
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: 10
|
||||
|
||||
CheckBox {
|
||||
id: cbFilterEnabled
|
||||
width: Math.max(implicitWidth, cbStopTraffic.implicitWidth)
|
||||
id: cbStart
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Filter Enabled")
|
||||
checked: firewallConf.filterEnabled
|
||||
&& qsTranslate("qml", "Start with Windows")
|
||||
checked: fortSettings.startWithWindows
|
||||
onToggled: setIniEdited()
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop traffic when Fort Firewall is not running")
|
||||
checked: firewallConf.provBoot
|
||||
onToggled: {
|
||||
firewallConf.filterEnabled = checked;
|
||||
firewallConf.provBoot = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Filter Local Addresses")
|
||||
checked: firewallConf.filterLocals
|
||||
onToggled: {
|
||||
firewallConf.filterLocals = checked;
|
||||
Row {
|
||||
spacing: 20
|
||||
|
||||
setConfFlagsEdited();
|
||||
CheckBox {
|
||||
id: cbFilterEnabled
|
||||
width: Math.max(implicitWidth, cbStopTraffic.implicitWidth)
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Filter Enabled")
|
||||
checked: firewallConf.filterEnabled
|
||||
onToggled: {
|
||||
firewallConf.filterEnabled = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Filter Local Addresses")
|
||||
checked: firewallConf.filterLocals
|
||||
onToggled: {
|
||||
firewallConf.filterLocals = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 20
|
||||
Row {
|
||||
spacing: 20
|
||||
|
||||
CheckBox {
|
||||
id: cbStopTraffic
|
||||
width: cbFilterEnabled.width
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop Traffic")
|
||||
checked: firewallConf.stopTraffic
|
||||
onToggled: {
|
||||
firewallConf.stopTraffic = checked;
|
||||
CheckBox {
|
||||
id: cbStopTraffic
|
||||
width: cbFilterEnabled.width
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop Traffic")
|
||||
checked: firewallConf.stopTraffic
|
||||
onToggled: {
|
||||
firewallConf.stopTraffic = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop Internet Traffic")
|
||||
checked: firewallConf.stopInetTraffic
|
||||
onToggled: {
|
||||
firewallConf.stopInetTraffic = checked;
|
||||
|
||||
setConfFlagsEdited();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: cbHotKeys
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Stop Internet Traffic")
|
||||
checked: firewallConf.stopInetTraffic
|
||||
onToggled: {
|
||||
firewallConf.stopInetTraffic = checked;
|
||||
&& qsTranslate("qml", "Hot Keys")
|
||||
checked: fortSettings.hotKeyEnabled
|
||||
onToggled: setIniEdited()
|
||||
}
|
||||
|
||||
setConfFlagsEdited();
|
||||
Row {
|
||||
spacing: 4
|
||||
|
||||
CheckBox {
|
||||
id: cbPassword
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Password:")
|
||||
checked: firewallConf.hasPassword
|
||||
onToggled: {
|
||||
if (!checked) {
|
||||
firewallConf.passwordHash =
|
||||
editPassword.text = "";
|
||||
} else {
|
||||
editPassword.forceActiveFocus();
|
||||
}
|
||||
|
||||
setConfEdited();
|
||||
}
|
||||
}
|
||||
TextFieldFrame {
|
||||
id: editPassword
|
||||
width: 180
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
readOnly: firewallConf.hasPassword || !cbPassword.checked
|
||||
placeholderText: translationManager.trTrigger
|
||||
&& (firewallConf.hasPassword
|
||||
? qsTranslate("qml", "Installed")
|
||||
: qsTranslate("qml", "Not Installed"))
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 4
|
||||
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Language:")
|
||||
}
|
||||
ComboBox {
|
||||
width: Math.max(implicitWidth, 180)
|
||||
flat: true
|
||||
currentIndex: translationManager.language
|
||||
model: translationManager.naturalLabels
|
||||
onActivated: fortManager.setLanguage(index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: cbHotKeys
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Hot Keys")
|
||||
checked: fortSettings.hotKeyEnabled
|
||||
onToggled: setIniEdited()
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: 10
|
||||
|
||||
Row {
|
||||
spacing: 4
|
||||
Frame {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
CheckBox {
|
||||
id: cbPassword
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Password:")
|
||||
checked: firewallConf.hasPassword
|
||||
onToggled: {
|
||||
if (!checked) {
|
||||
firewallConf.passwordHash =
|
||||
editPassword.text = "";
|
||||
} else {
|
||||
editPassword.forceActiveFocus();
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
|
||||
Row {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 5
|
||||
Image {
|
||||
source: driverManager.isDeviceOpened
|
||||
? (!driverManager.errorMessage
|
||||
? "qrc:/images/plugin.png"
|
||||
: "qrc:/images/plugin_error.png")
|
||||
: "qrc:/images/plugin_disabled.png"
|
||||
}
|
||||
Label {
|
||||
text: translationManager.trTrigger
|
||||
&& 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"))
|
||||
}
|
||||
}
|
||||
|
||||
setConfEdited();
|
||||
Row {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 10
|
||||
DelayButtonControl {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Install")
|
||||
onDelayClicked: fortManager.installDriver()
|
||||
}
|
||||
DelayButtonControl {
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Remove")
|
||||
onDelayClicked: fortManager.removeDriver()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
TextFieldFrame {
|
||||
id: editPassword
|
||||
width: 180
|
||||
echoMode: TextInput.Password
|
||||
passwordMaskDelay: 300
|
||||
readOnly: firewallConf.hasPassword || !cbPassword.checked
|
||||
placeholderText: translationManager.trTrigger
|
||||
&& (firewallConf.hasPassword
|
||||
? qsTranslate("qml", "Installed")
|
||||
: qsTranslate("qml", "Not Installed"))
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 4
|
||||
|
||||
Label {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: translationManager.trTrigger
|
||||
&& qsTranslate("qml", "Language:")
|
||||
}
|
||||
ComboBox {
|
||||
width: Math.max(implicitWidth, 180)
|
||||
flat: true
|
||||
currentIndex: translationManager.language
|
||||
model: translationManager.naturalLabels
|
||||
onActivated: fortManager.setLanguage(index)
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user