Compare commits
325 Commits
Author | SHA1 | Date | |
---|---|---|---|
5a171f6c67 | |||
|
c2e4ea2258 | ||
|
d2714dca02 | ||
|
5efb25dca3 | ||
|
e67493f5c0 | ||
|
32f7b9344c | ||
|
2041e01caa | ||
|
271fdb0d99 | ||
|
45904db741 | ||
|
a216060447 | ||
|
05a613b501 | ||
|
a9c7f98677 | ||
|
5018232c08 | ||
|
aed09bf798 | ||
|
d299e7d9a1 | ||
|
cf7b013726 | ||
|
b65ba2ebe2 | ||
|
69f6a3135b | ||
|
7dc1a5eda3 | ||
|
168a270c98 | ||
|
c3aa3f0c8f | ||
|
e26da85b5f | ||
|
f665a46346 | ||
|
d541d0a755 | ||
|
0f5bf03e38 | ||
|
3695914226 | ||
|
03dbfce482 | ||
|
6a8d2701b0 | ||
|
ff3e000688 | ||
|
824a11457b | ||
|
b7fa17df4e | ||
|
35af460b7b | ||
|
9aa1f6d715 | ||
|
308f9824b4 | ||
|
bf7521481a | ||
|
e4bcfb1653 | ||
|
a2b1d46900 | ||
|
3f49988cef | ||
|
f80d6aae6b | ||
|
ef2694d7a7 | ||
|
26afd90df9 | ||
|
02432be630 | ||
|
275d71d75f | ||
|
b90f441fde | ||
|
19976819a1 | ||
|
362a11f0bc | ||
|
d94aa4ebf7 | ||
|
2cf876cf32 | ||
|
9993fee336 | ||
|
de0c1f208d | ||
|
25ca2ef1d9 | ||
|
1333967535 | ||
|
e70ebe318d | ||
|
dcdf03f639 | ||
|
8b33ec859b | ||
|
53ff63b792 | ||
|
b46ce1620b | ||
|
4c20a54d7e | ||
|
a73968f98b | ||
|
9033c51bb4 | ||
|
d23429891e | ||
|
cf12b3627e | ||
|
582459d174 | ||
|
08e7390f6c | ||
|
c8eae4b222 | ||
|
54583eae6e | ||
|
634b4c3b41 | ||
|
54c5e7958a | ||
|
6ed45fa7a5 | ||
|
73ba838685 | ||
|
924beacc23 | ||
|
a830fc9372 | ||
|
4c7459e833 | ||
|
00a35d75d2 | ||
|
3e92ec2aae | ||
|
3ac0484f21 | ||
|
cbac07b29e | ||
|
7972f2d6d3 | ||
|
afed94745a | ||
|
c8f260c8e2 | ||
|
edb386d24e | ||
|
f188dea8a7 | ||
|
6fb7da4b5b | ||
|
a35e9b0164 | ||
|
4bc428f8b5 | ||
|
030dec5e14 | ||
|
0898a99878 | ||
|
8dd48fa7cc | ||
|
287405f81a | ||
|
fa27b80060 | ||
|
c2c14c4911 | ||
|
e2deb8751d | ||
|
1fe7d6e21f | ||
|
e68be6d4f1 | ||
|
45d3a42754 | ||
|
cb0410a182 | ||
|
9d349461cf | ||
|
d41a34673b | ||
|
b199b43f58 | ||
|
6d212efe1e | ||
|
d32486d882 | ||
|
5afa65ce68 | ||
|
5b46247df2 | ||
|
bda5433716 | ||
|
835e82ca63 | ||
|
98cdb18d62 | ||
|
cd59a9b294 | ||
|
4780433c4d | ||
|
28a4934a82 | ||
|
4e8bbeed35 | ||
|
f86ef0514b | ||
|
4c004af1ae | ||
|
66e3a737d4 | ||
|
9cf6552c71 | ||
|
f18e74917b | ||
|
b909222db9 | ||
|
0c7868536a | ||
|
fc3956caf1 | ||
|
4cf3c85070 | ||
|
6e57baccaf | ||
|
5ed704e676 | ||
|
eb3753ab25 | ||
|
f9d71577f3 | ||
|
814f2c7904 | ||
|
ceca889be4 | ||
|
696283b1e1 | ||
|
15cc3a8595 | ||
|
e8c3441f29 | ||
|
2de7b26f66 | ||
|
8f35aeb88f | ||
|
b49188c104 | ||
|
f8bf8830be | ||
|
6e6c547460 | ||
|
d287f52ba5 | ||
|
8cc02a07fb | ||
|
28d51484b1 | ||
|
e7d2e0bd38 | ||
|
999914926a | ||
|
e21b2201ab | ||
|
d65ded6072 | ||
|
16662f697b | ||
|
35d740b778 | ||
|
0a16364a7a | ||
|
e9090ab4a9 | ||
|
8bf33d4369 | ||
|
4e76d52671 | ||
|
47dc016da2 | ||
|
8b58f6d383 | ||
|
709431ead2 | ||
|
f90b2d97a7 | ||
|
5416ef841f | ||
|
e4cff2baf4 | ||
|
d047eaf2f2 | ||
|
56f4a75b25 | ||
|
dd05782f80 | ||
|
2c2919160b | ||
|
d7c8490724 | ||
|
1930eeb33c | ||
|
4cc9d0ec11 | ||
|
a7911d48d1 | ||
|
012c725e12 | ||
|
1907d3ac2f | ||
|
87376f1a5c | ||
|
f238ba3a6a | ||
|
abbc5641cd | ||
|
82c3690dcb | ||
|
d3e1c4bca0 | ||
|
b63d883eb2 | ||
|
529e2dd995 | ||
|
1d34a65f38 | ||
|
fea0bedef0 | ||
|
ec8fc79dd7 | ||
|
07e07ee777 | ||
|
5c8dca22d0 | ||
|
dba3eeabaa | ||
|
eabfac7323 | ||
|
3b1701f8b5 | ||
|
b65f761520 | ||
|
fddd4703cc | ||
|
f4e3848fa7 | ||
|
3e0ae6d4cc | ||
|
80f6ccf1d1 | ||
|
863b49eaec | ||
|
4785e358ec | ||
|
f0adbb60e5 | ||
|
61d814d9a2 | ||
|
d166668feb | ||
|
db3bfe9ad7 | ||
|
d2ea9d96d9 | ||
|
d4c82fce0c | ||
|
fe672aa8cc | ||
|
501b43002e | ||
|
43ed28de52 | ||
|
f7352f5c59 | ||
|
d112446d87 | ||
|
b863eedd96 | ||
|
e19c9fef53 | ||
|
10499691b3 | ||
|
bf6d7cd53b | ||
|
11db0fcf8d | ||
|
d44979e95e | ||
|
41f58c1448 | ||
|
2ff76e9c8e | ||
|
0b2cc3ba79 | ||
|
fb430b036e | ||
|
42194295cc | ||
|
558a206a8d | ||
|
172624b494 | ||
|
e64e8810f8 | ||
|
23f4a7f141 | ||
|
d01bb8834a | ||
|
0989a6584b | ||
|
c75f5ec135 | ||
|
d0a0b0eb4a | ||
|
6b7d5d3800 | ||
|
6a3e3b14b3 | ||
|
1ae30b0821 | ||
|
c15e387472 | ||
|
d04a0b0920 | ||
|
e8e0c71c05 | ||
|
516c4b5a22 | ||
|
4e027ec19f | ||
|
4788ad0081 | ||
|
891b3b43ef | ||
|
dee47b0ffc | ||
|
86753070e8 | ||
|
ff78d390ae | ||
|
447bcf8a0e | ||
|
e8a7865e99 | ||
|
fdb5b46ea1 | ||
|
0432579f5b | ||
|
2aa6b43e61 | ||
|
0bade9c42f | ||
|
067115280c | ||
|
873f84c447 | ||
|
4c9c7b00a1 | ||
|
64937105c6 | ||
|
297a18d530 | ||
|
8c0226c9db | ||
|
1abc4a5ac9 | ||
|
7ed3e4e01b | ||
|
dc81a44034 | ||
|
7febf94233 | ||
|
3a0f0c252e | ||
|
209c3b9616 | ||
|
a79cbd4429 | ||
|
eb6bd34489 | ||
|
ccc62ffb67 | ||
|
fc2d338450 | ||
|
eefe196b69 | ||
|
c1e23d38a9 | ||
|
e9c10e262e | ||
|
0d26d6230e | ||
|
0aa162b71b | ||
|
78a4aeb0eb | ||
|
ec5dff4b75 | ||
|
0070f910cc | ||
|
6cba836d98 | ||
|
4600aae8bc | ||
|
79e7aa1926 | ||
|
32683a89b9 | ||
|
43de4e5738 | ||
|
099b4e3792 | ||
|
389726379c | ||
|
9c0dcfe621 | ||
|
75a95661f8 | ||
|
31f52e5d22 | ||
|
78827d833d | ||
|
c0207a108e | ||
|
bb7af8da40 | ||
|
81ff9340cc | ||
|
3d040e9bab | ||
|
3542901781 | ||
|
8b91f43f0b | ||
|
7e622ad33b | ||
|
48a879bd71 | ||
|
bc8655aaeb | ||
|
05f9759d47 | ||
|
51659c7a42 | ||
|
39b8ff834f | ||
|
ea522b3864 | ||
|
79fc70efa1 | ||
|
5e1a4be134 | ||
|
63ae04cd8d | ||
|
4fb02058b1 | ||
|
e02a6a8ce1 | ||
|
2f40ae7913 | ||
|
2e35cd356e | ||
|
341a19a955 | ||
|
f7e39c7834 | ||
|
7660deb787 | ||
|
3fb847a7b6 | ||
|
dbb9ba70c4 | ||
|
ceb7f3bd0f | ||
|
8ce4b03399 | ||
|
44f0b6a06a | ||
|
b37272d875 | ||
|
ea91aa4ca4 | ||
|
cc250a643a | ||
|
9b01fcd4e1 | ||
|
021a870220 | ||
|
ae001b4d7f | ||
|
ec6834d90e | ||
|
de22663156 | ||
|
c3f090d9a0 | ||
|
d17543a075 | ||
|
ace3a141e4 | ||
|
06bd1ce198 | ||
|
9852fb8f68 | ||
|
eccb6b6578 | ||
|
c1457d3ef0 | ||
|
6dab355d87 | ||
|
e81f7714f9 | ||
|
2a3011bdef | ||
|
bf799ce061 | ||
|
a845e32960 | ||
|
028546540c | ||
|
2bf1d0f78e | ||
|
cce4ef4811 | ||
|
4051d2f2c8 | ||
|
8a031f2183 | ||
|
7c013310ab | ||
|
d5f0bbc3bf | ||
|
cb033140ac | ||
|
d582445597 |
5
.gitignore
vendored
@ -15,12 +15,15 @@
|
|||||||
# Source archive
|
# Source archive
|
||||||
*.tar.xz
|
*.tar.xz
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
|
*.sig
|
||||||
|
|
||||||
# Build directory
|
# Build directory
|
||||||
build/
|
build/
|
||||||
sources/build/
|
|
||||||
tmp/
|
tmp/
|
||||||
|
usr/
|
||||||
|
|
||||||
# translations
|
# translations
|
||||||
*.qm
|
*.qm
|
||||||
|
|
||||||
|
# temporary bckps
|
||||||
|
*~
|
||||||
|
12
.gitmodules
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[submodule "sources/3rdparty/tasks"]
|
||||||
|
path = sources/3rdparty/tasks
|
||||||
|
url = https://github.com/mhogomchungu/tasks.git
|
||||||
|
[submodule "sources/3rdparty/pdebug"]
|
||||||
|
path = sources/3rdparty/pdebug
|
||||||
|
url = https://github.com/arcan1s/qtadds-pdebug.git
|
||||||
|
[submodule "sources/3rdparty/language"]
|
||||||
|
path = sources/3rdparty/language
|
||||||
|
url = https://github.com/arcan1s/qtadds-language.git
|
||||||
|
[submodule "sources/3rdparty/task"]
|
||||||
|
path = sources/3rdparty/task
|
||||||
|
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git
|
3
AUTHORS
@ -1,2 +1,5 @@
|
|||||||
Current developers:
|
Current developers:
|
||||||
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
@nosada (Japanese translation)
|
||||||
|
338
CHANGELOG
@ -1,25 +1,327 @@
|
|||||||
Ver.1.0.6:
|
Ver.1.4.9
|
||||||
* [gui] fix error checking
|
---------
|
||||||
|
* library
|
||||||
|
* fix bug with invalid enabled profile definition (#46)
|
||||||
|
* some imrovements inside
|
||||||
|
* plasmoid
|
||||||
|
* change rendering from Qt to native
|
||||||
|
* update plasmoid to recent plasma changes
|
||||||
|
|
||||||
Ver.1.0.5:
|
Ver.1.4.8
|
||||||
+ [plasmoid] added "Start WiFi menu" function
|
---------
|
||||||
* [plasmoid] refactoring
|
* gui
|
||||||
* [plasmoid] edited icon
|
* update profile tab to netclt 1.10 and 1.11 changes
|
||||||
|
* plasmoid
|
||||||
|
* fix bug with no action on link activation
|
||||||
|
|
||||||
Ver.1.0.4:
|
Ver.1.4.7
|
||||||
+ [gui] added Qt5 gui (by default)
|
---------
|
||||||
+ [plasmoid] added notifications
|
* all
|
||||||
* [plasmoid] fix run command with sudo from plasmoid
|
+ implement support of setting of default configuration values while building
|
||||||
|
* fix language component (refer to #45)
|
||||||
|
* gui
|
||||||
|
* more correct work with configuration file
|
||||||
|
* helper
|
||||||
|
* more correct work with configuration file
|
||||||
|
|
||||||
Ver.1.0.3:
|
Ver.1.4.6
|
||||||
+ [plasmoid] edited russian translation
|
---------
|
||||||
* [all] refactoring
|
* all
|
||||||
|
+ implement time logging feature
|
||||||
|
* gui
|
||||||
|
+ implement autoupdate feature
|
||||||
|
- fix invalid profile path for the external editor
|
||||||
|
* library
|
||||||
|
+ implement netctl-auto support to scanWiFi() method (#44)
|
||||||
|
- fix bug with invalid data in netctl-auto profile list output
|
||||||
|
|
||||||
Ver.1.0.2:
|
Ver.1.4.5
|
||||||
* [plasmoid] fix layout margins
|
---------
|
||||||
|
* plasmoid
|
||||||
|
+ add translation support to plugin part
|
||||||
|
* more correct interface painting
|
||||||
|
* more correct configuration interface painting
|
||||||
|
* move plugin from private
|
||||||
|
|
||||||
Ver.1.0.1:
|
Ver.1.4.4
|
||||||
- [all] removed scripts
|
---------
|
||||||
|
* dataengine
|
||||||
|
- fix profile status definition
|
||||||
|
|
||||||
Ver.1.0:
|
Ver.1.4.3
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
- fix clang build (#41)
|
||||||
|
- fix WPA_DRIVERS (#40)
|
||||||
|
* library
|
||||||
|
- fix bug in WpaSup class with invalid returning value
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.4.2
|
||||||
|
---------
|
||||||
|
* gui
|
||||||
|
* remove Update call to the helper
|
||||||
|
|
||||||
|
Ver.1.4.1
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
+ some Easter eggs
|
||||||
|
+ add _DEFAULT_SOURCE to avoid gcc warnings
|
||||||
|
* refactoring
|
||||||
|
* fix cppcheck warnings
|
||||||
|
* update 3rdparty components
|
||||||
|
* fix language defilition
|
||||||
|
* replace General section to Common in settings (see http://doc.qt.io/qt-5/qsettings.html#Format-enum)
|
||||||
|
* gui
|
||||||
|
+ allow to change helper control group from UI (#36)
|
||||||
|
+ allow to open profile in an external editor (#38)
|
||||||
|
+ add IP validators (#34)
|
||||||
|
+ add toolbar configuration
|
||||||
|
+ add notification on hidding to tray
|
||||||
|
+ add returnPressed() signal to lineEdits
|
||||||
|
+ implement needToBeConfigured() signal
|
||||||
|
- remove margins
|
||||||
|
- fix bug with segfault on updating UI with KF5
|
||||||
|
* rewrite ErrorWindow class
|
||||||
|
* split MainWindow class
|
||||||
|
* update WiFi menu to new library functions
|
||||||
|
* improve UI (#25, #28)
|
||||||
|
* more correct component checking (#29, #37)
|
||||||
|
* more correct callbacks with exceptions
|
||||||
|
* dataengine
|
||||||
|
+ add desktop reconfiguration (#30)
|
||||||
|
* improve performance
|
||||||
|
* helper
|
||||||
|
+ add /interface interface
|
||||||
|
+ add /ctrl/{CurrentWiFi,VerboseWiFi} calls
|
||||||
|
+ add /netctl/VerboseProfiles call
|
||||||
|
+ add /netctl/{netctlActiveProfile,netctlProfileList,netctlVerboseProfileList) calls
|
||||||
|
* library
|
||||||
|
+ add NetctlInterface class
|
||||||
|
+ add WpaSup::CurrentWiFi method
|
||||||
|
+ append structures some additional information
|
||||||
|
+ mark Netctl::getProfileDescription() as deprecated
|
||||||
|
+ now WpaSup can connect to already created session (by default)
|
||||||
|
* improve performance
|
||||||
|
* plasmoid
|
||||||
|
+ add desktop reconfiguration (#30)
|
||||||
|
- remove legacy functions from KDE4 plasmoid
|
||||||
|
* improve performance of KF5 plasmoid (#26)
|
||||||
|
* test
|
||||||
|
* fix netctl tests
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.4.0
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
* change settings format from shell-like to ini (#24)
|
||||||
|
* dataengine
|
||||||
|
+ create package for KF5
|
||||||
|
* change NETCTLGUI_DEBUG=yes to DEBUG=yes
|
||||||
|
* update url
|
||||||
|
* gui
|
||||||
|
+ add workarounds to #22 and #23
|
||||||
|
* plasmoid
|
||||||
|
+ create package and plugin for KF5
|
||||||
|
* change NETCTLGUI_DEBUG=yes to DEBUG=yes
|
||||||
|
* update url
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.3.3
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
* update Japanese translation
|
||||||
|
* dataengine
|
||||||
|
- fix #19
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.3.2
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
+ add Japanese translation (thanks to @nosada)
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.3.1
|
||||||
|
---------
|
||||||
|
* gui
|
||||||
|
* more correct calls of boolean DBus methods
|
||||||
|
* edit helper icon
|
||||||
|
* helper
|
||||||
|
* more correct calls of boolean DBus methods
|
||||||
|
* more correct systemd service
|
||||||
|
* add ability to create session bus
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.3.0
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
+ add processes error messages
|
||||||
|
+ add support of several active profiles
|
||||||
|
* some bug fixes and refactoring
|
||||||
|
* rewrite debug messages
|
||||||
|
* dataengine
|
||||||
|
+ add new sources: intIp6, extIp6, netctlAutoStatus
|
||||||
|
* rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7)
|
||||||
|
* change default command to define external IP
|
||||||
|
* change interface list definition
|
||||||
|
* change internal IP definition
|
||||||
|
* gui
|
||||||
|
+ add 3rd party license information
|
||||||
|
+ add system tray icon as an alternative to the plasmoid
|
||||||
|
+ add DBus session interface org.netctlgui.netctlgui
|
||||||
|
+ add dynamic settings load
|
||||||
|
+ add support of openvswitch
|
||||||
|
+ add security notes and API descriptions
|
||||||
|
+ add ability to use helper
|
||||||
|
+ add ability to start minimized/maximized/detached
|
||||||
|
+ add ability to don't save profile from WiFi tab
|
||||||
|
+ add ability to skip external components checking
|
||||||
|
- remove buttons
|
||||||
|
* more correct actions into SettingsWindow
|
||||||
|
* update to library changes
|
||||||
|
* rewrite tables to use toolTip
|
||||||
|
* edit about window
|
||||||
|
* change menuBar
|
||||||
|
* helper
|
||||||
|
+ create daemon DBus system interface org.netctlgui.helper to the library:
|
||||||
|
self control slots, netctl control slots and netctl information slots
|
||||||
|
+ add tests
|
||||||
|
* library
|
||||||
|
+ add custom structures netctlWifiInfo and netctlProfileInfo
|
||||||
|
+ add methods getActiveProfile(), autoGetActiveProfile()
|
||||||
|
+ add slot switchToProfile()
|
||||||
|
+ add slot stopAllProfiles()
|
||||||
|
+ add slot reenableProfile()
|
||||||
|
+ add slots getRecommendedConfiguration()
|
||||||
|
+ add slots forceStartProfile() and forceStopProfile()
|
||||||
|
+ add double quotes to profile names
|
||||||
|
+ add tests
|
||||||
|
- remove functions getProfileDescriptions() and getProfileStatuses()
|
||||||
|
- remove SleepThread class
|
||||||
|
* rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7)
|
||||||
|
* rename getInterfaceList() to getWirelessInterfaceList()
|
||||||
|
* change temporary directory from $HOME/.cache to system one
|
||||||
|
* plasmoid
|
||||||
|
+ add 3rd party license information
|
||||||
|
+ allow plasmoid to use system tray
|
||||||
|
+ add ability to use helper
|
||||||
|
* change all running processes to detached (see #7)
|
||||||
|
* rewrite text label to use tags
|
||||||
|
* update to dataengine changes
|
||||||
|
* edit about window
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.2.0
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
+ add icons
|
||||||
|
+ add support of netctl-auto
|
||||||
|
* changes in the project architecture
|
||||||
|
* refactoring
|
||||||
|
* dataengine
|
||||||
|
+ add debug information (NETCTLGUI_DEBUG=yes)
|
||||||
|
* gui
|
||||||
|
+ add support of macvlan
|
||||||
|
+ add ability to remove profile
|
||||||
|
+ add support of hidden wifi network
|
||||||
|
+ add contextual menu to tables
|
||||||
|
+ add actions menu
|
||||||
|
+ add clear() function to profileTab
|
||||||
|
+ add about window
|
||||||
|
+ more command line options
|
||||||
|
+ add workaround for wireless-wep example
|
||||||
|
+ add shell completions
|
||||||
|
+ add "Report a bug" action
|
||||||
|
- fix possible segfaults with null arrays (#5)
|
||||||
|
* more debug information
|
||||||
|
* change lineEdit_profile to comboBox
|
||||||
|
* refactoring of configuration interface
|
||||||
|
* change setting of the interface to profile tab
|
||||||
|
* rewrite ErrorWindow class
|
||||||
|
* library
|
||||||
|
+ detach backend from frontend
|
||||||
|
+ add error checking
|
||||||
|
+ add doxygen documentation
|
||||||
|
* more debug information
|
||||||
|
* rewrite getSettingsFromProfile() function
|
||||||
|
* plasmoid
|
||||||
|
+ add dataengine configuration
|
||||||
|
+ add about window
|
||||||
|
+ add debug information (NETCTLGUI_DEBUG=yes)
|
||||||
|
* edit configuration interface
|
||||||
|
* change double click event to click event
|
||||||
|
* change class from Applet to PopupApplet
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.1.0 (netctl-1.7 update)
|
||||||
|
-----------------------------
|
||||||
|
* dataengine
|
||||||
|
* change definition if profile is enabled
|
||||||
|
* gui
|
||||||
|
+ add frequency
|
||||||
|
* change definition if profile is enabled
|
||||||
|
* plasmoid
|
||||||
|
+ add menu title
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.6
|
||||||
|
---------
|
||||||
|
* gui
|
||||||
|
* fix error checking
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.5
|
||||||
|
---------
|
||||||
|
* plasmoid
|
||||||
|
+ add "Start WiFi menu" function
|
||||||
|
* refactoring
|
||||||
|
* edit icon
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.4
|
||||||
|
---------
|
||||||
|
* gui
|
||||||
|
+ add Qt5 gui (by default)
|
||||||
|
* plasmoid
|
||||||
|
+ add notifications
|
||||||
|
* fix run command with sudo from plasmoid
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.3
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
* refactoring
|
||||||
|
* plasmoid
|
||||||
|
+ edit russian translation
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.2
|
||||||
|
---------
|
||||||
|
* plasmoid
|
||||||
|
- fix layout margins
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0.1
|
||||||
|
---------
|
||||||
|
* all
|
||||||
|
- remove scripts
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
Ver.1.0
|
||||||
|
-------
|
||||||
First release
|
First release
|
||||||
|
39
PKGBUILD-qt4
@ -1,39 +0,0 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
|
||||||
|
|
||||||
pkgname=netctl-gui-qt4
|
|
||||||
_pkgname=netctl-gui
|
|
||||||
pkgver=1.0.6
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui"
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
url="http://arcanis.name/projects/netctl-gui"
|
|
||||||
license=('GPLv3')
|
|
||||||
depends=('netctl' 'qt4')
|
|
||||||
makedepends=('automoc4' 'cmake' 'desktop-file-utils')
|
|
||||||
optdepends=('kdebase-runtime: sudo support'
|
|
||||||
'kdeplasma-applets-netctl-gui: KDE widget'
|
|
||||||
'sudo: sudo support'
|
|
||||||
'wpa_supplicant: wifi support')
|
|
||||||
provides=('netctl-gui')
|
|
||||||
conflicts=('netctl-gui')
|
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz")
|
|
||||||
install="${_pkgname}.install"
|
|
||||||
md5sums=('dc0e2f22f658d0c0ff159c95eb4fa413')
|
|
||||||
|
|
||||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DUSE_QT5:BOOL=0 -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0"
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
rm -rf "${srcdir}/build"
|
|
||||||
mkdir "${srcdir}/build"
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
cmake ${_cmakekeys} "../${_pkgname}"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
36
PKGBUILD-qt5
@ -1,36 +0,0 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
|
||||||
|
|
||||||
pkgname=netctl-gui
|
|
||||||
pkgver=1.0.6
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
url="http://arcanis.name/projects/netctl-gui"
|
|
||||||
license=('GPLv3')
|
|
||||||
depends=('netctl' 'qt5-base' 'xdg-utils')
|
|
||||||
makedepends=('automoc4' 'cmake' 'qt5-tools')
|
|
||||||
optdepends=('kdebase-runtime: sudo support'
|
|
||||||
'kdeplasma-applets-netctl-gui: KDE widget'
|
|
||||||
'sudo: sudo support'
|
|
||||||
'wpa_supplicant: wifi support')
|
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgname}-${pkgver}-src.tar.xz")
|
|
||||||
install="${pkgname}.install"
|
|
||||||
md5sums=('dc0e2f22f658d0c0ff159c95eb4fa413')
|
|
||||||
|
|
||||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_DATAENGINE:BOOL=0 -DBUILD_PLASMOID:BOOL=0"
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
rm -rf "${srcdir}/build"
|
|
||||||
mkdir "${srcdir}/build"
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
cmake ${_cmakekeys} "../${pkgname}"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
|
||||||
|
|
||||||
pkgname=kdeplasma-applets-netctl-gui
|
|
||||||
_pkgname=netctl-gui
|
|
||||||
pkgver=1.0.6
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="A plasmoid, which interacts with netctl. A part of netctl-gui"
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
url="http://arcanis.name/projects/netctl-gui"
|
|
||||||
license=('GPLv3')
|
|
||||||
depends=('netctl' 'kdebase-workspace')
|
|
||||||
makedepends=('automoc4' 'cmake')
|
|
||||||
optdepends=('kdebase-runtime: sudo support'
|
|
||||||
'netctl-gui: graphical front-end'
|
|
||||||
'netctl-gui-qt4: graphical front-end'
|
|
||||||
'sudo: sudo support')
|
|
||||||
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz")
|
|
||||||
install="${_pkgname}.install"
|
|
||||||
md5sums=('dc0e2f22f658d0c0ff159c95eb4fa413')
|
|
||||||
|
|
||||||
_cmakekeys="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI:BOOL=0"
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
rm -rf "${srcdir}/build"
|
|
||||||
mkdir "${srcdir}/build"
|
|
||||||
}
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
cmake ${_cmakekeys} "../${_pkgname}"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
41
README.md
@ -3,44 +3,48 @@ Netctl GUI
|
|||||||
|
|
||||||
Information
|
Information
|
||||||
-----------
|
-----------
|
||||||
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE.
|
|
||||||
|
|
||||||
**NOTE** LOOKING FOR TRANSLATORS!
|
Qt4/Qt5 graphical interface for netctl. It may work with profiles and may create new profiles. Also it may create a connection to WiFi. Moreover, it provides a widget and DataEngine for KDE4/KF5.
|
||||||
|
|
||||||
|
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/netctl-gui/issues/3)
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
It is recommended to use graphical interface for widget configuration. DataEngine settings are stored in `/usr/share/config/netctl.conf`:
|
|
||||||
|
|
||||||
* `CMD` - netctl command. Default value is `/usr/bin/netctl`.
|
It is recommended to use graphical interface for configuration. Configuration files are:
|
||||||
* `IPCMD` - ip command. `/usr/bin/ip` by default.
|
|
||||||
* `NETDIR` - a directory, which contains subdirectories with names of network interfaces. Default is `/sys/class/net/`.
|
|
||||||
* `EXTIPCMD` - a command, which returns external IP address. Default value is `wget -qO- http://ifconfig.me/ip`.
|
|
||||||
* `EXTIP` - `true` will enable external IP definition. Default is `false`.
|
|
||||||
|
|
||||||
All settings of GUI are stored in `$HOME/.config/netctl-gui.conf`. It is highly recommended to edit it from graphical interface.
|
* `$HOME/.config/netctl-gui.conf` - GUI/helper user configuration
|
||||||
|
* `/etc/netctl-gui.conf` - helper system-wide configuration
|
||||||
|
* `$HOME/.config/plasma-dataengine-netctl.conf` - DataEngine user configuration
|
||||||
|
* `/etc/xdg/plasma-dataengine-netctl.conf` - DataEngine system-wide configuration
|
||||||
|
|
||||||
Instruction
|
Instruction
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* netctl
|
* netctl
|
||||||
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
|
* qt5-base (if Qt5 is used) or qt4 (if Qt4 is used)
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
---------------------
|
---------------------
|
||||||
* kdebase-workspace (widget)
|
|
||||||
|
* kdebase-workspace (KDE4 widget)
|
||||||
|
* plasma-framework (KF5 widget)
|
||||||
* sudo (sudo support)
|
* sudo (sudo support)
|
||||||
* wpa_supplicant (WiFi support)
|
* wpa_supplicant (WiFi support)
|
||||||
|
|
||||||
Make dependencies
|
Make dependencies
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* automoc4
|
* automoc4
|
||||||
* cmake
|
* cmake
|
||||||
* qt5-tools (if Qt5 is used)
|
* qt5-tools (if Qt5 is used)
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* download sources
|
* download sources
|
||||||
* extract it and install the application:
|
* extract it and install the application:
|
||||||
|
|
||||||
@ -52,16 +56,31 @@ Installation
|
|||||||
|
|
||||||
Available cmake flags:
|
Available cmake flags:
|
||||||
|
|
||||||
|
* components:
|
||||||
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
|
* `-DBUILD_DATAENGINE:BOOL=0` - do not build DataEngine
|
||||||
* `-DBUILD_GUI:BOOL=0` - do not build GUI
|
* `-DBUILD_GUI:BOOL=0` - do not build GUI
|
||||||
|
* `-DBUILD_HELPER:BOOL=0` - do not build helper daemon
|
||||||
|
* `-DBUILD_LIBRARY:BOOL=0` - do not build library
|
||||||
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
|
* `-DBUILD_PLASMOID:BOOL=0` - do not build Plasmoid
|
||||||
|
* additional components:
|
||||||
|
* `-DBUILD_DOCS:BOOL=0` - do not build developer documentation
|
||||||
|
* `-DBUILD_TEST:BOOL=1` - build auto tests for the library and the helper
|
||||||
|
* project properties:
|
||||||
|
* `-DDBUS_SYSTEMCONF_PATH=/etc/dbus-1/system.d/` - path to dbus system configuration files
|
||||||
|
* `-DSYSTEMD_SERVICE_PATH=lib/systemd/system` - path to systemd services
|
||||||
|
* `-DUSE_CAPABILITIES:BOOL=0` - do not use setcap to get privileges to the helper
|
||||||
|
* `-DBUILD_KDE4:BOOL=1` - build KDE4 plasmoid instead of KF5 one
|
||||||
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
|
* `-DUSE_QT5:BOOL=0` - use Qt4 instead of Qt5 for GUI
|
||||||
|
|
||||||
Additional information
|
Additional information
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
TODO (wish list)
|
||||||
|
----------------
|
||||||
|
|
||||||
Links
|
Links
|
||||||
-----
|
-----
|
||||||
|
|
||||||
* [Homepage](http://arcanis.name/projects/netctl-gui)
|
* [Homepage](http://arcanis.name/projects/netctl-gui)
|
||||||
* Page on [kde-apps](http://kde-apps.org/content/show.php?content=164490)
|
* Page on [kde-apps](http://kde-apps.org/content/show.php?content=164490)
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/packages/netctl-gui) package
|
* Archlinux [AUR](https://aur.archlinux.org/pkgbase/netctl-gui/) package
|
||||||
|
98
arch/PKGBUILD
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
|
pkgbase=netctl-gui
|
||||||
|
pkgname=('libnetctlgui' 'netctlgui-helper' 'netctl-gui'
|
||||||
|
'plasma5-applet-netctl-gui')
|
||||||
|
pkgver=1.4.9
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Qt4/Qt5 GUI for netctl. Also provides a widget for KDE"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
|
license=('GPL3')
|
||||||
|
makedepends=('cmake' 'extra-cmake-modules' 'plasma-framework' 'qt5-tools')
|
||||||
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${pkgbase}-${pkgver}-src.tar.xz")
|
||||||
|
md5sums=('64c04c36eea017e7c0ddf687d60de128')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build-"{plasmoid,qt5}
|
||||||
|
mkdir "${srcdir}/build-"{plasmoid,qt5}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/build-plasmoid"
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||||
|
-DBUILD_GUI:BOOL=0 \
|
||||||
|
-DBUILD_LIBRARY:BOOL=0 \
|
||||||
|
-DBUILD_HELPER:BOOL=0 \
|
||||||
|
"../${pkgbase}"
|
||||||
|
make
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt5"
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_DATAENGINE:BOOL=0 \
|
||||||
|
-DBUILD_PLASMOID:BOOL=0 \
|
||||||
|
-DUSE_CAPABILITIES:BOOL=0 \
|
||||||
|
"../${pkgbase}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_plasma5-applet-netctl-gui() {
|
||||||
|
pkgdesc="A KF5 plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||||
|
depends=('netctl' 'plasma-framework')
|
||||||
|
optdepends=('netctlgui-helper: DBus helper daemon'
|
||||||
|
'netctl-gui: graphical front-end'
|
||||||
|
'sudo: sudo support')
|
||||||
|
install="plasma-netctl-gui.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-plasmoid"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_libnetctlgui() {
|
||||||
|
pkgdesc="Qt5 library which interacts with netctl. A part of netctl-gui"
|
||||||
|
depends=('netctl' 'qt5-base')
|
||||||
|
optdepends=('netctlgui-helper: DBus helper daemon'
|
||||||
|
'sudo: sudo support'
|
||||||
|
'wpa_supplicant: wifi support')
|
||||||
|
provides=('libnetctlgui-qt4')
|
||||||
|
conflicts=('libnetctlgui-qt4')
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt5/netctlgui"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_netctlgui-helper() {
|
||||||
|
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
|
||||||
|
depends=("libnetctlgui=${pkgver}")
|
||||||
|
provides=('netctlgui-helper-qt4')
|
||||||
|
conflicts=('netctlgui-helper-qt4')
|
||||||
|
backup=('etc/netctl-gui.conf'
|
||||||
|
'etc/dbus-1/system.d/org.netctlgui.helper.conf')
|
||||||
|
install="netctlgui-helper.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt5/helper"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_netctl-gui() {
|
||||||
|
pkgdesc="Qt5 graphical front-end for netctl. A part of netctl-gui"
|
||||||
|
depends=("libnetctlgui=${pkgver}" 'xdg-utils')
|
||||||
|
optdepends=('plasma-netctl-gui: KF5 widget'
|
||||||
|
'netctlgui-helper: DBus helper daemon')
|
||||||
|
provides=('netctl-gui-qt4')
|
||||||
|
conflicts=('netctl-gui-qt4')
|
||||||
|
install="netctl-gui.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt5/gui"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
cd "${srcdir}/build-qt5/resources"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
101
arch/PKGBUILD-qt4
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||||
|
|
||||||
|
pkgbase=netctl-gui-qt4
|
||||||
|
_pkgbase=netctl-gui
|
||||||
|
pkgname=('libnetctlgui-qt4' 'netctlgui-helper-qt4' 'netctl-gui-qt4'
|
||||||
|
'kdeplasma-applets-netctl-gui')
|
||||||
|
pkgver=1.4.9
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Qt4 GUI for netctl. Also provides a widget for KDE4"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/netctl-gui"
|
||||||
|
license=('GPL3')
|
||||||
|
makedepends=('automoc4' 'cmake' 'kdelibs')
|
||||||
|
source=("https://github.com/arcan1s/netctl-gui/releases/download/V.${pkgver}/${_pkgbase}-${pkgver}-src.tar.xz")
|
||||||
|
md5sums=('64c04c36eea017e7c0ddf687d60de128')
|
||||||
|
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build-"{plasmoid,qt4}
|
||||||
|
mkdir "${srcdir}/build-"{plasmoid,qt4}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "${srcdir}/build-plasmoid"
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_GUI:BOOL=0 \
|
||||||
|
-DBUILD_LIBRARY:BOOL=0 \
|
||||||
|
-DBUILD_HELPER:BOOL=0 \
|
||||||
|
-DBUILD_KDE4:BOOL=1 \
|
||||||
|
"../${_pkgbase}"
|
||||||
|
make
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt4"
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DBUILD_DATAENGINE:BOOL=0 \
|
||||||
|
-DBUILD_PLASMOID:BOOL=0 \
|
||||||
|
-DUSE_CAPABILITIES:BOOL=0 \
|
||||||
|
-DUSE_QT5:BOOL=0 \
|
||||||
|
"../${_pkgbase}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_kdeplasma-applets-netctl-gui() {
|
||||||
|
pkgdesc="A KDE4 plasmoid, which interacts with netctl. A part of netctl-gui"
|
||||||
|
depends=('netctl' 'kdebase-workspace')
|
||||||
|
optdepends=('netctlgui-helper-qt4: DBus helper daemon'
|
||||||
|
'netctl-gui-qt4: graphical front-end'
|
||||||
|
'sudo: sudo support')
|
||||||
|
install="kdeplasma-applets-netctl-gui.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-plasmoid"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_libnetctlgui-qt4() {
|
||||||
|
pkgdesc="Qt4 library which interacts with netctl. A part of netctl-gui"
|
||||||
|
depends=('netctl' 'qt4')
|
||||||
|
optdepends=('netctlgui-helper-qt4: DBus helper daemon'
|
||||||
|
'sudo: sudo support'
|
||||||
|
'wpa_supplicant: wifi support')
|
||||||
|
provides=('libnetctlgui')
|
||||||
|
conflicts=('libnetctlgui')
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt4/netctlgui"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_netctlgui-helper-qt4() {
|
||||||
|
pkgdesc="Helper daemon for netctl-gui. A part of netctl-gui"
|
||||||
|
depends=("libnetctlgui-qt4=${pkgver}")
|
||||||
|
provides=('netctlgui-helper')
|
||||||
|
conflicts=('netctlgui-helper')
|
||||||
|
backup=('etc/netctl-gui.conf'
|
||||||
|
'etc/dbus-1/system.d/org.netctlgui.helper.conf')
|
||||||
|
install="netctlgui-helper.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt4/helper"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
package_netctl-gui-qt4() {
|
||||||
|
pkgdesc="Qt4 graphical front-end for netctl. A part of netctl-gui"
|
||||||
|
depends=("libnetctlgui-qt4=${pkgver}")
|
||||||
|
optdepends=('kdeplasma-applets-netctl-gui: KDE widget'
|
||||||
|
'netctlgui-helper-qt4: DBus helper daemon')
|
||||||
|
provides=('netctl-gui')
|
||||||
|
conflicts=('netctl-gui')
|
||||||
|
install="netctl-gui.install"
|
||||||
|
|
||||||
|
cd "${srcdir}/build-qt4/gui"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
cd "${srcdir}/build-qt4/resources"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
14
arch/kdeplasma-applets-netctl-gui.install
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
post_install() {
|
||||||
|
cat << EOF
|
||||||
|
Update plasmoids...
|
||||||
|
EOF
|
||||||
|
kbuildsycoca4 > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_remove() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
11
arch/libnetctlgui.install
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
post_install() {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_remove() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
@ -4,9 +4,9 @@ post_install() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post_upgrade() {
|
post_upgrade() {
|
||||||
post_install
|
post_install "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
post_remove() {
|
post_remove() {
|
||||||
post_install
|
post_install "$1"
|
||||||
}
|
}
|
11
arch/netctlgui-helper.install
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
post_install() {
|
||||||
|
setcap cap_setuid=ep usr/bin/netctlgui-helper 2>/dev/null || chmod +s usr/bin/netctlgui-helper
|
||||||
|
cat << EOF
|
||||||
|
Note: users should be in network group if you want to get them access to the system bus
|
||||||
|
See http://arcanis.name/devs/netctl-gui-security-notes.html#helper
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
14
arch/plasma-netctl-gui.install
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
post_install() {
|
||||||
|
cat << EOF
|
||||||
|
Update plasmoids...
|
||||||
|
EOF
|
||||||
|
kbuildsycoca5 > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_remove() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
@ -1,25 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ARCHIVE="netctl-gui"
|
|
||||||
SRCDIR="sources"
|
SRCDIR="sources"
|
||||||
|
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
|
MINOR=$(grep -m1 PROJECT_VERSION_MINOR ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
|
PATCH=$(grep -m1 PROJECT_VERSION_PATCH ${SRCDIR}/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
|
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
|
||||||
|
ARCHIVE="netctl-gui"
|
||||||
FILES="AUTHORS CHANGELOG COPYING README.md"
|
FILES="AUTHORS CHANGELOG COPYING README.md"
|
||||||
IGNORELIST="build gui/resources/translations/english.qm gui/resources/translations/russian.qm dataengine/dataengine.cppcheck gui/src/gui.cppcheck plasmoid/plasmoid.cppcheck"
|
IGNORELIST="build *.qm *.cppcheck .git* *.kdev4"
|
||||||
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
# update submodules
|
||||||
$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
git submodule update --init --recursive
|
||||||
$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1)
|
|
||||||
# create archive
|
# create archive
|
||||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
||||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||||
cp -r "${SRCDIR}" "${ARCHIVE}"
|
cp -r "${SRCDIR}" "${ARCHIVE}"
|
||||||
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
||||||
for FILE in ${IGNORELIST[*]}; do rm -rf "${ARCHIVE}/${FILE}"; done
|
for FILE in ${IGNORELIST[*]}; do find "${ARCHIVE}" -name "${FILE}" -delete; done
|
||||||
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
||||||
|
ln -sf "../${ARCHIVE}-${VERSION}-src.tar.xz" arch
|
||||||
rm -rf "${ARCHIVE}"
|
rm -rf "${ARCHIVE}"
|
||||||
|
|
||||||
# update md5sum
|
# update md5sum
|
||||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-qt4
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD{,-qt4}
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-qt4
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD{,-qt4}
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-qt5
|
# clear
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-qt5
|
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -delete
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD-widget
|
find arch -type l -xtype l -delete
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD-widget
|
|
||||||
|
Before Width: | Height: | Size: 51 KiB |
BIN
screenshots/de-main.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/gui-about.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
screenshots/gui-main_tab.png
Normal file
After Width: | Height: | Size: 51 KiB |
BIN
screenshots/gui-netctl-auto.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
screenshots/gui-profile_tab.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
screenshots/gui-settings.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
screenshots/gui-wifi_tab.png
Normal file
After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 56 KiB |
Before Width: | Height: | Size: 45 KiB |
BIN
screenshots/plasmoid-config_1.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
screenshots/plasmoid-config_2.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/plasmoid-config_3.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
screenshots/plasmoid-main.png
Normal file
After Width: | Height: | Size: 114 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 47 KiB |
23
sources/.kdev4/netctl-gui.kdev4
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[Buildset]
|
||||||
|
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
|
||||||
|
|
||||||
|
[CMake]
|
||||||
|
Build Directory Count=1
|
||||||
|
Current Build Directory Index=0
|
||||||
|
ProjectRootRelative=./
|
||||||
|
|
||||||
|
[CMake][CMake Build Directory 0]
|
||||||
|
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||||
|
Build Type=Release
|
||||||
|
CMake Binary=file:///usr/bin/cmake
|
||||||
|
Environment Profile=
|
||||||
|
Extra Arguments=
|
||||||
|
Install Directory=file:///usr
|
||||||
|
|
||||||
|
[Defines And Includes][Compiler]
|
||||||
|
Name=GCC
|
||||||
|
Path=gcc
|
||||||
|
Type=GCC
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
VersionControlSupport=kdevgit
|
23
sources/.kdev4/sources.kdev4
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[Buildset]
|
||||||
|
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x14\x00n\x00e\x00t\x00c\x00t\x00l\x00-\x00g\x00u\x00i)
|
||||||
|
|
||||||
|
[CMake]
|
||||||
|
Build Directory Count=1
|
||||||
|
Current Build Directory Index=0
|
||||||
|
ProjectRootRelative=./
|
||||||
|
|
||||||
|
[CMake][CMake Build Directory 0]
|
||||||
|
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
|
||||||
|
Build Type=Debug
|
||||||
|
CMake Binary=file:///usr/bin/cmake
|
||||||
|
Environment Profile=
|
||||||
|
Extra Arguments=
|
||||||
|
Install Directory=file:///usr
|
||||||
|
|
||||||
|
[Defines And Includes][Compiler]
|
||||||
|
Name=GCC
|
||||||
|
Path=gcc
|
||||||
|
Type=GCC
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
VersionControlSupport=kdevgit
|
218
sources/3rdparty/about/about.ui
vendored
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>About</class>
|
||||||
|
<widget class="QWidget" name="About">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>450</width>
|
||||||
|
<height>359</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="tab_About">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>About</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollArea" name="scrollArea_about">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents_about">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>418</width>
|
||||||
|
<height>284</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_name">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_version">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_description">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignJustify|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_links">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_about">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_ackn">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Acknowledgement</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QScrollArea" name="scrollArea_ackn">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents_ackn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>418</width>
|
||||||
|
<height>284</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_translators">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_trdparty">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_ackn">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>229</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_license">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
1
sources/3rdparty/language
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 319125b1fafff9da14c89a94de6ba2852c90c9c2
|
14
sources/3rdparty/language-config.h
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef LANGUAGE_CONFIG_H
|
||||||
|
#define LANGUAGE_CONFIG_H
|
||||||
|
|
||||||
|
|
||||||
|
// put your languages here comma separated
|
||||||
|
// the first language is default language
|
||||||
|
#define LANGUAGES "en,ja,ru"
|
||||||
|
// language key in the configuration file
|
||||||
|
#define LANGUAGE_KEY "LANGUAGE"
|
||||||
|
// name of config section in the file if any
|
||||||
|
#define LANGUAGE_SECTION "Common"
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LANGUAGE_CONFIG_H */
|
41
sources/3rdparty/listmap/listmap.cpp
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "listmap.h"
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> listToMap(const QStringList list)
|
||||||
|
{
|
||||||
|
QMap<QString, QString> map;
|
||||||
|
for (int i=0; i<list.count(); i++) {
|
||||||
|
QStringList str = list[i].split(QString("=="));
|
||||||
|
if (str.count() != 2) continue;
|
||||||
|
map[str[0]] = str[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList mapToList(const QMap<QString, QString> map)
|
||||||
|
{
|
||||||
|
QStringList list;
|
||||||
|
for (int i=0; i<map.keys().count(); i++)
|
||||||
|
list.append(QString("%1==%2").arg(map.keys()[i]).arg(map[map.keys()[i]]));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
29
sources/3rdparty/listmap/listmap.h
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef LISTMAP_H
|
||||||
|
#define LISTMAP_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> listToMap(const QStringList list);
|
||||||
|
QStringList mapToList(const QMap<QString,QString> map);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* LISTMAP_H */
|
1
sources/3rdparty/pdebug
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 75e4a0df83478802bba53345486b42c56713fe09
|
1
sources/3rdparty/task
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit dd52af08c9d6a2c8652d2d5e21bc2a433efb497a
|
1
sources/3rdparty/tasks
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 36f7ac299633e96f246fec160939207257ae0097
|
@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required (VERSION 2.8)
|
cmake_minimum_required (VERSION 2.8.12)
|
||||||
|
|
||||||
cmake_policy (SET CMP0003 OLD)
|
cmake_policy (SET CMP0003 OLD)
|
||||||
cmake_policy (SET CMP0002 OLD)
|
cmake_policy (SET CMP0002 OLD)
|
||||||
@ -6,36 +6,90 @@ cmake_policy (SET CMP0011 NEW)
|
|||||||
cmake_policy (SET CMP0015 NEW)
|
cmake_policy (SET CMP0015 NEW)
|
||||||
|
|
||||||
project (netctl-gui)
|
project (netctl-gui)
|
||||||
|
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||||
|
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||||
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
set (PROJECT_VERSION_MAJOR 1)
|
set (PROJECT_VERSION_MAJOR 1)
|
||||||
set (PROJECT_VERSION_MINOR 0)
|
set (PROJECT_VERSION_MINOR 4)
|
||||||
set (PROJECT_VERSION_PATCH 6)
|
set (PROJECT_VERSION_PATCH 9)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||||
|
string (TIMESTAMP CURRENT_YEAR "%Y")
|
||||||
|
|
||||||
|
message (STATUS "Project: ${PROJECT_NAME}")
|
||||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||||
|
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||||
|
|
||||||
# install options
|
# install options
|
||||||
|
option (USE_CAPABILITIES "Use setcap to set capabilities for the helper" ON)
|
||||||
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
option (USE_QT5 "Use Qt5 instead of Qt4" ON)
|
||||||
|
# configuration
|
||||||
|
include (config-defs.cmake)
|
||||||
|
# components
|
||||||
option (BUILD_GUI "Build GUI" ON)
|
option (BUILD_GUI "Build GUI" ON)
|
||||||
option (BUILD_DATAENGINE "Build data engine" ON)
|
option (BUILD_HELPER "Build helper" ON)
|
||||||
|
option (BUILD_LIBRARY "Build library" ON)
|
||||||
|
option (BUILD_DATAENGINE "Build DataEngine" ON)
|
||||||
option (BUILD_PLASMOID "Build plasmoid" ON)
|
option (BUILD_PLASMOID "Build plasmoid" ON)
|
||||||
|
option (BUILD_KDE4 "Build on KDE4" OFF)
|
||||||
|
if (BUILD_GUI OR BUILD_HELPER)
|
||||||
|
set (BUILD_LIBRARY ON)
|
||||||
|
endif ()
|
||||||
|
if (BUILD_PLASMOID)
|
||||||
|
set (BUILD_DATAENGINE ON)
|
||||||
|
endif ()
|
||||||
|
# documentation
|
||||||
|
option (BUILD_DOCS "Build Doxygen documentation" OFF)
|
||||||
|
if (BUILD_DOCS)
|
||||||
|
set (BUILD_LIBRARY ON)
|
||||||
|
endif ()
|
||||||
|
# test
|
||||||
|
option (BUILD_TEST "Build unit tests" OFF)
|
||||||
|
if (BUILD_TEST)
|
||||||
|
set (BUILD_LIBRARY ON)
|
||||||
|
endif ()
|
||||||
|
# FIXME: dbus path
|
||||||
|
set (DBUS_SYSTEMCONF_PATH "/etc/dbus-1/system.d/" CACHE STRING "Path to dbus system configuration files")
|
||||||
|
set (SYSTEMD_SERVICE_PATH "lib/systemd/system" CACHE STRING "Path to systemd services")
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
set (ADD_CXX_FLAGS "-Wall")
|
set (CMAKE_CXX_FLAGS "-Wall -std=c++11")
|
||||||
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
|
||||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||||
|
# avoid newer gcc warnings
|
||||||
|
add_definitions (-D_DEFAULT_SOURCE)
|
||||||
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
|
set (CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
|
||||||
|
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||||
|
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||||
|
# linker flags
|
||||||
|
set (CMAKE_EXE_LINKER_FLAGS "-lc++abi")
|
||||||
|
set (CMAKE_MODULE_LINKER_FLAGS "-lc++abi")
|
||||||
|
set (CMAKE_SHARED_LINKER_FLAGS "-lc++abi")
|
||||||
else ()
|
else ()
|
||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_subdirectory (icons)
|
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||||
|
|
||||||
if (BUILD_PLASMOID)
|
# resources
|
||||||
set (BUILD_DATAENGINE ON)
|
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||||
|
set (PROJECT_LIBRARY netctlgui)
|
||||||
|
set (PROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
||||||
|
add_subdirectory (${PROJECT_RESOURCE_DIR})
|
||||||
|
|
||||||
|
# components
|
||||||
|
if (BUILD_LIBRARY)
|
||||||
|
add_subdirectory (${PROJECT_LIBRARY})
|
||||||
|
endif ()
|
||||||
|
if (BUILD_HELPER)
|
||||||
|
add_subdirectory (helper)
|
||||||
|
endif ()
|
||||||
|
if (BUILD_TEST)
|
||||||
|
enable_testing ()
|
||||||
|
add_subdirectory (test)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (BUILD_GUI)
|
if (BUILD_GUI)
|
||||||
add_subdirectory (gui)
|
add_subdirectory (gui)
|
||||||
endif ()
|
endif ()
|
||||||
@ -43,5 +97,9 @@ if (BUILD_DATAENGINE)
|
|||||||
add_subdirectory (dataengine)
|
add_subdirectory (dataengine)
|
||||||
endif ()
|
endif ()
|
||||||
if (BUILD_PLASMOID)
|
if (BUILD_PLASMOID)
|
||||||
add_subdirectory (plasmoid)
|
if (BUILD_KDE4)
|
||||||
|
add_subdirectory (plasmoid-kde4)
|
||||||
|
else ()
|
||||||
|
add_subdirectory (plasmoid-kf5)
|
||||||
|
endif (BUILD_KDE4)
|
||||||
endif ()
|
endif ()
|
||||||
|
41
sources/config-defs.cmake
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# default configuration options
|
||||||
|
|
||||||
|
# [Common] section
|
||||||
|
set (CFG_LANGUAGE "en" CACHE STRING "LANGUAGE key")
|
||||||
|
set (CFG_MAINUPDATE "0" CACHE STRING "MAINUPDATE key")
|
||||||
|
set (CFG_WIFIUPDATE "0" CACHE STRING "WIFIUPDATE key")
|
||||||
|
set (CFG_SYSTRAY "true" CACHE STRING "SYSTRAY key")
|
||||||
|
set (CFG_CLOSETOTRAY "true" CACHE STRING "CLOSETOTRAY key")
|
||||||
|
set (CFG_STARTTOTRAY "false" CACHE STRING "STARTTOTRAY key")
|
||||||
|
set (CFG_SKIPCOMPONENTS "false" CACHE STRING "SKIPCOMPONENTS key")
|
||||||
|
|
||||||
|
# [Helper] section
|
||||||
|
set (CFG_USE_HELPER "true" CACHE STRING "USE_HELPER key")
|
||||||
|
set (CFG_FORCE_SUDO "false" CACHE STRING "FORCE_SUDO key")
|
||||||
|
set (CFG_CLOSE_HELPER "false" CACHE STRING "CLOSE_HELPER key")
|
||||||
|
set (CFG_HELPER_PATH "netctlgui-helper" CACHE STRING "HELPER_PATH key")
|
||||||
|
set (CFG_HELPER_SERVICE "netctlgui-helper.service" CACHE STRING "HELPER_SERVICE key")
|
||||||
|
|
||||||
|
# [netctl] section
|
||||||
|
set (CFG_SYSTEMCTL_PATH "systemctl" CACHE STRING "SYSTEMCTL_PATH key")
|
||||||
|
set (CFG_NETCTL_PATH "netctl" CACHE STRING "NETCTL_PATH key")
|
||||||
|
set (CFG_NETCTLAUTO_PATH "netctl-auto" CACHE STRING "NETCTLAUTO_PATH key")
|
||||||
|
set (CFG_NETCTLAUTO_SERVICE "netctl-auto" CACHE STRING "NETCTLAUTO_SERVICE key")
|
||||||
|
set (CFG_PROFILE_DIR "/etc/netctl/" CACHE STRING "PROFILE_DIR key")
|
||||||
|
|
||||||
|
# [sudo] section
|
||||||
|
set (CFG_SUDO_PATH "kdesu" CACHE STRING "SUDO_PATH key")
|
||||||
|
|
||||||
|
# [wpa_supplicant] section
|
||||||
|
set (CFG_WPASUP_PATH "wpa_supplicant" CACHE STRING "WPASUP_PATH key")
|
||||||
|
set (CFG_WPACLI_PATH "wpa_cli" CACHE STRING "WPACLI_PATH key")
|
||||||
|
set (CFG_PID_FILE "/run/wpa_supplicant_$i.pid" CACHE STRING "PID_FILE key")
|
||||||
|
set (CFG_WPA_DRIVERS "nl80211,wext" CACHE STRING "WPA_DRIVERS key")
|
||||||
|
set (CFG_CTRL_DIR "/run/wpa_supplicant" CACHE STRING "CTRL_DIR key")
|
||||||
|
set (CFG_CTRL_GROUP "users" CACHE STRING "CTRL_GROUP key")
|
||||||
|
|
||||||
|
# [Other] section
|
||||||
|
set (CFG_EDITOR_PATH "gvim" CACHE STRING "EDITOR_PATH key")
|
||||||
|
set (CFG_IFACE_DIR "/sys/class/net/" CACHE STRING "IFACE_DIR key")
|
||||||
|
set (CFG_RFKILL_DIR "/sys/class/rfkill/" CACHE STRING "RFKILL_DIR key")
|
||||||
|
set (CFG_PREFERED_IFACE "" CACHE STRING "PREFERED_IFACE key")
|
@ -3,26 +3,71 @@ set (SUBPROJECT plasma_engine_netctl)
|
|||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
# find required libaries
|
# find required libaries
|
||||||
|
if (BUILD_KDE4)
|
||||||
find_package (KDE4 REQUIRED)
|
find_package (KDE4 REQUIRED)
|
||||||
include (KDE4Defaults)
|
include (KDE4Defaults)
|
||||||
|
|
||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||||
|
else ()
|
||||||
|
find_package (Qt5 REQUIRED COMPONENTS Widgets Network)
|
||||||
|
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||||
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
find_package(KF5 REQUIRED COMPONENTS Plasma Service)
|
||||||
|
|
||||||
|
include (KDEInstallDirs)
|
||||||
|
include (KDECMakeSettings)
|
||||||
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||||
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
|
${Qt5Network_INCLUDE_DIRS})
|
||||||
|
set (KDE_INCLUDE ${ConfigCore_INCLUDE_DIR}
|
||||||
|
${CoreAddons_INCLUDE_DIR}
|
||||||
|
${Plasma_INCLUDE_DIR}
|
||||||
|
${Service_INCLUDE_DIR})
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${PROJECT_TRDPARTY_DIR}
|
||||||
|
${Qt_INCLUDE}
|
||||||
|
${KDE_INCLUDE})
|
||||||
|
|
||||||
set (PLUGIN_NAME ${SUBPROJECT})
|
set (PLUGIN_NAME ${SUBPROJECT})
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
if (BUILD_KDE4)
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||||
|
else ()
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||||
|
endif ()
|
||||||
|
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
|
|
||||||
# prepare
|
# prepare
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
# make
|
# make
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
if (BUILD_KDE4)
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
|
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
|
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY})
|
||||||
|
else ()
|
||||||
|
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
|
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES})
|
||||||
|
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
endif ()
|
||||||
|
|
||||||
# install
|
# install
|
||||||
|
if (BUILD_KDE4)
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||||
|
else ()
|
||||||
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||||
|
endif ()
|
||||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="1">
|
|
||||||
<libraries>
|
|
||||||
<library>qt</library>
|
|
||||||
</libraries>
|
|
||||||
</project>
|
|
@ -1,18 +0,0 @@
|
|||||||
# Configuration file for netctl data engine
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
# command
|
|
||||||
CMD=/usr/bin/netctl
|
|
||||||
# ip command
|
|
||||||
IPCMD=/usr/bin/ip
|
|
||||||
|
|
||||||
## Network
|
|
||||||
# path to list of network devices
|
|
||||||
NETDIR=/sys/class/net/
|
|
||||||
|
|
||||||
## External IP
|
|
||||||
# external ip check command
|
|
||||||
EXTIPCMD=wget -qO- http://ifconfig.me/ip
|
|
||||||
# 'true' - check external IP
|
|
||||||
EXTIP=false
|
|
||||||
|
|
@ -18,237 +18,285 @@
|
|||||||
#include "netctl.h"
|
#include "netctl.h"
|
||||||
|
|
||||||
#include <Plasma/DataContainer>
|
#include <Plasma/DataContainer>
|
||||||
#include <KDE/KGlobal>
|
|
||||||
#include <KDE/KStandardDirs>
|
#include <QDebug>
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QProcess>
|
#include <QNetworkInterface>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <QSettings>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <task/taskadds.h>
|
||||||
|
#include <version.h>
|
||||||
|
|
||||||
|
// KF5-KDE4 compability
|
||||||
|
#ifdef BUILD_KDE4
|
||||||
|
#include <KGlobal>
|
||||||
|
#include <KStandardDirs>
|
||||||
|
#else
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
|
|
||||||
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
Netctl::Netctl(QObject *parent, const QVariantList &args)
|
||||||
: Plasma::DataEngine(parent, args)
|
: Plasma::DataEngine(parent, args)
|
||||||
{
|
{
|
||||||
Q_UNUSED(args)
|
Q_UNUSED(args)
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
|
#endif /* QT_VERSION >= 0x050000 */
|
||||||
|
// debug
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
debug = (debugEnv == QString("yes"));
|
||||||
|
|
||||||
setMinimumPollingInterval(333);
|
setMinimumPollingInterval(333);
|
||||||
readConfiguration();
|
readConfiguration();
|
||||||
|
initSources();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Netctl::~Netctl()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::sources() const
|
QStringList Netctl::sources() const
|
||||||
{
|
{
|
||||||
QStringList sources;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
sources.append(QString("currentProfile"));
|
QStringList sources;
|
||||||
sources.append(QString("extIp"));
|
sources.append(QString("active"));
|
||||||
|
sources.append(QString("current"));
|
||||||
|
sources.append(QString("extip4"));
|
||||||
|
sources.append(QString("extip6"));
|
||||||
|
sources.append(QString("info"));
|
||||||
sources.append(QString("interfaces"));
|
sources.append(QString("interfaces"));
|
||||||
sources.append(QString("intIp"));
|
sources.append(QString("intip4"));
|
||||||
|
sources.append(QString("intip6"));
|
||||||
|
sources.append(QString("netctlauto"));
|
||||||
sources.append(QString("profiles"));
|
sources.append(QString("profiles"));
|
||||||
sources.append(QString("statusBool"));
|
sources.append(QString("status"));
|
||||||
sources.append(QString("statusString"));
|
|
||||||
|
|
||||||
return sources;
|
return sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Netctl::getCmdOutput(const QString cmd) const
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||||
|
|
||||||
|
TaskResult process = runTask(cmd);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||||
|
|
||||||
|
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Netctl::readConfiguration()
|
void Netctl::readConfiguration()
|
||||||
{
|
{
|
||||||
// default configuration
|
if (debug) qDebug() << PDEBUG;
|
||||||
QMap<QString, QString> rawConfig;
|
|
||||||
rawConfig[QString("CMD")] = QString("/usr/bin/netctl");
|
|
||||||
rawConfig[QString("EXTIP")] = QString("false");
|
|
||||||
rawConfig[QString("EXTIPCMD")] = QString("wget -qO- http://ifconfig.me/ip");
|
|
||||||
rawConfig[QString("IPCMD")] = QString("/usr/bin/ip");
|
|
||||||
rawConfig[QString("NETDIR")] = QString("/sys/class/net/");
|
|
||||||
|
|
||||||
QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf");
|
QString fileName;
|
||||||
QFile confFile(fileName);
|
#ifdef BUILD_KDE4
|
||||||
bool ok = confFile.open(QIODevice::ReadOnly);
|
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-netctl.conf");
|
||||||
if (!ok) {
|
#else
|
||||||
configuration = updateConfiguration(rawConfig);
|
fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
||||||
return;
|
#endif /* BUILD_KDE4 */
|
||||||
}
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QString fileStr;
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
QStringList value;
|
|
||||||
while (true) {
|
|
||||||
fileStr = QString(confFile.readLine()).trimmed();
|
|
||||||
if (fileStr[0] == QChar('#')) continue;
|
|
||||||
if (fileStr[0] == QChar(';')) continue;
|
|
||||||
if (fileStr.contains(QChar('='))) {
|
|
||||||
value.clear();
|
|
||||||
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
|
|
||||||
value.append(fileStr.split(QChar('='))[i]);
|
|
||||||
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
|
|
||||||
}
|
|
||||||
if (confFile.atEnd())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
confFile.close();
|
|
||||||
configuration = updateConfiguration(rawConfig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Netctl commands"));
|
||||||
|
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("netctl"));
|
||||||
|
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("netctl-auto"));
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
QMap<QString, QString> Netctl::updateConfiguration(const QMap<QString, QString> rawConfig)
|
settings.beginGroup(QString("External IP"));
|
||||||
{
|
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false"));
|
||||||
QMap<QString, QString> config;
|
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com"));
|
||||||
QString key, value;
|
configuration[QString("EXTIP6")] = settings.value(QString("EXTIP6"), QString("false"));
|
||||||
// remove spaces and copy source map
|
configuration[QString("EXTIP6CMD")] = settings.value(QString("EXTIP6CMD"), QString("curl ip6.telize.com"));
|
||||||
for (int i=0; i<rawConfig.keys().count(); i++) {
|
settings.endGroup();
|
||||||
key = rawConfig.keys()[i];
|
|
||||||
value = rawConfig[key];
|
|
||||||
key.remove(QChar(' '));
|
|
||||||
if ((key != QString("CMD")) &&
|
|
||||||
(key != QString("EXTIPCMD")) &&
|
|
||||||
(key != QString("IPCMD")))
|
|
||||||
value.remove(QChar(' '));
|
|
||||||
config[key] = value;
|
|
||||||
}
|
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::sourceRequestEvent(const QString &name)
|
bool Netctl::sourceRequestEvent(const QString &name)
|
||||||
{
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Source name" << name;
|
||||||
|
|
||||||
return updateSourceEvent(name);
|
return updateSourceEvent(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getCurrentProfile(const QString cmd)
|
QString Netctl::getExtIp(const QString cmd) const
|
||||||
{
|
{
|
||||||
QProcess command;
|
if (debug) qDebug() << PDEBUG;
|
||||||
QString profile = QString("");
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||||
command.start(cmd + QString(" list"));
|
|
||||||
command.waitForFinished(-1);
|
return getCmdOutput(cmd);
|
||||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
}
|
||||||
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
|
||||||
for (int i=0; i<profileList.count(); i++)
|
|
||||||
if (profileList[i][0] == QChar('*')) {
|
QString Netctl::getInfo(const QStringList profiles, const QStringList statuses) const
|
||||||
profile = profileList[i];
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (profiles.count() != statuses.count()) return QString("N\\A");
|
||||||
|
|
||||||
|
QStringList list;
|
||||||
|
for (int i=0; i<profiles.count(); i++)
|
||||||
|
list.append(QString("%1 (%2)").arg(profiles.at(i)).arg(statuses.at(i)));
|
||||||
|
if (list.isEmpty()) list.append(QString("N\\A"));
|
||||||
|
|
||||||
|
return list.join(QString(" | "));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList Netctl::getInterfaceList() const
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QList<QNetworkInterface> rawList = QNetworkInterface::allInterfaces();
|
||||||
|
QStringList interfacesList;
|
||||||
|
foreach(QNetworkInterface interface, rawList)
|
||||||
|
interfacesList.append(interface.name());
|
||||||
|
|
||||||
|
return interfacesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Netctl::getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol) const
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString intIp = QString("");
|
||||||
|
if (protocol == QAbstractSocket::IPv4Protocol)
|
||||||
|
intIp = QString("127.0.0.1/8");
|
||||||
|
else if (protocol == QAbstractSocket::IPv6Protocol)
|
||||||
|
intIp = QString("::1/128");
|
||||||
|
QList<QHostAddress> rawList = QNetworkInterface::allAddresses();
|
||||||
|
foreach(QHostAddress address, rawList) {
|
||||||
|
if (address == QHostAddress(QHostAddress::LocalHost)) continue;
|
||||||
|
if (address == QHostAddress(QHostAddress::LocalHostIPv6)) continue;
|
||||||
|
if (address.protocol() != protocol) continue;
|
||||||
|
intIp = address.toString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
profile.remove(0, 1);
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getExtIp(const QString cmd)
|
|
||||||
{
|
|
||||||
QProcess command;
|
|
||||||
QString extIp = QString("");
|
|
||||||
command.start(cmd);
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
extIp = cmdOutput.trimmed();
|
|
||||||
return extIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::getInterfaceList(const QString dir)
|
|
||||||
{
|
|
||||||
QStringList interfaceList;
|
|
||||||
if (QDir(dir).exists())
|
|
||||||
interfaceList = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
|
|
||||||
return interfaceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getIntIp(const QString cmd, const QString dir)
|
|
||||||
{
|
|
||||||
QProcess command;
|
|
||||||
QString intIp = QString("127.0.0.1/8");
|
|
||||||
QStringList interfaceList = getInterfaceList(dir);
|
|
||||||
for (int i=0; i<interfaceList.count(); i++)
|
|
||||||
if (interfaceList[i] != QString("lo")) {
|
|
||||||
command.start(cmd + QString(" addr show ") + interfaceList[i]);
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
QStringList deviceInfo = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
|
||||||
for (int j=0; j<deviceInfo.count(); j++)
|
|
||||||
if (deviceInfo[j].split(QChar(' '), QString::SkipEmptyParts)[0] == QString("inet"))
|
|
||||||
intIp = deviceInfo[j].split(QChar(' '), QString::SkipEmptyParts)[1];
|
|
||||||
}
|
|
||||||
return intIp;
|
return intIp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList Netctl::getProfileList(const QString cmd)
|
QStringList Netctl::getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto)
|
||||||
{
|
{
|
||||||
QProcess command;
|
if (debug) qDebug() << PDEBUG;
|
||||||
command.start(cmd + QString(" list"));
|
|
||||||
command.waitForFinished(-1);
|
QString output = getCmdOutput(QString("%1 list").arg(cmdNetctlAuto));
|
||||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
if (output.isEmpty()) {
|
||||||
QStringList profileList = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
output = getCmdOutput(QString("%1 list").arg(cmdNetctl));
|
||||||
for (int i=0; i<profileList.count(); i++)
|
netctlAutoStatus = false;
|
||||||
profileList[i].remove(0, 1);
|
} else
|
||||||
|
netctlAutoStatus = true;
|
||||||
|
|
||||||
|
// parse
|
||||||
|
QStringList currentProfiles;
|
||||||
|
// workaround for first element spaces on which are trimmed
|
||||||
|
QStringList profileList = QString(" %1").arg(output).split(QChar('\n'));
|
||||||
|
for (int i=0; i<profileList.count(); i++) {
|
||||||
|
bool isActive = (profileList.at(i)[0] == QChar('*'));
|
||||||
|
profileList[i].remove(0, 2);
|
||||||
|
if (isActive) currentProfiles.append(profileList.at(i));
|
||||||
|
}
|
||||||
|
profileList.sort();
|
||||||
|
currentProfiles.sort();
|
||||||
|
|
||||||
|
// return profiles
|
||||||
|
currentProfile = currentProfiles;
|
||||||
|
status = !currentProfiles.isEmpty();
|
||||||
return profileList;
|
return profileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::getProfileStatus(const QString cmd)
|
QStringList Netctl::getProfileStringStatus(const QString cmdNetctl) const
|
||||||
{
|
{
|
||||||
bool status = false;
|
if (debug) qDebug() << PDEBUG;
|
||||||
QString cmdOutput = getCurrentProfile(cmd);
|
|
||||||
if (!cmdOutput.isEmpty())
|
QStringList status;
|
||||||
status = true;
|
if (netctlAutoStatus) {
|
||||||
|
status.append(QString("netctl-auto"));
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(QString profile, currentProfile) {
|
||||||
|
TaskResult process = runTask(QString("%1 is-enabled %2").arg(cmdNetctl).arg(profile));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||||
|
status.append(process.exitCode == 0 ? QString("enabled") : QString("static"));
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Netctl::getProfileStringStatus(const QString cmd)
|
void Netctl::initSources()
|
||||||
{
|
{
|
||||||
QProcess command;
|
if (debug) qDebug() << PDEBUG;
|
||||||
QString status = QString("static");
|
|
||||||
QString profile = getCurrentProfile(cmd);
|
QStringList sourcesList = sources();
|
||||||
command.start(cmd + QString(" status ") + profile);
|
foreach(QString source, sourcesList)
|
||||||
command.waitForFinished(-1);
|
setData(source, QString("value"), QString("N\\A"));
|
||||||
QString cmdOutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
QStringList profileStatus = cmdOutput.split(QChar('\n'), QString::SkipEmptyParts);
|
|
||||||
for (int i=0; i<profileStatus.count(); i++)
|
|
||||||
if (profileStatus[i].split(QChar(' '), QString::SkipEmptyParts)[0] == QString("Loaded:")) {
|
|
||||||
if (profileStatus[i].contains(QString("enabled")))
|
|
||||||
status = QString("enabled");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Netctl::updateSourceEvent(const QString &source)
|
bool Netctl::updateSourceEvent(const QString &source)
|
||||||
{
|
{
|
||||||
QString key = QString("value");
|
if (debug) qDebug() << PDEBUG;
|
||||||
QString value = QString("");
|
if (debug) qDebug() << PDEBUG << ":" << "Source name" << source;
|
||||||
if (source == QString("currentProfile")) {
|
|
||||||
value = getCurrentProfile(configuration[QString("CMD")]);
|
QString value = QString("N\\A");
|
||||||
|
if (source == QString("active")) {
|
||||||
|
value = status ? QString("true") : QString("false");
|
||||||
|
} else if (source == QString("current")) {
|
||||||
|
value = currentProfile.join(QChar('|'));
|
||||||
|
} else if (source == QString("extip4")) {
|
||||||
|
if (configuration[QString("EXTIP4")].toString() == QString("true"))
|
||||||
|
value = getExtIp(configuration[QString("EXTIP4CMD")].toString());
|
||||||
|
} else if (source == QString("extip6")) {
|
||||||
|
if (configuration[QString("EXTIP6")].toString() == QString("true"))
|
||||||
|
value = getExtIp(configuration[QString("EXTIP6CMD")].toString());
|
||||||
|
} else if (source == QString("info")) {
|
||||||
|
value = getInfo(currentProfile, currentStatus);
|
||||||
|
} else if (source == QString("interfaces")) {
|
||||||
|
value = getInterfaceList().join(QChar(','));
|
||||||
|
} else if (source == QString("intip4")) {
|
||||||
|
value = getIntIp(QAbstractSocket::IPv4Protocol);
|
||||||
|
} else if (source == QString("intip6")) {
|
||||||
|
value = getIntIp(QAbstractSocket::IPv6Protocol);
|
||||||
|
} else if (source == QString("netctlauto")) {
|
||||||
|
value = netctlAutoStatus ? QString("true") : QString("false");
|
||||||
|
} else if (source == QString("profiles")) {
|
||||||
|
value = getProfileList(configuration[QString("NETCTLCMD")].toString(),
|
||||||
|
configuration[QString("NETCTLAUTOCMD")].toString()).join(QChar(','));
|
||||||
|
} else if (source == QString("status")) {
|
||||||
|
currentStatus = getProfileStringStatus(configuration[QString("NETCTLCMD")].toString());
|
||||||
|
value = currentStatus.join(QChar('|'));
|
||||||
}
|
}
|
||||||
else if (source == QString("extIp")) {
|
setData(source, QString("value"), value);
|
||||||
if (configuration[QString("EXTIP")] == QString("true"))
|
|
||||||
value = getExtIp(configuration[QString("EXTIPCMD")]);
|
|
||||||
}
|
|
||||||
else if (source == QString("interfaces")) {
|
|
||||||
value = getInterfaceList(configuration[QString("NETDIR")]).join(QChar(','));
|
|
||||||
}
|
|
||||||
else if (source == QString("intIp")) {
|
|
||||||
value = getIntIp(configuration[QString("IPCMD")], configuration[QString("NETDIR")]);
|
|
||||||
}
|
|
||||||
else if (source == QString("profiles")) {
|
|
||||||
value = getProfileList(configuration[QString("CMD")]).join(QChar(','));
|
|
||||||
}
|
|
||||||
else if (source == QString("statusBool")) {
|
|
||||||
if (getProfileStatus(configuration[QString("CMD")]))
|
|
||||||
value = QString("true");
|
|
||||||
else
|
|
||||||
value = QString("false");
|
|
||||||
}
|
|
||||||
else if (source == QString("statusString")) {
|
|
||||||
value = getProfileStringStatus(configuration[QString("CMD")]);
|
|
||||||
}
|
|
||||||
setData(source, key, value);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef BUILD_KDE4
|
||||||
K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl)
|
K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl)
|
||||||
|
#else
|
||||||
|
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(netctl, Netctl, "plasma-dataengine-netctl.json")
|
||||||
|
#endif /* BUILD_KDE4 */
|
||||||
|
|
||||||
#include "netctl.moc"
|
#include "netctl.moc"
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#define NETCTL_DE_H
|
#define NETCTL_DE_H
|
||||||
|
|
||||||
#include <Plasma/DataEngine>
|
#include <Plasma/DataEngine>
|
||||||
|
#include <QAbstractSocket>
|
||||||
|
|
||||||
|
|
||||||
class Netctl : public Plasma::DataEngine
|
class Netctl : public Plasma::DataEngine
|
||||||
@ -26,14 +27,17 @@ class Netctl : public Plasma::DataEngine
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Netctl(QObject *parent, const QVariantList &args);
|
explicit Netctl(QObject *parent, const QVariantList &args);
|
||||||
QString getCurrentProfile(const QString cmd);
|
virtual ~Netctl();
|
||||||
QString getExtIp(const QString cmd);
|
QString getExtIp(const QString cmd) const;
|
||||||
QStringList getInterfaceList(const QString dir);
|
QString getInfo(const QStringList profiles, const QStringList statuses) const;
|
||||||
QString getIntIp(const QString cmd, const QString dir);
|
QStringList getInterfaceList() const;
|
||||||
QStringList getProfileList(const QString cmd);
|
QString getIntIp(const QAbstractSocket::NetworkLayerProtocol protocol) const;
|
||||||
bool getProfileStatus(const QString cmd);
|
QStringList getProfileList(const QString cmdNetctl, const QString cmdNetctlAuto);
|
||||||
QString getProfileStringStatus(const QString cmd);
|
QStringList getProfileStringStatus(const QString cmdNetctl) const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void initSources();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool sourceRequestEvent(const QString &name);
|
bool sourceRequestEvent(const QString &name);
|
||||||
@ -41,10 +45,16 @@ protected:
|
|||||||
QStringList sources() const;
|
QStringList sources() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isNetctlCheckRunning = false;
|
||||||
|
bool netctlAutoStatus = false;
|
||||||
|
bool status = false;
|
||||||
|
QStringList currentProfile;
|
||||||
|
QStringList currentStatus;
|
||||||
// configuration
|
// configuration
|
||||||
QMap<QString, QString> configuration;
|
bool debug;
|
||||||
|
QVariantMap configuration;
|
||||||
|
QString getCmdOutput(const QString cmd) const;
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
9
sources/dataengine/plasma-dataengine-netctl.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Netctl commands]
|
||||||
|
NETCTLCMD=netctl
|
||||||
|
NETCTLAUTOCMD=netctl-auto
|
||||||
|
|
||||||
|
[External IP]
|
||||||
|
EXTIP4CMD=curl ip4.telize.com
|
||||||
|
EXTIP4=false
|
||||||
|
EXTIP6CMD=curl ip6.telize.com
|
||||||
|
EXTIP6=false
|
@ -10,11 +10,11 @@ X-KDE-ServiceTypes=Plasma/DataEngine
|
|||||||
X-KDE-Library=plasma_engine_netctl
|
X-KDE-Library=plasma_engine_netctl
|
||||||
X-Plasma-EngineName=netctl
|
X-Plasma-EngineName=netctl
|
||||||
|
|
||||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=netctl
|
X-KDE-PluginInfo-Name=netctl
|
||||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid
|
X-KDE-PluginInfo-Website=https://arcanis.me/projects/netctl-gui/
|
||||||
X-KDE-PluginInfo-Category=Network
|
X-KDE-PluginInfo-Category=Network
|
||||||
X-KDE-PluginInfo-Depends=
|
X-KDE-PluginInfo-Depends=
|
||||||
X-KDE-PluginInfo-License=GPLv3
|
X-KDE-PluginInfo-License=GPLv3
|
@ -5,7 +5,8 @@ message (STATUS "Subproject ${SUBPROJECT}")
|
|||||||
# set directories
|
# set directories
|
||||||
set (SUBPROJECT_BINARY_DIR bin)
|
set (SUBPROJECT_BINARY_DIR bin)
|
||||||
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
set (SUBPROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||||
set (SUBPROJECT_RESOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
set (SUBPROJECT_DOCS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs)
|
||||||
|
set (SUBPROJECT_RESOURCE_DIR ${PROJECT_RESOURCE_DIR})
|
||||||
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
|
set (SUBPROJECT_TRANSLATION_DIR ${SUBPROJECT_RESOURCE_DIR}/translations)
|
||||||
# executable path
|
# executable path
|
||||||
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
|
set (EXECUTABLE_OUTPUT_PATH ${SUBPROJECT_BINARY_DIR})
|
||||||
@ -15,5 +16,13 @@ set (TARGETS "")
|
|||||||
set (HEADERS "")
|
set (HEADERS "")
|
||||||
|
|
||||||
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
add_subdirectory (${SUBPROJECT_SOURCE_DIR})
|
||||||
|
add_subdirectory (${SUBPROJECT_DOCS_DIR})
|
||||||
|
# build man
|
||||||
|
file (GLOB SUBPROJECT_MAN_IN *.1)
|
||||||
|
file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
|
||||||
|
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
|
||||||
|
|
||||||
install (FILES ${SUBPROJECT}.desktop DESTINATION share/applications/)
|
install (FILES ${SUBPROJECT}.desktop DESTINATION share/applications/)
|
||||||
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
|
||||||
|
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
|
||||||
|
install (FILES zsh-completions DESTINATION share/zsh/site-functions/ RENAME _${SUBPROJECT})
|
||||||
|
115
sources/gui/bash-completions
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
###########################################################################
|
||||||
|
# This file is part of netctl-gui #
|
||||||
|
# #
|
||||||
|
# netctl-gui is free software: you can redistribute it and/or #
|
||||||
|
# modify it under the terms of the GNU General Public License as #
|
||||||
|
# published by the Free Software Foundation, either version 3 of the #
|
||||||
|
# License, or (at your option) any later version. #
|
||||||
|
# #
|
||||||
|
# netctl-gui is distributed in the hope that it will be useful, #
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||||
|
# GNU General Public License for more details. #
|
||||||
|
# #
|
||||||
|
# You should have received a copy of the GNU General Public License #
|
||||||
|
# along with netctl-gui. If not, see http://www.gnu.org/licenses/ #
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
|
||||||
|
# variables
|
||||||
|
_netctl_gui_arglist=(
|
||||||
|
'--detached'
|
||||||
|
'--maximized'
|
||||||
|
'--minimized'
|
||||||
|
'--about'
|
||||||
|
'--netctl-auto'
|
||||||
|
'--settings'
|
||||||
|
'-e'
|
||||||
|
'--essid'
|
||||||
|
'-o'
|
||||||
|
'--open'
|
||||||
|
'-s'
|
||||||
|
'--select'
|
||||||
|
'-c'
|
||||||
|
'--config'
|
||||||
|
'-d'
|
||||||
|
'--debug'
|
||||||
|
'--default'
|
||||||
|
'--set-opts'
|
||||||
|
'-t'
|
||||||
|
'--tab'
|
||||||
|
'-v'
|
||||||
|
'--version'
|
||||||
|
'-i'
|
||||||
|
'--info'
|
||||||
|
'-h'
|
||||||
|
'--help'
|
||||||
|
)
|
||||||
|
|
||||||
|
_netctl_gui_settings=(
|
||||||
|
'CLOSE_HELPER'
|
||||||
|
'CLOSETOTRAY'
|
||||||
|
'CTRL_DIR'
|
||||||
|
'CTRL_GROUP'
|
||||||
|
'FORCE_SUDO'
|
||||||
|
'HELPER_PATH'
|
||||||
|
'HELPER_SERVICE'
|
||||||
|
'IFACE_DIR'
|
||||||
|
'LANGUAGE'
|
||||||
|
'NETCTL_PATH'
|
||||||
|
'NETCTLAUTO_PATH'
|
||||||
|
'NETCTLAUTO_SERVICE'
|
||||||
|
'PID_FILE'
|
||||||
|
'PREFERED_IFACE'
|
||||||
|
'PROFILE_DIR'
|
||||||
|
'RFKILL_DIR'
|
||||||
|
'SKIPCOMPONENTS'
|
||||||
|
'STARTTOTRAY'
|
||||||
|
'SUDO_PATH'
|
||||||
|
'SYSTEMCTL_PATH'
|
||||||
|
'SYSTRAY'
|
||||||
|
'USE_HELPER'
|
||||||
|
'WPACLI_PATH'
|
||||||
|
'WPASUP_PATH'
|
||||||
|
'WPA_DRIVERS'
|
||||||
|
)
|
||||||
|
|
||||||
|
_netctl_gui_tabs=(
|
||||||
|
'1'
|
||||||
|
'2'
|
||||||
|
'3'
|
||||||
|
)
|
||||||
|
|
||||||
|
_netctl_profiles() {
|
||||||
|
echo $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# work block
|
||||||
|
_netctl_gui() {
|
||||||
|
COMPREPLY=()
|
||||||
|
wantfiles='-@(c|-config)'
|
||||||
|
wantprofiles='-@(o|-open|s|-select)'
|
||||||
|
wantsettings='-@(-set-opts)'
|
||||||
|
wantstring='-@(e|-essid)'
|
||||||
|
wanttabs='-@(t|-tab)'
|
||||||
|
_get_comp_words_by_ref cur prev words cword
|
||||||
|
|
||||||
|
if [[ $prev = $wantfiles ]]; then
|
||||||
|
_filedir
|
||||||
|
elif [[ $prev = $wantprofiles ]]; then
|
||||||
|
COMPREPLY=($(compgen -W '$(_netctl_profiles)' -- "$cur"))
|
||||||
|
elif [[ $prev = $wantsettings ]]; then
|
||||||
|
COMPREPLY=($(compgen -S ',' -W '${_netctl_gui_settings[@]}' -- "$cur"))
|
||||||
|
elif [[ $prev = $wantstring ]]; then
|
||||||
|
COMPREPLY=()
|
||||||
|
elif [[ $prev = $wanttabs ]]; then
|
||||||
|
COMPREPLY=($(compgen -W '${_netctl_gui_tabs[@]}' -- "$cur"))
|
||||||
|
else
|
||||||
|
COMPREPLY=($(compgen -W '${_netctl_gui_arglist[@]}' -- "$cur"))
|
||||||
|
fi
|
||||||
|
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _netctl_gui netctl-gui
|
12
sources/gui/docs/CMakeLists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# build pages
|
||||||
|
file (GLOB SUBPROJECT_DOCS_IN *.html)
|
||||||
|
file (GLOB SUBPROJECT_IMGS *.png)
|
||||||
|
|
||||||
|
foreach (DOC_IN ${SUBPROJECT_DOCS_IN})
|
||||||
|
file (RELATIVE_PATH ONE_DOC ${CMAKE_SOURCE_DIR} ${DOC_IN})
|
||||||
|
configure_file (${DOC_IN} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||||
|
set (SUBPROJECT_DOCS ${SUBPROJECT_DOCS} ${CMAKE_CURRENT_BINARY_DIR}/${ONE_DOC})
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
install (FILES ${SUBPROJECT_DOCS} DESTINATION share/doc/${PROJECT_NAME})
|
||||||
|
install (FILES ${SUBPROJECT_IMGS} DESTINATION share/doc/${PROJECT_NAME})
|
BIN
sources/gui/docs/architecture.png
Normal file
After Width: | Height: | Size: 40 KiB |
478
sources/gui/docs/netctl-gui-dbus-api.html
Normal file
@ -0,0 +1,478 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>netctl-gui DBus API desription</title>
|
||||||
|
<style type="text/css">
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
padding: 5px 10px;
|
||||||
|
border: 1px solid #000000;
|
||||||
|
};
|
||||||
|
td {
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
th.sub {
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
small {
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>netctl-gui DBus API description</h1>
|
||||||
|
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||||
|
<ol>
|
||||||
|
<li><a href="#api">DBus API</a></li>
|
||||||
|
<li><a href="#helper">Helper API</a></li>
|
||||||
|
<li><a href="#ctrl">Helper ctrl API</a></li>
|
||||||
|
<li><a href="#interface">Helper interface API</a></li>
|
||||||
|
<li><a href="#netctl">Helper netctl API</a></li>
|
||||||
|
<li><a href="#gui">GUI API</a></li>
|
||||||
|
<li><a href="#netctlgui">GUI netctlgui API</a></li>
|
||||||
|
<li><a href="#links">External links</a></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<h2><a href="#api" class="anchor" id="api"></a>DBus API</h2>
|
||||||
|
<table>
|
||||||
|
<tbody><tr>
|
||||||
|
<th>method</th>
|
||||||
|
<th>responce</th>
|
||||||
|
<th>run as root</th>
|
||||||
|
</tr>
|
||||||
|
<!-- helper service -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="3"><a href="#helper" class="anchor" id="helper"></a><code>org.netctlgui.helper</code> service (system bus)</th>
|
||||||
|
</tr>
|
||||||
|
<!-- /ctrl path -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="3" class="sub"><a href="#ctrl" class="anchor" id="ctrl"></a><code>/ctrl</code> path</th>
|
||||||
|
</tr>
|
||||||
|
<!-- helper actions -->
|
||||||
|
<tr>
|
||||||
|
<td>bool Active()</td>
|
||||||
|
<td><code>true</code> if the helper is active</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString ApiDocs()</td>
|
||||||
|
<td>returns path to this API documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Close()</td>
|
||||||
|
<td><code>true</code> and closes the helper</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList FindSettings()</td>
|
||||||
|
<td>scans system and suggests the recommended configuration which may be used by the library</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString LibraryDocs()</td>
|
||||||
|
<td>returns path to the library documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString Pony()</td>
|
||||||
|
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString SecurityDocs()</td>
|
||||||
|
<td>returns path to the security documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Settings()</td>
|
||||||
|
<td>current helper settings <code>KEY==VALUE</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList UIDs()</td>
|
||||||
|
<td>returns the helper process UIDs <code>[UID, EUID]</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Update()</td>
|
||||||
|
<td>calls update the helper configuration. Returns <code>true</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl actions -->
|
||||||
|
<tr>
|
||||||
|
<td>bool Enable(QString profile)</td>
|
||||||
|
<td>enables or disables the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool forceStart(QString profile)</td>
|
||||||
|
<td>force starts the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool forceStop(QString profile)</td>
|
||||||
|
<td>force stops the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Reenable(QString profile)</td>
|
||||||
|
<td>reenables the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Restart(QString profile)</td>
|
||||||
|
<td>restarts the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Start(QString profile)</td>
|
||||||
|
<td>starts or stops the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool StopAll()</td>
|
||||||
|
<td>stops all active profiles. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool SwitchTo(QString profile)</td>
|
||||||
|
<td>switchs to the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Create(QString profile, QStringList settingsList)</td>
|
||||||
|
<td>creates the profile with specified settings. Settings should be given in the format <code>KEY==VALUE</code>. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Remove(QString profile)</td>
|
||||||
|
<td>removes the profile. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl-auto actions -->
|
||||||
|
<tr>
|
||||||
|
<td>bool autoDisableAll()</td>
|
||||||
|
<td>disables all profiles (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>no?</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoEnable(QString profile)</td>
|
||||||
|
<td>enables or disables the profile (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>no?</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoEnableAll()</td>
|
||||||
|
<td>enables all profiles (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>no?</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoStart(QString profile)</td>
|
||||||
|
<td>switchs to the profile (netctl-auto). Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>no?</td>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl-auto service actions -->
|
||||||
|
<tr>
|
||||||
|
<td>bool autoServiceEnable()</td>
|
||||||
|
<td>enables or disables netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoServiceRestart()</td>
|
||||||
|
<td>restarts netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoServiceStart()</td>
|
||||||
|
<td>starts or stops netctl-auto systemd service. Returns <code>true</code> if action has been performed successfully</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<!-- wpa_supplicant actions -->
|
||||||
|
<tr>
|
||||||
|
<td>QStringList CurrentWiFi()</td>
|
||||||
|
<td>returns current WiFi point in format <code>NAME|SECURITY|TYPE|FREQ|MAC|SIGNAL|ACTIVE|EXISTS</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList VerboseWiFi()</td>
|
||||||
|
<td>returns available WiFi points in format <code>NAME|SECURITY|TYPE|FREQS|MACS|SIGNAL|ACTIVE|EXISTS</code>. First line is always active connection (see <code>CurrentWiFi()</code>)</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList WiFi()</td>
|
||||||
|
<td>returns available WiFi points in format <code>NAME|SECURITY|SIGNAL|ACTIVE|EXISTS</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<!-- /interface path -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="3" class="sub"><a href="#interface" class="anchor" id="interface"></a><code>/interface</code> path</th>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl control -->
|
||||||
|
<tr>
|
||||||
|
<td>int Enable(QString profile)</td>
|
||||||
|
<td>enables or disables the profile. Returns is the profile enabled or <code>2</code> if there was an another error</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int Restart(QString profile)</td>
|
||||||
|
<td>restarts the profile. Returns is the profile active or <code>2</code> if there was an error</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int Start(QString profile)</td>
|
||||||
|
<td>starts or stops the profile. Returns is the profile active or <code>2</code> if there was an error</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool StopAll()</td>
|
||||||
|
<td>synonym of <code>/ctlr/StopAll()</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool SwitchTo(QString profile)</td>
|
||||||
|
<td>switchs to the profile (works with netctl and netctl-auto). Returns is the profile active or <code>2</code> if there was an error</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int Create(QString profile, QStringList settingsList)</td>
|
||||||
|
<td>>creates the profile with specified settings. Settings should be given in the format <code>KEY==VALUE</code>. Returns <code>1</code> if action has been performed successfully, <code>0</code> if there was an error in the profile copying and <code>2</code> if there was an another error</td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Profile(QString profile)</td>
|
||||||
|
<td>synonym of <code>/netctl/Profile()</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int Remove(QString profile)</td>
|
||||||
|
<td>synonym of <code>/ctrl/Remove()</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<!-- information -->
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Information()</td>
|
||||||
|
<td>returns general information in format <code>[IsNetctlAutoActive, NetctlProfiles, NetctlAutoProfiles]</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Status()</td>
|
||||||
|
<td>returns actual information in format <code>[IsNetctlAutoActive, ProfilesNames, ActiveProfile, ActiveProfileEnables]</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- wpa_supplicant actions -->
|
||||||
|
<tr>
|
||||||
|
<td>int Essid(QString essid, QStringList settingsList)</td>
|
||||||
|
<td>connects to WiFi point with the given ESSID, calls KnownEssid or UnknownESSID depending on whether there is a profile. Settings may be empty. To get return codes refer to <code>KnownEssid()</code> and <code>UnknownEssid()</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int KnownEssid(QString essid)</td>
|
||||||
|
<td>connects to WiFi point with the given ESSID with existent profile. Returns <code>Start()</code> if ok, in other cases returns <code>2</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>int UnknownEssid(QString essid, QStringList settingsList)</td>
|
||||||
|
<td>creates a profile and connects to WiFi point with the given ESSID. Returns <code>Start()</code> if ok, in other cases returns <code>2</code></td>
|
||||||
|
<td>yes</td>
|
||||||
|
</tr>
|
||||||
|
<!-- /netctl path -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="3" class="sub"><a href="#netctl" class="anchor" id="netctl"></a><code>/netctl</code> path</th>
|
||||||
|
</tr>
|
||||||
|
<!-- general information -->
|
||||||
|
<tr>
|
||||||
|
<td>QStringList ActiveProfile()</td>
|
||||||
|
<td>returns active profile from netctl or netctl-auto</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList ActiveProfileStatus()</td>
|
||||||
|
<td>returns active profile status from netctl or netctl-auto. May be <code>netctl-auto</code>, <code>active (enabled)</code>, <code>active (static)</code>, <code>inactive (enabled)</code>, <code>inactive (static)</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Information()</td>
|
||||||
|
<td>returns general information in format <code>[ActiveProfile, ActiveProfileStatus]</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList netctlActiveProfile()</td>
|
||||||
|
<td>returns active profile from netctl even if netctl-auto is running</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList netctlProfileList()</td>
|
||||||
|
<td>returns available profiles in format <code>NAME|DESCRIPTION|ACTIVE|ENABLED</code> from netctl even if netctl-auto is running</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList netctlVerboseProfileList()</td>
|
||||||
|
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</code> from netctl even if netctl-auto is running</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList ProfileList()</td>
|
||||||
|
<td>returns available profiles in format <code>NAME|DESCRIPTION|ACTIVE|ENABLED</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList VerboseProfileList()</td>
|
||||||
|
<td>returns available profiles in format <code>NAME|DESCRIPTION|TYPE|INTERFACE|ESSID|ACTIVE|ENABLED|NETCTL-AUTO</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList WirelessInterface()</td>
|
||||||
|
<td>returns wireless interfaces</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl specific information -->
|
||||||
|
<tr>
|
||||||
|
<td>bool isProfileActive(QString profile)</td>
|
||||||
|
<td>returns <code>true</code> if the profile is active</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool isProfileEnabled(QString profile)</td>
|
||||||
|
<td>returns <code>true</code> if the profile is enabled</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- netctl-auto specific information -->
|
||||||
|
<tr>
|
||||||
|
<td>bool autoIsProfileActive(QString profile)</td>
|
||||||
|
<td>returns <code>true</code> if the profile is active (netctl-auto)</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool autoIsProfileEnabled(QString profile)</td>
|
||||||
|
<td>returns <code>true</code> if the profile is enabled (netctl-auto)</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool isNetctlAutoActive()</td>
|
||||||
|
<td>returns <code>true</code> if netctl-auto is active</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool isNetctlAutoEnabled()</td>
|
||||||
|
<td>returns <code>true</code> if netctl-auto is enabled</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- profile information -->
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Profile(QString profile)</td>
|
||||||
|
<td>returns the profile settings in format <code>KEY==VALUE</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString ProfileByEssid(QString essid)</td>
|
||||||
|
<td>returns the profile name by the given ESSID or empty line</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString ProfileValue(QString profile, QString key)</td>
|
||||||
|
<td>returns value of the key by the given profile or empty line</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList ProfileValues(QString profile, QStringList keys)</td>
|
||||||
|
<td>returns values of the keys by the given profile or empty lines</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<!-- gui service -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="3"><a href="#gui" class="anchor" id="gui"></a><code>org.netctlgui.netctlgui</code> service (session bus)</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th colspan="3" class="sub"><a href="#netctlgui" class="anchor" id="netctlgui"></a><code>/netctlgui</code> path</th>
|
||||||
|
</tr>
|
||||||
|
<!-- gui actions -->
|
||||||
|
<tr>
|
||||||
|
<td>bool Active()</td>
|
||||||
|
<td><code>true</code> if the application is active</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>void ApiDocs()</td>
|
||||||
|
<td>opens this API documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Close()</td>
|
||||||
|
<td><code>true</code> and closes the application</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>void LibraryDocs()</td>
|
||||||
|
<td>opens the library documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QString Pony()</td>
|
||||||
|
<td>prints Pinkie Pie to stdout. Really, just try</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool Restore()</td>
|
||||||
|
<td><code>true</code> and restores the application</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>void SecurityDocs()</td>
|
||||||
|
<td>opens the security documentation</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList Settings()</td>
|
||||||
|
<td>current application settings <code>KEY==VALUE</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool ShowAbout()</td>
|
||||||
|
<td><code>true</code> and shows about window</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool ShowMain()</td>
|
||||||
|
<td><code>true</code> and shows main window</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool ShowNetctlAuto()</td>
|
||||||
|
<td><code>true</code> and shows netctl-auto window</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>bool ShowSettings()</td>
|
||||||
|
<td><code>true</code> and shows settings window</td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>QStringList UIDs()</td>
|
||||||
|
<td>returns the application process UIDs <code>[UID, EUID]</code></td>
|
||||||
|
<td>no</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://arcanis.me/projects/netctl-gui/">Homepage</a></li>
|
||||||
|
<li><a href="https://github.com/arcan1s/netctl-gui">Repository</a></li>
|
||||||
|
<li><a href="https://github.com/arcan1s/netctl-gui/issues">Bugtracker</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<small>
|
||||||
|
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||||
|
This software is licensed under @PROJECT_LICENSE@
|
||||||
|
</small>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
112
sources/gui/docs/netctl-gui-security-notes.html
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||||
|
<title>netctl-gui secutiry notes</title>
|
||||||
|
<style type="text/css">
|
||||||
|
img {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
small {
|
||||||
|
font-size: 70%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>netctl-gui security notes</h1>
|
||||||
|
<h3>Project version : @PROJECT_VERSION@</h3>
|
||||||
|
<ol>
|
||||||
|
<li><a href="#arch">Architecture</a></li>
|
||||||
|
<li><a href="#library">Library</a></li>
|
||||||
|
<li><a href="#helper">Helper</a></li>
|
||||||
|
<li><a href="#gui">Graphical interface</a></li>
|
||||||
|
<li><a href="#kde">KDE components</a></li>
|
||||||
|
<li><a href="#links">External links</a></li>
|
||||||
|
</ol>
|
||||||
|
|
||||||
|
<h2><a href="#description" class="anchor" id="description"></a>Description</h2>
|
||||||
|
<p></p>
|
||||||
|
|
||||||
|
<h2><a href="#arch" class="anchor" id="arch"></a>Architecture</h2>
|
||||||
|
<img src="architecture.png" alt="architecture">
|
||||||
|
|
||||||
|
<h2><a href="#library" class="anchor" id="library"></a>Library</h2>
|
||||||
|
<p>According to <a href="#arch">the scheme</a> the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which <b>require</b> root privileges are:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Netctl control module</li>
|
||||||
|
<li><ul>
|
||||||
|
<li><code>netctl stop-all|start|stop|restart|switch-to|enable|disable|reenable <profile></code>. They are commands which provide a general control to netctl.</li>
|
||||||
|
<li><code>systemctl start|restart|enable <netctl-auto@service></code>. They are commands which provide ability to control netctl-auto systemd service.</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>Netctl profiles module</li>
|
||||||
|
<li><ul>
|
||||||
|
<li>Copying of a temporary profile from home directory to netctl profiles directory. <code>cp</code> command is used for it.</li>
|
||||||
|
<li>Removal of a profile. <code>rm</code> command is used for it.</li>
|
||||||
|
</ul></li>
|
||||||
|
<li>WiFi module</li>
|
||||||
|
<li><ul>
|
||||||
|
<li>This module require root privileges to start <code>wpa_supplicant</code> only. For the futher interaction user must be in <code>CTRL_GROUP</code>.</li>
|
||||||
|
</ul></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>If library will be initialized with <code>FORCE_SUDO=true</code> than it will use <code>sudo</code> command (which can be transferred to the library by <code>SUDO_PATH</code> option). Otherwise it will try to set UID of children processes to 0. Please note that <code>sudo</code> command and UID setting will be used only for those commands which require it.</p>
|
||||||
|
|
||||||
|
<p>Profiles reading should be described. Since profiles has shell-like syntax some variables (which provide an array) cannot be reading by usual ways. To do it library uses bash:</p>
|
||||||
|
<pre>
|
||||||
|
# define system variables
|
||||||
|
env -i bash -c "set"
|
||||||
|
# get profile and system variable list
|
||||||
|
env -i bash -c "source '<profile>'; set"
|
||||||
|
# get profile variables
|
||||||
|
env -i bash -c "source '<profile>'; for i in ${!<key>[@]}; do echo ${<key>[$i]}; done"
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h2><a href="#helper" class="anchor" id="helper"></a>Helper</h2>
|
||||||
|
<p>First of all the helper <b>does not interact</b> with netctl directly, it uses the library to do it. So all library security notes are applicable here. To start the helper and to create DBus services user must be in <code>network</code> group by default (or must be root). But you may change it by editing <code>$DBUS_SYSTEMCONF_PATH/org.netctlgui.helper.conf</code> policy file (<code>/etc/dbus-1/system.d/org.netctlgui.helper.conf</code> by default). Please refer to DBus documentation to do it.</p>
|
||||||
|
|
||||||
|
<p>By default <code>netctgui-helper</code> binary has capabilities to set UID to the children processes (<code>CAP_SETUID</code>). If you do not want to get these capabilities you may use <code>-DUSE_CAPABILITIES</code> cmake flag. Please refer to <code>man 7 capabilities</code> for more details.</p>
|
||||||
|
|
||||||
|
<p>There are two configuration files <code>$HOME/.config/netctl-gui.conf</code> and <code>/etc/netctl-gui.conf</code>. The first one is a user configuration and the second one is a system-wide. Please note that by default user configuration has higher priority than system-wide, but running with <code>--system</code> flag user configuration will not be reading. The helper and GUI configurations are the same (although some keys aren't needed).</p>
|
||||||
|
|
||||||
|
<h2><a href="#gui" class="anchor" id="gui"></a>Graphical interface</h2>
|
||||||
|
<p>Graphical interface may interact with netctl over <a href="#helper">DBus (the helper)</a> and over <a href="#library">the library</a>. Please refer to their notes to any additional information. If user uses helper he should have permissions to run it.</p>
|
||||||
|
|
||||||
|
<h2><a href="#kde" class="anchor" id="kde"></a>KDE components</h2>
|
||||||
|
<p>There are two netctl-based commands which are run from the DataEngine</p>
|
||||||
|
<ul>
|
||||||
|
<li><code><cmd> list</code></li>
|
||||||
|
<li><code>netctl is-enabled <profile></code></li>
|
||||||
|
</ul>
|
||||||
|
<p>Both of them do not require any additional privileges normally. Also DataEngine has two other command which will be run from; they should define external IP. According to the idea that user can set <b>any</b> command to run, this module is not secure. But running commands will not do more than user can do from console himself.</p>
|
||||||
|
|
||||||
|
<p>The widget gets information from DataEngine, thus it does not require any additional permissions to show information. But netctl calls are used to control netctl. In this case used commands are</p>
|
||||||
|
<ul>
|
||||||
|
<li><code>netctl enable <profile></code></li>
|
||||||
|
<li><code>netctl disable <profile></code></li>
|
||||||
|
<li><code>netctl restart <profile></code></li>
|
||||||
|
<li><code>netctl start <profile></code></li>
|
||||||
|
<li><code>netctl stop <profile></code></li>
|
||||||
|
<li><code>netctl stop-all</code></li>
|
||||||
|
<li><code>netctl switch-to <profile></code></li>
|
||||||
|
<li><code>netctl-auto switch-to <profile></code></li>
|
||||||
|
</ul>
|
||||||
|
<p>All netctl-based commands <b>require</b> root privileges and <code>sudo</code> (and any other alternatives) is used normally as prefix to the commands. The netctl-auto command <b>does not require</b> additional permissions.</p>
|
||||||
|
|
||||||
|
<p>The other way is to use DBus communication with <a href="#helper">the helper</a>. In this case user should have rights to start the helper.</p>
|
||||||
|
|
||||||
|
<h2><a href="#links" class="anchor" id="links"></a>External links</h2>
|
||||||
|
<ul>
|
||||||
|
<li><a href="https://arcanis.me/projects/netctl-gui/">Homepage</a></li>
|
||||||
|
<li><a href="https://github.com/arcan1s/netctl-gui">Repository</a></li>
|
||||||
|
<li><a href="https://github.com/arcan1s/netctl-gui/issues">Bugtracker</a></li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<small>
|
||||||
|
© 2014-@CURRENT_YEAR@ <a href="mailto:@PROJECT_CONTACT@">@PROJECT_AUTHOR@</a><br>
|
||||||
|
This software is licensed under @PROJECT_LICENSE@
|
||||||
|
</small>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
BIN
sources/gui/docs/rawscheme.ppt
Normal file
79
sources/gui/netctl-gui.1
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
.TH netctl-gui 1 "@CURRENT_DATE@" "version @PROJECT_VERSION@" "General Commands Manual"
|
||||||
|
.SH NAME
|
||||||
|
netctl-gui is a graphical interface for netctl
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B netctl-gui
|
||||||
|
[ options ]
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B netctl-gui
|
||||||
|
is a project which provides graphical user interface for
|
||||||
|
.B netctl
|
||||||
|
written on C++ using Qt toolkit. It provides shared library and DBus API (through helper daemon) and Plasmoid and DataEngine for KDE.
|
||||||
|
.SH OPTIONS
|
||||||
|
.IP "--detached"
|
||||||
|
run detached from console
|
||||||
|
.IP "--maximized"
|
||||||
|
run maximized
|
||||||
|
.IP "--minimized"
|
||||||
|
run to system tray if it is available
|
||||||
|
.IP "--about"
|
||||||
|
show about window
|
||||||
|
.IP "--netctl-auto"
|
||||||
|
show netctl-auto window
|
||||||
|
.IP "--settings"
|
||||||
|
show settings window
|
||||||
|
.IP "-e, --essid ESSID"
|
||||||
|
select ESSID
|
||||||
|
.I ESSID
|
||||||
|
This option will set tab to 3 automatically
|
||||||
|
.IP "-o, --open PROFILE"
|
||||||
|
open profile
|
||||||
|
.I PROFILE
|
||||||
|
This option will set tab to 2 automatically
|
||||||
|
.IP "-s, --select PROFILE"
|
||||||
|
select profile
|
||||||
|
.I PROFILE
|
||||||
|
This option will set tab to 1 automatically
|
||||||
|
.IP "-c, --config FILE"
|
||||||
|
read configuration from file
|
||||||
|
.I FILE
|
||||||
|
.IP "-d, --debug"
|
||||||
|
print debug information
|
||||||
|
.IP "--default"
|
||||||
|
start with default settings
|
||||||
|
.IP "--set-opts OPTIONS"
|
||||||
|
set options
|
||||||
|
.I OPTIONS
|
||||||
|
for this run, comma separated. Example:
|
||||||
|
.nf
|
||||||
|
LANGUAGE=en,NETCTL_PATH=/path/to/ponies
|
||||||
|
.fi
|
||||||
|
.IP "-t, --tab NUM"
|
||||||
|
open a tab with number
|
||||||
|
.I NUM
|
||||||
|
.IP "-v, --version"
|
||||||
|
show version and exit
|
||||||
|
.IP "-i, --info"
|
||||||
|
show build information and exit
|
||||||
|
.IP "-h, --help"
|
||||||
|
show this help and exit
|
||||||
|
.SH FILES
|
||||||
|
.I $HOME/.config/netctl-gui.conf
|
||||||
|
.RS
|
||||||
|
Configuration file
|
||||||
|
.RE
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR netctlgui-helper (1)
|
||||||
|
.BR netctl-gui.conf (5)
|
||||||
|
.SH STANDARDS
|
||||||
|
See
|
||||||
|
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-dbus-api.html
|
||||||
|
for more details.
|
||||||
|
.SH SECURITY CONSIDERATIONS
|
||||||
|
See
|
||||||
|
.B @CMAKE_INSTALL_PREFIX@/share/doc/netctl-gui/netctl-gui-security-notes.html
|
||||||
|
for more details.
|
||||||
|
.SH AUTHOR
|
||||||
|
@PROJECT_AUTHOR@ <\fI@PROJECT_CONTACT@\fR>
|
||||||
|
.SH LICENSE
|
||||||
|
This software is licensed under @PROJECT_LICENSE@
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env xdg-open
|
#!/usr/bin/env xdg-open
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=Netctl GUI
|
Name=Netctl GUI
|
||||||
Comment=GUI written on Qt4 for netctl
|
Comment=Qt graphical user interface for netctl
|
||||||
Exec=netctl-gui
|
Exec=netctl-gui
|
||||||
Icon=netctl-gui.png
|
Icon=netctl-gui.png
|
||||||
Terminal=false
|
Terminal=false
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
|
||||||
<qresource>
|
|
||||||
<file>translations/english.qm</file>
|
|
||||||
<file>translations/russian.qm</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@ -1,73 +1,68 @@
|
|||||||
# set files
|
# set files
|
||||||
file (GLOB SOURCES *.cpp)
|
if (USE_QT5)
|
||||||
file (GLOB HEADERS *.h)
|
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
file (GLOB FORMS *.ui)
|
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
|
||||||
|
else ()
|
||||||
|
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/language/*.cpp
|
||||||
|
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
|
||||||
|
endif ()
|
||||||
|
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
|
||||||
|
${PROJECT_TRDPARTY_DIR}/language/*.h)
|
||||||
|
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
||||||
|
|
||||||
set (LANGUAGES english
|
file (GLOB LANGUAGES ${SUBPROJECT_TRANSLATION_DIR}/*.ts)
|
||||||
russian)
|
|
||||||
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
|
set (RESOURCES ${SUBPROJECT_RESOURCE_DIR}/resources.qrc)
|
||||||
|
|
||||||
message (STATUS "${SUBPROJECT} Sources: ${SOURCES}")
|
|
||||||
message (STATUS "${SUBPROJECT} Headers: ${HEADERS}")
|
|
||||||
message (STATUS "${SUBPROJECT} Forms: ${FORMS}")
|
|
||||||
|
|
||||||
# include_path
|
# include_path
|
||||||
include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../)
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/include/
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${PROJECT_TRDPARTY_DIR})
|
||||||
|
link_directories (${PROJECT_LIBRARY}/src/lib)
|
||||||
|
|
||||||
if (USE_QT5)
|
if (USE_QT5)
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package (Qt5 COMPONENTS Core DBus Widgets LinguistTools REQUIRED)
|
||||||
find_package(Qt5Widgets REQUIRED)
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5LinguistTools_DEFINITIONS})
|
||||||
find_package(Qt5LinguistTools REQUIRED)
|
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||||
add_definitions(${Qt5Core_DEFINITIONS})
|
set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES})
|
||||||
add_definitions(${Qt5Widgets_DEFINITIONS})
|
|
||||||
add_definitions(${Qt5LinguistTools_DEFINITIONS})
|
|
||||||
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
qt5_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||||
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
qt5_wrap_ui (UI_HEADERS ${FORMS})
|
||||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||||
|
|
||||||
foreach (LANGUAGE ${LANGUAGES})
|
foreach (LANGUAGE ${LANGUAGES})
|
||||||
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
|
set (TS ${LANGUAGE})
|
||||||
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
|
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||||
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
add_custom_command (OUTPUT ${QM} COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
add_custom_target (translations COMMAND ${Qt5_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||||
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
add_custom_command (TARGET translations COMMAND ${Qt5_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||||
message (STATUS "${SUBPROJECT} Translations: ${TRANSLATIONS_BINARY}")
|
|
||||||
|
|
||||||
source_group ("Header Files" FILES ${HEADERS})
|
|
||||||
source_group ("Source Files" FILES ${SOURCES})
|
|
||||||
source_group ("Generated Files" FILES ${MOC_SOURCES})
|
|
||||||
|
|
||||||
include_directories (${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
|
||||||
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
|
||||||
target_link_libraries (${SUBPROJECT} ${Qt5Widgets_LIBRARIES} ${Qt5Core_LIBRARIES})
|
|
||||||
else ()
|
else ()
|
||||||
find_package (Qt4 REQUIRED)
|
find_package (Qt4 COMPONENTS QtCore QtDBus QtGui REQUIRED)
|
||||||
include (${QT_USE_FILE})
|
include (${QT_USE_FILE})
|
||||||
|
set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTGUI_LIBRARY})
|
||||||
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
qt4_wrap_cpp (MOC_SOURCES ${HEADERS})
|
||||||
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
qt4_wrap_ui (UI_HEADERS ${FORMS})
|
||||||
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
qt4_add_resources (QRC_SOURCES ${RESOURCES})
|
||||||
|
|
||||||
foreach (LANGUAGE ${LANGUAGES})
|
foreach (LANGUAGE ${LANGUAGES})
|
||||||
set (TS ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.ts)
|
set (TS ${LANGUAGE})
|
||||||
set (QM ${SUBPROJECT_TRANSLATION_DIR}/${LANGUAGE}.qm)
|
string (REPLACE ".ts" ".qm" QM ${TS})
|
||||||
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
|
||||||
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
|
||||||
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
add_custom_command (OUTPUT ${QM} COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS} MAIN_DEPENDENCY ${TS})
|
||||||
endforeach ()
|
endforeach ()
|
||||||
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
add_custom_target (translations COMMAND ${QT_LUPDATE_EXECUTABLE} ${HEADERS} ${SOURCES} ${UI_HEADERS} -ts ${TRANSLATIONS})
|
||||||
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
add_custom_command (TARGET translations COMMAND ${QT_LRELEASE_EXECUTABLE} ${TRANSLATIONS})
|
||||||
message (STATUS "${SUBPROJECT} Translations: ${TRANSLATIONS_BINARY}")
|
|
||||||
|
|
||||||
source_group ("Header Files" FILES ${HEADERS})
|
|
||||||
source_group ("Source Files" FILES ${SOURCES})
|
|
||||||
source_group ("Generated Files" FILES ${MOC_SOURCES})
|
|
||||||
|
|
||||||
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
|
||||||
target_link_libraries (${SUBPROJECT} ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_executable (${SUBPROJECT} ${UI_HEADERS} ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QRC_SOURCES} ${TRANSLATIONS})
|
||||||
|
target_link_libraries (${SUBPROJECT} ${PROJECT_LIBRARY} ${QT_NEEDED_LIBS})
|
||||||
# install properties
|
# install properties
|
||||||
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
install (TARGETS ${SUBPROJECT} DESTINATION bin)
|
||||||
|
107
sources/gui/src/aboutwindow.cpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "aboutwindow.h"
|
||||||
|
#include "ui_aboutwindow.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::AboutWindow(QWidget *parent, const bool debugCmd)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
ui(new Ui::AboutWindow),
|
||||||
|
debug(debugCmd)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
createUi();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AboutWindow::~AboutWindow()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete uiAbout;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AboutWindow::createText()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
// 1st tab
|
||||||
|
uiAbout->label_name->setText(QString(NAME));
|
||||||
|
uiAbout->label_version->setText(QApplication::translate("AboutWindow", "Version %1\n(build date %2)")
|
||||||
|
.arg(QString(VERSION)).arg(QString(BUILD_DATE)));
|
||||||
|
uiAbout->label_description->setText(QApplication::translate("AboutWindow", "Qt-based graphical interface for netctl."));
|
||||||
|
uiAbout->label_links->setText(QApplication::translate("AboutWindow", "Links:") + QString("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE))
|
||||||
|
.arg(QApplication::translate("AboutWindow", "Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY))
|
||||||
|
.arg(QApplication::translate("AboutWindow", "Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER))
|
||||||
|
.arg(QApplication::translate("AboutWindow", "Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION))
|
||||||
|
.arg(QApplication::translate("AboutWindow", "Translation issue")) +\
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(AUR_PACKAGES))
|
||||||
|
.arg(QApplication::translate("AboutWindow", "AUR packages")));
|
||||||
|
uiAbout->label_license->setText(QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>")
|
||||||
|
.arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||||
|
QApplication::translate("AboutWindow", "This software is licensed under %1").arg(QString(LICENSE)) +
|
||||||
|
QString("</small>"));
|
||||||
|
// 2nd tab
|
||||||
|
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||||
|
for (int i=0; i<trdPartyList.count(); i++)
|
||||||
|
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||||
|
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||||
|
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||||
|
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||||
|
uiAbout->label_translators->setText(QApplication::translate("AboutWindow", "Translators: %1").arg(QString(TRANSLATORS)));
|
||||||
|
uiAbout->label_trdparty->setText(QApplication::translate("AboutWindow", "This software uses: %1").arg(trdPartyList.join(QString(", "))));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AboutWindow::createUi()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QWidget *aboutWidget = new QWidget();
|
||||||
|
uiAbout = new Ui::About;
|
||||||
|
uiAbout->setupUi(aboutWidget);
|
||||||
|
ui->verticalLayout->insertWidget(0, aboutWidget);
|
||||||
|
createText();
|
||||||
|
|
||||||
|
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked(bool)), this, SLOT(close()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ESC press event
|
||||||
|
void AboutWindow::keyPressEvent(QKeyEvent *pressedKey)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (pressedKey->key() == Qt::Key_Escape)
|
||||||
|
close();
|
||||||
|
}
|
51
sources/gui/src/aboutwindow.h
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef ABOUTWINDOW_H
|
||||||
|
#define ABOUTWINDOW_H
|
||||||
|
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include "ui_about.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class AboutWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
class AboutWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit AboutWindow(QWidget *parent = 0,
|
||||||
|
const bool debugCmd = false);
|
||||||
|
~AboutWindow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::AboutWindow *ui;
|
||||||
|
Ui::About *uiAbout;
|
||||||
|
bool debug;
|
||||||
|
void createText();
|
||||||
|
void createUi();
|
||||||
|
// ESC pressed event
|
||||||
|
void keyPressEvent(QKeyEvent *pressedKey);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* ABOUTWINDOW_H */
|
30
sources/gui/src/aboutwindow.ui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>AboutWindow</class>
|
||||||
|
<widget class="QMainWindow" name="AboutWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>516</width>
|
||||||
|
<height>431</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Close</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
69
sources/gui/src/bondwidget.cpp
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "bondwidget.h"
|
||||||
|
#include "ui_bondwidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
BondWidget::BondWidget(QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
ui(new Ui::BondWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BondWidget::~BondWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BondWidget::clear()
|
||||||
|
{
|
||||||
|
ui->lineEdit_mode->setText(QString("balance-rr"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> BondWidget::getSettings()
|
||||||
|
{
|
||||||
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
|
if (isOk() != 0) return settings;
|
||||||
|
|
||||||
|
if (ui->lineEdit_mode->text() != QString("balance-rr"))
|
||||||
|
settings[QString("Mode")] = ui->lineEdit_mode->text();
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int BondWidget::isOk()
|
||||||
|
{
|
||||||
|
// all fine
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BondWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
|
if (settings.contains(QString("Mode")))
|
||||||
|
ui->lineEdit_mode->setText(settings[QString("Mode")]);
|
||||||
|
}
|
47
sources/gui/src/bondwidget.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef BONDWIDGET_H
|
||||||
|
#define BONDWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class BondWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class BondWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit BondWidget(QWidget *parent = 0);
|
||||||
|
~BondWidget();
|
||||||
|
QMap<QString, QString> getSettings();
|
||||||
|
int isOk();
|
||||||
|
void setSettings(const QMap<QString, QString> settings);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::BondWidget *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* BONDWIDGET_H */
|
71
sources/gui/src/bondwidget.ui
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>BondWidget</class>
|
||||||
|
<widget class="QWidget" name="BondWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>550</width>
|
||||||
|
<height>46</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_bond">
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Bond settings</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_bond">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_mode">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mode</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_mode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>The bonding policy. See the kernel documentation on bonding for details</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -40,26 +40,16 @@ void BridgeWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BridgeWidget::setShown(const bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
show();
|
|
||||||
else
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> BridgeWidget::getSettings()
|
QMap<QString, QString> BridgeWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> bridgeSettings;
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
if (isOk() != 0)
|
if (isOk() != 0) return settings;
|
||||||
return bridgeSettings;
|
|
||||||
|
|
||||||
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
||||||
bridgeSettings[QString("SkipForwardingDelay")] = QString("yes");
|
settings[QString("SkipForwardingDelay")] = QString("yes");
|
||||||
|
|
||||||
return bridgeSettings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -72,9 +62,9 @@ int BridgeWidget::isOk()
|
|||||||
|
|
||||||
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
|
void BridgeWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> bridgeSettings = settings;
|
clear();
|
||||||
|
|
||||||
if (bridgeSettings.contains(QString("SkipForwardingDelay")))
|
if (settings.contains(QString("SkipForwardingDelay")))
|
||||||
if (bridgeSettings[QString("SkipForwardingDelay")].remove(QString("'")) == QString("yes"))
|
if (settings[QString("SkipForwardingDelay")] == QString("yes"))
|
||||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void setShown(const bool state);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::BridgeWidget *ui;
|
Ui::BridgeWidget *ui;
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>424</width>
|
<width>550</width>
|
||||||
<height>76</height>
|
<height>44</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_bridge">
|
<widget class="QDockWidget" name="dockWidget_bridge">
|
||||||
<property name="features">
|
<property name="features">
|
||||||
@ -24,8 +24,29 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_bridge">
|
<widget class="QWidget" name="dockWidgetContents_bridge">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_skip">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labe_skip">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_skip">
|
<widget class="QCheckBox" name="checkBox_skip">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Skip (R)STP and immediately activate all bridge members</string>
|
<string>Skip (R)STP and immediately activate all bridge members</string>
|
||||||
</property>
|
</property>
|
||||||
@ -35,6 +56,8 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
243
sources/gui/src/calls.cpp
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "calls.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <listmap/listmap.h>
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "dbusoperation.h"
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer createProfileSlot(const QString profile, QMap<QString,QString> settings,
|
||||||
|
NetctlInterface* interface, const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->createProfile(profile, settings);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
args.append(mapToList(settings));
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Create"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->enableProfile(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Enable"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->removeProfile(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Remove"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->restartProfile(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Restart"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer startProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->startProfile(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Start"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer stopAllProfilesSlot(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->stopAllProfiles();
|
||||||
|
try {
|
||||||
|
int responce = sendRequestToInterface(QString("StopAll"), debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->switchToProfile(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("SwitchTo"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
||||||
|
NetctlInterface* interface, const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "ESSID" << essid;
|
||||||
|
|
||||||
|
|
||||||
|
if (!useHelper) return interface->connectToEssid(essid, settings);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(essid);
|
||||||
|
args.append(mapToList(settings));
|
||||||
|
int responce = sendRequestToInterfaceWithArgs(QString("Essid"), args, debug)[0].toInt();
|
||||||
|
return static_cast<InterfaceAnswer>(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return InterfaceAnswer::Error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
netctlInformation generalInformation(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->information();
|
||||||
|
try {
|
||||||
|
QList<QVariant> responce = sendRequestToInterface(QString("Information"), debug);
|
||||||
|
// main
|
||||||
|
netctlInformation info;
|
||||||
|
info.netctlAuto = responce[0].toStringList().takeFirst().toInt();
|
||||||
|
info.netctlAutoEnabled = responce[0].toStringList().takeFirst().toInt();
|
||||||
|
QList<netctlProfileInfo> profiles = parseOutputNetctl(responce);
|
||||||
|
for (int i=0; i<profiles.count(); i++) {
|
||||||
|
if (profiles[i].netctlAuto)
|
||||||
|
info.netctlAutoProfiles.append(profiles[i]);
|
||||||
|
else
|
||||||
|
info.netctlProfiles.append(profiles[i]);
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return netctlInformation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug)
|
||||||
|
{
|
||||||
|
if (!useHelper) return interface->profileSettings(profile);
|
||||||
|
try {
|
||||||
|
QList<QVariant> args;
|
||||||
|
args.append(profile);
|
||||||
|
QStringList responce = sendRequestToInterfaceWithArgs(QString("Profile"), args, debug)[0].toStringList();
|
||||||
|
return listToMap(responce);
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return QMap<QString, QString>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (!useHelper) return interface->status();
|
||||||
|
try {
|
||||||
|
QStringList responce = sendRequestToInterface(QString("Status"), debug)[0].toStringList();
|
||||||
|
netctlCurrent status;
|
||||||
|
status.netctlAuto = responce[0].toInt();
|
||||||
|
status.profiles = responce[1].split(QChar('|'));
|
||||||
|
status.current = responce[2].split(QChar('|'));
|
||||||
|
QStringList enables = responce[3].split(QChar('|'));
|
||||||
|
for (int i=0; i<enables.count(); i++)
|
||||||
|
status.enables.append(enables[i].toInt());
|
||||||
|
return status;
|
||||||
|
} catch (...) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "An exception recevied";
|
||||||
|
return netctlCurrent();
|
||||||
|
}
|
||||||
|
}
|
55
sources/gui/src/calls.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CALLS_H
|
||||||
|
#define CALLS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include <netctlgui/netctlgui.h>
|
||||||
|
|
||||||
|
|
||||||
|
// control
|
||||||
|
InterfaceAnswer createProfileSlot(const QString profile, const QMap<QString,QString> settings,
|
||||||
|
NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug = false);
|
||||||
|
InterfaceAnswer enableProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
InterfaceAnswer removeProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
InterfaceAnswer restartProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
InterfaceAnswer startProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
InterfaceAnswer stopAllProfilesSlot(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug = false);
|
||||||
|
InterfaceAnswer switchToProfileSlot(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
// wireless connection
|
||||||
|
InterfaceAnswer connectToEssid(const QString essid, QMap<QString,QString> settings,
|
||||||
|
NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug = false);
|
||||||
|
// information
|
||||||
|
netctlInformation generalInformation(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug = false);
|
||||||
|
QMap<QString, QString> profileInformation(const QString profile, NetctlInterface *interface,
|
||||||
|
const bool useHelper, const bool debug = false);
|
||||||
|
netctlCurrent trayInformation(NetctlInterface *interface, const bool useHelper,
|
||||||
|
const bool debug = false);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CALLS_H */
|
88
sources/gui/src/commonfunctions.cpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "commonfunctions.h"
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
#include <task/taskadds.h>
|
||||||
|
|
||||||
|
|
||||||
|
bool checkExternalApps(const QString apps, const QMap<QString, QString> configuration,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Applications" << apps;
|
||||||
|
|
||||||
|
if (configuration[QString("SKIPCOMPONENTS")] == QString("true")) return true;
|
||||||
|
QStringList cmd;
|
||||||
|
cmd.append("which");
|
||||||
|
// avoid null-lines arguments
|
||||||
|
cmd.append("true");
|
||||||
|
cmd.append(externalApps(apps, configuration));
|
||||||
|
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Run cmd" << cmd.join(QChar(' '));
|
||||||
|
TaskResult process = runTask(cmd.join(QChar(' ')), false);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
||||||
|
if (process.exitCode != 0)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
||||||
|
|
||||||
|
return (process.exitCode == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString checkStatus(const bool statusBool, const bool nullFalse)
|
||||||
|
{
|
||||||
|
if (statusBool) return QApplication::translate("MainWindow", "yes");
|
||||||
|
if (!nullFalse) return QApplication::translate("MainWindow", "no");
|
||||||
|
|
||||||
|
return QString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList externalApps(const QString apps, const QMap<QString, QString> configuration)
|
||||||
|
{
|
||||||
|
QStringList app;
|
||||||
|
// editor works always over cmd
|
||||||
|
if ((apps == QString("editor")) || (apps == QString("all"))) {
|
||||||
|
app.append(configuration[QString("EDITOR_PATH")]);
|
||||||
|
app.append(configuration[QString("SUDO_PATH")]);
|
||||||
|
}
|
||||||
|
if ((apps == QString("helper")) || (apps == QString("all"))) {
|
||||||
|
app.append(configuration[QString("HELPER_PATH")]);
|
||||||
|
}
|
||||||
|
if ((apps == QString("netctl")) || (apps == QString("all"))) {
|
||||||
|
app.append(configuration[QString("NETCTL_PATH")]);
|
||||||
|
app.append(configuration[QString("NETCTLAUTO_PATH")]);
|
||||||
|
}
|
||||||
|
if ((apps == QString("systemctl")) || (apps == QString("all"))) {
|
||||||
|
app.append(configuration[QString("SYSTEMCTL_PATH")]);
|
||||||
|
}
|
||||||
|
if ((apps == QString("wpasup")) || (apps == QString("wpasup-only")) || (apps == QString("all"))) {
|
||||||
|
app.append(configuration[QString("WPACLI_PATH")]);
|
||||||
|
app.append(configuration[QString("WPASUP_PATH")]);
|
||||||
|
}
|
||||||
|
// append sudo
|
||||||
|
// FORCE_SUDO is always true if helper is not running
|
||||||
|
if ((apps.contains(QRegExp(QString("(^all$|^editor$|^netctl$|^sudo$|^systemctl$|^wpasup$)")))) &&
|
||||||
|
(configuration[QString("FORCE_SUDO")] == QString("true")))
|
||||||
|
app.append(configuration[QString("SUDO_PATH")]);
|
||||||
|
|
||||||
|
return app;
|
||||||
|
}
|
33
sources/gui/src/commonfunctions.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef COMMONFUNCTIONS_H
|
||||||
|
#define COMMONFUNCTIONS_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
|
||||||
|
bool checkExternalApps(const QString apps = QString("all"),
|
||||||
|
const QMap<QString, QString> configuration = QMap<QString, QString>(),
|
||||||
|
const bool debug = false);
|
||||||
|
QString checkStatus(const bool statusBool, const bool nullFalse = false);
|
||||||
|
QStringList externalApps(const QString apps,
|
||||||
|
const QMap<QString, QString> configuration = QMap<QString, QString>());
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* COMMONFUNCTIONS_H */
|
155
sources/gui/src/dbusoperation.cpp
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "dbusoperation.h"
|
||||||
|
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMessage>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw)
|
||||||
|
{
|
||||||
|
QList<netctlProfileInfo> profileInfo;
|
||||||
|
if (raw.isEmpty()) return profileInfo;
|
||||||
|
QStringList list = raw[0].toStringList();
|
||||||
|
for (int i=0; i<list.count(); i++) {
|
||||||
|
QStringList info = list[i].split(QChar('|'));
|
||||||
|
if (info.count() != 8) continue;
|
||||||
|
netctlProfileInfo profile;
|
||||||
|
profile.name = info[0];
|
||||||
|
profile.description = info[1];
|
||||||
|
profile.type = info[2];
|
||||||
|
profile.interface = info[3];
|
||||||
|
profile.essid = info[4];
|
||||||
|
profile.active = info[5].toInt();
|
||||||
|
profile.enabled = info[6].toInt();
|
||||||
|
profile.netctlAuto = info[7].toInt();
|
||||||
|
profileInfo.append(profile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return profileInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw)
|
||||||
|
{
|
||||||
|
QList<netctlWifiInfo> wifiInfo;
|
||||||
|
if (raw.isEmpty()) return wifiInfo;
|
||||||
|
QStringList list = raw[0].toStringList();
|
||||||
|
for (int i=0; i<list.count(); i++) {
|
||||||
|
QStringList info = list[i].split(QChar('|'));
|
||||||
|
if (info.count() != 8) continue;
|
||||||
|
netctlWifiInfo wifi;
|
||||||
|
wifi.name = info[0];
|
||||||
|
wifi.security = info[1];
|
||||||
|
wifi.type = static_cast<PointType>(info[2].toInt());
|
||||||
|
for (int j=0; j<info[3].split(QChar(',')).count(); j++)
|
||||||
|
wifi.frequencies.append(info[3].split(QChar(','))[j].toInt());
|
||||||
|
wifi.macs = info[4].split(QChar(','));
|
||||||
|
wifi.signal = info[5].toInt();
|
||||||
|
wifi.active = info[6].toInt();
|
||||||
|
wifi.exists = info[7].toInt();
|
||||||
|
wifiInfo.append(wifi);
|
||||||
|
}
|
||||||
|
|
||||||
|
return wifiInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToHelper(const QString path, const QString cmd,
|
||||||
|
const QList<QVariant> args, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
||||||
|
|
||||||
|
QDBusConnection bus = QDBusConnection::systemBus();
|
||||||
|
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, path,
|
||||||
|
DBUS_HELPER_INTERFACE, cmd);
|
||||||
|
if (!args.isEmpty()) request.setArguments(args);
|
||||||
|
QDBusMessage response = bus.call(request, QDBus::BlockWithGui);
|
||||||
|
QList<QVariant> arguments = response.arguments();
|
||||||
|
if (arguments.isEmpty())
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage();
|
||||||
|
|
||||||
|
return arguments;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToCtrl(const QString cmd, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
|
||||||
|
return sendRequestToCtrlWithArgs(cmd, QList<QVariant>(), debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToCtrlWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
||||||
|
|
||||||
|
return sendRequestToHelper(DBUS_CTRL_PATH, cmd, args, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList< QVariant > sendRequestToInterface(const QString cmd, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
|
||||||
|
return sendRequestToInterfaceWithArgs(cmd, QList<QVariant>(), debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToInterfaceWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
||||||
|
|
||||||
|
return sendRequestToHelper(DBUS_INTERFACE_PATH, cmd, args, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToLib(const QString cmd, const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
|
||||||
|
return sendRequestToLibWithArgs(cmd, QList<QVariant>(), debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<QVariant> sendRequestToLibWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "args" << args;
|
||||||
|
|
||||||
|
return sendRequestToHelper(DBUS_LIB_PATH, cmd, args, debug);
|
||||||
|
}
|
41
sources/gui/src/dbusoperation.h
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef DBUSOPERATION_H
|
||||||
|
#define DBUSOPERATION_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
#include <netctlgui/netctlgui.h>
|
||||||
|
|
||||||
|
QList<netctlProfileInfo> parseOutputNetctl(const QList<QVariant> raw);
|
||||||
|
QList<netctlWifiInfo> parseOutputWifi(const QList<QVariant> raw);
|
||||||
|
QList<QVariant> sendRequestToHelper(const QString path, const QString cmd,
|
||||||
|
const QList<QVariant> args, const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToCtrl(const QString cmd, const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToCtrlWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToInterface(const QString cmd, const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToInterfaceWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToLib(const QString cmd, const bool debug = false);
|
||||||
|
QList<QVariant> sendRequestToLibWithArgs(const QString cmd, const QList<QVariant> args,
|
||||||
|
const bool debug = false);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DBUSOPERATION_H */
|
@ -16,81 +16,193 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "errorwindow.h"
|
#include "errorwindow.h"
|
||||||
#include "ui_errorwindow.h"
|
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QSpacerItem>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
ErrorWindow::ErrorWindow(QWidget *parent, const int messageNumber)
|
|
||||||
: QMainWindow(parent),
|
ErrorWindow::ErrorWindow(QWidget *parent, const bool debugCmd)
|
||||||
ui(new Ui::ErrorWindow)
|
: debug(debugCmd)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
|
||||||
qDebug() << "[ErrorWindow]" << "[ErrorWindow]" << ":" << "Initializate with error code" << messageNumber;
|
|
||||||
setMessage(messageNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ErrorWindow::~ErrorWindow()
|
ErrorWindow::~ErrorWindow()
|
||||||
{
|
{
|
||||||
delete ui;
|
if (debug) qDebug() << PDEBUG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorWindow::setMessage(const int mess)
|
|
||||||
|
QStringList ErrorWindow::getMessage(const int mess)
|
||||||
{
|
{
|
||||||
QString message;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||||
|
|
||||||
|
QString message, title;
|
||||||
switch(mess) {
|
switch(mess) {
|
||||||
case 1:
|
case 1:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Could not find components");
|
message = QApplication::translate("ErrorWindow", "Could not find components");
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
message = QApplication::translate("ErrorWindow", "Does not support yet");
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
message = QApplication::translate("ErrorWindow", "Profile name is not set");
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
message = QApplication::translate("ErrorWindow", "Bind interfaces are not set");
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Description is not set");
|
message = QApplication::translate("ErrorWindow", "Description is not set");
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
message = QApplication::translate("ErrorWindow", "Ip settings are not set");
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
message = QApplication::translate("ErrorWindow", "Configuration file does not exist");
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Key is not set");
|
message = QApplication::translate("ErrorWindow", "Key is not set");
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
message = QApplication::translate("ErrorWindow", "Wireless settings are not set");
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
message = QApplication::translate("ErrorWindow", "Configuration file is not set");
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
message = QApplication::translate("ErrorWindow", "ESSID is not set");
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
message = QApplication::translate("ErrorWindow", "MAC address is incorrect");
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
message = QApplication::translate("ErrorWindow", "Session ID is not set");
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "User is not in network group, helper will not be started");
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "APN is not set");
|
message = QApplication::translate("ErrorWindow", "APN is not set");
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
message = QApplication::translate("ErrorWindow", "Empty user/group name");
|
||||||
break;
|
break;
|
||||||
|
case 17:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "Could not find profile");
|
||||||
|
break;
|
||||||
|
case 18:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "Could not find ESSID");
|
||||||
|
break;
|
||||||
|
case 19:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "Could not run helper");
|
||||||
|
break;
|
||||||
|
case 20:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "IP address does not match the standard");
|
||||||
|
break;
|
||||||
|
case 21:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
|
message = QApplication::translate("ErrorWindow", "Key is required for 'gre' mode");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
title = QApplication::translate("ErrorWindow", "Error!");
|
||||||
message = QApplication::translate("ErrorWindow", "Unknown error");
|
message = QApplication::translate("ErrorWindow", "Unknown error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->label->setText(message);
|
QStringList fullMessage;
|
||||||
|
fullMessage.append(title);
|
||||||
|
fullMessage.append(message);
|
||||||
|
return fullMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMessageBox::Icon ErrorWindow::getIcon(const int mess)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||||
|
|
||||||
|
QMessageBox::Icon icon;
|
||||||
|
switch(mess) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
case 6:
|
||||||
|
case 7:
|
||||||
|
case 8:
|
||||||
|
case 9:
|
||||||
|
case 10:
|
||||||
|
case 11:
|
||||||
|
case 12:
|
||||||
|
case 13:
|
||||||
|
case 14:
|
||||||
|
case 15:
|
||||||
|
case 16:
|
||||||
|
case 17:
|
||||||
|
case 18:
|
||||||
|
case 19:
|
||||||
|
case 20:
|
||||||
|
case 21:
|
||||||
|
icon = QMessageBox::Critical;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
icon = QMessageBox::NoIcon;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ErrorWindow::showWindow(const int mess, const QString sender, const bool debugCmd)
|
||||||
|
{
|
||||||
|
if (debugCmd) qDebug() << PDEBUG;
|
||||||
|
if (debugCmd) qDebug() << PDEBUG << ":" << "Message" << mess;
|
||||||
|
if (debugCmd) qDebug() << PDEBUG << ":" << "Sender" << sender;
|
||||||
|
|
||||||
|
ErrorWindow *errorWin = new ErrorWindow(0, debugCmd);
|
||||||
|
QStringList message = errorWin->getMessage(mess);
|
||||||
|
QMessageBox messageBox;
|
||||||
|
messageBox.setText(message[0]);
|
||||||
|
messageBox.setInformativeText(message[1]);
|
||||||
|
if (mess == 1)
|
||||||
|
messageBox.setDetailedText(sender);
|
||||||
|
else if (debugCmd)
|
||||||
|
messageBox.setDetailedText(QApplication::translate("ErrorWindow", "Sender : %1").arg(sender));
|
||||||
|
messageBox.setIcon(errorWin->getIcon(mess));
|
||||||
|
messageBox.setStandardButtons(QMessageBox::Ok);
|
||||||
|
messageBox.setDefaultButton(QMessageBox::Ok);
|
||||||
|
|
||||||
|
QSpacerItem *horizontalSpacer = new QSpacerItem(400, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
QGridLayout *layout = (QGridLayout *)messageBox.layout();
|
||||||
|
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
|
||||||
|
|
||||||
|
messageBox.exec();
|
||||||
|
delete errorWin;
|
||||||
}
|
}
|
||||||
|
@ -18,25 +18,29 @@
|
|||||||
#ifndef ERRORWINDOW_H
|
#ifndef ERRORWINDOW_H
|
||||||
#define ERRORWINDOW_H
|
#define ERRORWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMessageBox>
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
class ErrorWindow : public QObject
|
||||||
class ErrorWindow;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ErrorWindow : public QMainWindow
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ErrorWindow(QWidget *parent = 0,
|
explicit ErrorWindow(QWidget *parent = 0,
|
||||||
const int messageNumber = 0);
|
const bool debugCmd = false);
|
||||||
~ErrorWindow();
|
~ErrorWindow();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
static void showWindow(const int mess = 0,
|
||||||
|
const QString sender = QString(),
|
||||||
|
const bool debugCmd = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ErrorWindow *ui;
|
bool debug;
|
||||||
void setMessage(const int mess);
|
QStringList getMessage(const int mess);
|
||||||
|
QMessageBox::Icon getIcon(const int mess);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* ERRORWINDOW_H */
|
#endif /* ERRORWINDOW_H */
|
||||||
|
@ -1,123 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ErrorWindow</class>
|
|
||||||
<widget class="QMainWindow" name="ErrorWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>287</width>
|
|
||||||
<height>101</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Error</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_main">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Error text</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer1">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>10</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_button">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_button1">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Ok</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_button2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>pushButton</sender>
|
|
||||||
<signal>clicked(bool)</signal>
|
|
||||||
<receiver>ErrorWindow</receiver>
|
|
||||||
<slot>close()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>143</x>
|
|
||||||
<y>83</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>252</x>
|
|
||||||
<y>80</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@ -46,6 +46,7 @@ void EthernetWidget::clear()
|
|||||||
showWpa(ui->checkBox_8021x->checkState());
|
showWpa(ui->checkBox_8021x->checkState());
|
||||||
ui->lineEdit_wpaConfig->clear();
|
ui->lineEdit_wpaConfig->clear();
|
||||||
ui->comboBox_driver->setCurrentIndex(0);
|
ui->comboBox_driver->setCurrentIndex(0);
|
||||||
|
ui->spinBox_priority->setValue(1);
|
||||||
ui->spinBox_timeoutCarrier->setValue(5);
|
ui->spinBox_timeoutCarrier->setValue(5);
|
||||||
ui->spinBox_timeoutWpa->setValue(15);
|
ui->spinBox_timeoutWpa->setValue(15);
|
||||||
|
|
||||||
@ -54,15 +55,6 @@ void EthernetWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::setShown(const bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
show();
|
|
||||||
else
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::createActions()
|
void EthernetWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ethernetAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
@ -73,8 +65,7 @@ void EthernetWidget::createActions()
|
|||||||
|
|
||||||
void EthernetWidget::selectWpaConfig()
|
void EthernetWidget::selectWpaConfig()
|
||||||
{
|
{
|
||||||
QString filename = QFileDialog::getOpenFileName(
|
QString filename = QFileDialog::getOpenFileName(this,
|
||||||
this,
|
|
||||||
QApplication::translate("EthernetWidget", "Select wpa configuration file"),
|
QApplication::translate("EthernetWidget", "Select wpa configuration file"),
|
||||||
QDir::currentPath(),
|
QDir::currentPath(),
|
||||||
QApplication::translate("EthernetWidget", "Configuration files (*.conf)"));
|
QApplication::translate("EthernetWidget", "Configuration files (*.conf)"));
|
||||||
@ -87,44 +78,41 @@ void EthernetWidget::showAdvanced()
|
|||||||
{
|
{
|
||||||
if (ui->pushButton_ethernetAdvanced->isChecked()) {
|
if (ui->pushButton_ethernetAdvanced->isChecked()) {
|
||||||
ui->widget_ethernetAdvanced->setHidden(false);
|
ui->widget_ethernetAdvanced->setHidden(false);
|
||||||
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Hide advanced"));
|
ui->pushButton_ethernetAdvanced->setArrowType(Qt::UpArrow);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ui->widget_ethernetAdvanced->setHidden(true);
|
ui->widget_ethernetAdvanced->setHidden(true);
|
||||||
ui->pushButton_ethernetAdvanced->setText(QApplication::translate("EthernetWidget", "Show advanced"));
|
ui->pushButton_ethernetAdvanced->setArrowType(Qt::DownArrow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EthernetWidget::showWpa(const int state)
|
void EthernetWidget::showWpa(const int state)
|
||||||
{
|
{
|
||||||
if (state == 0)
|
ui->widget_wpa->setHidden(state == 0);
|
||||||
ui->widget_wpa->setHidden(true);
|
|
||||||
else
|
|
||||||
ui->widget_wpa->setHidden(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> EthernetWidget::getSettings()
|
QMap<QString, QString> EthernetWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> ethernetSettings;
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
if (isOk() != 0)
|
if (isOk() != 0) return settings;
|
||||||
return ethernetSettings;
|
|
||||||
|
|
||||||
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
if (ui->checkBox_skip->checkState() == Qt::Checked)
|
||||||
ethernetSettings[QString("SkipNoCarrier")] = QString("yes");
|
settings[QString("SkipNoCarrier")] = QString("yes");
|
||||||
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
|
if (ui->checkBox_8021x->checkState() == Qt::Checked) {
|
||||||
ethernetSettings[QString("Auth8021X")] = QString("yes");
|
settings[QString("Auth8021X")] = QString("yes");
|
||||||
ethernetSettings[QString("WPAConfigFile")] = QString("'") + ui->lineEdit_wpaConfig->text() + QString("'");
|
settings[QString("WPAConfigFile")] = QString("'%1'").arg(ui->lineEdit_wpaConfig->text());
|
||||||
ethernetSettings[QString("WPADriver")] = ui->comboBox_driver->currentText();
|
settings[QString("WPADriver")] = ui->comboBox_driver->currentText();
|
||||||
}
|
}
|
||||||
|
if (ui->spinBox_priority->value() != 1)
|
||||||
|
settings[QString("Priority")] = QString::number(ui->spinBox_priority->value());
|
||||||
if (ui->spinBox_timeoutCarrier->value() != 5)
|
if (ui->spinBox_timeoutCarrier->value() != 5)
|
||||||
ethernetSettings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
|
settings[QString("TimeoutCarrier")] = QString::number(ui->spinBox_timeoutCarrier->value());
|
||||||
if (ui->spinBox_timeoutWpa->value() != 15)
|
if (ui->spinBox_timeoutWpa->value() != 15)
|
||||||
ethernetSettings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
|
settings[QString("TimeoutWPA")] = QString::number(ui->spinBox_timeoutWpa->value());
|
||||||
|
|
||||||
return ethernetSettings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,8 +120,7 @@ int EthernetWidget::isOk()
|
|||||||
{
|
{
|
||||||
// file wpa_supplicant doesn't exists
|
// file wpa_supplicant doesn't exists
|
||||||
if (!ui->lineEdit_wpaConfig->text().isEmpty())
|
if (!ui->lineEdit_wpaConfig->text().isEmpty())
|
||||||
if (!QFile(ui->lineEdit_wpaConfig->text()).exists())
|
if (!QFile(ui->lineEdit_wpaConfig->text()).exists()) return 1;
|
||||||
return 1;
|
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -141,24 +128,26 @@ int EthernetWidget::isOk()
|
|||||||
|
|
||||||
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
void EthernetWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> ethernetSettings = settings;
|
clear();
|
||||||
|
|
||||||
if (ethernetSettings.contains(QString("SkipNoCarrier")))
|
if (settings.contains(QString("SkipNoCarrier")))
|
||||||
if (ethernetSettings[QString("SkipNoCarrier")].remove(QString("'")) == QString("yes"))
|
if (settings[QString("SkipNoCarrier")] == QString("yes"))
|
||||||
ui->checkBox_skip->setCheckState(Qt::Checked);
|
ui->checkBox_skip->setCheckState(Qt::Checked);
|
||||||
if (ethernetSettings.contains(QString("Auth8021X")))
|
if (settings.contains(QString("Auth8021X")))
|
||||||
if (ethernetSettings[QString("Auth8021X")].remove(QString("'")) == QString("yes"))
|
if (settings[QString("Auth8021X")] == QString("yes"))
|
||||||
ui->checkBox_8021x->setCheckState(Qt::Checked);
|
ui->checkBox_8021x->setCheckState(Qt::Checked);
|
||||||
if (ethernetSettings.contains(QString("WPAConfigFile")))
|
if (settings.contains(QString("WPAConfigFile")))
|
||||||
ui->lineEdit_wpaConfig->setText(ethernetSettings[QString("WPAConfigFile")].remove(QString("'")));
|
ui->lineEdit_wpaConfig->setText(settings[QString("WPAConfigFile")]);
|
||||||
if (ethernetSettings.contains(QString("WPADriver")))
|
if (settings.contains(QString("WPADriver"))) {
|
||||||
for (int i=0; i<ui->comboBox_driver->count(); i++)
|
int index = ui->comboBox_driver->findText(settings[QString("WPADriver")]);
|
||||||
if (ethernetSettings[QString("WPADriver")].remove(QString("'")) == ui->comboBox_driver->itemText(i))
|
ui->comboBox_driver->setCurrentIndex(index);
|
||||||
ui->comboBox_driver->setCurrentIndex(i);
|
}
|
||||||
if (ethernetSettings.contains(QString("TimeoutCarrier")))
|
if (settings.contains(QString("Priority")))
|
||||||
ui->spinBox_timeoutCarrier->setValue(ethernetSettings[QString("TimeoutCarrier")].toInt());
|
ui->spinBox_priority->setValue(settings[QString("Priority")].toInt());
|
||||||
if (ethernetSettings.contains(QString("TimeoutWPA")))
|
if (settings.contains(QString("TimeoutCarrier")))
|
||||||
ui->spinBox_timeoutWpa->setValue(ethernetSettings[QString("TimeoutWPA")].toInt());
|
ui->spinBox_timeoutCarrier->setValue(settings[QString("TimeoutCarrier")].toInt());
|
||||||
|
if (settings.contains(QString("TimeoutWPA")))
|
||||||
|
ui->spinBox_timeoutWpa->setValue(settings[QString("TimeoutWPA")].toInt());
|
||||||
|
|
||||||
showWpa(ui->checkBox_8021x->checkState());
|
showWpa(ui->checkBox_8021x->checkState());
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void setShown(const bool state);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void selectWpaConfig();
|
void selectWpaConfig();
|
||||||
|
@ -6,14 +6,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>431</width>
|
<width>550</width>
|
||||||
<height>296</height>
|
<height>255</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_ethernet">
|
<widget class="QDockWidget" name="dockWidget_ethernet">
|
||||||
<property name="features">
|
<property name="features">
|
||||||
@ -24,29 +24,29 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_ethernet">
|
<widget class="QWidget" name="dockWidgetContents_ethernet">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
|
<layout class="QHBoxLayout" name="layout_ethernetAdvanced">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_ethernetAdvanced">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_ethernetAdvanced">
|
<widget class="QToolButton" name="pushButton_ethernetAdvanced">
|
||||||
<property name="text">
|
|
||||||
<string>Hide advanced</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="arrowType">
|
||||||
|
<enum>Qt::DownArrow</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -54,8 +54,29 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
|
<widget class="QWidget" name="widget_ethernetAdvanced" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_skip">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_skip">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_skip">
|
<widget class="QCheckBox" name="checkBox_skip">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html></string>
|
<string><html><head/><body><p>Whether or not the absence of a carrier is acceptable</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
@ -64,8 +85,28 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_8021x">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_8021x">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_8021x">
|
<widget class="QCheckBox" name="checkBox_8021x">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Set to ‘yes’ to use 802.1x authentication</string>
|
<string>Set to ‘yes’ to use 802.1x authentication</string>
|
||||||
</property>
|
</property>
|
||||||
@ -77,26 +118,40 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_wpa" native="true">
|
<widget class="QWidget" name="widget_wpa" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_wpaConfig">
|
<layout class="QHBoxLayout" name="layout_wpaConfig">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_wpaConfig">
|
<widget class="QLabel" name="label_wpaConfig">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>7</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>WPA config file</string>
|
<string>WPA config file</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_wpaConfig">
|
<widget class="QLineEdit" name="lineEdit_wpaConfig">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>10</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Path to a wpa_supplicant configuration file</string>
|
<string>Path to a wpa_supplicant configuration file</string>
|
||||||
</property>
|
</property>
|
||||||
@ -104,6 +159,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_wpaConfig">
|
<widget class="QPushButton" name="pushButton_wpaConfig">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>4</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Browse</string>
|
<string>Browse</string>
|
||||||
</property>
|
</property>
|
||||||
@ -115,19 +176,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_driver">
|
<layout class="QHBoxLayout" name="layout_driver">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_driver">
|
<widget class="QLabel" name="label_driver">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>7</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>WPA driver</string>
|
<string>WPA driver</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_driver">
|
<widget class="QComboBox" name="comboBox_driver">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>14</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
|
<string>The wpa_supplicant driver to use for 802.1x authentication</string>
|
||||||
</property>
|
</property>
|
||||||
@ -157,19 +227,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
|
<layout class="QHBoxLayout" name="layout_timeoutCarrier">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_timeoutCarrier">
|
<widget class="QLabel" name="label_timeoutCarrier">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>1</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout carrier</string>
|
<string>Timeout carrier</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBox_timeoutCarrier">
|
<widget class="QSpinBox" name="spinBox_timeoutCarrier">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Maximum time, in seconds, to wait for a carrier</string>
|
<string>Maximum time, in seconds, to wait for a carrier</string>
|
||||||
</property>
|
</property>
|
||||||
@ -187,19 +266,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_timeoutWpa">
|
<layout class="QHBoxLayout" name="layout_timeoutWpa">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_timeoutWpa">
|
<widget class="QLabel" name="label_timeoutWpa">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>1</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Timeout WPA</string>
|
<string>Timeout WPA</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="spinBox_timeoutWpa">
|
<widget class="QSpinBox" name="spinBox_timeoutWpa">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
|
<string>Maximum time, in seconds, to wait for 802.1x authentication to succeed</string>
|
||||||
</property>
|
</property>
|
||||||
@ -213,6 +301,45 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_priority">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_priority">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Priority</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_priority">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Priority level of the profile. In case of automatic profile selection, profiles are tried in decreasing order of priority</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>999</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -223,9 +350,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>pushButton_ethernetAdvanced</tabstop>
|
|
||||||
<tabstop>checkBox_skip</tabstop>
|
|
||||||
<tabstop>checkBox_8021x</tabstop>
|
|
||||||
<tabstop>lineEdit_wpaConfig</tabstop>
|
<tabstop>lineEdit_wpaConfig</tabstop>
|
||||||
<tabstop>pushButton_wpaConfig</tabstop>
|
<tabstop>pushButton_wpaConfig</tabstop>
|
||||||
<tabstop>comboBox_driver</tabstop>
|
<tabstop>comboBox_driver</tabstop>
|
||||||
|
@ -59,6 +59,7 @@ void GeneralWidget::clear()
|
|||||||
ui->listWidget_after->clear();
|
ui->listWidget_after->clear();
|
||||||
ui->lineEdit_execUpPost->clear();
|
ui->lineEdit_execUpPost->clear();
|
||||||
ui->lineEdit_execDownPre->clear();
|
ui->lineEdit_execDownPre->clear();
|
||||||
|
ui->checkBox_exclude->setCheckState(Qt::Unchecked);
|
||||||
ui->checkBox_forceConnect->setCheckState(Qt::Unchecked);
|
ui->checkBox_forceConnect->setCheckState(Qt::Unchecked);
|
||||||
ui->checkBox_debug->setCheckState(Qt::Unchecked);
|
ui->checkBox_debug->setCheckState(Qt::Unchecked);
|
||||||
|
|
||||||
@ -67,20 +68,13 @@ void GeneralWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GeneralWidget::setShown(const bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
show();
|
|
||||||
else
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GeneralWidget::createActions()
|
void GeneralWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_generalAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
connect(ui->pushButton_after, SIGNAL(clicked(bool)), this, SLOT(addAfter()));
|
connect(ui->pushButton_after, SIGNAL(clicked(bool)), this, SLOT(addAfter()));
|
||||||
|
connect(ui->comboBox_after->lineEdit(), SIGNAL(returnPressed()), this, SLOT(addAfter()));
|
||||||
connect(ui->pushButton_bindto, SIGNAL(clicked(bool)), this, SLOT(addBindTo()));
|
connect(ui->pushButton_bindto, SIGNAL(clicked(bool)), this, SLOT(addBindTo()));
|
||||||
|
connect(ui->comboBox_bindto->lineEdit(), SIGNAL(returnPressed()), this, SLOT(addBindTo()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,10 +94,10 @@ void GeneralWidget::keyPressEvent(QKeyEvent *pressedKey)
|
|||||||
{
|
{
|
||||||
if (pressedKey->key() == Qt::Key_Delete) {
|
if (pressedKey->key() == Qt::Key_Delete) {
|
||||||
if (ui->listWidget_bindto->hasFocus() &&
|
if (ui->listWidget_bindto->hasFocus() &&
|
||||||
(ui->listWidget_bindto->currentItem() != 0))
|
(ui->listWidget_bindto->currentItem() != nullptr))
|
||||||
delete ui->listWidget_bindto->currentItem();
|
delete ui->listWidget_bindto->currentItem();
|
||||||
else if (ui->listWidget_after->hasFocus() &&
|
else if (ui->listWidget_after->hasFocus() &&
|
||||||
(ui->listWidget_after->currentItem() != 0))
|
(ui->listWidget_after->currentItem() != nullptr))
|
||||||
delete ui->listWidget_after->currentItem();
|
delete ui->listWidget_after->currentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -114,8 +108,7 @@ void GeneralWidget::showAdvanced()
|
|||||||
if (ui->pushButton_generalAdvanced->isChecked()) {
|
if (ui->pushButton_generalAdvanced->isChecked()) {
|
||||||
ui->widget_generalAdvanced->setHidden(false);
|
ui->widget_generalAdvanced->setHidden(false);
|
||||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
|
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Hide advanced"));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ui->widget_generalAdvanced->setHidden(true);
|
ui->widget_generalAdvanced->setHidden(true);
|
||||||
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
|
ui->pushButton_generalAdvanced->setText(QApplication::translate("GeneralWidget", "Show advanced"));
|
||||||
}
|
}
|
||||||
@ -124,36 +117,37 @@ void GeneralWidget::showAdvanced()
|
|||||||
|
|
||||||
QMap<QString, QString> GeneralWidget::getSettings()
|
QMap<QString, QString> GeneralWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> generalSettings;
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
if (isOk() != 0)
|
if (isOk() != 0) return settings;
|
||||||
return generalSettings;
|
|
||||||
|
|
||||||
generalSettings[QString("Description")] = QString("'") + ui->lineEdit_description->text() + QString("'");
|
settings[QString("Description")] = QString("'%1'").arg(ui->lineEdit_description->text());
|
||||||
generalSettings[QString("Connection")] = ui->comboBox_connection->currentText();
|
settings[QString("Connection")] = ui->comboBox_connection->currentText();
|
||||||
generalSettings[QString("Interface")] = ui->comboBox_interface->currentText();
|
settings[QString("Interface")] = ui->comboBox_interface->currentText();
|
||||||
if (ui->listWidget_bindto->count() != 0) {
|
if (ui->listWidget_bindto->count() != 0) {
|
||||||
QStringList interfaces;
|
QStringList interfaces;
|
||||||
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
for (int i=0; i<ui->listWidget_bindto->count(); i++)
|
||||||
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
interfaces.append(ui->listWidget_bindto->item(i)->text());
|
||||||
generalSettings[QString("BindsToInterfaces")] = interfaces.join(QString(" "));
|
settings[QString("BindsToInterfaces")] = interfaces.join(QChar(' '));
|
||||||
}
|
}
|
||||||
if (ui->listWidget_after->count() != 0) {
|
if (ui->listWidget_after->count() != 0) {
|
||||||
QStringList profiles;
|
QStringList profiles;
|
||||||
for (int i=0; i<ui->listWidget_after->count(); i++)
|
for (int i=0; i<ui->listWidget_after->count(); i++)
|
||||||
profiles.append(ui->listWidget_after->item(i)->text());
|
profiles.append(ui->listWidget_after->item(i)->text());
|
||||||
generalSettings[QString("After")] = profiles.join(QString(" "));
|
settings[QString("After")] = profiles.join(QChar(' '));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
if (!ui->lineEdit_execUpPost->text().isEmpty())
|
||||||
generalSettings[QString("ExecUpPost")] = QString("'") + ui->lineEdit_execUpPost->text() + QString("'");
|
settings[QString("ExecUpPost")] = QString("'%1'").arg(ui->lineEdit_execUpPost->text());
|
||||||
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
if (!ui->lineEdit_execDownPre->text().isEmpty())
|
||||||
generalSettings[QString("ExecDownPre")] = QString("'") + ui->lineEdit_execDownPre->text() + QString("'");
|
settings[QString("ExecDownPre")] = QString("'%1'").arg(ui->lineEdit_execDownPre->text());
|
||||||
|
if (ui->checkBox_exclude->checkState() == Qt::Checked)
|
||||||
|
settings[QString("ExcludeAuto")] = QString("yes");
|
||||||
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
if (ui->checkBox_forceConnect->checkState() == Qt::Checked)
|
||||||
generalSettings[QString("ForceConnect")] = QString("yes");
|
settings[QString("ForceConnect")] = QString("yes");
|
||||||
if (ui->checkBox_debug->checkState() == Qt::Checked)
|
if (ui->checkBox_debug->checkState() == Qt::Checked)
|
||||||
generalSettings[QString("NETCTL_DEBUG")] = QString("yes");
|
settings[QString("NETCTL_DEBUG")] = QString("yes");
|
||||||
|
|
||||||
return generalSettings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,12 +156,12 @@ int GeneralWidget::isOk()
|
|||||||
// bind interfaces is not set
|
// bind interfaces is not set
|
||||||
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
if ((ui->comboBox_connection->currentText() == QString("bond")) ||
|
||||||
(ui->comboBox_connection->currentText() == QString("bridge")) ||
|
(ui->comboBox_connection->currentText() == QString("bridge")) ||
|
||||||
(ui->comboBox_connection->currentText() == QString("vlan")))
|
(ui->comboBox_connection->currentText() == QString("vlan")) ||
|
||||||
if (ui->listWidget_bindto->count() == 0)
|
(ui->comboBox_connection->currentText() == QString("macvlan")) ||
|
||||||
return 1;
|
(ui->comboBox_connection->currentText() == QString("openvswitch")))
|
||||||
|
if (ui->listWidget_bindto->count() == 0) return 1;
|
||||||
// empty description
|
// empty description
|
||||||
if (ui->lineEdit_description->text().isEmpty())
|
if (ui->lineEdit_description->text().isEmpty()) return 2;
|
||||||
return 2;
|
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -175,30 +169,33 @@ int GeneralWidget::isOk()
|
|||||||
|
|
||||||
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
void GeneralWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> generalSettings = settings;
|
clear();
|
||||||
|
|
||||||
if (generalSettings.contains(QString("Description")))
|
if (settings.contains(QString("Description")))
|
||||||
ui->lineEdit_description->setText(generalSettings[QString("Description")].remove(QString("'")));
|
ui->lineEdit_description->setText(settings[QString("Description")]);
|
||||||
if (generalSettings.contains(QString("Connection")))
|
if (settings.contains(QString("Connection"))) {
|
||||||
for (int i=0; i<ui->comboBox_connection->count(); i++)
|
int index = ui->comboBox_connection->findText(settings[QString("Connection")]);
|
||||||
if (generalSettings[QString("Connection")].remove(QString("'")) == ui->comboBox_connection->itemText(i))
|
ui->comboBox_connection->setCurrentIndex(index);
|
||||||
ui->comboBox_connection->setCurrentIndex(i);
|
}
|
||||||
if (generalSettings.contains(QString("Interface")))
|
if (settings.contains(QString("Interface"))) {
|
||||||
for (int i=0; i<ui->comboBox_interface->count(); i++)
|
ui->comboBox_interface->addItem(settings[QString("Interface")]);
|
||||||
if (generalSettings[QString("Interface")].remove(QString("'")) == ui->comboBox_interface->itemText(i))
|
ui->comboBox_interface->setCurrentIndex(ui->comboBox_interface->count() - 1);
|
||||||
ui->comboBox_interface->setCurrentIndex(i);
|
}
|
||||||
if (generalSettings.contains(QString("BindsToInterfaces")))
|
if (settings.contains(QString("BindsToInterfaces")))
|
||||||
ui->listWidget_bindto->addItems(generalSettings[QString("BindsToInterfaces")].split(QString(" ")));
|
ui->listWidget_bindto->addItems(settings[QString("BindsToInterfaces")].split(QChar('\n')));
|
||||||
if (generalSettings.contains(QString("After")))
|
if (settings.contains(QString("After")))
|
||||||
ui->listWidget_after->addItems(generalSettings[QString("After")].split(QString(" ")));
|
ui->listWidget_after->addItems(settings[QString("After")].split(QChar('\n')));
|
||||||
if (generalSettings.contains(QString("ExecUpPost")))
|
if (settings.contains(QString("ExecUpPost")))
|
||||||
ui->lineEdit_execUpPost->setText(generalSettings[QString("ExecUpPost")].remove(QString("'")));
|
ui->lineEdit_execUpPost->setText(settings[QString("ExecUpPost")]);
|
||||||
if (generalSettings.contains(QString("ExecDownPre")))
|
if (settings.contains(QString("ExecDownPre")))
|
||||||
ui->lineEdit_execDownPre->setText(generalSettings[QString("ExecDownPre")].remove(QString("'")));
|
ui->lineEdit_execDownPre->setText(settings[QString("ExecDownPre")]);
|
||||||
if (generalSettings.contains(QString("ForceConnect")))
|
if (settings.contains(QString("ExcludeAuto")))
|
||||||
if (generalSettings[QString("ForceConnect")].remove(QString("'")) == QString("yes"))
|
if (settings[QString("ExcludeAuto")] == QString("yes"))
|
||||||
|
ui->checkBox_exclude->setCheckState(Qt::Checked);
|
||||||
|
if (settings.contains(QString("ForceConnect")))
|
||||||
|
if (settings[QString("ForceConnect")] == QString("yes"))
|
||||||
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
ui->checkBox_forceConnect->setCheckState(Qt::Checked);
|
||||||
if (generalSettings.contains(QString("NETCTL_DEBUG")))
|
if (settings.contains(QString("NETCTL_DEBUG")))
|
||||||
if (generalSettings[QString("NETCTL_DEBUG")].remove(QString("'")) == QString("yes"))
|
if (settings[QString("NETCTL_DEBUG")] == QString("yes"))
|
||||||
ui->checkBox_debug->setCheckState(Qt::Checked);
|
ui->checkBox_debug->setCheckState(Qt::Checked);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void setShown(const bool state);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addAfter();
|
void addAfter();
|
||||||
|
@ -6,16 +6,22 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>431</width>
|
<width>550</width>
|
||||||
<height>537</height>
|
<height>479</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDockWidget" name="dockWidget_general">
|
<widget class="QDockWidget" name="dockWidget_general">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="features">
|
<property name="features">
|
||||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||||
</property>
|
</property>
|
||||||
@ -24,25 +30,37 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="dockWidgetContents_general">
|
<widget class="QWidget" name="dockWidgetContents_general">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_description">
|
<layout class="QHBoxLayout" name="layout_description">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_description">
|
<widget class="QLabel" name="label_description">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>1</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Description</string>
|
<string>Description</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_description">
|
<widget class="QLineEdit" name="lineEdit_description">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>A description of the profile</p></body></html></string>
|
<string>A description of the profile</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -52,19 +70,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_connection">
|
<layout class="QHBoxLayout" name="layout_connection">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_connection">
|
<widget class="QLabel" name="label_connection">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>1</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connection</string>
|
<string>Connection</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_connection">
|
<widget class="QComboBox" name="comboBox_connection">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The connection type used by the profile</string>
|
<string>The connection type used by the profile</string>
|
||||||
</property>
|
</property>
|
||||||
@ -118,6 +145,16 @@
|
|||||||
<string notr="true">vlan</string>
|
<string notr="true">vlan</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">macvlan</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">openvswitch</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -126,19 +163,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_interface">
|
<layout class="QHBoxLayout" name="layout_interface">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_interface">
|
<widget class="QLabel" name="label_interface">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>1</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Interface</string>
|
<string>Interface</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_interface">
|
<widget class="QComboBox" name="comboBox_interface">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>The name of the associated network interface</string>
|
<string>The name of the associated network interface</string>
|
||||||
</property>
|
</property>
|
||||||
@ -155,18 +201,27 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_bindtoButton">
|
<layout class="QHBoxLayout" name="layout_bindtoButton">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_bindto">
|
<widget class="QLabel" name="label_bindto">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>7</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Binds to interfaces</string>
|
<string>Binds to interfaces</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_bindto">
|
<widget class="QComboBox" name="comboBox_bindto">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<width>150</width>
|
<horstretch>10</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -175,6 +230,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_bindto">
|
<widget class="QPushButton" name="pushButton_bindto">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>4</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
@ -200,26 +261,23 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_generalAdvanced">
|
<layout class="QHBoxLayout" name="layout_generalAdvanced">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_generalAdvanced">
|
<widget class="Line" name="line">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_generalAdvanced">
|
<widget class="QToolButton" name="pushButton_generalAdvanced">
|
||||||
<property name="text">
|
|
||||||
<string>Hide advanced</string>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="arrowType">
|
||||||
|
<enum>Qt::DownArrow</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@ -227,24 +285,36 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
<widget class="QWidget" name="widget_generalAdvanced" native="true">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="layout_after">
|
<layout class="QVBoxLayout" name="layout_after">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_afterButton">
|
<layout class="QHBoxLayout" name="layout_afterButton">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_after">
|
<widget class="QLabel" name="label_after">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>7</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>After</string>
|
<string>After</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBox_after">
|
<widget class="QComboBox" name="comboBox_after">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<width>150</width>
|
<horstretch>10</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="editable">
|
<property name="editable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -253,6 +323,12 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_after">
|
<widget class="QPushButton" name="pushButton_after">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>4</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
@ -279,19 +355,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_execUpPost">
|
<layout class="QHBoxLayout" name="layout_execUpPost">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_execUpPost">
|
<widget class="QLabel" name="label_execUpPost">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>7</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Command after starting</string>
|
<string>Command after starting</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_execUpPost">
|
<widget class="QLineEdit" name="lineEdit_execUpPost">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>14</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A command that is executed after a connection is established</string>
|
<string>A command that is executed after a connection is established</string>
|
||||||
</property>
|
</property>
|
||||||
@ -303,19 +388,28 @@
|
|||||||
<layout class="QHBoxLayout" name="layout_execDownPre">
|
<layout class="QHBoxLayout" name="layout_execDownPre">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_execDownPre">
|
<widget class="QLabel" name="label_execDownPre">
|
||||||
<property name="minimumSize">
|
<property name="sizePolicy">
|
||||||
<size>
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
<width>150</width>
|
<horstretch>7</horstretch>
|
||||||
<height>0</height>
|
<verstretch>0</verstretch>
|
||||||
</size>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Command before stoping</string>
|
<string>Command before stoping</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="lineEdit_execDownPre">
|
<widget class="QLineEdit" name="lineEdit_execDownPre">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>14</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>A command that is executed before a connection is brought down</string>
|
<string>A command that is executed before a connection is brought down</string>
|
||||||
</property>
|
</property>
|
||||||
@ -323,8 +417,56 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_exclude">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_exclude">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_exclude">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Whether or not to exclude this profile from automatic profile selection</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Exclude auto</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_forceConnect">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_forceConnect">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>7</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_forceConnect">
|
<widget class="QCheckBox" name="checkBox_forceConnect">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>14</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Set to ‘yes’ to force connecting even if the interface is up</string>
|
<string>Set to ‘yes’ to force connecting even if the interface is up</string>
|
||||||
</property>
|
</property>
|
||||||
@ -333,14 +475,36 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>7</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_debug">
|
<widget class="QCheckBox" name="checkBox_debug">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>14</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Debug mode</string>
|
<string>Debug mode</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="1">
|
|
||||||
<libraries>
|
|
||||||
<library>qt</library>
|
|
||||||
</libraries>
|
|
||||||
</project>
|
|
83
sources/gui/src/ipregexp.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "ipregexp.h"
|
||||||
|
|
||||||
|
|
||||||
|
IpRegExp::IpRegExp(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IpRegExp::~IpRegExp()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExp IpRegExp::ip4Regex()
|
||||||
|
{
|
||||||
|
return QRegExp(QString("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExp IpRegExp::ip4CidrRegex()
|
||||||
|
{
|
||||||
|
return QRegExp(QString("^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])(/([0-9]|[1-2][0-9]|3[0-2]))$"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExp IpRegExp::ip6Regex()
|
||||||
|
{
|
||||||
|
return QRegExp(QString("^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExp IpRegExp::ip6CidrRegex()
|
||||||
|
{
|
||||||
|
return QRegExp(QString("^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(/(d|dd|1[0-1]d|12[0-8]))$"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExpValidator *IpRegExp::ipv4Validator()
|
||||||
|
{
|
||||||
|
return new QRegExpValidator(IpRegExp::ip4Regex());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExpValidator *IpRegExp::ipv4CidrValidator()
|
||||||
|
{
|
||||||
|
return new QRegExpValidator(IpRegExp::ip4CidrRegex());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExpValidator *IpRegExp::ipv6Validator()
|
||||||
|
{
|
||||||
|
return new QRegExpValidator(IpRegExp::ip6Regex());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QRegExpValidator *IpRegExp::ipv6CidrValidator()
|
||||||
|
{
|
||||||
|
return new QRegExpValidator(IpRegExp::ip6CidrRegex());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool IpRegExp::checkString(const QString input, const QRegExp regexp)
|
||||||
|
{
|
||||||
|
return regexp.exactMatch(input);
|
||||||
|
}
|
49
sources/gui/src/ipregexp.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef IPREGEXP_H
|
||||||
|
#define IPREGEXP_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QRegExpValidator>
|
||||||
|
|
||||||
|
|
||||||
|
class IpRegExp : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit IpRegExp(QObject *parent = 0);
|
||||||
|
~IpRegExp();
|
||||||
|
|
||||||
|
// ipv4
|
||||||
|
static QRegExp ip4Regex();
|
||||||
|
static QRegExp ip4CidrRegex();
|
||||||
|
// ipv6
|
||||||
|
static QRegExp ip6Regex();
|
||||||
|
static QRegExp ip6CidrRegex();
|
||||||
|
// validators
|
||||||
|
static QRegExpValidator *ipv4Validator();
|
||||||
|
static QRegExpValidator *ipv4CidrValidator();
|
||||||
|
static QRegExpValidator *ipv6Validator();
|
||||||
|
static QRegExpValidator *ipv6CidrValidator();
|
||||||
|
// check
|
||||||
|
static bool checkString(const QString input, const QRegExp regexp);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* IPREGEXP_H */
|
@ -18,9 +18,11 @@
|
|||||||
#include "ipwidget.h"
|
#include "ipwidget.h"
|
||||||
#include "ui_ipwidget.h"
|
#include "ui_ipwidget.h"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
|
#include "errorwindow.h"
|
||||||
|
#include "ipregexp.h"
|
||||||
|
|
||||||
|
|
||||||
IpWidget::IpWidget(QWidget *parent)
|
IpWidget::IpWidget(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
@ -90,15 +92,6 @@ void IpWidget::clear()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::setShown(const bool state)
|
|
||||||
{
|
|
||||||
if (state)
|
|
||||||
show();
|
|
||||||
else
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::createActions()
|
void IpWidget::createActions()
|
||||||
{
|
{
|
||||||
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
connect(ui->pushButton_ipAdvanced, SIGNAL(clicked(bool)), this, SLOT(showAdvanced()));
|
||||||
@ -112,32 +105,36 @@ void IpWidget::createActions()
|
|||||||
connect(ui->comboBox_dhcp, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDhcpClient(QString)));
|
connect(ui->comboBox_dhcp, SIGNAL(currentIndexChanged(QString)), this, SLOT(changeDhcpClient(QString)));
|
||||||
// buttons
|
// buttons
|
||||||
connect(ui->pushButton_ipAddress, SIGNAL(clicked(bool)), this, SLOT(addIp()));
|
connect(ui->pushButton_ipAddress, SIGNAL(clicked(bool)), this, SLOT(addIp()));
|
||||||
|
connect(ui->lineEdit_ipAddress, SIGNAL(returnPressed()), this, SLOT(addIp()));
|
||||||
connect(ui->pushButton_ipRoutes, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes()));
|
connect(ui->pushButton_ipRoutes, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes()));
|
||||||
connect(ui->pushButton_ipAddress6, SIGNAL(clicked(bool)), this, SLOT(addIp6()));
|
connect(ui->pushButton_ipAddress6, SIGNAL(clicked(bool)), this, SLOT(addIp6()));
|
||||||
|
connect(ui->lineEdit_ipAddress6, SIGNAL(returnPressed()), this, SLOT(addIp6()));
|
||||||
connect(ui->pushButton_ipRoutes6, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes6()));
|
connect(ui->pushButton_ipRoutes6, SIGNAL(clicked(bool)), this, SLOT(addIpRoutes6()));
|
||||||
connect(ui->pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustom()));
|
connect(ui->pushButton_custom, SIGNAL(clicked(bool)), this, SLOT(addCustom()));
|
||||||
|
connect(ui->lineEdit_custom, SIGNAL(returnPressed()), this, SLOT(addCustom()));
|
||||||
connect(ui->pushButton_dns, SIGNAL(clicked(bool)), this, SLOT(addDns()));
|
connect(ui->pushButton_dns, SIGNAL(clicked(bool)), this, SLOT(addDns()));
|
||||||
|
connect(ui->lineEdit_dns, SIGNAL(returnPressed()), this, SLOT(addDns()));
|
||||||
connect(ui->pushButton_dnsOptions, SIGNAL(clicked(bool)), this, SLOT(addDnsOpt()));
|
connect(ui->pushButton_dnsOptions, SIGNAL(clicked(bool)), this, SLOT(addDnsOpt()));
|
||||||
|
connect(ui->lineEdit_dnsOptions, SIGNAL(returnPressed()), this, SLOT(addDnsOpt()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::createFilter()
|
void IpWidget::createFilter()
|
||||||
{
|
{
|
||||||
// using input mask because validators is not comfortable
|
|
||||||
// ipv4
|
// ipv4
|
||||||
ui->lineEdit_ipAddress->setInputMask(QString("999.999.999.999/99"));
|
ui->lineEdit_ipAddress->setValidator(IpRegExp::ipv4CidrValidator());
|
||||||
ui->lineEdit_gateway->setInputMask(QString("999.999.999.999"));
|
ui->lineEdit_gateway->setValidator(IpRegExp::ipv4Validator());
|
||||||
ui->lineEdit_ipRoutes->setInputMask(QString("999.999.999.999/99"));
|
ui->lineEdit_ipRoutes->setValidator(IpRegExp::ipv4CidrValidator());
|
||||||
ui->lineEdit_ipRoutes2->setInputMask(QString("999.999.999.999"));
|
ui->lineEdit_ipRoutes2->setValidator(IpRegExp::ipv4Validator());
|
||||||
|
|
||||||
// ipv6
|
// ipv6
|
||||||
ui->lineEdit_ipAddress6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
|
ui->lineEdit_ipAddress6->setValidator(IpRegExp::ipv6CidrValidator());
|
||||||
ui->lineEdit_gateway6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
|
ui->lineEdit_gateway6->setValidator(IpRegExp::ipv6Validator());
|
||||||
ui->lineEdit_ipRoutes6->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh/999"));
|
ui->lineEdit_ipRoutes6->setValidator(IpRegExp::ipv6CidrValidator());
|
||||||
ui->lineEdit_ipRoutes62->setInputMask(QString("<hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh:hhhh"));
|
ui->lineEdit_ipRoutes62->setValidator(IpRegExp::ipv6Validator());
|
||||||
|
|
||||||
// dns
|
// dns
|
||||||
ui->lineEdit_dns->setInputMask(QString("999.999.999.999"));
|
ui->lineEdit_dns->setValidator(IpRegExp::ipv4Validator());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -145,110 +142,47 @@ void IpWidget::keyPressEvent(QKeyEvent *pressedKey)
|
|||||||
{
|
{
|
||||||
if (pressedKey->key() == Qt::Key_Delete) {
|
if (pressedKey->key() == Qt::Key_Delete) {
|
||||||
if (ui->listWidget_ipAddress->hasFocus() &&
|
if (ui->listWidget_ipAddress->hasFocus() &&
|
||||||
(ui->listWidget_ipAddress->currentItem() != 0))
|
(ui->listWidget_ipAddress->currentItem() != nullptr))
|
||||||
delete ui->listWidget_ipAddress->currentItem();
|
delete ui->listWidget_ipAddress->currentItem();
|
||||||
else if (ui->listWidget_ipRoutes->hasFocus() &&
|
else if (ui->listWidget_ipRoutes->hasFocus() &&
|
||||||
(ui->listWidget_ipRoutes->currentItem() != 0))
|
(ui->listWidget_ipRoutes->currentItem() != nullptr))
|
||||||
delete ui->listWidget_ipRoutes->currentItem();
|
delete ui->listWidget_ipRoutes->currentItem();
|
||||||
else if (ui->listWidget_ipAddress6->hasFocus() &&
|
else if (ui->listWidget_ipAddress6->hasFocus() &&
|
||||||
(ui->listWidget_ipAddress6->currentItem() != 0))
|
(ui->listWidget_ipAddress6->currentItem() != nullptr))
|
||||||
delete ui->listWidget_ipAddress6->currentItem();
|
delete ui->listWidget_ipAddress6->currentItem();
|
||||||
else if (ui->listWidget_ipRoutes6->hasFocus() &&
|
else if (ui->listWidget_ipRoutes6->hasFocus() &&
|
||||||
(ui->listWidget_ipRoutes6->currentItem() != 0))
|
(ui->listWidget_ipRoutes6->currentItem() != nullptr))
|
||||||
delete ui->listWidget_ipRoutes6->currentItem();
|
delete ui->listWidget_ipRoutes6->currentItem();
|
||||||
else if (ui->listWidget_custom->hasFocus() &&
|
else if (ui->listWidget_custom->hasFocus() &&
|
||||||
(ui->listWidget_custom->currentItem() != 0))
|
(ui->listWidget_custom->currentItem() != nullptr))
|
||||||
delete ui->listWidget_custom->currentItem();
|
delete ui->listWidget_custom->currentItem();
|
||||||
else if (ui->listWidget_dns->hasFocus() &&
|
else if (ui->listWidget_dns->hasFocus() &&
|
||||||
(ui->listWidget_dns->currentItem() != 0))
|
(ui->listWidget_dns->currentItem() != nullptr))
|
||||||
delete ui->listWidget_dns->currentItem();
|
delete ui->listWidget_dns->currentItem();
|
||||||
else if (ui->listWidget_dnsOptions->hasFocus() &&
|
else if (ui->listWidget_dnsOptions->hasFocus() &&
|
||||||
(ui->listWidget_dnsOptions->currentItem() != 0))
|
(ui->listWidget_dnsOptions->currentItem() != nullptr))
|
||||||
delete ui->listWidget_dnsOptions->currentItem();
|
delete ui->listWidget_dnsOptions->currentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString IpWidget::getIp(const QString rawIp)
|
|
||||||
{
|
|
||||||
QStringList ip = rawIp.split(QString("."));
|
|
||||||
|
|
||||||
// fix empty fields
|
|
||||||
if (ip[0].isEmpty())
|
|
||||||
ip[0] = QString("127");
|
|
||||||
if (ip[1].isEmpty())
|
|
||||||
ip[1] = QString("0");
|
|
||||||
if (ip[2].isEmpty())
|
|
||||||
ip[2] = QString("0");
|
|
||||||
if (ip[3].isEmpty())
|
|
||||||
ip[3] = QString("1");
|
|
||||||
// fix numbers
|
|
||||||
for (int i=0; i<4; i++)
|
|
||||||
if (ip[i].toInt() > 255)
|
|
||||||
ip[i] = QString("255");
|
|
||||||
|
|
||||||
return ip.join(QString("."));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString IpWidget::getPrefix(const QString rawPrefix)
|
|
||||||
{
|
|
||||||
QString prefix;
|
|
||||||
|
|
||||||
if (rawPrefix.isEmpty())
|
|
||||||
prefix = QString("24");
|
|
||||||
else if (rawPrefix.toInt() > 32)
|
|
||||||
prefix = QString("32");
|
|
||||||
else
|
|
||||||
prefix = rawPrefix;
|
|
||||||
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString IpWidget::getIp6(const QString rawIp)
|
|
||||||
{
|
|
||||||
QString ip = rawIp;
|
|
||||||
|
|
||||||
for (int i=0; i<5; i++)
|
|
||||||
ip.replace(QString(":::"), QString("::"));
|
|
||||||
|
|
||||||
return ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString IpWidget::getPrefix6(const QString rawPrefix)
|
|
||||||
{
|
|
||||||
QString prefix;
|
|
||||||
|
|
||||||
if (rawPrefix.isEmpty())
|
|
||||||
prefix = QString("64");
|
|
||||||
else if (rawPrefix.toInt() > 128)
|
|
||||||
prefix = QString("128");
|
|
||||||
else
|
|
||||||
prefix = rawPrefix;
|
|
||||||
|
|
||||||
return prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIp()
|
void IpWidget::addIp()
|
||||||
{
|
{
|
||||||
QString ip = getIp(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[0]);
|
if (!IpRegExp::checkString(ui->lineEdit_ipAddress->text(), IpRegExp::ip4CidrRegex()))
|
||||||
QString prefix = getPrefix(ui->lineEdit_ipAddress->text().remove(" ").split(QString("/"))[1]);
|
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp]"));
|
||||||
|
|
||||||
ui->listWidget_ipAddress->addItem(ip + QString("/") + prefix);
|
ui->listWidget_ipAddress->addItem(ui->lineEdit_ipAddress->text());
|
||||||
ui->lineEdit_ipAddress->clear();
|
ui->lineEdit_ipAddress->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIpRoutes()
|
void IpWidget::addIpRoutes()
|
||||||
{
|
{
|
||||||
QString ip = getIp(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[0]);
|
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes->text(), IpRegExp::ip4CidrRegex())) ||
|
||||||
QString prefix = getPrefix(ui->lineEdit_ipRoutes->text().remove(" ").split(QString("/"))[1]);
|
(!IpRegExp::checkString(ui->lineEdit_ipRoutes2->text(), IpRegExp::ip4Regex())))
|
||||||
QString ipVia = getIp(ui->lineEdit_ipRoutes2->text().remove(" "));
|
return ErrorWindow::showWindow(20, QString("[IpWidget::addIpRoutes]"));
|
||||||
|
|
||||||
ui->listWidget_ipRoutes->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
ui->listWidget_ipRoutes->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes->text()).arg(ui->lineEdit_ipRoutes2->text()));
|
||||||
ui->lineEdit_ipRoutes->clear();
|
ui->lineEdit_ipRoutes->clear();
|
||||||
ui->lineEdit_ipRoutes2->clear();
|
ui->lineEdit_ipRoutes2->clear();
|
||||||
}
|
}
|
||||||
@ -256,21 +190,21 @@ void IpWidget::addIpRoutes()
|
|||||||
|
|
||||||
void IpWidget::addIp6()
|
void IpWidget::addIp6()
|
||||||
{
|
{
|
||||||
QString ip = getIp6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[0]);
|
if (!IpRegExp::checkString(ui->lineEdit_ipAddress6->text(), IpRegExp::ip6CidrRegex()))
|
||||||
QString prefix = getPrefix6(ui->lineEdit_ipAddress6->text().remove(" ").split(QString("/"))[1]);
|
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6]"));
|
||||||
|
|
||||||
ui->listWidget_ipAddress6->addItem(ip + QString("/") + prefix);
|
ui->listWidget_ipAddress6->addItem(ui->lineEdit_ipAddress6->text());
|
||||||
ui->lineEdit_ipAddress6->clear();
|
ui->lineEdit_ipAddress6->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::addIpRoutes6()
|
void IpWidget::addIpRoutes6()
|
||||||
{
|
{
|
||||||
QString ip = getIp6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[0]);
|
if ((!IpRegExp::checkString(ui->lineEdit_ipRoutes6->text(), IpRegExp::ip6CidrRegex())) ||
|
||||||
QString prefix = getPrefix6(ui->lineEdit_ipRoutes6->text().remove(" ").split(QString("/"))[1]);
|
(!IpRegExp::checkString(ui->lineEdit_ipRoutes62->text(), IpRegExp::ip6Regex())))
|
||||||
QString ipVia = getIp6(ui->lineEdit_ipRoutes62->text().remove(" "));
|
return ErrorWindow::showWindow(20, QString("[IpWidget::addIp6Routes]"));
|
||||||
|
|
||||||
ui->listWidget_ipRoutes6->addItem(ip + QString("/") + prefix + QString(" via ") + ipVia);
|
ui->listWidget_ipRoutes6->addItem(QString("%1 via %2").arg(ui->lineEdit_ipRoutes6->text()).arg(ui->lineEdit_ipRoutes62->text()));
|
||||||
ui->lineEdit_ipRoutes6->clear();
|
ui->lineEdit_ipRoutes6->clear();
|
||||||
ui->lineEdit_ipRoutes62->clear();
|
ui->lineEdit_ipRoutes62->clear();
|
||||||
}
|
}
|
||||||
@ -286,9 +220,10 @@ void IpWidget::addCustom()
|
|||||||
|
|
||||||
void IpWidget::addDns()
|
void IpWidget::addDns()
|
||||||
{
|
{
|
||||||
QString ip = getIp(ui->lineEdit_dns->text().remove(" "));
|
if (!IpRegExp::checkString(ui->lineEdit_dns->text(), IpRegExp::ip4Regex()))
|
||||||
|
return ErrorWindow::showWindow(20, QString("[IpWidget::addDns]"));
|
||||||
|
|
||||||
ui->listWidget_dns->addItem(ip);
|
ui->listWidget_dns->addItem(ui->lineEdit_dns->text());
|
||||||
ui->lineEdit_dns->clear();
|
ui->lineEdit_dns->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,64 +238,36 @@ void IpWidget::addDnsOpt()
|
|||||||
|
|
||||||
void IpWidget::changeIpMode(const QString currentText)
|
void IpWidget::changeIpMode(const QString currentText)
|
||||||
{
|
{
|
||||||
if (currentText == QString("dhcp"))
|
ui->widget_ip->setHidden(currentText == QString("dhcp"));
|
||||||
ui->widget_ip->setHidden(true);
|
|
||||||
else if (currentText == QString("static"))
|
|
||||||
ui->widget_ip->setHidden(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::ipEnable(const int state)
|
void IpWidget::ipEnable(const int state)
|
||||||
{
|
{
|
||||||
if (state == 0) {
|
ui->comboBox_ip->setDisabled(state == 0);
|
||||||
ui->comboBox_ip->setDisabled(true);
|
ui->widget_ip->setDisabled(state == 0);
|
||||||
ui->widget_ip->setDisabled(true);
|
ui->widget_ipRoutes->setDisabled(state == 0);
|
||||||
ui->widget_ipRoutes->setDisabled(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->comboBox_ip->setEnabled(true);
|
|
||||||
ui->widget_ip->setEnabled(true);
|
|
||||||
ui->widget_ipRoutes->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::changeIp6Mode(const QString currentText)
|
void IpWidget::changeIp6Mode(const QString currentText)
|
||||||
{
|
{
|
||||||
if ((currentText == QString("dhcp")) ||
|
ui->widget_ip6->setHidden(currentText.startsWith(QString("dhcp")));
|
||||||
(currentText == QString("dhcp-noaddr")))
|
|
||||||
ui->widget_ip6->setHidden(true);
|
|
||||||
else if ((currentText == QString("static")) ||
|
|
||||||
(currentText == QString("stateless")))
|
|
||||||
ui->widget_ip6->setHidden(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::ip6Enable(const int state)
|
void IpWidget::ip6Enable(const int state)
|
||||||
{
|
{
|
||||||
if (state == 0) {
|
ui->comboBox_ip6->setDisabled(state == 0);
|
||||||
ui->comboBox_ip6->setDisabled(true);
|
ui->widget_ip6->setDisabled(state == 0);
|
||||||
ui->widget_ip6->setDisabled(true);
|
ui->widget_ipRoutes6->setDisabled(state == 0);
|
||||||
ui->widget_ipRoutes6->setDisabled(true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ui->comboBox_ip6->setEnabled(true);
|
|
||||||
ui->widget_ip6->setEnabled(true);
|
|
||||||
ui->widget_ipRoutes6->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IpWidget::changeDhcpClient(const QString currentText)
|
void IpWidget::changeDhcpClient(const QString currentText)
|
||||||
{
|
{
|
||||||
if (currentText == QString("dhcpcd")) {
|
ui->widget_dhcpcdOpt->setHidden(currentText != QString("dhcpcd"));
|
||||||
ui->widget_dhcpcdOpt->setHidden(false);
|
ui->widget_dhclientOpt->setHidden(currentText == QString("dhcpcd"));
|
||||||
ui->widget_dhclientOpt->setHidden(true);
|
|
||||||
}
|
|
||||||
else if (currentText == QString("dhclient")) {
|
|
||||||
ui->widget_dhcpcdOpt->setHidden(true);
|
|
||||||
ui->widget_dhclientOpt->setHidden(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -368,120 +275,113 @@ void IpWidget::showAdvanced()
|
|||||||
{
|
{
|
||||||
if (ui->pushButton_ipAdvanced->isChecked()) {
|
if (ui->pushButton_ipAdvanced->isChecked()) {
|
||||||
ui->widget_ipAdvanced->setHidden(false);
|
ui->widget_ipAdvanced->setHidden(false);
|
||||||
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Hide advanced"));
|
ui->pushButton_ipAdvanced->setArrowType(Qt::UpArrow);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ui->widget_ipAdvanced->setHidden(true);
|
ui->widget_ipAdvanced->setHidden(true);
|
||||||
ui->pushButton_ipAdvanced->setText(QApplication::translate("IpWidget", "Show advanced"));
|
ui->pushButton_ipAdvanced->setArrowType(Qt::DownArrow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> IpWidget::getSettings()
|
QMap<QString, QString> IpWidget::getSettings()
|
||||||
{
|
{
|
||||||
QMap<QString, QString> ipSettings;
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
if (isOk() != 0)
|
if (isOk() != 0) return settings;
|
||||||
return ipSettings;
|
|
||||||
|
|
||||||
if (ui->checkBox_ip->checkState() == Qt::Checked) {
|
if (ui->checkBox_ip->checkState() == Qt::Checked) {
|
||||||
ipSettings[QString("IP")] = ui->comboBox_ip->currentText();
|
settings[QString("IP")] = ui->comboBox_ip->currentText();
|
||||||
if (ui->comboBox_ip->currentText() == QString("static")) {
|
if (ui->comboBox_ip->currentText() == QString("static")) {
|
||||||
QStringList addresses;
|
QStringList addresses;
|
||||||
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
|
for (int i=0; i<ui->listWidget_ipAddress->count(); i++)
|
||||||
addresses.append(QString("'") + ui->listWidget_ipAddress->item(i)->text() + QString("'"));
|
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress->item(i)->text()));
|
||||||
ipSettings[QString("Address")] = addresses.join(QString(" "));
|
settings[QString("Address")] = addresses.join(QChar(' '));
|
||||||
ipSettings[QString("Gateway")] = QString("'") + ui->lineEdit_gateway->text() + QString("'");
|
settings[QString("Gateway")] = QString("'%1'").arg(ui->lineEdit_gateway->text());
|
||||||
}
|
}
|
||||||
if (ui->listWidget_ipRoutes->count() > 0) {
|
if (ui->listWidget_ipRoutes->count() > 0) {
|
||||||
QStringList routes;
|
QStringList routes;
|
||||||
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
|
for (int i=0; i<ui->listWidget_ipRoutes->count(); i++)
|
||||||
routes.append(QString("'") + ui->listWidget_ipRoutes->item(i)->text() + QString("'"));
|
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes->item(i)->text()));
|
||||||
ipSettings[QString("Routes")] = routes.join(QString(" "));
|
settings[QString("Routes")] = routes.join(QChar(' '));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
settings[QString("IP")] = QString("no");
|
||||||
ipSettings[QString("IP")] = QString("no");
|
|
||||||
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
|
if (ui->checkBox_ip6->checkState() == Qt::Checked) {
|
||||||
ipSettings[QString("IP6")] = ui->comboBox_ip6->currentText();
|
settings[QString("IP6")] = ui->comboBox_ip6->currentText();
|
||||||
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
||||||
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
|
(ui->comboBox_ip6->currentText() == QString("stateless"))) {
|
||||||
QStringList addresses;
|
QStringList addresses;
|
||||||
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
|
for (int i=0; i<ui->listWidget_ipAddress6->count(); i++)
|
||||||
addresses.append(QString("'") + ui->listWidget_ipAddress6->item(i)->text() + QString("'"));
|
addresses.append(QString("'%1'").arg(ui->listWidget_ipAddress6->item(i)->text()));
|
||||||
ipSettings[QString("Address6")] = addresses.join(QString(" "));
|
settings[QString("Address6")] = addresses.join(QChar(' '));
|
||||||
ipSettings[QString("Gateway6")] = QString("'") + ui->lineEdit_gateway6->text() + QString("'");
|
settings[QString("Gateway6")] = QString("'%1'").arg(ui->lineEdit_gateway6->text());
|
||||||
}
|
}
|
||||||
if (ui->listWidget_ipRoutes6->count() > 0) {
|
if (ui->listWidget_ipRoutes6->count() > 0) {
|
||||||
QStringList routes;
|
QStringList routes;
|
||||||
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
|
for (int i=0; i<ui->listWidget_ipRoutes6->count(); i++)
|
||||||
routes.append(QString("'") + ui->listWidget_ipRoutes6->item(i)->text() + QString("'"));
|
routes.append(QString("'%1'").arg(ui->listWidget_ipRoutes6->item(i)->text()));
|
||||||
ipSettings[QString("Routes6")] = routes.join(QString(" "));
|
settings[QString("Routes6")] = routes.join(QChar(' '));
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
settings[QString("IP6")] = QString("no");
|
||||||
ipSettings[QString("IP6")] = QString("no");
|
|
||||||
if (ui->listWidget_custom->count() > 0) {
|
if (ui->listWidget_custom->count() > 0) {
|
||||||
QStringList custom;
|
QStringList custom;
|
||||||
for (int i=0; i<ui->listWidget_custom->count(); i++)
|
for (int i=0; i<ui->listWidget_custom->count(); i++)
|
||||||
custom.append(QString("'") + ui->listWidget_custom->item(i)->text() + QString("'"));
|
custom.append(QString("'%1'").arg(ui->listWidget_custom->item(i)->text()));
|
||||||
ipSettings[QString("IPCustom")] = custom.join(QString(" "));
|
settings[QString("IPCustom")] = custom.join(QChar(' '));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_hostname->text().isEmpty())
|
if (!ui->lineEdit_hostname->text().isEmpty())
|
||||||
ipSettings[QString("Hostname")] = QString("'") + ui->lineEdit_hostname->text() + QString("'");
|
settings[QString("Hostname")] = QString("'%1'").arg(ui->lineEdit_hostname->text());
|
||||||
if (ui->spinBox_timeoutDad->value() != 3)
|
if (ui->spinBox_timeoutDad->value() != 3)
|
||||||
ipSettings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
|
settings[QString("TimeoutDAD")] = QString::number(ui->spinBox_timeoutDad->value());
|
||||||
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
|
if (ui->comboBox_dhcp->currentText() == QString("dhcpcd")) {
|
||||||
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
|
if (!ui->lineEdit_dhcpcdOpt->text().isEmpty())
|
||||||
ipSettings[QString("DhcpcdOptions")] = QString("'") + ui->lineEdit_dhcpcdOpt->text() + QString("'");
|
settings[QString("DhcpcdOptions")] = QString("'%1'").arg(ui->lineEdit_dhcpcdOpt->text());
|
||||||
}
|
} else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
||||||
else if (ui->comboBox_dhcp->currentText() == QString("dhclient")) {
|
settings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
|
||||||
ipSettings[QString("DHCPClient")] = ui->comboBox_dhcp->currentText();
|
|
||||||
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
|
if (!ui->lineEdit_dhclientOpt->text().isEmpty())
|
||||||
ipSettings[QString("DhclientOptions")] = QString("'") + ui->lineEdit_dhclientOpt->text() + QString("'");
|
settings[QString("DhclientOptions")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt->text());
|
||||||
if (!ui->lineEdit_dhclientOpt6->text().isEmpty())
|
if (!ui->lineEdit_dhclientOpt6->text().isEmpty())
|
||||||
ipSettings[QString("DhclientOptions6")] = QString("'") + ui->lineEdit_dhclientOpt6->text() + QString("'");
|
settings[QString("DhclientOptions6")] = QString("'%1'").arg(ui->lineEdit_dhclientOpt6->text());
|
||||||
}
|
}
|
||||||
if (ui->spinBox_timeoutDhcp->value() != 30)
|
if (ui->spinBox_timeoutDhcp->value() != 30)
|
||||||
ipSettings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
|
settings[QString("TimeoutDHCP")] = QString::number(ui->spinBox_timeoutDhcp->value());
|
||||||
if (ui->checkBox_dhcp->checkState() == Qt::Checked)
|
if (ui->checkBox_dhcp->checkState() == Qt::Checked)
|
||||||
ipSettings[QString("DHCPReleaseOnStop")] = QString("yes");
|
settings[QString("DHCPReleaseOnStop")] = QString("yes");
|
||||||
if (ui->listWidget_dns->count() > 0) {
|
if (ui->listWidget_dns->count() > 0) {
|
||||||
QStringList dns;
|
QStringList dns;
|
||||||
for (int i=0; i<ui->listWidget_dns->count(); i++)
|
for (int i=0; i<ui->listWidget_dns->count(); i++)
|
||||||
dns.append(QString("'") + ui->listWidget_dns->item(i)->text() + QString("'"));
|
dns.append(QString("'%1'").arg(ui->listWidget_dns->item(i)->text()));
|
||||||
ipSettings[QString("DNS")] = dns.join(QString(" "));
|
settings[QString("DNS")] = dns.join(QChar(' '));
|
||||||
}
|
}
|
||||||
if (!ui->lineEdit_dnsDomain->text().isEmpty())
|
if (!ui->lineEdit_dnsDomain->text().isEmpty())
|
||||||
ipSettings[QString("DNSDomain")] = QString("'") + ui->lineEdit_dnsDomain->text() + QString("'");
|
settings[QString("DNSDomain")] = QString("'%1'").arg(ui->lineEdit_dnsDomain->text());
|
||||||
if (!ui->lineEdit_dnsSearch->text().isEmpty())
|
if (!ui->lineEdit_dnsSearch->text().isEmpty())
|
||||||
ipSettings[QString("DNSSearch")] = QString("'") + ui->lineEdit_dnsSearch->text() + QString("'");
|
settings[QString("DNSSearch")] = QString("'%1'").arg(ui->lineEdit_dnsSearch->text());
|
||||||
if (ui->listWidget_dnsOptions->count() > 0) {
|
if (ui->listWidget_dnsOptions->count() > 0) {
|
||||||
QStringList dnsOpt;
|
QStringList dnsOpt;
|
||||||
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
|
for (int i=0; i<ui->listWidget_dnsOptions->count(); i++)
|
||||||
dnsOpt.append(QString("'") + ui->listWidget_dnsOptions->item(i)->text() + QString("'"));
|
dnsOpt.append(QString("'%1'").arg(ui->listWidget_dnsOptions->item(i)->text()));
|
||||||
ipSettings[QString("DNSOptions")] = dnsOpt.join(QString(" "));
|
settings[QString("DNSOptions")] = dnsOpt.join(QChar(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
return ipSettings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IpWidget::isOk()
|
int IpWidget::isOk()
|
||||||
{
|
{
|
||||||
// ip settings is not set
|
// ip settings is not set
|
||||||
if (ui->checkBox_ip->checkState() == Qt::Checked)
|
if ((ui->checkBox_ip->checkState() == Qt::Checked) &&
|
||||||
if (ui->comboBox_ip->currentText() == QString("static"))
|
(ui->comboBox_ip->currentText() == QString("static")))
|
||||||
if ((ui->listWidget_ipAddress->count() == 0) ||
|
if ((ui->listWidget_ipAddress->count() == 0) ||
|
||||||
(ui->lineEdit_gateway->text().isEmpty()))
|
(ui->lineEdit_gateway->text().isEmpty())) return 1;
|
||||||
return 1;
|
|
||||||
// ipv6 settings is not set
|
// ipv6 settings is not set
|
||||||
if (ui->checkBox_ip6->checkState() == Qt::Checked)
|
if ((ui->checkBox_ip6->checkState() == Qt::Checked) &&
|
||||||
if ((ui->comboBox_ip6->currentText() == QString("static")) ||
|
((ui->comboBox_ip6->currentText() == QString("static")) ||
|
||||||
(ui->comboBox_ip6->currentText() == QString("stateless")))
|
(ui->comboBox_ip6->currentText() == QString("stateless"))))
|
||||||
if ((ui->listWidget_ipAddress6->count() == 0) ||
|
if ((ui->listWidget_ipAddress6->count() == 0) ||
|
||||||
(ui->lineEdit_gateway6->text().isEmpty()))
|
(ui->lineEdit_gateway6->text().isEmpty())) return 2;
|
||||||
return 2;
|
|
||||||
// all fine
|
// all fine
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -489,76 +389,67 @@ int IpWidget::isOk()
|
|||||||
|
|
||||||
void IpWidget::setSettings(const QMap<QString, QString> settings)
|
void IpWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
{
|
{
|
||||||
QMap<QString, QString> ipSettings = settings;
|
clear();
|
||||||
|
|
||||||
if (ipSettings.contains(QString("IP"))) {
|
if (settings.contains(QString("IP"))) {
|
||||||
if (ipSettings[QString("IP")].remove(QString("'")) == QString("no"))
|
if (settings[QString("IP")] == QString("no"))
|
||||||
ui->checkBox_ip->setCheckState(Qt::Unchecked);
|
ui->checkBox_ip->setCheckState(Qt::Unchecked);
|
||||||
else {
|
else {
|
||||||
ui->checkBox_ip->setCheckState(Qt::Checked);
|
ui->checkBox_ip->setCheckState(Qt::Checked);
|
||||||
for (int i=0; i<ui->comboBox_ip->count(); i++)
|
int index = ui->comboBox_ip->findText(settings[QString("IP")]);
|
||||||
if (ipSettings[QString("IP")].remove(QString("'")) == ui->comboBox_ip->itemText(i))
|
ui->comboBox_ip->setCurrentIndex(index);
|
||||||
ui->comboBox_ip->setCurrentIndex(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ipSettings.contains(QString("Address")))
|
if (settings.contains(QString("Address")))
|
||||||
ui->listWidget_ipAddress->addItems(ipSettings[QString("Address")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_ipAddress->addItems(settings[QString("Address")].split(QChar('\n')));
|
||||||
if (ipSettings.contains(QString("Gateway")))
|
if (settings.contains(QString("Gateway")))
|
||||||
ui->lineEdit_gateway->setText(ipSettings[QString("Gateway")].remove(QString("'")));
|
ui->lineEdit_gateway->setText(settings[QString("Gateway")]);
|
||||||
if (ipSettings.contains(QString("Routes")))
|
if (settings.contains(QString("Routes")))
|
||||||
ui->listWidget_ipRoutes->addItems(ipSettings[QString("Routes")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_ipRoutes->addItems(settings[QString("Routes")].split(QChar('\n')));
|
||||||
if (ipSettings.contains(QString("IP6"))) {
|
if (settings.contains(QString("IP6"))) {
|
||||||
if (ipSettings[QString("IP6")].remove(QString("'")) == QString("no"))
|
if (settings[QString("IP6")] == QString("no"))
|
||||||
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
|
ui->checkBox_ip6->setCheckState(Qt::Unchecked);
|
||||||
else {
|
else {
|
||||||
ui->checkBox_ip6->setCheckState(Qt::Checked);
|
ui->checkBox_ip6->setCheckState(Qt::Checked);
|
||||||
for (int i=0; i<ui->comboBox_ip6->count(); i++)
|
int index = ui->comboBox_ip6->findText(settings[QString("IP6")]);
|
||||||
if (ipSettings[QString("IP6")].remove(QString("'")) == ui->comboBox_ip6->itemText(i))
|
ui->comboBox_ip6->setCurrentIndex(index);
|
||||||
ui->comboBox_ip6->setCurrentIndex(i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ipSettings.contains(QString("Address6")))
|
if (settings.contains(QString("Address6")))
|
||||||
ui->listWidget_ipAddress6->addItems(ipSettings[QString("Address6")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_ipAddress6->addItems(settings[QString("Address6")].split(QChar('\n')));
|
||||||
if (ipSettings.contains(QString("Gateway6")))
|
if (settings.contains(QString("Gateway6")))
|
||||||
ui->lineEdit_gateway6->setText(ipSettings[QString("Gateway6")].remove(QString("'")));
|
ui->lineEdit_gateway6->setText(settings[QString("Gateway6")]);
|
||||||
if (ipSettings.contains(QString("Routes6")))
|
if (settings.contains(QString("Routes6")))
|
||||||
ui->listWidget_ipRoutes6->addItems(ipSettings[QString("Routes6")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_ipRoutes6->addItems(settings[QString("Routes6")].split(QChar('\n')));
|
||||||
if (ipSettings.contains(QString("IPCustom"))) {
|
if (settings.contains(QString("IPCustom")))
|
||||||
QStringList custom;
|
ui->listWidget_custom->addItems(settings[QString("IPCustom")].split(QChar('\n')));
|
||||||
if (ipSettings[QString("IPCustom")].contains(QString("\n")))
|
if (settings.contains(QString("Hostname")))
|
||||||
custom = ipSettings[QString("IPCustom")].split(QString("'\n'"));
|
ui->lineEdit_hostname->setText(settings[QString("Hostname")]);
|
||||||
else
|
if (settings.contains(QString("TimeoutDAD")))
|
||||||
custom = ipSettings[QString("IPCustom")].split(QString("' '"));
|
ui->spinBox_timeoutDad->setValue(settings[QString("TimeoutDAD")].toInt());
|
||||||
for (int i=0; i<custom.count(); i++)
|
if (settings.contains(QString("DHCPClient"))) {
|
||||||
ui->listWidget_custom->addItem(custom[i].remove(QString("'")));
|
int index = ui->comboBox_dhcp->findText(settings[QString("DHCPClient")]);
|
||||||
|
ui->comboBox_dhcp->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
if (ipSettings.contains(QString("Hostname")))
|
if (settings.contains(QString("DhcpcdOptions")))
|
||||||
ui->lineEdit_hostname->setText(ipSettings[QString("Hostname")].remove(QString("'")));
|
ui->lineEdit_dhcpcdOpt->setText(settings[QString("DhcpcdOptions")]);
|
||||||
if (ipSettings.contains(QString("TimeoutDAD")))
|
if (settings.contains(QString("DhclientOptions")))
|
||||||
ui->spinBox_timeoutDad->setValue(ipSettings[QString("TimeoutDAD")].toInt());
|
ui->lineEdit_dhclientOpt->setText(settings[QString("DhclientOptions")]);
|
||||||
if (ipSettings.contains(QString("DHCPClient")))
|
if (settings.contains(QString("DhclientOptions6")))
|
||||||
for (int i=0; i<ui->comboBox_dhcp->count(); i++)
|
ui->lineEdit_dhclientOpt6->setText(settings[QString("DhclientOptions6")]);
|
||||||
if (ipSettings[QString("DHCPClient")].remove(QString("'")) == ui->comboBox_dhcp->itemText(i))
|
if (settings.contains(QString("TimeoutDHCP")))
|
||||||
ui->comboBox_dhcp->setCurrentIndex(i);
|
ui->spinBox_timeoutDhcp->setValue(settings[QString("TimeoutDHCP")].toInt());
|
||||||
if (ipSettings.contains(QString("DhcpcdOptions")))
|
if (settings.contains(QString("DHCPReleaseOnStop")))
|
||||||
ui->lineEdit_dhcpcdOpt->setText(ipSettings[QString("DhcpcdOptions")].remove(QString("'")));
|
if (settings[QString("DHCPReleaseOnStop")] == QString("yes"))
|
||||||
if (ipSettings.contains(QString("DhclientOptions")))
|
|
||||||
ui->lineEdit_dhclientOpt->setText(ipSettings[QString("DhclientOptions")].remove(QString("'")));
|
|
||||||
if (ipSettings.contains(QString("DhclientOptions6")))
|
|
||||||
ui->lineEdit_dhclientOpt6->setText(ipSettings[QString("DhclientOptions6")].remove(QString("'")));
|
|
||||||
if (ipSettings.contains(QString("TimeoutDHCP")))
|
|
||||||
ui->spinBox_timeoutDhcp->setValue(ipSettings[QString("TimeoutDHCP")].toInt());
|
|
||||||
if (ipSettings.contains(QString("DHCPReleaseOnStop")))
|
|
||||||
if (ipSettings[QString("DHCPReleaseOnStop")].remove(QString("'")) == QString("yes"))
|
|
||||||
ui->checkBox_dhcp->setCheckState(Qt::Checked);
|
ui->checkBox_dhcp->setCheckState(Qt::Checked);
|
||||||
if (ipSettings.contains(QString("DNS")))
|
if (settings.contains(QString("DNS")))
|
||||||
ui->listWidget_dns->addItems(ipSettings[QString("DNS")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_dns->addItems(settings[QString("DNS")].split(QChar('\n')));
|
||||||
if (ipSettings.contains(QString("DNSDomain")))
|
if (settings.contains(QString("DNSDomain")))
|
||||||
ui->lineEdit_dnsDomain->setText(ipSettings[QString("DNSDomain")].remove(QString("'")));
|
ui->lineEdit_dnsDomain->setText(settings[QString("DNSDomain")]);
|
||||||
if (ipSettings.contains(QString("DNSSearch")))
|
if (settings.contains(QString("DNSSearch")))
|
||||||
ui->lineEdit_dnsSearch->setText(ipSettings[QString("DNSSearch")].remove(QString("'")));
|
ui->lineEdit_dnsSearch->setText(settings[QString("DNSSearch")]);
|
||||||
if (ipSettings.contains(QString("DNSOptions")))
|
if (settings.contains(QString("DNSOptions")))
|
||||||
ui->listWidget_dnsOptions->addItems(ipSettings[QString("DNSOptions")].remove(QString("'")).split(QString(" ")));
|
ui->listWidget_dnsOptions->addItems(settings[QString("DNSOptions")].split(QChar('\n')));
|
||||||
|
|
||||||
ipEnable(ui->checkBox_ip->checkState());
|
ipEnable(ui->checkBox_ip->checkState());
|
||||||
changeIpMode(ui->comboBox_ip->currentText());
|
changeIpMode(ui->comboBox_ip->currentText());
|
||||||
|
@ -38,7 +38,6 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clear();
|
void clear();
|
||||||
void setShown(const bool state);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// buttons
|
// buttons
|
||||||
@ -64,10 +63,6 @@ private:
|
|||||||
void createActions();
|
void createActions();
|
||||||
void createFilter();
|
void createFilter();
|
||||||
void keyPressEvent(QKeyEvent *pressedKey);
|
void keyPressEvent(QKeyEvent *pressedKey);
|
||||||
QString getIp(const QString rawIp);
|
|
||||||
QString getPrefix(const QString rawPrefix);
|
|
||||||
QString getIp6(const QString rawIp);
|
|
||||||
QString getPrefix6(const QString rawPrefix);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
83
sources/gui/src/macvlanwidget.cpp
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "macvlanwidget.h"
|
||||||
|
#include "ui_macvlanwidget.h"
|
||||||
|
|
||||||
|
|
||||||
|
MacvlanWidget::MacvlanWidget(QWidget *parent)
|
||||||
|
: QWidget(parent),
|
||||||
|
ui(new Ui::MacvlanWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
createFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MacvlanWidget::~MacvlanWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacvlanWidget::clear()
|
||||||
|
{
|
||||||
|
ui->comboBox_mode->setCurrentIndex(0);
|
||||||
|
ui->lineEdit_mac->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacvlanWidget::createFilter()
|
||||||
|
{
|
||||||
|
// mac
|
||||||
|
ui->lineEdit_mac->setInputMask(QString(">hh:hh:hh:hh:hh:hh"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, QString> MacvlanWidget::getSettings()
|
||||||
|
{
|
||||||
|
QMap<QString, QString> settings;
|
||||||
|
|
||||||
|
if (isOk() != 0) return settings;
|
||||||
|
|
||||||
|
settings[QString("Mode")] = ui->comboBox_mode->currentText();
|
||||||
|
if (!ui->lineEdit_mac->text().remove(QChar(':')).isEmpty())
|
||||||
|
settings[QString("MACAddress")] = ui->lineEdit_mac->text();
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int MacvlanWidget::isOk()
|
||||||
|
{
|
||||||
|
// all fine
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacvlanWidget::setSettings(const QMap<QString, QString> settings)
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
|
||||||
|
if (settings.contains(QString("Mode"))) {
|
||||||
|
int index = ui->comboBox_mode->findText(settings[QString("Mode")]);
|
||||||
|
ui->comboBox_mode->setCurrentIndex(index);
|
||||||
|
}
|
||||||
|
if (settings.contains(QString("MACAddress")))
|
||||||
|
ui->lineEdit_mac->setText(settings[QString("MACAddress")]);
|
||||||
|
}
|
48
sources/gui/src/macvlanwidget.h
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef MACVLANWIDGET_H
|
||||||
|
#define MACVLANWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class MacvlanWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MacvlanWidget : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit MacvlanWidget(QWidget *parent = 0);
|
||||||
|
~MacvlanWidget();
|
||||||
|
QMap<QString, QString> getSettings();
|
||||||
|
int isOk();
|
||||||
|
void setSettings(const QMap<QString, QString> settings);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void clear();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::MacvlanWidget *ui;
|
||||||
|
void createFilter();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* MACVLANWIDGET_H */
|
121
sources/gui/src/macvlanwidget.ui
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MacvlanWidget</class>
|
||||||
|
<widget class="QWidget" name="MacvlanWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>396</width>
|
||||||
|
<height>79</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QDockWidget" name="dockWidget_macvlan">
|
||||||
|
<property name="features">
|
||||||
|
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>macvlan settings</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="dockWidgetContents_macvlan">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_mode">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Mode</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_mode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">bridge</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">vepa</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">private</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">passthru</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="layout_mac">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_mac">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||||
|
<horstretch>1</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>MAC address</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_mac">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>2</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Optional static MAC address</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -17,90 +17,196 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QDBusMessage>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QTextStream>
|
#include <QLibraryInfo>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <language/language.h>
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
#include "messages.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
#include <pdebug/pdebug-time.h>
|
||||||
|
#endif /* QT_VERSION >= 0x050000 */
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
bool existingSessionOperation(const QString operation)
|
||||||
|
{
|
||||||
|
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||||
|
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_SERVICE, DBUS_OBJECT_PATH,
|
||||||
|
DBUS_INTERFACE, operation);
|
||||||
|
QDBusMessage response = bus.call(request);
|
||||||
|
QList<QVariant> arguments = response.arguments();
|
||||||
|
|
||||||
|
return (!arguments.isEmpty() && arguments[0].toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
unsigned int getUidFromSession(const int type = 0)
|
||||||
|
{
|
||||||
|
QDBusConnection bus = QDBusConnection::sessionBus();
|
||||||
|
QDBusMessage request = QDBusMessage::createMethodCall(DBUS_SERVICE, DBUS_OBJECT_PATH,
|
||||||
|
DBUS_INTERFACE, QString("UIDs"));
|
||||||
|
QDBusMessage response = bus.call(request);
|
||||||
|
QList<QVariant> arguments = response.arguments();
|
||||||
|
|
||||||
|
return arguments[0].toStringList()[type].toUInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QVariantMap args = getArgs();
|
||||||
|
// reading
|
||||||
|
for (int i=1; i<argc; i++) {
|
||||||
|
if (QString(argv[i]) == QString("--detached")) {
|
||||||
|
// detached
|
||||||
|
args[QString("detached")] = true;
|
||||||
|
} else if (QString(argv[i]) == QString("--maximized")) {
|
||||||
|
// maximized
|
||||||
|
args[QString("minimized")] = (int) 1;
|
||||||
|
} else if (QString(argv[i]) == QString("--minimized")) {
|
||||||
|
// minimized
|
||||||
|
args[QString("minimized")] = (int) 2;
|
||||||
|
} else if (QString(argv[i]) == QString("--about")) {
|
||||||
|
// about
|
||||||
|
args[QString("about")] = true;
|
||||||
|
} else if (QString(argv[i]) == QString("--netctl-auto")) {
|
||||||
|
// netctl-auto
|
||||||
|
args[QString("auto")] = true;
|
||||||
|
} else if (QString(argv[i]) == QString("--settings")) {
|
||||||
|
// settings
|
||||||
|
args[QString("settings")] = true;
|
||||||
|
} else if ((QString(argv[i]) == QString("-e")) || (QString(argv[i]) == QString("--essid"))) {
|
||||||
|
// select ESSID
|
||||||
|
args[QString("essid")] = QString(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-o")) || (QString(argv[i]) == QString("--open"))) {
|
||||||
|
// open profile
|
||||||
|
args[QString("open")] = QString(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-s")) || (QString(argv[i]) == QString("--select"))) {
|
||||||
|
// select profile
|
||||||
|
args[QString("select")] = QString(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-c")) || (QString(argv[i]) == QString("--config"))) {
|
||||||
|
// config path
|
||||||
|
args[QString("config")] = QDir().absoluteFilePath(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-d")) || (QString(argv[i]) == QString("--debug"))) {
|
||||||
|
// debug
|
||||||
|
args[QString("debug")] = true;
|
||||||
|
} else if (QString(argv[i]) == QString("--default")) {
|
||||||
|
// default settings
|
||||||
|
args[QString("default")] = true;
|
||||||
|
} else if (QString(argv[i]) == QString("--set-opts")) {
|
||||||
|
// options
|
||||||
|
args[QString("options")] = QString(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-t")) || (QString(argv[i]) == QString("--tab"))) {
|
||||||
|
// tab number
|
||||||
|
if (atoi(argv[i+1]) > 3)
|
||||||
|
args[QString("tab")] = (int) 3;
|
||||||
|
else if (atoi(argv[i+1]) < 1)
|
||||||
|
args[QString("tab")] = (int) 1;
|
||||||
|
else
|
||||||
|
args[QString("tab")] = atoi(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
|
||||||
|
// help message
|
||||||
|
args[QString("help")] = true;
|
||||||
|
} else if ((QString(argv[i]) == QString("-i")) || (QString(argv[i]) == QString("--info"))) {
|
||||||
|
// info message
|
||||||
|
args[QString("info")] = true;
|
||||||
|
} else if ((QString(argv[i]) == QString("-v")) || (QString(argv[i]) == QString("--version"))) {
|
||||||
|
// version message
|
||||||
|
args[QString("version")] = true;
|
||||||
|
} else {
|
||||||
|
args[QString("error")] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
if (!args[QString("debug")].toBool()) args[QString("debug")] = (debugEnv == QString("yes"));
|
||||||
|
if ((args[QString("debug")].toBool()) ||
|
||||||
|
(args[QString("help")].toBool()) ||
|
||||||
|
(args[QString("info")].toBool()) ||
|
||||||
|
(args[QString("version")].toBool()) ||
|
||||||
|
(args[QString("error")].toBool()))
|
||||||
|
args[QString("detached")] = false;
|
||||||
|
if (args[QString("essid")].toString() != QString("ESSID"))
|
||||||
|
args[QString("tab")] = static_cast<int>(3);
|
||||||
|
if (args[QString("open")].toString() != QString("PROFILE"))
|
||||||
|
args[QString("tab")] = static_cast<int>(2);
|
||||||
|
if (args[QString("select")].toString() != QString("PROFILE"))
|
||||||
|
args[QString("tab")] = static_cast<int>(1);
|
||||||
|
|
||||||
// translation
|
// check
|
||||||
QString configPath = QDir::homePath() + QDir::separator() + QString(".config") +
|
QString robotEnv = environment.value(QString("SKYNET"), QString(""));
|
||||||
QDir::separator() + QString("netctl-gui.conf");
|
if (!robotEnv.isEmpty()) {
|
||||||
QFile configFile(configPath);
|
cout << "Sorry, this software is only for humans" << endl;
|
||||||
QString fileStr;
|
return 2;
|
||||||
QString language = QString("english");
|
|
||||||
if (configFile.open(QIODevice::ReadOnly))
|
|
||||||
while (true) {
|
|
||||||
fileStr = QString(configFile.readLine());
|
|
||||||
if (fileStr[0] != '#') {
|
|
||||||
if (fileStr.contains(QString("LANGUAGE=")))
|
|
||||||
language = fileStr.split(QString("="))[1]
|
|
||||||
.remove(QString(" "))
|
|
||||||
.trimmed();
|
|
||||||
}
|
}
|
||||||
if (configFile.atEnd())
|
|
||||||
break;
|
// detach from console
|
||||||
}
|
if (args[QString("detached")].toBool())
|
||||||
configFile.close();
|
daemon(0, 0);
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
|
qInstallMessageHandler(debugString);
|
||||||
|
#endif
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
QApplication::setQuitOnLastWindowClosed(false);
|
||||||
|
// reread translations according to flags
|
||||||
|
QString language = Language::defineLanguage(args[QString("config")].toString(),
|
||||||
|
args[QString("options")].toString());
|
||||||
|
QTranslator qtTranslator;
|
||||||
|
qtTranslator.load(QString("qt_%1").arg(language), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
|
a.installTranslator(&qtTranslator);
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
translator.load(QString(":/translations/") + language);
|
translator.load(QString(":/translations/%1").arg(language));
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
QString helpMessage = QString("");
|
// running
|
||||||
helpMessage += QApplication::translate("MainWindow", " Netctl GUI\n");
|
if (args[QString("error")].toBool()) {
|
||||||
helpMessage += QApplication::translate("MainWindow", "Version : %1 License : GPLv3\n")
|
cout << errorMessage().toUtf8().data() << endl;
|
||||||
.arg(QString(VERSION));
|
cout << helpMessage().toUtf8().data();
|
||||||
helpMessage += QApplication::translate("MainWindow", " Evgeniy Alekseev aka arcanis\n");
|
return 1;
|
||||||
helpMessage += QApplication::translate("MainWindow", " E-mail : esalexeev@gmail.com\n\n");
|
} else if (args[QString("help")].toBool()) {
|
||||||
helpMessage += QApplication::translate("MainWindow", "Usage:\n");
|
cout << helpMessage().toUtf8().data();
|
||||||
helpMessage += QApplication::translate("MainWindow", "netctl-gui [ --default ] [ -t NUM | --tab NUM ] [ -h | --help]\n\n");
|
return 0;
|
||||||
helpMessage += QApplication::translate("MainWindow", "Parametrs:\n");
|
} else if (args[QString("info")].toBool()) {
|
||||||
helpMessage += QApplication::translate("MainWindow", " --default - start with default settings\n");
|
cout << versionMessage().toUtf8().data() << endl;
|
||||||
helpMessage += QApplication::translate("MainWindow", " -t NUM --tab NUM - open a tab with number NUM\n");
|
cout << infoMessage().toUtf8().data();
|
||||||
helpMessage += QApplication::translate("MainWindow", " -h --help - show this help and exit\n");
|
return 0;
|
||||||
bool defaultSettings = false;
|
} else if (args[QString("version")].toBool()) {
|
||||||
int tabNumber = 0;
|
cout << versionMessage().toUtf8().data();
|
||||||
|
|
||||||
for (int i=1; i<argc; i++) {
|
|
||||||
// help message
|
|
||||||
if (((argv[i][0] == '-') && (argv[i][1] == 'h') && (argv[i][2] == '\0')) ||
|
|
||||||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'h') && (argv[i][3] == 'e') &&
|
|
||||||
(argv[i][4] == 'l') && (argv[i][5] == 'p') && (argv[i][6] == '\0'))) {
|
|
||||||
cout << helpMessage.toUtf8().data();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// default settings
|
|
||||||
else if ((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 'd') && (argv[i][3] == 'e') &&
|
|
||||||
(argv[i][4] == 'f') && (argv[i][5] == 'a') && (argv[i][6] == 'u') && (argv[i][7] == 'l') &&
|
|
||||||
(argv[i][8] == 't') && (argv[i][9] == '\0')) {
|
|
||||||
defaultSettings = true;
|
|
||||||
}
|
|
||||||
// tab number
|
|
||||||
else if (((argv[i][0] == '-') && (argv[i][1] == 't') && (argv[i][2] == '\0')) ||
|
|
||||||
((argv[i][0] == '-') && (argv[i][1] == '-') && (argv[i][2] == 't') &&
|
|
||||||
(argv[i][3] == 'a') && (argv[i][4] == 'b') && (argv[i][5] == '\0'))) {
|
|
||||||
if (atoi(argv[i+1]) > 3)
|
|
||||||
tabNumber = 3;
|
|
||||||
else if (atoi(argv[i+1]) < 1)
|
|
||||||
tabNumber = 1;
|
|
||||||
else
|
|
||||||
tabNumber = atoi(argv[i+1]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow w(0, defaultSettings, tabNumber);
|
// check if exists
|
||||||
w.show();
|
if (existingSessionOperation(QString("Active"))) {
|
||||||
|
if ((getuid() == getUidFromSession(0)) && (geteuid() == getUidFromSession(1))) {
|
||||||
|
// restore session
|
||||||
|
cout << QCoreApplication::translate("MainWindow", "Restore existing session.")
|
||||||
|
.toUtf8().data() << endl;
|
||||||
|
existingSessionOperation(QString("Restore"));
|
||||||
|
return 0;
|
||||||
|
} else if ((getuid() == getUidFromSession(0)) && (geteuid() != getUidFromSession(1))) {
|
||||||
|
cout << QCoreApplication::translate("MainWindow", "Close existing session.")
|
||||||
|
.toUtf8().data() << endl;
|
||||||
|
existingSessionOperation(QString("Close"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MainWindow w(0, args, &qtTranslator, &translator);
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|