Compare commits
391 Commits
Author | SHA1 | Date | |
---|---|---|---|
224e558a98 | |||
a391df2804 | |||
755d0b39f8 | |||
fcd612880f | |||
5aff2d2e4e | |||
5a52c056a7 | |||
42615a6fdc | |||
b431d2c6cf | |||
f96b3fcb07 | |||
f534a6854a | |||
b51c97abbb | |||
8dc3510a30 | |||
fce098cb5c | |||
5f4bf9ec29 | |||
8c73b2560b | |||
78931b3ae0 | |||
a53c5ec38c | |||
3bac9ac09f | |||
b82d78bcbe | |||
396fa95ec3 | |||
c6cadba4b6 | |||
daa362fc16 | |||
26c51007e0 | |||
7919e6d250 | |||
88c3e780cf | |||
7f4dfe1060 | |||
15d88ee3ba | |||
104bb52557 | |||
9a6b883905 | |||
fd8f2127d9 | |||
7ae90bf82d | |||
bcf26156d1 | |||
4cee2535ee | |||
e1ebd87871 | |||
4cef889fd4 | |||
d785839d1d | |||
cf6ccc293b | |||
e9ee6150c1 | |||
30577e91ec | |||
e5006ed2d6 | |||
3bd73d0458 | |||
4dbf5150fc | |||
061244b1d0 | |||
8055647f34 | |||
d74c7cb030 | |||
f5006af977 | |||
16d7d2bc20 | |||
6e27717dc8 | |||
d1f1d79752 | |||
862d14dc0e | |||
685c0390b4 | |||
35a5aa6a6c | |||
681fec4cac | |||
bb88892125 | |||
f01fd96cf6 | |||
eac1319889 | |||
86d4bd76ea | |||
27fd4e8f1e | |||
9611677254 | |||
a61cff7caa | |||
4966a0a5bf | |||
b1abf74e89 | |||
16170c72b0 | |||
c5a0ba3796 | |||
cce37d66e5 | |||
c850aaf2a3 | |||
43efbbba72 | |||
3a0cbee39f | |||
213595b3c1 | |||
f5fbb80d91 | |||
0288e6e1eb | |||
6667b45919 | |||
9ff07241b1 | |||
cc7b7b5659 | |||
3e709f549d | |||
adcf6c942f | |||
7415a6830f | |||
c23846f7b4 | |||
e957a2723b | |||
5369bbda65 | |||
6a8842163e | |||
56e7ee3d11 | |||
ce72c46cd9 | |||
78ab09c1da | |||
498a965488 | |||
d1d4a97fa4 | |||
8f1e8606d4 | |||
b682c6dbd6 | |||
c8bf047e76 | |||
a336d9aa04 | |||
2272b0c2c0 | |||
0533ee8cd5 | |||
be792a4c5a | |||
997e13706b | |||
6bcb6798a2 | |||
4e3593a2a9 | |||
4b471593c7 | |||
695a85be29 | |||
bae34ba898 | |||
93db63b16c | |||
0cd2ff6813 | |||
222db43dc1 | |||
e4be3b2e02 | |||
543e39a7ac | |||
ca60a85241 | |||
2c3c575493 | |||
5f37a9d8c7 | |||
c3420a8393 | |||
5ce3a5c213 | |||
179a97b01b | |||
f0c79a4dab | |||
f56f319075 | |||
f7b7d5b6b4 | |||
3193de1a85 | |||
8cdfdd4e81 | |||
16d7ca2005 | |||
e54ab7e1a5 | |||
a335979830 | |||
8460d07875 | |||
5ec26c7747 | |||
8aafdb6fc4 | |||
9eedaf246f | |||
e7714042bb | |||
0f4bbbfba1 | |||
7069758b73 | |||
bbc9d72606 | |||
b53b1111f9 | |||
64fdc4bebe | |||
583046e195 | |||
71b3a4e6ab | |||
4b90fac0c4 | |||
2fa0acf13d | |||
0f9d2e52ab | |||
373bab14db | |||
7e095c4349 | |||
a4af7ffc07 | |||
0ab4878b22 | |||
1748829901 | |||
6a41fa2b8a | |||
2cd04e1f7f | |||
0a61d926f8 | |||
45c248b101 | |||
6a784d2e28 | |||
13023a4985 | |||
6463ed3bf7 | |||
5bf3847bc9 | |||
4fc2e238bd | |||
c18bb61521 | |||
9e82210463 | |||
171d545562 | |||
c6fa1f2a79 | |||
14cee9dbc7 | |||
5759273e4c | |||
4387bb1e76 | |||
03af5f0e49 | |||
7f6afbcb4d | |||
4a320bc5d6 | |||
29d34525a3 | |||
0ab74b493c | |||
952fa97fcc | |||
677ed1ab5e | |||
deb0b3bdbb | |||
20c85f0d42 | |||
f9a37f0cb2 | |||
0c8013c26b | |||
6b9e19ed58 | |||
432ab694fd | |||
c506183247 | |||
fe822518d5 | |||
1f9e8221f0 | |||
d7e93e83a3 | |||
17c3383616 | |||
830bab7cb6 | |||
0b3832cc32 | |||
e64ca5ec08 | |||
84b93098f2 | |||
17bef06c98 | |||
db7573de80 | |||
4907496a2e | |||
43daae5529 | |||
1d1fe469f8 | |||
99049164be | |||
f61948d9b3 | |||
ea54c54d42 | |||
c843c5260d | |||
a8912074dd | |||
2be0edcb40 | |||
fcf7ca233f | |||
aa127574c4 | |||
d72f827984 | |||
b7d607bfcc | |||
c727947557 | |||
6864e5bda0 | |||
4babb3ba04 | |||
e0aadc48c4 | |||
18b6fc6eef | |||
5406f6f66f | |||
ab966504cc | |||
ce761db924 | |||
f91c80b5b1 | |||
97fbb4acc1 | |||
554354ce36 | |||
c007fabe12 | |||
3b11e39e99 | |||
653cc4fd84 | |||
eae742c559 | |||
e339f5aa1a | |||
21a1d8cd1b | |||
0ea17555b1 | |||
eec87be7a2 | |||
0cd293c4c3 | |||
e5c70b9535 | |||
3ef68f7a43 | |||
1fbc9e315e | |||
28dafcb721 | |||
4164c7fe04 | |||
bc8aadc17b | |||
cd48ac8245 | |||
0751d080eb | |||
6c6cfe9a04 | |||
b61d514cb2 | |||
a5c352bc06 | |||
54174974b1 | |||
fd81fda9a1 | |||
c69957e905 | |||
a65f4cb02f | |||
3b89b30a98 | |||
5921bd4c1d | |||
5b26d835df | |||
38c4d3bfaf | |||
eac50a8799 | |||
6e5a068ad2 | |||
7f639805e6 | |||
8a6650f833 | |||
96cfeb520d | |||
7cd80e14a7 | |||
b55d453aeb | |||
7eb5197318 | |||
e603ad9977 | |||
068a976499 | |||
5b44fa5c75 | |||
87614084ab | |||
8ccad0b86c | |||
0240dee6ea | |||
81105fb12d | |||
93abb86340 | |||
5584ba0e9f | |||
2c35031549 | |||
d28d7156ce | |||
123cfcb475 | |||
7fa541bc06 | |||
03574461a9 | |||
f588c9af8d | |||
ee39ac9203 | |||
5ea8c97094 | |||
edf3a72564 | |||
b9c9aac686 | |||
7dd7251a45 | |||
1ccbc264ed | |||
334189b8a1 | |||
6c7d6a5443 | |||
e37f2a7190 | |||
baf21549d5 | |||
07c2abd5bc | |||
2ea73b2261 | |||
7c3b47693e | |||
0fe67ce323 | |||
bfb7d72faf | |||
662b952961 | |||
a81cbe3d9c | |||
0462bb186e | |||
9985fe6260 | |||
11a6f01ae3 | |||
43ee40a65d | |||
f9eb27964f | |||
bab9f58b35 | |||
608908fd02 | |||
178bbd0bc0 | |||
f8a02a48ac | |||
cf39fba9c2 | |||
6643852822 | |||
7145a1d33e | |||
a3c1f4ea66 | |||
a6ddd53308 | |||
744f3bc04b | |||
afdf86f03a | |||
8f2784d2a2 | |||
926da88c10 | |||
ea287c21b1 | |||
c0561a95e0 | |||
b7d1802ca8 | |||
c659f16d7e | |||
79cbfc4b32 | |||
61e2a380b9 | |||
64bc89ba75 | |||
926d112d22 | |||
e205664fec | |||
5d13c8289f | |||
7ac5d68b02 | |||
69b5bdec66 | |||
5ce7aac9dd | |||
80eb7983fc | |||
7e2b1384ae | |||
d573cc7491 | |||
b380000d2f | |||
50d96574f5 | |||
d6819e3771 | |||
a54b3064fe | |||
a0288bcf96 | |||
f1e22f122e | |||
52f85836a2 | |||
2ad638c158 | |||
cebf3b9aea | |||
e32a37043a | |||
246430dc28 | |||
dd4471a0d2 | |||
31c612cfd2 | |||
2201f4d4a2 | |||
886e24d4af | |||
fbf5f649ee | |||
7fc7b68358 | |||
9904e5d6c6 | |||
e10f3396b9 | |||
25ff5a9189 | |||
41b1282488 | |||
5d46988745 | |||
71823471cc | |||
fe580ef806 | |||
b1f8340774 | |||
e868b03454 | |||
632adfa54c | |||
4476ec8e45 | |||
b4f7b6e65a | |||
77349e797f | |||
e7b6e4a3bf | |||
3d8f88d935 | |||
1eed0f458c | |||
9b581a882f | |||
6ba1288c50 | |||
926c283338 | |||
8519eb51bd | |||
f05b256306 | |||
6fd7bad8f9 | |||
6f4ecbd107 | |||
9f392c3a19 | |||
e04430e36c | |||
68759513a9 | |||
62164f8229 | |||
7c5e02217b | |||
23cd74132a | |||
5dfb02bf9d | |||
2d0a92eec1 | |||
359e81ff93 | |||
1bd80ba786 | |||
2a04414600 | |||
fe51e67ba4 | |||
e208be7894 | |||
26bf118d50 | |||
86da48bbca | |||
d081a64889 | |||
3d2c09647a | |||
c7a99a6d0d | |||
c0a273f9f7 | |||
5d724ac688 | |||
8e318a99d0 | |||
5c861b3814 | |||
5cf068875c | |||
80366e59bb | |||
a6a94f0e49 | |||
6a74802261 | |||
c44e98d8a1 | |||
b872a66088 | |||
74d54d6268 | |||
2ad6d76d4e | |||
878dac158e | |||
2de09cec32 | |||
90ca8c89f5 | |||
757d7b703f | |||
5d3e377ffb | |||
9b5a6908d7 | |||
f54ba7a6cf | |||
7427183981 | |||
109328e33b | |||
ec62e93e4e | |||
1a6d97800c | |||
b09e90a0e5 | |||
c1f18a31bf | |||
962478a27a | |||
4857c6658f | |||
4416298e88 | |||
a3576275cc |
7
.gitignore
vendored
@ -1,4 +1,7 @@
|
|||||||
sources/build
|
sources/build
|
||||||
sources/usr
|
sources/usr
|
||||||
*src.tar.xz
|
*src.tar.[gx]z
|
||||||
*src.tar.gz
|
*pkg.tar.[gx]z
|
||||||
|
build
|
||||||
|
src
|
||||||
|
pkg
|
||||||
|
12
.gitmodules
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[submodule "sources/3rdparty/pdebug"]
|
||||||
|
path = sources/3rdparty/pdebug
|
||||||
|
url = https://github.com/arcan1s/qtadds-pdebug.git
|
||||||
|
[submodule "sources/3rdparty/task"]
|
||||||
|
path = sources/3rdparty/task
|
||||||
|
url = https://github.com/arcan1s/qtadds-taskadds-qprocess.git
|
||||||
|
[submodule "sources/3rdparty/tasks"]
|
||||||
|
path = sources/3rdparty/tasks
|
||||||
|
url = https://github.com/mhogomchungu/tasks.git
|
||||||
|
[submodule "sources/3rdparty/fontdialog"]
|
||||||
|
path = sources/3rdparty/fontdialog
|
||||||
|
url = https://github.com/arcan1s/qtadds-fontdialog.git
|
6
AUTHORS
@ -2,4 +2,8 @@ Current developers:
|
|||||||
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
|
||||||
|
|
||||||
Translators:
|
Translators:
|
||||||
@Mermouy (french translations)
|
@Mermouy (French translation)
|
||||||
|
Ernesto Avilés Vzqz (Spanish translation)
|
||||||
|
@underr (Brazillian Portuguese translation)
|
||||||
|
Виктор Слободян (Ukrainian translation)
|
||||||
|
Steve Lemuel (Chinese translation)
|
||||||
|
283
CHANGELOG
@ -1,20 +1,199 @@
|
|||||||
|
Ver.2.3.1:
|
||||||
|
- fix bug with no updates from configuration UI
|
||||||
|
- fix invalid vertical tab parsing
|
||||||
|
* translation update
|
||||||
|
* merge fan tags to temp ones, improve lmsensors tags handling
|
||||||
|
|
||||||
|
Ver.2.3.0:
|
||||||
|
+ implement fitlers support to ExtScripts (ApiVer = 3) (#53)
|
||||||
|
+ implement ability to wrap `\n` as new lines (#53)
|
||||||
|
+ implement key sorting in comboboxes
|
||||||
|
+ implement (perc)(bid|ask|price)chg tag support (ApiVer = 2)
|
||||||
|
+ implement timeouts to quotes (#54)
|
||||||
|
- fix bug with invalid html parsing
|
||||||
|
* move from XML to JSON in ExtQuotes (ApiVer = 2)
|
||||||
|
* more pretty configuration UI
|
||||||
|
* some part of refactoring
|
||||||
|
|
||||||
|
Ver.2.2.2:
|
||||||
|
+ add quotes support (#46)
|
||||||
|
+ add support of properties height and width (#47)
|
||||||
|
+ add transtaltion support to the plugins (#50)
|
||||||
|
+ add support of key caching
|
||||||
|
+ add support of X-AW-Number to ExtScript and ExtUpgrade (ApiVer = 2)
|
||||||
|
+ add reconnection to DataEngine (in some cases some values are not updated)
|
||||||
|
+ add widgets width and height update
|
||||||
|
- fix bug with Ext* items update (#49)
|
||||||
|
- fix bug with GPUDEV, HDDDEV settings saving from UI
|
||||||
|
- fix Desktop Panel settings
|
||||||
|
- fix bug with adding paragraph settings
|
||||||
|
* drop support of KDE4 support, created a separated branch
|
||||||
|
* increase intervals limits (#48)
|
||||||
|
* hddtemp was replaced to smartctl by default
|
||||||
|
* plugins were moved from private
|
||||||
|
* more correct interface painting
|
||||||
|
|
||||||
|
Ver.2.2.1:
|
||||||
|
+ add key X-AW-Interval to ExtUpgrade (ApiVer = 1, default = 3600)
|
||||||
|
+ add values cache to ExtScript and ExtUpgrade
|
||||||
|
+ add support isActive to ExtUpgrade
|
||||||
|
* change cmake version check
|
||||||
|
* improve logic of ExtScript and ExtUpgrade
|
||||||
|
|
||||||
|
Ver.2.2.0:
|
||||||
|
* port to Plasma 5
|
||||||
|
+ add support of windows list in tooltip
|
||||||
|
+ add notifications on system events
|
||||||
|
+ add ability to show selected tag
|
||||||
|
+ add tags $downN, $upN
|
||||||
|
+ add new engine netdev
|
||||||
|
+ add support of smartctl
|
||||||
|
- remove ability to hide panel on hotkey
|
||||||
|
* small changes in widget logic
|
||||||
|
* edit window preview painting
|
||||||
|
* KDE4 code upgrade to new ABI
|
||||||
|
* DataEngine optimization
|
||||||
|
* PKGCMD was replaced by ExtUpgrade
|
||||||
|
|
||||||
|
Ver.2.1.0:
|
||||||
|
+ add support of custom scripts
|
||||||
|
+ add support of desktop preview to DP
|
||||||
|
+ add bar support
|
||||||
|
+ add autoupdate function
|
||||||
|
- remove custom command
|
||||||
|
- fix #34
|
||||||
|
* fix notifications
|
||||||
|
* rewrite UI to KDE standards
|
||||||
|
* fix margins on graphical objects
|
||||||
|
* rewrite DP abd DE to use library calls
|
||||||
|
* edit GPU properties definition
|
||||||
|
* edit regexp matching
|
||||||
|
|
||||||
|
Ver.2.0.5:
|
||||||
|
+ add tooltip bottom (#30)
|
||||||
|
* fix network interface update
|
||||||
|
* fix battery tooltip bug
|
||||||
|
* edit DP layout (#31)
|
||||||
|
|
||||||
|
Ver.2.0.4:
|
||||||
|
* more correct work with batteries
|
||||||
|
|
||||||
|
Ver.2.0.3:
|
||||||
|
+ add support of several $bat tags
|
||||||
|
* edit layout
|
||||||
|
|
||||||
|
Ver.2.0.2:
|
||||||
|
+ add $fan* tags
|
||||||
|
+ add Chinese translation (thanks to @Lemueler)
|
||||||
|
+ add net devices checking is it p2p device
|
||||||
|
- remove ps stats from notification
|
||||||
|
* yet another fix cpu* and cpucl*
|
||||||
|
* rewrite DP configuration interface
|
||||||
|
* fix non-standard temp units
|
||||||
|
|
||||||
|
Ver.2.0.1:
|
||||||
|
+ add support of custom interfaces
|
||||||
|
* fix label edge's shading
|
||||||
|
* fix cpu*, cpucl*, gpu*, ps* tags
|
||||||
|
|
||||||
|
Ver.2.0.0:
|
||||||
|
+ add new widget - awesome widget
|
||||||
|
+ add new tags $hddfreemb, $hddfreegb, $memusedmb, $memusedgb, $memfreemb $memfreegb, $swapfreemb, $swapfreegb
|
||||||
|
+ add new DataEngine - battery
|
||||||
|
+ add new tooltip - battery
|
||||||
|
+ add new temperature units cm^-1, kcal/mol, kJ/mol, Reamur
|
||||||
|
+ add ability to hide panels by hotkey pressing
|
||||||
|
- remove widget pytextmonitor
|
||||||
|
- remove separate fields
|
||||||
|
- remove README
|
||||||
|
* project has been renamed to Awesome Widgets
|
||||||
|
* rename tag $custom (time) to $ctime
|
||||||
|
* rename tag $custom (uptime) to $cuptime
|
||||||
|
* rename tag $time (player) to $duration
|
||||||
|
* rename tag $number to $ndesktop
|
||||||
|
* rename tag $name to $desktop
|
||||||
|
* rename tag $total to $tdesktops
|
||||||
|
* debug flag is DEBUG now
|
||||||
|
* rewrite project to C++
|
||||||
|
* tooltip doesn't depend on widget now
|
||||||
|
* text align now can be configured only by using HTML tags
|
||||||
|
* move battery and AC settings to DataEngine
|
||||||
|
* changes in configuration interface
|
||||||
|
|
||||||
|
Ver.1.11.0:
|
||||||
|
+ add ability to disable background image
|
||||||
|
+ add desktop DataEngine
|
||||||
|
+ add PTM desktop panel
|
||||||
|
+ add desktop label (tags $name, $number, $total)
|
||||||
|
+ add ability to interact with players using mpris
|
||||||
|
* rewrite to use submodules
|
||||||
|
* rewrite DataEngine to use tasks
|
||||||
|
* fix nvidia temperature definition
|
||||||
|
|
||||||
|
Ver.1.10.2:
|
||||||
|
- fix error with tempUnits in hddtemp label
|
||||||
|
|
||||||
|
Ver.1.10.1:
|
||||||
|
- fix error with number formats in ps label
|
||||||
|
- fix first initialization of DataEngine
|
||||||
|
- fix checking of qmmp
|
||||||
|
|
||||||
|
Ver.1.10.0:
|
||||||
|
+ add tags $hddtotmb, $hddtotgb
|
||||||
|
+ add tags $memtotmb, $memtotgb, $swaptotmb, $swaptotgb
|
||||||
|
+ add ability for force update text
|
||||||
|
+ add support of clementine
|
||||||
|
+ add support of hddtemp cmd
|
||||||
|
+ add support of disable option for HDDDEV and GPUDEV
|
||||||
|
+ add error checking of DataEngine variables
|
||||||
|
+ add multithreading to DataEngine
|
||||||
|
+ add ability to disable popup messages
|
||||||
|
+ add ability to use vertical layout
|
||||||
|
+ add ability to add stretch
|
||||||
|
+ add ability to show debug information (set environment variable 'PTM_DEBUG' to 'yes')
|
||||||
|
+ add Brazillian Portuguese translation (@underr)
|
||||||
|
+ add Ukrainian translation (Виктор Слободян)
|
||||||
|
- remove util.py
|
||||||
|
- remove createNotifyrc since it isn't needed
|
||||||
|
* refactoring of configuration interface
|
||||||
|
* player settings was moved from plasmoid to DataEngine
|
||||||
|
* edit readme call
|
||||||
|
* change readme from md to html
|
||||||
|
|
||||||
|
Ver.1.9.0:
|
||||||
|
+ add support of several custom commands ($customN)
|
||||||
|
+ add hdd speed label ($hddrN, $hddwN)
|
||||||
|
+ add actions to context menu (open readme and run ksysguard)
|
||||||
|
- remove doubleclick event
|
||||||
|
* fix parsing pkg label
|
||||||
|
|
||||||
|
Ver.1.8.3:
|
||||||
|
+ add Spanish translation (thanks to Ernesto Avilés Vzqz)
|
||||||
|
+ add readme to the package
|
||||||
|
|
||||||
|
Ver.1.8.2:
|
||||||
|
+ add different temperature units (Farenheit and Kelvin)
|
||||||
|
|
||||||
|
Ver.1.8.1:
|
||||||
|
* change pkg update time to hour
|
||||||
|
|
||||||
Ver.1.8.0:
|
Ver.1.8.0:
|
||||||
+ added scrollbar to configuration interface
|
+ add scrollbar to configuration interface
|
||||||
+ added AC lines configuration
|
+ add AC lines configuration
|
||||||
+ added $hddmbN, %hddgbN tags
|
+ add $hddmbN, $hddgbN tags
|
||||||
+ added support of ps ($ps, $pscount, $pstotal tags)
|
+ add support of ps ($ps, $pscount, $pstotal tags)
|
||||||
+ added support of package managers ($pkgcountN tags)
|
+ add support of package managers ($pkgcountN tags)
|
||||||
* refactoring of DataEngine
|
* refactoring of DataEngine
|
||||||
|
|
||||||
Ver.1.7.4:
|
Ver.1.7.4:
|
||||||
+ added support more than 10 tags in cpu, cpuclock, hdd, hddtemp, temp labels
|
+ add support more than 10 tags in cpu, cpuclock, hdd, hddtemp, temp labels
|
||||||
- format bug fixes
|
- format bug fixes
|
||||||
* changes in custom uptime format
|
* changes in custom uptime format
|
||||||
|
|
||||||
Ver.1.7.3:
|
Ver.1.7.3:
|
||||||
+ added tags $memgb, $swapgb
|
+ add tags $memgb, $swapgb
|
||||||
+ added readme directory
|
+ add readme directory
|
||||||
+ added french translation (@Mermouy)
|
+ add french translation (@Mermouy)
|
||||||
- fix tooltip for custom uptime format
|
- fix tooltip for custom uptime format
|
||||||
- fix #12
|
- fix #12
|
||||||
* more refactoring to the god of refactoring
|
* more refactoring to the god of refactoring
|
||||||
@ -23,108 +202,108 @@ Ver.1.7.3:
|
|||||||
* player_name now has str type
|
* player_name now has str type
|
||||||
|
|
||||||
Ver.1.7.2:
|
Ver.1.7.2:
|
||||||
+ added tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
+ add tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
||||||
+ added scalling to tooltips
|
+ add scalling to tooltips
|
||||||
+ added dataengine configuration from ptm
|
+ add DataEngine configuration from ptm
|
||||||
+ added custom command to dataengine
|
+ add custom command to DataEngine
|
||||||
- removed custom command from ptm
|
- remove custom command from ptm
|
||||||
- removed tags $ds, $hs, $ms
|
- remove tags $ds, $hs, $ms
|
||||||
|
|
||||||
Ver.1.7.1:
|
Ver.1.7.1:
|
||||||
- removed error label
|
- remove error label
|
||||||
* fix bug with zero values in tooltip
|
* fix bug with zero values in tooltip
|
||||||
|
|
||||||
Ver.1.7.0:
|
Ver.1.7.0:
|
||||||
+ added support of several tags in temperature label
|
+ add support of several tags in temperature label
|
||||||
+ added tags $cpuN, $cpuclN, $hddN, $tempN, $hddtempN, $up, $down
|
+ add tags $cpuN, $cpuclN, $hddN, $tempN, $hddtempN, $up, $down
|
||||||
+ added label with custom command
|
+ add label with custom command
|
||||||
+ added tooltips for CPU, CPU clock, memory, swap and network labels
|
+ add tooltips for CPU, CPU clock, memory, swap and network labels
|
||||||
- removed tags @@...@@, $temp, $ccpu, $ccpucl, $net
|
- remove tags @@...@@, $temp, $ccpu, $ccpucl, $net
|
||||||
* changes in settings
|
* changes in settings
|
||||||
* ptm now does not require net-tools
|
* ptm now does not require net-tools
|
||||||
* refactoring
|
* refactoring
|
||||||
|
|
||||||
Ver.1.6.1:
|
Ver.1.6.1:
|
||||||
+ added support of several devices in hddtemp label
|
+ add support of several devices in hddtemp label
|
||||||
- fixed #6
|
- fixed #6
|
||||||
|
|
||||||
Ver.1.6.0:
|
Ver.1.6.0:
|
||||||
+ added $custom tag to time and uptime labels (#8)
|
+ add $custom tag to time and uptime labels (#8)
|
||||||
+ russian translation
|
+ russian translation
|
||||||
- fixed #6, #10
|
- fix #6, #10
|
||||||
* changed license to GPLv3
|
* change license to GPLv3
|
||||||
* changed project build
|
* change project build
|
||||||
|
|
||||||
Ver.1.5.3:
|
Ver.1.5.3:
|
||||||
+ added $album, $progress and $time tags to player label (#7)
|
+ add $album, $progress and $time tags to player label (#7)
|
||||||
- fixed zero swap
|
- fix zero swap
|
||||||
|
|
||||||
Ver.1.5.2:
|
Ver.1.5.2:
|
||||||
+ added $isotime, $shorttime and $longtime tags to time label
|
+ add $isotime, $shorttime and $longtime tags to time label
|
||||||
|
|
||||||
Ver.1.5.1:
|
Ver.1.5.1:
|
||||||
+ added time label
|
+ add time label
|
||||||
|
|
||||||
Ver.1.5.0:
|
Ver.1.5.0:
|
||||||
+ added player label
|
+ add player label
|
||||||
|
|
||||||
Ver.1.4.0:
|
Ver.1.4.0:
|
||||||
+ added notifications
|
+ add notifications
|
||||||
|
|
||||||
Ver.1.3.6:
|
Ver.1.3.6:
|
||||||
- fixed #1, #2
|
- fix #1, #2
|
||||||
|
|
||||||
Ver.1.3.5:
|
Ver.1.3.5:
|
||||||
- fix bug with definition network device
|
- fix bug with definition network device
|
||||||
|
|
||||||
Ver.1.3.4:
|
Ver.1.3.4:
|
||||||
+ added double click event
|
+ add double click event
|
||||||
+ added auto selection of network device
|
+ add auto selection of network device
|
||||||
- fixed yet another plasma crash
|
- fix yet another plasma crash
|
||||||
|
|
||||||
Ver.1.3.3:
|
Ver.1.3.3:
|
||||||
* edited reading temperature device
|
* edit reading temperature device
|
||||||
|
|
||||||
Ver.1.3.2b:
|
Ver.1.3.2b:
|
||||||
- fixed plasma crash
|
- fix plasma crash
|
||||||
|
|
||||||
Ver.1.3.2:
|
Ver.1.3.2:
|
||||||
+ added GPU, GPU temperature, HDD and HDD temperature labels
|
+ add GPU, GPU temperature, HDD and HDD temperature labels
|
||||||
+ added $ccpu and $ccpucl tags
|
+ add $ccpu and $ccpucl tags
|
||||||
- bug fixes
|
- bug fixes
|
||||||
* optimization and refactoring
|
* optimization and refactoring
|
||||||
|
|
||||||
Ver.1.2.2:
|
Ver.1.2.2:
|
||||||
+ added tooltip to lineEdit
|
+ add tooltip to lineEdit
|
||||||
|
|
||||||
Ver.1.2.1:
|
Ver.1.2.1:
|
||||||
* if battery doesn't exist return 'off'
|
* if battery doesn't exist return 'off'
|
||||||
* if AC doesn't exist return '(?)'
|
* if AC doesn't exist return '(?)'
|
||||||
|
|
||||||
Ver.1.2.0:
|
Ver.1.2.0:
|
||||||
+ added $ac tag to battery label
|
+ add $ac tag to battery label
|
||||||
+ added battery and ac device configurations
|
+ add battery and ac device configurations
|
||||||
+ added error cheking
|
+ add error cheking
|
||||||
* $bat tag now reading from /sys/*
|
* $bat tag now reading from /sys/*
|
||||||
|
|
||||||
Ver.1.1.4:
|
Ver.1.1.4:
|
||||||
* changed parsing acpi output (battery label)
|
* change parsing acpi output (battery label)
|
||||||
|
|
||||||
Ver.1.1.3:
|
Ver.1.1.3:
|
||||||
+ added font weight
|
+ add font weight
|
||||||
* edited font setup line. Now setup for font family works normaly
|
* edit font setup line. Now setup for font family works normaly
|
||||||
* small bug fix
|
* small bug fix
|
||||||
|
|
||||||
Ver.1.1.2:
|
Ver.1.1.2:
|
||||||
+ added CPU clock lable
|
+ add CPU clock lable
|
||||||
+ added function to update network device (100*time_interval)
|
+ add function to update network device (100*time_interval)
|
||||||
+ changed update sliders
|
+ change update sliders
|
||||||
|
|
||||||
Ver.1.1.1:
|
Ver.1.1.1:
|
||||||
+ added $swapmb, $memmb, $netdev, @@netdev=...@@ tags
|
+ add $swapmb, $memmb, $netdev, @@netdev=...@@ tags
|
||||||
- some bug fixes
|
- some bug fixes
|
||||||
* widget consists of several labels
|
* widget consists of several labels
|
||||||
* edited configuration interface
|
* edit configuration interface
|
||||||
|
|
||||||
Ver.1.0:
|
Ver.1.0:
|
||||||
First release
|
First release
|
||||||
|
179
CHANGELOG-RU
@ -1,3 +1,182 @@
|
|||||||
|
Вер.2.3.1:
|
||||||
|
- пофикшен баг с отсутствием обновлений значений из настроек
|
||||||
|
- убрана поддержка фильтра `\t`
|
||||||
|
* обновлены переводы
|
||||||
|
* теги fan были объединены с temp, улучшена поддержка тегов lmsensors
|
||||||
|
|
||||||
|
Вер.2.3.0:
|
||||||
|
+ добавлена поддержка фильтров в ExtScript (ApiVer = 3) (#53)
|
||||||
|
+ добавлена возможность отображать `\n`, как перенос строки (#53)
|
||||||
|
+ добавлена сортировка ключей в комбобоксах
|
||||||
|
+ добавлена поддержка тегов (perc)(bid|ask|price)chg (ApiVer = 2)
|
||||||
|
+ добавлены таймауты запросов котировок (#54)
|
||||||
|
- исправлен баг с неправильным парсингом html
|
||||||
|
* ExtQuotes теперь использует JSON вместо XML (ApiVer = 2)
|
||||||
|
* более красивый UI настроек
|
||||||
|
* некоторый рефакторинг
|
||||||
|
|
||||||
|
Вер.2.2.2:
|
||||||
|
+ добавлена поддержка котировок (#46)
|
||||||
|
+ добавлена поддержка свойств height и width (#47)
|
||||||
|
+ добавлена поддержка перевода в плагины (#50)
|
||||||
|
+ добавлено кеширование ключей
|
||||||
|
+ добавлена поддержка X-AW-Number в ExtScript, ExtUpgrade (ApiVer=2)
|
||||||
|
+ добавлено переподключение DataEngine (в некоторых случаях отдельные значения не обновляются)
|
||||||
|
+ добавлено обновление ширины и высоты виджета
|
||||||
|
- исправлен баг при обновлении Ext* (#49)
|
||||||
|
- исправлен баг с сохранением настроек GPUDEV, HDDDEV из графического интерфейса
|
||||||
|
- исправлены настройки Desktop Panel
|
||||||
|
- исправлен баг с добавлением настроек параграфа
|
||||||
|
* дропнута поддержка KDE4 версии (отдельная ветка разработки)
|
||||||
|
* увеличены лимиты для интервалов (#48)
|
||||||
|
* hddtemp был заменен на smartctl по умолчанию
|
||||||
|
* плагины были перемещены из private
|
||||||
|
* более корректное рисование интерфейса
|
||||||
|
|
||||||
|
Вер.2.2.1:
|
||||||
|
+ добавлен ключ X-AW-Interval в ExtUpgrade (ApiVer = 1, default = 3600)
|
||||||
|
+ добавлено кеширование значений в ExtScript и ExtUpgrade
|
||||||
|
+ добавлена поддержка isActive в ExtUpgrade
|
||||||
|
* изменена проверка версий cmake
|
||||||
|
* улучшена логика работы ExtScript и ExtUpgrade
|
||||||
|
|
||||||
|
Вер.2.2.0:
|
||||||
|
* портирование на Plasma 5
|
||||||
|
+ добавлена поддержка списка окон в тултипе
|
||||||
|
+ добавлены уведомления на системные события
|
||||||
|
+ добавлена возможность показать выбранный тег
|
||||||
|
+ добавлены теги $downN, $upN
|
||||||
|
+ добавлен инструмент netdev
|
||||||
|
+ добавлена поддержка smartctl
|
||||||
|
- убрана возможность сокрытия панелей
|
||||||
|
* незначительно изменена логика работы виджета
|
||||||
|
* исправлена отрисовка превью окон
|
||||||
|
* обновление кодовой базы KDE4 под новый ABI
|
||||||
|
* оптимизация работы DataEngine
|
||||||
|
* PKGCMD были заменены на ExtUpgrade
|
||||||
|
|
||||||
|
Вер.2.1.0:
|
||||||
|
+ добавлена функция автообновления
|
||||||
|
+ добавлена поддерка кастомных скриптов
|
||||||
|
+ добавлена поддержка превью рабочего стола для DP
|
||||||
|
+ добавлена поддержка баров
|
||||||
|
- удалена поддержка кастомных команд
|
||||||
|
- фикс #34
|
||||||
|
* исправлены уведомления
|
||||||
|
* переписан UI в соответствии со стандартами KDE
|
||||||
|
* исправлены границы для графических объектов
|
||||||
|
* переписан DP и DE на использование библиотечных функций
|
||||||
|
* изменено определение свойств GPU
|
||||||
|
* изменен поиск регулярных выражений
|
||||||
|
|
||||||
|
Вер.2.0.5:
|
||||||
|
+ добавлен нижний край к тултипу (#30)
|
||||||
|
* исправлен баг с обновлением сетевого интерфейса
|
||||||
|
* исправлен баг с тултипом батареи
|
||||||
|
* отредактирована разметка DP (#31)
|
||||||
|
|
||||||
|
Вер.2.0.4:
|
||||||
|
* более корректная работа с батареями
|
||||||
|
|
||||||
|
Вер.2.0.3:
|
||||||
|
+ добавлена поддержка нескольких тегов $bat
|
||||||
|
* отредактирована разметка
|
||||||
|
|
||||||
|
Вер.2.0.2:
|
||||||
|
+ добавлены теги $fan*
|
||||||
|
+ добавлен китайский перевод (спасибо @Lemueler)
|
||||||
|
+ добавлена проверка сетевых устройств на p2p
|
||||||
|
- удалено ps stats из уведомлений
|
||||||
|
* еще один фикс тегов cpu* и cpucl
|
||||||
|
* переписан конфигурационный интерфейс DP
|
||||||
|
* исправлены нестандартные единицы температуры
|
||||||
|
|
||||||
|
Вер.2.0.1:
|
||||||
|
+ добавлена поддержка кастомных интерфейсов
|
||||||
|
* фикс затенения краев поля
|
||||||
|
* фикс тегов cpu*, cpucl*, gpu*, ps*
|
||||||
|
|
||||||
|
Вер.2.0.0:
|
||||||
|
+ добавлен виджет awesome widget
|
||||||
|
+ новые теги $hddfreemb, $hddfreegb, $memusedmb, $memusedgb, $memfreemb $memfreegb, $swapfreemb, $swapfreegb
|
||||||
|
+ новый DataEngine - battery
|
||||||
|
+ новый тултип - battery
|
||||||
|
+ новые температурные единицы см^-1, ккал/моль, кДж/моль, Реамюр
|
||||||
|
+ добавлена возможность скрывать панели по хоткею
|
||||||
|
- удален виджет pytextmonitor
|
||||||
|
- убраны отдельные поля
|
||||||
|
- удалены README
|
||||||
|
* проект переименован в Awesome Widgets
|
||||||
|
* тег $custom (время) переименован в $ctime
|
||||||
|
* тег $custom (время работы) переименован в $cuptime
|
||||||
|
* тег $time (плеер) переименован в $duration
|
||||||
|
* тег $number переименован в $ndesktop
|
||||||
|
* тег $name переименован в $desktop
|
||||||
|
* тег $total переименован в $tdesktops
|
||||||
|
* дебаг флаг теперь DEBUG
|
||||||
|
* проект полностью переписан на C++
|
||||||
|
* тултип независит теперь от самого виджета
|
||||||
|
* настройка выравнивания текста теперь осуществляется только HTML тегами
|
||||||
|
* настройки батареи и адаптора питания вынесены в DataEngine
|
||||||
|
* изменения в конфигурационном интерфейсе
|
||||||
|
|
||||||
|
Вер.1.11.0:
|
||||||
|
+ добавлена возможность отключения фона
|
||||||
|
+ добавлен desktop DataEngine
|
||||||
|
+ добавлен виджет PTM desktop panel
|
||||||
|
+ добавлено поле текущий рабочий стол (теги $name, $number, $total)
|
||||||
|
+ добавлена возможность взаимодействия с плеерами через mpris
|
||||||
|
* добавлено использование сабмодулей
|
||||||
|
* DataEngine переписан с использованием tasks
|
||||||
|
* фикс чтения температуры nvidia
|
||||||
|
|
||||||
|
Вер.1.10.2:
|
||||||
|
- фикс ошибки с tempUnits в поле hddtemp
|
||||||
|
|
||||||
|
Вер.1.10.1:
|
||||||
|
- пофикшена ошибка с форматами чисел в поле ps
|
||||||
|
- пофикшена инициализация значений в DataEngine
|
||||||
|
- пофикшена проверка qmmp
|
||||||
|
|
||||||
|
Вер.1.10.0:
|
||||||
|
+ добавлены теги $hddtotmb, $hddtotgb
|
||||||
|
+ добавлены теги $memtotmb, $memtotgb, $swaptotmb, $swaptotgb
|
||||||
|
+ добавлена возможность форсированного обновления
|
||||||
|
+ добавлена поддержка clementine
|
||||||
|
+ добавлена поддержка команды hddtemp
|
||||||
|
+ добавлены поддержка disable для HDDDEV и GPUDEV
|
||||||
|
+ добавлена многопоточность в DataEngine
|
||||||
|
+ добавлена проверка ошибок для переменных DataEngine
|
||||||
|
+ добавлена возможность отключения всплывающих сообщений
|
||||||
|
+ добавлена возможность использовать вертикальную разметку
|
||||||
|
+ добавлена возможность добавить пустое пространство
|
||||||
|
+ добавлена возможность вывода отладочной информации (установите переменную окружения 'PTM_DEBUG' в 'yes')
|
||||||
|
+ добавлен перевод Brazillian Portuguese (@underr)
|
||||||
|
+ добавлена украинская локализация (Виктор Слободян)
|
||||||
|
- удален util.py
|
||||||
|
- удалены функции createNotifyrc, поскольку они больше не нужны
|
||||||
|
* рефакторинг конфигурационного интерфейса
|
||||||
|
* настройки плеера были перенесены из виджета в DataEngine
|
||||||
|
* исправлен вызов readme под четырехсимвольное обозначение
|
||||||
|
* перенос readme с md на html
|
||||||
|
|
||||||
|
Вер.1.9.0:
|
||||||
|
+ добавлена поддержка нескольких кастомных команд ($customN)
|
||||||
|
+ добавлено поле скорости hdd ($hddrN, $hddwN)
|
||||||
|
+ добавлены действия в контекстное меню (открыть readme и запустить ksysguard)
|
||||||
|
* исправлен парсинг поля pkg
|
||||||
|
- убрано событие по двойному клику
|
||||||
|
|
||||||
|
Вер.1.8.3:
|
||||||
|
+ добавлен испанский перевод (Ernesto Avilés Vzqz)
|
||||||
|
+ добавлены файлы readme
|
||||||
|
|
||||||
|
Вер.1.8.2:
|
||||||
|
+ добавлены различные температурные единицы (Farenheit и Kelvin)
|
||||||
|
|
||||||
|
Вер.1.8.1:
|
||||||
|
* поле pkg теперь обновляется раз в час
|
||||||
|
|
||||||
Вер.1.8.0:
|
Вер.1.8.0:
|
||||||
+ добавлены скроллбары в конфигурационный интерфейс
|
+ добавлены скроллбары в конфигурационный интерфейс
|
||||||
+ добавлена настройка значений AC
|
+ добавлена настройка значений AC
|
||||||
|
4
COPYING
@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
|
|||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
pytextmonitor
|
awesome-widgets
|
||||||
Copyright (C) 2013-2014 Evgeniy Alekseev
|
Copyright (C) 2013-2014 Evgeniy Alekseev
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
|
|||||||
If the program does terminal interaction, make it output a short
|
If the program does terminal interaction, make it output a short
|
||||||
notice like this when it starts in an interactive mode:
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
pytextmonitor Copyright (C) 2013 Evgeniy Alekseev
|
awesome-widgets Copyright (C) 2013 Evgeniy Alekseev
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
This is free software, and you are welcome to redistribute it
|
This is free software, and you are welcome to redistribute it
|
||||||
under certain conditions; type `show c' for details.
|
under certain conditions; type `show c' for details.
|
||||||
|
42
PKGBUILD
@ -1,42 +0,0 @@
|
|||||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
|
||||||
|
|
||||||
pkgname=kdeplasma-applets-pytextmonitor
|
|
||||||
_pkgname=pytextmonitor
|
|
||||||
pkgver=1.8.0
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc="Minimalistic Plasmoid script written on Python2. It looks like widgets in Awesome WM"
|
|
||||||
arch=('i686' 'x86_64')
|
|
||||||
url="http://arcanis.name/projects/pytextmonitor"
|
|
||||||
license=('GPLv3')
|
|
||||||
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors')
|
|
||||||
optdepends=("amarok: for music player monitor"
|
|
||||||
"catalyst: for GPU monitor"
|
|
||||||
"hddtemp: for HDD temperature monitor"
|
|
||||||
"mpd: for music player monitor"
|
|
||||||
"net-tools: for popup messages"
|
|
||||||
"nvidia-utils: for GPU monitor"
|
|
||||||
"qmmp: for music player monitor"
|
|
||||||
"sysstat: for popup messages")
|
|
||||||
makedepends=('automoc4' 'cmake')
|
|
||||||
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
|
||||||
install=${pkgname}.install
|
|
||||||
md5sums=('9052985dc219e75ffbed88ce3ebf5a32')
|
|
||||||
backup=('usr/share/config/extsysmon.conf')
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
[[ -d ${srcdir}/build ]] && rm -rf "${srcdir}/build"
|
|
||||||
mkdir "${srcdir}/build"
|
|
||||||
}
|
|
||||||
|
|
||||||
build () {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) \
|
|
||||||
"../${_pkgname}"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
209
README.md
@ -1,216 +1,75 @@
|
|||||||
pytextmonitor
|
awesome-widgets (ex-pytextmonitor)
|
||||||
=============
|
==================================
|
||||||
|
|
||||||
Information
|
Information
|
||||||
-----------
|
-----------
|
||||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
|
||||||
|
|
||||||
**NOTE** LOOKING FOR TRANSLATORS!
|
A collection of minimalistic widgets which looks like Awesome Window Manager widgets.
|
||||||
|
|
||||||
Configuration
|
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/awesome-widgets/issues/14)
|
||||||
-------------
|
|
||||||
For edited output you must open Settings window and setup output format in lines:
|
|
||||||
* tag `$time` - time in default format. For example, *fri Nov 6 04:48:01 2013*
|
|
||||||
* tag `$isotime` - time in iso format
|
|
||||||
* tag `$shorttime` - time in short locale format
|
|
||||||
* tag `$longtime` - time in long locale format
|
|
||||||
* tag `$custom` - custom time format
|
|
||||||
* tag `$uptime` - uptime, *---d--h--m*
|
|
||||||
* tag `$custom` - custom uptime format
|
|
||||||
* tag `$cpu` - total load cpu, *%*
|
|
||||||
* tag `$cpuN` - load CPU for core N, *%*
|
|
||||||
* tag `$cpucl` - average cpu clock, *MHz*
|
|
||||||
* tag `$cpuclN` - cpu clock for core N, *MHz*
|
|
||||||
* tag `$tempN` - temperature for device N. For example, `$temp0`
|
|
||||||
* tag `$gpu` - GPU usage, *%*. `aticonfig` or `nvidia-smi` must be installed
|
|
||||||
* tag `$gputemp` - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
|
|
||||||
* tag `$mem` - usage memory, *%*
|
|
||||||
* tag `$memmb` - usage memory, *MB*
|
|
||||||
* tag `$memgb` - usage memory, *GB*
|
|
||||||
* tag `$swap` - swap, *%*
|
|
||||||
* tag `$swapmb` - swap, *MB*
|
|
||||||
* tag `$swapgb` - swap, *GB*
|
|
||||||
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
|
|
||||||
* tag `$hddtempN` - temperature for HDD N. For example, `$hddtemp0`
|
|
||||||
* tag `$down` - download speed, *KB/s*
|
|
||||||
* tag `$up` - upload speed, *KB/s*
|
|
||||||
* tag `$netdev` - current network device
|
|
||||||
* tag `$bat` - battery charge, *%*
|
|
||||||
* tag `$ac` - status AC device. Return (\*) if AC device is online or *( )* if offline
|
|
||||||
* tag `$album` - current song album. One of supported music players must be installed
|
|
||||||
* tag `$artist` - current song artist. One of supported music players must be installed
|
|
||||||
* tag `$progress` - current song progress. One of supported music players must be installed
|
|
||||||
* tag `$time` - current song duration. One of supported music players must be installed
|
|
||||||
* tag `$title` - current song title. One of supported music players must be installed
|
|
||||||
* tag `$pscount` - number of running processes
|
|
||||||
* tag `$pstotal` - total number of processes
|
|
||||||
* tag `$ps` - list of running processes
|
|
||||||
* tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
|
|
||||||
* tag `$custom` - returns output for custom command
|
|
||||||
|
|
||||||
Label order will changed if you change slider position. HTML tags in label work normally.
|
Features
|
||||||
|
========
|
||||||
|
|
||||||
**NOTE** you don't may set to show `$cpu` tag in swap label for example. **`$cpu` will work only in cpu label**.
|
* easy and fully configurable native Plasma widget which may be used as Conky widget or as Awesome-like information panel
|
||||||
|
* panel which shows active desktop status
|
||||||
|
* clear Conky-like configuration with html tags support
|
||||||
|
* custom command support (it may be simple action as well as special custom tag)
|
||||||
|
* graphical item support - tooltips, bars
|
||||||
|
|
||||||
Advanced settings
|
See [links](#Links) for more details.
|
||||||
-----------------
|
|
||||||
**Custom time**
|
|
||||||
|
|
||||||
* tag `$dddd` - weekday in long format
|
**Didn't find required feature?** [Just ask for it!](https://github.com/arcan1s/awesome-widgets/issues)
|
||||||
* tag `$ddd` - weekday in short format
|
|
||||||
* tag `$dd` - day
|
|
||||||
* tag `$d` - day without zero
|
|
||||||
* tag `$MMMM` - month in long format
|
|
||||||
* tag `$MMM` - month in short format
|
|
||||||
* tag `$MM` - month
|
|
||||||
* tag `$M` - month without zero
|
|
||||||
* tag `$yyyy` - year
|
|
||||||
* tag `$yy` - year in short format
|
|
||||||
* tag `$hh` - hours
|
|
||||||
* tag `$h` - hours without zero
|
|
||||||
* tag `$mm` - minutes
|
|
||||||
* tag `$m` - minutes without zero
|
|
||||||
* tag `$ss` - seconds
|
|
||||||
* tag `$s` - seconds without zero
|
|
||||||
|
|
||||||
**Custom uptime**
|
|
||||||
|
|
||||||
* tag `$dd` - uptime days
|
|
||||||
* tag `$d` - uptime days without zero
|
|
||||||
* tag `$hh` - uptime hours
|
|
||||||
* tag `$h` - uptime hours without zero
|
|
||||||
* tag `$mm` - uptime minutes
|
|
||||||
* tag `$m` - uptime minutes without zero
|
|
||||||
|
|
||||||
**Temperature devices**
|
|
||||||
|
|
||||||
List of devices, which will be observed in temp label (combo box items come from `sensors`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**Mount points**
|
|
||||||
|
|
||||||
List of mount points, which will be observed in hdd label (combo box items come from `mount`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
List of hard disk devices, which will be observed in hddtem label (combo box items come from `find`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**Network directory**
|
|
||||||
|
|
||||||
Path to directory, which contains network devices information. Default is `/sys/class/net`. Required for auto select network device.
|
|
||||||
|
|
||||||
**Network device**
|
|
||||||
|
|
||||||
Use specified device as active. Combo box items come from **network directory**. Will disable auto select network device.
|
|
||||||
|
|
||||||
**Battery device**
|
|
||||||
|
|
||||||
File with battery information. File (`/sys/class/power_supply/BAT0/capacity` by default) should contain only battery charge in percent.
|
|
||||||
|
|
||||||
**AC online tag**
|
|
||||||
|
|
||||||
Line which will be shown when AC is online.
|
|
||||||
|
|
||||||
**AC offline tag**
|
|
||||||
|
|
||||||
Line which will be shown when AC is offline.
|
|
||||||
|
|
||||||
**AC device**
|
|
||||||
|
|
||||||
File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online.
|
|
||||||
|
|
||||||
**Music player**
|
|
||||||
|
|
||||||
Select one of supported music playes for player label.
|
|
||||||
|
|
||||||
Tooltip settings
|
|
||||||
----------------
|
|
||||||
Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.
|
|
||||||
|
|
||||||
DataEngine settings
|
|
||||||
-------------------
|
|
||||||
**Custom command**
|
|
||||||
|
|
||||||
*NOTE* This can cause the computer freeze.
|
|
||||||
|
|
||||||
A command, which will be run for custom label.
|
|
||||||
|
|
||||||
**GPU device**
|
|
||||||
|
|
||||||
Select one of supported GPU devices. `auto` will enable auto selection. Default is `auto`.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices. Default is `all`.
|
|
||||||
|
|
||||||
**MPD address**
|
|
||||||
|
|
||||||
Address of MPD server. Default is `localhost`.
|
|
||||||
|
|
||||||
**MPD port**
|
|
||||||
|
|
||||||
Port of MPD server. Default is `6600`.
|
|
||||||
|
|
||||||
**Package manager**
|
|
||||||
|
|
||||||
List of commands, which will be run. Number of null lines is a number of unneeded lines. Defaults:
|
|
||||||
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
|
|
||||||
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
|
|
||||||
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
|
|
||||||
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
|
|
||||||
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
|
|
||||||
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
|
|
||||||
|
|
||||||
|
|
||||||
DataEngine configuration
|
|
||||||
------------------------
|
|
||||||
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
|
|
||||||
|
|
||||||
Instruction
|
Instruction
|
||||||
===========
|
===========
|
||||||
|
|
||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
* kdebase-workspace
|
|
||||||
* kdebindings-python2
|
* plasma-framework
|
||||||
* lm_sensors (*for definition temperature device*)
|
|
||||||
* sysstat (*for notification*)
|
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
* proprietary video driver
|
* proprietary video driver
|
||||||
* hddtemp (make sure that it may be run with `sudo` without password. Just add following line to `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
|
* hddtemp
|
||||||
* music player (amarok, mpd or qmmp)
|
* smartmontools
|
||||||
|
* music player (mpd or supported MPRIS)
|
||||||
|
|
||||||
Make dependencies
|
Make dependencies
|
||||||
-----------------
|
-----------------
|
||||||
* automoc4
|
|
||||||
* cmake
|
* cmake
|
||||||
* kdebase-runtime
|
* extra-cmake-modules
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* download sources
|
* download sources
|
||||||
* install
|
* install
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||||
make && make install
|
|
||||||
|
|
||||||
Also you may install it to `/`:
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
|
||||||
make && sudo make install
|
make && sudo make install
|
||||||
|
|
||||||
|
**NOTE** on Plasma 5 it may require `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||||
|
|
||||||
Additional information
|
Additional information
|
||||||
======================
|
======================
|
||||||
|
|
||||||
TODO (wish list)
|
TODO (wish list)
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
See [milestones](https://github.com/arcan1s/awesome-widgets/milestones) for more details.
|
||||||
|
|
||||||
Links
|
Links
|
||||||
-----
|
-----
|
||||||
* [Homepage](http://arcanis.name/projects/pytextmonitor/)
|
|
||||||
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
* [Homepage](http://arcanis.name/projects/awesome-widgets/)
|
||||||
|
* [Migration to 2.*](http://arcanis.name/en/2014/09/04/migration-to-v2/)
|
||||||
|
* [Scripts and bars](http://arcanis.name/en/2014/12/19/aw-v21-bells-and-whistles/)
|
||||||
|
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Awesome+Widgets?content=157124)
|
||||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/) package
|
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma5-applet-awesome-widgets/) package
|
||||||
|
* [OpenSuse](http://software.opensuse.org/package/awesome-widgets) package
|
||||||
|
40
arch/PKGBUILD
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
|
||||||
|
|
||||||
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
|
_pkgname=awesome-widgets
|
||||||
|
pkgver=2.3.1
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/awesome-widgets"
|
||||||
|
license=('GPL3')
|
||||||
|
depends=('plasma-framework')
|
||||||
|
optdepends=("catalyst: for GPU monitor"
|
||||||
|
"hddtemp: for HDD temperature monitor"
|
||||||
|
"smartmontools: for HDD temperature monitor"
|
||||||
|
"mpd: for music player monitor"
|
||||||
|
"nvidia-utils: for GPU monitor")
|
||||||
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
|
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
|
install=${pkgname}.install
|
||||||
|
md5sums=('90e640b6679b4cf0f6f99cf6da2848f3')
|
||||||
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/build"
|
||||||
|
mkdir "${srcdir}/build"
|
||||||
|
}
|
||||||
|
|
||||||
|
build () {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
"../${_pkgname}"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
54
arch/PKGBUILD-git
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
|
||||||
|
|
||||||
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
|
_pkgname=awesome-widgets
|
||||||
|
pkgver=2.2.1.r15.g78931b3
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor). Git version"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/awesome-widgets"
|
||||||
|
license=('GPL3')
|
||||||
|
depends=('plasma-framework')
|
||||||
|
optdepends=("amarok: for music player monitor"
|
||||||
|
"clementine: for music player monitor"
|
||||||
|
"catalyst: for GPU monitor"
|
||||||
|
"hddtemp: for HDD temperature monitor"
|
||||||
|
"smartmontools: for HDD temperature monitor"
|
||||||
|
"mpd: for music player monitor"
|
||||||
|
"nvidia-utils: for GPU monitor"
|
||||||
|
"qmmp: for music player monitor")
|
||||||
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
|
source=(${_pkgname}::git+https://github.com/arcan1s/awesome-widgets/)
|
||||||
|
install=${pkgname}.install
|
||||||
|
md5sums=('SKIP')
|
||||||
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
git describe --tags --long | sed 's/V\.//' | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/${_pkgname}/build"
|
||||||
|
mkdir "${srcdir}/${_pkgname}/build"
|
||||||
|
|
||||||
|
# update submobules
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
git submodule init
|
||||||
|
git submodule update --recursive
|
||||||
|
echo "$pkgver"
|
||||||
|
}
|
||||||
|
|
||||||
|
build () {
|
||||||
|
cd "${srcdir}/${_pkgname}/build"
|
||||||
|
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
"../sources"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/${_pkgname}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
11
arch/plasma5-applet-awesome-widgets.install
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
post_install() {
|
||||||
|
kbuildsycoca5 > /dev/null 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
post_upgrade() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
post_remove() {
|
||||||
|
post_install "$1"
|
||||||
|
}
|
@ -1,15 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# update english readme
|
|
||||||
cp README.md readme/en.md
|
|
||||||
|
|
||||||
SRCDIR="sources"
|
SRCDIR="sources"
|
||||||
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
|
MINOR=$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1)
|
PATCH=$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||||
|
VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
|
||||||
|
# update submodules
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# build dataengine
|
# build dataengine
|
||||||
ARCHIVE="ext-sysmon"
|
ARCHIVE="extsysmon"
|
||||||
# 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}"
|
||||||
@ -18,19 +19,23 @@ tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
|||||||
rm -rf "${ARCHIVE}"
|
rm -rf "${ARCHIVE}"
|
||||||
|
|
||||||
# build widget
|
# build widget
|
||||||
ARCHIVE="pytextmonitor"
|
ARCHIVE="awesome-widgets"
|
||||||
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING readme"
|
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
|
||||||
IGNORELIST="build usr"
|
IGNORELIST="build usr .kdev4 *.kdev4"
|
||||||
# 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 rm -rf "${ARCHIVE}/${FILE}"; 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
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD
|
||||||
|
# clear
|
||||||
|
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -exec rm -rf {} \;
|
||||||
|
find arch -type l -xtype l -exec rm -rf {} \;
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
func_update() {
|
|
||||||
cat << EOF
|
|
||||||
Update plasmoids...
|
|
||||||
EOF
|
|
||||||
kbuildsycoca4 > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
post_install() {
|
|
||||||
func_update
|
|
||||||
cat << EOF
|
|
||||||
Make sure that \`hddtemp\` can be run with sudo without password
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
func_update
|
|
||||||
cat << EOF
|
|
||||||
Make sure that \`hddtemp\` can be run with sudo without password
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
post_remove() {
|
|
||||||
func_update
|
|
||||||
}
|
|
216
readme/en.md
@ -1,216 +0,0 @@
|
|||||||
pytextmonitor
|
|
||||||
=============
|
|
||||||
|
|
||||||
Information
|
|
||||||
-----------
|
|
||||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
|
||||||
|
|
||||||
**NOTE** LOOKING FOR TRANSLATORS!
|
|
||||||
|
|
||||||
Configuration
|
|
||||||
-------------
|
|
||||||
For edited output you must open Settings window and setup output format in lines:
|
|
||||||
* tag `$time` - time in default format. For example, *fri Nov 6 04:48:01 2013*
|
|
||||||
* tag `$isotime` - time in iso format
|
|
||||||
* tag `$shorttime` - time in short locale format
|
|
||||||
* tag `$longtime` - time in long locale format
|
|
||||||
* tag `$custom` - custom time format
|
|
||||||
* tag `$uptime` - uptime, *---d--h--m*
|
|
||||||
* tag `$custom` - custom uptime format
|
|
||||||
* tag `$cpu` - total load cpu, *%*
|
|
||||||
* tag `$cpuN` - load CPU for core N, *%*
|
|
||||||
* tag `$cpucl` - average cpu clock, *MHz*
|
|
||||||
* tag `$cpuclN` - cpu clock for core N, *MHz*
|
|
||||||
* tag `$tempN` - temperature for device N. For example, `$temp0`
|
|
||||||
* tag `$gpu` - GPU usage, *%*. `aticonfig` or `nvidia-smi` must be installed
|
|
||||||
* tag `$gputemp` - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
|
|
||||||
* tag `$mem` - usage memory, *%*
|
|
||||||
* tag `$memmb` - usage memory, *MB*
|
|
||||||
* tag `$memgb` - usage memory, *GB*
|
|
||||||
* tag `$swap` - swap, *%*
|
|
||||||
* tag `$swapmb` - swap, *MB*
|
|
||||||
* tag `$swapgb` - swap, *GB*
|
|
||||||
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
|
|
||||||
* tag `$hddtempN` - temperature for HDD N. For example, `$hddtemp0`
|
|
||||||
* tag `$down` - download speed, *KB/s*
|
|
||||||
* tag `$up` - upload speed, *KB/s*
|
|
||||||
* tag `$netdev` - current network device
|
|
||||||
* tag `$bat` - battery charge, *%*
|
|
||||||
* tag `$ac` - status AC device. Return (\*) if AC device is online or *( )* if offline
|
|
||||||
* tag `$album` - current song album. One of supported music players must be installed
|
|
||||||
* tag `$artist` - current song artist. One of supported music players must be installed
|
|
||||||
* tag `$progress` - current song progress. One of supported music players must be installed
|
|
||||||
* tag `$time` - current song duration. One of supported music players must be installed
|
|
||||||
* tag `$title` - current song title. One of supported music players must be installed
|
|
||||||
* tag `$pscount` - number of running processes
|
|
||||||
* tag `$pstotal` - total number of processes
|
|
||||||
* tag `$ps` - list of running processes
|
|
||||||
* tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
|
|
||||||
* tag `$custom` - returns output for custom command
|
|
||||||
|
|
||||||
Label order will changed if you change slider position. HTML tags in label work normally.
|
|
||||||
|
|
||||||
**NOTE** you don't may set to show `$cpu` tag in swap label for example. **`$cpu` will work only in cpu label**.
|
|
||||||
|
|
||||||
Advanced settings
|
|
||||||
-----------------
|
|
||||||
**Custom time**
|
|
||||||
|
|
||||||
* tag `$dddd` - weekday in long format
|
|
||||||
* tag `$ddd` - weekday in short format
|
|
||||||
* tag `$dd` - day
|
|
||||||
* tag `$d` - day without zero
|
|
||||||
* tag `$MMMM` - month in long format
|
|
||||||
* tag `$MMM` - month in short format
|
|
||||||
* tag `$MM` - month
|
|
||||||
* tag `$M` - month without zero
|
|
||||||
* tag `$yyyy` - year
|
|
||||||
* tag `$yy` - year in short format
|
|
||||||
* tag `$hh` - hours
|
|
||||||
* tag `$h` - hours without zero
|
|
||||||
* tag `$mm` - minutes
|
|
||||||
* tag `$m` - minutes without zero
|
|
||||||
* tag `$ss` - seconds
|
|
||||||
* tag `$s` - seconds without zero
|
|
||||||
|
|
||||||
**Custom uptime**
|
|
||||||
|
|
||||||
* tag `$dd` - uptime days
|
|
||||||
* tag `$d` - uptime days without zero
|
|
||||||
* tag `$hh` - uptime hours
|
|
||||||
* tag `$h` - uptime hours without zero
|
|
||||||
* tag `$mm` - uptime minutes
|
|
||||||
* tag `$m` - uptime minutes without zero
|
|
||||||
|
|
||||||
**Temperature devices**
|
|
||||||
|
|
||||||
List of devices, which will be observed in temp label (combo box items come from `sensors`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**Mount points**
|
|
||||||
|
|
||||||
List of mount points, which will be observed in hdd label (combo box items come from `mount`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
List of hard disk devices, which will be observed in hddtem label (combo box items come from `find`). List widget is editable, delete key will remove current item.
|
|
||||||
|
|
||||||
**Network directory**
|
|
||||||
|
|
||||||
Path to directory, which contains network devices information. Default is `/sys/class/net`. Required for auto select network device.
|
|
||||||
|
|
||||||
**Network device**
|
|
||||||
|
|
||||||
Use specified device as active. Combo box items come from **network directory**. Will disable auto select network device.
|
|
||||||
|
|
||||||
**Battery device**
|
|
||||||
|
|
||||||
File with battery information. File (`/sys/class/power_supply/BAT0/capacity` by default) should contain only battery charge in percent.
|
|
||||||
|
|
||||||
**AC online tag**
|
|
||||||
|
|
||||||
Line which will be shown when AC is online.
|
|
||||||
|
|
||||||
**AC offline tag**
|
|
||||||
|
|
||||||
Line which will be shown when AC is offline.
|
|
||||||
|
|
||||||
**AC device**
|
|
||||||
|
|
||||||
File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online.
|
|
||||||
|
|
||||||
**Music player**
|
|
||||||
|
|
||||||
Select one of supported music playes for player label.
|
|
||||||
|
|
||||||
Tooltip settings
|
|
||||||
----------------
|
|
||||||
Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.
|
|
||||||
|
|
||||||
DataEngine settings
|
|
||||||
-------------------
|
|
||||||
**Custom command**
|
|
||||||
|
|
||||||
*NOTE* This can cause the computer freeze.
|
|
||||||
|
|
||||||
A command, which will be run for custom label.
|
|
||||||
|
|
||||||
**GPU device**
|
|
||||||
|
|
||||||
Select one of supported GPU devices. `auto` will enable auto selection. Default is `auto`.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices. Default is `all`.
|
|
||||||
|
|
||||||
**MPD address**
|
|
||||||
|
|
||||||
Address of MPD server. Default is `localhost`.
|
|
||||||
|
|
||||||
**MPD port**
|
|
||||||
|
|
||||||
Port of MPD server. Default is `6600`.
|
|
||||||
|
|
||||||
**Package manager**
|
|
||||||
|
|
||||||
List of commands, which will be run. Number of null lines is a number of unneeded lines. Defaults:
|
|
||||||
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
|
|
||||||
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
|
|
||||||
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
|
|
||||||
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
|
|
||||||
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
|
|
||||||
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
|
|
||||||
|
|
||||||
|
|
||||||
DataEngine configuration
|
|
||||||
------------------------
|
|
||||||
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
|
|
||||||
|
|
||||||
Instruction
|
|
||||||
===========
|
|
||||||
|
|
||||||
Dependencies
|
|
||||||
------------
|
|
||||||
* kdebase-workspace
|
|
||||||
* kdebindings-python2
|
|
||||||
* lm_sensors (*for definition temperature device*)
|
|
||||||
* sysstat (*for notification*)
|
|
||||||
|
|
||||||
Optional dependencies
|
|
||||||
---------------------
|
|
||||||
* proprietary video driver
|
|
||||||
* hddtemp (make sure that it may be run with `sudo` without password. Just add following line to `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
|
|
||||||
* music player (amarok, mpd or qmmp)
|
|
||||||
|
|
||||||
Make dependencies
|
|
||||||
-----------------
|
|
||||||
* automoc4
|
|
||||||
* cmake
|
|
||||||
* kdebase-runtime
|
|
||||||
|
|
||||||
Installation
|
|
||||||
------------
|
|
||||||
* download sources
|
|
||||||
* install
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
|
||||||
make && make install
|
|
||||||
|
|
||||||
Also you may install it to `/`:
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
|
||||||
make && sudo make install
|
|
||||||
|
|
||||||
Additional information
|
|
||||||
======================
|
|
||||||
|
|
||||||
TODO (wish list)
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Links
|
|
||||||
-----
|
|
||||||
* [Homepage](http://arcanis.name/projects/pytextmonitor/)
|
|
||||||
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
|
||||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/) package
|
|
213
readme/ru.md
@ -1,213 +0,0 @@
|
|||||||
pytextmonitor
|
|
||||||
=============
|
|
||||||
|
|
||||||
Информация
|
|
||||||
----------
|
|
||||||
PyTextMonitor - минималистичный плазмоид, написанный на Python2. Он выглядит, как виджеты в Awesome WM.
|
|
||||||
|
|
||||||
Настройка
|
|
||||||
---------
|
|
||||||
Для редактирования внешнего виде, откройте окно настроек и установите требуемый формат в поля:
|
|
||||||
* тег `$time` - время в стандартном формате. Например, *fri Nov 6 04:48:01 2013*
|
|
||||||
* тег `$isotime` - время в ISO формате
|
|
||||||
* тег `$shorttime` - время в коротком формате
|
|
||||||
* тег `$longtime` - время в длинном формате
|
|
||||||
* тег `$custom` - свой формат времени
|
|
||||||
* тег `$uptime` - время работы, *---d--h--m*
|
|
||||||
* тег `$custom` - свой формат аптайма
|
|
||||||
* тег `$cpu` - общая загрузка CPU, *%*
|
|
||||||
* тег `$cpuN` - загрузка CPU для ядра N, *%*
|
|
||||||
* тег `$cpucl` - средняя частота CPU, *MHz*
|
|
||||||
* тег `$cpuclN` - частота CPU для ядра N, *MHz
|
|
||||||
* тег `$tempN` - температура для устройства N. Например, `$temp0`
|
|
||||||
* тег `$gpu` - использование GPU, *%*. `aticonfig` или `nvidia-smi` должны быть установлены
|
|
||||||
* тег `$gputemp` - температура GPU. `aticonfig` или `nvidia-smi` должны быть установлены
|
|
||||||
* тег `$mem` - использование RAM, *%*
|
|
||||||
* тег `$memmb` - использование RAM, *MB*
|
|
||||||
* тег `$memgb` - использование RAM, *GB*
|
|
||||||
* тег `$swap` - swap, *%*
|
|
||||||
* тег `$swapmb` - swap, *MB*
|
|
||||||
* тег `$swapgb` - swap, *GB*
|
|
||||||
* тег `$hddN` - использование точки монтирования N, *%*. Например, `$hdd0`
|
|
||||||
* тег `$hddtempN` - температура HDD N. Например, `$hddtemp0`
|
|
||||||
* тег `$down` - скорость загрузки, *KB/s*
|
|
||||||
* тег `$up` - скорость отдачи, *KB/s*
|
|
||||||
* тег `$netdev` - текущий сетевой интерфейс
|
|
||||||
* тег `$bat` - заряд батареи, *%*
|
|
||||||
* тег `$ac` - статус адаптора питания. Возвращает (\*), если AC подключен или *( )*, если нет
|
|
||||||
* тег `$album` - альбом. Один из поддерживаемых плееров должен быть установлен
|
|
||||||
* тег `$artist` - исполнитель. Один из поддерживаемых плееров должен быть установлен
|
|
||||||
* тег `$progress` - прогресс. Один из поддерживаемых плееров должен быть установлен
|
|
||||||
* тег `$time` - длительность. Один из поддерживаемых плееров должен быть установлен
|
|
||||||
* тег `$title` - название. Один из поддерживаемых плееров должен быть установлен
|
|
||||||
* тег `$pscount` - число запущенных процессов
|
|
||||||
* тег `$pstotal` - общее число процессов
|
|
||||||
* тег `$ps` - список процессов
|
|
||||||
* тег `$pkgcountN` - число пакетов, которые могут быть обновлены, для команды N. Например, `$pkgcount0`
|
|
||||||
* тег `$custom` - возвращает результат своей команды
|
|
||||||
|
|
||||||
Порядок полей изменится, если вы измените позицию слайдеров. HTML теги в полях работают корректно.
|
|
||||||
|
|
||||||
**ЗАМЕЧАНИЕ** вы не можете установить тег `$cpu`, например, в поле swap. **`$cpu` будет работать только в поле CPU**.
|
|
||||||
|
|
||||||
Расширенные настройки
|
|
||||||
---------------------
|
|
||||||
**Свой формат времени**
|
|
||||||
|
|
||||||
* тег `$dddd` - день недели в длинном формате
|
|
||||||
* тег `$ddd` - день недели в коротком формате
|
|
||||||
* тег `$dd` - день
|
|
||||||
* тег `$d` - день без нуля
|
|
||||||
* тег `$MMMM` - месяц в длинном формате
|
|
||||||
* тег `$MMM` - месяц в коротком формате
|
|
||||||
* тег `$MM` - месяц
|
|
||||||
* тег `$M` - месяц без нуля
|
|
||||||
* тег `$yyyy` - год
|
|
||||||
* тег `$yy` - год в коротком формате
|
|
||||||
* тег `$hh` - часы
|
|
||||||
* тег `$h` - часы без нуля
|
|
||||||
* тег `$mm` - минуты
|
|
||||||
* тег `$m` - минуты без нуля
|
|
||||||
* тег `$ss` - секунды
|
|
||||||
* тег `$s` - секунды без нуля
|
|
||||||
|
|
||||||
**Свой формат аптайма**
|
|
||||||
|
|
||||||
* тег `$dd` - дни аптайма
|
|
||||||
* тег `$d` - дни аптайма без нуля
|
|
||||||
* тег `$hh` - часы аптайма
|
|
||||||
* тег `$h` - часы аптайма без нуля
|
|
||||||
* тег `$mm` - минуты аптайма
|
|
||||||
* тег `$m` - минуты аптайма без нуля
|
|
||||||
|
|
||||||
**Датчики температуры**
|
|
||||||
|
|
||||||
Список датчиков, которые будут наблюдаться в поле temo (содержимое комбо бокса берется из `sensors`). Виджет редактируем, клавиша delete удалит текущую строку.
|
|
||||||
|
|
||||||
**Точки монтирования**
|
|
||||||
|
|
||||||
Список точек монтирования, которые будут наблюдаться в поле hdd (содержимое комбо бокса берется из `mount`). Виджет редактируем, клавиша delete удалит текущую строку.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
Список HDD, которые будут наблюдаться в поле hddtemp (содержимое комбо бокса берется из `find`). Виджет редактируем, клавиша delete удалит текущую строку.
|
|
||||||
|
|
||||||
**Директория с сетевыми интерфейсами**
|
|
||||||
|
|
||||||
Путь к директории, которая содержит информацию о сетевых интерфейсах. По умолчанию `/sys/class/net`. Требуется для определения сетевого устройства.
|
|
||||||
|
|
||||||
**Сетевое устройство**
|
|
||||||
|
|
||||||
Использовать указанный интерфейс, как активный. Содержимое комбо бокса берется из **директории с сетевыми интерфейсами**. Эта опция отключит авто определение интерфейса.
|
|
||||||
|
|
||||||
**Устройство батареи**
|
|
||||||
|
|
||||||
Файл с информацией о батарее. Данный файл (`/sys/class/power_supply/BAT0/capacity` по умолчанию) должен содержать только заряд батареи в процентах.
|
|
||||||
|
|
||||||
**AC online тег**
|
|
||||||
|
|
||||||
Строка, которая будет показана, когда AC онлайн.
|
|
||||||
|
|
||||||
**AC offline тег**
|
|
||||||
|
|
||||||
Строка, которая будет показана, когда AC оффлайн.
|
|
||||||
|
|
||||||
**Устройство AC**
|
|
||||||
|
|
||||||
Файл с информацией об адапторе питания. Данный файл (`/sys/class/power_supply/AC/online` по умолчанию) должен содержать `1`, если адаптор подключен.
|
|
||||||
|
|
||||||
**Музыкальные плеер**
|
|
||||||
|
|
||||||
Выберете один из поддерживаемых музыкальных плееров.
|
|
||||||
|
|
||||||
Настройки тултипа
|
|
||||||
-----------------
|
|
||||||
Начиная с версии 1.7.0 поля CPU, частота CPU, память, swap и сеть поддерживают графический тултип. Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть выставленно в данной вкладке. Цвета графиков также настраиваются.
|
|
||||||
|
|
||||||
Настройки DataEngine
|
|
||||||
--------------------
|
|
||||||
**Своя команда**
|
|
||||||
|
|
||||||
*ЗАМЕЧАНИЕ* Может вызвать зависание компьютера.
|
|
||||||
|
|
||||||
Команда, которая будет запущена для соответствующего поля.
|
|
||||||
|
|
||||||
**Устройство GPU**
|
|
||||||
|
|
||||||
Выберете одно из поддерживаемых устройств GPU. `auto` включит автоматическое определение. По умолчанию `auto`.
|
|
||||||
|
|
||||||
**HDD**
|
|
||||||
|
|
||||||
Выберете один из HDD для монитора его температуры. `all` включит монитор для всех доступных устройств. По умолчанию `all`.
|
|
||||||
|
|
||||||
**Адрес MPD**
|
|
||||||
|
|
||||||
Адрес MPD сервера. По умолчанию `localhost`.
|
|
||||||
|
|
||||||
**Порт MPD**
|
|
||||||
|
|
||||||
Порт MPD сервера. По умолчанию `6600`.
|
|
||||||
|
|
||||||
**Package manager**
|
|
||||||
|
|
||||||
Список команд, которые будут запущены. Число пустых строк - число ненужных для подсчета строк. Стандартные настройки:
|
|
||||||
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
|
|
||||||
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
|
|
||||||
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
|
|
||||||
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
|
|
||||||
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
|
|
||||||
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
|
|
||||||
|
|
||||||
Настройка DataEngine
|
|
||||||
--------------------
|
|
||||||
Вы можете отредактировать настройки DataEngine вручную. Откройте файл `/usr/share/config/extsysmon.conf` или `$HOME/.kde4/share/config/extsysmon.conf`, в зависимости от типа установки. Раскомментируйте требуемые строки и отредактируйте их.
|
|
||||||
|
|
||||||
Инструкция
|
|
||||||
==========
|
|
||||||
|
|
||||||
Зависимости
|
|
||||||
-----------
|
|
||||||
* kdebase-workspace
|
|
||||||
* kdebindings-python2
|
|
||||||
* lm_sensors (*для определения датчиков температуры*)
|
|
||||||
* sysstat (*для уведомлений*)
|
|
||||||
|
|
||||||
Опциональные зависимости
|
|
||||||
------------------------
|
|
||||||
* проприетарный видеодрайвер
|
|
||||||
* hddtemp (убедитесь, что может быть запущен с `sudo` без пароля. Просто добавьте следующую строку в `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
|
|
||||||
* музыкальный плеер (amarok, mpd или qmmp)
|
|
||||||
|
|
||||||
Зависимости сборки
|
|
||||||
------------------
|
|
||||||
* automoc4
|
|
||||||
* cmake
|
|
||||||
* kdebase-runtime
|
|
||||||
|
|
||||||
Установка
|
|
||||||
---------
|
|
||||||
* скачать исходный архив
|
|
||||||
* установить
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
|
||||||
make && make install
|
|
||||||
|
|
||||||
Для установки в `/`:
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
|
||||||
make && sudo make install
|
|
||||||
|
|
||||||
Дополнительная информация
|
|
||||||
=========================
|
|
||||||
|
|
||||||
TODO (wish list)
|
|
||||||
----------------
|
|
||||||
|
|
||||||
Ссылки
|
|
||||||
------
|
|
||||||
* [Домашняя страница](http://arcanis.name/projects/pytextmonitor/)
|
|
||||||
* Виджет на [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
|
||||||
* DataEngine на [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
|
||||||
* Пакет для Archlinux в [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/)
|
|
BIN
screenshots/config_01.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
screenshots/config_02.png
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
screenshots/config_03.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
screenshots/config_04.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
screenshots/config_05.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
screenshots/config_06.png
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
screenshots/dp_config_01.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
screenshots/dp_config_02.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
screenshots/dp_config_03.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
screenshots/dp_config_04.png
Normal file
After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 78 KiB |
Before Width: | Height: | Size: 52 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 43 KiB |
23
sources/.kdev4/awesomewidgets.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\x1e\x00a\x00w\x00e\x00s\x00o\x00m\x00e\x00-\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||||
|
|
||||||
|
[CMake]
|
||||||
|
Build Directory Count=1
|
||||||
|
Current Build Directory Index=0
|
||||||
|
ProjectRootRelative=./
|
||||||
|
|
||||||
|
[CMake][CMake Build Directory 0]
|
||||||
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/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\x1e\x00a\x00w\x00e\x00s\x00o\x00m\x00e\x00-\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||||
|
|
||||||
|
[CMake]
|
||||||
|
Build Directory Count=1
|
||||||
|
Current Build Directory Index=0
|
||||||
|
ProjectRootRelative=./
|
||||||
|
|
||||||
|
[CMake][CMake Build Directory 0]
|
||||||
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/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
|
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/fontdialog
vendored
Submodule
1
sources/3rdparty/pdebug
vendored
Submodule
1
sources/3rdparty/task
vendored
Submodule
1
sources/3rdparty/tasks
vendored
Submodule
@ -1,27 +1,46 @@
|
|||||||
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)
|
||||||
cmake_policy (SET CMP0011 NEW)
|
cmake_policy (SET CMP0011 NEW)
|
||||||
cmake_policy (SET CMP0015 NEW)
|
cmake_policy (SET CMP0015 NEW)
|
||||||
|
|
||||||
project (pytextmonitor)
|
project (awesomewidgets)
|
||||||
set (PROJECT_VERSION_MAJOR 1)
|
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||||
set (PROJECT_VERSION_MINOR 8)
|
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||||
set (PROJECT_VERSION_PATCH 0)
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
|
set (PROJECT_VERSION_MAJOR 2)
|
||||||
|
set (PROJECT_VERSION_MINOR 3)
|
||||||
|
set (PROJECT_VERSION_PATCH 1)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
|
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}")
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set (ADD_CXX_FLAGS "-Wall")
|
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -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)
|
||||||
else ()
|
else ()
|
||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
add_subdirectory (ext-sysmon)
|
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||||
add_subdirectory (ptm)
|
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||||
|
|
||||||
|
add_subdirectory (extsysmon)
|
||||||
|
add_subdirectory (awesome-widget)
|
||||||
|
add_subdirectory (desktop-panel)
|
||||||
|
|
||||||
|
# translations
|
||||||
|
add_subdirectory (translations)
|
||||||
|
19
sources/awesome-widget/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# set project name
|
||||||
|
set (SUBPROJECT plasma_applet_awesome-widget)
|
||||||
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||||
|
|
||||||
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
|
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml)
|
||||||
|
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||||
|
|
||||||
|
include (KDEInstallDirs)
|
||||||
|
include (KDECMakeSettings)
|
||||||
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
|
add_subdirectory (plugin)
|
||||||
|
plasma_install_package (package org.kde.plasma.awesomewidget)
|
28
sources/awesome-widget/metadata.desktop
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Awesome Widget
|
||||||
|
Comment=A minimalistic Plasmoid
|
||||||
|
Comment[en]=A minimalistic Plasmoid
|
||||||
|
Comment[es]=Un plasmoide minimalista
|
||||||
|
Comment[es]=Un script Plasmoïde minimaliste
|
||||||
|
Comment[pt_BR]=Um script Plasmoid
|
||||||
|
Comment[ru]=Минималистичный плазмоид
|
||||||
|
Comment[uk]=Мінімалістичний плазмоїд
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
Type=Service
|
||||||
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
X-Plasma-API=declarativeappletscript
|
||||||
|
X-Plasma-MainScript=ui/main.qml
|
||||||
|
X-Plasma-RemoteLocation=
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
|
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||||
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
X-KDE-PluginInfo-Depends=
|
||||||
|
X-KDE-PluginInfo-License=GPLv3
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
59
sources/awesome-widget/package/contents/config/config.qml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
import org.kde.plasma.configuration 2.0
|
||||||
|
|
||||||
|
|
||||||
|
ConfigModel {
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Widget")
|
||||||
|
icon: "utilities-system-monitor"
|
||||||
|
source: "widget.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Advanced")
|
||||||
|
icon: "system-run"
|
||||||
|
source: "advanced.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Tooltip")
|
||||||
|
icon: "preferences-desktop-color"
|
||||||
|
source: "tooltip.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Appearance")
|
||||||
|
icon: "preferences-desktop-theme"
|
||||||
|
source: "appearance.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("DataEngine")
|
||||||
|
icon: "utilities-system-monitor"
|
||||||
|
source: "dataengine.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("About")
|
||||||
|
icon: "help-about"
|
||||||
|
source: "about.qml"
|
||||||
|
}
|
||||||
|
}
|
131
sources/awesome-widget/package/contents/config/main.xml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||||
|
<kcfgfile name=""/>
|
||||||
|
|
||||||
|
<group name="Widget">
|
||||||
|
<!-- widget -->
|
||||||
|
<entry name="text" type="string">
|
||||||
|
<default>[cpu: $cpu%] [mem: $mem%] [swap: $swap%] [$netdev: $down/$upKB/s]</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Advanced">
|
||||||
|
<!-- advanced -->
|
||||||
|
<entry name="height" type="int">
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="width" type="int">
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="notify" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="wrapNewLines" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="background" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="customTime" type="string">
|
||||||
|
<default>$hh:$mm</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="customUptime" type="string">
|
||||||
|
<default>$dd,$hh,$mm</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tempUnits" type="string">
|
||||||
|
<default>Celsius</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="acOnline" type="string">
|
||||||
|
<default>(*)</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="acOffline" type="string">
|
||||||
|
<default>( )</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="checkUpdates" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Tooltip">
|
||||||
|
<entry name="tooltipNumber" type="int">
|
||||||
|
<default>100</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="useTooltipBackground" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipBackground" type="string">
|
||||||
|
<default>#ffffff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="cpuTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="cpuTooltipColor" type="string">
|
||||||
|
<default>#ff0000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="cpuclTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="cpuclTooltipColor" type="string">
|
||||||
|
<default>#00ff00</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="memTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="memTooltipColor" type="string">
|
||||||
|
<default>#0000ff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="swapTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="swapTooltipColor" type="string">
|
||||||
|
<default>#ffff00</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="downTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="downTooltipColor" type="string">
|
||||||
|
<default>#00ffff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="upTooltipColor" type="string">
|
||||||
|
<default>#ff00ff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="batTooltip" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="batTooltipColor" type="string">
|
||||||
|
<default>#008800</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="batInTooltipColor" type="string">
|
||||||
|
<default>#880000</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Appearance">
|
||||||
|
<!-- appearance -->
|
||||||
|
<entry name="interval" type="int">
|
||||||
|
<default>1000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="textAlign" type="string">
|
||||||
|
<default>center</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontFamily" type="string">
|
||||||
|
<default>Terminus</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontSize" type="int">
|
||||||
|
<default>12</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontColor" type="string">
|
||||||
|
<default>#000000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontWeight" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontStyle" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</kcfg>
|
109
sources/awesome-widget/package/contents/ui/about.qml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: aboutPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
QtControls.TabView {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Tab {
|
||||||
|
title: i18n("About")
|
||||||
|
|
||||||
|
QtLayouts.ColumnLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: AWActions.getAboutText("header")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: AWActions.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: AWActions.getAboutText("description")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: AWActions.getAboutText("links")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
font.capitalization: Font.SmallCaps
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: AWActions.getAboutText("copy")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Tab {
|
||||||
|
title: i18n("Acknowledgment")
|
||||||
|
|
||||||
|
QtLayouts.ColumnLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: AWActions.getAboutText("translators")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: AWActions.getAboutText("3rdparty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[about::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
257
sources/awesome-widget/package/contents/ui/advanced.qml
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: advancedPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_height: widgetHeight.value
|
||||||
|
property alias cfg_width: widgetWidth.value
|
||||||
|
property alias cfg_notify: notify.checked
|
||||||
|
property alias cfg_wrapNewLines: wrapNewLines.checked
|
||||||
|
property alias cfg_background: background.checked
|
||||||
|
property alias cfg_customTime: customTime.text
|
||||||
|
property alias cfg_customUptime: customUptime.text
|
||||||
|
property string cfg_tempUnits: tempUnits.currentText
|
||||||
|
property alias cfg_acOnline: acOnline.text
|
||||||
|
property alias cfg_acOffline: acOffline.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Widget height, px")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: widgetHeight
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 0
|
||||||
|
maximumValue: 4096
|
||||||
|
stepSize: 50
|
||||||
|
value: plasmoid.configuration.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Widget width, px")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: widgetWidth
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 0
|
||||||
|
maximumValue: 4096
|
||||||
|
stepSize: 50
|
||||||
|
value: plasmoid.configuration.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: notify
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Enable notifications")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: wrapNewLines
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Wrap new lines")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: background
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Enable background")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Custom time format")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: customTime
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: plasmoid.configuration.customTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Custom uptime format")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: customUptime
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: plasmoid.configuration.customUptime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Temperature units")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: tempUnits
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("Celsius"),
|
||||||
|
'name': "Celsius"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("Fahrenheit"),
|
||||||
|
'name': "Fahrenheit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("Kelvin"),
|
||||||
|
'name': "Kelvin"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("Reaumur"),
|
||||||
|
'name': "Reaumur"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("cm^-1"),
|
||||||
|
'name': "cm^-1"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("kJ/mol"),
|
||||||
|
'name': "kJ/mol"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("kcal/mol"),
|
||||||
|
'name': "kcal/mol"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.tempUnits) {
|
||||||
|
tempUnits.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("AC online tag")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: acOnline
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: plasmoid.configuration.acOnline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("AC offline tag")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: acOffline
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[advanced::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
239
sources/awesome-widget/package/contents/ui/appearance.qml
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: appearancePage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant weight: {
|
||||||
|
25: 0,
|
||||||
|
50: 1,
|
||||||
|
63: 3,
|
||||||
|
75: 4,
|
||||||
|
87: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
property alias cfg_interval: update.value
|
||||||
|
property alias cfg_fontFamily: selectFont.text
|
||||||
|
property alias cfg_fontSize: fontSize.value
|
||||||
|
property string cfg_fontWeight: fontWeight.currentText
|
||||||
|
property string cfg_fontStyle: fontStyle.currentText
|
||||||
|
property alias cfg_fontColor: selectColor.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Time interval")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: update
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
minimumValue: 1000
|
||||||
|
maximumValue: 10000
|
||||||
|
stepSize: 500
|
||||||
|
value: plasmoid.configuration.interval
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectFont
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
text: plasmoid.configuration.fontFamily
|
||||||
|
onClicked: fontDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font size")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: fontSize
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
minimumValue: 8
|
||||||
|
maximumValue: 32
|
||||||
|
stepSize: 1
|
||||||
|
value: plasmoid.configuration.fontSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font weight")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontWeight
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("light"),
|
||||||
|
'name': "light"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("demi bold"),
|
||||||
|
'name': "demibold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("bold"),
|
||||||
|
'name': "bold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("black"),
|
||||||
|
'name': "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
|
||||||
|
fontWeight.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font style")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontStyle
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("italic"),
|
||||||
|
'name': "italic"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
|
||||||
|
fontStyle.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectColor
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.fontColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.fontColor
|
||||||
|
onClicked: colorDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: colorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: selectColor.text
|
||||||
|
onAccepted: selectColor.text = colorDialog.color
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FontDialog {
|
||||||
|
id: fontDialog
|
||||||
|
title: i18n("Select a font")
|
||||||
|
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||||
|
onAccepted: {
|
||||||
|
selectFont.text = fontDialog.font.family
|
||||||
|
fontSize.value = fontDialog.font.pointSize
|
||||||
|
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||||
|
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[appearance::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
288
sources/awesome-widget/package/contents/ui/dataengine.qml
Normal file
@ -0,0 +1,288 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.0 as QtControls
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: dataenginePage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
|
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("ACPI path")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: cfg_dataengine["ACPIPATH"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Custom scripts")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Edit scripts")
|
||||||
|
onClicked: AWKeys.editItem("extscript")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("GPU device")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: gpuDev
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
model: ["auto", "disable", "ati", "nvidia"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i=0; i<model.length; i++) {
|
||||||
|
if (model[i] == cfg_dataengine["GPUDEV"]) {
|
||||||
|
currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("HDD")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: hdd
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
model: AWKeys.getHddDevices(true)
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i=0; i<model.length; i++) {
|
||||||
|
if (model[i] == cfg_dataengine["HDDDEV"]) {
|
||||||
|
hdd.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("hddtemp cmd")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: cfg_dataengine["HDDTEMPCMD"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("MPD address")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: cfg_dataengine["MPDADDRESS"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("MPD port")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 1000
|
||||||
|
maximumValue: 65535
|
||||||
|
stepSize: 1
|
||||||
|
value: cfg_dataengine["MPDPORT"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("MPRIS player name")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: mpris
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
editable: true
|
||||||
|
model: ["auto", "amarok", "audacious", "clementine", "deadbeef",
|
||||||
|
"vlc", "qmmp", "xmms2", cfg_dataengine["MPRIS"]]
|
||||||
|
currentIndex: model.length - 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Music player")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: player
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
model: ["mpris", "mpd"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i=0; i<model.length; i++) {
|
||||||
|
if (model[i] == cfg_dataengine["PLAYER"]) {
|
||||||
|
player.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Quotes monitor")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Edit tickers")
|
||||||
|
onClicked: AWKeys.editItem("extquotes")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Package manager")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Edit command")
|
||||||
|
onClicked: AWKeys.editItem("extupgrade")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[dataengine::onCompleted]")
|
||||||
|
|
||||||
|
// init submodule
|
||||||
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onDestruction: {
|
||||||
|
if (debug) console.log("[dataengine::onDestruction]")
|
||||||
|
|
||||||
|
cfg_dataengine["GPUDEV"] = gpuDev.currentText
|
||||||
|
cfg_dataengine["HDDDEV"] = hdd.currentText
|
||||||
|
cfg_dataengine["PLAYER"] = player.currentText
|
||||||
|
cfg_dataengine["MPRIS"] = mpris.currentText
|
||||||
|
AWActions.writeDataEngineConfiguration(cfg_dataengine)
|
||||||
|
}
|
||||||
|
}
|
36
sources/awesome-widget/package/contents/ui/general.qml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
pragma Singleton
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property variant fontWeight: {
|
||||||
|
"light": Font.Light,
|
||||||
|
"normal": Font.Normal,
|
||||||
|
"demibold": Font.DemiBold,
|
||||||
|
"bold": Font.Bold,
|
||||||
|
"black": Font.Black
|
||||||
|
}
|
||||||
|
property variant align: {
|
||||||
|
"left": Text.AlignLeft,
|
||||||
|
"center": Text.AlignHCenter,
|
||||||
|
"right": Text.AlignRight,
|
||||||
|
"justify": Text.AlignJustify
|
||||||
|
}
|
||||||
|
}
|
233
sources/awesome-widget/package/contents/ui/main.qml
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import org.kde.plasma.plasmoid 2.0
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
import "."
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: main
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant settings: {
|
||||||
|
"customTime": plasmoid.configuration.customTime,
|
||||||
|
"customUptime": plasmoid.configuration.customUptime,
|
||||||
|
"tempUnits": plasmoid.configuration.tempUnits,
|
||||||
|
"acOnline": plasmoid.configuration.acOnline,
|
||||||
|
"acOffline": plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackground": plasmoid.configuration.tooltipBackground,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
|
signal needUpdate
|
||||||
|
signal sizeUpdate
|
||||||
|
|
||||||
|
|
||||||
|
// init
|
||||||
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||||
|
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||||
|
|
||||||
|
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
|
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||||
|
|
||||||
|
Plasmoid.icon: "utilities-system-monitor"
|
||||||
|
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||||
|
Plasmoid.associatedApplication: "ksysguard"
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: systemmonitorDE
|
||||||
|
engine: "systemmonitor"
|
||||||
|
connectedSources: systemmonitorDE.sources
|
||||||
|
interval: plasmoid.configuration.interval
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
// FIXME: ugly workaround to make some sources working
|
||||||
|
systemmonitorDE.interval = plasmoid.configuration.interval
|
||||||
|
|
||||||
|
if (AWKeys.setDataBySource(sourceName, data, settings)) disconnectSource(sourceName)
|
||||||
|
}
|
||||||
|
|
||||||
|
onSourceAdded: {
|
||||||
|
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
||||||
|
|
||||||
|
AWKeys.addDevice(source)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: extsysmonDE
|
||||||
|
engine: "extsysmon"
|
||||||
|
connectedSources: extsysmonDE.sources
|
||||||
|
interval: plasmoid.configuration.interval
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
// FIXME: ugly workaround to make some sources working
|
||||||
|
extsysmonDE.interval = plasmoid.configuration.interval
|
||||||
|
|
||||||
|
if (AWKeys.setDataBySource(sourceName, data, settings)) needUpdate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: timeDE
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: ["Local"]
|
||||||
|
interval: 1000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ui
|
||||||
|
Text {
|
||||||
|
id: text
|
||||||
|
anchors.fill: parent
|
||||||
|
textFormat: Text.RichText
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
|
||||||
|
horizontalAlignment: general.align[plasmoid.configuration.textAlign]
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
color: plasmoid.configuration.fontColor
|
||||||
|
font.family: plasmoid.configuration.fontFamily
|
||||||
|
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||||
|
font.pointSize: plasmoid.configuration.fontSize
|
||||||
|
font.weight: general.fontWeight[plasmoid.configuration.fontWeight]
|
||||||
|
|
||||||
|
text: plasmoid.configuration.text
|
||||||
|
|
||||||
|
PlasmaCore.ToolTipArea {
|
||||||
|
height: tooltip.height
|
||||||
|
width: tooltip.width
|
||||||
|
mainItem: Text {
|
||||||
|
id: tooltip
|
||||||
|
height: contentHeight
|
||||||
|
width: contentWidth
|
||||||
|
textFormat: Text.RichText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[main::onCompleted]")
|
||||||
|
|
||||||
|
// actions
|
||||||
|
plasmoid.setAction("requestKey", i18n("Request key"), "utilities-system-monitor")
|
||||||
|
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
|
||||||
|
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
||||||
|
// plasmoid.setAction("report", i18n("Mail to developers"), "email")
|
||||||
|
// init submodule
|
||||||
|
Plasmoid.userConfiguringChanged(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
onNeedUpdate: {
|
||||||
|
if (debug) console.log("[main::onNeedUpdate]")
|
||||||
|
|
||||||
|
text.text = AWKeys.parsePattern()
|
||||||
|
tooltip.text = AWKeys.toolTipImage()
|
||||||
|
|
||||||
|
sizeUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
onSizeUpdate: {
|
||||||
|
if (debug) console.log("[main::onSizeUpdate]")
|
||||||
|
|
||||||
|
if (plasmoid.configuration.height == 0) {
|
||||||
|
Layout.minimumHeight = text.contentHeight
|
||||||
|
Layout.maximumHeight = -1
|
||||||
|
} else {
|
||||||
|
Layout.minimumHeight = plasmoid.configuration.height
|
||||||
|
Layout.maximumHeight = plasmoid.configuration.height
|
||||||
|
}
|
||||||
|
if (plasmoid.configuration.width == 0) {
|
||||||
|
Layout.minimumWidth = text.contentWidth
|
||||||
|
Layout.maximumWidth = -1
|
||||||
|
} else {
|
||||||
|
Layout.minimumWidth = plasmoid.configuration.width
|
||||||
|
Layout.maximumWidth = plasmoid.configuration.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plasmoid.onUserConfiguringChanged: {
|
||||||
|
if (plasmoid.userConfiguring) return
|
||||||
|
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||||
|
|
||||||
|
// init submodule
|
||||||
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
|
AWKeys.initTooltip(tooltipSettings)
|
||||||
|
AWKeys.setPopupEnabled(plasmoid.configuration.notify)
|
||||||
|
AWKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
|
||||||
|
|
||||||
|
needUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
function action_checkUpdates() {
|
||||||
|
if (debug) console.log("[main::action_checkUpdates]")
|
||||||
|
|
||||||
|
AWActions.checkUpdates()
|
||||||
|
}
|
||||||
|
|
||||||
|
function action_showReadme() {
|
||||||
|
if (debug) console.log("[main::action_showReadme]")
|
||||||
|
|
||||||
|
AWActions.showReadme()
|
||||||
|
}
|
||||||
|
|
||||||
|
function action_report() {
|
||||||
|
if (debug) console.log("[main::action_report]")
|
||||||
|
|
||||||
|
AWActions.sendEmail()
|
||||||
|
}
|
||||||
|
|
||||||
|
function action_requestKey() {
|
||||||
|
if (debug) console.log("[main::action_requestKey]")
|
||||||
|
|
||||||
|
AWKeys.graphicalValueByKey()
|
||||||
|
}
|
||||||
|
}
|
1
sources/awesome-widget/package/contents/ui/qmldir
Normal file
@ -0,0 +1 @@
|
|||||||
|
singleton general general.qml
|
513
sources/awesome-widget/package/contents/ui/tooltip.qml
Normal file
@ -0,0 +1,513 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: tooltipPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_tooltipNumber: tooltipNumber.value
|
||||||
|
property alias cfg_useTooltipBackground: useTooltipBackground.checked
|
||||||
|
property alias cfg_tooltipBackground: tooltipBackground.text
|
||||||
|
property alias cfg_cpuTooltip: cpuTooltip.checked
|
||||||
|
property alias cfg_cpuTooltipColor: cpuTooltipColor.text
|
||||||
|
property alias cfg_cpuclTooltip: cpuclTooltip.checked
|
||||||
|
property alias cfg_cpuclTooltipColor: cpuclTooltipColor.text
|
||||||
|
property alias cfg_memTooltip: memTooltip.checked
|
||||||
|
property alias cfg_memTooltipColor: memTooltipColor.text
|
||||||
|
property alias cfg_swapTooltip: swapTooltip.checked
|
||||||
|
property alias cfg_swapTooltipColor: swapTooltipColor.text
|
||||||
|
property alias cfg_downTooltip: downTooltip.checked
|
||||||
|
property alias cfg_downTooltipColor: downTooltipColor.text
|
||||||
|
property alias cfg_upTooltipColor: upTooltipColor.text
|
||||||
|
property alias cfg_batTooltip: batTooltip.checked
|
||||||
|
property alias cfg_batTooltipColor: batTooltipColor.text
|
||||||
|
property alias cfg_batInTooltipColor: batInTooltipColor.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
QtControls.Label {
|
||||||
|
width: parent.width
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: i18n("CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox fully checked.")
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Number of values for tooltips")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: tooltipNumber
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 50
|
||||||
|
maximumValue: 1000
|
||||||
|
stepSize: 25
|
||||||
|
value: plasmoid.configuration.tooltipNumber
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - useTooltipBackground.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Background")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: useTooltipBackground
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: tooltipBackground
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.tooltipBackground
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.tooltipBackground
|
||||||
|
onClicked: tooltipBackgroundDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: tooltipBackgroundDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: tooltipBackground.text
|
||||||
|
onAccepted: tooltipBackground.text = tooltipBackgroundDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - cpuTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("CPU color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: cpuTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: cpuTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.cpuTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.cpuTooltipColor
|
||||||
|
onClicked: cpuTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: cpuTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: cpuTooltipColor.text
|
||||||
|
onAccepted: cpuTooltipColor.text = cpuTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - cpuclTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("CPU clock color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: cpuclTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: cpuclTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.cpuclTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.cpuclTooltipColor
|
||||||
|
onClicked: cpuclTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: cpuclTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: cpuclTooltipColor.text
|
||||||
|
onAccepted: cpuclTooltipColor.text = cpuclTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - memTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Memory color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: memTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: memTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.memTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.memTooltipColor
|
||||||
|
onClicked: memTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: memTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: memTooltipColor.text
|
||||||
|
onAccepted: memTooltipColor.text = memTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - swapTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Swap color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: swapTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: swapTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.swapTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.swapTooltipColor
|
||||||
|
onClicked: swapTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: swapTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: swapTooltipColor.text
|
||||||
|
onAccepted: swapTooltipColor.text = swapTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - downTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Download speed color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: downTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: downTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.downTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.downTooltipColor
|
||||||
|
onClicked: downTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: downTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: downTooltipColor.text
|
||||||
|
onAccepted: downTooltipColor.text = downTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Upload speed color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: upTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.upTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.upTooltipColor
|
||||||
|
onClicked: upTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: upTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: upTooltipColor.text
|
||||||
|
onAccepted: upTooltipColor.text = upTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5 - batTooltip.width
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Battery active color")
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: batTooltip
|
||||||
|
height: parent.height
|
||||||
|
width: implicitWidth
|
||||||
|
style: QtStyles.CheckBoxStyle {
|
||||||
|
indicator: Rectangle {
|
||||||
|
implicitWidth: 16
|
||||||
|
implicitHeight: 16
|
||||||
|
radius: 3
|
||||||
|
border.width: 1
|
||||||
|
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||||
|
Rectangle {
|
||||||
|
visible: control.checked
|
||||||
|
radius: 1
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: 4
|
||||||
|
color: "#555555"
|
||||||
|
border.color: "#333333"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: batTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.batTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.batTooltipColor
|
||||||
|
onClicked: batTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: batTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: batTooltipColor.text
|
||||||
|
onAccepted: batTooltipColor.text = batTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Battery inactive color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: batInTooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.batInTooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.batInTooltipColor
|
||||||
|
onClicked: batInTooltipColorDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: batInTooltipColorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: batInTooltipColor.text
|
||||||
|
onAccepted: batInTooltipColor.text = batInTooltipColorDialog.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[tooltip::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
326
sources/awesome-widget/package/contents/ui/widget.qml
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
||||||
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: widgetPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant settings: {
|
||||||
|
"customTime": plasmoid.configuration.customTime,
|
||||||
|
"customUptime": plasmoid.configuration.customUptime,
|
||||||
|
"tempUnits": plasmoid.configuration.tempUnits,
|
||||||
|
"acOnline": plasmoid.configuration.acOnline,
|
||||||
|
"acOffline": plasmoid.configuration.acOffline
|
||||||
|
}
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||||
|
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||||
|
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||||
|
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||||
|
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||||
|
"memTooltip": plasmoid.configuration.memTooltip,
|
||||||
|
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||||
|
"downTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"upTooltip": plasmoid.configuration.downTooltip,
|
||||||
|
"batTooltip": plasmoid.configuration.batTooltip,
|
||||||
|
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||||
|
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||||
|
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||||
|
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||||
|
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||||
|
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||||
|
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||||
|
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||||
|
}
|
||||||
|
|
||||||
|
property alias cfg_text: textPattern.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
QtControls.Label {
|
||||||
|
width: parent.width
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
|
text: i18n("Font")
|
||||||
|
iconName: "font"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Font button")
|
||||||
|
|
||||||
|
var defaultFont = {
|
||||||
|
"color": plasmoid.configuration.fontColor,
|
||||||
|
"family": plasmoid.configuration.fontFamily,
|
||||||
|
"size": plasmoid.configuration.fontSize
|
||||||
|
}
|
||||||
|
var font = AWActions.getFont(defaultFont)
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<span style=\"color:" + font.color +
|
||||||
|
"; font-family:'" + font.family +
|
||||||
|
"'; font-size:" + font.size + "pt;\">" +
|
||||||
|
selected + "</span>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Indent button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, selected + "<br>\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Bold button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<b>" + selected + "</b>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Italic button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<i>" + selected + "</i>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Underline button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<u>" + selected + "</u>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Strike button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<s>" + selected + "</s>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Left button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Center button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Right button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Justify button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: tags
|
||||||
|
width: parent.width - addTagButton.width - showValueButton.width
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: addTagButton
|
||||||
|
text: i18n("Add")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Add tag button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, selected + "$" + tags.currentText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: showValueButton
|
||||||
|
text: i18n("Show value")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||||
|
|
||||||
|
var message = i18n("Tag: %1", tags.currentText)
|
||||||
|
message += "<br>"
|
||||||
|
message += i18n("Value: %1", AWKeys.valueByKey(tags.currentText))
|
||||||
|
message += "<br>"
|
||||||
|
message += i18n("Info: %1", AWKeys.infoByKey(tags.currentText))
|
||||||
|
AWActions.sendNotification("tag", message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width
|
||||||
|
text: i18n("Edit bars")
|
||||||
|
onClicked: AWKeys.editItem("graphicalitem")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.TextArea {
|
||||||
|
id: textPattern
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height * 4 / 5
|
||||||
|
textFormat: TextEdit.PlainText
|
||||||
|
text: plasmoid.configuration.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we need to initializate DataEngines here too
|
||||||
|
// because we need to get keys and values
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: systemmonitorDE
|
||||||
|
engine: "systemmonitor"
|
||||||
|
connectedSources: systemmonitorDE.sources
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: extsysmonDE
|
||||||
|
engine: "extsysmon"
|
||||||
|
connectedSources: extsysmonDE.sources
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.DataSource {
|
||||||
|
id: timeDE
|
||||||
|
engine: "time"
|
||||||
|
connectedSources: ["Local"]
|
||||||
|
interval: 5000
|
||||||
|
|
||||||
|
onNewData: {
|
||||||
|
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||||
|
|
||||||
|
AWKeys.setDataBySource(sourceName, data, settings)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
|
||||||
|
// init submodule
|
||||||
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
|
tags.model = AWKeys.dictKeys(true)
|
||||||
|
}
|
||||||
|
}
|
28
sources/awesome-widget/package/metadata.desktop
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Awesome Widget
|
||||||
|
Comment=A minimalistic Plasmoid
|
||||||
|
Comment[en]=A minimalistic Plasmoid
|
||||||
|
Comment[es]=Un plasmoide minimalista
|
||||||
|
Comment[es]=Un script Plasmoïde minimaliste
|
||||||
|
Comment[pt_BR]=Um script Plasmoid
|
||||||
|
Comment[ru]=Минималистичный плазмоид
|
||||||
|
Comment[uk]=Мінімалістичний плазмоїд
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
Type=Service
|
||||||
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
X-Plasma-API=declarativeappletscript
|
||||||
|
X-Plasma-MainScript=ui/main.qml
|
||||||
|
X-Plasma-RemoteLocation=
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
|
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||||
|
X-KDE-PluginInfo-Version=2.3.0
|
||||||
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
X-KDE-PluginInfo-Depends=
|
||||||
|
X-KDE-PluginInfo-License=GPLv3
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
38
sources/awesome-widget/plugin/CMakeLists.txt
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
set (PLUGIN_NAME awplugin)
|
||||||
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||||
|
|
||||||
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||||
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
|
||||||
|
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
|
||||||
|
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||||
|
${Notifications_INCLUDE_DIR})
|
||||||
|
set (Kf5_LIBRARIES KF5::I18n
|
||||||
|
KF5::Notifications)
|
||||||
|
|
||||||
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${PROJECT_TRDPARTY_DIR}
|
||||||
|
../../extsysmon
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../../extsysmon
|
||||||
|
${Qt_INCLUDE}
|
||||||
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
|
# task source is required by extscripts
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||||
|
../../extsysmon/extquotes.cpp
|
||||||
|
../../extsysmon/extscript.cpp
|
||||||
|
../../extsysmon/extupgrade.cpp)
|
||||||
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||||
|
|
||||||
|
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||||
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||||
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||||
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||||
|
install (DIRECTORY ${SUBPROJECT_DESKTOP} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
253
sources/awesome-widget/plugin/awactions.cpp
Normal file
@ -0,0 +1,253 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "awactions.h"
|
||||||
|
|
||||||
|
#include <KI18n/KLocalizedString>
|
||||||
|
#include <KNotifications/KNotification>
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
|
#include <fontdialog/fontdialog.h>
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "extscript.h"
|
||||||
|
#include "graphicalitem.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
AWActions::AWActions(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
// debug
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
debug = (debugEnv == QString("yes"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AWActions::~AWActions()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::checkUpdates()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||||
|
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(versionReplyRecieved(QNetworkReply *)));
|
||||||
|
|
||||||
|
manager->get(QNetworkRequest(QUrl(VERSION_API)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::runCmd(const QString cmd)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||||
|
|
||||||
|
QProcess command;
|
||||||
|
sendNotification(QString("Info"), i18n("Run %1", cmd));
|
||||||
|
|
||||||
|
command.startDetached(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::sendEmail()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::showReadme()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QDesktopServices::openUrl(QString(HOMEPAGE));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString AWActions::getAboutText(const QString type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
if (type == QString("header"))
|
||||||
|
text = QString(NAME);
|
||||||
|
else if (type == QString("version"))
|
||||||
|
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE));
|
||||||
|
else if (type == QString("description"))
|
||||||
|
text = i18n("A set of minimalistic plasmoid widgets");
|
||||||
|
else if (type == QString("links"))
|
||||||
|
text = i18n("Links:") + QString("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
|
||||||
|
else if (type == QString("copy"))
|
||||||
|
text = QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||||
|
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>");
|
||||||
|
else if (type == QString("translators"))
|
||||||
|
text = i18n("Translators: %1", QString(TRANSLATORS));
|
||||||
|
else if (type == QString("3rdparty")) {
|
||||||
|
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]);
|
||||||
|
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantMap AWActions::getFont(const QVariantMap defaultFont)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QVariantMap fontMap;
|
||||||
|
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||||
|
defaultFont[QString("size")].toInt(),
|
||||||
|
400, false, defaultFont[QString("color")].toString());
|
||||||
|
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont,
|
||||||
|
false, false);
|
||||||
|
fontMap[QString("color")] = font.color().name();
|
||||||
|
fontMap[QString("family")] = font.family();
|
||||||
|
fontMap[QString("size")] = font.pointSize();
|
||||||
|
|
||||||
|
return fontMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantMap AWActions::readDataEngineConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
|
QVariantMap configuration;
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Configuration"));
|
||||||
|
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||||
|
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
||||||
|
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
||||||
|
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a"));
|
||||||
|
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
||||||
|
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
||||||
|
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
||||||
|
configuration[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris"));
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
return configuration;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/plasma-dataengine-extsysmon.conf");
|
||||||
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Configuration"));
|
||||||
|
settings.setValue(QString("ACPIPATH"), configuration[QString("ACPIPATH")]);
|
||||||
|
settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]);
|
||||||
|
settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]);
|
||||||
|
settings.setValue(QString("HDDTEMPCMD"), configuration[QString("HDDTEMPCMD")]);
|
||||||
|
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]);
|
||||||
|
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
|
||||||
|
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
|
||||||
|
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup)
|
||||||
|
{
|
||||||
|
if ((eventId == QString("event")) && (!enablePopup)) return;
|
||||||
|
|
||||||
|
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: %1").arg(eventId), message);
|
||||||
|
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::showUpdates(QString version)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
text += i18n("Current version : %1", QString(VERSION)) + QString("\n");
|
||||||
|
text += i18n("New version : %1", version) + QString("\n\n");
|
||||||
|
text += i18n("Click \"Ok\" to download");
|
||||||
|
|
||||||
|
int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel);
|
||||||
|
switch (select) {
|
||||||
|
case QMessageBox::Ok:
|
||||||
|
QDesktopServices::openUrl(QString(RELEASES) + version);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWActions::versionReplyRecieved(QNetworkReply *reply)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString answer = reply->readAll();
|
||||||
|
if (!answer.contains(QString("tag_name"))) return;
|
||||||
|
QString version = QString(VERSION);
|
||||||
|
if (debug) qDebug() << PDEBUG << answer;
|
||||||
|
for (int i=0; i<answer.split(QString("tag_name")).count(); i++) {
|
||||||
|
version = answer.split(QString("tag_name"))[1].split(QChar(','))[0];
|
||||||
|
version.remove(QChar('"'));
|
||||||
|
version.remove(QChar(':'));
|
||||||
|
version.remove(QString("V."));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int old_major = QString(VERSION).split(QChar('.'))[0].toInt();
|
||||||
|
int old_minor = QString(VERSION).split(QChar('.'))[1].toInt();
|
||||||
|
int old_patch = QString(VERSION).split(QChar('.'))[2].toInt();
|
||||||
|
int new_major = QString(version).split(QChar('.'))[0].toInt();
|
||||||
|
int new_minor = QString(version).split(QChar('.'))[1].toInt();
|
||||||
|
int new_patch = QString(version).split(QChar('.'))[2].toInt();
|
||||||
|
if ((old_major < new_major) ||
|
||||||
|
((old_major == new_major) && (old_minor < new_minor)) ||
|
||||||
|
((old_major == new_major) && (old_minor == new_minor) && (old_patch < new_patch)))
|
||||||
|
showUpdates(version);
|
||||||
|
}
|
62
sources/awesome-widget/plugin/awactions.h
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef AWACTIONS_H
|
||||||
|
#define AWACTIONS_H
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class QNetworkReply;
|
||||||
|
|
||||||
|
class AWActions : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AWActions(QObject *parent = nullptr);
|
||||||
|
~AWActions();
|
||||||
|
|
||||||
|
Q_INVOKABLE void checkUpdates();
|
||||||
|
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
|
||||||
|
Q_INVOKABLE void sendEmail();
|
||||||
|
Q_INVOKABLE void showReadme();
|
||||||
|
// configuration slots
|
||||||
|
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
||||||
|
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||||
|
// dataengine
|
||||||
|
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||||
|
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
||||||
|
const bool enablePopup = false);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void showUpdates(QString version);
|
||||||
|
void versionReplyRecieved(QNetworkReply *reply);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// variables
|
||||||
|
bool debug = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* AWACTIONS_H */
|
50
sources/awesome-widget/plugin/awesomewidget.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "awesomewidget.h"
|
||||||
|
|
||||||
|
#include <QtQml>
|
||||||
|
|
||||||
|
#include "awactions.h"
|
||||||
|
#include "awkeys.h"
|
||||||
|
|
||||||
|
|
||||||
|
static QObject *awactions_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
|
{
|
||||||
|
Q_UNUSED(engine);
|
||||||
|
Q_UNUSED(scriptEngine);
|
||||||
|
|
||||||
|
return new AWActions();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
|
{
|
||||||
|
Q_UNUSED(engine);
|
||||||
|
Q_UNUSED(scriptEngine);
|
||||||
|
|
||||||
|
return new AWKeys();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWPlugin::registerTypes(const char *uri)
|
||||||
|
{
|
||||||
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.awesomewidget"));
|
||||||
|
|
||||||
|
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||||
|
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
||||||
|
}
|
35
sources/awesome-widget/plugin/awesomewidget.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef AWPLUGIN_H
|
||||||
|
#define AWPLUGIN_H
|
||||||
|
|
||||||
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
|
||||||
|
class AWPlugin : public QQmlExtensionPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||||
|
|
||||||
|
public:
|
||||||
|
void registerTypes(const char *uri);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* AWPLUGIN_H */
|
1509
sources/awesome-widget/plugin/awkeys.cpp
Normal file
126
sources/awesome-widget/plugin/awkeys.h
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef AWKEYS_H
|
||||||
|
#define AWKEYS_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class AWToolTip;
|
||||||
|
class ExtQuotes;
|
||||||
|
class ExtScript;
|
||||||
|
class ExtUpgrade;
|
||||||
|
class GraphicalItem;
|
||||||
|
|
||||||
|
class AWKeys : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
enum RequestedItem {
|
||||||
|
Nothing,
|
||||||
|
RequestedGraphicalItem,
|
||||||
|
RequestedExtQuotes,
|
||||||
|
RequestedExtScript,
|
||||||
|
RequestedExtUpgrade
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
AWKeys(QObject *parent = nullptr);
|
||||||
|
~AWKeys();
|
||||||
|
|
||||||
|
Q_INVOKABLE void initKeys(const QString currentPattern);
|
||||||
|
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
|
||||||
|
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
|
||||||
|
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
|
||||||
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
|
Q_INVOKABLE QString parsePattern();
|
||||||
|
Q_INVOKABLE QString toolTipImage();
|
||||||
|
Q_INVOKABLE QSize toolTipSize();
|
||||||
|
// keys
|
||||||
|
Q_INVOKABLE void addDevice(const QString source);
|
||||||
|
Q_INVOKABLE QStringList dictKeys(const bool sorted = false);
|
||||||
|
Q_INVOKABLE QStringList getHddDevices();
|
||||||
|
Q_INVOKABLE bool setDataBySource(const QString sourceName, const QVariantMap data,
|
||||||
|
const QVariantMap params);
|
||||||
|
// values
|
||||||
|
Q_INVOKABLE void graphicalValueByKey();
|
||||||
|
Q_INVOKABLE QString infoByKey(QString key);
|
||||||
|
Q_INVOKABLE QString valueByKey(QString key);
|
||||||
|
// configuration
|
||||||
|
Q_INVOKABLE void editItem(const QString type);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void loadKeysFromCache();
|
||||||
|
void reinitKeys();
|
||||||
|
// editor
|
||||||
|
void editItemButtonPressed(QAbstractButton *button);
|
||||||
|
void copyBar(const QString original);
|
||||||
|
void copyQuotes(const QString original);
|
||||||
|
void copyScript(const QString original);
|
||||||
|
void copyUpgrade(const QString original);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// methods
|
||||||
|
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||||
|
bool checkKeys(const QVariantMap data);
|
||||||
|
QString htmlValue(QString key);
|
||||||
|
int numberCpus();
|
||||||
|
float temperature(const float temp, const QString units);
|
||||||
|
// find methods
|
||||||
|
QStringList findGraphicalItems();
|
||||||
|
QStringList findKeys();
|
||||||
|
// get methods
|
||||||
|
QList<ExtQuotes *> getExtQuotes();
|
||||||
|
QList<ExtScript *> getExtScripts();
|
||||||
|
QList<ExtUpgrade *> getExtUpgrade();
|
||||||
|
QList<GraphicalItem *> getGraphicalItems();
|
||||||
|
GraphicalItem *getItemByTag(const QString tag);
|
||||||
|
QStringList getTimeKeys();
|
||||||
|
AWToolTip *toolTip = nullptr;
|
||||||
|
// graphical elements
|
||||||
|
QDialog *dialog = nullptr;
|
||||||
|
QListWidget *widgetDialog = nullptr;
|
||||||
|
QDialogButtonBox *dialogButtons = nullptr;
|
||||||
|
QPushButton *copyButton = nullptr;
|
||||||
|
QPushButton *createButton = nullptr;
|
||||||
|
QPushButton *deleteButton = nullptr;
|
||||||
|
RequestedItem requestedItem = Nothing;
|
||||||
|
// variables
|
||||||
|
bool debug = false;
|
||||||
|
bool enablePopup = false;
|
||||||
|
bool wrapNewLines = false;
|
||||||
|
QList<GraphicalItem *> graphicalItems;
|
||||||
|
QList<ExtQuotes *> extQuotes;
|
||||||
|
QList<ExtScript *> extScripts;
|
||||||
|
QList<ExtUpgrade *> extUpgrade;
|
||||||
|
QStringList foundBars, foundKeys, keys;
|
||||||
|
QString pattern;
|
||||||
|
QMap<QString, QString> values;
|
||||||
|
QStringList diskDevices, hddDevices, mountDevices, networkDevices, tempDevices;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* AWKEYS_H */
|
154
sources/awesome-widget/plugin/awtooltip.cpp
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "awtooltip.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
|
AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
|
||||||
|
: QObject(parent),
|
||||||
|
configuration(settings)
|
||||||
|
{
|
||||||
|
// debug
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
debug = (debugEnv == QString("yes"));
|
||||||
|
|
||||||
|
toolTipScene = new QGraphicsScene();
|
||||||
|
toolTipView = new QGraphicsView(toolTipScene);
|
||||||
|
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||||
|
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||||
|
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||||
|
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
|
||||||
|
counts += configuration[QString("cpuTooltip")].toInt();
|
||||||
|
counts += configuration[QString("cpuclTooltip")].toInt();
|
||||||
|
counts += configuration[QString("memTooltip")].toInt();
|
||||||
|
counts += configuration[QString("swapTooltip")].toInt();
|
||||||
|
counts += configuration[QString("downTooltip")].toInt();
|
||||||
|
counts += configuration[QString("batTooltip")].toInt();
|
||||||
|
|
||||||
|
boundaries[QString("cpuTooltip")] = 100.0;
|
||||||
|
boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||||
|
boundaries[QString("memTooltip")] = 100.0;
|
||||||
|
boundaries[QString("swapTooltip")] = 100.0;
|
||||||
|
boundaries[QString("downTooltip")] = 1.0;
|
||||||
|
boundaries[QString("upTooltip")] = 1.0;
|
||||||
|
boundaries[QString("batTooltip")] = 100.0;
|
||||||
|
size.setHeight(105.0);
|
||||||
|
size.setWidth(100.0 * counts);
|
||||||
|
|
||||||
|
if (configuration[QString("cpuTooltip")].toBool()) requiredKeys.append(QString("cpuTooltip"));
|
||||||
|
if (configuration[QString("cpuclTooltip")].toBool()) requiredKeys.append(QString("cpuclTooltip"));
|
||||||
|
if (configuration[QString("memTooltip")].toBool()) requiredKeys.append(QString("memTooltip"));
|
||||||
|
if (configuration[QString("swapTooltip")].toBool()) requiredKeys.append(QString("swapTooltip"));
|
||||||
|
if (configuration[QString("downTooltip")].toBool()) requiredKeys.append(QString("downTooltip"));
|
||||||
|
if (configuration[QString("upTooltip")].toBool()) requiredKeys.append(QString("upTooltip"));
|
||||||
|
if (configuration[QString("batTooltip")].toBool()) requiredKeys.append(QString("batTooltip"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
AWToolTip::~AWToolTip()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete toolTipView;
|
||||||
|
delete toolTipScene;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QSize AWToolTip::getSize()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QPixmap AWToolTip::image()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
toolTipView->resize(size);
|
||||||
|
// create image
|
||||||
|
toolTipScene->clear();
|
||||||
|
QPen pen = QPen();
|
||||||
|
// background
|
||||||
|
if (configuration[QString("useTooltipBackground")].toBool())
|
||||||
|
toolTipScene->setBackgroundBrush(QBrush(QColor(configuration[QString("tooltipBackground")].toString())));
|
||||||
|
else
|
||||||
|
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||||
|
bool down = false;
|
||||||
|
for (int i=0; i<requiredKeys.count(); i++) {
|
||||||
|
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||||
|
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||||
|
if (requiredKeys[i] != QString("batTooltip"))
|
||||||
|
pen.setColor(QColor(configuration[QString("%1Color").arg(requiredKeys[i])].toString()));
|
||||||
|
float shift = i * 100.0;
|
||||||
|
if (down) shift -= 100.0;
|
||||||
|
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
||||||
|
float x1 = j * normX + shift;
|
||||||
|
float y1 = - fabs(data[requiredKeys[i]][j]) * normY + 5.0;
|
||||||
|
float x2 = (j + 1) * normX + shift;
|
||||||
|
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
|
||||||
|
if (requiredKeys[i] == QString("batTooltip")) {
|
||||||
|
if (data[requiredKeys[i]][j+1] > 0)
|
||||||
|
pen.setColor(QColor(configuration[QString("batTooltipColor")].toString()));
|
||||||
|
else
|
||||||
|
pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString()));
|
||||||
|
}
|
||||||
|
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||||
|
}
|
||||||
|
if (requiredKeys[i] == QString("downTooltip")) down = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return toolTipView->grab();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AWToolTip::setData(const QString source, float value, const bool ac)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (data[source].count() == 0)
|
||||||
|
data[source].append(0.0);
|
||||||
|
else if (data[source].count() > configuration[QString("tooltipNumber")].toInt())
|
||||||
|
data[source].takeFirst();
|
||||||
|
if (isnan(value)) value = 0.0;
|
||||||
|
|
||||||
|
if (ac)
|
||||||
|
data[source].append(value);
|
||||||
|
else
|
||||||
|
data[source].append(-value);
|
||||||
|
|
||||||
|
if ((source == QString("downTooltip")) || (source == QString("upTooltip"))) {
|
||||||
|
for (int i=0; i<data[QString("downTooltip")].count(); i++)
|
||||||
|
if (boundaries[QString("downTooltip")] < data[QString("downTooltip")][i])
|
||||||
|
boundaries[QString("downTooltip")] = data[QString("downTooltip")][i];
|
||||||
|
for (int i=0; i<data[QString("upTooltip")].count(); i++)
|
||||||
|
if (boundaries[QString("downTooltip")] < data[QString("upTooltip")][i])
|
||||||
|
boundaries[QString("downTooltip")] = data[QString("upTooltip")][i];
|
||||||
|
boundaries[QString("downTooltip")] *= 1.2;
|
||||||
|
boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")];
|
||||||
|
}
|
||||||
|
}
|
58
sources/awesome-widget/plugin/awtooltip.h
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef AWTOOLTIP_H
|
||||||
|
#define AWTOOLTIP_H
|
||||||
|
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class AWToolTip : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
|
||||||
|
~AWToolTip();
|
||||||
|
|
||||||
|
QSize getSize();
|
||||||
|
QPixmap image();
|
||||||
|
void setData(const QString source, float value,
|
||||||
|
const bool ac = true);
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ui
|
||||||
|
QGraphicsScene *toolTipScene = nullptr;
|
||||||
|
QGraphicsView *toolTipView = nullptr;
|
||||||
|
// variables
|
||||||
|
bool debug = false;
|
||||||
|
int counts = 0;
|
||||||
|
QVariantMap configuration;
|
||||||
|
QMap<QString, float> boundaries;
|
||||||
|
QMap<QString, QList<float>> data;
|
||||||
|
QStringList requiredKeys;
|
||||||
|
QSize size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* AWTOOLTIP_H */
|
12
sources/awesome-widget/plugin/desktops/aw-bat-bar.desktop
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=bar3
|
||||||
|
Comment=Simple bat bar
|
||||||
|
X-AW-Value=bat
|
||||||
|
X-AW-ActiveColor="0,0,0,255"
|
||||||
|
X-AW-InactiveColor="255,255,255,255"
|
||||||
|
X-AW-Type=Horizontal
|
||||||
|
X-AW-Direction=LeftToRight
|
||||||
|
X-AW-Height=25
|
||||||
|
X-AW-Width=100
|
||||||
|
X-AW-ApiVersion=1
|
12
sources/awesome-widget/plugin/desktops/aw-cpu-bar.desktop
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=bar0
|
||||||
|
Comment=Simple cpu bar
|
||||||
|
X-AW-Value=cpu
|
||||||
|
X-AW-ActiveColor="0,0,0,255"
|
||||||
|
X-AW-InactiveColor="255,255,255,255"
|
||||||
|
X-AW-Type=Horizontal
|
||||||
|
X-AW-Direction=LeftToRight
|
||||||
|
X-AW-Height=25
|
||||||
|
X-AW-Width=100
|
||||||
|
X-AW-ApiVersion=1
|
12
sources/awesome-widget/plugin/desktops/aw-mem-bar.desktop
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=bar1
|
||||||
|
Comment=Simple mem bar
|
||||||
|
X-AW-Value=mem
|
||||||
|
X-AW-ActiveColor="0,0,0,255"
|
||||||
|
X-AW-InactiveColor="255,255,255,255"
|
||||||
|
X-AW-Type=Horizontal
|
||||||
|
X-AW-Direction=LeftToRight
|
||||||
|
X-AW-Height=25
|
||||||
|
X-AW-Width=100
|
||||||
|
X-AW-ApiVersion=1
|
12
sources/awesome-widget/plugin/desktops/aw-swap-bar.desktop
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=bar2
|
||||||
|
Comment=Simple swap bar
|
||||||
|
X-AW-Value=swap
|
||||||
|
X-AW-ActiveColor="0,0,0,255"
|
||||||
|
X-AW-InactiveColor="255,255,255,255"
|
||||||
|
X-AW-Type=Horizontal
|
||||||
|
X-AW-Direction=LeftToRight
|
||||||
|
X-AW-Height=25
|
||||||
|
X-AW-Width=100
|
||||||
|
X-AW-ApiVersion=1
|
525
sources/awesome-widget/plugin/graphicalitem.cpp
Normal file
@ -0,0 +1,525 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "graphicalitem.h"
|
||||||
|
#include "ui_graphicalitem.h"
|
||||||
|
|
||||||
|
#include <KI18n/KLocalizedString>
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QColorDialog>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QGraphicsEllipseItem>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||||
|
: QDialog(parent),
|
||||||
|
m_fileName(desktopName),
|
||||||
|
m_dirs(directories),
|
||||||
|
debug(debugCmd),
|
||||||
|
ui(new Ui::GraphicalItem)
|
||||||
|
{
|
||||||
|
readConfiguration();
|
||||||
|
|
||||||
|
ui->setupUi(this);
|
||||||
|
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||||
|
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GraphicalItem::~GraphicalItem()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::image(const float value)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||||
|
if (m_bar == QString("none")) return QString("");
|
||||||
|
|
||||||
|
QColor active = stringToColor(m_activeColor);
|
||||||
|
QColor inactive = stringToColor(m_inactiveColor);
|
||||||
|
float percent = value / 100.0;
|
||||||
|
int scale[2] = {1, 1};
|
||||||
|
QPen pen = QPen();
|
||||||
|
QGraphicsScene *scene = new QGraphicsScene();
|
||||||
|
scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||||
|
QGraphicsView *view = new QGraphicsView(scene);
|
||||||
|
view->setStyleSheet(QString("background: transparent"));
|
||||||
|
view->setContentsMargins(0, 0, 0, 0);
|
||||||
|
view->setFrameShape(QFrame::NoFrame);
|
||||||
|
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
view->resize(m_width + 5.0, m_height + 5.0);
|
||||||
|
|
||||||
|
// paint
|
||||||
|
switch (m_type) {
|
||||||
|
case Vertical:
|
||||||
|
pen.setWidth(m_width);
|
||||||
|
// inactive
|
||||||
|
pen.setColor(inactive);
|
||||||
|
scene->addLine(0.5 * m_width, -0.5 * m_width, 0.5 * m_width,
|
||||||
|
(1.0 - percent) * m_height - 0.5 * m_width, pen);
|
||||||
|
// active
|
||||||
|
pen.setColor(active);
|
||||||
|
scene->addLine(0.5 * m_width, (1.0 - percent) * m_height + 0.5 * m_width,
|
||||||
|
0.5 * m_width, m_height + 0.5 * m_width, pen);
|
||||||
|
// scale
|
||||||
|
scale[1] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
|
break;
|
||||||
|
case Circle:
|
||||||
|
QGraphicsEllipseItem *circle;
|
||||||
|
pen.setWidth(1.0);
|
||||||
|
// inactive
|
||||||
|
pen.setColor(inactive);
|
||||||
|
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||||
|
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
||||||
|
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
||||||
|
// active
|
||||||
|
pen.setColor(active);
|
||||||
|
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(active, Qt::SolidPattern));
|
||||||
|
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
||||||
|
circle->setStartAngle(90.0 * 16.0);
|
||||||
|
// scale
|
||||||
|
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pen.setWidth(m_height);
|
||||||
|
// inactive
|
||||||
|
pen.setColor(inactive);
|
||||||
|
scene->addLine(percent * m_width + 0.5 * m_height, 0.5 * m_height,
|
||||||
|
m_width + 0.5 * m_height, 0.5 * m_height, pen);
|
||||||
|
// active
|
||||||
|
pen.setColor(active);
|
||||||
|
scene->addLine(-0.5 * m_height, 0.5 * m_height,
|
||||||
|
percent * m_width - 0.5 * m_height, 0.5 * m_height, pen);
|
||||||
|
// scale
|
||||||
|
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert
|
||||||
|
QPixmap pixmap = view->grab().transformed(QTransform().scale(scale[0], scale[1]));
|
||||||
|
QByteArray byteArray;
|
||||||
|
QBuffer buffer(&byteArray);
|
||||||
|
pixmap.save(&buffer, "PNG");
|
||||||
|
QString url = QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
||||||
|
delete view;
|
||||||
|
delete scene;
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::fileName()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GraphicalItem::apiVersion()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::name()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::comment()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::bar()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::activeColor()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_activeColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::inactiveColor()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_inactiveColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GraphicalItem::Type GraphicalItem::type()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::strType()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString value;
|
||||||
|
switch (m_type) {
|
||||||
|
case Vertical:
|
||||||
|
value = QString("Vertical");
|
||||||
|
break;
|
||||||
|
case Circle:
|
||||||
|
value = QString("Circle");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = QString("Horizontal");
|
||||||
|
break;
|
||||||
|
}\
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
GraphicalItem::Direction GraphicalItem::direction()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString GraphicalItem::strDirection()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString value;
|
||||||
|
switch (m_direction) {
|
||||||
|
case RightToLeft:
|
||||||
|
value = QString("RightToLeft");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = QString("LeftToRight");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GraphicalItem::height()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GraphicalItem::width()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setApiVersion(const int _apiVersion)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||||
|
|
||||||
|
m_apiVersion = _apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setName(const QString _name)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||||
|
|
||||||
|
m_name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setComment(const QString _comment)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||||
|
|
||||||
|
m_comment = _comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setBar(const QString _bar)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Bar" << _bar;
|
||||||
|
|
||||||
|
if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
|
||||||
|
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
||||||
|
(!_bar.contains(QRegExp(QString("mem")))) &&
|
||||||
|
(!_bar.contains(QRegExp(QString("swap")))) &&
|
||||||
|
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
||||||
|
(!_bar.contains(QRegExp(QString("bat.*")))))
|
||||||
|
m_bar = QString("none");
|
||||||
|
else
|
||||||
|
m_bar = _bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setActiveColor(const QString _color)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
|
m_activeColor = _color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setInactiveColor(const QString _color)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
|
m_inactiveColor = _color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setType(const Type _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||||
|
|
||||||
|
m_type = _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setStrType(const QString _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||||
|
|
||||||
|
if (_type == QString("Vertical"))
|
||||||
|
setType(Vertical);
|
||||||
|
else if (_type == QString("Circle"))
|
||||||
|
setType(Circle);
|
||||||
|
else
|
||||||
|
setType(Horizontal);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setDirection(const Direction _direction)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||||
|
|
||||||
|
m_direction = _direction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setStrDirection(const QString _direction)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||||
|
|
||||||
|
if (_direction == QString("RightToLeft"))
|
||||||
|
setDirection(RightToLeft);
|
||||||
|
else
|
||||||
|
setDirection(LeftToRight);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setHeight(const int _height)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Height" << _height;
|
||||||
|
if (_height <= 0) return;
|
||||||
|
|
||||||
|
m_height = _height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::setWidth(const int _width)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Width" << _width;
|
||||||
|
if (_width <= 0) return;
|
||||||
|
|
||||||
|
m_width = _width;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::readConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
|
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||||
|
setApiVersion(settings.value(QString("X-AW-ApiVersion"), AWGIAPI).toInt());
|
||||||
|
setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
|
||||||
|
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString());
|
||||||
|
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString());
|
||||||
|
setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
|
||||||
|
setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString());
|
||||||
|
setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
|
||||||
|
setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int GraphicalItem::showConfiguration(const QStringList tags)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
ui->label_nameValue->setText(m_name);
|
||||||
|
ui->lineEdit_comment->setText(m_comment);
|
||||||
|
ui->comboBox_value->addItems(tags);
|
||||||
|
ui->comboBox_value->addItem(m_bar);
|
||||||
|
ui->comboBox_value->setCurrentIndex(ui->comboBox_value->count() - 1);
|
||||||
|
ui->pushButton_activeColor->setText(m_activeColor);
|
||||||
|
ui->pushButton_inactiveColor->setText(m_inactiveColor);
|
||||||
|
ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
|
||||||
|
ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
|
||||||
|
ui->spinBox_height->setValue(m_height);
|
||||||
|
ui->spinBox_width->setValue(m_width);
|
||||||
|
|
||||||
|
int ret = exec();
|
||||||
|
if (ret != 1) return ret;
|
||||||
|
|
||||||
|
setName(ui->label_nameValue->text());
|
||||||
|
setComment(ui->lineEdit_comment->text());
|
||||||
|
setApiVersion(AWGIAPI);
|
||||||
|
setBar(ui->comboBox_value->currentText());
|
||||||
|
setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
|
||||||
|
setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
|
||||||
|
setStrType(ui->comboBox_type->currentText());
|
||||||
|
setStrDirection(ui->comboBox_direction->currentText());
|
||||||
|
setHeight(ui->spinBox_height->value());
|
||||||
|
setWidth(ui->spinBox_width->value());
|
||||||
|
|
||||||
|
writeConfiguration();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool GraphicalItem::tryDelete()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||||
|
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||||
|
|
||||||
|
// check if exists
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::writeConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||||
|
settings.setValue(QString("Name"), m_name);
|
||||||
|
settings.setValue(QString("Comment"), m_comment);
|
||||||
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
|
settings.setValue(QString("X-AW-Value"), m_bar);
|
||||||
|
settings.setValue(QString("X-AW-ActiveColor"), m_activeColor);
|
||||||
|
settings.setValue(QString("X-AW-InactiveColor"), m_inactiveColor);
|
||||||
|
settings.setValue(QString("X-AW-Type"), strType());
|
||||||
|
settings.setValue(QString("X-AW-Direction"), strDirection());
|
||||||
|
settings.setValue(QString("X-AW-Height"), m_height);
|
||||||
|
settings.setValue(QString("X-AW-Width"), m_width);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GraphicalItem::changeColor()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QColor color = stringToColor((dynamic_cast<QPushButton *>(sender()))->text());
|
||||||
|
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||||
|
QColorDialog::ShowAlphaChannel);
|
||||||
|
if (!newColor.isValid()) return;
|
||||||
|
|
||||||
|
QStringList colorText;
|
||||||
|
colorText.append(QString("%1").arg(newColor.red()));
|
||||||
|
colorText.append(QString("%1").arg(newColor.green()));
|
||||||
|
colorText.append(QString("%1").arg(newColor.blue()));
|
||||||
|
colorText.append(QString("%1").arg(newColor.alpha()));
|
||||||
|
dynamic_cast<QPushButton *>(sender())->setText(colorText.join(QChar(',')));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QColor GraphicalItem::stringToColor(const QString _color)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||||
|
|
||||||
|
QColor qcolor;
|
||||||
|
QStringList listColor = _color.split(QChar(','));
|
||||||
|
while (listColor.count() < 4)
|
||||||
|
listColor.append(QString("0"));
|
||||||
|
qcolor.setRed(listColor[0].toInt());
|
||||||
|
qcolor.setGreen(listColor[1].toInt());
|
||||||
|
qcolor.setBlue(listColor[2].toInt());
|
||||||
|
qcolor.setAlpha(listColor[3].toInt());
|
||||||
|
|
||||||
|
return qcolor;
|
||||||
|
}
|
115
sources/awesome-widget/plugin/graphicalitem.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef GRAPHICALITEM_H
|
||||||
|
#define GRAPHICALITEM_H
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class GraphicalItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
class GraphicalItem : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
|
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||||
|
Q_PROPERTY(QString bar READ bar WRITE setBar)
|
||||||
|
Q_PROPERTY(QString activeColor READ activeColor WRITE setActiveColor)
|
||||||
|
Q_PROPERTY(QString inactiveColor READ inactiveColor WRITE setInactiveColor)
|
||||||
|
Q_PROPERTY(Type type READ type WRITE setType)
|
||||||
|
Q_PROPERTY(Direction direction READ direction WRITE setDirection)
|
||||||
|
Q_PROPERTY(int height READ height WRITE setHeight)
|
||||||
|
Q_PROPERTY(int width READ width WRITE setWidth)
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum Direction {
|
||||||
|
LeftToRight = 0,
|
||||||
|
RightToLeft
|
||||||
|
};
|
||||||
|
enum Type {
|
||||||
|
Horizontal = 0,
|
||||||
|
Vertical,
|
||||||
|
Circle
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(),
|
||||||
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
|
~GraphicalItem();
|
||||||
|
QString fileName();
|
||||||
|
QString image(const float value);
|
||||||
|
// get methods
|
||||||
|
int apiVersion();
|
||||||
|
QString name();
|
||||||
|
QString comment();
|
||||||
|
QString bar();
|
||||||
|
QString activeColor();
|
||||||
|
QString inactiveColor();
|
||||||
|
Type type();
|
||||||
|
QString strType();
|
||||||
|
Direction direction();
|
||||||
|
QString strDirection();
|
||||||
|
int height();
|
||||||
|
int width();
|
||||||
|
// set methods
|
||||||
|
void setApiVersion(const int _apiVersion = 0);
|
||||||
|
void setName(const QString _name = QString("none"));
|
||||||
|
void setComment(const QString _comment = QString("empty"));
|
||||||
|
void setBar(const QString _bar = QString("cpu"));
|
||||||
|
void setActiveColor(const QString _color = QString("0,0,0,130"));
|
||||||
|
void setInactiveColor(const QString _color = QString("255,255,255,130"));
|
||||||
|
void setType(const Type _type = Horizontal);
|
||||||
|
void setStrType(const QString _type = QString("Horizontal"));
|
||||||
|
void setDirection(const Direction _direction = LeftToRight);
|
||||||
|
void setStrDirection(const QString _direction = QString("LeftToRight"));
|
||||||
|
void setHeight(const int _height = 100);
|
||||||
|
void setWidth(const int _width = 100);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void readConfiguration();
|
||||||
|
int showConfiguration(const QStringList tags = QStringList());
|
||||||
|
bool tryDelete();
|
||||||
|
void writeConfiguration();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void changeColor();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QColor stringToColor(const QString _color);
|
||||||
|
QString m_fileName;
|
||||||
|
QStringList m_dirs;
|
||||||
|
bool debug;
|
||||||
|
Ui::GraphicalItem *ui;
|
||||||
|
// properties
|
||||||
|
int m_apiVersion = 0;
|
||||||
|
QString m_name = QString("none");
|
||||||
|
QString m_comment = QString("empty");
|
||||||
|
QString m_bar = QString("cpu");
|
||||||
|
QString m_activeColor = QString("0,0,0,130");
|
||||||
|
QString m_inactiveColor = QString("255,255,255,130");
|
||||||
|
Type m_type = Horizontal;
|
||||||
|
Direction m_direction = LeftToRight;
|
||||||
|
int m_height = 100;
|
||||||
|
int m_width = 100;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* GRAPHICALITEM_H */
|
293
sources/awesome-widget/plugin/graphicalitem.ui
Normal file
@ -0,0 +1,293 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>GraphicalItem</class>
|
||||||
|
<widget class="QDialog" name="GraphicalItem">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>416</width>
|
||||||
|
<height>325</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_name">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_name">
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_nameValue">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_comment">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_comment">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Comment</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_comment"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_value">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_value">
|
||||||
|
<property name="text">
|
||||||
|
<string>Value</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_value">
|
||||||
|
<property name="editable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_activeColor">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_activeColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>Active color</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_activeColor">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_inactiveColor">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_inactiveColor">
|
||||||
|
<property name="text">
|
||||||
|
<string>Inactive color</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_inactiveColor">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_type">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_type">
|
||||||
|
<property name="text">
|
||||||
|
<string>Type</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_type">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Horizontal</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Vertical</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">Circle</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_direction">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_direction">
|
||||||
|
<property name="text">
|
||||||
|
<string>Direction</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="comboBox_direction">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">LeftToRight</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">RightToLeft</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_height">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_height">
|
||||||
|
<property name="text">
|
||||||
|
<string>Height</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_height">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>2000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>25</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_width">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_width">
|
||||||
|
<property name="text">
|
||||||
|
<string>Width</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_width">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>2000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>25</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>GraphicalItem</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>GraphicalItem</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
@ -0,0 +1,24 @@
|
|||||||
|
[Global]
|
||||||
|
IconName=system
|
||||||
|
Name=Awesome Widget
|
||||||
|
Comment=Awesome widget notifications
|
||||||
|
|
||||||
|
[info]
|
||||||
|
Name=Information
|
||||||
|
Comment=Information
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/event]
|
||||||
|
Name=Event
|
||||||
|
Comment=Some event occurs
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/system]
|
||||||
|
Name=System information
|
||||||
|
Comment=System information
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/tag]
|
||||||
|
Name=Tag information
|
||||||
|
Comment=Tag information
|
||||||
|
Action=Popup
|
3
sources/awesome-widget/plugin/qmldir
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module org.kde.plasma.awesomewidget
|
||||||
|
|
||||||
|
plugin awplugin
|
3
sources/awesomewidgets.kdev4
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[Project]
|
||||||
|
Manager=KDevCMakeManager
|
||||||
|
Name=awesome-widgets
|
19
sources/desktop-panel/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# set project name
|
||||||
|
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||||
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||||
|
|
||||||
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
||||||
|
find_package (Qt5 REQUIRED COMPONENTS Core Qml)
|
||||||
|
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem)
|
||||||
|
|
||||||
|
include (KDEInstallDirs)
|
||||||
|
include (KDECMakeSettings)
|
||||||
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
|
add_subdirectory (plugin)
|
||||||
|
plasma_install_package (package org.kde.plasma.desktoppanel)
|
28
sources/desktop-panel/metadata.desktop
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Desktop Panel
|
||||||
|
Comment=A minimalistic Plasmoid
|
||||||
|
Comment[en]=A minimalistic Plasmoid
|
||||||
|
Comment[es]=Un plasmoide minimalista
|
||||||
|
Comment[es]=Un script Plasmoïde minimaliste
|
||||||
|
Comment[pt_BR]=Um script Plasmoid
|
||||||
|
Comment[ru]=Минималистичный плазмоид
|
||||||
|
Comment[uk]=Мінімалістичний плазмоїд
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
Type=Service
|
||||||
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
X-Plasma-API=declarativeappletscript
|
||||||
|
X-Plasma-MainScript=ui/main.qml
|
||||||
|
X-Plasma-RemoteLocation=
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
|
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
|
||||||
|
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||||
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
X-KDE-PluginInfo-Depends=
|
||||||
|
X-KDE-PluginInfo-License=GPLv3
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
53
sources/desktop-panel/package/contents/config/config.qml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
import org.kde.plasma.configuration 2.0
|
||||||
|
|
||||||
|
|
||||||
|
ConfigModel {
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Widget")
|
||||||
|
icon: "utilities-system-monitor"
|
||||||
|
source: "widget.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Advanced")
|
||||||
|
icon: "system-run"
|
||||||
|
source: "advanced.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Active desktop")
|
||||||
|
icon: "preferences-desktop-theme"
|
||||||
|
source: "activeapp.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("Inactive desktop")
|
||||||
|
icon: "preferences-desktop-theme"
|
||||||
|
source: "inactiveapp.qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
ConfigCategory {
|
||||||
|
name: i18n("About")
|
||||||
|
icon: "help-about"
|
||||||
|
source: "about.qml"
|
||||||
|
}
|
||||||
|
}
|
87
sources/desktop-panel/package/contents/config/main.xml
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||||
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||||
|
<kcfgfile name=""/>
|
||||||
|
|
||||||
|
<group name="Widget">
|
||||||
|
<!-- widget -->
|
||||||
|
<entry name="text" type="string">
|
||||||
|
<default>[$mark$number/$total: $name]</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Advanced">
|
||||||
|
<!-- advanced -->
|
||||||
|
<entry name="height" type="int">
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="width" type="int">
|
||||||
|
<default>0</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipType" type="string">
|
||||||
|
<default>windows</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipWidth" type="int">
|
||||||
|
<default>200</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="tooltipColor" type="string">
|
||||||
|
<default>#ffffff</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="background" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="verticalLayout" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="mark" type="string">
|
||||||
|
<default>¤</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="panels" type="int">
|
||||||
|
<default>-1</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group name="Appearance">
|
||||||
|
<!-- appearance -->
|
||||||
|
<entry name="textAlign" type="string">
|
||||||
|
<default>center</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontFamily" type="string">
|
||||||
|
<default>Terminus</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontSize" type="int">
|
||||||
|
<default>12</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontColor" type="string">
|
||||||
|
<default>#000000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontWeight" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="fontStyle" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<!-- current -->
|
||||||
|
<entry name="currentTextAlign" type="string">
|
||||||
|
<default>center</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontFamily" type="string">
|
||||||
|
<default>Terminus</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontSize" type="int">
|
||||||
|
<default>12</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontColor" type="string">
|
||||||
|
<default>#ff0000</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontWeight" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="currentFontStyle" type="string">
|
||||||
|
<default>normal</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</kcfg>
|
109
sources/desktop-panel/package/contents/ui/about.qml
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: aboutPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
QtControls.TabView {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Tab {
|
||||||
|
title: i18n("About")
|
||||||
|
|
||||||
|
QtLayouts.ColumnLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: DPAdds.getAboutText("header")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: DPAdds.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: DPAdds.getAboutText("description")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignLeft
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: DPAdds.getAboutText("links")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
font.capitalization: Font.SmallCaps
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: DPAdds.getAboutText("copy")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Tab {
|
||||||
|
title: i18n("Acknowledgment")
|
||||||
|
|
||||||
|
QtLayouts.ColumnLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
text: DPAdds.getAboutText("translators")
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
|
textFormat: Text.RichText
|
||||||
|
text: DPAdds.getAboutText("3rdparty")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[about::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
218
sources/desktop-panel/package/contents/ui/activeapp.qml
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: activeAppearancePage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
property variant weight: {
|
||||||
|
25: 0,
|
||||||
|
50: 1,
|
||||||
|
63: 3,
|
||||||
|
75: 4,
|
||||||
|
87: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
property alias cfg_currentFontFamily: selectFont.text
|
||||||
|
property alias cfg_currentFontSize: fontSize.value
|
||||||
|
property string cfg_currentFontWeight: fontWeight.currentText
|
||||||
|
property string cfg_currentFontStyle: fontStyle.currentText
|
||||||
|
property alias cfg_currentFontColor: selectColor.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectFont
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
text: plasmoid.configuration.currentFontFamily
|
||||||
|
onClicked: fontDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font size")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: fontSize
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
minimumValue: 8
|
||||||
|
maximumValue: 32
|
||||||
|
stepSize: 1
|
||||||
|
value: plasmoid.configuration.currentFontSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font weight")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontWeight
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("light"),
|
||||||
|
'name': "light"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("demi bold"),
|
||||||
|
'name': "demibold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("bold"),
|
||||||
|
'name': "bold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("black"),
|
||||||
|
'name': "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_currentFontWeight = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
|
||||||
|
fontWeight.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font style")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontStyle
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("italic"),
|
||||||
|
'name': "italic"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_currentFontStyle = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
|
||||||
|
fontStyle.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectColor
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.currentFontColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.currentFontColor
|
||||||
|
onClicked: colorDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: colorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: selectColor.text
|
||||||
|
onAccepted: selectColor.text = colorDialog.color
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FontDialog {
|
||||||
|
id: fontDialog
|
||||||
|
title: i18n("Select a font")
|
||||||
|
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||||
|
onAccepted: {
|
||||||
|
selectFont.text = fontDialog.font.family
|
||||||
|
fontSize.value = fontDialog.font.pointSize
|
||||||
|
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||||
|
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[activeapp::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
255
sources/desktop-panel/package/contents/ui/advanced.qml
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: advancedPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_height: widgetHeight.value
|
||||||
|
property alias cfg_width: widgetWidth.value
|
||||||
|
property string cfg_tooltipType: tooltipType.currentText
|
||||||
|
property alias cfg_tooltipWidth: tooltipWidth.value
|
||||||
|
property alias cfg_tooltipColor: tooltipColor.text
|
||||||
|
property alias cfg_background: background.checked
|
||||||
|
property alias cfg_verticalLayout: verticalLayout.checked
|
||||||
|
property string cfg_mark: mark.currentText
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Widget height, px")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: widgetHeight
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 0
|
||||||
|
maximumValue: 4096
|
||||||
|
stepSize: 50
|
||||||
|
value: plasmoid.configuration.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Widget width, px")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: widgetWidth
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 0
|
||||||
|
maximumValue: 4096
|
||||||
|
stepSize: 50
|
||||||
|
value: plasmoid.configuration.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Tooltip type")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: tooltipType
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("contours"),
|
||||||
|
'name': "contours"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("windows"),
|
||||||
|
'name': "windows"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("clean desktop"),
|
||||||
|
'name': "clean"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("names"),
|
||||||
|
'name': "names"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("none"),
|
||||||
|
'name': "none"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_tooltipType = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.tooltipType) {
|
||||||
|
tooltipType.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Tooltip width")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: tooltipWidth
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
minimumValue: 100
|
||||||
|
maximumValue: 1000
|
||||||
|
stepSize: 50
|
||||||
|
value: plasmoid.configuration.tooltipWidth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: tooltipColor
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.tooltipColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.tooltipColor
|
||||||
|
onClicked: colorDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: background
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Enable background")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.heigth
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
}
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: verticalLayout
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
text: i18n("Vertical layout")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width * 2 / 5
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Mark")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: mark
|
||||||
|
width: parent.width * 3 / 5
|
||||||
|
editable: true
|
||||||
|
model: ["#", "$", "%", "&", "*", "@", "¤", "¶", "·", "º",
|
||||||
|
plasmoid.configuration.mark]
|
||||||
|
currentIndex: model.length - 1
|
||||||
|
onCurrentIndexChanged: cfg_mark = currentText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Row {
|
||||||
|
// height: implicitHeight
|
||||||
|
// width: parent.width
|
||||||
|
// QtControls.Label {
|
||||||
|
// height: parent.height
|
||||||
|
// width: parent.width * 2 / 5
|
||||||
|
// horizontalAlignment: Text.AlignRight
|
||||||
|
// verticalAlignment: Text.AlignVCenter
|
||||||
|
// text: i18n("Panels to be hidden")
|
||||||
|
// }
|
||||||
|
// QtControls.Button {
|
||||||
|
// width: parent.width * 3 / 5
|
||||||
|
// text: i18n("Edit panels")
|
||||||
|
// onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: colorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: tooltipColor.text
|
||||||
|
onAccepted: tooltipColor.text = colorDialog.color
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[advanced::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
36
sources/desktop-panel/package/contents/ui/general.qml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
pragma Singleton
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property variant fontWeight: {
|
||||||
|
"light": Font.Light,
|
||||||
|
"normal": Font.Normal,
|
||||||
|
"demibold": Font.DemiBold,
|
||||||
|
"bold": Font.Bold,
|
||||||
|
"black": Font.Black
|
||||||
|
}
|
||||||
|
property variant align: {
|
||||||
|
"left": Text.AlignLeft,
|
||||||
|
"center": Text.AlignHCenter,
|
||||||
|
"right": Text.AlignRight,
|
||||||
|
"justify": Text.AlignJustify
|
||||||
|
}
|
||||||
|
}
|
218
sources/desktop-panel/package/contents/ui/inactiveapp.qml
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: inactiveAppearancePage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: AWKeys.isDebugEnabled()
|
||||||
|
property variant weight: {
|
||||||
|
25: 0,
|
||||||
|
50: 1,
|
||||||
|
63: 3,
|
||||||
|
75: 4,
|
||||||
|
87: 5
|
||||||
|
}
|
||||||
|
|
||||||
|
property alias cfg_fontFamily: selectFont.text
|
||||||
|
property alias cfg_fontSize: fontSize.value
|
||||||
|
property string cfg_fontWeight: fontWeight.currentText
|
||||||
|
property string cfg_fontStyle: fontStyle.currentText
|
||||||
|
property alias cfg_fontColor: selectColor.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectFont
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
text: plasmoid.configuration.fontFamily
|
||||||
|
onClicked: fontDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font size")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: fontSize
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
minimumValue: 8
|
||||||
|
maximumValue: 32
|
||||||
|
stepSize: 1
|
||||||
|
value: plasmoid.configuration.fontSize
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font weight")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontWeight
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("light"),
|
||||||
|
'name': "light"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("demi bold"),
|
||||||
|
'name': "demibold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("bold"),
|
||||||
|
'name': "bold"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("black"),
|
||||||
|
'name': "black"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
|
||||||
|
fontWeight.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font style")
|
||||||
|
}
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: fontStyle
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
textRole: "label"
|
||||||
|
model: [
|
||||||
|
{
|
||||||
|
'label': i18n("normal"),
|
||||||
|
'name': "normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'label': i18n("italic"),
|
||||||
|
'name': "italic"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (var i = 0; i < model.length; i++) {
|
||||||
|
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
|
||||||
|
fontStyle.currentIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Label {
|
||||||
|
height: parent.height
|
||||||
|
width: parent.width / 3
|
||||||
|
horizontalAlignment: Text.AlignRight
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
text: i18n("Font color")
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: selectColor
|
||||||
|
width: parent.width * 2 / 3
|
||||||
|
style: QtStyles.ButtonStyle {
|
||||||
|
background: Rectangle {
|
||||||
|
color: plasmoid.configuration.fontColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
text: plasmoid.configuration.fontColor
|
||||||
|
onClicked: colorDialog.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.ColorDialog {
|
||||||
|
id: colorDialog
|
||||||
|
title: i18n("Select a color")
|
||||||
|
color: selectColor.text
|
||||||
|
onAccepted: selectColor.text = colorDialog.color
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FontDialog {
|
||||||
|
id: fontDialog
|
||||||
|
title: i18n("Select a font")
|
||||||
|
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||||
|
onAccepted: {
|
||||||
|
selectFont.text = fontDialog.font.family
|
||||||
|
fontSize.value = fontDialog.font.pointSize
|
||||||
|
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||||
|
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[inactiveapp::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
193
sources/desktop-panel/package/contents/ui/main.qml
Normal file
@ -0,0 +1,193 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.4
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
import QtQuick.Layouts 1.1
|
||||||
|
import org.kde.plasma.plasmoid 2.0
|
||||||
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
import "."
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: main
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
property variant tooltipSettings: {
|
||||||
|
"tooltipColor": plasmoid.configuration.tooltipColor,
|
||||||
|
"tooltipType": plasmoid.configuration.tooltipType,
|
||||||
|
"tooltipWidth": plasmoid.configuration.tooltipWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
signal needUpdate
|
||||||
|
signal needTooltipUpdate
|
||||||
|
signal sizeUpdate
|
||||||
|
|
||||||
|
|
||||||
|
// init
|
||||||
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||||
|
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||||
|
|
||||||
|
Plasmoid.icon: "utilities-system-monitor"
|
||||||
|
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||||
|
|
||||||
|
|
||||||
|
// ui
|
||||||
|
GridLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
|
||||||
|
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
id: repeater
|
||||||
|
Layout.columnSpan: 0
|
||||||
|
Layout.rowSpan: 0
|
||||||
|
model: DPAdds.numberOfDesktops()
|
||||||
|
|
||||||
|
Text {
|
||||||
|
id: text
|
||||||
|
height: contentHeight
|
||||||
|
width: contentWidth
|
||||||
|
textFormat: Text.RichText
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
||||||
|
text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1)
|
||||||
|
property alias tooltip: tooltip
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
hoverEnabled: true
|
||||||
|
anchors.fill: parent
|
||||||
|
onClicked: DPAdds.setCurrentDesktop(index + 1);
|
||||||
|
onEntered: needTooltipUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
PlasmaCore.ToolTipArea {
|
||||||
|
height: tooltip.height
|
||||||
|
width: tooltip.width
|
||||||
|
mainItem: Text {
|
||||||
|
id: tooltip
|
||||||
|
height: contentHeight
|
||||||
|
width: contentWidth
|
||||||
|
textFormat: Text.RichText
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: timer
|
||||||
|
interval: 1000
|
||||||
|
onTriggered: needUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
onNeedUpdate: {
|
||||||
|
if (debug) console.log("[main::onNeedUpdate]")
|
||||||
|
|
||||||
|
for (var i=0; i<repeater.count; i++) {
|
||||||
|
if (!repeater.itemAt(i)) {
|
||||||
|
if (debug) console.log("[main::onNeedUpdate] : Nothing to do here " + i)
|
||||||
|
timer.start()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
repeater.itemAt(i).text = DPAdds.parsePattern(plasmoid.configuration.text, i + 1)
|
||||||
|
if (DPAdds.currentDesktop() == i + 1) {
|
||||||
|
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
|
||||||
|
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
|
||||||
|
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
|
||||||
|
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
|
||||||
|
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.currentFontWeight]
|
||||||
|
} else {
|
||||||
|
repeater.itemAt(i).color = plasmoid.configuration.fontColor
|
||||||
|
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
|
||||||
|
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||||
|
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
|
||||||
|
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
|
||||||
|
}
|
||||||
|
repeater.itemAt(i).update()
|
||||||
|
}
|
||||||
|
|
||||||
|
sizeUpdate()
|
||||||
|
needTooltipUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
onNeedTooltipUpdate: {
|
||||||
|
if (debug) console.log("[main::onNeedTooltipUpdate]")
|
||||||
|
|
||||||
|
for (var i=0; i<repeater.count; i++) {
|
||||||
|
repeater.itemAt(i).tooltip.text = DPAdds.toolTipImage(i + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onSizeUpdate: {
|
||||||
|
if (debug) console.log("[main::onSizeUpdate]")
|
||||||
|
|
||||||
|
if (plasmoid.configuration.height == 0) {
|
||||||
|
var newHeight = 0
|
||||||
|
for (var i=0; i<repeater.count; i++)
|
||||||
|
newHeight += repeater.itemAt(i).contentHeight
|
||||||
|
Layout.minimumHeight = newHeight
|
||||||
|
Layout.maximumHeight = -1
|
||||||
|
} else {
|
||||||
|
Layout.minimumHeight = plasmoid.configuration.height
|
||||||
|
Layout.maximumHeight = plasmoid.configuration.height
|
||||||
|
}
|
||||||
|
if (plasmoid.configuration.width == 0) {
|
||||||
|
var newWidth = 0
|
||||||
|
for (var i=0; i<repeater.count; i++)
|
||||||
|
newWidth += repeater.itemAt(i).contentWidth
|
||||||
|
Layout.minimumWidth = newWidth
|
||||||
|
Layout.maximumWidth = -1
|
||||||
|
} else {
|
||||||
|
Layout.minimumWidth = plasmoid.configuration.width
|
||||||
|
Layout.maximumWidth = plasmoid.configuration.width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Plasmoid.onActivated: {
|
||||||
|
if (debug) console.log("[main::onActivated]")
|
||||||
|
|
||||||
|
// DPAdds.changePanelsState()
|
||||||
|
}
|
||||||
|
|
||||||
|
Plasmoid.onUserConfiguringChanged: {
|
||||||
|
if (plasmoid.userConfiguring) return
|
||||||
|
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||||
|
|
||||||
|
DPAdds.setMark(plasmoid.configuration.mark)
|
||||||
|
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
|
||||||
|
DPAdds.setToolTipData(tooltipSettings)
|
||||||
|
|
||||||
|
needUpdate()
|
||||||
|
}
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[main::onCompleted]")
|
||||||
|
|
||||||
|
// init submodule
|
||||||
|
Plasmoid.userConfiguringChanged(false)
|
||||||
|
DPAdds.desktopChanged.connect(needUpdate)
|
||||||
|
DPAdds.windowListChanged.connect(needTooltipUpdate)
|
||||||
|
}
|
||||||
|
}
|
1
sources/desktop-panel/package/contents/ui/qmldir
Normal file
@ -0,0 +1 @@
|
|||||||
|
singleton general general.qml
|
243
sources/desktop-panel/package/contents/ui/widget.qml
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
|
||||||
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: widgetPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
implicitWidth: pageColumn.implicitWidth
|
||||||
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_text: textPattern.text
|
||||||
|
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: pageColumn
|
||||||
|
anchors.fill: parent
|
||||||
|
QtControls.Label {
|
||||||
|
width: parent.width
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
|
text: i18n("Font")
|
||||||
|
iconName: "font"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Font button")
|
||||||
|
|
||||||
|
var defaultFont = {
|
||||||
|
"color": plasmoid.configuration.fontColor,
|
||||||
|
"family": plasmoid.configuration.fontFamily,
|
||||||
|
"size": plasmoid.configuration.fontSize
|
||||||
|
}
|
||||||
|
var font = DPAdds.getFont(defaultFont)
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<span style=\"color:" + font.color +
|
||||||
|
"; font-family:'" + font.family +
|
||||||
|
"'; font-size:" + font.size + "pt;\">" +
|
||||||
|
selected + "</span>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Indent button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, selected + "<br>\n")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Bold button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<b>" + selected + "</b>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Italic button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<i>" + selected + "</i>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Underline button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<u>" + selected + "</u>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Strike button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<s>" + selected + "</s>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Left button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Center button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Right button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Justify button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.ComboBox {
|
||||||
|
id: tags
|
||||||
|
width: parent.width - addTagButton.width - showValueButton.width
|
||||||
|
model: DPAdds.dictKeys()
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: addTagButton
|
||||||
|
text: i18n("Add")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Add tag button")
|
||||||
|
|
||||||
|
var pos = textPattern.cursorPosition
|
||||||
|
var selected = textPattern.selectedText
|
||||||
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
|
textPattern.insert(pos, selected + "$" + tags.currentText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
id: showValueButton
|
||||||
|
text: i18n("Show value")
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||||
|
|
||||||
|
var message = i18n("Tag: %1", tags.currentText)
|
||||||
|
message += "<br>"
|
||||||
|
message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText))
|
||||||
|
DPAdds.sendNotification("tag", message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.TextArea {
|
||||||
|
id: textPattern
|
||||||
|
width: parent.width
|
||||||
|
height: parent.height * 4 / 5
|
||||||
|
textFormat: TextEdit.PlainText
|
||||||
|
text: plasmoid.configuration.text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Component.onCompleted: {
|
||||||
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
}
|
||||||
|
}
|
28
sources/desktop-panel/package/metadata.desktop
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=Desktop Panel
|
||||||
|
Comment=A minimalistic Plasmoid
|
||||||
|
Comment[en]=A minimalistic Plasmoid
|
||||||
|
Comment[es]=Un plasmoide minimalista
|
||||||
|
Comment[es]=Un script Plasmoïde minimaliste
|
||||||
|
Comment[pt_BR]=Um script Plasmoid
|
||||||
|
Comment[ru]=Минималистичный плазмоид
|
||||||
|
Comment[uk]=Мінімалістичний плазмоїд
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
Type=Service
|
||||||
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
|
X-KDE-ServiceTypes=Plasma/Applet
|
||||||
|
X-Plasma-API=declarativeappletscript
|
||||||
|
X-Plasma-MainScript=ui/main.qml
|
||||||
|
X-Plasma-RemoteLocation=
|
||||||
|
|
||||||
|
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||||
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
|
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
|
||||||
|
X-KDE-PluginInfo-Version=2.3.0
|
||||||
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
|
X-KDE-PluginInfo-Category=System Information
|
||||||
|
X-KDE-PluginInfo-Depends=
|
||||||
|
X-KDE-PluginInfo-License=GPLv3
|
||||||
|
X-KDE-PluginInfo-EnabledByDefault=true
|
33
sources/desktop-panel/plugin/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
set (PLUGIN_NAME dpplugin)
|
||||||
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.desktoppanel\")
|
||||||
|
|
||||||
|
add_definitions (${Qt5Core_DEFINITIONS})
|
||||||
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
|
${Qt5Qml_INCLUDE_DIRS})
|
||||||
|
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||||
|
${Qt5Qml_LIBRARIES})
|
||||||
|
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||||
|
${Notifications_INCLUDE_DIR}
|
||||||
|
${Plasma_INCLUDE_DIR})
|
||||||
|
set (Kf5_LIBRARIES KF5::I18n
|
||||||
|
KF5::Notifications
|
||||||
|
KF5::Plasma
|
||||||
|
KF5::WindowSystem)
|
||||||
|
|
||||||
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${PROJECT_TRDPARTY_DIR}
|
||||||
|
${Qt_INCLUDE}
|
||||||
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||||
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
|
||||||
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||||
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||||
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
39
sources/desktop-panel/plugin/desktoppanel.cpp
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "desktoppanel.h"
|
||||||
|
|
||||||
|
#include <QtQml>
|
||||||
|
|
||||||
|
#include "dpadds.h"
|
||||||
|
|
||||||
|
|
||||||
|
static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||||
|
{
|
||||||
|
Q_UNUSED(engine);
|
||||||
|
Q_UNUSED(scriptEngine);
|
||||||
|
|
||||||
|
return new DPAdds();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPPlugin::registerTypes(const char *uri)
|
||||||
|
{
|
||||||
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.desktoppanel"));
|
||||||
|
|
||||||
|
qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
||||||
|
}
|
35
sources/desktop-panel/plugin/desktoppanel.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DPPLUGIN_H
|
||||||
|
#define DPPLUGIN_H
|
||||||
|
|
||||||
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
|
||||||
|
class DPPlugin : public QQmlExtensionPlugin
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||||
|
|
||||||
|
public:
|
||||||
|
void registerTypes(const char *uri);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DPPLUGIN_H */
|
487
sources/desktop-panel/plugin/dpadds.cpp
Normal file
@ -0,0 +1,487 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "dpadds.h"
|
||||||
|
|
||||||
|
#include <KI18n/KLocalizedString>
|
||||||
|
#include <KNotifications/KNotification>
|
||||||
|
#include <KWindowSystem/KWindowSystem>
|
||||||
|
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QGraphicsPixmapItem>
|
||||||
|
#include <QGraphicsScene>
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
#include <QScreen>
|
||||||
|
|
||||||
|
#include <fontdialog/fontdialog.h>
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
DPAdds::DPAdds(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
{
|
||||||
|
// debug
|
||||||
|
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||||
|
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||||
|
debug = (debugEnv == QString("yes"));
|
||||||
|
|
||||||
|
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(changeDesktop(int)));
|
||||||
|
connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SLOT(changeWindowList(WId)));
|
||||||
|
connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(changeWindowList(WId)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DPAdds::~DPAdds()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool DPAdds::isDebugEnabled()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int DPAdds::currentDesktop()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return KWindowSystem::currentDesktop();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList DPAdds::dictKeys()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QStringList allKeys;
|
||||||
|
allKeys.append(QString("mark"));
|
||||||
|
allKeys.append(QString("name"));
|
||||||
|
allKeys.append(QString("number"));
|
||||||
|
allKeys.append(QString("total"));
|
||||||
|
|
||||||
|
return allKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int DPAdds::numberOfDesktops()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return KWindowSystem::numberOfDesktops();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::toolTipImage(const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||||
|
if (tooltipType == QString("none")) return QString();
|
||||||
|
|
||||||
|
// prepare
|
||||||
|
DesktopWindowsInfo info = getInfoByDesktop(desktop);
|
||||||
|
if (tooltipType == QString("names")) {
|
||||||
|
QStringList windowList;
|
||||||
|
for (int i=0; i<info.windowsData.count(); i++)
|
||||||
|
windowList.append(info.windowsData[i].name);
|
||||||
|
return QString("<ul><li>%1</li></ul>").arg(windowList.join(QString("</li><li>")));
|
||||||
|
}
|
||||||
|
// init
|
||||||
|
QGraphicsScene *toolTipScene = new QGraphicsScene();
|
||||||
|
QGraphicsView *toolTipView = new QGraphicsView(toolTipScene);
|
||||||
|
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||||
|
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||||
|
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||||
|
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
// update
|
||||||
|
float margin = 5.0 * info.desktop.width() / 400.0;
|
||||||
|
toolTipView->resize(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
|
||||||
|
toolTipScene->clear();
|
||||||
|
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||||
|
// borders
|
||||||
|
toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
|
||||||
|
toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin,
|
||||||
|
info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
|
||||||
|
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin,
|
||||||
|
info.desktop.width() + 2.0 * margin, 0);
|
||||||
|
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
|
||||||
|
|
||||||
|
if (tooltipType == QString("contours")) {
|
||||||
|
QPen pen = QPen();
|
||||||
|
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
||||||
|
pen.setColor(QColor(tooltipColor));
|
||||||
|
for (int i=0; i<info.windowsData.count(); i++) {
|
||||||
|
QRect rect = info.windowsData[i].rect;
|
||||||
|
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
|
||||||
|
rect.left() + margin, rect.top() + margin, pen);
|
||||||
|
toolTipScene->addLine(rect.left() + margin, rect.top() + margin,
|
||||||
|
rect.right() + margin, rect.top() + margin, pen);
|
||||||
|
toolTipScene->addLine(rect.right() + margin, rect.top() + margin,
|
||||||
|
rect.right() + margin, rect.bottom() + margin, pen);
|
||||||
|
toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin,
|
||||||
|
rect.left() + margin, rect.bottom() + margin, pen);
|
||||||
|
}
|
||||||
|
} else if (tooltipType == QString("clean")) {
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||||
|
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||||
|
toolTipScene->addPixmap(desktop)
|
||||||
|
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||||
|
}
|
||||||
|
} else if (tooltipType == QString("windows")) {
|
||||||
|
QScreen *screen = QGuiApplication::primaryScreen();
|
||||||
|
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||||
|
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||||
|
toolTipScene->addPixmap(desktop)
|
||||||
|
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||||
|
}
|
||||||
|
for (int i=0; i<info.windowsData.count(); i++) {
|
||||||
|
QPixmap window = screen->grabWindow(info.windowsData[i].id);
|
||||||
|
toolTipScene->addPixmap(window)
|
||||||
|
->setOffset(info.windowsData[i].rect.left(), info.windowsData[i].rect.top());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap image = toolTipView->grab().scaledToWidth(tooltipWidth);
|
||||||
|
QByteArray byteArray;
|
||||||
|
QBuffer buffer(&byteArray);
|
||||||
|
image.save(&buffer, "PNG");
|
||||||
|
|
||||||
|
delete toolTipView;
|
||||||
|
delete toolTipScene;
|
||||||
|
|
||||||
|
return QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::parsePattern(const QString pattern, const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString parsed = pattern;
|
||||||
|
QStringList keys = dictKeys();
|
||||||
|
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||||
|
for (int i=0; i<keys.count(); i++)
|
||||||
|
parsed.replace(QString("$%1").arg(keys[i]), valueByKey(keys[i], desktop));
|
||||||
|
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||||
|
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::setMark(const QString newMark)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Mark" << newMark;
|
||||||
|
|
||||||
|
mark = newMark;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::setPanelsToControl(const QString newPanels)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Panels" << newPanels;
|
||||||
|
|
||||||
|
panelsToControl.clear();
|
||||||
|
if (newPanels == QString("-1")) {
|
||||||
|
int count = getPanels().count();
|
||||||
|
for (int i=0; i<count; i++)
|
||||||
|
panelsToControl.append(i);
|
||||||
|
} else
|
||||||
|
for (int i=0; i<newPanels.split(QChar(',')).count(); i++)
|
||||||
|
panelsToControl.append(newPanels.split(QChar(','))[i].toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::setToolTipData(const QVariantMap tooltipData)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData;
|
||||||
|
|
||||||
|
tooltipColor = tooltipData[QString("tooltipColor")].toString();
|
||||||
|
tooltipType = tooltipData[QString("tooltipType")].toString();
|
||||||
|
tooltipWidth = tooltipData[QString("tooltipWidth")].toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::valueByKey(const QString key, int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
|
||||||
|
if (desktop == -1) desktop = currentDesktop();
|
||||||
|
|
||||||
|
QString currentMark = currentDesktop() == desktop ? mark : QString("");
|
||||||
|
if (key == QString("mark"))
|
||||||
|
return QString("%1").arg(currentMark, mark.count(), QLatin1Char(' '))
|
||||||
|
.replace(QString(" "), QString(" "));
|
||||||
|
else if (key == QString("name"))
|
||||||
|
return KWindowSystem::desktopName(desktop).replace(QString(" "), QString(" "));
|
||||||
|
else if (key == QString("number"))
|
||||||
|
return QString::number(desktop);
|
||||||
|
else if (key == QString("total"))
|
||||||
|
return QString::number(numberOfDesktops());
|
||||||
|
else
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::editPanelsToContol(const QString current)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
// paint
|
||||||
|
QDialog *dialog = new QDialog(nullptr);
|
||||||
|
QListWidget *widget = new QListWidget(dialog);
|
||||||
|
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
|
||||||
|
Qt::Vertical, dialog);
|
||||||
|
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||||
|
layout->addWidget(widget);
|
||||||
|
layout->addWidget(buttons);
|
||||||
|
dialog->setLayout(layout);
|
||||||
|
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||||
|
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||||
|
|
||||||
|
// fill
|
||||||
|
QList<Plasma::Containment *> panels = getPanels();
|
||||||
|
for (int i=0; i<panels.count(); i++) {
|
||||||
|
QListWidgetItem *item = new QListWidgetItem(panelLocationToStr(panels[i]->location()), widget);
|
||||||
|
if ((current.split(QChar(',')).contains(QString::number(i))) ||
|
||||||
|
(current == QString("-1")))
|
||||||
|
item->setCheckState(Qt::Checked);
|
||||||
|
else
|
||||||
|
item->setCheckState(Qt::Unchecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
// exec
|
||||||
|
QString value;
|
||||||
|
QStringList indexes;
|
||||||
|
int ret = dialog->exec();
|
||||||
|
switch (ret) {
|
||||||
|
case QDialog::Accepted:
|
||||||
|
for (int i=0; i<widget->count(); i++)
|
||||||
|
if (widget->item(i)->checkState() == Qt::Checked)
|
||||||
|
indexes.append(QString::number(i));
|
||||||
|
if (indexes.count() == widget->count())
|
||||||
|
value = QString("-1");
|
||||||
|
else
|
||||||
|
value = indexes.join(QChar(','));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
value = current;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::getAboutText(const QString type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||||
|
|
||||||
|
QString text;
|
||||||
|
if (type == QString("header"))
|
||||||
|
text = QString(NAME);
|
||||||
|
else if (type == QString("version"))
|
||||||
|
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE));
|
||||||
|
else if (type == QString("description"))
|
||||||
|
text = i18n("A set of minimalistic plasmoid widgets");
|
||||||
|
else if (type == QString("links"))
|
||||||
|
text = i18n("Links:") + QString("<br>") +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||||
|
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
|
||||||
|
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
|
||||||
|
else if (type == QString("copy"))
|
||||||
|
text = QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||||
|
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>");
|
||||||
|
else if (type == QString("translators"))
|
||||||
|
text = i18n("Translators: %1", QString(TRANSLATORS));
|
||||||
|
else if (type == QString("3rdparty")) {
|
||||||
|
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]);
|
||||||
|
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||||
|
}
|
||||||
|
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantMap DPAdds::getFont(const QVariantMap defaultFont)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QVariantMap fontMap;
|
||||||
|
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||||
|
defaultFont[QString("size")].toInt(),
|
||||||
|
400, false, defaultFont[QString("color")].toString());
|
||||||
|
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont,
|
||||||
|
false, false);
|
||||||
|
fontMap[QString("color")] = font.color().name();
|
||||||
|
fontMap[QString("family")] = font.family();
|
||||||
|
fontMap[QString("size")] = font.pointSize();
|
||||||
|
|
||||||
|
return fontMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::changePanelsState()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (panelsToControl.isEmpty()) return;
|
||||||
|
|
||||||
|
// QList<Plasma::Containment *> panels = getPanels();
|
||||||
|
// for (int i=0; i<panels.count(); i++) {
|
||||||
|
// if (!panelsToControl.contains(i)) continue;
|
||||||
|
// bool wasVisible = panels[i]->view()->isVisible();
|
||||||
|
// int winId = panels[i]->view()->winId();
|
||||||
|
// if (wasVisible) {
|
||||||
|
// if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
|
||||||
|
// KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
|
||||||
|
// oldState = oldInfo.state();
|
||||||
|
// panels[i]->view()->setVisible(false);
|
||||||
|
// } else {
|
||||||
|
// if (debug) qDebug() << PDEBUG << ":" << "Show panel";
|
||||||
|
// panels[i]->view()->setVisible(true);
|
||||||
|
// KWindowSystem::clearState(winId, NET::KeepAbove);
|
||||||
|
// KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
|
||||||
|
// KWindowSystem::setOnAllDesktops(winId, true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// panels.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::sendNotification(const QString eventId, const QString message)
|
||||||
|
{
|
||||||
|
KNotification *notification = KNotification::event(eventId, QString("Desktop Panel ::: %1").arg(eventId), message);
|
||||||
|
notification->setComponentName(QString("plasma-applet-org.kde.plasma.desktop-panel"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::setCurrentDesktop(const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||||
|
|
||||||
|
KWindowSystem::setCurrentDesktop(desktop);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::changeDesktop(const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||||
|
|
||||||
|
emit(desktopChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DPAdds::changeWindowList(const WId window)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Window" << window;
|
||||||
|
|
||||||
|
emit(windowListChanged());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||||
|
|
||||||
|
|
||||||
|
DesktopWindowsInfo info;
|
||||||
|
info.desktop = KWindowSystem::workArea(desktop);
|
||||||
|
|
||||||
|
QList<WId> windows = KWindowSystem::windows();
|
||||||
|
for (int i=0; i<windows.count(); i++) {
|
||||||
|
KWindowInfo winInfo = KWindowInfo(windows[i],
|
||||||
|
NET::Property::WMDesktop | NET::Property::WMGeometry |
|
||||||
|
NET::Property::WMState | NET::Property::WMWindowType |
|
||||||
|
NET::Property::WMVisibleName);
|
||||||
|
if (!winInfo.isOnDesktop(desktop)) continue;
|
||||||
|
WindowData data;
|
||||||
|
data.id = windows[i];
|
||||||
|
data.name = winInfo.visibleName();
|
||||||
|
data.rect = winInfo.geometry();
|
||||||
|
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) {
|
||||||
|
if (winInfo.isMinimized()) continue;
|
||||||
|
info.windowsData.append(data);
|
||||||
|
} else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask) == NET::WindowType::Desktop) {
|
||||||
|
info.desktopsData.append(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QList<Plasma::Containment *> DPAdds::getPanels()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
// Plasma::Corona *corona = new Plasma::Corona(this);
|
||||||
|
QList<Plasma::Containment *> panels;
|
||||||
|
// for (int i=0; i<corona->containments().count(); i++)
|
||||||
|
// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||||
|
// panels.append(corona->containments()[i]);
|
||||||
|
// delete corona;
|
||||||
|
|
||||||
|
return panels;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString DPAdds::panelLocationToStr(Plasma::Types::Location location)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Location" << location;
|
||||||
|
|
||||||
|
switch (location) {
|
||||||
|
case Plasma::Types::Location::TopEdge:
|
||||||
|
return i18n("Top Edge");
|
||||||
|
case Plasma::Types::Location::BottomEdge:
|
||||||
|
return i18n("Bottom Edge");
|
||||||
|
case Plasma::Types::Location::LeftEdge:
|
||||||
|
return i18n("Left Edge");
|
||||||
|
case Plasma::Types::Location::RightEdge:
|
||||||
|
return i18n("Right Edge");
|
||||||
|
default:
|
||||||
|
return i18n("Unknown location (%1)", location);
|
||||||
|
}
|
||||||
|
}
|
92
sources/desktop-panel/plugin/dpadds.h
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef DPADDS_H
|
||||||
|
#define DPADDS_H
|
||||||
|
|
||||||
|
#include <Plasma/Containment>
|
||||||
|
|
||||||
|
#include <QMap>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
|
||||||
|
class DPAdds : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
WId id;
|
||||||
|
QString name;
|
||||||
|
QRect rect;
|
||||||
|
} WindowData;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
QRect desktop;
|
||||||
|
QList<WindowData> desktopsData;
|
||||||
|
QList<WindowData> windowsData;
|
||||||
|
} DesktopWindowsInfo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DPAdds(QObject *parent = nullptr);
|
||||||
|
~DPAdds();
|
||||||
|
|
||||||
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
|
Q_INVOKABLE int currentDesktop();
|
||||||
|
Q_INVOKABLE QStringList dictKeys();
|
||||||
|
Q_INVOKABLE int numberOfDesktops();
|
||||||
|
Q_INVOKABLE QString toolTipImage(const int desktop);
|
||||||
|
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop);
|
||||||
|
// values
|
||||||
|
Q_INVOKABLE void setMark(const QString newMark);
|
||||||
|
Q_INVOKABLE void setPanelsToControl(const QString newPanels);
|
||||||
|
Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData);
|
||||||
|
Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1);
|
||||||
|
// configuration slots
|
||||||
|
Q_INVOKABLE QString editPanelsToContol(const QString current);
|
||||||
|
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||||
|
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void desktopChanged();
|
||||||
|
void windowListChanged();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
Q_INVOKABLE void changePanelsState();
|
||||||
|
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
|
||||||
|
Q_INVOKABLE void setCurrentDesktop(const int desktop);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void changeDesktop(const int desktop);
|
||||||
|
void changeWindowList(const WId window);
|
||||||
|
|
||||||
|
private:
|
||||||
|
DesktopWindowsInfo getInfoByDesktop(const int desktop);
|
||||||
|
QList<Plasma::Containment *> getPanels();
|
||||||
|
QString panelLocationToStr(Plasma::Types::Location location);
|
||||||
|
// variables
|
||||||
|
bool debug = false;
|
||||||
|
int oldState, tooltipWidth = 200;
|
||||||
|
QString mark = QString("*");
|
||||||
|
QString tooltipColor = QString("#000000");
|
||||||
|
QString tooltipType = QString("none");
|
||||||
|
QList<int> panelsToControl;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* DPADDS_H */
|
@ -0,0 +1,24 @@
|
|||||||
|
[Global]
|
||||||
|
IconName=system
|
||||||
|
Name=Desktop Panel
|
||||||
|
Comment=Desktop panel notifications
|
||||||
|
|
||||||
|
[info]
|
||||||
|
Name=Information
|
||||||
|
Comment=Information
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/event]
|
||||||
|
Name=Event
|
||||||
|
Comment=Some event occurs
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/system]
|
||||||
|
Name=System information
|
||||||
|
Comment=System information
|
||||||
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/tag]
|
||||||
|
Name=Tag information
|
||||||
|
Comment=Tag information
|
||||||
|
Action=Popup
|
3
sources/desktop-panel/plugin/qmldir
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module org.kde.plasma.desktoppanel
|
||||||
|
|
||||||
|
plugin dpplugin
|
@ -1,27 +0,0 @@
|
|||||||
# set project name
|
|
||||||
set (SUBPROJECT plasma_engine_extsysmon)
|
|
||||||
|
|
||||||
# find required libaries
|
|
||||||
find_package (KDE4 REQUIRED)
|
|
||||||
include (KDE4Defaults)
|
|
||||||
|
|
||||||
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 (PLUGIN_NAME ${SUBPROJECT})
|
|
||||||
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
|
||||||
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
|
||||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
|
||||||
file (GLOB SUBPROJECT_CONF *.conf)
|
|
||||||
|
|
||||||
# prepare
|
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
|
||||||
|
|
||||||
# make
|
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS})
|
|
||||||
|
|
||||||
# install
|
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
||||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
|
||||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
|
@ -1,29 +0,0 @@
|
|||||||
# Configuration file for Extended Systemmonitor DataEngine
|
|
||||||
# Uncomment needed lines
|
|
||||||
|
|
||||||
# Custom command
|
|
||||||
#CUSTOM=wget -qO- http://ifconfig.me/ip
|
|
||||||
|
|
||||||
# Set GPU device
|
|
||||||
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto'
|
|
||||||
#GPUDEV=auto
|
|
||||||
|
|
||||||
# Set block device for hddtemp comma separated or use 'all'
|
|
||||||
#HDDDEV=all
|
|
||||||
|
|
||||||
# Set MPD settings
|
|
||||||
#MPDADDRESS=localhost
|
|
||||||
#MPDPORT=6600
|
|
||||||
|
|
||||||
# Package upgrade info
|
|
||||||
## from vicious
|
|
||||||
## Arch: PKGCMD=pacman -Qu PKGNULL=0
|
|
||||||
## Debian: PKGCMD=apt-show-versions -u -b PKGNULL=0
|
|
||||||
## Ubuntu: PKGCMD=aptitude search '~U' PKGNULL=0
|
|
||||||
## Fedora: PKGCMD=yum list updates PKGNULL=3
|
|
||||||
## FreeBSD: PKGCMD=pkg_version -I -l '<' PKGNULL=0
|
|
||||||
## Mandriva: PKGCMD=urpmq --auto-select PKGNULL=0
|
|
||||||
# Commands to run, comma separated
|
|
||||||
#PKGCMD=pacman -Qu
|
|
||||||
# Number of null lines for commands, comma separated
|
|
||||||
#PKGNULL=0
|
|
@ -1,486 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of pytextmonitor *
|
|
||||||
* *
|
|
||||||
* pytextmonitor 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. *
|
|
||||||
* *
|
|
||||||
* pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include "extsysmon.h"
|
|
||||||
|
|
||||||
#include <Plasma/DataContainer>
|
|
||||||
#include <KDE/KGlobal>
|
|
||||||
#include <KDE/KStandardDirs>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QTextCodec>
|
|
||||||
|
|
||||||
|
|
||||||
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
|
||||||
: Plasma::DataEngine(parent, args)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args)
|
|
||||||
|
|
||||||
setMinimumPollingInterval(333);
|
|
||||||
readConfiguration();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString ExtendedSysMon::getAllHdd()
|
|
||||||
{
|
|
||||||
QProcess command;
|
|
||||||
QStringList devices;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
QString dev;
|
|
||||||
command.start("find /dev -name [hs]d[a-z]");
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
dev = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
|
||||||
devices.append(dev);
|
|
||||||
}
|
|
||||||
return devices.join(QChar(','));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString ExtendedSysMon::getAutoGpu()
|
|
||||||
{
|
|
||||||
QProcess command;
|
|
||||||
QString gpu = QString("");
|
|
||||||
QString qoutput = QString("");
|
|
||||||
command.start("lspci");
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
if (qoutput.toLower().contains("nvidia"))
|
|
||||||
gpu = QString("nvidia");
|
|
||||||
else if (qoutput.toLower().contains("radeon"))
|
|
||||||
gpu = QString("ati");
|
|
||||||
return gpu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList ExtendedSysMon::sources() const
|
|
||||||
{
|
|
||||||
QStringList source;
|
|
||||||
source.append(QString("custom"));
|
|
||||||
source.append(QString("gpu"));
|
|
||||||
source.append(QString("gputemp"));
|
|
||||||
source.append(QString("hddtemp"));
|
|
||||||
source.append(QString("pkg"));
|
|
||||||
source.append(QString("player"));
|
|
||||||
source.append(QString("ps"));
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ExtendedSysMon::readConfiguration()
|
|
||||||
{
|
|
||||||
// pre-setup
|
|
||||||
QMap<QString, QString> rawConfig;
|
|
||||||
rawConfig[QString("CUSTOM")] = QString("wget -qO- http://ifconfig.me/ip");
|
|
||||||
rawConfig[QString("GPUDEV")] = QString("auto");
|
|
||||||
rawConfig[QString("HDDDEV")] = QString("all");
|
|
||||||
rawConfig[QString("MPDADDRESS")] = QString("localhost");
|
|
||||||
rawConfig[QString("MPDPORT")] = QString("6600");
|
|
||||||
rawConfig[QString("PKGCMD")] = QString("pacman -Qu");
|
|
||||||
rawConfig[QString("PKGNULL")] = QString("0");
|
|
||||||
|
|
||||||
QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
|
|
||||||
QFile confFile(fileName);
|
|
||||||
bool ok = confFile.open(QIODevice::ReadOnly);
|
|
||||||
if (!ok) {
|
|
||||||
configuration = updateConfiguration(rawConfig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
QString fileStr;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig)
|
|
||||||
{
|
|
||||||
QMap<QString, QString> config;
|
|
||||||
QString key, value;
|
|
||||||
// remove spaces and copy source map
|
|
||||||
for (int i=0; i<rawConfig.keys().count(); i++) {
|
|
||||||
key = rawConfig.keys()[i];
|
|
||||||
value = rawConfig[key];
|
|
||||||
key.remove(QChar(' '));
|
|
||||||
if ((key != QString("CUSTOM")) && (key != QString("PKGCMD")))
|
|
||||||
value.remove(QChar(' '));
|
|
||||||
config[key] = value;
|
|
||||||
}
|
|
||||||
// update values
|
|
||||||
if (config[QString("GPUDEV")] == QString("auto"))
|
|
||||||
config[QString("GPUDEV")] = getAutoGpu();
|
|
||||||
if (config[QString("HDDDEV")] == QString("all"))
|
|
||||||
config[QString("HDDDEV")] = getAllHdd();
|
|
||||||
for (int i=config[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
|
|
||||||
i<config[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
|
|
||||||
i++)
|
|
||||||
config[QString("PKGNULL")] += QString(",0");
|
|
||||||
return config;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString ExtendedSysMon::getCustomCmd(const QString cmd)
|
|
||||||
{
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
command.start(QString("bash -c \"") + cmd + QString("\""));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
|
||||||
return qoutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float ExtendedSysMon::getGpu(const QString device)
|
|
||||||
{
|
|
||||||
float gpu = 0.0;
|
|
||||||
if ((device != QString("nvidia")) && (device != QString("ati")))
|
|
||||||
return gpu;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput;
|
|
||||||
|
|
||||||
if (device == QString("nvidia")) {
|
|
||||||
command.start(QString("nvidia-smi -q -d UTILIZATION"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Gpu"))) {
|
|
||||||
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
|
||||||
.split(QChar(' '), QString::SkipEmptyParts)[2]
|
|
||||||
.remove(QChar('%'));
|
|
||||||
gpu = load.toFloat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (device == QString("ati")) {
|
|
||||||
command.start(QString("aticonfig --od-getclocks"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("load"))) {
|
|
||||||
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
|
||||||
.split(QChar(' '), QString::SkipEmptyParts)[3]
|
|
||||||
.remove(QChar('%'));
|
|
||||||
gpu = load.toFloat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gpu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float ExtendedSysMon::getGpuTemp(const QString device)
|
|
||||||
{
|
|
||||||
float gpuTemp = 0.0;
|
|
||||||
if ((device != QString("nvidia")) && (device != QString("ati")))
|
|
||||||
return gpuTemp;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput;
|
|
||||||
if (device == QString("nvidia")) {
|
|
||||||
command.start(QString("nvidia-smi -q -d TEMPERATURE"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Gpu"))) {
|
|
||||||
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
|
||||||
.split(QChar(' '), QString::SkipEmptyParts)[2];
|
|
||||||
gpuTemp = temp.toFloat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (device == QString("ati")) {
|
|
||||||
command.start(QString("aticonfig --od-gettemperature"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Temperature"))) {
|
|
||||||
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
|
|
||||||
.split(QChar(' '), QString::SkipEmptyParts)[4];
|
|
||||||
gpuTemp = temp.toFloat();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return gpuTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float ExtendedSysMon::getHddTemp(const QString device)
|
|
||||||
{
|
|
||||||
float hddTemp = 0.0;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
command.start(QString("sudo hddtemp ") + device);
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
|
||||||
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
|
|
||||||
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts)[2];
|
|
||||||
temp.remove(QChar(0260)).remove(QChar('C'));
|
|
||||||
hddTemp = temp.toFloat();
|
|
||||||
}
|
|
||||||
return hddTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList ExtendedSysMon::getPlayerInfo(const QString playerName,
|
|
||||||
const QString mpdAddress,
|
|
||||||
const QString mpdPort)
|
|
||||||
{
|
|
||||||
QStringList info;
|
|
||||||
// album
|
|
||||||
info.append(QString("unknown"));
|
|
||||||
// artist
|
|
||||||
info.append(QString("unknown"));
|
|
||||||
// progress
|
|
||||||
info.append(QString("0"));
|
|
||||||
// duration
|
|
||||||
info.append(QString("0"));
|
|
||||||
// title
|
|
||||||
info.append(QString("unknown"));
|
|
||||||
if ((playerName != QString("amarok")) &&
|
|
||||||
(playerName != QString("mpd")) &&
|
|
||||||
(playerName != QString("qmmp")))
|
|
||||||
return info;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
QString qstr;
|
|
||||||
if (playerName == QString("amarok")) {
|
|
||||||
// amarok
|
|
||||||
command.start("qdbus org.kde.amarok /Player GetMetadata");
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
|
||||||
if (qstr.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
|
|
||||||
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("album"))
|
|
||||||
info[0] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("artist"))
|
|
||||||
info[1] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time"))
|
|
||||||
info[3] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
|
|
||||||
info[4] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
command.start("qdbus org.kde.amarok /Player PositionGet");
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
|
||||||
int time = qstr.toInt() / 1000;
|
|
||||||
info[2] = QString::number(time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (playerName == QString("mpd")) {
|
|
||||||
// mpd
|
|
||||||
command.start(QString("bash -c \"echo 'currentsong\nstatus\nclose' | curl --connect-timeout 1 -fsm 3 telnet://") +
|
|
||||||
mpdAddress + QString(":") + mpdPort + QString("\""));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
|
||||||
if (qstr.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
|
|
||||||
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
|
|
||||||
info[0] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
|
|
||||||
info[1] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) {
|
|
||||||
info[3] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
|
|
||||||
info[2] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
|
|
||||||
}
|
|
||||||
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
|
|
||||||
info[4] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (playerName == QString("qmmp")) {
|
|
||||||
// qmmp
|
|
||||||
command.start("qmmp --status");
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
|
|
||||||
if ((qstr.split(QString(" = "), QString::SkipEmptyParts).count() > 1) || (qstr.at(0) == QChar('['))) {
|
|
||||||
if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ALBUM"))
|
|
||||||
info[0] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ARTIST"))
|
|
||||||
info[1] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
else if ((qstr.at(0) == QChar('[')) && (!qstr.contains("[stopped]"))) {
|
|
||||||
QString time = qstr.split(QString(" "), QString::SkipEmptyParts)[2].trimmed();
|
|
||||||
info[2] = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
|
|
||||||
time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
|
|
||||||
info[3] = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
|
|
||||||
time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
|
|
||||||
}
|
|
||||||
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("TITLE"))
|
|
||||||
info[4] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList ExtendedSysMon::getPsStats()
|
|
||||||
{
|
|
||||||
int psCount = 0;
|
|
||||||
QStringList psList;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
command.start(QString("ps --no-headers -o command"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
|
||||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
|
|
||||||
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i] != QString("ps --no-headers -o command")) {
|
|
||||||
psCount++;
|
|
||||||
psList.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
|
|
||||||
}
|
|
||||||
QStringList psStats;
|
|
||||||
psStats.append(QString::number(psCount));
|
|
||||||
psStats.append(psList.join(QString(",")));
|
|
||||||
command.start(QString("ps -e --no-headers -o command"));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
|
||||||
int psTotal = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
|
|
||||||
psStats.append(QString::number(psTotal));
|
|
||||||
return psStats;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int ExtendedSysMon::getUpgradeInfo(const QString pkgCommand, const int pkgNull)
|
|
||||||
{
|
|
||||||
int count = 0;
|
|
||||||
QProcess command;
|
|
||||||
QString qoutput = QString("");
|
|
||||||
command.start(QString("bash -c \"") + pkgCommand + QString("\""));
|
|
||||||
command.waitForFinished(-1);
|
|
||||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
|
|
||||||
count = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
|
|
||||||
return (count - pkgNull);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ExtendedSysMon::sourceRequestEvent(const QString &name)
|
|
||||||
{
|
|
||||||
return updateSourceEvent(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
|
||||||
{
|
|
||||||
QString key;
|
|
||||||
if (source == QString("custom")) {
|
|
||||||
key = QString("custom");
|
|
||||||
QString value = getCustomCmd(configuration[QString("CUSTOM")]);
|
|
||||||
setData(source, key, value);
|
|
||||||
}
|
|
||||||
else if (source == QString("gpu")) {
|
|
||||||
key = QString("GPU");
|
|
||||||
float value = getGpu(configuration[QString("GPUDEV")]);
|
|
||||||
setData(source, key, value);
|
|
||||||
}
|
|
||||||
else if (source == QString("gputemp")) {
|
|
||||||
key = QString("GPUTemp");
|
|
||||||
float value = getGpuTemp(configuration[QString("GPUDEV")]);
|
|
||||||
setData(source, key, value);
|
|
||||||
}
|
|
||||||
else if (source == QString("hddtemp")) {
|
|
||||||
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
|
||||||
for (int i=0; i<deviceList.count(); i++) {
|
|
||||||
float value = getHddTemp(deviceList[i]);
|
|
||||||
setData(source, deviceList[i], value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (source == QString("pkg")) {
|
|
||||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++) {
|
|
||||||
key = QString("pkgCount") + QString::number(i);
|
|
||||||
int value = getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i],
|
|
||||||
configuration[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts)[i].toInt());
|
|
||||||
setData(source, key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (source == QString("player")) {
|
|
||||||
QStringList value;
|
|
||||||
// amarok
|
|
||||||
value = getPlayerInfo(QString("amarok"));
|
|
||||||
key = QString("amarok_album");
|
|
||||||
setData(source, key, value[0]);
|
|
||||||
key = QString("amarok_artist");
|
|
||||||
setData(source, key, value[1]);
|
|
||||||
key = QString("amarok_progress");
|
|
||||||
setData(source, key, value[2]);
|
|
||||||
key = QString("amarok_duration");
|
|
||||||
setData(source, key, value[3]);
|
|
||||||
key = QString("amarok_title");
|
|
||||||
setData(source, key, value[4]);
|
|
||||||
// mpd
|
|
||||||
value = getPlayerInfo(QString("mpd"),
|
|
||||||
configuration[QString("MPDADDRESS")],
|
|
||||||
configuration[QString("MPDPORT")]);
|
|
||||||
key = QString("mpd_album");
|
|
||||||
setData(source, key, value[0]);
|
|
||||||
key = QString("mpd_artist");
|
|
||||||
setData(source, key, value[1]);
|
|
||||||
key = QString("mpd_progress");
|
|
||||||
setData(source, key, value[2]);
|
|
||||||
key = QString("mpd_duration");
|
|
||||||
setData(source, key, value[3]);
|
|
||||||
key = QString("mpd_title");
|
|
||||||
setData(source, key, value[4]);
|
|
||||||
// qmmp
|
|
||||||
value = getPlayerInfo(QString("qmmp"));
|
|
||||||
key = QString("qmmp_album");
|
|
||||||
setData(source, key, value[0]);
|
|
||||||
key = QString("qmmp_artist");
|
|
||||||
setData(source, key, value[1]);
|
|
||||||
key = QString("qmmp_progress");
|
|
||||||
setData(source, key, value[2]);
|
|
||||||
key = QString("qmmp_duration");
|
|
||||||
setData(source, key, value[3]);
|
|
||||||
key = QString("qmmp_title");
|
|
||||||
setData(source, key, value[4]);
|
|
||||||
}
|
|
||||||
else if (source == QString("ps")) {
|
|
||||||
QStringList value = getPsStats();
|
|
||||||
key = QString("psCount");
|
|
||||||
setData(source, key, value[0].toInt());
|
|
||||||
key = QString("ps");
|
|
||||||
setData(source, key, value[1]);
|
|
||||||
key = QString("psTotal");
|
|
||||||
setData(source, key, value[2].toInt());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
|
|
||||||
|
|
||||||
#include "extsysmon.moc"
|
|
@ -1,56 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* This file is part of pytextmonitor *
|
|
||||||
* *
|
|
||||||
* pytextmonitor 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. *
|
|
||||||
* *
|
|
||||||
* pytextmonitor 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 pytextmonitor. If not, see http://www.gnu.org/licenses/ *
|
|
||||||
***************************************************************************/
|
|
||||||
|
|
||||||
#ifndef EXTSYSMON_H
|
|
||||||
#define EXTSYSMON_H
|
|
||||||
|
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
|
|
||||||
class ExtendedSysMon : public Plasma::DataEngine
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ExtendedSysMon(QObject *parent, const QVariantList &args);
|
|
||||||
// update functions
|
|
||||||
QString getCustomCmd(const QString cmd);
|
|
||||||
float getGpu(const QString device);
|
|
||||||
float getGpuTemp(const QString device);
|
|
||||||
float getHddTemp(const QString device);
|
|
||||||
QStringList getPlayerInfo(const QString playerName,
|
|
||||||
const QString mpdAddress = 0,
|
|
||||||
const QString mpdPort = 0);
|
|
||||||
QStringList getPsStats();
|
|
||||||
int getUpgradeInfo(const QString pkgCommand,
|
|
||||||
const int pkgNull = 0);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
bool sourceRequestEvent(const QString &name);
|
|
||||||
bool updateSourceEvent(const QString &source);
|
|
||||||
QStringList sources() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
// configuration
|
|
||||||
QMap<QString, QString> configuration;
|
|
||||||
// reread configuration
|
|
||||||
QString getAllHdd();
|
|
||||||
QString getAutoGpu();
|
|
||||||
void readConfiguration();
|
|
||||||
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* EXTSYSMON_H */
|
|
57
sources/extsysmon/CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# set project name
|
||||||
|
set (SUBPROJECT plasma_dataengine_extsysmon)
|
||||||
|
set (PLUGIN_NAME ${SUBPROJECT})
|
||||||
|
message (STATUS "Subproject ${SUBPROJECT}")
|
||||||
|
|
||||||
|
# find required libaries
|
||||||
|
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets)
|
||||||
|
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 WindowSystem)
|
||||||
|
|
||||||
|
include (KDEInstallDirs)
|
||||||
|
include (KDECMakeSettings)
|
||||||
|
include (KDECompilerSettings)
|
||||||
|
|
||||||
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||||
|
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||||
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||||
|
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS})
|
||||||
|
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include_directories (${CMAKE_SOURCE_DIR}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||||
|
${PROJECT_TRDPARTY_DIR}
|
||||||
|
${Qt_INCLUDE}
|
||||||
|
${KDE_INCLUDE})
|
||||||
|
|
||||||
|
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
|
||||||
|
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
|
||||||
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
|
||||||
|
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
||||||
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
|
file (GLOB SUBPROJECT_CONF *.conf)
|
||||||
|
set (SUBPROJECT_QUOTES ${CMAKE_CURRENT_SOURCE_DIR}/quotes)
|
||||||
|
set (SUBPROJECT_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/scripts)
|
||||||
|
set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||||
|
|
||||||
|
# prepare
|
||||||
|
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
|
# make
|
||||||
|
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||||
|
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||||
|
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||||
|
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
|
||||||
|
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
|
||||||
|
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||||
|
|
||||||
|
# install
|
||||||
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||||
|
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||||
|
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||||
|
install (DIRECTORY ${SUBPROJECT_QUOTES} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||||
|
install (DIRECTORY ${SUBPROJECT_UPGRADE} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
366
sources/extsysmon/extquotes.cpp
Normal file
@ -0,0 +1,366 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "extquotes.h"
|
||||||
|
#include "ui_extquotes.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, const QStringList directories, const bool debugCmd)
|
||||||
|
: QDialog(parent),
|
||||||
|
m_fileName(quotesName),
|
||||||
|
m_dirs(directories),
|
||||||
|
debug(debugCmd),
|
||||||
|
ui(new Ui::ExtQuotes)
|
||||||
|
{
|
||||||
|
m_name = m_fileName;
|
||||||
|
readConfiguration();
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
values[QString("ask")] = 0.0;
|
||||||
|
values[QString("askchg")] = 0.0;
|
||||||
|
values[QString("percaskchg")] = 0.0;
|
||||||
|
values[QString("bid")] = 0.0;
|
||||||
|
values[QString("bidchg")] = 0.0;
|
||||||
|
values[QString("percbidchg")] = 0.0;
|
||||||
|
values[QString("price")] = 0.0;
|
||||||
|
values[QString("pricechg")] = 0.0;
|
||||||
|
values[QString("percpricechg")] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExtQuotes::~ExtQuotes()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtQuotes::apiVersion()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::comment()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::fileName()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtQuotes::interval()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtQuotes::isActive()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::name()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtQuotes::number()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::tag(const QString _type)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
|
||||||
|
|
||||||
|
return QString("%1%2").arg(_type).arg(m_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::ticker()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_ticker;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setApiVersion(const int _apiVersion)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||||
|
|
||||||
|
m_apiVersion = _apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setActive(const bool state)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||||
|
|
||||||
|
m_active = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setComment(const QString _comment)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||||
|
|
||||||
|
m_comment = _comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setInterval(const int _interval)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||||
|
|
||||||
|
m_interval = _interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setName(const QString _name)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||||
|
|
||||||
|
m_name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setNumber(int _number)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||||
|
if (_number == -1) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||||
|
qsrand(QTime::currentTime().msec());
|
||||||
|
_number = qrand() % 1000;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_number = _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::setTicker(const QString _ticker)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Ticker" << _ticker;
|
||||||
|
|
||||||
|
m_ticker = _ticker;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::readConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
|
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||||
|
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||||
|
setTicker(settings.value(QString("X-AW-Ticker"), m_ticker).toString());
|
||||||
|
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||||
|
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||||
|
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
// update for current API
|
||||||
|
if ((m_apiVersion > 0) && (m_apiVersion < AWEQAPI)) {
|
||||||
|
setApiVersion(AWEQAPI);
|
||||||
|
writeConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QMap<QString, float> ExtQuotes::run()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (!m_active) return values;
|
||||||
|
|
||||||
|
if (times == 1) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Send request";
|
||||||
|
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||||
|
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
|
||||||
|
|
||||||
|
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
|
||||||
|
new QReplyTimeout(reply, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// update value
|
||||||
|
if (times >= m_interval) times = 0;
|
||||||
|
times++;
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtQuotes::showConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
ui->lineEdit_name->setText(m_name);
|
||||||
|
ui->lineEdit_comment->setText(m_comment);
|
||||||
|
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||||
|
ui->lineEdit_ticker->setText(m_ticker);
|
||||||
|
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->spinBox_interval->setValue(m_interval);
|
||||||
|
|
||||||
|
int ret = exec();
|
||||||
|
if (ret != 1) return ret;
|
||||||
|
setName(ui->lineEdit_name->text());
|
||||||
|
setComment(ui->lineEdit_comment->text());
|
||||||
|
setNumber(ui->label_numberValue->text().toInt());
|
||||||
|
setApiVersion(AWEQAPI);
|
||||||
|
setTicker(ui->lineEdit_ticker->text());
|
||||||
|
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||||
|
setInterval(ui->spinBox_interval->value());
|
||||||
|
|
||||||
|
writeConfiguration();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtQuotes::tryDelete()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||||
|
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||||
|
|
||||||
|
// check if exists
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtQuotes::writeConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||||
|
settings.setValue(QString("Name"), m_name);
|
||||||
|
settings.setValue(QString("Comment"), m_comment);
|
||||||
|
settings.setValue(QString("X-AW-Ticker"), m_ticker);
|
||||||
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
|
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||||
|
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||||
|
settings.setValue(QString("X-AW-Number"), m_number);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
|
||||||
|
|
||||||
|
QJsonParseError error;
|
||||||
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
|
||||||
|
reply->deleteLater();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||||
|
if ((reply->error() != QNetworkReply::NoError) ||
|
||||||
|
(error.error != QJsonParseError::NoError)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap();
|
||||||
|
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
|
||||||
|
float value;
|
||||||
|
|
||||||
|
// ask
|
||||||
|
value = jsonQuotes[QString("Ask")].toString().toFloat();
|
||||||
|
values[QString("askchg")] = values[QString("ask")] == 0 ? 0.0 : value - values[QString("ask")];
|
||||||
|
values[QString("percaskchg")] = 100 * values[QString("askchg")] / values[QString("ask")];
|
||||||
|
values[QString("ask")] = value;
|
||||||
|
|
||||||
|
// bid
|
||||||
|
value = jsonQuotes[QString("Bid")].toString().toFloat();
|
||||||
|
values[QString("bidchg")] = values[QString("bid")] == 0 ? 0.0 : value - values[QString("bid")];
|
||||||
|
values[QString("percbidchg")] = 100 * values[QString("bidchg")] / values[QString("bid")];
|
||||||
|
values[QString("bid")] = value;
|
||||||
|
|
||||||
|
// last trade
|
||||||
|
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toFloat();
|
||||||
|
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
|
||||||
|
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
|
||||||
|
values[QString("price")] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtQuotes::url()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString apiUrl = QString(YAHOO_URL);
|
||||||
|
apiUrl.replace(QString("$TICKER"), m_ticker);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
|
||||||
|
|
||||||
|
return apiUrl;
|
||||||
|
}
|
115
sources/extsysmon/extquotes.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef EXTQUOTES_H
|
||||||
|
#define EXTQUOTES_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
|
||||||
|
|
||||||
|
|
||||||
|
class QReplyTimeout : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
QReplyTimeout(QNetworkReply *reply, const int timeout) : QObject(reply)
|
||||||
|
{
|
||||||
|
QTimer::singleShot(timeout, this, SLOT(timeout()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void timeout()
|
||||||
|
{
|
||||||
|
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
|
||||||
|
if (reply->isRunning()) reply->close();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ExtQuotes;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExtQuotes : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
|
||||||
|
Q_PROPERTY(QString name READ name WRITE setName)
|
||||||
|
Q_PROPERTY(QString comment READ comment WRITE setComment)
|
||||||
|
Q_PROPERTY(int interval READ interval WRITE setInterval)
|
||||||
|
Q_PROPERTY(bool active READ isActive WRITE setActive)
|
||||||
|
Q_PROPERTY(int number READ number WRITE setNumber)
|
||||||
|
Q_PROPERTY(QString ticker READ ticker WRITE setTicker)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(),
|
||||||
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
|
~ExtQuotes();
|
||||||
|
// get methods
|
||||||
|
int apiVersion();
|
||||||
|
QString comment();
|
||||||
|
QString fileName();
|
||||||
|
int interval();
|
||||||
|
bool isActive();
|
||||||
|
QString name();
|
||||||
|
int number();
|
||||||
|
QString tag(const QString _type = QString("price"));
|
||||||
|
QString ticker();
|
||||||
|
// set methods
|
||||||
|
void setApiVersion(const int _apiVersion = 0);
|
||||||
|
void setActive(const bool _state = true);
|
||||||
|
void setComment(const QString _comment = QString("empty"));
|
||||||
|
void setInterval(const int _interval = 0);
|
||||||
|
void setName(const QString _name = QString("none"));
|
||||||
|
void setNumber(int _number = -1);
|
||||||
|
void setTicker(const QString _ticker = QString("EURUSD=X"));
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void readConfiguration();
|
||||||
|
QMap<QString, float> run();
|
||||||
|
int showConfiguration();
|
||||||
|
bool tryDelete();
|
||||||
|
void writeConfiguration();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void quotesReplyReceived(QNetworkReply *reply);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString m_fileName;
|
||||||
|
QStringList m_dirs;
|
||||||
|
bool debug;
|
||||||
|
Ui::ExtQuotes *ui;
|
||||||
|
QString url();
|
||||||
|
// properties
|
||||||
|
int m_apiVersion = 0;
|
||||||
|
bool m_active = true;
|
||||||
|
QString m_comment = QString("empty");
|
||||||
|
int m_interval = 60;
|
||||||
|
QString m_name = QString("none");
|
||||||
|
int m_number = -1;
|
||||||
|
QString m_ticker = QString("EURUSD=X");
|
||||||
|
// values
|
||||||
|
int times = 0;
|
||||||
|
QMap<QString, float> values;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* EXTQUOTES_H */
|
240
sources/extsysmon/extquotes.ui
Normal file
@ -0,0 +1,240 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ExtQuotes</class>
|
||||||
|
<widget class="QDialog" name="ExtQuotes">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>420</width>
|
||||||
|
<height>301</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_name">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_name">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Name</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_name"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_comment">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_comment">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Comment</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_comment"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_number">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_number">
|
||||||
|
<property name="text">
|
||||||
|
<string>Tag</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_numberValue">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p>Use YAHOO! finance ticker to get quotes for the instrument. Refer to <a href="http://finance.yahoo.com/"><span style=" text-decoration: underline; color:#0057ae;">http://finance.yahoo.com/</span></a></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_ticker">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_ticker">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ticker</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="lineEdit_ticker"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_active">
|
||||||
|
<item>
|
||||||
|
<spacer name="spacer_active">
|
||||||
|
<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="QCheckBox" name="checkBox_active">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Active</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layout_interval">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_interval">
|
||||||
|
<property name="text">
|
||||||
|
<string>Interval</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="spinBox_interval">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>60</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>ExtQuotes</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>ExtQuotes</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
533
sources/extsysmon/extscript.cpp
Normal file
@ -0,0 +1,533 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of awesome-widgets *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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. *
|
||||||
|
* *
|
||||||
|
* awesome-widgets 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 awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "extscript.h"
|
||||||
|
#include "ui_extscript.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonParseError>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
|
||||||
|
ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringList directories, const bool debugCmd)
|
||||||
|
: QDialog(parent),
|
||||||
|
m_fileName(scriptName),
|
||||||
|
m_dirs(directories),
|
||||||
|
debug(debugCmd),
|
||||||
|
ui(new Ui::ExtScript)
|
||||||
|
{
|
||||||
|
m_name = m_fileName;
|
||||||
|
readConfiguration();
|
||||||
|
readJsonFilters();
|
||||||
|
// init process
|
||||||
|
process = new QProcess(this);
|
||||||
|
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
|
||||||
|
process->waitForFinished(0);
|
||||||
|
// init ui
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExtScript::~ExtScript()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
process->kill();
|
||||||
|
delete process;
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtScript::apiVersion()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::comment()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::executable()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_executable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::fileName()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QStringList ExtScript::filters()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtScript::hasOutput()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtScript::interval()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtScript::isActive()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_active;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::name()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtScript::number()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::prefix()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ExtScript::Redirect ExtScript::redirect()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return m_redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::strRedirect()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString value;
|
||||||
|
switch (m_redirect) {
|
||||||
|
case stdout2stderr:
|
||||||
|
value = QString("stdout2stderr");
|
||||||
|
break;
|
||||||
|
case stderr2stdout:
|
||||||
|
value = QString("stderr2stdout");
|
||||||
|
break;
|
||||||
|
case nothing:
|
||||||
|
default:
|
||||||
|
value = QString("nothing");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::tag()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
return QString("custom%1").arg(m_number);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setApiVersion(const int _apiVersion)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||||
|
|
||||||
|
m_apiVersion = _apiVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setActive(const bool state)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
||||||
|
|
||||||
|
m_active = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setComment(const QString _comment)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||||
|
|
||||||
|
m_comment = _comment;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setExecutable(const QString _executable)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Executable" << _executable;
|
||||||
|
|
||||||
|
m_executable = _executable;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setFilters(const QStringList _filters)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Filters" << _filters;
|
||||||
|
|
||||||
|
for (int i=0; i<_filters.count(); i++)
|
||||||
|
updateFilter(_filters[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setHasOutput(const bool _state)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
|
||||||
|
|
||||||
|
m_output = _state;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setInterval(const int _interval)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
|
||||||
|
if (_interval <= 0) return;
|
||||||
|
|
||||||
|
m_interval = _interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setName(const QString _name)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||||
|
|
||||||
|
m_name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setNumber(int _number)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
|
||||||
|
if (_number == -1) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
|
||||||
|
qsrand(QTime::currentTime().msec());
|
||||||
|
_number = qrand() % 1000;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_number = _number;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setPrefix(const QString _prefix)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Prefix" << _prefix;
|
||||||
|
|
||||||
|
m_prefix = _prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setRedirect(const Redirect _redirect)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Redirect" << _redirect;
|
||||||
|
|
||||||
|
m_redirect = _redirect;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::setStrRedirect(const QString _redirect)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Redirect" << _redirect;
|
||||||
|
|
||||||
|
if (_redirect == QString("stdout2sdterr"))
|
||||||
|
m_redirect = stdout2stderr;
|
||||||
|
else if (_redirect == QString("stderr2sdtout"))
|
||||||
|
m_redirect = stderr2stdout;
|
||||||
|
else
|
||||||
|
m_redirect = nothing;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::applyFilters(QString _value)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Value" << _value;
|
||||||
|
|
||||||
|
for (int i=0; i<m_filters.count(); i++) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Found filter" << m_filters[i];
|
||||||
|
QVariantMap filter = jsonFilters[m_filters[i]].toMap();
|
||||||
|
if (filter.isEmpty()) {
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Could not find filter in the json";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for (int j=0; j<filter.keys().count(); j++)
|
||||||
|
_value.replace(filter.keys()[j], filter[filter.keys()[j]].toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return _value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::updateFilter(const QString _filter, const bool _add)
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Filter" << _filter;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Should be added" << _add;
|
||||||
|
|
||||||
|
if (_add) {
|
||||||
|
if (m_filters.contains(_filter)) return;
|
||||||
|
m_filters.append(_filter);
|
||||||
|
} else {
|
||||||
|
m_filters.removeOne(_filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::readConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
|
setComment(settings.value(QString("Comment"), m_comment).toString());
|
||||||
|
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
|
||||||
|
setExecutable(settings.value(QString("Exec"), m_executable).toString());
|
||||||
|
setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString());
|
||||||
|
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
|
||||||
|
setHasOutput(settings.value(QString("X-AW-Output"), QVariant(m_output)).toString() == QString("true"));
|
||||||
|
setStrRedirect(settings.value(QString("X-AW-Redirect"), strRedirect()).toString());
|
||||||
|
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
|
||||||
|
// api == 2
|
||||||
|
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
|
||||||
|
// api == 3
|
||||||
|
setFilters(settings.value(QString("X-AW-Filters"), m_filters).toString()
|
||||||
|
.split(QChar(','), QString::SkipEmptyParts));
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!m_output)
|
||||||
|
setRedirect(stdout2stderr);
|
||||||
|
|
||||||
|
// update for current API
|
||||||
|
if ((m_apiVersion > 0) && (m_apiVersion < AWESAPI)) {
|
||||||
|
setApiVersion(AWESAPI);
|
||||||
|
writeConfiguration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::readJsonFilters()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
|
||||||
|
QString("awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
|
QFile jsonFile(fileName);
|
||||||
|
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
return;
|
||||||
|
QString jsonText = jsonFile.readAll();
|
||||||
|
jsonFile.close();
|
||||||
|
|
||||||
|
QJsonParseError error;
|
||||||
|
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
|
||||||
|
if (error.error != QJsonParseError::NoError)
|
||||||
|
return;
|
||||||
|
jsonFilters = jsonDoc.toVariant().toMap();
|
||||||
|
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Filters" << jsonFilters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString ExtScript::run()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
if (!m_active) return value;
|
||||||
|
|
||||||
|
if ((times == 1) && (process->state() == QProcess::NotRunning)) {
|
||||||
|
QStringList cmdList;
|
||||||
|
if (!m_prefix.isEmpty()) cmdList.append(m_prefix);
|
||||||
|
cmdList.append(m_executable);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' '));
|
||||||
|
process->start(cmdList.join(QChar(' ')));
|
||||||
|
} else if (times >= m_interval)
|
||||||
|
times = 0;
|
||||||
|
times++;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ExtScript::showConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
ui->lineEdit_name->setText(m_name);
|
||||||
|
ui->lineEdit_comment->setText(m_comment);
|
||||||
|
ui->label_numberValue->setText(QString("%1").arg(m_number));
|
||||||
|
ui->lineEdit_command->setText(m_executable);
|
||||||
|
ui->lineEdit_prefix->setText(m_prefix);
|
||||||
|
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
|
||||||
|
ui->spinBox_interval->setValue(m_interval);
|
||||||
|
// filters
|
||||||
|
ui->checkBox_colorFilter->setCheckState(m_filters.contains(QString("color")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->checkBox_linesFilter->setCheckState(m_filters.contains(QString("newline")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
ui->checkBox_spaceFilter->setCheckState(m_filters.contains(QString("space")) ? Qt::Checked : Qt::Unchecked);
|
||||||
|
|
||||||
|
int ret = exec();
|
||||||
|
if (ret != 1) return ret;
|
||||||
|
setName(ui->lineEdit_name->text());
|
||||||
|
setComment(ui->lineEdit_comment->text());
|
||||||
|
setNumber(ui->label_numberValue->text().toInt());
|
||||||
|
setApiVersion(AWESAPI);
|
||||||
|
setExecutable(ui->lineEdit_command->text());
|
||||||
|
setPrefix(ui->lineEdit_prefix->text());
|
||||||
|
setActive(ui->checkBox_active->checkState() == Qt::Checked);
|
||||||
|
setHasOutput(ui->checkBox_output->checkState() == Qt::Checked);
|
||||||
|
setStrRedirect(ui->comboBox_redirect->currentText());
|
||||||
|
setInterval(ui->spinBox_interval->value());
|
||||||
|
// filters
|
||||||
|
updateFilter(QString("color"), ui->checkBox_colorFilter->checkState() == Qt::Checked);
|
||||||
|
updateFilter(QString("newline"), ui->checkBox_linesFilter->checkState() == Qt::Checked);
|
||||||
|
updateFilter(QString("space"), ui->checkBox_spaceFilter->checkState() == Qt::Checked);
|
||||||
|
|
||||||
|
writeConfiguration();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ExtScript::tryDelete()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||||
|
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||||
|
|
||||||
|
// check if exists
|
||||||
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
|
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::writeConfiguration()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
|
settings.setValue(QString("Encoding"), QString("UTF-8"));
|
||||||
|
settings.setValue(QString("Name"), m_name);
|
||||||
|
settings.setValue(QString("Comment"), m_comment);
|
||||||
|
settings.setValue(QString("Exec"), m_executable);
|
||||||
|
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
|
||||||
|
settings.setValue(QString("X-AW-Prefix"), m_prefix);
|
||||||
|
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
|
||||||
|
settings.setValue(QString("X-AW-Output"), QVariant(m_output).toString());
|
||||||
|
settings.setValue(QString("X-AW-Redirect"), strRedirect());
|
||||||
|
settings.setValue(QString("X-AW-Interval"), m_interval);
|
||||||
|
settings.setValue(QString("X-AW-Number"), m_number);
|
||||||
|
settings.setValue(QString("X-AW-Filters"), m_filters.join(QChar(',')));
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
settings.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ExtScript::updateValue()
|
||||||
|
{
|
||||||
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process->exitCode();
|
||||||
|
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardError()).trimmed();
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Error" << qdebug;
|
||||||
|
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
|
||||||
|
|
||||||
|
switch (m_redirect) {
|
||||||
|
case stdout2stderr:
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Debug" << qdebug;
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
|
||||||
|
break;
|
||||||
|
case stderr2stdout:
|
||||||
|
value = QString("%1\t%2").arg(qdebug).arg(qoutput);
|
||||||
|
break;
|
||||||
|
case nothing:
|
||||||
|
default:
|
||||||
|
if (debug) qDebug() << PDEBUG << ":" << "Debug" << qdebug;
|
||||||
|
value = qoutput;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// filters
|
||||||
|
value = applyFilters(value);
|
||||||
|
}
|