├── .github └── FUNDING.yml ├── .gitignore ├── ChangeLog ├── LICENSE ├── README.md ├── deploy ├── FortFirewall.iss ├── create-installer.bat ├── data │ ├── FortFirewall.exe.example.ini │ ├── inst.tmp │ └── qt.conf ├── deployment.json ├── driver-cab │ ├── fortfw.ddf │ ├── make-cab-win10-64.bat │ ├── make-cab-win10-arm64.bat │ ├── make-cab-win7-32.bat │ ├── make-cab-win7-64.bat │ └── make-cab.bat ├── languages │ ├── ChineseSimplified.isl │ └── custom │ │ ├── BrazilianPortuguese.isl │ │ ├── ChineseSimplified.isl │ │ ├── Default.isl │ │ ├── French.isl │ │ ├── German.isl │ │ ├── Italian.isl │ │ ├── Japanese.isl │ │ ├── Korean.isl │ │ ├── Polish.isl │ │ ├── Portuguese.isl │ │ ├── Russian.isl │ │ ├── Slovenian.isl │ │ └── Spanish.isl ├── out │ ├── FortFirewall-Silent.bat │ └── FortFirewall-Unpack.bat ├── qt-build-arm64.bat ├── qt-build-win7.bat ├── qt-build.bat ├── setup-deployment-win10-arm64.bat ├── setup-deployment-win10.bat ├── setup-deployment-win7.bat ├── setup-deployment.bat ├── setup-deployment.ps1 └── sign │ ├── cert │ ├── Certum Trusted Network CA.crt │ └── SectigoPublicCodeSigningRootR46_AAA.crt │ ├── clear-certs.bat │ ├── sign-app.bat │ ├── sign-bin.bat │ ├── sign-cabs.bat │ ├── sign-driver.bat │ ├── sign-env-certum.bat │ ├── sign-env-sectigo.bat │ ├── sign-out.bat │ └── sign-verify.bat └── src ├── .qmake.conf ├── 3rdparty ├── breakpad │ ├── .clang-format │ └── src │ │ ├── client │ │ └── windows │ │ │ ├── common │ │ │ └── ipc_protocol.h │ │ │ ├── crash_generation │ │ │ ├── crash_generation_client.cc │ │ │ └── crash_generation_client.h │ │ │ └── handler │ │ │ ├── exception_handler.cc │ │ │ └── exception_handler.h │ │ ├── common │ │ ├── scoped_ptr.h │ │ └── windows │ │ │ ├── guid_string.cc │ │ │ ├── guid_string.h │ │ │ ├── string_utils-inl.h │ │ │ └── string_utils.cc │ │ └── google_breakpad │ │ └── common │ │ ├── breakpad_types.h │ │ ├── minidump_cpu_amd64.h │ │ ├── minidump_cpu_arm.h │ │ ├── minidump_cpu_arm64.h │ │ ├── minidump_cpu_mips.h │ │ ├── minidump_cpu_ppc.h │ │ ├── minidump_cpu_ppc64.h │ │ ├── minidump_cpu_riscv.h │ │ ├── minidump_cpu_sparc.h │ │ ├── minidump_cpu_x86.h │ │ ├── minidump_exception_fuchsia.h │ │ ├── minidump_exception_linux.h │ │ ├── minidump_exception_mac.h │ │ ├── minidump_exception_ps3.h │ │ ├── minidump_exception_solaris.h │ │ ├── minidump_exception_win32.h │ │ ├── minidump_format.h │ │ └── minidump_size.h ├── qcustomplot │ ├── qcustomplot.cpp │ └── qcustomplot.h ├── sqlite │ ├── sqlite.h │ ├── sqlite3.c │ ├── sqlite3.h │ └── sqlite_cfg.h ├── tlsf │ ├── tlsf.c │ └── tlsf.h ├── tommyds │ ├── tommyarrayof.c │ ├── tommyarrayof.h │ ├── tommychain.h │ ├── tommyhash.c │ ├── tommyhash.h │ ├── tommyhashdyn.c │ ├── tommyhashdyn.h │ ├── tommylist.c │ ├── tommylist.h │ └── tommytypes.h └── wildmatch │ ├── wildmatch.c │ └── wildmatch.h ├── FortFirewall.pro ├── _clang-format ├── driver ├── Driver-include.pri ├── Driver.pri ├── FortFirewallDriver.pro ├── common │ ├── common.h │ ├── common_types.h │ ├── fort_wildmatch.c │ ├── fort_wildmatch.h │ ├── fortconf.c │ ├── fortconf.h │ ├── fortdef.h │ ├── fortguid.h │ ├── fortioctl.h │ ├── fortlog.c │ ├── fortlog.h │ ├── fortprov.c │ └── fortprov.h ├── evt │ ├── FORTEVT_MSG00001.bin │ ├── fortevt.h │ ├── fortevt.mc │ ├── fortevt.rc │ └── mcbuild.bat ├── fortbuf.c ├── fortbuf.h ├── fortcb.c ├── fortcb.h ├── fortcnf.c ├── fortcnf.h ├── fortcnf_conf.c ├── fortcnf_conf.h ├── fortcnf_rule.c ├── fortcnf_rule.h ├── fortcnf_zone.c ├── fortcnf_zone.h ├── fortcout.c ├── fortcout.h ├── fortcoutarg.h ├── fortdbg.c ├── fortdbg.h ├── fortdev.c ├── fortdev.h ├── fortdrv.c ├── fortdrv.def ├── fortdrv.h ├── fortdrv.rc ├── fortdrv.vcxproj ├── fortdrv_amalg.c ├── fortfw.inf ├── fortmod.c ├── fortmod.h ├── fortpkt.c ├── fortpkt.h ├── fortpool.c ├── fortpool.h ├── fortps.c ├── fortps.h ├── fortscb.c ├── fortscb.h ├── fortstat.c ├── fortstat.h ├── forttds.c ├── forttds.h ├── fortthr.c ├── fortthr.h ├── forttlsf.c ├── forttlsf.h ├── forttmr.c ├── forttmr.h ├── forttrace.c ├── forttrace.h ├── fortutl.c ├── fortutl.h ├── fortwrk.c ├── fortwrk.h ├── loader │ ├── fort.rsa.pub │ ├── fortdl.c │ ├── fortdl.h │ ├── fortdl.rc │ ├── fortdl.vcxproj │ ├── fortdl_amalg.c │ ├── fortimg.c │ ├── fortimg.h │ ├── fortmm.c │ ├── fortmm.h │ ├── fortmm_imp.c │ ├── fortmm_imp.h │ ├── msvcbuild-win10-64.bat │ ├── msvcbuild-win10-arm64.bat │ ├── msvcbuild-win7-32.bat │ ├── msvcbuild-win7-64.bat │ └── msvcbuild.bat ├── msvcbuild-win10-64.bat ├── msvcbuild-win10-arm64.bat ├── msvcbuild-win7-32.bat ├── msvcbuild-win7-64.bat ├── msvcbuild.bat ├── proxycb │ ├── fortpcb_def.h │ ├── fortpcb_drv.c │ ├── fortpcb_drv.h │ ├── fortpcb_dst.c │ ├── fortpcb_dst.h │ ├── fortpcb_dst_arm64.asm │ ├── fortpcb_dst_dummy.c │ ├── fortpcb_dst_x86.asm │ ├── fortpcb_src.c │ ├── fortpcb_src.h │ ├── fortpcb_src_arm64.asm │ ├── fortpcb_src_dummy.c │ └── fortpcb_src_x86.asm ├── scripts │ ├── check-reinstall.bat │ ├── execute-cmd.bat │ ├── install.bat │ ├── reinstall.bat │ ├── setup-vars.bat │ └── uninstall.bat ├── test │ └── main.c └── wdm │ ├── um_aux_klib.c │ ├── um_aux_klib.h │ ├── um_fwpmk.c │ ├── um_fwpmk.h │ ├── um_fwpsk.c │ ├── um_fwpsk.h │ ├── um_ndis.c │ ├── um_ndis.h │ ├── um_ntddk.c │ ├── um_ntddk.h │ ├── um_ntifs.c │ ├── um_ntifs.h │ ├── um_wdm.c │ └── um_wdm.h ├── driver_payload ├── FortFirewallDriverPayload.pro ├── driverpayload.cpp ├── driverpayload.h └── main.cpp ├── global.pri ├── scripts ├── breakpad │ └── dump-windbg.bat ├── driver │ └── bin2array.bat └── i18n │ ├── release_ts.bat │ └── update_ts.bat ├── tests ├── Common │ ├── Common.pri │ ├── Common.pro │ ├── GoogleTest-include.pri │ ├── GoogleTest.pri │ ├── googletest.h │ └── mocks │ │ ├── Mocks.pri │ │ ├── mockquotamanager.cpp │ │ ├── mockquotamanager.h │ │ ├── mocksqlitestmt.cpp │ │ └── mocksqlitestmt.h ├── FortFirewallTests.pro ├── LogBufferTest │ ├── LogBufferTest.pro │ ├── tst_logbuffer.h │ └── tst_main.cpp ├── LogReaderTest │ ├── LogReaderTest.pro │ ├── tst_logreader.h │ └── tst_main.cpp ├── StatTest │ ├── StatTest.pro │ ├── data.qrc │ ├── data │ │ └── migrations │ │ │ ├── 1.sql │ │ │ ├── 2.sql │ │ │ └── 3.sql │ ├── tst_main.cpp │ └── tst_stat.h └── UtilTest │ ├── UtilTest.pro │ ├── data.qrc │ ├── data │ └── tasix-mrlg.html │ ├── tst_bitutil.h │ ├── tst_confutil.h │ ├── tst_dateutil.h │ ├── tst_fileutil.h │ ├── tst_ioccontainer.h │ ├── tst_main.cpp │ ├── tst_netutil.h │ ├── tst_ruletextparser.h │ └── tst_stringutil.h ├── ui ├── 3rdparty │ ├── 3rdparty-include.pri │ ├── 3rdparty.pri │ ├── qcustomplot │ │ └── qcustomplot.pri │ └── sqlite │ │ ├── dbquery.cpp │ │ ├── dbquery.h │ │ ├── dbutil.cpp │ │ ├── dbutil.h │ │ ├── dbvar.cpp │ │ ├── dbvar.h │ │ ├── sqlite.pri │ │ ├── sqlite_types.h │ │ ├── sqlitedb.cpp │ │ ├── sqlitedb.h │ │ ├── sqlitedbext.cpp │ │ ├── sqlitedbext.h │ │ ├── sqlitestmt.cpp │ │ ├── sqlitestmt.h │ │ ├── sqliteutilbase.cpp │ │ └── sqliteutilbase.h ├── FortFirewallUI-include.pri ├── FortFirewallUI.pri ├── FortFirewallUI.pro ├── README.portable ├── appinfo │ ├── appbasejob.cpp │ ├── appbasejob.h │ ├── appiconjob.cpp │ ├── appiconjob.h │ ├── appinfo.cpp │ ├── appinfo.h │ ├── appinfo_migrations.qrc │ ├── appinfocache.cpp │ ├── appinfocache.h │ ├── appinfojob.cpp │ ├── appinfojob.h │ ├── appinfomanager.cpp │ ├── appinfomanager.h │ ├── appinfoutil.cpp │ ├── appinfoutil.h │ ├── appinfoworker.cpp │ ├── appinfoworker.h │ └── migrations │ │ └── 1.sql ├── conf │ ├── addressgroup.cpp │ ├── addressgroup.h │ ├── app.cpp │ ├── app.h │ ├── appgroup.cpp │ ├── appgroup.h │ ├── conf_migrations.qrc │ ├── conf_zone.qrc │ ├── confappmanager.cpp │ ├── confappmanager.h │ ├── confmanager.cpp │ ├── confmanager.h │ ├── confmanagerbase.cpp │ ├── confmanagerbase.h │ ├── confrulemanager.cpp │ ├── confrulemanager.h │ ├── confzonemanager.cpp │ ├── confzonemanager.h │ ├── firewallconf.cpp │ ├── firewallconf.h │ ├── inioptions.cpp │ ├── inioptions.h │ ├── migrations │ │ └── 1.sql │ ├── rule.cpp │ ├── rule.h │ ├── zone.cpp │ ├── zone.h │ └── zone │ │ ├── sources.json │ │ └── types.json ├── control │ ├── command │ │ ├── controlcommandbackup.cpp │ │ ├── controlcommandbackup.h │ │ ├── controlcommandbase.cpp │ │ ├── controlcommandbase.h │ │ ├── controlcommandblock.cpp │ │ ├── controlcommandblock.h │ │ ├── controlcommandconf.cpp │ │ ├── controlcommandconf.h │ │ ├── controlcommandfilter.cpp │ │ ├── controlcommandfilter.h │ │ ├── controlcommandfiltermode.cpp │ │ ├── controlcommandfiltermode.h │ │ ├── controlcommandgroup.cpp │ │ ├── controlcommandgroup.h │ │ ├── controlcommandhome.cpp │ │ ├── controlcommandhome.h │ │ ├── controlcommandmanager.cpp │ │ ├── controlcommandmanager.h │ │ ├── controlcommandprog.cpp │ │ ├── controlcommandprog.h │ │ ├── controlcommandrpc.cpp │ │ ├── controlcommandrpc.h │ │ ├── controlcommandzone.cpp │ │ └── controlcommandzone.h │ ├── control.cpp │ ├── control.h │ ├── control_types.h │ ├── controlmanager.cpp │ ├── controlmanager.h │ ├── controlworker.cpp │ └── controlworker.h ├── driver │ ├── drivercommon.cpp │ ├── drivercommon.h │ ├── drivermanager.cpp │ ├── drivermanager.h │ ├── driverworker.cpp │ └── driverworker.h ├── form │ ├── basecontroller.cpp │ ├── basecontroller.h │ ├── controls │ │ ├── appinforow.cpp │ │ ├── appinforow.h │ │ ├── checkspincombo.cpp │ │ ├── checkspincombo.h │ │ ├── checktimeperiod.cpp │ │ ├── checktimeperiod.h │ │ ├── clickablemenu.cpp │ │ ├── clickablemenu.h │ │ ├── combobox.cpp │ │ ├── combobox.h │ │ ├── controlutil.cpp │ │ ├── controlutil.h │ │ ├── doublespinbox.cpp │ │ ├── doublespinbox.h │ │ ├── focusablemenu.cpp │ │ ├── focusablemenu.h │ │ ├── formwindow.cpp │ │ ├── formwindow.h │ │ ├── labelcolor.cpp │ │ ├── labelcolor.h │ │ ├── labeldoublespin.cpp │ │ ├── labeldoublespin.h │ │ ├── labelspin.cpp │ │ ├── labelspin.h │ │ ├── labelspincombo.cpp │ │ ├── labelspincombo.h │ │ ├── lineedit.cpp │ │ ├── lineedit.h │ │ ├── listview.cpp │ │ ├── listview.h │ │ ├── mainwindow.cpp │ │ ├── mainwindow.h │ │ ├── menubutton.cpp │ │ ├── menubutton.h │ │ ├── menuwidget.cpp │ │ ├── menuwidget.h │ │ ├── optionsbutton.cpp │ │ ├── optionsbutton.h │ │ ├── plaintextedit.cpp │ │ ├── plaintextedit.h │ │ ├── pushbutton.cpp │ │ ├── pushbutton.h │ │ ├── sidebutton.cpp │ │ ├── sidebutton.h │ │ ├── spinbox.cpp │ │ ├── spinbox.h │ │ ├── spincombo.cpp │ │ ├── spincombo.h │ │ ├── tabbar.cpp │ │ ├── tabbar.h │ │ ├── tableview.cpp │ │ ├── tableview.h │ │ ├── textarea2splitter.cpp │ │ ├── textarea2splitter.h │ │ ├── textarea2splitterhandle.cpp │ │ ├── textarea2splitterhandle.h │ │ ├── toolbutton.cpp │ │ ├── toolbutton.h │ │ ├── treeitemdelegate.cpp │ │ ├── treeitemdelegate.h │ │ ├── treeview.cpp │ │ ├── treeview.h │ │ ├── zonesselector.cpp │ │ └── zonesselector.h │ ├── dialog │ │ ├── dialogutil.cpp │ │ ├── dialogutil.h │ │ ├── passworddialog.cpp │ │ ├── passworddialog.h │ │ ├── splashscreen.cpp │ │ └── splashscreen.h │ ├── form_types.h │ ├── graph │ │ ├── axistickerspeed.cpp │ │ ├── axistickerspeed.h │ │ ├── graphplot.cpp │ │ ├── graphplot.h │ │ ├── graphwindow.cpp │ │ └── graphwindow.h │ ├── home │ │ ├── homecontroller.cpp │ │ ├── homecontroller.h │ │ ├── homewindow.cpp │ │ ├── homewindow.h │ │ └── pages │ │ │ ├── aboutpage.cpp │ │ │ ├── aboutpage.h │ │ │ ├── homebasepage.cpp │ │ │ ├── homebasepage.h │ │ │ ├── homemainpage.cpp │ │ │ ├── homemainpage.h │ │ │ ├── homepage.cpp │ │ │ └── homepage.h │ ├── opt │ │ ├── optionscontroller.cpp │ │ ├── optionscontroller.h │ │ ├── optionswindow.cpp │ │ ├── optionswindow.h │ │ └── pages │ │ │ ├── addressespage.cpp │ │ │ ├── addressespage.h │ │ │ ├── applicationspage.cpp │ │ │ ├── applicationspage.h │ │ │ ├── apps │ │ │ ├── appscolumn.cpp │ │ │ └── appscolumn.h │ │ │ ├── graphpage.cpp │ │ │ ├── graphpage.h │ │ │ ├── ifacepage.cpp │ │ │ ├── ifacepage.h │ │ │ ├── optbasepage.cpp │ │ │ ├── optbasepage.h │ │ │ ├── optionspage.cpp │ │ │ ├── optionspage.h │ │ │ ├── optmainpage.cpp │ │ │ ├── optmainpage.h │ │ │ ├── schedulepage.cpp │ │ │ ├── schedulepage.h │ │ │ ├── statisticspage.cpp │ │ │ └── statisticspage.h │ ├── prog │ │ ├── programalertwindow.cpp │ │ ├── programalertwindow.h │ │ ├── programeditcontroller.cpp │ │ ├── programeditcontroller.h │ │ ├── programeditdialog.cpp │ │ ├── programeditdialog.h │ │ ├── programscontroller.cpp │ │ ├── programscontroller.h │ │ ├── programswindow.cpp │ │ └── programswindow.h │ ├── rule │ │ ├── ruleeditdialog.cpp │ │ ├── ruleeditdialog.h │ │ ├── rulescontroller.cpp │ │ ├── rulescontroller.h │ │ ├── ruleswindow.cpp │ │ └── ruleswindow.h │ ├── stat │ │ ├── pages │ │ │ ├── connectionspage.cpp │ │ │ ├── connectionspage.h │ │ │ ├── statbasepage.cpp │ │ │ ├── statbasepage.h │ │ │ ├── statmainpage.cpp │ │ │ ├── statmainpage.h │ │ │ ├── trafficpage.cpp │ │ │ └── trafficpage.h │ │ ├── statisticscontroller.cpp │ │ ├── statisticscontroller.h │ │ ├── statisticswindow.cpp │ │ └── statisticswindow.h │ ├── svc │ │ ├── servicescontroller.cpp │ │ ├── servicescontroller.h │ │ ├── serviceswindow.cpp │ │ └── serviceswindow.h │ ├── tray │ │ ├── traycontroller.cpp │ │ ├── traycontroller.h │ │ ├── trayicon.cpp │ │ └── trayicon.h │ └── zone │ │ ├── zoneeditdialog.cpp │ │ ├── zoneeditdialog.h │ │ ├── zonescontroller.cpp │ │ ├── zonescontroller.h │ │ ├── zoneswindow.cpp │ │ └── zoneswindow.h ├── fort_icons.qrc ├── fort_readme.qrc ├── fort_scripts.qrc ├── fortmanager.cpp ├── fortmanager.h ├── fortsettings.cpp ├── fortsettings.h ├── hostinfo │ ├── hostinfo.cpp │ ├── hostinfo.h │ ├── hostinfocache.cpp │ ├── hostinfocache.h │ ├── hostinfojob.cpp │ ├── hostinfojob.h │ ├── hostinfomanager.cpp │ └── hostinfomanager.h ├── i18n │ ├── i18n_ar.ts │ ├── i18n_de.ts │ ├── i18n_en.ts │ ├── i18n_es.ts │ ├── i18n_fr.ts │ ├── i18n_it.ts │ ├── i18n_ja.ts │ ├── i18n_ko.ts │ ├── i18n_pl.ts │ ├── i18n_pt_BR.ts │ ├── i18n_ru.ts │ ├── i18n_sl.ts │ ├── i18n_zh_CN.ts │ └── qt │ │ ├── qtbase_ar.ts │ │ ├── qtbase_de.ts │ │ ├── qtbase_en.ts │ │ ├── qtbase_es.ts │ │ ├── qtbase_fr.ts │ │ ├── qtbase_it.ts │ │ ├── qtbase_ja.ts │ │ ├── qtbase_ko.ts │ │ ├── qtbase_pl.ts │ │ ├── qtbase_pt_BR.ts │ │ ├── qtbase_ru.ts │ │ ├── qtbase_sl.ts │ │ └── qtbase_zh_CN.ts ├── icons │ ├── accept.png │ ├── action_log.png │ ├── add.png │ ├── application-window-96.png │ ├── application.png │ ├── application_double.png │ ├── arrow_refresh_small.png │ ├── arrow_rotate_clockwise.png │ ├── blue_up.png │ ├── books.png │ ├── broom.png │ ├── bullet_arrow_down.png │ ├── bullet_arrow_up.png │ ├── cancel.png │ ├── chart_bar.png │ ├── clock.png │ ├── coding.png │ ├── cog.png │ ├── computer-96.png │ ├── computer.png │ ├── connect.png │ ├── control_end.png │ ├── control_fastforward.png │ ├── control_repeat.png │ ├── control_rewind.png │ ├── control_start.png │ ├── cross.png │ ├── delete.png │ ├── deny.png │ ├── disk.png │ ├── document_tree.png │ ├── download.png │ ├── error.png │ ├── filter.png │ ├── folder.png │ ├── fort-96.png │ ├── fort.png │ ├── fort.svg │ ├── fort_deny.png │ ├── fort_gray.png │ ├── fort_orange.png │ ├── fort_red.png │ ├── github.png │ ├── global_telecom.png │ ├── green_down.png │ ├── help.png │ ├── hostname.png │ ├── information.png │ ├── interface_preferences.png │ ├── ip.png │ ├── ip_block.png │ ├── ip_class.png │ ├── key.png │ ├── large_tiles.png │ ├── lightbulb.png │ ├── lock.png │ ├── lock_open.png │ ├── magnifier.png │ ├── page_copy.png │ ├── parking.png │ ├── pencil.png │ ├── play.png │ ├── recycle.png │ ├── road_sign.png │ ├── save_as.png │ ├── script.png │ ├── script_code.png │ ├── script_code_red.png │ ├── scull.png │ ├── server_components.png │ ├── speedometer.png │ ├── standby.png │ ├── tick.png │ ├── time.png │ ├── widgets.png │ └── windows-48.png ├── log │ ├── logbuffer.cpp │ ├── logbuffer.h │ ├── logentry.cpp │ ├── logentry.h │ ├── logentryapp.cpp │ ├── logentryapp.h │ ├── logentryconn.cpp │ ├── logentryconn.h │ ├── logentryprocnew.cpp │ ├── logentryprocnew.h │ ├── logentrystattraf.cpp │ ├── logentrystattraf.h │ ├── logentrytime.cpp │ ├── logentrytime.h │ ├── logmanager.cpp │ └── logmanager.h ├── manager │ ├── autoupdatemanager.cpp │ ├── autoupdatemanager.h │ ├── dberrormanager.cpp │ ├── dberrormanager.h │ ├── dbmanagerbase.cpp │ ├── dbmanagerbase.h │ ├── drivelistmanager.cpp │ ├── drivelistmanager.h │ ├── envmanager.cpp │ ├── envmanager.h │ ├── hotkeymanager.cpp │ ├── hotkeymanager.h │ ├── logger.cpp │ ├── logger.h │ ├── nativeeventfilter.cpp │ ├── nativeeventfilter.h │ ├── serviceinfomanager.cpp │ ├── serviceinfomanager.h │ ├── servicemanager.cpp │ ├── servicemanager.h │ ├── translationmanager.cpp │ ├── translationmanager.h │ ├── windowmanager.cpp │ └── windowmanager.h ├── model │ ├── appconnlistmodel.cpp │ ├── appconnlistmodel.h │ ├── applistcolumn.h │ ├── applistmodel.cpp │ ├── applistmodel.h │ ├── applistmodeldata.cpp │ ├── applistmodeldata.h │ ├── applistmodelheaderdata.cpp │ ├── applistmodelheaderdata.h │ ├── appstatcolumn.h │ ├── appstatmodel.cpp │ ├── appstatmodel.h │ ├── connlistcolumn.h │ ├── connlistmodel.cpp │ ├── connlistmodel.h │ ├── rulelistmodel.cpp │ ├── rulelistmodel.h │ ├── rulesetmodel.cpp │ ├── rulesetmodel.h │ ├── servicelistmodel.cpp │ ├── servicelistmodel.h │ ├── traflistcolumn.h │ ├── traflistmodel.cpp │ ├── traflistmodel.h │ ├── trafunittype.cpp │ ├── trafunittype.h │ ├── zonelistmodel.cpp │ ├── zonelistmodel.h │ ├── zonesourcewrapper.cpp │ ├── zonesourcewrapper.h │ ├── zonetypewrapper.cpp │ └── zonetypewrapper.h ├── rpc │ ├── appinfomanagerrpc.cpp │ ├── appinfomanagerrpc.h │ ├── askpendingmanagerrpc.cpp │ ├── askpendingmanagerrpc.h │ ├── autoupdatemanagerrpc.cpp │ ├── autoupdatemanagerrpc.h │ ├── confappmanagerrpc.cpp │ ├── confappmanagerrpc.h │ ├── confmanagerrpc.cpp │ ├── confmanagerrpc.h │ ├── confrulemanagerrpc.cpp │ ├── confrulemanagerrpc.h │ ├── confzonemanagerrpc.cpp │ ├── confzonemanagerrpc.h │ ├── dberrormanagerrpc.cpp │ ├── dberrormanagerrpc.h │ ├── drivelistmanagerrpc.cpp │ ├── drivelistmanagerrpc.h │ ├── drivermanagerrpc.cpp │ ├── drivermanagerrpc.h │ ├── logmanagerrpc.cpp │ ├── logmanagerrpc.h │ ├── quotamanagerrpc.cpp │ ├── quotamanagerrpc.h │ ├── rpcmanager.cpp │ ├── rpcmanager.h │ ├── serviceinfomanagerrpc.cpp │ ├── serviceinfomanagerrpc.h │ ├── statconnmanagerrpc.cpp │ ├── statconnmanagerrpc.h │ ├── statmanagerrpc.cpp │ ├── statmanagerrpc.h │ ├── taskmanagerrpc.cpp │ ├── taskmanagerrpc.h │ ├── windowmanagerfake.cpp │ └── windowmanagerfake.h ├── scripts │ └── restart.bat ├── stat │ ├── askpendingmanager.cpp │ ├── askpendingmanager.h │ ├── deleteconnjob.cpp │ ├── deleteconnjob.h │ ├── logconnjob.cpp │ ├── logconnjob.h │ ├── migrations │ │ ├── conn │ │ │ └── 1.sql │ │ ├── conn_traf │ │ │ └── 1.sql │ │ └── traf │ │ │ └── 1.sql │ ├── quotamanager.cpp │ ├── quotamanager.h │ ├── stat_migrations.qrc │ ├── statconnbasejob.cpp │ ├── statconnbasejob.h │ ├── statconnmanager.cpp │ ├── statconnmanager.h │ ├── statconnworker.cpp │ ├── statconnworker.h │ ├── statmanager.cpp │ ├── statmanager.h │ ├── statsql.cpp │ └── statsql.h ├── task │ ├── taskdownloader.cpp │ ├── taskdownloader.h │ ├── taskeditinfo.cpp │ ├── taskeditinfo.h │ ├── taskinfo.cpp │ ├── taskinfo.h │ ├── taskinfoapppurger.cpp │ ├── taskinfoapppurger.h │ ├── taskinfoupdatechecker.cpp │ ├── taskinfoupdatechecker.h │ ├── taskinfozonedownloader.cpp │ ├── taskinfozonedownloader.h │ ├── tasklistmodel.cpp │ ├── tasklistmodel.h │ ├── tasklistmodeldata.cpp │ ├── tasklistmodeldata.h │ ├── tasklistmodelheaderdata.cpp │ ├── tasklistmodelheaderdata.h │ ├── taskmanager.cpp │ ├── taskmanager.h │ ├── taskupdatechecker.cpp │ ├── taskupdatechecker.h │ ├── taskworker.cpp │ ├── taskworker.h │ ├── taskzonedownloader.cpp │ └── taskzonedownloader.h ├── user │ ├── iniuser.cpp │ ├── iniuser.h │ ├── usersettings.cpp │ └── usersettings.h └── util │ ├── bitutil.cpp │ ├── bitutil.h │ ├── classhelpers.h │ ├── conf │ ├── addressrange.cpp │ ├── addressrange.h │ ├── appparseoptions.cpp │ ├── appparseoptions.h │ ├── conf_types.h │ ├── confappswalker.h │ ├── confbuffer.cpp │ ├── confbuffer.h │ ├── confdata.cpp │ ├── confdata.h │ ├── confrodata.cpp │ ├── confrodata.h │ ├── confruleswalker.h │ ├── confutil.cpp │ ├── confutil.h │ ├── ruletextparser.cpp │ └── ruletextparser.h │ ├── consoleoutput.cpp │ ├── consoleoutput.h │ ├── dateutil.cpp │ ├── dateutil.h │ ├── device.cpp │ ├── device.h │ ├── dirinfo.cpp │ ├── dirinfo.h │ ├── fileutil.cpp │ ├── fileutil.h │ ├── formatutil.cpp │ ├── formatutil.h │ ├── guiutil.cpp │ ├── guiutil.h │ ├── iconcache.cpp │ ├── iconcache.h │ ├── ini │ ├── mapsettings.cpp │ ├── mapsettings.h │ ├── settings.cpp │ └── settings.h │ ├── ioc │ ├── ioccontainer.cpp │ ├── ioccontainer.h │ └── iocservice.h │ ├── json │ ├── jsonutil.cpp │ ├── jsonutil.h │ ├── mapwrapper.cpp │ └── mapwrapper.h │ ├── model │ ├── ftstablesqlmodel.cpp │ ├── ftstablesqlmodel.h │ ├── stringlistmodel.cpp │ ├── stringlistmodel.h │ ├── tableitemmodel.cpp │ ├── tableitemmodel.h │ ├── tablesqlmodel.cpp │ └── tablesqlmodel.h │ ├── net │ ├── actionrange.cpp │ ├── actionrange.h │ ├── arearange.cpp │ ├── arearange.h │ ├── dirrange.cpp │ ├── dirrange.h │ ├── iprange.cpp │ ├── iprange.h │ ├── ipverrange.cpp │ ├── ipverrange.h │ ├── netdownloader.cpp │ ├── netdownloader.h │ ├── netformatutil.cpp │ ├── netformatutil.h │ ├── netutil.cpp │ ├── netutil.h │ ├── portrange.cpp │ ├── portrange.h │ ├── profilerange.cpp │ ├── profilerange.h │ ├── protorange.cpp │ ├── protorange.h │ ├── textrange.cpp │ ├── textrange.h │ ├── valuerange.cpp │ ├── valuerange.h │ ├── valuerangeutil.cpp │ └── valuerangeutil.h │ ├── osutil.cpp │ ├── osutil.h │ ├── processinfo.cpp │ ├── processinfo.h │ ├── regkey.cpp │ ├── regkey.h │ ├── service │ ├── service_types.h │ ├── servicehandle.cpp │ ├── servicehandle.h │ ├── serviceinfo.cpp │ ├── serviceinfo.h │ ├── servicelistmonitor.cpp │ ├── servicelistmonitor.h │ ├── servicemanageriface.cpp │ ├── servicemanageriface.h │ ├── servicemonitor.cpp │ ├── servicemonitor.h │ ├── serviceworker.cpp │ └── serviceworker.h │ ├── startuputil.cpp │ ├── startuputil.h │ ├── stringutil.cpp │ ├── stringutil.h │ ├── taskbarbutton.cpp │ ├── taskbarbutton.h │ ├── textareautil.cpp │ ├── textareautil.h │ ├── threadstorage.cpp │ ├── threadstorage.h │ ├── triggertimer.cpp │ ├── triggertimer.h │ ├── util_types.h │ ├── variantutil.cpp │ ├── variantutil.h │ ├── window │ ├── basewindowstatewatcher.cpp │ ├── basewindowstatewatcher.h │ ├── widgetwindow.cpp │ ├── widgetwindow.h │ ├── widgetwindowstatewatcher.cpp │ ├── widgetwindowstatewatcher.h │ ├── windowstatewatcher.cpp │ └── windowstatewatcher.h │ └── worker │ ├── worker_types.h │ ├── workerjob.cpp │ ├── workerjob.h │ ├── workermanager.cpp │ ├── workermanager.h │ ├── workerobject.cpp │ └── workerobject.h ├── ui_bin ├── 3rdparty │ ├── 3rdparty-include.pri │ ├── 3rdparty.pri │ └── breakpad │ │ ├── breakpad.pri │ │ ├── crashhandler.cpp │ │ └── crashhandler.h ├── FortFirewall.ico ├── FortFirewall.rc ├── FortFirewallUIBin.pro └── main.cpp └── version ├── FortFirewallVersion.pri ├── fort_version.h └── fort_version_l.h /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # Sponsoring 2 | 3 | github: [tnodir] 4 | patreon: tnodir 5 | custom: ["https://buymeacoffee.com/tnodir"] 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.cab 2 | *.dll 3 | *.exe 4 | *.pdb 5 | *.qm 6 | *.sys 7 | 8 | build*/ 9 | 10 | *.pro.u* 11 | *Makefile* 12 | 13 | .qmake.stash 14 | uic_wrapper.bat 15 | 16 | -------------------------------------------------------------------------------- /deploy/create-installer.bat: -------------------------------------------------------------------------------- 1 | @setlocal 2 | 3 | @cd %~dp0 4 | @echo off 5 | 6 | @set PROC_ARCHS="x86 x64" 7 | @set CHECK_WIN10= 8 | @if not exist ".\build\driver\x86\" ( 9 | @set PROC_ARCHS="x64" 10 | @set CHECK_WIN10="Y" 11 | ) 12 | @if exist ".\build\driver\ARM64\" ( 13 | @set PROC_ARCHS="x64 arm64" 14 | ) 15 | 16 | @set INNO_PATH=D:\Utils\Dev\InnoSetup5\ISCC.exe 17 | 18 | "%INNO_PATH%" FortFirewall.iss /DPROC_ARCHS=%PROC_ARCHS% /DCHECK_WIN10=%CHECK_WIN10% 19 | -------------------------------------------------------------------------------- /deploy/data/inst.tmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/data/inst.tmp -------------------------------------------------------------------------------- /deploy/data/qt.conf: -------------------------------------------------------------------------------- 1 | [Platforms] 2 | WindowsArguments = fontengine=gdi 3 | -------------------------------------------------------------------------------- /deploy/deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "files": { 3 | "${TARGET}": { 4 | "fort": [ 5 | "${BUILD}-${CONFIG}/ui_bin/FortFirewall.exe", 6 | "${ROOT}/src/ui/i18n | *.qm |" 7 | ] 8 | }, 9 | "${TARGET}/driver": { 10 | "scripts": [ 11 | "${ROOT}/src/driver/scripts | *.bat *.lnk |" 12 | ] 13 | }, 14 | "${TARGET}/driver/x86 | win7": { 15 | "sys": [ 16 | "${BUILD}-driver-${CONFIG}/Win32/fortfw.sys" 17 | ] 18 | }, 19 | "${TARGET}/driver/x86_64_old | win7 win10": { 20 | "sys": [ 21 | "${BUILD}-driver-win7/x64/fortfw.sys" 22 | ] 23 | }, 24 | "${TARGET}/driver/x86_64 | win7 win10": { 25 | "sys": [ 26 | "${BUILD}-driver-win10/x64/fortfw.sys" 27 | ] 28 | }, 29 | "${TARGET}/driver/ARM64 | win10-arm64": { 30 | "sys": [ 31 | "${BUILD}-driver-win10/ARM64/fortfw.sys" 32 | ] 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /deploy/driver-cab/fortfw.ddf: -------------------------------------------------------------------------------- 1 | ; External defines: 2 | ; .Set PLAT=x64 3 | ; .Set CONFIG=win10 4 | 5 | .Set CabinetFileCountThreshold=0 6 | .Set FolderFileCountThreshold=0 7 | .Set FolderSizeThreshold=0 8 | .Set MaxCabinetSize=0 9 | .Set MaxDiskFileCount=0 10 | .Set MaxDiskSize=0 11 | .Set CompressionType=MSZIP 12 | .Set Cabinet=on 13 | .Set Compress=on 14 | 15 | .Set CabinetNameTemplate=fortfw-%CONFIG%-%PLAT%.cab 16 | .Set DiskDirectoryTemplate= ; Output .cab files into current directory 17 | 18 | .Define DRIVER_PATH=..\..\build-driver-loader-%CONFIG%\%PLAT% 19 | .Define INF_PATH=..\..\src\driver\fortfw.inf 20 | 21 | .Set DestinationDir=fortfw 22 | %DRIVER_PATH%\fortfw.sys 23 | %DRIVER_PATH%\fortfw.pdb 24 | %INF_PATH% 25 | -------------------------------------------------------------------------------- /deploy/driver-cab/make-cab-win10-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0make-cab.bat x64 win10 -------------------------------------------------------------------------------- /deploy/driver-cab/make-cab-win10-arm64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0make-cab.bat ARM64 win10 -------------------------------------------------------------------------------- /deploy/driver-cab/make-cab-win7-32.bat: -------------------------------------------------------------------------------- 1 | @%~dp0make-cab.bat Win32 win7 -------------------------------------------------------------------------------- /deploy/driver-cab/make-cab-win7-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0make-cab.bat x64 win7 -------------------------------------------------------------------------------- /deploy/driver-cab/make-cab.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set PLAT=%1 5 | @set CONFIG=%2 6 | 7 | @set DRV_PATH=%~dp0..\..\build-driver-loader-%CONFIG%\%PLAT%\fortfw.sys 8 | 9 | @call ../sign/clear-certs.bat %DRV_PATH% 10 | 11 | @cd %~dp0 12 | makecab.exe /f fortfw.ddf /D PLAT=%PLAT% /D CONFIG=%CONFIG% 13 | 14 | @del /Q setup.* 15 | -------------------------------------------------------------------------------- /deploy/languages/ChineseSimplified.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/ChineseSimplified.isl -------------------------------------------------------------------------------- /deploy/languages/custom/BrazilianPortuguese.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/BrazilianPortuguese.isl -------------------------------------------------------------------------------- /deploy/languages/custom/ChineseSimplified.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/ChineseSimplified.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Default.isl: -------------------------------------------------------------------------------- 1 | [LangOptions] 2 | LanguageName=English 3 | LanguageID=$0409 4 | LanguageCodePage=0 5 | 6 | [CustomMessages] 7 | 8 | ; *** Fort Firewall messages 9 | WindowsExplorerIntegration=Windows Explorer integration 10 | WindowsService=Windows Service 11 | Portable=Portable 12 | UninstallPassword=Uninstall Password 13 | UninstallPasswordOK=OK 14 | UninstallPasswordCancel=Cancel 15 | WrongPassword=Wrong password 16 | NotCompatibleWithWindows=This program is not compatible with Windows version (Windows 10 1809 or newer required). 17 | NotCompatibleWithWindows7=This program is not compatible with Windows 7 version (KB4474419 required). 18 | NotCompatibleWithHVCI=This program is not compatible with HVCI (Core Isolation). 19 | InstallVCRedist=Install the latest Visual C++ redistributable! 20 | IsDeleteData=Delete config & data files? 21 | -------------------------------------------------------------------------------- /deploy/languages/custom/French.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/French.isl -------------------------------------------------------------------------------- /deploy/languages/custom/German.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/German.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Italian.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Italian.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Japanese.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Japanese.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Korean.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Korean.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Polish.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Polish.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Portuguese.isl: -------------------------------------------------------------------------------- 1 | [LangOptions] 2 | LanguageName=Portugu<00EA>s (Portugal) 3 | LanguageID=$0816 4 | LanguageCodePage=1252 5 | 6 | [CustomMessages] 7 | 8 | ; *** Fort Firewall messages 9 | WindowsExplorerIntegration=Windows Explorer integration 10 | WindowsService=Windows Service 11 | Portable=Portable 12 | UninstallPassword=Uninstall Password 13 | UninstallPasswordOK=OK 14 | UninstallPasswordCancel=Cancel 15 | WrongPassword=Wrong password 16 | NotCompatibleWithWindows=This program is not compatible with Windows version (Windows 10 1809 or newer required). 17 | NotCompatibleWithWindows7=This program is not compatible with Windows 7 version (KB4474419 required). 18 | NotCompatibleWithHVCI=This program is not compatible with HVCI (Core Isolation). 19 | InstallVCRedist=Install the latest Visual C++ redistributable! 20 | IsDeleteData=Delete config & data files? 21 | -------------------------------------------------------------------------------- /deploy/languages/custom/Russian.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Russian.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Slovenian.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Slovenian.isl -------------------------------------------------------------------------------- /deploy/languages/custom/Spanish.isl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/deploy/languages/custom/Spanish.isl -------------------------------------------------------------------------------- /deploy/out/FortFirewall-Silent.bat: -------------------------------------------------------------------------------- 1 | @for %%f in (FortFirewall-*.exe) do @call .\%%f /SILENT 2 | -------------------------------------------------------------------------------- /deploy/out/FortFirewall-Unpack.bat: -------------------------------------------------------------------------------- 1 | @call %1 /SILENT /UNPACK=. 2 | -------------------------------------------------------------------------------- /deploy/setup-deployment-win10-arm64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0setup-deployment.bat -Config win10-arm64 2 | -------------------------------------------------------------------------------- /deploy/setup-deployment-win10.bat: -------------------------------------------------------------------------------- 1 | @%~dp0setup-deployment.bat -Config win10 2 | -------------------------------------------------------------------------------- /deploy/setup-deployment-win7.bat: -------------------------------------------------------------------------------- 1 | @%~dp0setup-deployment.bat -Config win7 2 | -------------------------------------------------------------------------------- /deploy/setup-deployment.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set TARGET_PATH=build 5 | 6 | rd /Q /S %TARGET_PATH% 7 | md %TARGET_PATH% 8 | 9 | powershell.exe -executionpolicy remotesigned -file setup-deployment.ps1 %TARGET_PATH% %* 10 | -------------------------------------------------------------------------------- /deploy/sign/clear-certs.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set BIN_PATH=%1 5 | 6 | signtool.exe remove /s %BIN_PATH% 7 | -------------------------------------------------------------------------------- /deploy/sign/sign-app.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set APP_PATH=..\build\FortFirewall.exe 5 | 6 | @call sign-env-certum.bat 7 | 8 | signtool.exe sign /n "%CRT_NAME%" /fd SHA256 /td SHA256 /tr %TS_URL% %APP_PATH% 9 | -------------------------------------------------------------------------------- /deploy/sign/sign-bin.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set BIN_PATH=.\*.bin 5 | 6 | @call sign-env-sectigo.bat 7 | 8 | signtool.exe sign /n "%CRT_NAME%" /fd SHA256 /td SHA256 /tr %TS_URL% %BIN_PATH% 9 | -------------------------------------------------------------------------------- /deploy/sign/sign-cabs.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set CAB_PATH=..\driver-cab\fortfw*.cab 5 | 6 | @call sign-env-certum.bat 7 | 8 | signtool.exe sign /n "%CRT_NAME%" /fd SHA256 /td SHA256 /tr %TS_URL% %CAB_PATH% 9 | -------------------------------------------------------------------------------- /deploy/sign/sign-driver.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @rem ARCH: x86, x86_64 5 | @set ARCH=%1 6 | 7 | @set DRV_PATH=..\build\driver\%ARCH%\fortfw.sys 8 | 9 | @call sign-env-sectigo.bat 10 | 11 | signtool.exe sign /ac "%CRT_PATH%" /n "%CRT_NAME%" /fd SHA256 /td SHA256 /tr %TS_URL% %DRV_PATH% 12 | -------------------------------------------------------------------------------- /deploy/sign/sign-env-certum.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @rem Certum 4 | @set CRT_PATH=cert\Certum Trusted Network CA.crt 5 | @set CRT_NAME=Open Source Developer, Nodir Temirkhodjaev 6 | 7 | @set TS_URL=http://timestamp.digicert.com/ 8 | -------------------------------------------------------------------------------- /deploy/sign/sign-env-sectigo.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @rem Sectigo 4 | @set CRT_PATH=cert\SectigoPublicCodeSigningRootR46_AAA.crt 5 | @set CRT_NAME=Renew-it-now 6 | 7 | @set TS_URL=http://timestamp.digicert.com/ 8 | -------------------------------------------------------------------------------- /deploy/sign/sign-out.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @set OUT_PATH=..\out\*.exe 5 | 6 | @call sign-env-certum.bat 7 | 8 | signtool.exe sign /n "%CRT_NAME%" /fd SHA256 /td SHA256 /tr %TS_URL% %OUT_PATH% 9 | -------------------------------------------------------------------------------- /deploy/sign/sign-verify.bat: -------------------------------------------------------------------------------- 1 | @cd %~dp0 2 | @echo off 3 | 4 | @rem ARCH: 64, 32 5 | @set ARCH=%1 6 | 7 | @set DRV_PATH=..\build\driver\fortfw%ARCH%.sys 8 | 9 | signtool.exe verify /v /kp %DRV_PATH% 10 | -------------------------------------------------------------------------------- /src/.qmake.conf: -------------------------------------------------------------------------------- 1 | builddir=$$shadowed($$PWD) 2 | -------------------------------------------------------------------------------- /src/3rdparty/breakpad/.clang-format: -------------------------------------------------------------------------------- 1 | # Defines the Chromium style for automatic reformatting. 2 | # https://clang.llvm.org/docs/ClangFormatStyleOptions.html 3 | BasedOnStyle: Chromium 4 | 5 | # This defaults to 'Auto'. Explicitly set it for a while, so that 6 | # 'vector >' in existing files gets formatted to 7 | # 'vector>'. ('Auto' means that clang-format will only use 8 | # 'int>>' if the file already contains at least one such instance.) 9 | Standard: Cpp11 10 | -------------------------------------------------------------------------------- /src/3rdparty/sqlite/sqlite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "sqlite_cfg.h" 4 | #include "sqlite3.h" 5 | -------------------------------------------------------------------------------- /src/3rdparty/wildmatch/wildmatch.h: -------------------------------------------------------------------------------- 1 | #ifndef WILDMATCH_H 2 | #define WILDMATCH_H 3 | 4 | #define WM_NOMATCH 1 5 | #define WM_MATCH 0 6 | #define WM_ABORT_ALL -1 7 | #define WM_ABORT_TO_STARSTAR -2 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif 12 | 13 | WILDMATCH_API int wildmatch(const wm_char *pattern, const wm_char *text); 14 | 15 | #ifdef __cplusplus 16 | } // extern "C" 17 | #endif 18 | 19 | #endif // WILDMATCH_H 20 | -------------------------------------------------------------------------------- /src/FortFirewall.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS += \ 4 | ui \ 5 | ui_bin 6 | 7 | ui.file = ui/FortFirewallUI.pro 8 | 9 | ui_bin.depends = ui 10 | ui_bin.file = ui_bin/FortFirewallUIBin.pro 11 | 12 | # Tests 13 | tests { 14 | SUBDIRS += \ 15 | driver \ 16 | tests 17 | 18 | driver.file = driver/FortFirewallDriver.pro 19 | 20 | tests.depends = ui 21 | tests.file = tests/FortFirewallTests.pro 22 | } 23 | 24 | # Driver Payload 25 | driver_payload { 26 | SUBDIRS += \ 27 | driver_payload 28 | 29 | driver_payload.depends = ui 30 | driver_payload.file = driver_payload/FortFirewallDriverPayload.pro 31 | } 32 | -------------------------------------------------------------------------------- /src/driver/Driver-include.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH *= $$PWD 2 | 3 | # Windows 4 | LIBS *= -lfwpuclnt -ladvapi32 -lkernel32 -luser32 -lshell32 -luuid -lversion -lws2_32 -lwtsapi32 -lbcrypt 5 | -------------------------------------------------------------------------------- /src/driver/Driver.pri: -------------------------------------------------------------------------------- 1 | include($$PWD/Driver-include.pri) 2 | 3 | SOURCES += \ 4 | $$PWD/common/fortconf.c \ 5 | $$PWD/common/fortlog.c \ 6 | $$PWD/common/fortprov.c \ 7 | $$PWD/common/fort_wildmatch.c 8 | 9 | HEADERS += \ 10 | $$PWD/common/common.h \ 11 | $$PWD/common/common_types.h \ 12 | $$PWD/common/fortconf.h \ 13 | $$PWD/common/fortdef.h \ 14 | $$PWD/common/fortguid.h \ 15 | $$PWD/common/fortioctl.h \ 16 | $$PWD/common/fortlog.h \ 17 | $$PWD/common/fortprov.h \ 18 | $$PWD/common/fort_wildmatch.h 19 | -------------------------------------------------------------------------------- /src/driver/common/fort_wildmatch.c: -------------------------------------------------------------------------------- 1 | /* Fort Firewall WildMatch */ 2 | 3 | #include "fort_wildmatch.h" 4 | 5 | #include "../../3rdparty/wildmatch/wildmatch.c" 6 | -------------------------------------------------------------------------------- /src/driver/common/fort_wildmatch.h: -------------------------------------------------------------------------------- 1 | #ifndef FORT_WILDMATCH_H 2 | #define FORT_WILDMATCH_H 3 | 4 | #include "common.h" 5 | 6 | #define WILDMATCH_API FORT_API 7 | 8 | typedef WCHAR wm_char; 9 | 10 | #include "../../3rdparty/wildmatch/wildmatch.h" 11 | 12 | #endif // FORT_WILDMATCH_H 13 | -------------------------------------------------------------------------------- /src/driver/evt/FORTEVT_MSG00001.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/driver/evt/FORTEVT_MSG00001.bin -------------------------------------------------------------------------------- /src/driver/evt/fortevt.rc: -------------------------------------------------------------------------------- 1 | LANGUAGE 0x9,0x1 2 | 1 11 "FORTEVT_MSG00001.bin" 3 | -------------------------------------------------------------------------------- /src/driver/evt/mcbuild.bat: -------------------------------------------------------------------------------- 1 | @rem Open "Visual Studio .NET Command Prompt" to run this script 2 | 3 | @setlocal 4 | 5 | @cd %~dp0 6 | 7 | mc -z FORTEVT fortevt.mc 8 | -------------------------------------------------------------------------------- /src/driver/fortcb.c: -------------------------------------------------------------------------------- 1 | /* Fort Firewall Driver Callbacks */ 2 | 3 | #include "fortcb.h" 4 | 5 | #include "proxycb/fortpcb_dst.h" 6 | 7 | FORT_PROXYCB_INFO g_callbackInfo; 8 | 9 | FORT_API FortCallbackFunc fort_callback(int id, FortCallbackFunc func) 10 | { 11 | if (g_callbackInfo.src == NULL) 12 | return func; 13 | 14 | ProxyCallbackProc cb = g_callbackInfo.src[id]; 15 | 16 | #ifdef FORT_DEBUG 17 | LOG("Proxy Callback: i=%d func=%p cb=%p\n", id, func, cb); 18 | #endif 19 | 20 | g_callbackInfo.callbacks[id] = func; 21 | return cb; 22 | } 23 | 24 | FORT_API void fort_callback_setup(PFORT_PROXYCB_INFO cb_info) 25 | { 26 | fort_proxycb_dst_setup(cb_info); 27 | 28 | g_callbackInfo = *cb_info; 29 | } 30 | -------------------------------------------------------------------------------- /src/driver/fortcb.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTCB_H 2 | #define FORTCB_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #include "proxycb/fortpcb_def.h" 7 | 8 | enum { 9 | FORT_CALLBACK_SYSCB_POWER = 0, 10 | FORT_CALLBACK_SYSCB_TIME, 11 | FORT_CALLBACK_TIMER_CALLBACK, 12 | FORT_CALLBACK_WORKER_CALLBACK, 13 | FORT_CALLBACK_PSTREE_NOTIFY, 14 | }; 15 | 16 | #if defined(__cplusplus) 17 | extern "C" { 18 | #endif 19 | 20 | typedef void(WINAPI *FortCallbackFunc)(void); 21 | 22 | FORT_API FortCallbackFunc fort_callback(int id, FortCallbackFunc func); 23 | 24 | FORT_API void fort_callback_setup(PFORT_PROXYCB_INFO cb_info); 25 | 26 | #ifdef __cplusplus 27 | } // extern "C" 28 | #endif 29 | 30 | #define FORT_CALLBACK(id, T, func) (T) fort_callback((id), (FortCallbackFunc) (func)) 31 | 32 | #endif // FORTCB_H 33 | -------------------------------------------------------------------------------- /src/driver/fortcnf_rule.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTCNF_RULE_H 2 | #define FORTCNF_RULE_H 3 | 4 | #include "fortcnf.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | FORT_API PFORT_CONF_RULES fort_conf_rules_new(PCFORT_CONF_RULES rules, ULONG len); 11 | 12 | FORT_API void fort_conf_rules_set(PFORT_DEVICE_CONF device_conf, PFORT_CONF_RULES rules); 13 | 14 | FORT_API void fort_conf_rule_flag_set( 15 | PFORT_DEVICE_CONF device_conf, PCFORT_CONF_RULE_FLAG rule_flag); 16 | 17 | FORT_API BOOL fort_devconf_rules_conn_filtered( 18 | PFORT_DEVICE_CONF device_conf, PFORT_CONF_META_CONN conn, UINT16 rule_id); 19 | 20 | #ifdef __cplusplus 21 | } // extern "C" 22 | #endif 23 | 24 | #endif // FORTCNF_RULE_H 25 | -------------------------------------------------------------------------------- /src/driver/fortcnf_zone.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTCNF_ZONE_H 2 | #define FORTCNF_ZONE_H 3 | 4 | #include "fortcnf.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | FORT_API PFORT_CONF_ZONES fort_conf_zones_new(PCFORT_CONF_ZONES zones, ULONG len); 11 | 12 | FORT_API void fort_conf_zones_set(PFORT_DEVICE_CONF device_conf, PFORT_CONF_ZONES zones); 13 | 14 | FORT_API void fort_conf_zone_flag_set( 15 | PFORT_DEVICE_CONF device_conf, PCFORT_CONF_ZONE_FLAG zone_flag); 16 | 17 | FORT_API BOOL fort_devconf_zones_ip_included(PFORT_DEVICE_CONF device_conf, 18 | PCFORT_CONF_META_CONN conn, UCHAR *zone_id, UINT32 zones_mask); 19 | 20 | FORT_API BOOL fort_devconf_zones_conn_filtered(PFORT_DEVICE_CONF device_conf, 21 | PCFORT_CONF_META_CONN conn, PFORT_CONF_ZONES_CONN_FILTERED_OPT opt); 22 | 23 | #ifdef __cplusplus 24 | } // extern "C" 25 | #endif 26 | 27 | #endif // FORTCNF_ZONE_H 28 | -------------------------------------------------------------------------------- /src/driver/fortcout.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTCOUT_H 2 | #define FORTCOUT_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #include "common/fortconf.h" 7 | 8 | #if defined(__cplusplus) 9 | extern "C" { 10 | #endif 11 | 12 | FORT_API NTSTATUS fort_callout_install(PDEVICE_OBJECT device); 13 | 14 | FORT_API void fort_callout_remove(void); 15 | 16 | FORT_API NTSTATUS fort_callout_force_reauth(const FORT_CONF_FLAGS old_conf_flags); 17 | 18 | FORT_API void fort_callout_timer(void); 19 | 20 | #ifdef __cplusplus 21 | } // extern "C" 22 | #endif 23 | 24 | #endif // FORTCOUT_H 25 | -------------------------------------------------------------------------------- /src/driver/fortdbg.c: -------------------------------------------------------------------------------- 1 | /* Fort Firewall Debugging */ 2 | 3 | #include "fortdbg.h" 4 | 5 | #define FORT_KERNEL_STACK_MIN_SIZE 1024 6 | 7 | #define FORT_STATUS_INVALID_STACK 0x0000007F /* UNEXPECTED_KERNEL_MODE_TRAP */ 8 | #define FORT_TRAP_CODE 0x0000000C /* STACK_FAULT */ 9 | 10 | FORT_API void fort_check_stack(const char *func_name, FORT_FUNC_ID func_id) 11 | { 12 | const UINT32 free_size = (UINT32) IoGetRemainingStackSize(); 13 | 14 | if (free_size > FORT_KERNEL_STACK_MIN_SIZE) 15 | return; 16 | 17 | LOG("Stack Overflow: %s: id=%d remaining=%d\n", func_name, func_id, free_size); 18 | 19 | KeBugCheckEx(FORT_STATUS_INVALID_STACK, FORT_TRAP_CODE, (FORT_DEBUG_VERSION << 16) | func_id, 20 | free_size, 0); 21 | } 22 | -------------------------------------------------------------------------------- /src/driver/fortdrv.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | DriverImportsSetup 3 | DriverCallbacksSetup 4 | DriverEntry 5 | -------------------------------------------------------------------------------- /src/driver/fortmod.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTMOD_H 2 | #define FORTMOD_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | typedef struct _AUX_MODULE_EXTENDED_INFO AUX_MODULE_EXTENDED_INFO, *PAUX_MODULE_EXTENDED_INFO; 11 | 12 | typedef struct _LOADEDMODULE 13 | { 14 | PUCHAR codeBase; 15 | } LOADEDMODULE, *PLOADEDMODULE; 16 | 17 | FORT_API PIMAGE_NT_HEADERS GetModuleNtHeaders(PUCHAR codeBase); 18 | 19 | FORT_API NTSTATUS GetModuleInfo(PLOADEDMODULE pModule, LPCSTR name, 20 | const PAUX_MODULE_EXTENDED_INFO modules, DWORD modulesCount); 21 | 22 | FORT_API NTSTATUS GetModuleInfoList(PAUX_MODULE_EXTENDED_INFO *outModules, DWORD *outModulesCount); 23 | 24 | FORT_API void FreeModuleInfoList(PAUX_MODULE_EXTENDED_INFO modules); 25 | 26 | FORT_API FARPROC ModuleGetProcAddress(PLOADEDMODULE pModule, LPCSTR funcName); 27 | 28 | #ifdef __cplusplus 29 | } // extern "C" 30 | #endif 31 | 32 | #endif // FORTMOD_H 33 | -------------------------------------------------------------------------------- /src/driver/fortscb.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTSCB_H 2 | #define FORTSCB_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | FORT_API NTSTATUS fort_syscb_power_register(void); 11 | 12 | FORT_API void fort_syscb_power_unregister(void); 13 | 14 | FORT_API NTSTATUS fort_syscb_time_register(void); 15 | 16 | FORT_API void fort_syscb_time_unregister(void); 17 | 18 | #ifdef __cplusplus 19 | } // extern "C" 20 | #endif 21 | 22 | #endif // FORTSCB_H 23 | -------------------------------------------------------------------------------- /src/driver/forttds.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTTDS_H 2 | #define FORTTDS_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #define TOMMY_API FORT_API 7 | 8 | #define tommy_assert NT_ASSERT 9 | 10 | #define tommy_malloc fort_tommy_malloc 11 | #define tommy_free fort_tommy_free 12 | #define tommy_calloc fort_tommy_calloc 13 | #define tommy_realloc fort_tommy_realloc 14 | 15 | FORT_API PVOID fort_tommy_malloc(SIZE_T size); 16 | 17 | FORT_API void fort_tommy_free(PVOID p); 18 | 19 | FORT_API PVOID fort_tommy_calloc(SIZE_T count, SIZE_T element_size); 20 | 21 | FORT_API PVOID fort_tommy_realloc(PVOID p, SIZE_T new_size); 22 | 23 | #include "../3rdparty/tommyds/tommyarrayof.h" 24 | #include "../3rdparty/tommyds/tommylist.h" 25 | #include "../3rdparty/tommyds/tommyhash.h" 26 | #include "../3rdparty/tommyds/tommyhashdyn.h" 27 | 28 | #endif // FORTTDS_H 29 | -------------------------------------------------------------------------------- /src/driver/fortthr.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTTHR_H 2 | #define FORTTHR_H 3 | 4 | #include "fortdrv.h" 5 | 6 | typedef struct fort_thread 7 | { 8 | PVOID thread_obj; 9 | } FORT_THREAD, *PFORT_THREAD; 10 | 11 | #if defined(__cplusplus) 12 | extern "C" { 13 | #endif 14 | 15 | FORT_API NTSTATUS fort_thread_run( 16 | PFORT_THREAD thread, PKSTART_ROUTINE routine, PVOID context, int priorityIncrement); 17 | 18 | FORT_API void fort_thread_wait(PFORT_THREAD thread); 19 | 20 | #ifdef __cplusplus 21 | } // extern "C" 22 | #endif 23 | 24 | #endif // FORTTHR_H 25 | -------------------------------------------------------------------------------- /src/driver/forttlsf.c: -------------------------------------------------------------------------------- 1 | /* Fort Firewall TLSF */ 2 | 3 | #include "forttlsf.h" 4 | 5 | #include "../3rdparty/tlsf/tlsf.c" 6 | -------------------------------------------------------------------------------- /src/driver/forttlsf.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTTLSF_H 2 | #define FORTTLSF_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #define TLSF_API FORT_API 7 | 8 | #define tlsf_assert NT_ASSERT 9 | #define tlsf_printf 10 | 11 | #define TLSF_MAX_POOL_SIZE (16 * 1024 * 1024) 12 | 13 | #include "../3rdparty/tlsf/tlsf.h" 14 | 15 | #endif // FORTTLSF_H 16 | -------------------------------------------------------------------------------- /src/driver/forttrace.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTTRACE_H 2 | #define FORTTRACE_H 3 | 4 | #include "fortdrv.h" 5 | 6 | #include "evt/fortevt.h" 7 | 8 | #define TRACE(event_code, status, error_value, sequence) \ 9 | fort_trace_event((event_code), (status), (error_value), (sequence)) 10 | 11 | #if defined(__cplusplus) 12 | extern "C" { 13 | #endif 14 | 15 | FORT_API void fort_trace_event( 16 | NTSTATUS event_code, NTSTATUS status, ULONG error_value, ULONG sequence); 17 | 18 | #ifdef __cplusplus 19 | } // extern "C" 20 | #endif 21 | 22 | #endif // FORTTRACE_H 23 | -------------------------------------------------------------------------------- /src/driver/loader/fortdl.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTDL_H 2 | #define FORTDL_H 3 | 4 | #include "../fortdrv.h" 5 | 6 | #define FORT_LOADER_POOL_TAG 'LwfF' 7 | 8 | #endif // FORTDL_H 9 | -------------------------------------------------------------------------------- /src/driver/loader/fortdl_amalg.c: -------------------------------------------------------------------------------- 1 | /* Fort Firewall Driver Loader Amalgamated */ 2 | 3 | #define FORT_AMALG 4 | #define FORT_DRIVER 5 | #define FORT_DEBUG 6 | 7 | #include "../fortmod.c" 8 | #include "../fortutl.c" 9 | 10 | #include "../proxycb/fortpcb_drv.c" 11 | #include "../proxycb/fortpcb_src.c" 12 | 13 | #include "fortmm.c" 14 | #include "fortmm_imp.c" 15 | #include "fortimg.c" 16 | #include "fortdl.c" 17 | -------------------------------------------------------------------------------- /src/driver/loader/fortimg.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTIMG_H 2 | #define FORTIMG_H 3 | 4 | #include "fortdl.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | FORT_API NTSTATUS fort_image_payload( 11 | const PUCHAR data, DWORD dataSize, PUCHAR *outPayload, DWORD *outPayloadSize); 12 | 13 | #ifdef __cplusplus 14 | } // extern "C" 15 | #endif 16 | 17 | #endif // FORTIMG_H 18 | -------------------------------------------------------------------------------- /src/driver/loader/fortmm.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTMM_H 2 | #define FORTMM_H 3 | 4 | #include "fortdl.h" 5 | 6 | #include "../fortmod.h" 7 | #include "../proxycb/fortpcb_def.h" 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif 12 | 13 | FORT_API NTSTATUS LoadModuleFromMemory(PLOADEDMODULE pModule, const PUCHAR lpData, DWORD dwSize); 14 | 15 | FORT_API void UnloadModule(PLOADEDMODULE pModule); 16 | 17 | FORT_API NTSTATUS SetupModuleCallbacks(PLOADEDMODULE pModule, PFORT_PROXYCB_INFO cbInfo); 18 | 19 | FORT_API NTSTATUS CallModuleEntry( 20 | PLOADEDMODULE pModule, PDRIVER_OBJECT driver, PUNICODE_STRING regPath); 21 | 22 | #ifdef __cplusplus 23 | } // extern "C" 24 | #endif 25 | 26 | #endif // FORTMM_H 27 | -------------------------------------------------------------------------------- /src/driver/loader/msvcbuild-win10-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat x64 win10 2 | -------------------------------------------------------------------------------- /src/driver/loader/msvcbuild-win10-arm64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat ARM64 win10 arm64 2 | -------------------------------------------------------------------------------- /src/driver/loader/msvcbuild-win7-32.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat Win32 win7 2 | -------------------------------------------------------------------------------- /src/driver/loader/msvcbuild-win7-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat x64 win7 2 | -------------------------------------------------------------------------------- /src/driver/loader/msvcbuild.bat: -------------------------------------------------------------------------------- 1 | @rem Open "Visual Studio .NET Command Prompt" to run this script 2 | 3 | @setlocal 4 | 5 | @cd %~dp0 6 | 7 | @rem PLAT: x64, Win32 8 | @set PLAT=%1 9 | @if "%PLAT%"=="" @set PLAT=x64 10 | 11 | @rem CONFIG: win7, win10 12 | @set CONFIG=%2 13 | @if "%CONFIG%"=="" @set CONFIG=win10 14 | 15 | @rem ARCH: x86, arm64 16 | @set ARCH=%3 17 | @if "%ARCH%"=="" @set ARCH=x86 18 | 19 | @set OutDir=..\..\..\build-driver-loader-%CONFIG%\%PLAT% 20 | @set IntDir=%OutDir%-obj 21 | 22 | MSBuild fortdl.vcxproj /p:OutDir=%OutDir%\;IntDir=%IntDir%\;Platform=%PLAT%;Config=%CONFIG%;Arch=%ARCH% 23 | 24 | @rem DumpBin /SYMBOLS "%IntDir%\fortdl.obj" > symbols.txt 25 | 26 | @rd /S /Q "%IntDir%" 27 | 28 | @rd /S /Q "%OutDir%\fortdl" 29 | @del /Q "%OutDir%\fortfw*.cer" 30 | -------------------------------------------------------------------------------- /src/driver/msvcbuild-win10-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat x64 win10 2 | -------------------------------------------------------------------------------- /src/driver/msvcbuild-win10-arm64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat ARM64 win10 arm64 2 | -------------------------------------------------------------------------------- /src/driver/msvcbuild-win7-32.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat Win32 win7 2 | -------------------------------------------------------------------------------- /src/driver/msvcbuild-win7-64.bat: -------------------------------------------------------------------------------- 1 | @%~dp0msvcbuild.bat x64 win7 2 | -------------------------------------------------------------------------------- /src/driver/msvcbuild.bat: -------------------------------------------------------------------------------- 1 | @rem Open "Visual Studio .NET Command Prompt" to run this script 2 | 3 | @setlocal 4 | 5 | @cd %~dp0 6 | 7 | @rem PLAT: x64, Win32 8 | @set PLAT=%1 9 | @if "%PLAT%"=="" @set PLAT=x64 10 | 11 | @rem CONFIG: win7, win10 12 | @set CONFIG=%2 13 | @if "%CONFIG%"=="" @set CONFIG=win10 14 | 15 | @rem ARCH: x86, arm64 16 | @set ARCH=%3 17 | @if "%ARCH%"=="" @set ARCH=x86 18 | 19 | @set OutDir=..\..\build-driver-%CONFIG%\%PLAT% 20 | @set IntDir=%OutDir%-obj 21 | 22 | MSBuild fortdrv.vcxproj /p:OutDir=%OutDir%\;IntDir=%IntDir%\;Platform=%PLAT%;Config=%CONFIG%;Arch=%ARCH% 23 | 24 | @rem DumpBin /SYMBOLS "%IntDir%\fortdrv.obj" > symbols.txt 25 | 26 | @rd /S /Q "%IntDir%" 27 | 28 | @rd /S /Q "%OutDir%\fortdrv" 29 | @del /Q "%OutDir%\fortfw*.cer" 30 | -------------------------------------------------------------------------------- /src/driver/proxycb/fortpcb_def.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTPCB_DEF_H 2 | #define FORTPCB_DEF_H 3 | 4 | #include "../fortdrv.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | typedef void(WINAPI *ProxyCallbackProc)(void); 11 | 12 | typedef struct fort_proxycb_info 13 | { 14 | ProxyCallbackProc *src; 15 | ProxyCallbackProc *dst; 16 | ProxyCallbackProc *callbacks; 17 | } FORT_PROXYCB_INFO, *PFORT_PROXYCB_INFO; 18 | 19 | #define PROXY_CALLBACKS_COUNT 64 20 | 21 | #ifdef __cplusplus 22 | } // extern "C" 23 | #endif 24 | 25 | #endif // FORTPCB_DEF_H 26 | -------------------------------------------------------------------------------- /src/driver/proxycb/fortpcb_drv.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTPCB_DRV_H 2 | #define FORTPCB_DRV_H 3 | 4 | #include "fortpcb_def.h" 5 | 6 | #define FORT_DRIVER_MAJOR_FUNC_MAX (IRP_MJ_MAXIMUM_FUNCTION + 1) 7 | static_assert(FORT_DRIVER_MAJOR_FUNC_MAX == 28, "Driver Major Functions Count Mismatch"); 8 | 9 | #if defined(__cplusplus) 10 | extern "C" { 11 | #endif 12 | 13 | FORT_API void fort_proxycb_drv_prepare(PDRIVER_DISPATCH *driver_major_funcs); 14 | FORT_API void fort_proxycb_drv_setup(PDRIVER_DISPATCH *driver_major_funcs); 15 | 16 | #ifdef __cplusplus 17 | } // extern "C" 18 | #endif 19 | 20 | #endif // FORTPCB_DRV_H 21 | -------------------------------------------------------------------------------- /src/driver/proxycb/fortpcb_dst.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTPCB_DST_H 2 | #define FORTPCB_DST_H 3 | 4 | #include "fortpcb_def.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | extern ProxyCallbackProc g_proxyCallbacksArray[PROXY_CALLBACKS_COUNT]; 11 | 12 | FORT_API void fort_proxycb_dst_setup(PFORT_PROXYCB_INFO cbInfo); 13 | 14 | #ifdef __cplusplus 15 | } // extern "C" 16 | #endif 17 | 18 | #endif // FORTPCB_DST_H 19 | -------------------------------------------------------------------------------- /src/driver/proxycb/fortpcb_src.h: -------------------------------------------------------------------------------- 1 | #ifndef FORTPCB_SRC_H 2 | #define FORTPCB_SRC_H 3 | 4 | #include "fortpcb_def.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | extern ProxyCallbackProc g_proxyDstCallbacksArray[PROXY_CALLBACKS_COUNT]; 11 | 12 | FORT_API void fort_proxycb_src_prepare(PFORT_PROXYCB_INFO cbInfo); 13 | FORT_API void fort_proxycb_src_setup(PFORT_PROXYCB_INFO cbInfo); 14 | 15 | #ifdef __cplusplus 16 | } // extern "C" 17 | #endif 18 | 19 | #endif // FORTPCB_SRC_H 20 | -------------------------------------------------------------------------------- /src/driver/scripts/check-reinstall.bat: -------------------------------------------------------------------------------- 1 | @rem Check existing driver file's timestamp or reinstall it 2 | 3 | @call "%~dp0setup-vars.bat" 4 | 5 | 6 | @if exist "%DSTPATH%" ( 7 | xcopy /L /D /Y "%SRCPATH%" "%DSTPATH%" | findstr /B /C:"0 " >NUL && goto EXIT 8 | ) 9 | 10 | "%~dp0reinstall.bat" %* 11 | 12 | :EXIT 13 | -------------------------------------------------------------------------------- /src/driver/scripts/execute-cmd.bat: -------------------------------------------------------------------------------- 1 | @rem Execute the command 2 | 3 | @cd "%~dp0" 4 | @echo off 5 | 6 | set "SystemPath=%SystemRoot%\System32" 7 | if defined PROGRAMFILES(X86) ( 8 | if exist %SystemRoot%\Sysnative\* set "SystemPath=%SystemRoot%\Sysnative" 9 | ) 10 | 11 | start "" /MIN /W %SystemPath%\cmd.exe /C "%~dp0%1" 12 | -------------------------------------------------------------------------------- /src/driver/scripts/reinstall.bat: -------------------------------------------------------------------------------- 1 | @rem Re-install driver 2 | 3 | @cd "%~dp0" 4 | @echo off 5 | 6 | %ComSpec% /C "%~dp0uninstall.bat" 7 | 8 | "%~dp0install.bat" %* 9 | -------------------------------------------------------------------------------- /src/driver/scripts/setup-vars.bat: -------------------------------------------------------------------------------- 1 | @rem Setup variables 2 | 3 | @if defined FORTSVC goto EXIT 4 | 5 | @set PATH=%SystemRoot%\System32;%PATH% 6 | 7 | @set ARCH=x86 8 | @if "%PROCESSOR_ARCHITECTURE%" == "AMD64" ( 9 | @set ARCH=x86_64 10 | 11 | @rem Check for Windows 10 2004 12 | @for /f "tokens=6 delims=.[] " %%i in ('ver') do @( 13 | @if %%i lss 19041 @set ARCH=x86_64_old 14 | ) 15 | ) else ( 16 | @if "%PROCESSOR_ARCHITECTURE%" == "ARM64" @set ARCH=ARM64 17 | ) 18 | 19 | @set BASENAME=fortfw 20 | @set FILENAME=%BASENAME%.sys 21 | 22 | @set SRCDIR=%~dp0..\%ARCH% 23 | @set SRCPATH=%SRCDIR%\%FILENAME% 24 | 25 | @set DSTDIR=%SystemRoot%\System32\drivers 26 | @set DSTPATH=%DSTDIR%\%FILENAME% 27 | 28 | @set DRIVERSVC=%BASENAME% 29 | @set DISPNAME=Fort Firewall Driver 30 | 31 | @set FORTSVC=FortFirewallSvc 32 | 33 | :EXIT 34 | -------------------------------------------------------------------------------- /src/driver/scripts/uninstall.bat: -------------------------------------------------------------------------------- 1 | @rem Uninstall driver 2 | 3 | @call "%~dp0setup-vars.bat" 4 | 5 | 6 | @rem Stop the FortFirewall service 7 | @sc stop %FORTSVC% 8 | 9 | 10 | @rem Stop the driver service 11 | sc stop %DRIVERSVC% 12 | 13 | @rem Remove the driver service 14 | sc delete %DRIVERSVC% 15 | @if ERRORLEVEL 1 ( 16 | @echo Error: Cannot delete a service: %DRIVERSVC% 17 | @set RCODE=%ERRORLEVEL% 18 | @rem @goto EXIT 19 | ) 20 | 21 | 22 | @rem Remove driver from system storage 23 | @if exist "%DSTPATH%" ( 24 | Del "%DSTPATH%" 25 | ) 26 | 27 | 28 | @set RCODE=0 29 | @goto EXIT 30 | 31 | :EXIT 32 | @echo End execution... Result Code = %RCODE% 33 | @exit /b %RCODE% 34 | -------------------------------------------------------------------------------- /src/driver/wdm/um_aux_klib.c: -------------------------------------------------------------------------------- 1 | #include "um_aux_klib.h" 2 | 3 | NTSTATUS AuxKlibInitialize() 4 | { 5 | return STATUS_SUCCESS; 6 | } 7 | 8 | NTSTATUS AuxKlibQueryModuleInformation(PULONG BufferSize, ULONG ElementSize, PVOID QueryInfo) 9 | { 10 | UNUSED(BufferSize); 11 | UNUSED(ElementSize); 12 | UNUSED(QueryInfo); 13 | return STATUS_SUCCESS; 14 | } 15 | -------------------------------------------------------------------------------- /src/driver/wdm/um_aux_klib.h: -------------------------------------------------------------------------------- 1 | #ifndef UM_AUX_KLIB_H 2 | #define UM_AUX_KLIB_H 3 | 4 | #include "um_wdm.h" 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | #define AUX_KLIB_MODULE_PATH_LEN 256 11 | 12 | typedef struct _AUX_MODULE_BASIC_INFO 13 | { 14 | PVOID ImageBase; 15 | } AUX_MODULE_BASIC_INFO, *PAUX_MODULE_BASIC_INFO; 16 | 17 | typedef struct _AUX_MODULE_EXTENDED_INFO 18 | { 19 | AUX_MODULE_BASIC_INFO BasicInfo; 20 | ULONG ImageSize; 21 | USHORT FileNameOffset; 22 | UCHAR FullPathName[AUX_KLIB_MODULE_PATH_LEN]; 23 | } AUX_MODULE_EXTENDED_INFO, *PAUX_MODULE_EXTENDED_INFO; 24 | 25 | FORT_API NTSTATUS AuxKlibInitialize(VOID); 26 | 27 | FORT_API NTSTATUS AuxKlibQueryModuleInformation( 28 | PULONG BufferSize, ULONG ElementSize, PVOID QueryInfo); 29 | 30 | #ifdef __cplusplus 31 | } // extern "C" 32 | #endif 33 | 34 | #endif // UM_AUX_KLIB_H 35 | -------------------------------------------------------------------------------- /src/driver/wdm/um_fwpmk.c: -------------------------------------------------------------------------------- 1 | #include "um_fwpmk.h" 2 | 3 | FWPM_SERVICE_STATE NTAPI FwpmBfeStateGet0() 4 | { 5 | return FWPM_SERVICE_STOPPED; 6 | } 7 | -------------------------------------------------------------------------------- /src/driver/wdm/um_ntddk.c: -------------------------------------------------------------------------------- 1 | #include "um_ntddk.h" 2 | 3 | NTSTATUS IoQueryFullDriverPath(PDRIVER_OBJECT driverObject, PUNICODE_STRING fullPath) 4 | { 5 | UNUSED(driverObject); 6 | UNUSED(fullPath); 7 | return STATUS_SUCCESS; 8 | } 9 | 10 | NTSTATUS PsSetCreateProcessNotifyRoutineEx( 11 | PCREATE_PROCESS_NOTIFY_ROUTINE_EX notifyRoutine, BOOLEAN remove) 12 | { 13 | UNUSED(notifyRoutine); 14 | UNUSED(remove); 15 | return STATUS_SUCCESS; 16 | } 17 | 18 | NTSTATUS KeExpandKernelStackAndCallout(PEXPAND_STACK_CALLOUT callout, PVOID parameter, SIZE_T size) 19 | { 20 | UNUSED(callout); 21 | UNUSED(parameter); 22 | UNUSED(size); 23 | return STATUS_SUCCESS; 24 | } 25 | 26 | LONG KeSetBasePriorityThread(PVOID threadObject, LONG increment) 27 | { 28 | UNUSED(threadObject); 29 | UNUSED(increment); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /src/driver_payload/FortFirewallDriverPayload.pro: -------------------------------------------------------------------------------- 1 | include(../global.pri) 2 | 3 | include(../ui/FortFirewallUI.pri) 4 | 5 | CONFIG += console 6 | CONFIG -= debug_and_release 7 | 8 | TARGET = DriverPayload 9 | TEMPLATE = app 10 | 11 | SOURCES += \ 12 | driverpayload.cpp \ 13 | main.cpp 14 | 15 | HEADERS += \ 16 | driverpayload.h 17 | 18 | # Windows 19 | LIBS *= -limagehlp 20 | -------------------------------------------------------------------------------- /src/driver_payload/driverpayload.h: -------------------------------------------------------------------------------- 1 | #ifndef DRIVERPAYLOAD_H 2 | #define DRIVERPAYLOAD_H 3 | 4 | #include 5 | 6 | class DriverPayload 7 | { 8 | public: 9 | explicit DriverPayload() = default; 10 | 11 | void processArguments(const QStringList &args); 12 | 13 | bool createOutputFile(); 14 | 15 | private: 16 | QString m_inputFilePath; 17 | QString m_outputFilePath; 18 | QString m_payloadFilePath; 19 | QString m_secretFilePath; 20 | }; 21 | 22 | #endif // DRIVERPAYLOAD_H 23 | -------------------------------------------------------------------------------- /src/driver_payload/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "driverpayload.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | QCoreApplication app(argc, argv); 8 | Q_UNUSED(app); 9 | 10 | DriverPayload payload; 11 | payload.processArguments(QCoreApplication::arguments()); 12 | 13 | if (!payload.createOutputFile()) 14 | return 2; 15 | 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /src/global.pri: -------------------------------------------------------------------------------- 1 | 2 | MOC_DIR = .moc 3 | OBJECTS_DIR = .obj 4 | RCC_DIR = .rcc 5 | UI_DIR = .ui 6 | 7 | # Version 8 | include($$PWD/version/FortFirewallVersion.pri) 9 | -------------------------------------------------------------------------------- /src/scripts/breakpad/dump-windbg.bat: -------------------------------------------------------------------------------- 1 | 2 | @set WINDBG_PATH="C:\Program Files (x86)\Windows Kits\10\Debuggers\x86" 3 | 4 | @set PDB_PATH=%~dp0 5 | @set DUMP_FILE=%1 6 | 7 | %WINDBG_PATH%\windbg.exe -y "%PDB_PATH%" -i "%PDB_PATH%" -z "%DUMP_FILE%" -sflags 0x40 -c ".ecxr;k" 8 | -------------------------------------------------------------------------------- /src/scripts/driver/bin2array.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | @set BIN_PATH=%1 4 | @set HEADER_PATH=%2 5 | 6 | python -c "import sys;a=sys.argv;open(a[2],'wb').write((','.join([hex(b) for b in open(a[1],'rb').read()])).encode('utf-8'))" %BIN_PATH% %HEADER_PATH% 7 | -------------------------------------------------------------------------------- /src/scripts/i18n/release_ts.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @rem set QT_HOME=D:\Qt\Qt6.6.1\6.6.1\msvc2019_64 3 | 4 | cd ..\..\ui 5 | 6 | for %%L in (ar,de,es,fr,it,ja,ko,pl,pt_BR,ru,sl,zh_CN) do ( 7 | %QT_HOME%\bin\lrelease -removeidentical i18n\i18n_%%L.ts i18n\qt\qtbase_%%L.ts -qm i18n\i18n_%%L.qm 8 | ) 9 | -------------------------------------------------------------------------------- /src/scripts/i18n/update_ts.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | @rem set QT_HOME=D:\Qt\Qt6.6.1\6.6.1\msvc2019_64 3 | 4 | cd ..\..\ui 5 | 6 | for /r %%f in (i18n\*.ts) do %QT_HOME%\bin\lupdate -no-obsolete -locations none .\ -ts %%f 7 | -------------------------------------------------------------------------------- /src/tests/Common/Common.pri: -------------------------------------------------------------------------------- 1 | include($$PWD/../../global.pri) 2 | 3 | include($$PWD/../../ui/FortFirewallUI.pri) 4 | 5 | QT += testlib 6 | 7 | CONFIG += console 8 | CONFIG -= app_bundle debug_and_release 9 | 10 | TEMPLATE = app 11 | 12 | # GoogleTest 13 | include($$PWD/GoogleTest-include.pri) 14 | 15 | # Link to a static library 16 | LIBS *= -L$$builddir/tests/Common 17 | LIBS *= -lCommonLib 18 | PRE_TARGETDEPS *= $$builddir/tests/Common/CommonLib.lib 19 | -------------------------------------------------------------------------------- /src/tests/Common/Common.pro: -------------------------------------------------------------------------------- 1 | include(../../global.pri) 2 | 3 | include(../../ui/FortFirewallUI.pri) 4 | 5 | CONFIG += console 6 | CONFIG -= app_bundle debug_and_release 7 | 8 | TARGET = CommonLib 9 | CONFIG += staticlib 10 | TEMPLATE = lib 11 | 12 | # Mocks 13 | include(mocks/Mocks.pri) 14 | 15 | # GoogleTest 16 | include(GoogleTest.pri) 17 | -------------------------------------------------------------------------------- /src/tests/Common/GoogleTest-include.pri: -------------------------------------------------------------------------------- 1 | isEmpty(GOOGLETEST_DIR): GOOGLETEST_DIR=$$(GOOGLETEST_DIR) 2 | 3 | !exists($$GOOGLETEST_DIR):message("No GoogleTest source found: set GOOGLETEST_DIR env var.") 4 | 5 | GTEST_PATH = $$GOOGLETEST_DIR/googletest 6 | GMOCK_PATH = $$GOOGLETEST_DIR/googlemock 7 | 8 | requires(exists($$GTEST_PATH):exists($$GMOCK_PATH)) 9 | 10 | DEFINES += GTEST_LANG_CXX11 11 | 12 | INCLUDEPATH *= \ 13 | $$GTEST_PATH \ 14 | $$GTEST_PATH/include \ 15 | $$GMOCK_PATH \ 16 | $$GMOCK_PATH/include 17 | 18 | INCLUDEPATH *= $$PWD 19 | -------------------------------------------------------------------------------- /src/tests/Common/GoogleTest.pri: -------------------------------------------------------------------------------- 1 | include($$PWD/GoogleTest-include.pri) 2 | 3 | SOURCES += \ 4 | $$GTEST_PATH/src/gtest-all.cc \ 5 | $$GMOCK_PATH/src/gmock-all.cc 6 | 7 | HEADERS += \ 8 | $$PWD/googletest.h 9 | -------------------------------------------------------------------------------- /src/tests/Common/googletest.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | using namespace testing; 9 | 10 | QT_BEGIN_NAMESPACE 11 | inline void PrintTo(const QString &qString, ::std::ostream *os) 12 | { 13 | *os << qPrintable(qString); 14 | } 15 | QT_END_NAMESPACE 16 | -------------------------------------------------------------------------------- /src/tests/Common/mocks/Mocks.pri: -------------------------------------------------------------------------------- 1 | 2 | SOURCES += \ 3 | $$PWD/mockquotamanager.cpp \ 4 | $$PWD/mocksqlitestmt.cpp 5 | 6 | HEADERS += \ 7 | $$PWD/mockquotamanager.h \ 8 | $$PWD/mocksqlitestmt.h 9 | -------------------------------------------------------------------------------- /src/tests/Common/mocks/mockquotamanager.cpp: -------------------------------------------------------------------------------- 1 | #include "mockquotamanager.h" 2 | 3 | MockQuotaManager::MockQuotaManager(QObject *parent) : QuotaManager(parent) { } 4 | -------------------------------------------------------------------------------- /src/tests/Common/mocks/mockquotamanager.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCKQUOTAMANAGER_H 2 | #define MOCKQUOTAMANAGER_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class MockQuotaManager : public QuotaManager 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit MockQuotaManager(QObject *parent = nullptr); 14 | 15 | protected: 16 | MOCK_METHOD(qint32, quotaDayAlerted, (), (const)); 17 | MOCK_METHOD(void, setQuotaDayAlerted, (qint32 v)); 18 | 19 | MOCK_METHOD(qint32, quotaMonthAlerted, (), (const)); 20 | MOCK_METHOD(void, setQuotaMonthAlerted, (qint32 v)); 21 | }; 22 | 23 | #endif // MOCKQUOTAMANAGER_H 24 | -------------------------------------------------------------------------------- /src/tests/Common/mocks/mocksqlitestmt.cpp: -------------------------------------------------------------------------------- 1 | #include "mocksqlitestmt.h" 2 | 3 | MockSqliteStmt::MockSqliteStmt() : SqliteStmt() { } 4 | -------------------------------------------------------------------------------- /src/tests/Common/mocks/mocksqlitestmt.h: -------------------------------------------------------------------------------- 1 | #ifndef MOCKSQLITESTMT_H 2 | #define MOCKSQLITESTMT_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class MockSqliteStmt : public SqliteStmt 9 | { 10 | public: 11 | explicit MockSqliteStmt(); 12 | 13 | MOCK_METHOD(SqliteStmt::StepResult, step, ()); 14 | 15 | MOCK_METHOD(qint32, columnInt, (int column), (const)); 16 | }; 17 | 18 | #endif // MOCKSQLITESTMT_H 19 | -------------------------------------------------------------------------------- /src/tests/FortFirewallTests.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS = \ 4 | Common \ 5 | LogBufferTest \ 6 | LogReaderTest \ 7 | StatTest \ 8 | UtilTest 9 | 10 | LogBufferTest.depends = Common 11 | LogReaderTest.depends = Common 12 | StatTest.depends = Common 13 | UtilTest.depends = Common 14 | -------------------------------------------------------------------------------- /src/tests/LogBufferTest/LogBufferTest.pro: -------------------------------------------------------------------------------- 1 | include(../Common/Common.pri) 2 | 3 | HEADERS += \ 4 | tst_logbuffer.h \ 5 | 6 | SOURCES += \ 7 | tst_main.cpp 8 | -------------------------------------------------------------------------------- /src/tests/LogBufferTest/tst_main.cpp: -------------------------------------------------------------------------------- 1 | #include "tst_logbuffer.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | ::testing::InitGoogleTest(&argc, argv); 11 | ::testing::InitGoogleMock(&argc, argv); 12 | 13 | QCoreApplication app(argc, argv); 14 | 15 | return RUN_ALL_TESTS(); 16 | } 17 | -------------------------------------------------------------------------------- /src/tests/LogReaderTest/LogReaderTest.pro: -------------------------------------------------------------------------------- 1 | include(../Common/Common.pri) 2 | 3 | HEADERS += \ 4 | tst_logreader.h \ 5 | 6 | SOURCES += \ 7 | tst_main.cpp 8 | -------------------------------------------------------------------------------- /src/tests/LogReaderTest/tst_main.cpp: -------------------------------------------------------------------------------- 1 | #include "tst_logreader.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | ::testing::InitGoogleTest(&argc, argv); 11 | ::testing::InitGoogleMock(&argc, argv); 12 | 13 | QCoreApplication app(argc, argv); 14 | 15 | return RUN_ALL_TESTS(); 16 | } 17 | -------------------------------------------------------------------------------- /src/tests/StatTest/StatTest.pro: -------------------------------------------------------------------------------- 1 | include(../Common/Common.pri) 2 | 3 | HEADERS += \ 4 | tst_stat.h 5 | 6 | SOURCES += \ 7 | tst_main.cpp 8 | 9 | # Test Data 10 | RESOURCES += data.qrc 11 | -------------------------------------------------------------------------------- /src/tests/StatTest/data.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | data/migrations/1.sql 4 | data/migrations/2.sql 5 | data/migrations/3.sql 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/tests/StatTest/data/migrations/1.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 1; 2 | 3 | CREATE TABLE t1( 4 | col1 INTEGER 5 | ); 6 | -------------------------------------------------------------------------------- /src/tests/StatTest/data/migrations/2.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 2; 2 | 3 | CREATE TABLE t2( 4 | col1 INTEGER 5 | ); 6 | -------------------------------------------------------------------------------- /src/tests/StatTest/data/migrations/3.sql: -------------------------------------------------------------------------------- 1 | PRAGMA user_version = 3; 2 | 3 | CREATE TABLE? t3( 4 | col1 INTEGER 5 | ); 6 | -------------------------------------------------------------------------------- /src/tests/StatTest/tst_main.cpp: -------------------------------------------------------------------------------- 1 | #include "tst_stat.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | ::testing::InitGoogleTest(&argc, argv); 13 | ::testing::InitGoogleMock(&argc, argv); 14 | 15 | QCoreApplication app(argc, argv); 16 | 17 | FortManager::setupResources(); 18 | 19 | return RUN_ALL_TESTS(); 20 | } 21 | -------------------------------------------------------------------------------- /src/tests/UtilTest/UtilTest.pro: -------------------------------------------------------------------------------- 1 | include(../Common/Common.pri) 2 | 3 | HEADERS += \ 4 | tst_bitutil.h \ 5 | tst_confutil.h \ 6 | tst_dateutil.h \ 7 | tst_fileutil.h \ 8 | tst_ioccontainer.h \ 9 | tst_netutil.h \ 10 | tst_ruletextparser.h \ 11 | tst_stringutil.h 12 | 13 | SOURCES += \ 14 | tst_main.cpp 15 | 16 | # Test Data 17 | RESOURCES += data.qrc 18 | -------------------------------------------------------------------------------- /src/tests/UtilTest/data.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | data/tasix-mrlg.html 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/tests/UtilTest/tst_bitutil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | class BitUtilTest : public Test 10 | { 11 | // Test interface 12 | protected: 13 | void SetUp(); 14 | void TearDown(); 15 | }; 16 | 17 | void BitUtilTest::SetUp() { } 18 | 19 | void BitUtilTest::TearDown() { } 20 | 21 | TEST_F(BitUtilTest, bitCount) 22 | { 23 | ASSERT_EQ(BitUtil::bitCount(0x03), 2); 24 | ASSERT_EQ(BitUtil::bitCount(0x8F), 5); 25 | } 26 | 27 | TEST_F(BitUtilTest, firstZeroBit) 28 | { 29 | ASSERT_EQ(BitUtil::firstZeroBit(0x03), 2); 30 | ASSERT_EQ(BitUtil::firstZeroBit(0x8F), 4); 31 | } 32 | -------------------------------------------------------------------------------- /src/tests/UtilTest/tst_main.cpp: -------------------------------------------------------------------------------- 1 | #include "tst_bitutil.h" 2 | #include "tst_confutil.h" 3 | #include "tst_dateutil.h" 4 | #include "tst_fileutil.h" 5 | #include "tst_ioccontainer.h" 6 | #include "tst_netutil.h" 7 | #include "tst_ruletextparser.h" 8 | #include "tst_stringutil.h" 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | ::testing::InitGoogleTest(&argc, argv); 18 | ::testing::InitGoogleMock(&argc, argv); 19 | 20 | QCoreApplication app(argc, argv); 21 | 22 | return RUN_ALL_TESTS(); 23 | } 24 | -------------------------------------------------------------------------------- /src/tests/UtilTest/tst_stringutil.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | 9 | class StringUtilTest : public Test 10 | { 11 | // Test interface 12 | protected: 13 | void SetUp(); 14 | void TearDown(); 15 | }; 16 | 17 | void StringUtilTest::SetUp() { } 18 | 19 | void StringUtilTest::TearDown() { } 20 | 21 | TEST_F(StringUtilTest, multiString) 22 | { 23 | const QStringList list = { "1", "22", "333" }; 24 | 25 | QByteArray buffer; 26 | ASSERT_TRUE(StringUtil::buildMultiString(buffer, list)); 27 | ASSERT_EQ(StringUtil::parseMultiString(buffer), list); 28 | } 29 | 30 | TEST_F(StringUtilTest, multiStringBad) 31 | { 32 | QByteArray buffer; 33 | ASSERT_FALSE(StringUtil::buildMultiString(buffer, { "1", "", "2" })); 34 | } 35 | -------------------------------------------------------------------------------- /src/ui/3rdparty/3rdparty-include.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH *= $$PWD 2 | -------------------------------------------------------------------------------- /src/ui/3rdparty/3rdparty.pri: -------------------------------------------------------------------------------- 1 | include($$PWD/3rdparty-include.pri) 2 | 3 | include($$PWD/qcustomplot/qcustomplot.pri) 4 | 5 | include($$PWD/sqlite/sqlite.pri) 6 | -------------------------------------------------------------------------------- /src/ui/3rdparty/qcustomplot/qcustomplot.pri: -------------------------------------------------------------------------------- 1 | 2 | DEFINES += \ 3 | QT_NO_PRINTER 4 | 5 | QCUSTOMPLOT_DIR = $$PWD/../../../3rdparty/qcustomplot 6 | INCLUDEPATH += $$QCUSTOMPLOT_DIR 7 | 8 | SOURCES += \ 9 | $$QCUSTOMPLOT_DIR/qcustomplot.cpp 10 | 11 | HEADERS += \ 12 | $$QCUSTOMPLOT_DIR/qcustomplot.h 13 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/dbutil.cpp: -------------------------------------------------------------------------------- 1 | #include "dbutil.h" 2 | 3 | #include "sqlitestmt.h" 4 | 5 | void DbUtil::doList(const SqliteStmtList &stmtList) 6 | { 7 | for (SqliteStmt *stmt : stmtList) { 8 | const auto stepRes = stmt->step(); 9 | Q_UNUSED(stepRes); 10 | 11 | stmt->reset(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/dbutil.h: -------------------------------------------------------------------------------- 1 | #ifndef DBUTIL_H 2 | #define DBUTIL_H 3 | 4 | #include 5 | 6 | #include "sqlite_types.h" 7 | 8 | class DbUtil 9 | { 10 | public: 11 | static void doList(const SqliteStmtList &stmtList); 12 | }; 13 | 14 | #endif // DBUTIL_H 15 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/dbvar.cpp: -------------------------------------------------------------------------------- 1 | #include "dbvar.h" 2 | 3 | #include "sqlitedb.h" 4 | #include "sqlitestmt.h" 5 | 6 | QVariant DbVar::nullable(const QString &v) 7 | { 8 | return nullable(v, v.isEmpty()); 9 | } 10 | 11 | QVariant DbVar::nullable(const QDateTime &v) 12 | { 13 | return nullable(v, v.isNull()); 14 | } 15 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/dbvar.h: -------------------------------------------------------------------------------- 1 | #ifndef DBVAR_H 2 | #define DBVAR_H 3 | 4 | #include 5 | #include 6 | 7 | class DbVar 8 | { 9 | public: 10 | template 11 | inline static QVariant nullable(const T &v, bool isNull) 12 | { 13 | return isNull ? QVariant() : QVariant(v); 14 | } 15 | inline static QVariant nullable(bool v) { return nullable(v, !v); } 16 | inline static QVariant nullable(int v) { return nullable(v, v == 0); } 17 | inline static QVariant nullable(quint32 v) { return nullable(v, v == 0); } 18 | inline static QVariant nullable(qint64 v) { return nullable(v, v == 0); } 19 | static QVariant nullable(const QString &v); 20 | static QVariant nullable(const QDateTime &v); 21 | }; 22 | 23 | #endif // DBVAR_H 24 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/sqlite.pri: -------------------------------------------------------------------------------- 1 | CONFIG(release, debug|release) { 2 | DEFINES *= NDEBUG 3 | } else { 4 | DEFINES += SQLITE_DEBUG SQLITE_ENABLE_API_ARMOR 5 | } 6 | 7 | DEFINES += _HAVE_SQLITE_CONFIG_H 8 | 9 | SQLITE_DIR = $$PWD/../../../3rdparty/sqlite 10 | 11 | INCLUDEPATH += $$SQLITE_DIR 12 | 13 | SOURCES += \ 14 | $$SQLITE_DIR/sqlite3.c \ 15 | $$PWD/dbquery.cpp \ 16 | $$PWD/dbutil.cpp \ 17 | $$PWD/dbvar.cpp \ 18 | $$PWD/sqlitedb.cpp \ 19 | $$PWD/sqlitedbext.cpp \ 20 | $$PWD/sqlitestmt.cpp \ 21 | $$PWD/sqliteutilbase.cpp 22 | 23 | HEADERS += \ 24 | $$SQLITE_DIR/sqlite.h \ 25 | $$SQLITE_DIR/sqlite3.h \ 26 | $$SQLITE_DIR/sqlite_cfg.h \ 27 | $$PWD/dbquery.h \ 28 | $$PWD/dbutil.h \ 29 | $$PWD/dbvar.h \ 30 | $$PWD/sqlite_types.h \ 31 | $$PWD/sqlitedb.h \ 32 | $$PWD/sqlitedbext.h \ 33 | $$PWD/sqlitestmt.h \ 34 | $$PWD/sqliteutilbase.h 35 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/sqlite_types.h: -------------------------------------------------------------------------------- 1 | #ifndef SQLITE_TYPES_H 2 | #define SQLITE_TYPES_H 3 | 4 | #include 5 | #include 6 | 7 | class SqliteDb; 8 | class SqliteStmt; 9 | 10 | using SqliteDbPtr = QSharedPointer; 11 | 12 | using SqliteStmtList = QList; 13 | 14 | #endif // SQLITE_TYPES_H 15 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/sqlitedbext.h: -------------------------------------------------------------------------------- 1 | #ifndef SQLITEDBEXT_H 2 | #define SQLITEDBEXT_H 3 | 4 | #include 5 | 6 | class SqliteDb; 7 | 8 | class SqliteDbExt 9 | { 10 | public: 11 | static void registerExtensions(SqliteDb *sqliteDb); 12 | }; 13 | 14 | #endif // SQLITEDBEXT_H 15 | -------------------------------------------------------------------------------- /src/ui/3rdparty/sqlite/sqliteutilbase.h: -------------------------------------------------------------------------------- 1 | #ifndef SQLITEUTILBASE_H 2 | #define SQLITEUTILBASE_H 3 | 4 | #include 5 | 6 | class SqliteUtilBase 7 | { 8 | public: 9 | virtual SqliteDb *sqliteDb() const = 0; 10 | 11 | void removeDbFilesToCleanOpen() const; 12 | 13 | bool backupDbFile(const QString &path) const; 14 | 15 | protected: 16 | bool beginWriteTransaction(); 17 | void commitTransaction(); 18 | void endTransaction(bool &ok); 19 | }; 20 | 21 | #endif // SQLITEUTILBASE_H 22 | -------------------------------------------------------------------------------- /src/ui/FortFirewallUI-include.pri: -------------------------------------------------------------------------------- 1 | 2 | QT += gui network widgets 3 | 4 | CONFIG += c++2a 5 | 6 | # Driver integration 7 | include($$PWD/../driver/Driver-include.pri) 8 | 9 | # 3rd party integrations 10 | include($$PWD/3rdparty/3rdparty-include.pri) 11 | 12 | INCLUDEPATH *= $$PWD 13 | -------------------------------------------------------------------------------- /src/ui/FortFirewallUI.pri: -------------------------------------------------------------------------------- 1 | 2 | include($$PWD/FortFirewallUI-include.pri) 3 | 4 | # Link to a static library 5 | LIBS *= -L$$builddir/ui 6 | LIBS *= -lFortFirewallUILib 7 | PRE_TARGETDEPS *= $$builddir/ui/FortFirewallUILib.lib 8 | 9 | # Windows 10 | LIBS *= -lntdll -lwinmm 11 | -------------------------------------------------------------------------------- /src/ui/README.portable: -------------------------------------------------------------------------------- 1 | README.portable 2 | =============== 3 | 4 | This version of Fort Firewall is portable, i.e. does not need to 5 | be installed. It will run from any directory you place it in, even 6 | from a USB thumbdrive. 7 | 8 | Please DO NOT REMOVE the "README.portable" file, as this will reverse 9 | the portability of the application! 10 | 11 | Fort Firewall needs administrator privileges to install driver. 12 | 13 | How to UNINSTALL a portable installation: 14 | 15 | - Run the Fort Firewall as Administrator. 16 | - Open the 'My Fort' window and click on Portable: Uninstall button. 17 | - Close the running Fort Firewall. 18 | - Delete the Fort Firewall application's folder. 19 | -------------------------------------------------------------------------------- /src/ui/appinfo/appbasejob.cpp: -------------------------------------------------------------------------------- 1 | #include "appbasejob.h" 2 | 3 | AppBaseJob::AppBaseJob(const QString &appPath) : WorkerJob(appPath) { } 4 | -------------------------------------------------------------------------------- /src/ui/appinfo/appbasejob.h: -------------------------------------------------------------------------------- 1 | #ifndef APPBASEJOB_H 2 | #define APPBASEJOB_H 3 | 4 | #include 5 | 6 | class AppBaseJob : public WorkerJob 7 | { 8 | public: 9 | explicit AppBaseJob(const QString &appPath); 10 | 11 | const QString &appPath() const { return text(); } 12 | }; 13 | 14 | #endif // APPBASEJOB_H 15 | -------------------------------------------------------------------------------- /src/ui/appinfo/appiconjob.cpp: -------------------------------------------------------------------------------- 1 | #include "appiconjob.h" 2 | 3 | #include 4 | 5 | #include "appinfomanager.h" 6 | 7 | AppIconJob::AppIconJob(const QString &appPath, qint64 iconId) : 8 | AppBaseJob(appPath), m_iconId(iconId) 9 | { 10 | } 11 | 12 | void AppIconJob::doJob(WorkerObject &worker) 13 | { 14 | loadAppIcon(static_cast(worker.manager())); 15 | } 16 | 17 | void AppIconJob::reportResult(WorkerObject &worker) 18 | { 19 | emitFinished(static_cast(worker.manager())); 20 | } 21 | 22 | void AppIconJob::loadAppIcon(AppInfoManager *manager) 23 | { 24 | // Try to load from DB 25 | m_image = manager->loadIconFromDb(iconId()); 26 | } 27 | 28 | void AppIconJob::emitFinished(AppInfoManager *manager) 29 | { 30 | emit manager->lookupIconFinished(appPath(), m_image); 31 | } 32 | -------------------------------------------------------------------------------- /src/ui/appinfo/appiconjob.h: -------------------------------------------------------------------------------- 1 | #ifndef APPICONJOB_H 2 | #define APPICONJOB_H 3 | 4 | #include 5 | 6 | #include "appbasejob.h" 7 | 8 | class AppInfoManager; 9 | 10 | class AppIconJob : public AppBaseJob 11 | { 12 | public: 13 | explicit AppIconJob(const QString &appPath, qint64 iconId); 14 | 15 | qint64 iconId() const { return m_iconId; } 16 | 17 | void doJob(WorkerObject &worker) override; 18 | void reportResult(WorkerObject &worker) override; 19 | 20 | private: 21 | void loadAppIcon(AppInfoManager *manager); 22 | void emitFinished(AppInfoManager *manager); 23 | 24 | private: 25 | const qint64 m_iconId = 0; 26 | 27 | QImage m_image; 28 | }; 29 | 30 | #endif // APPICONJOB_H 31 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "appinfo.h" 2 | 3 | #include "appinfoutil.h" 4 | 5 | QString AppInfo::filePath(const QString &appPath) const 6 | { 7 | return !altPath.isEmpty() ? altPath : appPath; 8 | } 9 | 10 | bool AppInfo::checkFileModified(const QString &appPath) 11 | { 12 | const auto appFileModTime = AppInfoUtil::fileModTime(filePath(appPath), fileExists); 13 | 14 | return appFileModTime.isValid() && appFileModTime != fileModTime; 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFO_H 2 | #define APPINFO_H 3 | 4 | #include 5 | #include 6 | 7 | class AppInfo 8 | { 9 | public: 10 | QString filePath(const QString &appPath) const; 11 | bool checkFileModified(const QString &appPath); 12 | 13 | bool isValid() const { return iconId != 0; } 14 | 15 | public: 16 | bool fileExists = true; // transient 17 | 18 | qint64 iconId = 0; 19 | 20 | QDateTime fileModTime; 21 | 22 | QString altPath; 23 | QString fileDescription; 24 | QString companyName; 25 | QString productName; 26 | QString productVersion; 27 | }; 28 | 29 | Q_DECLARE_METATYPE(AppInfo) 30 | 31 | #endif // APPINFO_H 32 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfo_migrations.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | migrations/1.sql 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfojob.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFOJOB_H 2 | #define APPINFOJOB_H 3 | 4 | #include "appbasejob.h" 5 | #include "appinfo.h" 6 | 7 | class AppInfoManager; 8 | 9 | class AppInfoJob : public AppBaseJob 10 | { 11 | public: 12 | explicit AppInfoJob(const QString &appPath); 13 | 14 | void doJob(WorkerObject &worker) override; 15 | void reportResult(WorkerObject &worker) override; 16 | 17 | private: 18 | void loadAppInfo(AppInfoManager *manager); 19 | void emitFinished(AppInfoManager *manager); 20 | 21 | private: 22 | AppInfo m_appInfo; 23 | }; 24 | 25 | #endif // APPINFOJOB_H 26 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfoutil.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFOUTIL_H 2 | #define APPINFOUTIL_H 3 | 4 | #include 5 | #include 6 | 7 | class AppInfo; 8 | 9 | namespace AppInfoUtil { 10 | 11 | bool getInfo(const QString &appPath, AppInfo &appInfo); 12 | QImage getIcon(const QString &appPath); 13 | 14 | void initThread(); 15 | void doneThread(); 16 | 17 | bool fileExists(const QString &appPath); 18 | 19 | QDateTime fileModTime(const QString &appPath, bool &fileExists); 20 | 21 | bool openFolder(const QString &appPath); 22 | 23 | } 24 | 25 | #endif // APPINFOUTIL_H 26 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfoworker.cpp: -------------------------------------------------------------------------------- 1 | #include "appinfoworker.h" 2 | 3 | #include "appinfomanager.h" 4 | #include "appinfoutil.h" 5 | 6 | AppInfoWorker::AppInfoWorker(AppInfoManager *manager) : WorkerObject(manager) { } 7 | 8 | void AppInfoWorker::run() 9 | { 10 | AppInfoUtil::initThread(); 11 | 12 | WorkerObject::run(); 13 | 14 | AppInfoUtil::doneThread(); 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/appinfo/appinfoworker.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFOWORKER_H 2 | #define APPINFOWORKER_H 3 | 4 | #include 5 | 6 | class AppInfoManager; 7 | 8 | class AppInfoWorker : public WorkerObject 9 | { 10 | public: 11 | explicit AppInfoWorker(AppInfoManager *manager); 12 | 13 | QThread::Priority priority() const override { return QThread::LowPriority; } 14 | 15 | QString workerName() const override { return "AppInfoWorker"; } 16 | 17 | void run() override; 18 | }; 19 | 20 | #endif // APPINFOWORKER_H 21 | -------------------------------------------------------------------------------- /src/ui/appinfo/migrations/1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE app( 2 | app_id INTEGER PRIMARY KEY, 3 | path TEXT NOT NULL, 4 | alt_path TEXT, 5 | file_descr TEXT, 6 | company_name TEXT, 7 | product_name TEXT, 8 | product_ver TEXT, 9 | file_mod_time INTEGER, 10 | icon_id INTEGER 11 | ); 12 | 13 | CREATE UNIQUE INDEX app_path_uk ON app(path); 14 | 15 | CREATE TABLE icon( 16 | icon_id INTEGER PRIMARY KEY, 17 | ref_count INTEGER NOT NULL, 18 | hash INTEGER NOT NULL, 19 | image BLOB NOT NULL 20 | ); 21 | 22 | CREATE INDEX icon_hash_idx ON icon(hash); 23 | -------------------------------------------------------------------------------- /src/ui/conf/conf_migrations.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | migrations/1.sql 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ui/conf/conf_zone.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | zone/sources.json 4 | zone/types.json 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/ui/conf/confmanagerbase.cpp: -------------------------------------------------------------------------------- 1 | #include "confmanagerbase.h" 2 | 3 | #include "confmanager.h" 4 | 5 | ConfManagerBase::ConfManagerBase(QObject *parent) : QObject(parent) { } 6 | 7 | SqliteDb *ConfManagerBase::sqliteDb() const 8 | { 9 | return confManager()->sqliteDb(); 10 | } 11 | -------------------------------------------------------------------------------- /src/ui/conf/confmanagerbase.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFMANAGERBASE_H 2 | #define CONFMANAGERBASE_H 3 | 4 | #include 5 | 6 | class ConfManagerBase : public QObject, public DbManagerBase 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit ConfManagerBase(QObject *parent = nullptr); 12 | 13 | SqliteDb *sqliteDb() const override; 14 | }; 15 | 16 | #endif // CONFMANAGERBASE_H 17 | -------------------------------------------------------------------------------- /src/ui/conf/inioptions.cpp: -------------------------------------------------------------------------------- 1 | #include "inioptions.h" 2 | 3 | IniOptions::IniOptions(Settings *settings) : MapSettings(settings) { } 4 | -------------------------------------------------------------------------------- /src/ui/conf/zone.cpp: -------------------------------------------------------------------------------- 1 | #include "zone.h" 2 | 3 | bool Zone::isNameEqual(const Zone &o) const 4 | { 5 | return zoneName == o.zoneName; 6 | } 7 | 8 | bool Zone::isOptionsEqual(const Zone &o) const 9 | { 10 | return enabled == o.enabled && customUrl == o.customUrl && sourceCode == o.sourceCode 11 | && url == o.url && formData == o.formData && textInline == o.textInline; 12 | } 13 | -------------------------------------------------------------------------------- /src/ui/conf/zone.h: -------------------------------------------------------------------------------- 1 | #ifndef ZONE_H 2 | #define ZONE_H 3 | 4 | #include 5 | #include 6 | 7 | class Zone 8 | { 9 | public: 10 | bool isNameEqual(const Zone &o) const; 11 | bool isOptionsEqual(const Zone &o) const; 12 | 13 | public: 14 | bool enabled : 1 = true; 15 | bool customUrl : 1 = false; 16 | 17 | int zoneId = 0; 18 | 19 | int addressCount = 0; 20 | 21 | QString zoneName; 22 | QString sourceCode; 23 | 24 | QString url; 25 | QString formData; 26 | 27 | QString textInline; 28 | 29 | QString textChecksum; 30 | QString binChecksum; 31 | 32 | QDateTime sourceModTime; 33 | QDateTime lastRun; 34 | QDateTime lastSuccess; 35 | }; 36 | 37 | #endif // ZONE_H 38 | -------------------------------------------------------------------------------- /src/ui/conf/zone/types.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": "gen", 4 | "title": "Generic", 5 | "description": "Generic list", 6 | "sort": true, 7 | "pattern": "^\\s*(\\[?[A-Fa-f\\d:.]+\\]?\\s*[\\/-]?\\s*\\S*)", 8 | "emptyNetMask": 32 9 | }, 10 | { 11 | "code": "bgp", 12 | "title": "BGP", 13 | "description": "BGP table", 14 | "sort": true, 15 | "pattern": "^\\D{0,9}([\\d./-]{7,})", 16 | "emptyNetMask": 24 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandbackup.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDBACKUP_H 2 | #define CONTROLCOMMANDBACKUP_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandBackup : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDBACKUP_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandbase.cpp: -------------------------------------------------------------------------------- 1 | #include "controlcommandbase.h" 2 | 3 | #include 4 | #include 5 | 6 | bool ControlCommandBase::checkCommandActionPassword( 7 | ProcessCommandResult &r, quint32 action, quint32 passwordNotRequiredActions) 8 | { 9 | if ((action & passwordNotRequiredActions) != 0) 10 | return true; 11 | 12 | if (!IoC()->checkPassword(/*temporary=*/true)) { 13 | r.errorMessage = "Password required"; 14 | return false; 15 | } 16 | 17 | return true; 18 | } 19 | 20 | void ControlCommandBase::uncheckCommandActionPassword() 21 | { 22 | IoC()->uncheckTemporaryPassword(); 23 | } 24 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandbase.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDBASE_H 2 | #define CONTROLCOMMANDBASE_H 3 | 4 | #include 5 | 6 | class ControlCommandBase 7 | { 8 | protected: 9 | static bool checkCommandActionPassword( 10 | ProcessCommandResult &r, quint32 action, quint32 passwordNotRequiredActions = 0); 11 | 12 | static void uncheckCommandActionPassword(); 13 | }; 14 | 15 | #endif // CONTROLCOMMANDBASE_H 16 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandblock.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDBLOCK_H 2 | #define CONTROLCOMMANDBLOCK_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandBlock : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDBLOCK_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandconf.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDCONF_H 2 | #define CONTROLCOMMANDCONF_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandConf : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDCONF_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandfilter.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDFILTER_H 2 | #define CONTROLCOMMANDFILTER_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandFilter : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDFILTER_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandfiltermode.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDFILTERMODE_H 2 | #define CONTROLCOMMANDFILTERMODE_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandFilterMode : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDFILTERMODE_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandgroup.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDGROUP_H 2 | #define CONTROLCOMMANDGROUP_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandGroup : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDGROUP_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandhome.cpp: -------------------------------------------------------------------------------- 1 | #include "controlcommandhome.h" 2 | 3 | #include 4 | #include 5 | 6 | bool ControlCommandHome::processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r) 7 | { 8 | const auto commandText = p.args.value(0).toString(); 9 | 10 | if (commandText == "show") { 11 | return IoC()->exposeHomeWindow(); 12 | } 13 | 14 | r.errorMessage = "Usage: home show"; 15 | return false; 16 | } 17 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandhome.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDHOME_H 2 | #define CONTROLCOMMANDHOME_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandHome : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDHOME_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDMANAGER_H 2 | #define CONTROLCOMMANDMANAGER_H 3 | 4 | #include 5 | 6 | class ControlCommandManager 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDMANAGER_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandprog.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDPROG_H 2 | #define CONTROLCOMMANDPROG_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandProg : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDPROG_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandrpc.cpp: -------------------------------------------------------------------------------- 1 | #include "controlcommandrpc.h" 2 | 3 | #include 4 | #include 5 | 6 | bool ControlCommandRpc::processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r) 7 | { 8 | return IoC()->processCommandRpc(p, r); 9 | } 10 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDRPC_H 2 | #define CONTROLCOMMANDRPC_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandRpc : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDRPC_H 13 | -------------------------------------------------------------------------------- /src/ui/control/command/controlcommandzone.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROLCOMMANDZONE_H 2 | #define CONTROLCOMMANDZONE_H 3 | 4 | #include "controlcommandbase.h" 5 | 6 | class ControlCommandZone : public ControlCommandBase 7 | { 8 | public: 9 | static bool processCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 10 | }; 11 | 12 | #endif // CONTROLCOMMANDZONE_H 13 | -------------------------------------------------------------------------------- /src/ui/control/control.h: -------------------------------------------------------------------------------- 1 | #ifndef CONTROL_H 2 | #define CONTROL_H 3 | 4 | #include 5 | 6 | #include "control_types.h" 7 | 8 | namespace Control { 9 | 10 | RpcManager managerByCommand(Command cmd); 11 | 12 | bool commandRequiresValidation(Command cmd); 13 | 14 | QDebug operator<<(QDebug debug, Command cmd); 15 | QDebug operator<<(QDebug debug, RpcManager rpcManager); 16 | 17 | } 18 | 19 | #endif // CONTROL_H 20 | -------------------------------------------------------------------------------- /src/ui/form/controls/appinforow.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFOROW_H 2 | #define APPINFOROW_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QLabel) 7 | QT_FORWARD_DECLARE_CLASS(QLineEdit) 8 | QT_FORWARD_DECLARE_CLASS(QToolButton) 9 | 10 | class AppInfoCache; 11 | 12 | class AppInfoRow : public QWidget 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit AppInfoRow(QWidget *parent = nullptr); 18 | 19 | void retranslateUi(); 20 | 21 | void refreshAppInfoVersion(const QString &appPath, AppInfoCache *appInfoCache); 22 | 23 | private: 24 | void setupUi(); 25 | 26 | private: 27 | QString m_filePath; 28 | 29 | QToolButton *m_btAppCopyPath = nullptr; 30 | QToolButton *m_btAppOpenFolder = nullptr; 31 | QLineEdit *m_lineAppPath = nullptr; 32 | QLabel *m_labelAppProductName = nullptr; 33 | QLabel *m_labelAppCompanyName = nullptr; 34 | }; 35 | 36 | #endif // APPINFOROW_H 37 | -------------------------------------------------------------------------------- /src/ui/form/controls/checkspincombo.cpp: -------------------------------------------------------------------------------- 1 | #include "checkspincombo.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | CheckSpinCombo::CheckSpinCombo(QWidget *parent) : SpinCombo(parent) 8 | { 9 | setupUi(); 10 | } 11 | 12 | void CheckSpinCombo::setupUi() 13 | { 14 | m_checkBox = new QCheckBox(); 15 | 16 | boxLayout()->insertWidget(0, m_checkBox, 1); 17 | 18 | connect(comboBox(), QOverload::of(&QComboBox::activated), this, [&](int index) { 19 | if (disabledIndex() != -1) { 20 | checkBox()->setChecked(index != disabledIndex()); 21 | } 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /src/ui/form/controls/checkspincombo.h: -------------------------------------------------------------------------------- 1 | #ifndef CHECKSPINCOMBO_H 2 | #define CHECKSPINCOMBO_H 3 | 4 | #include "spincombo.h" 5 | 6 | QT_FORWARD_DECLARE_CLASS(QCheckBox) 7 | 8 | using ValuesList = QVector; 9 | 10 | class CheckSpinCombo : public SpinCombo 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit CheckSpinCombo(QWidget *parent = nullptr); 16 | 17 | int disabledIndex() const { return m_disabledIndex; } 18 | void setDisabledIndex(int index) { m_disabledIndex = index; } 19 | 20 | QCheckBox *checkBox() const { return m_checkBox; } 21 | 22 | private: 23 | void setupUi(); 24 | 25 | private: 26 | int m_disabledIndex = -1; 27 | 28 | QCheckBox *m_checkBox = nullptr; 29 | }; 30 | 31 | #endif // CHECKSPINCOMBO_H 32 | -------------------------------------------------------------------------------- /src/ui/form/controls/clickablemenu.cpp: -------------------------------------------------------------------------------- 1 | #include "clickablemenu.h" 2 | 3 | #include 4 | 5 | ClickableMenu::ClickableMenu(QWidget *parent) : QMenu(parent) 6 | { 7 | setAttribute(Qt::WA_WindowPropagation); // to inherit default font 8 | } 9 | 10 | void ClickableMenu::mousePressEvent(QMouseEvent *event) 11 | { 12 | m_pressed = true; 13 | 14 | QMenu::mousePressEvent(event); 15 | } 16 | 17 | void ClickableMenu::mouseReleaseEvent(QMouseEvent *event) 18 | { 19 | if (!m_pressed) 20 | return; 21 | 22 | m_pressed = false; 23 | 24 | QMenu::mouseReleaseEvent(event); 25 | 26 | if (isVisible()) { 27 | emit clicked(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/ui/form/controls/clickablemenu.h: -------------------------------------------------------------------------------- 1 | #ifndef CLICKABLEMENU_H 2 | #define CLICKABLEMENU_H 3 | 4 | #include 5 | 6 | class ClickableMenu : public QMenu 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit ClickableMenu(QWidget *parent = nullptr); 12 | 13 | signals: 14 | void clicked(); 15 | 16 | protected: 17 | void mousePressEvent(QMouseEvent *event) override; 18 | void mouseReleaseEvent(QMouseEvent *event) override; 19 | 20 | private: 21 | bool m_pressed : 1 = false; 22 | }; 23 | 24 | #endif // CLICKABLEMENU_H 25 | -------------------------------------------------------------------------------- /src/ui/form/controls/combobox.cpp: -------------------------------------------------------------------------------- 1 | #include "combobox.h" 2 | 3 | #include 4 | 5 | ComboBox::ComboBox(QWidget *parent) : QComboBox(parent) 6 | { 7 | setFocusPolicy(Qt::StrongFocus); 8 | } 9 | 10 | void ComboBox::wheelEvent(QWheelEvent *e) 11 | { 12 | if (!hasFocus()) { 13 | e->ignore(); 14 | return; 15 | } 16 | 17 | QComboBox::wheelEvent(e); 18 | } 19 | -------------------------------------------------------------------------------- /src/ui/form/controls/combobox.h: -------------------------------------------------------------------------------- 1 | #ifndef COMBOBOX_H 2 | #define COMBOBOX_H 3 | 4 | #include 5 | 6 | class ComboBox : public QComboBox 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit ComboBox(QWidget *parent = nullptr); 12 | 13 | protected: 14 | void wheelEvent(QWheelEvent *e) override; 15 | }; 16 | 17 | #endif // COMBOBOX_H 18 | -------------------------------------------------------------------------------- /src/ui/form/controls/doublespinbox.cpp: -------------------------------------------------------------------------------- 1 | #include "doublespinbox.h" 2 | 3 | #include 4 | 5 | DoubleSpinBox::DoubleSpinBox(QWidget *parent) : QDoubleSpinBox(parent) 6 | { 7 | setFocusPolicy(Qt::StrongFocus); 8 | } 9 | 10 | void DoubleSpinBox::wheelEvent(QWheelEvent *e) 11 | { 12 | if (!hasFocus()) { 13 | e->ignore(); 14 | return; 15 | } 16 | 17 | QDoubleSpinBox::wheelEvent(e); 18 | } 19 | -------------------------------------------------------------------------------- /src/ui/form/controls/doublespinbox.h: -------------------------------------------------------------------------------- 1 | #ifndef DOUBLESPINBOX_H 2 | #define DOUBLESPINBOX_H 3 | 4 | #include 5 | 6 | class DoubleSpinBox : public QDoubleSpinBox 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit DoubleSpinBox(QWidget *parent = nullptr); 12 | 13 | protected: 14 | void wheelEvent(QWheelEvent *e) override; 15 | }; 16 | 17 | #endif // DOUBLESPINBOX_H 18 | -------------------------------------------------------------------------------- /src/ui/form/controls/focusablemenu.h: -------------------------------------------------------------------------------- 1 | #ifndef FOCUSABLEMENU_H 2 | #define FOCUSABLEMENU_H 3 | 4 | #include 5 | 6 | class FocusableMenu : public QMenu 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit FocusableMenu(QWidget *parent = nullptr); 12 | 13 | protected: 14 | bool event(QEvent *e) override; 15 | void mousePressEvent(QMouseEvent *e) override; 16 | void mouseMoveEvent(QMouseEvent *e) override; 17 | bool focusNextPrevChild(bool next) override; 18 | }; 19 | 20 | #endif // FOCUSABLEMENU_H 21 | -------------------------------------------------------------------------------- /src/ui/form/controls/labeldoublespin.cpp: -------------------------------------------------------------------------------- 1 | #include "labeldoublespin.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "controlutil.h" 7 | #include "doublespinbox.h" 8 | 9 | LabelDoubleSpin::LabelDoubleSpin(QWidget *parent) : QWidget(parent) 10 | { 11 | setupUi(); 12 | } 13 | 14 | QHBoxLayout *LabelDoubleSpin::boxLayout() const 15 | { 16 | return static_cast(layout()); 17 | } 18 | 19 | void LabelDoubleSpin::setupUi() 20 | { 21 | m_label = ControlUtil::createLabel(); 22 | 23 | setupSpin(); 24 | 25 | auto layout = ControlUtil::createRowLayout(m_label, m_spinBox); 26 | 27 | this->setLayout(layout); 28 | } 29 | 30 | void LabelDoubleSpin::setupSpin() 31 | { 32 | m_spinBox = new DoubleSpinBox(); 33 | m_spinBox->setFixedWidth(110); 34 | m_spinBox->setRange(0, 9999); 35 | } 36 | -------------------------------------------------------------------------------- /src/ui/form/controls/labeldoublespin.h: -------------------------------------------------------------------------------- 1 | #ifndef LABELDOUBLESPIN_H 2 | #define LABELDOUBLESPIN_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QDoubleSpinBox) 7 | QT_FORWARD_DECLARE_CLASS(QHBoxLayout) 8 | QT_FORWARD_DECLARE_CLASS(QLabel) 9 | 10 | class LabelDoubleSpin : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit LabelDoubleSpin(QWidget *parent = nullptr); 16 | 17 | QHBoxLayout *boxLayout() const; 18 | QLabel *label() const { return m_label; } 19 | QDoubleSpinBox *spinBox() const { return m_spinBox; } 20 | 21 | private: 22 | void setupUi(); 23 | void setupSpin(); 24 | 25 | private: 26 | QLabel *m_label = nullptr; 27 | QDoubleSpinBox *m_spinBox = nullptr; 28 | }; 29 | 30 | #endif // LABELDOUBLESPIN_H 31 | -------------------------------------------------------------------------------- /src/ui/form/controls/labelspin.cpp: -------------------------------------------------------------------------------- 1 | #include "labelspin.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | #include "controlutil.h" 8 | 9 | LabelSpin::LabelSpin(QWidget *parent) : QWidget(parent) 10 | { 11 | setupUi(); 12 | } 13 | 14 | QHBoxLayout *LabelSpin::boxLayout() const 15 | { 16 | return static_cast(layout()); 17 | } 18 | 19 | void LabelSpin::setupUi() 20 | { 21 | m_label = ControlUtil::createLabel(); 22 | 23 | setupSpin(); 24 | 25 | auto layout = ControlUtil::createRowLayout(m_label, m_spinBox); 26 | 27 | this->setLayout(layout); 28 | } 29 | 30 | void LabelSpin::setupSpin() 31 | { 32 | m_spinBox = ControlUtil::createSpinBox(); 33 | m_spinBox->setFixedWidth(110); 34 | m_spinBox->setRange(0, 9999); 35 | } 36 | -------------------------------------------------------------------------------- /src/ui/form/controls/labelspin.h: -------------------------------------------------------------------------------- 1 | #ifndef LABELSPIN_H 2 | #define LABELSPIN_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QHBoxLayout) 7 | QT_FORWARD_DECLARE_CLASS(QLabel) 8 | QT_FORWARD_DECLARE_CLASS(QSpinBox) 9 | 10 | class LabelSpin : public QWidget 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit LabelSpin(QWidget *parent = nullptr); 16 | 17 | QHBoxLayout *boxLayout() const; 18 | QLabel *label() const { return m_label; } 19 | QSpinBox *spinBox() const { return m_spinBox; } 20 | 21 | private: 22 | void setupUi(); 23 | void setupSpin(); 24 | 25 | private: 26 | QLabel *m_label = nullptr; 27 | QSpinBox *m_spinBox = nullptr; 28 | }; 29 | 30 | #endif // LABELSPIN_H 31 | -------------------------------------------------------------------------------- /src/ui/form/controls/labelspincombo.cpp: -------------------------------------------------------------------------------- 1 | #include "labelspincombo.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "controlutil.h" 7 | 8 | LabelSpinCombo::LabelSpinCombo(QWidget *parent) : SpinCombo(parent) 9 | { 10 | setupUi(); 11 | } 12 | 13 | void LabelSpinCombo::setupUi() 14 | { 15 | m_label = ControlUtil::createLabel(); 16 | 17 | boxLayout()->insertWidget(0, m_label, 1); 18 | } 19 | -------------------------------------------------------------------------------- /src/ui/form/controls/labelspincombo.h: -------------------------------------------------------------------------------- 1 | #ifndef LABELSPINCOMBO_H 2 | #define LABELSPINCOMBO_H 3 | 4 | #include "spincombo.h" 5 | 6 | QT_FORWARD_DECLARE_CLASS(QLabel) 7 | 8 | class LabelSpinCombo : public SpinCombo 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit LabelSpinCombo(QWidget *parent = nullptr); 14 | 15 | QLabel *label() const { return m_label; } 16 | 17 | private: 18 | void setupUi(); 19 | 20 | private: 21 | QLabel *m_label = nullptr; 22 | }; 23 | 24 | #endif // LABELSPINCOMBO_H 25 | -------------------------------------------------------------------------------- /src/ui/form/controls/lineedit.cpp: -------------------------------------------------------------------------------- 1 | #include "lineedit.h" 2 | 3 | #include 4 | 5 | LineEdit::LineEdit(QWidget *parent) : QLineEdit(parent) { } 6 | 7 | void LineEdit::setStartText(const QString &v) 8 | { 9 | setText(v); 10 | setCursorPosition(0); 11 | } 12 | 13 | bool LineEdit::event(QEvent *event) 14 | { 15 | switch (event->type()) { 16 | case QEvent::ToolTip: { 17 | setToolTip(text()); 18 | } break; 19 | } 20 | 21 | return QLineEdit::event(event); 22 | } 23 | -------------------------------------------------------------------------------- /src/ui/form/controls/lineedit.h: -------------------------------------------------------------------------------- 1 | #ifndef LINEEDIT_H 2 | #define LINEEDIT_H 3 | 4 | #include 5 | 6 | class LineEdit : public QLineEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit LineEdit(QWidget *parent = nullptr); 12 | 13 | void setStartText(const QString &v); 14 | 15 | bool event(QEvent *event) override; 16 | }; 17 | 18 | #endif // LINEEDIT_H 19 | -------------------------------------------------------------------------------- /src/ui/form/controls/listview.cpp: -------------------------------------------------------------------------------- 1 | #include "listview.h" 2 | 3 | ListView::ListView(QWidget *parent) : QListView(parent) { } 4 | 5 | void ListView::setModel(QAbstractItemModel *model) 6 | { 7 | QListView::setModel(model); 8 | 9 | connect(model, &QAbstractItemModel::modelReset, this, 10 | [&] { emit currentIndexChanged(currentIndex()); }); 11 | } 12 | 13 | int ListView::currentRow() const 14 | { 15 | return currentIndex().row(); 16 | } 17 | 18 | void ListView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) 19 | { 20 | QListView::currentChanged(current, previous); 21 | 22 | emit currentIndexChanged(current); 23 | } 24 | -------------------------------------------------------------------------------- /src/ui/form/controls/listview.h: -------------------------------------------------------------------------------- 1 | #ifndef LISTVIEW_H 2 | #define LISTVIEW_H 3 | 4 | #include 5 | 6 | class ListView : public QListView 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit ListView(QWidget *parent = nullptr); 12 | 13 | void setModel(QAbstractItemModel *model) override; 14 | 15 | int currentRow() const; 16 | 17 | signals: 18 | void currentIndexChanged(const QModelIndex &index); 19 | 20 | protected: 21 | void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; 22 | }; 23 | 24 | #endif // LISTVIEW_H 25 | -------------------------------------------------------------------------------- /src/ui/form/controls/mainwindow.cpp: -------------------------------------------------------------------------------- 1 | #include "mainwindow.h" 2 | 3 | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/form/controls/mainwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef MAINWINDOW_H 2 | #define MAINWINDOW_H 3 | 4 | #include 5 | 6 | class MainWindow : public QMainWindow 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit MainWindow(QWidget *parent = nullptr); 12 | }; 13 | 14 | #endif // MAINWINDOW_H 15 | -------------------------------------------------------------------------------- /src/ui/form/controls/menubutton.h: -------------------------------------------------------------------------------- 1 | #ifndef MENUBUTTON_H 2 | #define MENUBUTTON_H 3 | 4 | #include "pushbutton.h" 5 | 6 | class TrayIcon; 7 | 8 | class MenuButton : public PushButton 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit MenuButton(QWidget *parent = nullptr); 14 | 15 | TrayIcon *trayIcon() const; 16 | 17 | private: 18 | void setupUi(); 19 | 20 | protected: 21 | void mousePressEvent(QMouseEvent *e) override; 22 | void mouseReleaseEvent(QMouseEvent *e) override; 23 | }; 24 | 25 | #endif // MENUBUTTON_H 26 | -------------------------------------------------------------------------------- /src/ui/form/controls/menuwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef MENUWIDGET_H 2 | #define MENUWIDGET_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QMenu) 7 | 8 | class MenuWidget : public QWidget 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit MenuWidget(QMenu *menu, QAction *action, QWidget *parent = nullptr); 14 | 15 | signals: 16 | void layoutChanged(); 17 | 18 | protected: 19 | bool event(QEvent *event) override; 20 | 21 | private: 22 | void relayoutMenu(); 23 | 24 | private: 25 | QMenu *m_menu = nullptr; 26 | QAction *m_action = nullptr; 27 | }; 28 | 29 | #endif // MENUWIDGET_H 30 | -------------------------------------------------------------------------------- /src/ui/form/controls/optionsbutton.cpp: -------------------------------------------------------------------------------- 1 | #include "optionsbutton.h" 2 | 3 | #include 4 | 5 | #include
6 | #include 7 | #include 8 | #include 9 | 10 | OptionsButton::OptionsButton(int tabIndex, QWidget *parent) : 11 | ToolButton(parent), m_tabIndex(tabIndex) 12 | { 13 | setupUi(); 14 | 15 | connect(this, &QToolButton::clicked, this, &OptionsButton::showOptionsWindow); 16 | } 17 | 18 | TrayIcon *OptionsButton::trayIcon() const 19 | { 20 | return IoC()->trayIcon(); 21 | } 22 | 23 | void OptionsButton::showOptionsWindow() 24 | { 25 | IoC()->showOptionsWindowTab(m_tabIndex); 26 | } 27 | 28 | void OptionsButton::setupUi() 29 | { 30 | setIcon(IconCache::icon(":/icons/cog.png")); 31 | 32 | setPopupMode(QToolButton::MenuButtonPopup); 33 | setMenu(trayIcon()->optionsMenu()); 34 | } 35 | -------------------------------------------------------------------------------- /src/ui/form/controls/optionsbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef OPTIONSBUTTON_H 2 | #define OPTIONSBUTTON_H 3 | 4 | #include "toolbutton.h" 5 | 6 | class TrayIcon; 7 | 8 | class OptionsButton : public ToolButton 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit OptionsButton(int tabIndex = 0, QWidget *parent = nullptr); 14 | 15 | TrayIcon *trayIcon() const; 16 | 17 | public slots: 18 | void showOptionsWindow(); 19 | 20 | private: 21 | void setupUi(); 22 | 23 | private: 24 | int m_tabIndex = 0; 25 | }; 26 | 27 | #endif // OPTIONSBUTTON_H 28 | -------------------------------------------------------------------------------- /src/ui/form/controls/plaintextedit.h: -------------------------------------------------------------------------------- 1 | #ifndef PLAINTEXTEDIT_H 2 | #define PLAINTEXTEDIT_H 3 | 4 | #include 5 | 6 | class PlainTextEdit : public QPlainTextEdit 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit PlainTextEdit(QWidget *parent = nullptr); 12 | 13 | bool isEmpty() const; 14 | 15 | void addContextAction(QAction *a) { return m_contextActions.append(a); } 16 | 17 | public slots: 18 | void setText(const QString &text); 19 | 20 | protected: 21 | void contextMenuEvent(QContextMenuEvent *e) override; 22 | 23 | private: 24 | QList m_contextActions; 25 | }; 26 | 27 | #endif // PLAINTEXTEDIT_H 28 | -------------------------------------------------------------------------------- /src/ui/form/controls/pushbutton.cpp: -------------------------------------------------------------------------------- 1 | #include "pushbutton.h" 2 | 3 | #include 4 | 5 | PushButton::PushButton(QWidget *parent) : QPushButton(parent) { } 6 | 7 | PushButton::PushButton(const QIcon &icon, const QString &text, QWidget *parent) : 8 | QPushButton(icon, text, parent) 9 | { 10 | } 11 | 12 | void PushButton::mousePressEvent(QMouseEvent *e) 13 | { 14 | QPushButton::mousePressEvent(e); 15 | 16 | setMousePressed(true); 17 | } 18 | 19 | void PushButton::mouseReleaseEvent(QMouseEvent *e) 20 | { 21 | QPushButton::mouseReleaseEvent(e); 22 | 23 | if (!mousePressed()) 24 | return; 25 | 26 | setMousePressed(false); 27 | 28 | if (e->button() == Qt::RightButton && e->modifiers() == Qt::NoModifier) { 29 | onRightClicked(); 30 | } 31 | } 32 | 33 | void PushButton::onRightClicked() 34 | { 35 | if (menu()) { 36 | showMenu(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/ui/form/controls/pushbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef PUSHBUTTON_H 2 | #define PUSHBUTTON_H 3 | 4 | #include 5 | 6 | class PushButton : public QPushButton 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit PushButton(QWidget *parent = nullptr); 12 | explicit PushButton(const QIcon &icon, const QString &text, QWidget *parent = nullptr); 13 | 14 | protected: 15 | bool mousePressed() const { return m_mousePressed; } 16 | void setMousePressed(bool v) { m_mousePressed = v; } 17 | 18 | void mousePressEvent(QMouseEvent *e) override; 19 | void mouseReleaseEvent(QMouseEvent *e) override; 20 | 21 | private: 22 | void onRightClicked(); 23 | 24 | private: 25 | bool m_mousePressed : 1 = false; 26 | }; 27 | 28 | #endif // PUSHBUTTON_H 29 | -------------------------------------------------------------------------------- /src/ui/form/controls/sidebutton.cpp: -------------------------------------------------------------------------------- 1 | #include "sidebutton.h" 2 | 3 | #include 4 | 5 | namespace { 6 | 7 | constexpr int indicatorWidth = 3; 8 | 9 | } 10 | 11 | SideButton::SideButton(QWidget *parent) : QToolButton(parent) { } 12 | 13 | QSize SideButton::sizeHint() const 14 | { 15 | QSize sh = QToolButton::sizeHint(); 16 | sh.setWidth(sh.width() + indicatorWidth); 17 | return sh; 18 | } 19 | 20 | void SideButton::paintEvent(QPaintEvent *event) 21 | { 22 | QToolButton::paintEvent(event); 23 | 24 | if (!isChecked()) 25 | return; 26 | 27 | QRect r = rect(); 28 | if (isRightToLeft()) { 29 | r.setX(r.width() - indicatorWidth); 30 | } 31 | r.setWidth(indicatorWidth); 32 | 33 | QPainter p(this); 34 | p.fillRect(r, QColor(0x3a, 0xd2, 0x4c)); 35 | } 36 | -------------------------------------------------------------------------------- /src/ui/form/controls/sidebutton.h: -------------------------------------------------------------------------------- 1 | #ifndef SIDEBUTTON_H 2 | #define SIDEBUTTON_H 3 | 4 | #include 5 | 6 | class SideButton : public QToolButton 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit SideButton(QWidget *parent = nullptr); 12 | 13 | QSize sizeHint() const override; 14 | 15 | protected: 16 | void paintEvent(QPaintEvent *event) override; 17 | }; 18 | 19 | #endif // SIDEBUTTON_H 20 | -------------------------------------------------------------------------------- /src/ui/form/controls/spinbox.cpp: -------------------------------------------------------------------------------- 1 | #include "spinbox.h" 2 | 3 | #include 4 | 5 | SpinBox::SpinBox(QWidget *parent) : QSpinBox(parent) 6 | { 7 | setFocusPolicy(Qt::StrongFocus); 8 | } 9 | 10 | void SpinBox::wheelEvent(QWheelEvent *e) 11 | { 12 | if (!hasFocus()) { 13 | e->ignore(); 14 | return; 15 | } 16 | 17 | QSpinBox::wheelEvent(e); 18 | } 19 | -------------------------------------------------------------------------------- /src/ui/form/controls/spinbox.h: -------------------------------------------------------------------------------- 1 | #ifndef SPINBOX_H 2 | #define SPINBOX_H 3 | 4 | #include 5 | 6 | class SpinBox : public QSpinBox 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit SpinBox(QWidget *parent = nullptr); 12 | 13 | protected: 14 | void wheelEvent(QWheelEvent *e) override; 15 | }; 16 | 17 | #endif // SPINBOX_H 18 | -------------------------------------------------------------------------------- /src/ui/form/controls/tabbar.cpp: -------------------------------------------------------------------------------- 1 | #include "tabbar.h" 2 | 3 | TabBar::TabBar(QWidget *parent) : QTabBar(parent) { } 4 | 5 | QSize TabBar::tabSizeHint(int index) const 6 | { 7 | auto size = QTabBar::tabSizeHint(index); 8 | if (tabMinimumWidth() != 0) { 9 | size.setWidth(qMax(size.width(), tabMinimumWidth())); 10 | } 11 | return size; 12 | } 13 | -------------------------------------------------------------------------------- /src/ui/form/controls/tabbar.h: -------------------------------------------------------------------------------- 1 | #ifndef TABBAR_H 2 | #define TABBAR_H 3 | 4 | #include 5 | 6 | class TabBar : public QTabBar 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit TabBar(QWidget *parent = nullptr); 12 | 13 | int tabMinimumWidth() const { return m_tabMinimumWidth; } 14 | void setTabMinimumWidth(int v) { m_tabMinimumWidth = v; } 15 | 16 | protected: 17 | QSize tabSizeHint(int index) const override; 18 | 19 | private: 20 | int m_tabMinimumWidth = 0; 21 | }; 22 | 23 | #endif // TABBAR_H 24 | -------------------------------------------------------------------------------- /src/ui/form/controls/textarea2splitter.cpp: -------------------------------------------------------------------------------- 1 | #include "textarea2splitter.h" 2 | 3 | #include "textarea2splitterhandle.h" 4 | 5 | TextArea2Splitter::TextArea2Splitter(QWidget *parent) : QSplitter(parent) 6 | { 7 | setupUi(); 8 | } 9 | 10 | void TextArea2Splitter::setupUi() 11 | { 12 | setHandleWidth(32); 13 | } 14 | 15 | TextArea2SplitterHandle *TextArea2Splitter::handle() const 16 | { 17 | return static_cast(QSplitter::handle(1)); 18 | } 19 | 20 | QSplitterHandle *TextArea2Splitter::createHandle() 21 | { 22 | auto handle = new TextArea2SplitterHandle(orientation(), this); 23 | return handle; 24 | } 25 | -------------------------------------------------------------------------------- /src/ui/form/controls/textarea2splitter.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTAREA2SPLITTER_H 2 | #define TEXTAREA2SPLITTER_H 3 | 4 | #include 5 | 6 | class TextArea2SplitterHandle; 7 | 8 | class TextArea2Splitter : public QSplitter 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit TextArea2Splitter(QWidget *parent = nullptr); 14 | 15 | TextArea2SplitterHandle *handle() const; 16 | 17 | protected: 18 | QSplitterHandle *createHandle() override; 19 | 20 | private: 21 | void setupUi(); 22 | }; 23 | 24 | #endif // TEXTAREA2SPLITTER_H 25 | -------------------------------------------------------------------------------- /src/ui/form/controls/toolbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef TOOLBUTTON_H 2 | #define TOOLBUTTON_H 3 | 4 | #include 5 | 6 | class ToolButton : public QToolButton 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit ToolButton(QWidget *parent = nullptr); 12 | 13 | signals: 14 | void aboutToShowMenu(); 15 | 16 | protected: 17 | bool mousePressed() const { return m_mousePressed; } 18 | 19 | void mousePressEvent(QMouseEvent *e) override; 20 | void mouseReleaseEvent(QMouseEvent *e) override; 21 | 22 | private: 23 | void checkLeftPress(QMouseEvent *e); 24 | void onRightClicked(); 25 | 26 | private: 27 | bool m_mousePressed : 1 = false; 28 | }; 29 | 30 | #endif // TOOLBUTTON_H 31 | -------------------------------------------------------------------------------- /src/ui/form/controls/treeitemdelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef TREEITEMDELEGATE_H 2 | #define TREEITEMDELEGATE_H 3 | 4 | #include 5 | 6 | class TreeItemDelegate : public QStyledItemDelegate 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit TreeItemDelegate(QObject *parent = nullptr); 12 | 13 | void paint(QPainter *painter, const QStyleOptionViewItem &option, 14 | const QModelIndex &index) const override; 15 | QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override; 16 | 17 | private: 18 | void setOptionEnabled(QStyleOptionViewItem &opt, const QModelIndex &index) const; 19 | }; 20 | 21 | #endif // TREEITEMDELEGATE_H 22 | -------------------------------------------------------------------------------- /src/ui/form/controls/treeview.h: -------------------------------------------------------------------------------- 1 | #ifndef TREEVIEW_H 2 | #define TREEVIEW_H 3 | 4 | #include 5 | 6 | class TreeView : public QTreeView 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit TreeView(QWidget *parent = nullptr); 12 | 13 | QMenu *menu() const { return m_menu; } 14 | void setMenu(QMenu *menu) { m_menu = menu; } 15 | 16 | void setModel(QAbstractItemModel *model) override; 17 | 18 | void setupItemDelegate(); 19 | 20 | signals: 21 | void currentIndexChanged(const QModelIndex &index); 22 | 23 | protected: 24 | void selectionChanged( 25 | const QItemSelection &selected, const QItemSelection &deselected) override; 26 | void currentChanged(const QModelIndex ¤t, const QModelIndex &previous) override; 27 | 28 | void contextMenuEvent(QContextMenuEvent *event) override; 29 | 30 | private: 31 | QMenu *m_menu = nullptr; 32 | }; 33 | 34 | #endif // TREEVIEW_H 35 | -------------------------------------------------------------------------------- /src/ui/form/dialog/splashscreen.h: -------------------------------------------------------------------------------- 1 | #ifndef SPLASHSCREEN_H 2 | #define SPLASHSCREEN_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QLabel) 7 | 8 | class SplashScreen : public QSplashScreen 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit SplashScreen(); 14 | 15 | static QLayout *createLogoLayout(); 16 | static QLayout *createLogoIconLayout(); 17 | static QLayout *createLogoTextLayout(); 18 | 19 | public slots: 20 | void showFading(); 21 | void closeDelayed(); 22 | void closeFading(); 23 | 24 | private: 25 | void setupUi(); 26 | QLayout *setupMainLayout(); 27 | }; 28 | 29 | #endif // SPLASHSCREEN_H 30 | -------------------------------------------------------------------------------- /src/ui/form/form_types.h: -------------------------------------------------------------------------------- 1 | #ifndef FORM_TYPES_H 2 | #define FORM_TYPES_H 3 | 4 | #include 5 | 6 | enum WindowCode { 7 | WindowNone = 0, 8 | WindowHome = (1 << 0), 9 | WindowPrograms = (1 << 1), 10 | WindowProgramAlert = (1 << 2), 11 | WindowServices = (1 << 3), 12 | WindowOptions = (1 << 4), 13 | WindowRules = (1 << 5), 14 | WindowStatistics = (1 << 6), 15 | WindowZones = (1 << 7), 16 | WindowGraph = (1 << 8), 17 | WindowPasswordDialog = (1 << 9), 18 | }; 19 | 20 | constexpr quint32 WindowPasswordProtected = (WindowPrograms | WindowProgramAlert | WindowServices 21 | | WindowOptions | WindowRules | WindowStatistics | WindowZones); 22 | 23 | #endif // FORM_TYPES_H 24 | -------------------------------------------------------------------------------- /src/ui/form/graph/axistickerspeed.cpp: -------------------------------------------------------------------------------- 1 | #include "axistickerspeed.h" 2 | 3 | #include 4 | 5 | double AxisTickerSpeed::getTickStep(const QCPRange &range) 6 | { 7 | const double exactStep = range.size() / tickCount(); 8 | constexpr int tickStep = 2; 9 | 10 | return qPow(tickStep, qFloor(qLn(exactStep) / qLn(tickStep) + 0.5)); 11 | } 12 | 13 | QString AxisTickerSpeed::getTickLabel( 14 | double tick, const QLocale &locale, QChar formatChar, int precision) 15 | { 16 | Q_UNUSED(locale); 17 | Q_UNUSED(formatChar); 18 | Q_UNUSED(precision); 19 | 20 | return FormatUtil::formatSpeed(qint64(tick), unitFormat()); 21 | } 22 | -------------------------------------------------------------------------------- /src/ui/form/graph/axistickerspeed.h: -------------------------------------------------------------------------------- 1 | #ifndef AXISTICKERSPEED_H 2 | #define AXISTICKERSPEED_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class AxisTickerSpeed : public QCPAxisTicker 9 | { 10 | Q_GADGET 11 | 12 | public: 13 | explicit AxisTickerSpeed() = default; 14 | 15 | FormatUtil::SizeFormat unitFormat() const { return m_unitFormat; } 16 | void setUnitFormat(FormatUtil::SizeFormat v) { m_unitFormat = v; } 17 | 18 | protected: 19 | double getTickStep(const QCPRange &range) override; 20 | QString getTickLabel( 21 | double tick, const QLocale &locale, QChar formatChar, int precision) override; 22 | 23 | private: 24 | FormatUtil::SizeFormat m_unitFormat = FormatUtil::SpeedTraditionalFormat; 25 | }; 26 | 27 | #endif // AXISTICKERSPEED_H 28 | -------------------------------------------------------------------------------- /src/ui/form/home/homecontroller.cpp: -------------------------------------------------------------------------------- 1 | #include "homecontroller.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | HomeController::HomeController(QObject *parent) : BaseController(parent) 8 | { 9 | connect(IoC(), &ConfManager::iniChanged, this, 10 | &HomeController::updatePasswordLocked); 11 | connect(IoC(), &FortSettings::passwordCheckedChanged, this, 12 | &HomeController::updatePasswordLocked); 13 | 14 | updatePasswordLocked(); 15 | } 16 | 17 | void HomeController::setPasswordLocked(bool v) 18 | { 19 | if (m_passwordLocked == v) 20 | return; 21 | 22 | m_passwordLocked = v; 23 | emit passwordLockedChanged(); 24 | } 25 | 26 | void HomeController::updatePasswordLocked() 27 | { 28 | auto settings = IoC(); 29 | 30 | setPasswordLocked(settings->isPasswordRequired()); 31 | } 32 | -------------------------------------------------------------------------------- /src/ui/form/home/homecontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef HOMECONTROLLER_H 2 | #define HOMECONTROLLER_H 3 | 4 | #include 5 | 6 | class HomeController : public BaseController 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit HomeController(QObject *parent = nullptr); 12 | 13 | bool passwordLocked() const { return m_passwordLocked; } 14 | void setPasswordLocked(bool v); 15 | 16 | signals: 17 | void afterSaveWindowState(IniUser *ini); 18 | void afterRestoreWindowState(IniUser *ini); 19 | 20 | void passwordLockedChanged(); 21 | 22 | private: 23 | void updatePasswordLocked(); 24 | 25 | private: 26 | bool m_passwordLocked = false; 27 | }; 28 | 29 | #endif // HOMECONTROLLER_H 30 | -------------------------------------------------------------------------------- /src/ui/form/home/pages/homemainpage.h: -------------------------------------------------------------------------------- 1 | #ifndef HOMEMAINPAGE_H 2 | #define HOMEMAINPAGE_H 3 | 4 | #include "homebasepage.h" 5 | 6 | QT_FORWARD_DECLARE_CLASS(QStackedWidget) 7 | 8 | class HomeMainPage : public HomeBasePage 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | enum TabIndex : qint8 { TabHome = 0, TabAbout }; 14 | Q_ENUM(TabIndex) 15 | 16 | explicit HomeMainPage(HomeController *ctrl = nullptr, QWidget *parent = nullptr); 17 | 18 | void setCurrentTab(TabIndex tabIndex); 19 | 20 | protected slots: 21 | void onRetranslateUi() override; 22 | 23 | private: 24 | void setupUi(); 25 | QLayout *setupSideBar(); 26 | void setupSideBarButtons(); 27 | void setupStackedLayout(); 28 | 29 | QToolButton *buttonAt(TabIndex tabIndex) const { return m_buttons[tabIndex]; } 30 | 31 | private: 32 | QVector m_buttons; 33 | QStackedWidget *m_stackedPages = nullptr; 34 | }; 35 | 36 | #endif // HOMEMAINPAGE_H 37 | -------------------------------------------------------------------------------- /src/ui/form/prog/programalertwindow.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRAMALERTWINDOW_H 2 | #define PROGRAMALERTWINDOW_H 3 | 4 | #include 5 | 6 | #include "programeditdialog.h" 7 | 8 | class ProgramAlertWindow : public ProgramEditDialog 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit ProgramAlertWindow(QWidget *parent = nullptr); 14 | 15 | WindowCode windowCode() const override { return WindowProgramAlert; } 16 | QString windowOverlayIconPath() const override { return ":/icons/error.png"; } 17 | 18 | bool isAutoActive() const; 19 | 20 | void initialize(); 21 | 22 | void saveWindowState(bool wasVisible) override; 23 | void restoreWindowState() override; 24 | 25 | protected: 26 | void closeOnSave() override; 27 | 28 | private: 29 | void setupController(); 30 | 31 | void retranslateWindowTitle() override; 32 | 33 | void setupUi(); 34 | }; 35 | 36 | #endif // PROGRAMALERTWINDOW_H 37 | -------------------------------------------------------------------------------- /src/ui/form/prog/programeditcontroller.cpp: -------------------------------------------------------------------------------- 1 | #include "programeditcontroller.h" 2 | 3 | #include 4 | 5 | ProgramEditController::ProgramEditController(QObject *parent) : BaseController(parent) { } 6 | 7 | bool ProgramEditController::addOrUpdateApp(App &app, bool onlyUpdate) 8 | { 9 | return confAppManager()->addOrUpdateApp(app, onlyUpdate); 10 | } 11 | 12 | bool ProgramEditController::updateApp(App &app) 13 | { 14 | return confAppManager()->updateApp(app); 15 | } 16 | 17 | bool ProgramEditController::updateAppName(qint64 appId, const QString &appName) 18 | { 19 | return confAppManager()->updateAppName(appId, appName); 20 | } 21 | -------------------------------------------------------------------------------- /src/ui/form/prog/programeditcontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRAMEDITCONTROLLER_H 2 | #define PROGRAMEDITCONTROLLER_H 3 | 4 | #include 5 | 6 | class App; 7 | 8 | class ProgramEditController : public BaseController 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit ProgramEditController(QObject *parent = nullptr); 14 | 15 | public slots: 16 | bool addOrUpdateApp(App &app, bool onlyUpdate = false); 17 | bool updateApp(App &app); 18 | bool updateAppName(qint64 appId, const QString &appName); 19 | }; 20 | 21 | #endif // PROGRAMEDITCONTROLLER_H 22 | -------------------------------------------------------------------------------- /src/ui/form/prog/programscontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef PROGRAMSCONTROLLER_H 2 | #define PROGRAMSCONTROLLER_H 3 | 4 | #include "programeditcontroller.h" 5 | 6 | class AppInfoCache; 7 | class AppListModel; 8 | 9 | class ProgramsController : public ProgramEditController 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit ProgramsController(QObject *parent = nullptr); 15 | 16 | AppInfoCache *appInfoCache() const; 17 | AppListModel *appListModel() const { return m_appListModel; } 18 | 19 | void initialize(); 20 | 21 | public slots: 22 | void updateAppsBlocked(const QVector &appIdList, bool blocked, bool killProcess); 23 | void deleteApps(const QVector &appIdList); 24 | void deleteAlertedApps(); 25 | void clearAlerts(); 26 | void purgeApps(); 27 | 28 | private: 29 | AppListModel *m_appListModel = nullptr; 30 | }; 31 | 32 | #endif // PROGRAMSCONTROLLER_H 33 | -------------------------------------------------------------------------------- /src/ui/form/rule/rulescontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef RULESCONTROLLER_H 2 | #define RULESCONTROLLER_H 3 | 4 | #include 5 | 6 | class Rule; 7 | class RuleListModel; 8 | 9 | class RulesController : public BaseController 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit RulesController(QObject *parent = nullptr); 15 | 16 | RuleListModel *ruleListModel() const; 17 | 18 | public slots: 19 | bool addOrUpdateRule(Rule &rule); 20 | void deleteRule(int ruleId); 21 | bool updateRuleName(int ruleId, const QString &ruleName); 22 | 23 | private: 24 | RuleListModel *m_ruleListModel = nullptr; 25 | }; 26 | 27 | #endif // RULESCONTROLLER_H 28 | -------------------------------------------------------------------------------- /src/ui/form/stat/pages/statmainpage.h: -------------------------------------------------------------------------------- 1 | #ifndef STATMAINPAGE_H 2 | #define STATMAINPAGE_H 3 | 4 | #include "statbasepage.h" 5 | 6 | QT_FORWARD_DECLARE_CLASS(QTabWidget) 7 | 8 | class StatMainPage : public StatBasePage 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit StatMainPage(StatisticsController *ctrl = nullptr, QWidget *parent = nullptr); 14 | 15 | protected slots: 16 | void onRestoreWindowState(IniUser *ini) override; 17 | 18 | void onRetranslateUi() override; 19 | 20 | private: 21 | void setupUi(); 22 | void setupTabBar(); 23 | void setupCornerWidget(); 24 | QLayout *setupCornerLayout(); 25 | 26 | private: 27 | QTabWidget *m_tabWidget = nullptr; 28 | QToolButton *m_btOptions = nullptr; 29 | QPushButton *m_btMenu = nullptr; 30 | }; 31 | 32 | #endif // STATMAINPAGE_H 33 | -------------------------------------------------------------------------------- /src/ui/form/stat/statisticscontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef STATISTICSCONTROLLER_H 2 | #define STATISTICSCONTROLLER_H 3 | 4 | #include 5 | 6 | class StatConnManager; 7 | class StatManager; 8 | 9 | class StatisticsController : public BaseController 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit StatisticsController(QObject *parent = nullptr); 15 | 16 | StatManager *statManager() const; 17 | StatConnManager *statConnManager() const; 18 | 19 | void clearTraffic(); 20 | void deleteStatApp(qint64 appId); 21 | void resetAppTotals(); 22 | 23 | void deleteConn(qint64 connIdTo = 0); 24 | 25 | signals: 26 | void afterSaveWindowState(IniUser *ini); 27 | void afterRestoreWindowState(IniUser *ini); 28 | }; 29 | 30 | #endif // STATISTICSCONTROLLER_H 31 | -------------------------------------------------------------------------------- /src/ui/form/svc/servicescontroller.cpp: -------------------------------------------------------------------------------- 1 | #include "servicescontroller.h" 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | ServicesController::ServicesController(QObject *parent) : 8 | BaseController(parent), m_serviceListModel(new ServiceListModel(this)) 9 | { 10 | } 11 | 12 | ServiceInfoManager *ServicesController::serviceInfoManager() const 13 | { 14 | return IoC(); 15 | } 16 | 17 | void ServicesController::initialize() 18 | { 19 | serviceListModel()->initialize(); 20 | } 21 | -------------------------------------------------------------------------------- /src/ui/form/svc/servicescontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICESCONTROLLER_H 2 | #define SERVICESCONTROLLER_H 3 | 4 | #include 5 | 6 | class ServiceInfoManager; 7 | class ServiceListModel; 8 | 9 | class ServicesController : public BaseController 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit ServicesController(QObject *parent = nullptr); 15 | 16 | ServiceInfoManager *serviceInfoManager() const; 17 | ServiceListModel *serviceListModel() const { return m_serviceListModel; } 18 | 19 | void initialize(); 20 | 21 | private: 22 | ServiceListModel *m_serviceListModel = nullptr; 23 | }; 24 | 25 | #endif // SERVICESCONTROLLER_H 26 | -------------------------------------------------------------------------------- /src/ui/form/tray/traycontroller.cpp: -------------------------------------------------------------------------------- 1 | #include "traycontroller.h" 2 | 3 | TrayController::TrayController(QObject *parent) : BaseController(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/form/tray/traycontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef TRAYCONTROLLER_H 2 | #define TRAYCONTROLLER_H 3 | 4 | #include 5 | 6 | class TrayController : public BaseController 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit TrayController(QObject *parent = nullptr); 12 | }; 13 | 14 | #endif // TRAYCONTROLLER_H 15 | -------------------------------------------------------------------------------- /src/ui/form/zone/zonescontroller.h: -------------------------------------------------------------------------------- 1 | #ifndef ZONESCONTROLLER_H 2 | #define ZONESCONTROLLER_H 3 | 4 | #include 5 | 6 | class Zone; 7 | class ZoneListModel; 8 | 9 | class ZonesController : public BaseController 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit ZonesController(QObject *parent = nullptr); 15 | 16 | ZoneListModel *zoneListModel() const; 17 | 18 | public slots: 19 | bool addOrUpdateZone(Zone &zone); 20 | void deleteZone(int zoneId); 21 | bool updateZoneName(int zoneId, const QString &zoneName); 22 | }; 23 | 24 | #endif // ZONESCONTROLLER_H 25 | -------------------------------------------------------------------------------- /src/ui/fort_readme.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | README.portable 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ui/fort_scripts.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | scripts/restart.bat 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "hostinfo.h" 2 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef HOSTINFO_H 2 | #define HOSTINFO_H 3 | 4 | #include 5 | 6 | class HostInfo 7 | { 8 | public: 9 | QString hostName; 10 | }; 11 | 12 | #endif // HOSTINFO_H 13 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfojob.cpp: -------------------------------------------------------------------------------- 1 | #include "hostinfojob.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "hostinfomanager.h" 7 | 8 | HostInfoJob::HostInfoJob(const QString &address) : WorkerJob(address) { } 9 | 10 | void HostInfoJob::doJob(WorkerObject & /*worker*/) 11 | { 12 | m_hostName = NetUtil::getHostName(address()); 13 | } 14 | 15 | void HostInfoJob::reportResult(WorkerObject &worker) 16 | { 17 | emitFinished(static_cast(worker.manager())); 18 | } 19 | 20 | void HostInfoJob::emitFinished(HostInfoManager *manager) 21 | { 22 | emit manager->lookupFinished(address(), m_hostName); 23 | } 24 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfojob.h: -------------------------------------------------------------------------------- 1 | #ifndef HOSTINFOJOB_H 2 | #define HOSTINFOJOB_H 3 | 4 | #include 5 | 6 | class HostInfoManager; 7 | 8 | class HostInfoJob : public WorkerJob 9 | { 10 | public: 11 | explicit HostInfoJob(const QString &address); 12 | 13 | QString address() const { return text(); } 14 | 15 | void doJob(WorkerObject &worker) override; 16 | void reportResult(WorkerObject &worker) override; 17 | 18 | private: 19 | void emitFinished(HostInfoManager *manager); 20 | 21 | private: 22 | QString m_hostName; 23 | }; 24 | 25 | #endif // HOSTINFOJOB_H 26 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfomanager.cpp: -------------------------------------------------------------------------------- 1 | #include "hostinfomanager.h" 2 | 3 | #include "hostinfojob.h" 4 | 5 | HostInfoManager::HostInfoManager(QObject *parent) : WorkerManager(parent) 6 | { 7 | setMaxWorkersCount(2); 8 | 9 | QSysInfo::machineHostName(); // Initialize ws2_32.dll 10 | } 11 | 12 | void HostInfoManager::lookupHost(const QString &address) 13 | { 14 | enqueueJob(WorkerJobPtr(new HostInfoJob(address))); 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/hostinfo/hostinfomanager.h: -------------------------------------------------------------------------------- 1 | #ifndef HOSTINFOMANAGER_H 2 | #define HOSTINFOMANAGER_H 3 | 4 | #include 5 | 6 | class HostInfoManager : public WorkerManager 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit HostInfoManager(QObject *parent = nullptr); 12 | 13 | QString workerName() const override { return "HostInfoWorker"; } 14 | 15 | signals: 16 | void lookupFinished(const QString &address, const QString &hostName); 17 | 18 | public slots: 19 | void lookupHost(const QString &address); 20 | }; 21 | 22 | #endif // HOSTINFOMANAGER_H 23 | -------------------------------------------------------------------------------- /src/ui/icons/accept.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/accept.png -------------------------------------------------------------------------------- /src/ui/icons/action_log.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/action_log.png -------------------------------------------------------------------------------- /src/ui/icons/add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/add.png -------------------------------------------------------------------------------- /src/ui/icons/application-window-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/application-window-96.png -------------------------------------------------------------------------------- /src/ui/icons/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/application.png -------------------------------------------------------------------------------- /src/ui/icons/application_double.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/application_double.png -------------------------------------------------------------------------------- /src/ui/icons/arrow_refresh_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/arrow_refresh_small.png -------------------------------------------------------------------------------- /src/ui/icons/arrow_rotate_clockwise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/arrow_rotate_clockwise.png -------------------------------------------------------------------------------- /src/ui/icons/blue_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/blue_up.png -------------------------------------------------------------------------------- /src/ui/icons/books.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/books.png -------------------------------------------------------------------------------- /src/ui/icons/broom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/broom.png -------------------------------------------------------------------------------- /src/ui/icons/bullet_arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/bullet_arrow_down.png -------------------------------------------------------------------------------- /src/ui/icons/bullet_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/bullet_arrow_up.png -------------------------------------------------------------------------------- /src/ui/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/cancel.png -------------------------------------------------------------------------------- /src/ui/icons/chart_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/chart_bar.png -------------------------------------------------------------------------------- /src/ui/icons/clock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/clock.png -------------------------------------------------------------------------------- /src/ui/icons/coding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/coding.png -------------------------------------------------------------------------------- /src/ui/icons/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/cog.png -------------------------------------------------------------------------------- /src/ui/icons/computer-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/computer-96.png -------------------------------------------------------------------------------- /src/ui/icons/computer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/computer.png -------------------------------------------------------------------------------- /src/ui/icons/connect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/connect.png -------------------------------------------------------------------------------- /src/ui/icons/control_end.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/control_end.png -------------------------------------------------------------------------------- /src/ui/icons/control_fastforward.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/control_fastforward.png -------------------------------------------------------------------------------- /src/ui/icons/control_repeat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/control_repeat.png -------------------------------------------------------------------------------- /src/ui/icons/control_rewind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/control_rewind.png -------------------------------------------------------------------------------- /src/ui/icons/control_start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/control_start.png -------------------------------------------------------------------------------- /src/ui/icons/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/cross.png -------------------------------------------------------------------------------- /src/ui/icons/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/delete.png -------------------------------------------------------------------------------- /src/ui/icons/deny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/deny.png -------------------------------------------------------------------------------- /src/ui/icons/disk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/disk.png -------------------------------------------------------------------------------- /src/ui/icons/document_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/document_tree.png -------------------------------------------------------------------------------- /src/ui/icons/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/download.png -------------------------------------------------------------------------------- /src/ui/icons/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/error.png -------------------------------------------------------------------------------- /src/ui/icons/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/filter.png -------------------------------------------------------------------------------- /src/ui/icons/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/folder.png -------------------------------------------------------------------------------- /src/ui/icons/fort-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort-96.png -------------------------------------------------------------------------------- /src/ui/icons/fort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort.png -------------------------------------------------------------------------------- /src/ui/icons/fort_deny.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort_deny.png -------------------------------------------------------------------------------- /src/ui/icons/fort_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort_gray.png -------------------------------------------------------------------------------- /src/ui/icons/fort_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort_orange.png -------------------------------------------------------------------------------- /src/ui/icons/fort_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/fort_red.png -------------------------------------------------------------------------------- /src/ui/icons/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/github.png -------------------------------------------------------------------------------- /src/ui/icons/global_telecom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/global_telecom.png -------------------------------------------------------------------------------- /src/ui/icons/green_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/green_down.png -------------------------------------------------------------------------------- /src/ui/icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/help.png -------------------------------------------------------------------------------- /src/ui/icons/hostname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/hostname.png -------------------------------------------------------------------------------- /src/ui/icons/information.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/information.png -------------------------------------------------------------------------------- /src/ui/icons/interface_preferences.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/interface_preferences.png -------------------------------------------------------------------------------- /src/ui/icons/ip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/ip.png -------------------------------------------------------------------------------- /src/ui/icons/ip_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/ip_block.png -------------------------------------------------------------------------------- /src/ui/icons/ip_class.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/ip_class.png -------------------------------------------------------------------------------- /src/ui/icons/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/key.png -------------------------------------------------------------------------------- /src/ui/icons/large_tiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/large_tiles.png -------------------------------------------------------------------------------- /src/ui/icons/lightbulb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/lightbulb.png -------------------------------------------------------------------------------- /src/ui/icons/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/lock.png -------------------------------------------------------------------------------- /src/ui/icons/lock_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/lock_open.png -------------------------------------------------------------------------------- /src/ui/icons/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/magnifier.png -------------------------------------------------------------------------------- /src/ui/icons/page_copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/page_copy.png -------------------------------------------------------------------------------- /src/ui/icons/parking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/parking.png -------------------------------------------------------------------------------- /src/ui/icons/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/pencil.png -------------------------------------------------------------------------------- /src/ui/icons/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/play.png -------------------------------------------------------------------------------- /src/ui/icons/recycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/recycle.png -------------------------------------------------------------------------------- /src/ui/icons/road_sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/road_sign.png -------------------------------------------------------------------------------- /src/ui/icons/save_as.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/save_as.png -------------------------------------------------------------------------------- /src/ui/icons/script.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/script.png -------------------------------------------------------------------------------- /src/ui/icons/script_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/script_code.png -------------------------------------------------------------------------------- /src/ui/icons/script_code_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/script_code_red.png -------------------------------------------------------------------------------- /src/ui/icons/scull.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/scull.png -------------------------------------------------------------------------------- /src/ui/icons/server_components.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/server_components.png -------------------------------------------------------------------------------- /src/ui/icons/speedometer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/speedometer.png -------------------------------------------------------------------------------- /src/ui/icons/standby.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/standby.png -------------------------------------------------------------------------------- /src/ui/icons/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/tick.png -------------------------------------------------------------------------------- /src/ui/icons/time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/time.png -------------------------------------------------------------------------------- /src/ui/icons/widgets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/widgets.png -------------------------------------------------------------------------------- /src/ui/icons/windows-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui/icons/windows-48.png -------------------------------------------------------------------------------- /src/ui/log/logentry.cpp: -------------------------------------------------------------------------------- 1 | #include "logentry.h" 2 | 3 | #include 4 | #include 5 | 6 | QString LogEntry::getAppPath(const QString &kernelPath, quint32 pid) 7 | { 8 | return kernelPath.isEmpty() ? OsUtil::pidToPath(pid) : FileUtil::kernelPathToPath(kernelPath); 9 | } 10 | -------------------------------------------------------------------------------- /src/ui/log/logentry.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGENTRY_H 2 | #define LOGENTRY_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class LogEntry 10 | { 11 | public: 12 | explicit LogEntry() = default; 13 | virtual ~LogEntry() = default; 14 | CLASS_DEFAULT_COPY_MOVE(LogEntry) 15 | 16 | virtual FortLogType type() const = 0; 17 | 18 | protected: 19 | static QString getAppPath(const QString &kernelPath, quint32 pid); 20 | }; 21 | 22 | #endif // LOGENTRY_H 23 | -------------------------------------------------------------------------------- /src/ui/log/logentryapp.cpp: -------------------------------------------------------------------------------- 1 | #include "logentryapp.h" 2 | 3 | LogEntryApp::LogEntryApp(quint32 pid, const QString &kernelPath) : 4 | m_pid(pid), m_kernelPath(kernelPath) 5 | { 6 | } 7 | 8 | QString LogEntryApp::path() const 9 | { 10 | return getAppPath(m_kernelPath, m_pid); 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/log/logentryconn.cpp: -------------------------------------------------------------------------------- 1 | #include "logentryconn.h" 2 | 3 | #include 4 | 5 | void LogEntryConn::setLocalIp4(quint32 ip) 6 | { 7 | m_localIp.v4 = ip; 8 | } 9 | 10 | QByteArrayView LogEntryConn::localIp6View() const 11 | { 12 | return NetUtil::ip6ToArrayView(m_localIp.v6); 13 | } 14 | 15 | void LogEntryConn::setLocalIp6ByView(const QByteArrayView &ip) 16 | { 17 | m_localIp.v6 = NetUtil::arrayViewToIp6(ip); 18 | } 19 | 20 | void LogEntryConn::setRemoteIp4(quint32 ip) 21 | { 22 | m_remoteIp.v4 = ip; 23 | } 24 | 25 | QByteArrayView LogEntryConn::remoteIp6View() const 26 | { 27 | return NetUtil::ip6ToArrayView(m_remoteIp.v6); 28 | } 29 | 30 | void LogEntryConn::setRemoteIp6ByView(const QByteArrayView &ip) 31 | { 32 | m_remoteIp.v6 = NetUtil::arrayViewToIp6(ip); 33 | } 34 | 35 | bool LogEntryConn::isAskPending() const 36 | { 37 | return reason() == FORT_CONN_REASON_ASK_PENDING; 38 | } 39 | -------------------------------------------------------------------------------- /src/ui/log/logentryprocnew.cpp: -------------------------------------------------------------------------------- 1 | #include "logentryprocnew.h" 2 | 3 | LogEntryProcNew::LogEntryProcNew(quint32 pid, const QString &kernelPath) : 4 | m_pid(pid), m_kernelPath(kernelPath) 5 | { 6 | } 7 | 8 | void LogEntryProcNew::setPid(quint32 pid) 9 | { 10 | m_pid = pid; 11 | } 12 | 13 | void LogEntryProcNew::setKernelPath(const QString &kernelPath) 14 | { 15 | m_kernelPath = kernelPath; 16 | } 17 | 18 | QString LogEntryProcNew::path() const 19 | { 20 | return getAppPath(m_kernelPath, m_pid); 21 | } 22 | -------------------------------------------------------------------------------- /src/ui/log/logentryprocnew.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGENTRYPROCNEW_H 2 | #define LOGENTRYPROCNEW_H 3 | 4 | #include "logentry.h" 5 | 6 | class LogEntryProcNew : public LogEntry 7 | { 8 | public: 9 | explicit LogEntryProcNew(quint32 pid = 0, const QString &kernelPath = QString()); 10 | 11 | FortLogType type() const override { return FORT_LOG_TYPE_PROC_NEW; } 12 | 13 | quint32 appId() const { return m_appId; } 14 | void setAppId(quint32 v) { m_appId = v; } 15 | 16 | quint32 pid() const { return m_pid; } 17 | void setPid(quint32 pid); 18 | 19 | QString kernelPath() const { return m_kernelPath; } 20 | void setKernelPath(const QString &kernelPath); 21 | 22 | QString path() const; 23 | 24 | private: 25 | quint32 m_appId = 0; 26 | quint32 m_pid = 0; 27 | QString m_kernelPath; 28 | }; 29 | 30 | #endif // LOGENTRYPROCNEW_H 31 | -------------------------------------------------------------------------------- /src/ui/log/logentrystattraf.cpp: -------------------------------------------------------------------------------- 1 | #include "logentrystattraf.h" 2 | 3 | LogEntryStatTraf::LogEntryStatTraf(quint16 procCount, const quint32 *procTrafBytes) : 4 | m_procCount(procCount), m_procTrafBytes(procTrafBytes) 5 | { 6 | } 7 | 8 | void LogEntryStatTraf::setProcCount(quint16 procCount) 9 | { 10 | m_procCount = procCount; 11 | } 12 | 13 | void LogEntryStatTraf::setProcTrafBytes(const quint32 *procTrafBytes) 14 | { 15 | m_procTrafBytes = procTrafBytes; 16 | } 17 | -------------------------------------------------------------------------------- /src/ui/log/logentrystattraf.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGENTRYSTATTRAF_H 2 | #define LOGENTRYSTATTRAF_H 3 | 4 | #include "logentry.h" 5 | 6 | class LogEntryStatTraf : public LogEntry 7 | { 8 | public: 9 | explicit LogEntryStatTraf(quint16 procCount = 0, const quint32 *procTrafBytes = nullptr); 10 | 11 | FortLogType type() const override { return FORT_LOG_TYPE_STAT_TRAF; } 12 | 13 | quint16 procCount() const { return m_procCount; } 14 | void setProcCount(quint16 procCount); 15 | 16 | const quint32 *procTrafBytes() const { return m_procTrafBytes; } 17 | void setProcTrafBytes(const quint32 *procTrafBytes); 18 | 19 | private: 20 | quint16 m_procCount = 0; 21 | const quint32 *m_procTrafBytes = nullptr; 22 | }; 23 | 24 | #endif // LOGENTRYSTATTRAF_H 25 | -------------------------------------------------------------------------------- /src/ui/log/logentrytime.cpp: -------------------------------------------------------------------------------- 1 | #include "logentrytime.h" 2 | 3 | LogEntryTime::LogEntryTime(qint64 unixTime) : m_unixTime(unixTime) { } 4 | 5 | void LogEntryTime::setSystemTimeChanged(bool systemTimeChanged) 6 | { 7 | m_systemTimeChanged = systemTimeChanged; 8 | } 9 | 10 | void LogEntryTime::setUnixTime(qint64 unixTime) 11 | { 12 | m_unixTime = unixTime; 13 | } 14 | -------------------------------------------------------------------------------- /src/ui/log/logentrytime.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGENTRYTIME_H 2 | #define LOGENTRYTIME_H 3 | 4 | #include "logentry.h" 5 | 6 | class LogEntryTime : public LogEntry 7 | { 8 | public: 9 | explicit LogEntryTime(qint64 unixTime = 0); 10 | 11 | FortLogType type() const override { return FORT_LOG_TYPE_TIME; } 12 | 13 | bool systemTimeChanged() const { return m_systemTimeChanged; } 14 | void setSystemTimeChanged(bool systemTimeChanged); 15 | 16 | qint64 unixTime() const { return m_unixTime; } 17 | void setUnixTime(qint64 unixTime); 18 | 19 | private: 20 | bool m_systemTimeChanged = false; 21 | qint64 m_unixTime = 0; 22 | }; 23 | 24 | #endif // LOGENTRYTIME_H 25 | -------------------------------------------------------------------------------- /src/ui/manager/dberrormanager.h: -------------------------------------------------------------------------------- 1 | #ifndef DBERRORMANAGER_H 2 | #define DBERRORMANAGER_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class DbErrorManager : public QObject, public IocService 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit DbErrorManager(QObject *parent = nullptr); 15 | 16 | void setUp() override; 17 | 18 | private slots: 19 | void checkProfileDir(); 20 | 21 | protected: 22 | virtual void setupTimer(); 23 | 24 | void setupDirInfo(const QString &path); 25 | 26 | private: 27 | DirInfo m_confDir; 28 | }; 29 | 30 | #endif // DBERRORMANAGER_H 31 | -------------------------------------------------------------------------------- /src/ui/manager/dbmanagerbase.cpp: -------------------------------------------------------------------------------- 1 | #include "dbmanagerbase.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | ConfManager *DbManagerBase::confManager() const 8 | { 9 | return IoC(); 10 | } 11 | 12 | FirewallConf *DbManagerBase::conf() const 13 | { 14 | return confManager()->conf(); 15 | } 16 | 17 | SqliteDb *DbManagerBase::sqliteDb() const 18 | { 19 | return confManager()->sqliteDb(); 20 | } 21 | -------------------------------------------------------------------------------- /src/ui/manager/dbmanagerbase.h: -------------------------------------------------------------------------------- 1 | #ifndef DBMANAGERBASE_H 2 | #define DBMANAGERBASE_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class ConfManager; 9 | class FirewallConf; 10 | 11 | class DbManagerBase : public SqliteUtilBase 12 | { 13 | public: 14 | ConfManager *confManager() const; 15 | FirewallConf *conf() const; 16 | SqliteDb *sqliteDb() const override; 17 | }; 18 | 19 | #endif // DBMANAGERBASE_H 20 | -------------------------------------------------------------------------------- /src/ui/manager/drivelistmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef DRIVELISTMANAGER_H 2 | #define DRIVELISTMANAGER_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | class DriveListManager : public QObject, public IocService 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit DriveListManager(QObject *parent = nullptr); 15 | 16 | void setUp() override; 17 | 18 | signals: 19 | void driveMaskChanged(quint32 addedMask, quint32 removedMask); 20 | 21 | public slots: 22 | virtual void onDriveListChanged(); 23 | 24 | protected slots: 25 | virtual void populateDriveMask(); 26 | 27 | private: 28 | void setDriveMask(quint32 driveMask); 29 | 30 | private: 31 | bool m_isUserAdmin = false; 32 | 33 | quint32 m_driveMask = 0; 34 | 35 | TriggerTimer m_driveListTimer; 36 | }; 37 | 38 | #endif // DRIVELISTMANAGER_H 39 | -------------------------------------------------------------------------------- /src/ui/model/appconnlistmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef APPCONNLISTMODEL_H 2 | #define APPCONNLISTMODEL_H 3 | 4 | #include 5 | 6 | #include "connlistmodel.h" 7 | 8 | class AppConnListModel : public ConnListModel 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit AppConnListModel(QObject *parent = nullptr); 14 | 15 | const QString &appPath() const { return m_appPath; } 16 | void setAppPath(const QString &v) { m_appPath = v; } 17 | 18 | protected: 19 | void fillConnIdRange(qint64 &idMin, qint64 &idMax) override; 20 | 21 | bool isConnIdRangeOut( 22 | qint64 oldIdMin, qint64 oldIdMax, qint64 idMin, qint64 idMax) const override; 23 | 24 | qint64 connIdByIndex(int row) const override; 25 | 26 | int doSqlCount() const override { return m_connIds.size(); } 27 | 28 | private: 29 | QString m_appPath; 30 | 31 | QVector m_connIds; 32 | }; 33 | 34 | #endif // APPCONNLISTMODEL_H 35 | -------------------------------------------------------------------------------- /src/ui/model/applistcolumn.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLISTCOLUMN_H 2 | #define APPLISTCOLUMN_H 3 | 4 | enum class AppListColumn : qint8 { 5 | Name = 0, 6 | Zones, 7 | Rule, 8 | Scheduled, 9 | Action, 10 | Group, 11 | FilePath, 12 | CreationTime, 13 | Notes, 14 | Count, 15 | }; 16 | 17 | #endif // APPLISTCOLUMN_H 18 | -------------------------------------------------------------------------------- /src/ui/model/applistmodelheaderdata.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLISTMODELHEADERDATA_H 2 | #define APPLISTMODELHEADERDATA_H 3 | 4 | #include 5 | #include 6 | 7 | class AppListModelHeaderData 8 | { 9 | public: 10 | explicit AppListModelHeaderData(int column, int role = Qt::DisplayRole); 11 | 12 | int role() const { return m_role; } 13 | int column() const { return m_column; } 14 | 15 | QVariant headerDataDisplay() const; 16 | QVariant headerDataDecoration() const; 17 | 18 | private: 19 | int m_role = Qt::DisplayRole; 20 | int m_column = 0; 21 | }; 22 | 23 | #endif // APPLISTMODELHEADERDATA_H 24 | -------------------------------------------------------------------------------- /src/ui/model/appstatcolumn.h: -------------------------------------------------------------------------------- 1 | #ifndef APPSTATCOLUMN_H 2 | #define APPSTATCOLUMN_H 3 | 4 | enum class AppStatColumn : qint8 { 5 | Program = 0, 6 | Download, 7 | Upload, 8 | Count, 9 | }; 10 | 11 | #endif // APPSTATCOLUMN_H 12 | -------------------------------------------------------------------------------- /src/ui/model/connlistcolumn.h: -------------------------------------------------------------------------------- 1 | #ifndef CONNLISTCOLUMN_H 2 | #define CONNLISTCOLUMN_H 3 | 4 | enum class ConnListColumn : qint8 { 5 | Program = 0, 6 | ProcessId, 7 | Protocol, 8 | LocalHostName, 9 | LocalIp, 10 | LocalPort, 11 | RemoteHostName, 12 | RemoteIp, 13 | RemotePort, 14 | Direction, 15 | Action, 16 | Reason, 17 | Time, 18 | Count, 19 | }; 20 | 21 | #endif // CONNLISTCOLUMN_H 22 | -------------------------------------------------------------------------------- /src/ui/model/traflistcolumn.h: -------------------------------------------------------------------------------- 1 | #ifndef TRAFLISTCOLUMN_H 2 | #define TRAFLISTCOLUMN_H 3 | 4 | enum class TrafListColumn : qint8 { 5 | Date = 0, 6 | Download, 7 | Upload, 8 | Sum, 9 | Count, 10 | }; 11 | 12 | #endif // TRAFLISTCOLUMN_H 13 | -------------------------------------------------------------------------------- /src/ui/model/zonesourcewrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef ZONESOURCEWRAPPER_H 2 | #define ZONESOURCEWRAPPER_H 3 | 4 | #include 5 | 6 | class ZoneSourceWrapper : public MapWrapper 7 | { 8 | public: 9 | enum SourceId { 10 | SourceText = 0, 11 | SourceFile, 12 | SourceWinSpyBlock, 13 | SourceFireHol_Level1, 14 | SourceTasix, 15 | }; 16 | 17 | explicit ZoneSourceWrapper(const QVariant &var = {}); 18 | 19 | int id() const; 20 | void setId(int id); 21 | 22 | QString code() const; 23 | QString title() const; 24 | QString zoneType() const; 25 | QString url() const; 26 | QString formData() const; 27 | 28 | bool isTextInline() const; 29 | 30 | static int idByCode(const QString &code); 31 | }; 32 | 33 | #endif // ZONESOURCEWRAPPER_H 34 | -------------------------------------------------------------------------------- /src/ui/model/zonetypewrapper.h: -------------------------------------------------------------------------------- 1 | #ifndef ZONEWRAPPER_H 2 | #define ZONEWRAPPER_H 3 | 4 | #include 5 | 6 | class ZoneTypeWrapper : public MapWrapper 7 | { 8 | public: 9 | enum TypeId { 10 | TypeGeneric = 0, 11 | TypeBgp, 12 | }; 13 | 14 | explicit ZoneTypeWrapper(const QVariant &var = {}); 15 | 16 | int id() const; 17 | void setId(int index); 18 | 19 | QString code() const; 20 | QString title() const; 21 | QString description() const; 22 | bool sort() const; 23 | QString pattern() const; 24 | int emptyNetMask() const; 25 | 26 | static int idByCode(const QString &code); 27 | }; 28 | 29 | #endif // ZONEWRAPPER_H 30 | -------------------------------------------------------------------------------- /src/ui/rpc/appinfomanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef APPINFOMANAGERRPC_H 2 | #define APPINFOMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class RpcManager; 8 | 9 | class AppInfoManagerRpc : public AppInfoManager 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit AppInfoManagerRpc(const QString &filePath, bool noCache, QObject *parent = nullptr); 15 | 16 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 17 | 18 | static void setupServerSignals(RpcManager *rpcManager); 19 | 20 | public slots: 21 | void lookupAppInfo(const QString &appPath) override; 22 | }; 23 | 24 | #endif // APPINFOMANAGERRPC_H 25 | -------------------------------------------------------------------------------- /src/ui/rpc/askpendingmanagerrpc.cpp: -------------------------------------------------------------------------------- 1 | #include "askpendingmanagerrpc.h" 2 | 3 | AskPendingManagerRpc::AskPendingManagerRpc(QObject *parent) : AskPendingManager(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/rpc/askpendingmanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef ASKPENDINGMANAGERRPC_H 2 | #define ASKPENDINGMANAGERRPC_H 3 | 4 | #include 5 | 6 | class AskPendingManagerRpc : public AskPendingManager 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit AskPendingManagerRpc(QObject *parent = nullptr); 12 | }; 13 | 14 | #endif // ASKPENDINGMANAGERRPC_H 15 | -------------------------------------------------------------------------------- /src/ui/rpc/dberrormanagerrpc.cpp: -------------------------------------------------------------------------------- 1 | #include "dberrormanagerrpc.h" 2 | 3 | DbErrorManagerRpc::DbErrorManagerRpc(QObject *parent) : DbErrorManager(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/rpc/dberrormanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef DBERRORMANAGERRPC_H 2 | #define DBERRORMANAGERRPC_H 3 | 4 | #include 5 | 6 | class DbErrorManagerRpc : public DbErrorManager 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit DbErrorManagerRpc(QObject *parent = nullptr); 12 | 13 | protected: 14 | void setupTimer() override { } 15 | }; 16 | 17 | #endif // DBERRORMANAGERRPC_H 18 | -------------------------------------------------------------------------------- /src/ui/rpc/drivelistmanagerrpc.cpp: -------------------------------------------------------------------------------- 1 | #include "drivelistmanagerrpc.h" 2 | 3 | #include 4 | #include 5 | 6 | DriveListManagerRpc::DriveListManagerRpc(QObject *parent) : DriveListManager(parent) { } 7 | 8 | bool DriveListManagerRpc::processServerCommand( 9 | const ProcessCommandArgs &p, ProcessCommandResult & /*r*/) 10 | { 11 | auto driveListManager = IoC(); 12 | 13 | switch (p.command) { 14 | case Control::Rpc_DriveListManager_onDriveListChanged: { 15 | driveListManager->onDriveListChanged(); 16 | return true; 17 | } 18 | default: 19 | return false; 20 | } 21 | } 22 | 23 | void DriveListManagerRpc::onDriveListChanged() 24 | { 25 | IoC()->invokeOnServer(Control::Rpc_DriveListManager_onDriveListChanged); 26 | } 27 | -------------------------------------------------------------------------------- /src/ui/rpc/drivelistmanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef DRIVELISTMANAGERRPC_H 2 | #define DRIVELISTMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class DriveListManagerRpc : public DriveListManager 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit DriveListManagerRpc(QObject *parent = nullptr); 13 | 14 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 15 | 16 | public slots: 17 | void onDriveListChanged() override; 18 | 19 | protected slots: 20 | void populateDriveMask() override { } 21 | }; 22 | 23 | #endif // DRIVELISTMANAGERRPC_H 24 | -------------------------------------------------------------------------------- /src/ui/rpc/logmanagerrpc.cpp: -------------------------------------------------------------------------------- 1 | #include "logmanagerrpc.h" 2 | 3 | LogManagerRpc::LogManagerRpc(QObject *parent) : LogManager(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/rpc/logmanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef LOGMANAGERRPC_H 2 | #define LOGMANAGERRPC_H 3 | 4 | #include 5 | 6 | class LogManagerRpc : public LogManager 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit LogManagerRpc(QObject *parent = nullptr); 12 | 13 | void setActive(bool /*active*/) override { } 14 | 15 | void setUp() override { } 16 | void tearDown() override { } 17 | }; 18 | 19 | #endif // LOGMANAGERRPC_H 20 | -------------------------------------------------------------------------------- /src/ui/rpc/quotamanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef QUOTAMANAGERRPC_H 2 | #define QUOTAMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class RpcManager; 8 | 9 | class QuotaManagerRpc : public QuotaManager 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit QuotaManagerRpc(QObject *parent = nullptr); 15 | 16 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 17 | 18 | static void setupServerSignals(RpcManager *rpcManager); 19 | 20 | protected: 21 | void setupConfManager() override { } 22 | }; 23 | 24 | #endif // QUOTAMANAGERRPC_H 25 | -------------------------------------------------------------------------------- /src/ui/rpc/serviceinfomanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICEINFOMANAGERRPC_H 2 | #define SERVICEINFOMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class RpcManager; 8 | 9 | class ServiceInfoManagerRpc : public ServiceInfoManager 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit ServiceInfoManagerRpc(QObject *parent = nullptr); 15 | 16 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 17 | 18 | public slots: 19 | void trackService(const QString &serviceName) override; 20 | void revertService(const QString &serviceName) override; 21 | 22 | protected: 23 | void setupServiceListMonitor() override { } 24 | }; 25 | 26 | #endif // SERVICEINFOMANAGERRPC_H 27 | -------------------------------------------------------------------------------- /src/ui/rpc/statconnmanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef STATCONNMANAGERRPC_H 2 | #define STATCONNMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class RpcManager; 8 | 9 | class StatConnManagerRpc : public StatConnManager 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit StatConnManagerRpc(const QString &filePath, QObject *parent = nullptr); 15 | 16 | void deleteConn(qint64 connIdTo = 0) override; 17 | 18 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 19 | 20 | static void setupServerSignals(RpcManager *rpcManager); 21 | 22 | protected: 23 | void setupWorker() override { } 24 | void setupConfManager() override { } 25 | 26 | void checkCearConnOnStartup() override { } 27 | void checkCearConnOnExit() override { } 28 | }; 29 | 30 | #endif // STATCONNMANAGERRPC_H 31 | -------------------------------------------------------------------------------- /src/ui/rpc/statmanagerrpc.h: -------------------------------------------------------------------------------- 1 | #ifndef STATMANAGERRPC_H 2 | #define STATMANAGERRPC_H 3 | 4 | #include 5 | #include 6 | 7 | class RpcManager; 8 | 9 | class StatManagerRpc : public StatManager 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit StatManagerRpc(const QString &filePath, QObject *parent = nullptr); 15 | 16 | void setConf(const FirewallConf * /*conf*/) override { } 17 | 18 | bool deleteStatApp(qint64 appId) override; 19 | 20 | bool resetAppTrafTotals() override; 21 | 22 | bool exportMasterBackup(const QString &path) override; 23 | bool importMasterBackup(const QString &path) override; 24 | 25 | static bool processServerCommand(const ProcessCommandArgs &p, ProcessCommandResult &r); 26 | 27 | static void setupServerSignals(RpcManager *rpcManager); 28 | 29 | public slots: 30 | bool clearTraffic() override; 31 | }; 32 | 33 | #endif // STATMANAGERRPC_H 34 | -------------------------------------------------------------------------------- /src/ui/rpc/windowmanagerfake.h: -------------------------------------------------------------------------------- 1 | #ifndef WINDOWMANAGERFAKE_H 2 | #define WINDOWMANAGERFAKE_H 3 | 4 | #include 5 | 6 | class WindowManagerFake : public WindowManager 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit WindowManagerFake(QObject *parent = nullptr); 12 | 13 | void setUp() override { } 14 | void tearDown() override { } 15 | 16 | public slots: 17 | bool exposeHomeWindow() override; 18 | 19 | bool showProgramEditForm(const QString &appPath) override; 20 | 21 | bool checkPassword(bool temporary = false) override; 22 | 23 | void showErrorBox(const QString &text, const QString &title = QString(), 24 | QWidget *parent = nullptr) override; 25 | void showInfoBox(const QString &text, const QString &title = QString(), 26 | QWidget *parent = nullptr) override; 27 | }; 28 | 29 | #endif // WINDOWMANAGERFAKE_H 30 | -------------------------------------------------------------------------------- /src/ui/scripts/restart.bat: -------------------------------------------------------------------------------- 1 | @rem Restart the UI process after Installer 2 | 3 | @echo Waiting for Fort Firewall Installer completion... 4 | 5 | @rem Timeout seconds 6 | @set seconds=30 7 | 8 | :LOOP 9 | 10 | @rem Delay for 1 second 11 | @timeout /t 1 >NUL 12 | 13 | @if not exist inst.tmp @goto END 14 | 15 | @set /a seconds=%seconds%-1 16 | @if "%seconds%" == "0" @goto END 17 | 18 | @goto LOOP 19 | 20 | 21 | :END 22 | start FortFirewall.exe --launch 23 | -------------------------------------------------------------------------------- /src/ui/stat/askpendingmanager.h: -------------------------------------------------------------------------------- 1 | #ifndef ASKPENDINGMANAGER_H 2 | #define ASKPENDINGMANAGER_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | 11 | class LogEntryConn; 12 | 13 | class AskPendingManager : public QObject, public IocService 14 | { 15 | Q_OBJECT 16 | 17 | public: 18 | explicit AskPendingManager(QObject *parent = nullptr); 19 | CLASS_DELETE_COPY_MOVE(AskPendingManager) 20 | 21 | SqliteDb *sqliteDb() const { return m_sqliteDb.data(); } 22 | 23 | void setUp() override; 24 | 25 | void logConn(const LogEntryConn &entry); 26 | 27 | private: 28 | bool setupDb(); 29 | 30 | private: 31 | SqliteDbPtr m_sqliteDb; 32 | }; 33 | 34 | #endif // ASKPENDINGMANAGER_H 35 | -------------------------------------------------------------------------------- /src/ui/stat/deleteconnjob.h: -------------------------------------------------------------------------------- 1 | #ifndef DELETECONNJOB_H 2 | #define DELETECONNJOB_H 3 | 4 | #include "statconnbasejob.h" 5 | 6 | class StatConnManager; 7 | 8 | class DeleteConnJob : public StatConnBaseJob 9 | { 10 | public: 11 | explicit DeleteConnJob(qint64 connIdTo); 12 | 13 | qint64 connIdTo() const { return m_connIdTo; } 14 | 15 | StatConnJobType jobType() const override { return JobTypeDeleteConn; } 16 | 17 | protected: 18 | bool processMerge(const StatConnBaseJob &statJob) override; 19 | void processJob() override; 20 | void emitFinished() override; 21 | 22 | private: 23 | qint64 m_connIdTo = 0; 24 | }; 25 | 26 | #endif // DELETECONNJOB_H 27 | -------------------------------------------------------------------------------- /src/ui/stat/migrations/conn/1.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE app( 2 | app_id INTEGER PRIMARY KEY, 3 | conf_app_id INTEGER, 4 | path TEXT NOT NULL, 5 | creat_time INTEGER NOT NULL 6 | ); 7 | 8 | CREATE UNIQUE INDEX app_path_uk ON app(path); 9 | 10 | CREATE TABLE conn( 11 | conn_id INTEGER PRIMARY KEY, 12 | app_id INTEGER NOT NULL, 13 | conn_time INTEGER NOT NULL, 14 | process_id INTEGER NOT NULL, 15 | reason INTEGER NOT NULL, 16 | blocked BOOLEAN NOT NULL, 17 | inherited BOOLEAN NOT NULL, 18 | inbound BOOLEAN NOT NULL, 19 | ip_proto INTEGER NOT NULL, 20 | local_port INTEGER NOT NULL, 21 | remote_port INTEGER NOT NULL, 22 | local_ip INTEGER, 23 | remote_ip INTEGER, 24 | local_ip6 BLOB, 25 | remote_ip6 BLOB, 26 | zone_id INTEGER, 27 | rule_id INTEGER 28 | ); 29 | 30 | CREATE INDEX conn_app_id_idx ON conn(app_id); 31 | -------------------------------------------------------------------------------- /src/ui/stat/stat_migrations.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | migrations/conn/1.sql 4 | migrations/conn_traf/1.sql 5 | migrations/traf/1.sql 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/ui/stat/statconnworker.cpp: -------------------------------------------------------------------------------- 1 | #include "statconnworker.h" 2 | 3 | #include "statconnmanager.h" 4 | 5 | StatConnWorker::StatConnWorker(StatConnManager *manager) : WorkerObject(manager) { } 6 | -------------------------------------------------------------------------------- /src/ui/stat/statconnworker.h: -------------------------------------------------------------------------------- 1 | #ifndef STATCONNWORKER_H 2 | #define STATCONNWORKER_H 3 | 4 | #include 5 | 6 | class StatConnManager; 7 | 8 | class StatConnWorker : public WorkerObject 9 | { 10 | public: 11 | explicit StatConnWorker(StatConnManager *manager); 12 | 13 | QThread::Priority priority() const override { return QThread::HighPriority; } 14 | 15 | QString workerName() const override { return "StatConnWorker"; } 16 | }; 17 | 18 | #endif // STATCONNWORKER_H 19 | -------------------------------------------------------------------------------- /src/ui/task/taskeditinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "taskeditinfo.h" 2 | 3 | #include "taskinfo.h" 4 | 5 | static_assert(sizeof(TaskEditInfo) == sizeof(quint64), "TaskEditInfo size mismatch"); 6 | 7 | TaskEditInfo::TaskEditInfo(quint64 v) : m_value(v) { } 8 | 9 | void TaskEditInfo::resetToDefault() 10 | { 11 | setEnabled(false); 12 | setRunOnStartup(false); 13 | setDelayStartup(false); 14 | setMaxRetries(0); 15 | setRetrySeconds(0); 16 | setIntervalHours(TaskDefaultIntervalHours); 17 | } 18 | -------------------------------------------------------------------------------- /src/ui/task/taskinfoapppurger.cpp: -------------------------------------------------------------------------------- 1 | #include "taskinfoapppurger.h" 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | #include "taskmanager.h" 9 | 10 | namespace { 11 | 12 | const QLoggingCategory LC("task.appPurger"); 13 | 14 | } 15 | 16 | TaskInfoAppPurger::TaskInfoAppPurger(TaskManager &taskManager) : 17 | TaskInfo(AppPurger, taskManager) { } 18 | 19 | void TaskInfoAppPurger::runTaskWorker() 20 | { 21 | // TODO: Use worker to run in a separate thread to not block the UI 22 | const bool ok = IoC()->purgeApps(); 23 | 24 | qCDebug(LC) << "Purged:" << ok; 25 | 26 | handleFinished(ok); 27 | } 28 | -------------------------------------------------------------------------------- /src/ui/task/taskinfoapppurger.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKINFOAPPPURGER_H 2 | #define TASKINFOAPPPURGER_H 3 | 4 | #include "taskinfo.h" 5 | 6 | class TaskAppPurger; 7 | 8 | class TaskInfoAppPurger : public TaskInfo 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit TaskInfoAppPurger(TaskManager &taskManager); 14 | 15 | public slots: 16 | bool processResult(bool success) override { return success; } 17 | 18 | protected slots: 19 | void setupTaskWorker() override { } 20 | void runTaskWorker() override; 21 | }; 22 | 23 | #endif // TASKINFOAPPPURGER_H 24 | -------------------------------------------------------------------------------- /src/ui/task/tasklistmodelheaderdata.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKLISTMODELHEADERDATA_H 2 | #define TASKLISTMODELHEADERDATA_H 3 | 4 | #include 5 | #include 6 | 7 | class TaskListModelHeaderData 8 | { 9 | public: 10 | explicit TaskListModelHeaderData(int column, int role = Qt::DisplayRole); 11 | 12 | int role() const { return m_role; } 13 | int column() const { return m_column; } 14 | 15 | QVariant headerDataDisplay() const; 16 | QVariant headerDataDecoration() const; 17 | 18 | private: 19 | int m_role = Qt::DisplayRole; 20 | int m_column = 0; 21 | }; 22 | 23 | #endif // TASKLISTMODELHEADERDATA_H 24 | -------------------------------------------------------------------------------- /src/ui/task/taskworker.cpp: -------------------------------------------------------------------------------- 1 | #include "taskworker.h" 2 | 3 | TaskWorker::TaskWorker(QObject *parent) : QObject(parent) { } 4 | -------------------------------------------------------------------------------- /src/ui/task/taskworker.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKWORKER_H 2 | #define TASKWORKER_H 3 | 4 | #include 5 | 6 | class TaskWorker : public QObject 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit TaskWorker(QObject *parent = nullptr); 12 | 13 | signals: 14 | void finished(bool success); 15 | 16 | public slots: 17 | virtual void run() = 0; 18 | virtual void finish(bool success = false) = 0; 19 | }; 20 | 21 | #endif // TASKWORKER_H 22 | -------------------------------------------------------------------------------- /src/ui/user/usersettings.h: -------------------------------------------------------------------------------- 1 | #ifndef USERSETTINGS_H 2 | #define USERSETTINGS_H 3 | 4 | #include 5 | #include 6 | 7 | #include "iniuser.h" 8 | 9 | class UserSettings : public Settings, public IocService 10 | { 11 | Q_OBJECT 12 | 13 | public: 14 | explicit UserSettings(QObject *parent = nullptr); 15 | 16 | IniUser &iniUser() { return m_iniUser; } 17 | const IniUser &iniUser() const { return m_iniUser; } 18 | 19 | void setUp() override; 20 | 21 | protected: 22 | void migrateIniOnLoad() override; 23 | void migrateIniOnWrite() override; 24 | 25 | private: 26 | IniUser m_iniUser; 27 | }; 28 | 29 | #endif // USERSETTINGS_H 30 | -------------------------------------------------------------------------------- /src/ui/util/bitutil.cpp: -------------------------------------------------------------------------------- 1 | #include "bitutil.h" 2 | 3 | #include 4 | 5 | int BitUtil::bitCount(quint32 v) 6 | { 7 | return qPopulationCount(v); 8 | } 9 | 10 | int BitUtil::firstZeroBit(quint32 v) 11 | { 12 | return bitScanForward(~v); 13 | } 14 | 15 | int BitUtil::bitScanForward(quint32 v) 16 | { 17 | return qCountTrailingZeroBits(v); 18 | } 19 | -------------------------------------------------------------------------------- /src/ui/util/bitutil.h: -------------------------------------------------------------------------------- 1 | #ifndef BITUTIL_H 2 | #define BITUTIL_H 3 | 4 | #include 5 | 6 | class BitUtil 7 | { 8 | public: 9 | static int bitCount(quint32 v); 10 | 11 | static int firstZeroBit(quint32 v); 12 | 13 | static int bitScanForward(quint32 v); 14 | }; 15 | 16 | #endif // BITUTIL_H 17 | -------------------------------------------------------------------------------- /src/ui/util/classhelpers.h: -------------------------------------------------------------------------------- 1 | #ifndef CLASSHELPERS_H 2 | #define CLASSHELPERS_H 3 | 4 | // Define a default copy/move constructors and assignment operators 5 | #define CLASS_DEFAULT_COPY_MOVE(Class) \ 6 | Class(const Class &) = default;\ 7 | Class &operator=(const Class &) = default;\ 8 | Class(Class &&) = default;\ 9 | Class &operator=(Class &&) = default; 10 | 11 | // Define a delete copy/move constructors and assignment operators 12 | #define CLASS_DELETE_COPY_MOVE(Class) \ 13 | Class(const Class &) = delete;\ 14 | Class &operator=(const Class &) = delete;\ 15 | Class(Class &&) = delete;\ 16 | Class &operator=(Class &&) = delete; 17 | 18 | #endif // CLASSHELPERS_H 19 | -------------------------------------------------------------------------------- /src/ui/util/conf/addressrange.cpp: -------------------------------------------------------------------------------- 1 | #include "addressrange.h" 2 | -------------------------------------------------------------------------------- /src/ui/util/conf/appparseoptions.cpp: -------------------------------------------------------------------------------- 1 | #include "appparseoptions.h" 2 | 3 | appdata_map_t &AppParseOptions::appsMap(bool isWild, bool isPrefix) 4 | { 5 | return isWild ? wildAppsMap : (isPrefix ? prefixAppsMap : exeAppsMap); 6 | } 7 | 8 | quint32 &AppParseOptions::appsSize(bool isWild, bool isPrefix) 9 | { 10 | return isWild ? wildAppsSize : (isPrefix ? prefixAppsSize : exeAppsSize); 11 | } 12 | -------------------------------------------------------------------------------- /src/ui/util/conf/appparseoptions.h: -------------------------------------------------------------------------------- 1 | #ifndef APPPARSEOPTIONS_H 2 | #define APPPARSEOPTIONS_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | #include "addressrange.h" 11 | 12 | using addrranges_arr_t = QVarLengthArray; 13 | using appdata_map_t = QMap; 14 | 15 | class AppParseOptions 16 | { 17 | public: 18 | appdata_map_t &appsMap(bool isWild, bool isPrefix); 19 | quint32 &appsSize(bool isWild, bool isPrefix); 20 | 21 | public: 22 | bool procWild = false; 23 | 24 | quint32 wildAppsSize = 0; 25 | quint32 prefixAppsSize = 0; 26 | quint32 exeAppsSize = 0; 27 | 28 | appdata_map_t wildAppsMap; 29 | appdata_map_t prefixAppsMap; 30 | appdata_map_t exeAppsMap; 31 | }; 32 | 33 | #endif // APPPARSEOPTIONS_H 34 | -------------------------------------------------------------------------------- /src/ui/util/conf/conf_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | using longs_arr_t = QVector; 6 | using shorts_arr_t = QVector; 7 | using bytes_arr_t = QVector; 8 | using chars_arr_t = QVector; 9 | -------------------------------------------------------------------------------- /src/ui/util/conf/confappswalker.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFAPPSWALKER_H 2 | #define CONFAPPSWALKER_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | class App; 9 | 10 | using walkAppsCallback = bool(App &app); 11 | 12 | class ConfAppsWalker 13 | { 14 | public: 15 | virtual bool walkApps(const std::function &func) const = 0; 16 | }; 17 | 18 | #endif // CONFAPPSWALKER_H 19 | -------------------------------------------------------------------------------- /src/ui/util/conf/confrodata.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFRODATA_H 2 | #define CONFRODATA_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "conf_types.h" 9 | 10 | class ConfRoData 11 | { 12 | public: 13 | explicit ConfRoData(const void *data); 14 | 15 | bool loadAddressList(IpRange &ipRange, uint &bufSize); 16 | bool loadIpRange(IpRange &ipRange, uint &bufSize, bool isIPv6 = false); 17 | 18 | void loadLongs(longs_arr_t &array); 19 | void loadIp6Array(ip6_arr_t &array); 20 | void loadData(void *dst, int elemCount, uint elemSize); 21 | 22 | private: 23 | const char *m_data = nullptr; 24 | }; 25 | 26 | #endif // CONFRODATA_H 27 | -------------------------------------------------------------------------------- /src/ui/util/conf/confruleswalker.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFRULESWALKER_H 2 | #define CONFRULESWALKER_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | class Rule; 11 | 12 | struct RuleSetInfo 13 | { 14 | quint32 index : 24; 15 | quint32 count : 8; 16 | }; 17 | 18 | using ruleset_map_t = QHash; 19 | using ruleid_arr_t = QVector; 20 | 21 | struct WalkRulesArgs 22 | { 23 | ruleset_map_t ruleSetMap; 24 | ruleid_arr_t ruleSetIds; 25 | 26 | quint16 maxRuleId = 0; 27 | quint16 globPreRuleId = 0; 28 | quint16 globPostRuleId = 0; 29 | }; 30 | 31 | using walkRulesCallback = bool(const Rule &rule); 32 | 33 | class ConfRulesWalker 34 | { 35 | public: 36 | virtual bool walkRules( 37 | WalkRulesArgs &wra, const std::function &func) const = 0; 38 | }; 39 | 40 | #endif // CONFRULESWALKER_H 41 | -------------------------------------------------------------------------------- /src/ui/util/conf/confutil.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFUTIL_H 2 | #define CONFUTIL_H 3 | 4 | #include 5 | #include 6 | 7 | class ConfUtil 8 | { 9 | public: 10 | static int ruleMaxCount(); 11 | static int ruleGlobalMaxCount(); 12 | static int ruleSetMaxCount(); 13 | static int ruleDepthFilterMaxCount(); 14 | static int ruleSetDepthMaxCount(); 15 | 16 | static int zoneMaxCount(); 17 | 18 | static QRegularExpressionMatch matchWildcard(const QStringView path); 19 | static bool hasWildcard(const QStringView path); 20 | 21 | static QString parseAppPath(const QStringView line, bool &isWild, bool &isPrefix); 22 | }; 23 | 24 | #endif // CONFUTIL_H 25 | -------------------------------------------------------------------------------- /src/ui/util/dirinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRINFO_H 2 | #define DIRINFO_H 3 | 4 | #include 5 | 6 | using DirHandle = void *; 7 | 8 | #define DIR_INVALID_HANDLE DirHandle(-1) 9 | 10 | class DirInfo final 11 | { 12 | public: 13 | explicit DirInfo(); 14 | ~DirInfo(); 15 | 16 | const QString &path() const { return m_path; } 17 | void setPath(const QString &path); 18 | 19 | bool open(); 20 | void close(); 21 | 22 | bool isOpen() const { return m_handle != DIR_INVALID_HANDLE; } 23 | 24 | bool checkIsValid(); 25 | 26 | private: 27 | DirHandle m_handle = DIR_INVALID_HANDLE; 28 | 29 | QString m_path; 30 | }; 31 | 32 | #endif // DIRINFO_H 33 | -------------------------------------------------------------------------------- /src/ui/util/guiutil.h: -------------------------------------------------------------------------------- 1 | #ifndef GUIUTIL_H 2 | #define GUIUTIL_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | QT_FORWARD_DECLARE_CLASS(QMouseEvent) 9 | 10 | class GuiUtil 11 | { 12 | public: 13 | static void setClipboardData(const QVariant &data); 14 | 15 | static QIcon overlayIcon(const QString &basePath, const QString &overlayPath, 16 | Qt::Alignment alignment = Qt::AlignRight | Qt::AlignBottom); 17 | 18 | static QFont fontBold(); 19 | 20 | static QPoint globalPos(const QMouseEvent *event); 21 | }; 22 | 23 | #endif // GUIUTIL_H 24 | -------------------------------------------------------------------------------- /src/ui/util/iconcache.h: -------------------------------------------------------------------------------- 1 | #ifndef ICONCACHE_H 2 | #define ICONCACHE_H 3 | 4 | #include 5 | #include 6 | 7 | class IconCache 8 | { 9 | public: 10 | static QIcon *findObject(const QString &key); 11 | static bool insertObject(const QString &key, QIcon *iconObj); 12 | 13 | static bool find(const QString &key, QIcon &icon); 14 | static bool insert(const QString &key, const QIcon &icon); 15 | static void remove(const QString &key); 16 | 17 | static QIcon *iconObject(const QString &filePath); 18 | static QIcon icon(const QString &filePath); 19 | 20 | static QPixmap pixmap(const QString &filePath, const QSize &size); 21 | static QPixmap pixmap(const QString &filePath, int extent = 32); 22 | }; 23 | 24 | #endif // ICONCACHE_H 25 | -------------------------------------------------------------------------------- /src/ui/util/ioc/iocservice.h: -------------------------------------------------------------------------------- 1 | #ifndef IOCSERVICE_H 2 | #define IOCSERVICE_H 3 | 4 | class IocService 5 | { 6 | public: 7 | explicit IocService() = default; 8 | virtual ~IocService() = default; 9 | 10 | virtual void setUp() { } 11 | virtual void tearDown() { } 12 | }; 13 | 14 | #endif // IOCSERVICE_H 15 | -------------------------------------------------------------------------------- /src/ui/util/json/jsonutil.cpp: -------------------------------------------------------------------------------- 1 | #include "jsonutil.h" 2 | 3 | #include 4 | 5 | QVariant JsonUtil::jsonToVariant(const QByteArray &data, QString &errorString) 6 | { 7 | QJsonParseError jsonParseError {}; 8 | const QJsonDocument jsonDoc = QJsonDocument::fromJson(data, &jsonParseError); 9 | if (jsonParseError.error != QJsonParseError::NoError) { 10 | errorString = jsonParseError.errorString(); 11 | return QVariant(); 12 | } 13 | 14 | return jsonDoc.toVariant(); 15 | } 16 | -------------------------------------------------------------------------------- /src/ui/util/json/jsonutil.h: -------------------------------------------------------------------------------- 1 | #ifndef JSONUTIL_H 2 | #define JSONUTIL_H 3 | 4 | #include 5 | #include 6 | 7 | class JsonUtil 8 | { 9 | public: 10 | static QVariant jsonToVariant(const QByteArray &data, QString &errorString); 11 | }; 12 | 13 | #endif // JSONUTIL_H 14 | -------------------------------------------------------------------------------- /src/ui/util/model/ftstablesqlmodel.h: -------------------------------------------------------------------------------- 1 | #ifndef FTSTABLESQLMODEL_H 2 | #define FTSTABLESQLMODEL_H 3 | 4 | #include "tablesqlmodel.h" 5 | 6 | class FtsTableSqlModel : public TableSqlModel 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit FtsTableSqlModel(QObject *parent = nullptr); 12 | 13 | QString ftsFilterMatch() const { return m_ftsFilterMatch; } 14 | QString ftsFilter() const { return m_ftsFilter; } 15 | void setFtsFilter(const QString &filter); 16 | 17 | protected: 18 | void fillQueryVars(QVariantHash &vars) const override; 19 | 20 | QString sqlWhere() const override; 21 | virtual QString sqlWhereFts() const = 0; 22 | 23 | private: 24 | QString m_ftsFilter; 25 | QString m_ftsFilterMatch; 26 | }; 27 | 28 | #endif // FTSTABLESQLMODEL_H 29 | -------------------------------------------------------------------------------- /src/ui/util/net/actionrange.h: -------------------------------------------------------------------------------- 1 | #ifndef ACTIONRANGE_H 2 | #define ACTIONRANGE_H 3 | 4 | #include 5 | 6 | #include "textrange.h" 7 | 8 | class ActionRange : public TextRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit ActionRange(QObject *parent = nullptr); 14 | 15 | quint8 actionTypeId() const { return m_actionTypeId; } 16 | 17 | bool isEmpty() const override; 18 | 19 | void clear() override; 20 | 21 | void toList(QStringList &list) const override; 22 | 23 | void write(ConfData &confData) const override; 24 | 25 | protected: 26 | TextRange::ParseError parseText(const QString &text); 27 | 28 | private: 29 | quint8 m_actionTypeId = 0; 30 | }; 31 | 32 | #endif // ACTIONRANGE_H 33 | -------------------------------------------------------------------------------- /src/ui/util/net/arearange.h: -------------------------------------------------------------------------------- 1 | #ifndef AREARANGE_H 2 | #define AREARANGE_H 3 | 4 | #include 5 | 6 | #include "textrange.h" 7 | 8 | class AreaRange : public TextRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit AreaRange(QObject *parent = nullptr); 14 | 15 | bool isLocalhost() const { return m_isLocalhost; } 16 | bool isLan() const { return m_isLan; } 17 | bool isInet() const { return m_isInet; } 18 | 19 | bool isEmpty() const override; 20 | 21 | void clear() override; 22 | 23 | void toList(QStringList &list) const override; 24 | 25 | void write(ConfData &confData) const override; 26 | 27 | protected: 28 | TextRange::ParseError parseText(const QString &text); 29 | 30 | private: 31 | bool m_isLocalhost : 1 = false; 32 | bool m_isLan : 1 = false; 33 | bool m_isInet : 1 = false; 34 | }; 35 | 36 | #endif // AREARANGE_H 37 | -------------------------------------------------------------------------------- /src/ui/util/net/dirrange.h: -------------------------------------------------------------------------------- 1 | #ifndef DIRRANGE_H 2 | #define DIRRANGE_H 3 | 4 | #include 5 | 6 | #include "textrange.h" 7 | 8 | class DirRange : public TextRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit DirRange(QObject *parent = nullptr); 14 | 15 | bool isIn() const { return m_isIn; } 16 | bool isOut() const { return m_isOut; } 17 | 18 | bool isEmpty() const override; 19 | 20 | void clear() override; 21 | 22 | void toList(QStringList &list) const override; 23 | 24 | void write(ConfData &confData) const override; 25 | 26 | protected: 27 | TextRange::ParseError parseText(const QString &text); 28 | 29 | private: 30 | bool m_isIn : 1 = false; 31 | bool m_isOut : 1 = false; 32 | }; 33 | 34 | #endif // DIRRANGE_H 35 | -------------------------------------------------------------------------------- /src/ui/util/net/ipverrange.h: -------------------------------------------------------------------------------- 1 | #ifndef IPVERRANGE_H 2 | #define IPVERRANGE_H 3 | 4 | #include 5 | 6 | #include "textrange.h" 7 | 8 | class IpVerRange : public TextRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit IpVerRange(QObject *parent = nullptr); 14 | 15 | bool isV4() const { return m_isV4; } 16 | bool isV6() const { return m_isV6; } 17 | 18 | bool isEmpty() const override; 19 | 20 | void clear() override; 21 | 22 | void toList(QStringList &list) const override; 23 | 24 | void write(ConfData &confData) const override; 25 | 26 | protected: 27 | TextRange::ParseError parseText(const QString &text); 28 | 29 | private: 30 | bool m_isV4 : 1 = false; 31 | bool m_isV6 : 1 = false; 32 | }; 33 | 34 | #endif // IPVERRANGE_H 35 | -------------------------------------------------------------------------------- /src/ui/util/net/profilerange.h: -------------------------------------------------------------------------------- 1 | #ifndef PROFILERANGE_H 2 | #define PROFILERANGE_H 3 | 4 | #include 5 | 6 | #include "textrange.h" 7 | 8 | class ProfileRange : public TextRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit ProfileRange(QObject *parent = nullptr); 14 | 15 | quint8 profileId() const { return m_profileId; } 16 | 17 | bool isEmpty() const override; 18 | 19 | void clear() override; 20 | 21 | void toList(QStringList &list) const override; 22 | 23 | void write(ConfData &confData) const override; 24 | 25 | protected: 26 | TextRange::ParseError parseText(const QString &text); 27 | 28 | private: 29 | quint8 m_profileId = 0; 30 | }; 31 | 32 | #endif // PROFILERANGE_H 33 | -------------------------------------------------------------------------------- /src/ui/util/net/textrange.cpp: -------------------------------------------------------------------------------- 1 | #include "textrange.h" 2 | 3 | TextRange::TextRange(QObject *parent) : ValueRange(parent) { } 4 | 5 | int TextRange::sizeToWrite() const 6 | { 7 | return sizeof(quint16); 8 | } 9 | 10 | bool TextRange::fromList(const StringViewList &list, bool /*sort*/) 11 | { 12 | clear(); 13 | 14 | int lineNo = 0; 15 | for (const auto &line : list) { 16 | ++lineNo; 17 | 18 | const auto lineTrimmed = line.trimmed(); 19 | if (lineTrimmed.isEmpty() || lineTrimmed.startsWith('#')) // commented line 20 | continue; 21 | 22 | const auto text = line.toString().toUpper(); 23 | 24 | if (parseText(text) != ErrorOk) { 25 | appendErrorDetails(QString("line='%1'").arg(line)); 26 | setErrorLineNo(lineNo); 27 | return false; 28 | } 29 | } 30 | 31 | return true; 32 | } 33 | -------------------------------------------------------------------------------- /src/ui/util/net/textrange.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTRANGE_H 2 | #define TEXTRANGE_H 3 | 4 | #include 5 | 6 | #include "valuerange.h" 7 | 8 | class TextRange : public ValueRange 9 | { 10 | Q_OBJECT 11 | 12 | public: 13 | explicit TextRange(QObject *parent = nullptr); 14 | 15 | int sizeToWrite() const override; 16 | 17 | bool fromList(const StringViewList &list, bool sort = true) override; 18 | 19 | protected: 20 | enum ParseError { 21 | ErrorOk = 0, 22 | ErrorBadText, 23 | }; 24 | 25 | virtual TextRange::ParseError parseText(const QString &text) = 0; 26 | }; 27 | 28 | #endif // TEXTRANGE_H 29 | -------------------------------------------------------------------------------- /src/ui/util/net/valuerangeutil.h: -------------------------------------------------------------------------------- 1 | #ifndef VALUERANGEUTIL_H 2 | #define VALUERANGEUTIL_H 3 | 4 | #include "valuerange.h" 5 | 6 | class ValueRangeUtil 7 | { 8 | public: 9 | static ValueRange *createRangeByType(qint8 type); 10 | }; 11 | 12 | #endif // VALUERANGEUTIL_H 13 | -------------------------------------------------------------------------------- /src/ui/util/processinfo.h: -------------------------------------------------------------------------------- 1 | #ifndef PROCESSINFO_H 2 | #define PROCESSINFO_H 3 | 4 | #include 5 | 6 | using ProcessHandle = void *; 7 | 8 | #define PROC_INVALID_PID quint32(-1) 9 | #define PROC_INVALID_HANDLE nullptr 10 | 11 | class ProcessInfo final 12 | { 13 | public: 14 | explicit ProcessInfo(quint32 pid = PROC_INVALID_PID); 15 | ~ProcessInfo(); 16 | 17 | quint32 pid() const { return m_pid; } 18 | 19 | bool isValid() const { return m_pid != PROC_INVALID_PID && m_handle != PROC_INVALID_HANDLE; } 20 | 21 | QString path(bool isKernelPath = false) const; 22 | 23 | static quint32 currentPid(); 24 | 25 | private: 26 | void openProcess(); 27 | void closeProcess(); 28 | 29 | private: 30 | quint32 m_pid = 0; 31 | ProcessHandle m_handle = PROC_INVALID_HANDLE; 32 | }; 33 | 34 | #endif // PROCESSINFO_H 35 | -------------------------------------------------------------------------------- /src/ui/util/service/service_types.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICE_TYPES_H 2 | #define SERVICE_TYPES_H 3 | 4 | enum ServiceControlCode { 5 | ServiceControlStop = 128, 6 | ServiceControlStopRestarting, 7 | ServiceControlStopUninstall, 8 | }; 9 | 10 | #endif // SERVICE_TYPES_H 11 | -------------------------------------------------------------------------------- /src/ui/util/service/serviceinfo.cpp: -------------------------------------------------------------------------------- 1 | #include "serviceinfo.h" 2 | -------------------------------------------------------------------------------- /src/ui/util/service/servicelistmonitor.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICELISTMONITOR_H 2 | #define SERVICELISTMONITOR_H 3 | 4 | #include 5 | #include 6 | 7 | class ServiceListMonitor : public QObject 8 | { 9 | Q_OBJECT 10 | 11 | public: 12 | explicit ServiceListMonitor(QObject *parent = nullptr); 13 | ~ServiceListMonitor() override; 14 | 15 | void *managerHandle() const { return m_managerHandle; } 16 | 17 | void startMonitor(); 18 | void stopMonitor(); 19 | 20 | void onManagerNotify(const QStringList &createdServiceNames); 21 | 22 | signals: 23 | void servicesCreated(const QStringList &serviceNames); 24 | 25 | private: 26 | void *m_managerHandle = nullptr; 27 | 28 | QByteArray m_buffer; 29 | }; 30 | 31 | #endif // SERVICELISTMONITOR_H 32 | -------------------------------------------------------------------------------- /src/ui/util/service/servicemanageriface.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICEMANAGERIFACE_H 2 | #define SERVICEMANAGERIFACE_H 3 | 4 | #include 5 | 6 | class ServiceManagerIface 7 | { 8 | public: 9 | ServiceManagerIface() = default; 10 | virtual ~ServiceManagerIface() = default; 11 | 12 | virtual bool acceptStop() const { return true; } 13 | virtual bool acceptPauseContinue() const { return true; } 14 | 15 | virtual void initialize(qintptr hstatus); 16 | 17 | void registerDeviceNotification(); 18 | void unregisterDeviceNotification(); 19 | 20 | virtual const wchar_t *serviceName() const = 0; 21 | 22 | virtual void processControl(quint32 code, quint32 eventType) = 0; 23 | 24 | static bool isDeviceEvent(quint32 eventType); 25 | 26 | protected: 27 | void setupAcceptedControls(); 28 | 29 | static void reportStatus(quint32 code = 0); 30 | }; 31 | 32 | #endif // SERVICEMANAGERIFACE_H 33 | -------------------------------------------------------------------------------- /src/ui/util/service/serviceworker.h: -------------------------------------------------------------------------------- 1 | #ifndef SERVICEWORKER_H 2 | #define SERVICEWORKER_H 3 | 4 | #include 5 | 6 | class ServiceManagerIface; 7 | 8 | class ServiceWorker 9 | { 10 | public: 11 | static void run(ServiceManagerIface *manager); 12 | }; 13 | 14 | #endif // SERVICEWORKER_H 15 | -------------------------------------------------------------------------------- /src/ui/util/taskbarbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef TASKBARBUTTON_H 2 | #define TASKBARBUTTON_H 3 | 4 | #include 5 | 6 | QT_FORWARD_DECLARE_CLASS(QWindow) 7 | 8 | struct ITaskbarList4; 9 | 10 | class TaskbarButton final 11 | { 12 | public: 13 | explicit TaskbarButton(); 14 | ~TaskbarButton(); 15 | 16 | void setApplicationBadge(const QIcon &icon); 17 | void setWindowBadge(QWindow *window); 18 | 19 | private: 20 | void setupTaskbarIface(); 21 | void closeTaskbarIface(); 22 | 23 | void setBadgeIcon(const QIcon &icon); 24 | void closeBadgeIcon(); 25 | 26 | private: 27 | using IconHandle = void *; 28 | 29 | ITaskbarList4 *m_taskbarIface = nullptr; 30 | IconHandle m_badgeIcon = nullptr; 31 | }; 32 | 33 | #endif // TASKBARBUTTON_H 34 | -------------------------------------------------------------------------------- /src/ui/util/textareautil.h: -------------------------------------------------------------------------------- 1 | #ifndef TEXTAREAUTIL_H 2 | #define TEXTAREAUTIL_H 3 | 4 | #include 5 | #include 6 | 7 | QT_FORWARD_DECLARE_CLASS(QPlainTextEdit) 8 | 9 | class TextAreaUtil 10 | { 11 | public: 12 | static void moveCursor( 13 | QPlainTextEdit *area, int pos, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor); 14 | 15 | static void selectText(QPlainTextEdit *area, int start, int end); 16 | static QString selectedText(QPlainTextEdit *area); 17 | static void removeSelectedText(QPlainTextEdit *area); 18 | 19 | static void appendText(QPlainTextEdit *area, const QString &text); 20 | 21 | static void moveAllLines(QPlainTextEdit *srcArea, QPlainTextEdit *dstArea); 22 | static void interchangeAllLines(QPlainTextEdit *srcArea, QPlainTextEdit *dstArea); 23 | 24 | static void moveSelectedLines(QPlainTextEdit *srcArea, QPlainTextEdit *dstArea); 25 | }; 26 | 27 | #endif // TEXTAREAUTIL_H 28 | -------------------------------------------------------------------------------- /src/ui/util/threadstorage.h: -------------------------------------------------------------------------------- 1 | #ifndef THREADSTORAGE_H 2 | #define THREADSTORAGE_H 3 | 4 | class ThreadStorage final 5 | { 6 | public: 7 | explicit ThreadStorage(); 8 | ~ThreadStorage(); 9 | 10 | void *value() const; 11 | bool setValue(void *v); 12 | 13 | private: 14 | void createTlsIndex(); 15 | void deleteTlsIndex(); 16 | 17 | private: 18 | constexpr static int BadTlsIndex = -1; 19 | int m_tlsIndex = BadTlsIndex; 20 | }; 21 | 22 | #endif // THREADSTORAGE_H 23 | -------------------------------------------------------------------------------- /src/ui/util/triggertimer.cpp: -------------------------------------------------------------------------------- 1 | #include "triggertimer.h" 2 | 3 | TriggerTimer::TriggerTimer(QObject *parent) : TriggerTimer(/*interval=*/DefaultInterval, parent) { } 4 | 5 | TriggerTimer::TriggerTimer(int interval, QObject *parent) : QTimer(parent) 6 | { 7 | setSingleShot(true); 8 | setInterval(interval); 9 | } 10 | 11 | void TriggerTimer::startTrigger() 12 | { 13 | if (!isActive()) { 14 | start(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/ui/util/triggertimer.h: -------------------------------------------------------------------------------- 1 | #ifndef TRIGGERTIMER_H 2 | #define TRIGGERTIMER_H 3 | 4 | #include 5 | 6 | class TriggerTimer : public QTimer 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | constexpr static int DefaultInterval = 100; 12 | 13 | explicit TriggerTimer(QObject *parent = nullptr); 14 | explicit TriggerTimer(int interval, QObject *parent = nullptr); 15 | 16 | public slots: 17 | void startTrigger(); 18 | }; 19 | 20 | #endif // TRIGGERTIMER_H 21 | -------------------------------------------------------------------------------- /src/ui/util/util_types.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | using StringViewList = QList; 6 | using TokenizeViewResult = QStringTokenizer; 7 | -------------------------------------------------------------------------------- /src/ui/util/variantutil.cpp: -------------------------------------------------------------------------------- 1 | #include "variantutil.h" 2 | 3 | namespace { 4 | 5 | const char *const UserDataKey = "userData"; 6 | 7 | } 8 | 9 | QStringList VariantUtil::listToStringList(const QVariantList &list, Qt::SplitBehavior behavior) 10 | { 11 | QStringList res; 12 | 13 | for (const QVariant &v : list) { 14 | const auto s = v.toString(); 15 | if (s.isEmpty() && behavior == Qt::SkipEmptyParts) 16 | continue; 17 | 18 | res.append(s); 19 | } 20 | 21 | return res; 22 | } 23 | 24 | QVariant VariantUtil::userData(QObject *o) 25 | { 26 | return o->property(UserDataKey); 27 | } 28 | 29 | void VariantUtil::setUserData(QObject *o, const QVariant &v) 30 | { 31 | o->setProperty(UserDataKey, v); 32 | } 33 | -------------------------------------------------------------------------------- /src/ui/util/window/windowstatewatcher.h: -------------------------------------------------------------------------------- 1 | #ifndef WINDOWSTATEWATCHER_H 2 | #define WINDOWSTATEWATCHER_H 3 | 4 | #include "basewindowstatewatcher.h" 5 | 6 | class WindowStateWatcher : public BaseWindowStateWatcher 7 | { 8 | Q_OBJECT 9 | 10 | public: 11 | explicit WindowStateWatcher(QObject *parent = nullptr); 12 | 13 | void restore(QWindow *window, const QSize &defaultSize, const QRect &rect, bool maximized); 14 | 15 | public slots: 16 | void install(QWindow *window); 17 | 18 | private: 19 | void handleWindowPositionChange(QWindow *window); 20 | void handleWindowSizeChange(QWindow *window); 21 | void handleWindowVisibilityChange(QWindow *window); 22 | 23 | private slots: 24 | void onPositionChanged(); 25 | void onSizeChanged(); 26 | void onVisibilityChanged(); 27 | }; 28 | 29 | #endif // WINDOWSTATEWATCHER_H 30 | -------------------------------------------------------------------------------- /src/ui/util/worker/worker_types.h: -------------------------------------------------------------------------------- 1 | #ifndef WORKER_TYPES_H 2 | #define WORKER_TYPES_H 3 | 4 | #include 5 | 6 | class WorkerJob; 7 | class WorkerObject; 8 | class WorkerManager; 9 | 10 | using WorkerJobPtr = QSharedPointer; 11 | 12 | #endif // WORKER_TYPES_H 13 | -------------------------------------------------------------------------------- /src/ui/util/worker/workerjob.cpp: -------------------------------------------------------------------------------- 1 | #include "workerjob.h" 2 | 3 | WorkerJob::WorkerJob(const QString &text) : m_text(text) { } 4 | -------------------------------------------------------------------------------- /src/ui/util/worker/workerjob.h: -------------------------------------------------------------------------------- 1 | #ifndef WORKERJOB_H 2 | #define WORKERJOB_H 3 | 4 | #include 5 | 6 | #include 7 | 8 | #include "worker_types.h" 9 | 10 | class WorkerJob 11 | { 12 | public: 13 | explicit WorkerJob(const QString &text = {}); 14 | virtual ~WorkerJob() = default; 15 | 16 | const QString &text() const { return m_text; } 17 | 18 | virtual bool mergeJob(const WorkerJob &job) 19 | { 20 | Q_UNUSED(job); 21 | return false; 22 | } 23 | 24 | virtual void doJob(WorkerObject &worker) { Q_UNUSED(worker); } 25 | virtual void reportResult(WorkerObject &worker) { Q_UNUSED(worker); } 26 | 27 | private: 28 | const QString m_text; 29 | }; 30 | 31 | #endif // WORKERJOB_H 32 | -------------------------------------------------------------------------------- /src/ui/util/worker/workerobject.cpp: -------------------------------------------------------------------------------- 1 | #include "workerobject.h" 2 | 3 | #include "workerjob.h" 4 | #include "workermanager.h" 5 | 6 | #include 7 | 8 | WorkerObject::WorkerObject(WorkerManager *manager) : m_manager(manager) { } 9 | 10 | QString WorkerObject::workerName() const 11 | { 12 | return manager()->workerName(); 13 | } 14 | 15 | void WorkerObject::run() 16 | { 17 | QThread::currentThread()->setPriority(priority()); 18 | 19 | OsUtil::setCurrentThreadName(workerName()); 20 | 21 | for (;;) { 22 | WorkerJobPtr job = manager()->dequeueJob(); 23 | if (!job) 24 | break; 25 | 26 | doJob(*job); 27 | } 28 | 29 | manager()->workerFinished(this); 30 | } 31 | 32 | void WorkerObject::doJob(WorkerJob &job) 33 | { 34 | job.doJob(*this); 35 | 36 | if (!manager()->aborted()) { 37 | job.reportResult(*this); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/ui/util/worker/workerobject.h: -------------------------------------------------------------------------------- 1 | #ifndef WORKEROBJECT_H 2 | #define WORKEROBJECT_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "worker_types.h" 9 | 10 | class WorkerObject : public QRunnable 11 | { 12 | public: 13 | explicit WorkerObject(WorkerManager *manager); 14 | 15 | WorkerManager *manager() const { return m_manager; } 16 | 17 | virtual QThread::Priority priority() const { return QThread::NormalPriority; } 18 | 19 | virtual QString workerName() const; 20 | 21 | void run() override; 22 | 23 | protected: 24 | virtual void doJob(WorkerJob &job); 25 | 26 | private: 27 | WorkerManager *m_manager = nullptr; 28 | }; 29 | 30 | #endif // WORKEROBJECT_H 31 | -------------------------------------------------------------------------------- /src/ui_bin/3rdparty/3rdparty-include.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH *= $$PWD 2 | -------------------------------------------------------------------------------- /src/ui_bin/3rdparty/3rdparty.pri: -------------------------------------------------------------------------------- 1 | include($$PWD/3rdparty-include.pri) 2 | 3 | include($$PWD/breakpad/breakpad.pri) 4 | -------------------------------------------------------------------------------- /src/ui_bin/3rdparty/breakpad/crashhandler.h: -------------------------------------------------------------------------------- 1 | #ifndef CRASHHANDLER_H 2 | #define CRASHHANDLER_H 3 | 4 | #include 5 | 6 | namespace google_breakpad { 7 | class ExceptionHandler; 8 | } 9 | 10 | class CrashHandler 11 | { 12 | public: 13 | explicit CrashHandler(); 14 | ~CrashHandler(); 15 | 16 | QString fileNamePrefix() const { return m_fileNamePrefix; } 17 | void setFileNamePrefix(const QString &v) { m_fileNamePrefix = v; } 18 | 19 | QString fileNameSuffix() const { return m_fileNameSuffix; } 20 | void setFileNameSuffix(const QString &v) { m_fileNameSuffix = v; } 21 | 22 | void install(const QString &dumpPath); 23 | void uninstall(); 24 | 25 | private: 26 | QString m_fileNamePrefix; 27 | QString m_fileNameSuffix; 28 | 29 | google_breakpad::ExceptionHandler *m_exceptionHandler = nullptr; 30 | }; 31 | 32 | #endif // CRASHHANDLER_H 33 | -------------------------------------------------------------------------------- /src/ui_bin/FortFirewall.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tnodir/fort/b9de57d7c5fbfa49f3e5eb91f088f5ab1665de38/src/ui_bin/FortFirewall.ico -------------------------------------------------------------------------------- /src/version/FortFirewallVersion.pri: -------------------------------------------------------------------------------- 1 | INCLUDEPATH *= $$PWD 2 | 3 | HEADERS += \ 4 | $$PWD/fort_version.h \ 5 | $$PWD/fort_version_l.h 6 | -------------------------------------------------------------------------------- /src/version/fort_version.h: -------------------------------------------------------------------------------- 1 | #ifndef FORT_VERSION_H 2 | #define FORT_VERSION_H 3 | 4 | #define APP_VERSION_MAJOR 3 5 | #define APP_VERSION_MINOR 18 6 | #define APP_VERSION_PATCH 3 7 | #define APP_VERSION_STR "3.18.3" 8 | #define APP_VERSION_BUILD_STR "" 9 | #define APP_VERSION 0x031803 10 | 11 | #define APP_NAME "Fort Firewall" 12 | #define APP_BASE "FortFirewall" 13 | #define APP_PUBLISHER "Nodir Temirkhodjaev" 14 | #define APP_LEGALCOPYRIGHT "Copyright (C) Nodir Temirkhodjaev. All Rights Reserved." 15 | #define APP_URL "https://github.com/tnodir/fort" 16 | #define APP_UPDATES_URL "https://github.com/tnodir/fort/releases" 17 | #define APP_UPDATES_API_URL "https://api.github.com/repos/tnodir/fort/releases/latest" 18 | 19 | #define DRIVER_VERSION 51 20 | 21 | #endif // FORT_VERSION_H 22 | -------------------------------------------------------------------------------- /src/version/fort_version_l.h: -------------------------------------------------------------------------------- 1 | #ifndef FORT_VERSION_L_H 2 | #define FORT_VERSION_L_H 3 | 4 | #include "fort_version.h" 5 | 6 | #define APP_NAME_L L"Fort Firewall" 7 | #define APP_BASE_L L"FortFirewall" 8 | 9 | #endif // FORT_VERSION_L_H 10 | --------------------------------------------------------------------------------