Compare commits
282 Commits
Author | SHA1 | Date | |
---|---|---|---|
d01fb91e36 | |||
61ed3a444f | |||
494590475a | |||
27ab7d9cd7 | |||
1869a68122 | |||
aa0a4b417d | |||
41deb8ef72 | |||
aa15e13713 | |||
ad63f78929 | |||
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 |
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
|
1
AUTHORS
@ -6,3 +6,4 @@ Translators:
|
||||
Ernesto Avilés Vzqz (Spanish translation)
|
||||
@underr (Brazillian Portuguese translation)
|
||||
Виктор Слободян (Ukrainian translation)
|
||||
Steve Lemuel (Chinese translation)
|
||||
|
298
CHANGELOG
@ -1,3 +1,145 @@
|
||||
Ver.2.3.3:
|
||||
* change text rendering from Qt to native
|
||||
|
||||
Ver.2.3.2:
|
||||
+ change network speed units from KB/s to MB/s if value is more than 1000 KB/s (metrics are the same)
|
||||
- fix bug with no actions on link activation (thanks to infans)
|
||||
* improve quotes support, e.g. fix plasma crash
|
||||
* rewrite main widget to signal-slot update model
|
||||
* improve battery calculation for system which has several batteries
|
||||
|
||||
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
|
||||
|
||||
@ -7,61 +149,61 @@ Ver.1.10.1:
|
||||
- fix checking of qmmp
|
||||
|
||||
Ver.1.10.0:
|
||||
+ added tags $hddtotmb, $hddtotgb
|
||||
+ added tags $memtotmb, $memtotgb, $swaptotmb, $swaptotgb
|
||||
+ added ability for force update text
|
||||
+ added support of clementine
|
||||
+ added support of hddtemp cmd
|
||||
+ added support of disable option for HDDDEV and GPUDEV
|
||||
+ added error checking of DataEngine variables
|
||||
+ added multithreading to DataEngine
|
||||
+ added ability to disable popup messages
|
||||
+ added ability to use vertical layout
|
||||
+ added ability to add stretch
|
||||
+ added ability to show debug information (set environment variable 'PTM_DEBUG' to 'yes')
|
||||
+ added Brazillian Portuguese translation (@underr)
|
||||
+ added Ukrainian translation (Виктор Слободян)
|
||||
- removed util.py
|
||||
- removed createNotifyrc since it isn't needed
|
||||
+ 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
|
||||
* edited readme call
|
||||
* changed readme from md to html
|
||||
* player settings was moved from plasmoid to DataEngine
|
||||
* edit readme call
|
||||
* change readme from md to html
|
||||
|
||||
Ver.1.9.0:
|
||||
+ added support of several custom commands ($customN)
|
||||
+ added hdd speed label ($hddrN, $hddwN)
|
||||
+ added actions to context menu (open readme and run ksysguard)
|
||||
- removed doubleclick event
|
||||
+ 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:
|
||||
+ added Spanish translation (thanks to Ernesto Avilés Vzqz)
|
||||
+ added readme to the package
|
||||
+ add Spanish translation (thanks to Ernesto Avilés Vzqz)
|
||||
+ add readme to the package
|
||||
|
||||
Ver.1.8.2:
|
||||
+ added different temperature units (Farenheit and Kelvin)
|
||||
+ add different temperature units (Farenheit and Kelvin)
|
||||
|
||||
Ver.1.8.1:
|
||||
* change pkg update time to hour
|
||||
|
||||
Ver.1.8.0:
|
||||
+ added scrollbar to configuration interface
|
||||
+ added AC lines configuration
|
||||
+ added $hddmbN, %hddgbN tags
|
||||
+ added support of ps ($ps, $pscount, $pstotal tags)
|
||||
+ added support of package managers ($pkgcountN tags)
|
||||
+ add scrollbar to configuration interface
|
||||
+ add AC lines configuration
|
||||
+ add $hddmbN, $hddgbN tags
|
||||
+ add support of ps ($ps, $pscount, $pstotal tags)
|
||||
+ add support of package managers ($pkgcountN tags)
|
||||
* refactoring of DataEngine
|
||||
|
||||
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
|
||||
* changes in custom uptime format
|
||||
|
||||
Ver.1.7.3:
|
||||
+ added tags $memgb, $swapgb
|
||||
+ added readme directory
|
||||
+ added french translation (@Mermouy)
|
||||
+ add tags $memgb, $swapgb
|
||||
+ add readme directory
|
||||
+ add french translation (@Mermouy)
|
||||
- fix tooltip for custom uptime format
|
||||
- fix #12
|
||||
* more refactoring to the god of refactoring
|
||||
@ -70,108 +212,108 @@ Ver.1.7.3:
|
||||
* player_name now has str type
|
||||
|
||||
Ver.1.7.2:
|
||||
+ added tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
||||
+ added scalling to tooltips
|
||||
+ added dataengine configuration from ptm
|
||||
+ added custom command to dataengine
|
||||
- removed custom command from ptm
|
||||
- removed tags $ds, $hs, $ms
|
||||
+ add tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
||||
+ add scalling to tooltips
|
||||
+ add DataEngine configuration from ptm
|
||||
+ add custom command to DataEngine
|
||||
- remove custom command from ptm
|
||||
- remove tags $ds, $hs, $ms
|
||||
|
||||
Ver.1.7.1:
|
||||
- removed error label
|
||||
- remove error label
|
||||
* fix bug with zero values in tooltip
|
||||
|
||||
Ver.1.7.0:
|
||||
+ added support of several tags in temperature label
|
||||
+ added tags $cpuN, $cpuclN, $hddN, $tempN, $hddtempN, $up, $down
|
||||
+ added label with custom command
|
||||
+ added tooltips for CPU, CPU clock, memory, swap and network labels
|
||||
- removed tags @@...@@, $temp, $ccpu, $ccpucl, $net
|
||||
+ add support of several tags in temperature label
|
||||
+ add tags $cpuN, $cpuclN, $hddN, $tempN, $hddtempN, $up, $down
|
||||
+ add label with custom command
|
||||
+ add tooltips for CPU, CPU clock, memory, swap and network labels
|
||||
- remove tags @@...@@, $temp, $ccpu, $ccpucl, $net
|
||||
* changes in settings
|
||||
* ptm now does not require net-tools
|
||||
* refactoring
|
||||
|
||||
Ver.1.6.1:
|
||||
+ added support of several devices in hddtemp label
|
||||
+ add support of several devices in hddtemp label
|
||||
- fixed #6
|
||||
|
||||
Ver.1.6.0:
|
||||
+ added $custom tag to time and uptime labels (#8)
|
||||
+ add $custom tag to time and uptime labels (#8)
|
||||
+ russian translation
|
||||
- fixed #6, #10
|
||||
* changed license to GPLv3
|
||||
* changed project build
|
||||
- fix #6, #10
|
||||
* change license to GPLv3
|
||||
* change project build
|
||||
|
||||
Ver.1.5.3:
|
||||
+ added $album, $progress and $time tags to player label (#7)
|
||||
- fixed zero swap
|
||||
+ add $album, $progress and $time tags to player label (#7)
|
||||
- fix zero swap
|
||||
|
||||
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:
|
||||
+ added time label
|
||||
+ add time label
|
||||
|
||||
Ver.1.5.0:
|
||||
+ added player label
|
||||
+ add player label
|
||||
|
||||
Ver.1.4.0:
|
||||
+ added notifications
|
||||
+ add notifications
|
||||
|
||||
Ver.1.3.6:
|
||||
- fixed #1, #2
|
||||
- fix #1, #2
|
||||
|
||||
Ver.1.3.5:
|
||||
- fix bug with definition network device
|
||||
|
||||
Ver.1.3.4:
|
||||
+ added double click event
|
||||
+ added auto selection of network device
|
||||
- fixed yet another plasma crash
|
||||
+ add double click event
|
||||
+ add auto selection of network device
|
||||
- fix yet another plasma crash
|
||||
|
||||
Ver.1.3.3:
|
||||
* edited reading temperature device
|
||||
* edit reading temperature device
|
||||
|
||||
Ver.1.3.2b:
|
||||
- fixed plasma crash
|
||||
- fix plasma crash
|
||||
|
||||
Ver.1.3.2:
|
||||
+ added GPU, GPU temperature, HDD and HDD temperature labels
|
||||
+ added $ccpu and $ccpucl tags
|
||||
+ add GPU, GPU temperature, HDD and HDD temperature labels
|
||||
+ add $ccpu and $ccpucl tags
|
||||
- bug fixes
|
||||
* optimization and refactoring
|
||||
|
||||
Ver.1.2.2:
|
||||
+ added tooltip to lineEdit
|
||||
+ add tooltip to lineEdit
|
||||
|
||||
Ver.1.2.1:
|
||||
* if battery doesn't exist return 'off'
|
||||
* if AC doesn't exist return '(?)'
|
||||
|
||||
Ver.1.2.0:
|
||||
+ added $ac tag to battery label
|
||||
+ added battery and ac device configurations
|
||||
+ added error cheking
|
||||
+ add $ac tag to battery label
|
||||
+ add battery and ac device configurations
|
||||
+ add error cheking
|
||||
* $bat tag now reading from /sys/*
|
||||
|
||||
Ver.1.1.4:
|
||||
* changed parsing acpi output (battery label)
|
||||
* change parsing acpi output (battery label)
|
||||
|
||||
Ver.1.1.3:
|
||||
+ added font weight
|
||||
* edited font setup line. Now setup for font family works normaly
|
||||
+ add font weight
|
||||
* edit font setup line. Now setup for font family works normaly
|
||||
* small bug fix
|
||||
|
||||
Ver.1.1.2:
|
||||
+ added CPU clock lable
|
||||
+ added function to update network device (100*time_interval)
|
||||
+ changed update sliders
|
||||
+ add CPU clock lable
|
||||
+ add function to update network device (100*time_interval)
|
||||
+ change update sliders
|
||||
|
||||
Ver.1.1.1:
|
||||
+ added $swapmb, $memmb, $netdev, @@netdev=...@@ tags
|
||||
+ add $swapmb, $memmb, $netdev, @@netdev=...@@ tags
|
||||
- some bug fixes
|
||||
* widget consists of several labels
|
||||
* edited configuration interface
|
||||
* edit configuration interface
|
||||
|
||||
Ver.1.0:
|
||||
First release
|
||||
|
144
CHANGELOG-RU
@ -1,3 +1,145 @@
|
||||
Вер.2.3.3:
|
||||
* изменен рендеринг с Qt на нативный
|
||||
|
||||
Вер.2.3.2:
|
||||
+ добавлено изменение скорости интернета с KB/s на MB/s, если величина более 1000 KB/s
|
||||
- пофикшен баг с отсутствием действия при активации ссылки (спасибо infans)
|
||||
* улучшена поддержка котировок, например пофикшен возможный сегфолт плазмы
|
||||
* переписать основной виджет к модели сигнал-слот
|
||||
* улучшена поддержка расчета заряда батареи для нескольких батарей
|
||||
|
||||
Вер.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
|
||||
|
||||
@ -24,7 +166,7 @@
|
||||
- удален util.py
|
||||
- удалены функции createNotifyrc, поскольку они больше не нужны
|
||||
* рефакторинг конфигурационного интерфейса
|
||||
* настройки плеера были перенесены из виджета в dataengine
|
||||
* настройки плеера были перенесены из виджета в DataEngine
|
||||
* исправлен вызов readme под четырехсимвольное обозначение
|
||||
* перенос readme с md на html
|
||||
|
||||
|
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
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
pytextmonitor
|
||||
awesome-widgets
|
||||
Copyright (C) 2013-2014 Evgeniy Alekseev
|
||||
|
||||
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
|
||||
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 is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
43
PKGBUILD
@ -1,43 +0,0 @@
|
||||
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
|
||||
|
||||
pkgname=kdeplasma-applets-pytextmonitor
|
||||
_pkgname=pytextmonitor
|
||||
pkgver=1.10.2
|
||||
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=('GPL3')
|
||||
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors')
|
||||
optdepends=("amarok: for music player monitor"
|
||||
"clementine: 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=('62b7cb57cb996282bb7decc2dbdf27c1')
|
||||
backup=('usr/share/config/extsysmon.conf')
|
||||
|
||||
prepare() {
|
||||
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
|
||||
}
|
251
README.md
@ -1,217 +1,25 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
awesome-widgets (ex-pytextmonitor)
|
||||
==================================
|
||||
|
||||
Information
|
||||
-----------
|
||||
|
||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
||||
A collection of minimalistic widgets which looks like Awesome Window Manager widgets.
|
||||
|
||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/awesome-widgets/issues/14)
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
Features
|
||||
========
|
||||
|
||||
For edited output you must open Settings window and setup output format in lines:
|
||||
* 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
|
||||
|
||||
* 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 `$memtotmb` - total RAM, *MB*
|
||||
* tag `$memtotgb` - total RAM, *GB*
|
||||
* tag `$swap` - swap, *%*
|
||||
* tag `$swapmb` - swap, *MB*
|
||||
* tag `$swapgb` - swap, *GB*
|
||||
* tag `$swaptotmb` - total swap, *MB*
|
||||
* tag `$swaptotgb` - total swap, *GB*
|
||||
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
|
||||
* tag `$hddmbN` - usage for mount point N, *MB*. For example, `$hddmb0`
|
||||
* tag `$hddgbN` - usage for mount point N, *GB*. For example, `$hddgb0`
|
||||
* tag `$hddtotmbN` - total size of mount point N, *MB*. For example, `$hddtotmb0`
|
||||
* tag `$hddtotgbN` - total size of mount point N, *GB*. For example, `$hddtotgb0`
|
||||
* tag `$hddrN` - read speed of disk N, *KB/s*. For example, `$hddr0`
|
||||
* tag `$hddwN` - write speed of disk N, *KB/s*. For example, `$hddw0`
|
||||
* 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 `$customN` - returns output for custom command N. For example, `$custom0`
|
||||
See [links](#Links) for more details.
|
||||
|
||||
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**.
|
||||
|
||||
Tips & tricks
|
||||
-------------
|
||||
|
||||
You may use different colors for labels. Just put label text into html code. See [issue](https://github.com/arcan1s/pytextmonitor/issues/9) for more details.
|
||||
|
||||
Numbering of elements of temperature, HDD usage, HDD speed, HDD temperature refers to elements order from second tab (*Advanced settings*). You should add item to the required listWidget first. And the first element in the listWidget will be `$tag0`. See [issue](https://github.com/arcan1s/pytextmonitor/issues/17) for more details.
|
||||
|
||||
Advanced settings
|
||||
-----------------
|
||||
|
||||
**Vertical layout**
|
||||
|
||||
Use vertical layout instead of horizontal one.
|
||||
|
||||
**Enable popup**
|
||||
|
||||
Uncheck box if you do not use popup messages.
|
||||
|
||||
**Add stretch**
|
||||
|
||||
Add stretch (spacer) to the selected side of the widget.
|
||||
|
||||
**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 units**
|
||||
|
||||
Select units for temperature. Available units are Celsius, Farenheit and Kelvin.
|
||||
|
||||
**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 (speed)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddspeed label (combo box items come from DataEngine). List widget is editable, delete key will remove current item.
|
||||
|
||||
**HDD (temperature)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddtemp 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.
|
||||
|
||||
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.
|
||||
|
||||
Commands, which will be run for custom label.
|
||||
|
||||
**GPU device**
|
||||
|
||||
Select one of supported GPU devices. `auto` will enable auto selection, `disable` will disable definition of GPU states. Default is `auto`.
|
||||
|
||||
**HDD**
|
||||
|
||||
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices, `disable` will disable definition of HDD temperature. Default is `all`.
|
||||
|
||||
**hddtemp cmd**
|
||||
|
||||
Type a command which will be run for hddtemp DataEngine. Default is `sudo hddtemp`.
|
||||
|
||||
**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`
|
||||
|
||||
**Music player**
|
||||
|
||||
Select one of supported music playes for player label.
|
||||
|
||||
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.
|
||||
**Didn't find required feature?** [Just ask for it!](https://github.com/arcan1s/awesome-widgets/issues)
|
||||
|
||||
Instruction
|
||||
===========
|
||||
@ -219,23 +27,21 @@ Instruction
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
* kdebase-workspace
|
||||
* kdebindings-python2
|
||||
* lm_sensors (*for definition temperature device*)
|
||||
* plasma-framework
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
|
||||
* sysstat (*for notification*)
|
||||
* 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, clementine, mpd or qmmp)
|
||||
* hddtemp
|
||||
* smartmontools
|
||||
* music player (mpd or supported MPRIS)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
* extra-cmake-modules
|
||||
|
||||
Installation
|
||||
------------
|
||||
@ -244,25 +50,26 @@ Installation
|
||||
* 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` ../
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||
make && sudo make install
|
||||
|
||||
**NOTE** on Plasma 5 it may require `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||
|
||||
Additional information
|
||||
======================
|
||||
|
||||
TODO (wish list)
|
||||
----------------
|
||||
|
||||
See [milestones](https://github.com/arcan1s/awesome-widgets/milestones) for more details.
|
||||
|
||||
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)
|
||||
* 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/search?q=awesome-widgets) packages, [KF5 OpenSuse](http://software.opensuse.org/package/plasma5-awesome-widgets) package
|
||||
|
268
README.md.orig
@ -1,268 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Information
|
||||
-----------
|
||||
|
||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
||||
|
||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
|
||||
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 `$memtotmb` - total RAM, *MB*
|
||||
* tag `$memtotgb` - total RAM, *GB*
|
||||
* tag `$swap` - swap, *%*
|
||||
* tag `$swapmb` - swap, *MB*
|
||||
* tag `$swapgb` - swap, *GB*
|
||||
* tag `$swaptotmb` - total swap, *MB*
|
||||
* tag `$swaptotgb` - total swap, *GB*
|
||||
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
|
||||
* tag `$hddmbN` - usage for mount point N, *MB*. For example, `$hddmb0`
|
||||
* tag `$hddgbN` - usage for mount point N, *GB*. For example, `$hddgb0`
|
||||
* tag `$hddtotmbN` - total size of mount point N, *MB*. For example, `$hddtotmb0`
|
||||
* tag `$hddtotgbN` - total size of mount point N, *GB*. For example, `$hddtotgb0`
|
||||
* tag `$hddrN` - read speed of disk N, *KB/s*. For example, `$hddr0`
|
||||
* tag `$hddwN` - write speed of disk N, *KB/s*. For example, `$hddw0`
|
||||
* 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 `$customN` - returns output for custom command N. For example, `$custom0`
|
||||
|
||||
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**.
|
||||
|
||||
Tips & tricks
|
||||
-------------
|
||||
|
||||
You may use different colors for labels. Just put label text into html code. See [issue](https://github.com/arcan1s/pytextmonitor/issues/9) for more details.
|
||||
|
||||
Numbering of elements of temperature, HDD usage, HDD speed, HDD temperature refers to elements order from second tab (*Advanced settings*). You should add item to the required listWidget first. And the first element in the listWidget will be `$tag0`. See [issue](https://github.com/arcan1s/pytextmonitor/issues/17) for more details.
|
||||
|
||||
Advanced settings
|
||||
-----------------
|
||||
|
||||
**Vertical layout**
|
||||
|
||||
Use vertical layout instead of horizontal one.
|
||||
|
||||
**Enable popup**
|
||||
|
||||
Uncheck box if you do not use popup messages.
|
||||
|
||||
**Add stretch**
|
||||
|
||||
Add stretch (spacer) to the selected side of the widget.
|
||||
|
||||
**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 units**
|
||||
|
||||
Select units for temperature. Available units are Celsius, Farenheit and Kelvin.
|
||||
|
||||
**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 (speed)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddspeed label (combo box items come from DataEngine). List widget is editable, delete key will remove current item.
|
||||
|
||||
**HDD (temperature)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddtemp 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.
|
||||
|
||||
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.
|
||||
|
||||
Commands, which will be run for custom label.
|
||||
|
||||
**GPU device**
|
||||
|
||||
Select one of supported GPU devices. `auto` will enable auto selection, `disable` will disable definition of GPU states. Default is `auto`.
|
||||
|
||||
**HDD**
|
||||
|
||||
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices, `disable` will disable definition of HDD temperature. Default is `all`.
|
||||
|
||||
**hddtemp cmd**
|
||||
|
||||
Type a command which will be run for hddtemp DataEngine. Default is `sudo hddtemp`.
|
||||
|
||||
**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`
|
||||
|
||||
**Music player**
|
||||
|
||||
Select one of supported music playes for player label.
|
||||
|
||||
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*)
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
|
||||
* sysstat (*for notification*)
|
||||
* 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, clementine, mpd or qmmp)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
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
|
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.3
|
||||
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=('a40592d66d9b5149fc7d470dc3e355cb')
|
||||
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
|
||||
|
||||
./update_files.sh
|
||||
|
||||
SRCDIR="sources"
|
||||
MAJOR=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||
MINOR=$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | sed 's/.$//g')
|
||||
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
|
||||
ARCHIVE="ext-sysmon"
|
||||
ARCHIVE="extsysmon"
|
||||
# create archive
|
||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f ${ARCHIVE}-${VERSION}-src.tar.xz
|
||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||
@ -18,9 +19,9 @@ tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
||||
rm -rf "${ARCHIVE}"
|
||||
|
||||
# build widget
|
||||
ARCHIVE="pytextmonitor"
|
||||
ARCHIVE="awesome-widgets"
|
||||
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
|
||||
IGNORELIST="build usr"
|
||||
IGNORELIST="build usr .kdev4 *.kdev4"
|
||||
# create archive
|
||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||
@ -28,9 +29,13 @@ cp -r "${SRCDIR}" "${ARCHIVE}"
|
||||
for FILE in ${FILES[*]}; do cp -r "$FILE" "${ARCHIVE}"; done
|
||||
for FILE in ${IGNORELIST[*]}; do rm -rf "${ARCHIVE}/${FILE}"; done
|
||||
tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
|
||||
ln -sf "../${ARCHIVE}-${VERSION}-src.tar.xz" arch
|
||||
rm -rf "${ARCHIVE}"
|
||||
|
||||
# update md5sum
|
||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" PKGBUILD
|
||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" PKGBUILD
|
||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/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,18 +0,0 @@
|
||||
func_update() {
|
||||
cat << EOF
|
||||
Update plasmoids...
|
||||
EOF
|
||||
kbuildsycoca4 > /dev/null 2>&1
|
||||
}
|
||||
|
||||
post_install() {
|
||||
func_update
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
func_update
|
||||
}
|
||||
|
||||
post_remove() {
|
||||
func_update
|
||||
}
|
268
md_readme/en.md
@ -1,268 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Information
|
||||
-----------
|
||||
|
||||
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
|
||||
|
||||
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
|
||||
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 `$memtotmb` - total RAM, *MB*
|
||||
* tag `$memtotgb` - total RAM, *GB*
|
||||
* tag `$swap` - swap, *%*
|
||||
* tag `$swapmb` - swap, *MB*
|
||||
* tag `$swapgb` - swap, *GB*
|
||||
* tag `$swaptotmb` - total swap, *MB*
|
||||
* tag `$swaptotgb` - total swap, *GB*
|
||||
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
|
||||
* tag `$hddmbN` - usage for mount point N, *MB*. For example, `$hddmb0`
|
||||
* tag `$hddgbN` - usage for mount point N, *GB*. For example, `$hddgb0`
|
||||
* tag `$hddtotmbN` - total size of mount point N, *MB*. For example, `$hddtotmb0`
|
||||
* tag `$hddtotgbN` - total size of mount point N, *GB*. For example, `$hddtotgb0`
|
||||
* tag `$hddrN` - read speed of disk N, *KB/s*. For example, `$hddr0`
|
||||
* tag `$hddwN` - write speed of disk N, *KB/s*. For example, `$hddw0`
|
||||
* 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 `$customN` - returns output for custom command N. For example, `$custom0`
|
||||
|
||||
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**.
|
||||
|
||||
Tips & tricks
|
||||
-------------
|
||||
|
||||
You may use different colors for labels. Just put label text into html code. See [issue](https://github.com/arcan1s/pytextmonitor/issues/9) for more details.
|
||||
|
||||
Numbering of elements of temperature, HDD usage, HDD speed, HDD temperature refers to elements order from second tab (*Advanced settings*). You should add item to the required listWidget first. And the first element in the listWidget will be `$tag0`. See [issue](https://github.com/arcan1s/pytextmonitor/issues/17) for more details.
|
||||
|
||||
Advanced settings
|
||||
-----------------
|
||||
|
||||
**Vertical layout**
|
||||
|
||||
Use vertical layout instead of horizontal one.
|
||||
|
||||
**Enable popup**
|
||||
|
||||
Uncheck box if you do not use popup messages.
|
||||
|
||||
**Add stretch**
|
||||
|
||||
Add stretch (spacer) to the selected side of the widget.
|
||||
|
||||
**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 units**
|
||||
|
||||
Select units for temperature. Available units are Celsius, Farenheit and Kelvin.
|
||||
|
||||
**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 (speed)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddspeed label (combo box items come from DataEngine). List widget is editable, delete key will remove current item.
|
||||
|
||||
**HDD (temperature)**
|
||||
|
||||
List of hard disk devices, which will be observed in hddtemp 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.
|
||||
|
||||
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.
|
||||
|
||||
Commands, which will be run for custom label.
|
||||
|
||||
**GPU device**
|
||||
|
||||
Select one of supported GPU devices. `auto` will enable auto selection, `disable` will disable definition of GPU states. Default is `auto`.
|
||||
|
||||
**HDD**
|
||||
|
||||
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices, `disable` will disable definition of HDD temperature. Default is `all`.
|
||||
|
||||
**hddtemp cmd**
|
||||
|
||||
Type a command which will be run for hddtemp DataEngine. Default is `sudo hddtemp`.
|
||||
|
||||
**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`
|
||||
|
||||
**Music player**
|
||||
|
||||
Select one of supported music playes for player label.
|
||||
|
||||
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*)
|
||||
|
||||
Optional dependencies
|
||||
---------------------
|
||||
|
||||
* sysstat (*for notification*)
|
||||
* 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, clementine, mpd or qmmp)
|
||||
|
||||
Make dependencies
|
||||
-----------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
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
|
245
md_readme/es.md
@ -1,245 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Información
|
||||
-----------
|
||||
PyTextMonitor es un plasmoide minimalista escrito en Python2. Luce como los componentes visuales de awesome-wm.
|
||||
|
||||
**NOTA** [¡Se buscan traductores!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
|
||||
Configuración
|
||||
-------------
|
||||
|
||||
Para editar la visualización debes abrir la ventana de Ajustes y establecer el formato de visualización en líneas:
|
||||
|
||||
* etiqueta `$time` - hora en formato por defecto. Por ejemplo, *vie 06 Nov 04:48:01 2013*
|
||||
* etiqueta `$isotime` - hora en formato ISO
|
||||
* etiqueta `$shorttime` - hora en formato local corto
|
||||
* etiqueta `$longtime` - hora en formato local largo
|
||||
* etiqueta `$custom` - formato de hora personalizado
|
||||
* etiqueta `$uptime` - tiempo de actividad del sistema, *---d--h--m*
|
||||
* etiqueta `$custom` - formato personalizado del tiempo de actividad del sistema
|
||||
* etiqueta `$cpu` - carga total de la CPU, *%*
|
||||
* etiqueta `$cpuN` - carga de la CPU para el núcleo N, *%*
|
||||
* etiqueta `$cpucl` - frecuencia promedio de la CPU, *MHz*
|
||||
* etiqueta `$cpuclN` - frecuencia de la CPU para el núcleo N, *MHz*
|
||||
* etiqueta `$tempN` - temperatura para el dispositivo N. Por ejemplo, `$temp0`
|
||||
* etiqueta `$gpu` - uso de la GPU, *%*. Debe estar instalado `aticonfig` o `nvidia-smi`
|
||||
* etiqueta `$gputemp` - temperatura de la GPU. Debe estar instalado `aticonfig` o `nvidia-smi`
|
||||
* etiqueta `$mem` - uso de la memoria, *%*
|
||||
* etiqueta `$memmb` - uso de la memoria, *MB*
|
||||
* etiqueta `$memgb` - uso de la memoria, *GB*
|
||||
* etiqueta `$memtotmb` - uso total de memoria, *MB*
|
||||
* etiqueta `$memtotgb` - uso total de memoria, *GB*
|
||||
* etiqueta `$swap` - swap, *%*
|
||||
* etiqueta `$swapmb` - swap, *MB*
|
||||
* etiqueta `$swapgb` - swap, *GB*
|
||||
* etiqueta `$swaptotmb` - uso total de swap, *MB*
|
||||
* etiqueta `$swaptotgb` - uso total de swap, *GB*
|
||||
* etiqueta `$hddN` - uso para el punto de montaje N, *%*. Por ejemplo, `$hdd0`
|
||||
* etiqueta `$hddmbN` - uso para el punto de montaje N, *MB*. Por ejemplo, `$hddmb0`
|
||||
* etiqueta `$hddgbN` - uso para el punto de montaje N, *GB*. Por ejemplo, `$hddgb0`
|
||||
* etiqueta `$hddtotmbN` - tamaño completo del punto de montaje N, *MB*. Por ejemplo, `$hddtotmb0`
|
||||
* etiqueta `$hddtotgbN` - tamaño completo del punto de montaje N, *GB*. Por ejemplo, `$hddtotgb0`
|
||||
* etiqueta `$hddrN` - leer la velocidad del disco N, *KB/s*. Por ejemplo, `$hddr0`
|
||||
* etiqueta `$hddwN` - velocidad de escritura del disco N, *KB/s*. Por ejemplo: `$hddw0`
|
||||
* etiqueta `$hddtempN` - temperatura para el disco duro N. Por ejemplo, `$hddtemp0`
|
||||
|
||||
**NOTA** no puedes establecer la etiqueta `$cpu` para que se muestre en la información de la swap, por citar un ejemplo. **`$cpu` solo funcionará en la etiqueta de la CPU**.
|
||||
|
||||
Trucos
|
||||
------
|
||||
|
||||
Es posible usar diferentes colores para las etiquetas. Solo tienes que ponerles el texto en formato HTML. Para más detalles, ver [el tema](https://github.com/arcan1s/pytextmonitor/issues/9) relacionado.
|
||||
|
||||
La enumeración de los elementos de temperatura, uso del disco duro, velocidad del disco duro y la temperatura del disco duro, se refiere al orden de los elementos de la segunda pestaña (*Ajustes avanzados*). Primeramente deberías añadir el elemento a la lista requerida. El primer elemento de la lista será $tag0. Para más información, ver [el tema](https://github.com/arcan1s/pytextmonitor/issues/17) relacionado.
|
||||
|
||||
Ajustes avanzados
|
||||
-----------------
|
||||
|
||||
**Orientación vertical**
|
||||
|
||||
Usar la orientación vertical en lugar de la horizontal.
|
||||
|
||||
**Habilitar ventanas emergentes**
|
||||
|
||||
Desmarcar esta caja si no deseas usar ventanas emergentes.
|
||||
|
||||
**Añadir extensión**
|
||||
|
||||
Añadir extensión (espaciador) al lado seleccionado del widget.
|
||||
|
||||
**Hora personalizada**
|
||||
|
||||
* etiqueta `$dddd` - día de la semana en foramto largo
|
||||
* etiqueta `$ddd` - día de la semana en formato corto
|
||||
* etiqueta `$dd` - día
|
||||
* etiqueta `$d` - día sin ceros
|
||||
* etiqueta `$MMMM` - mes en formato largo
|
||||
* etiqueta `$MMM` - mes en formato corto
|
||||
* etiqueta `$MM` - mes
|
||||
* etiqueta `$M` - mes sin ceros
|
||||
* etiqueta `$yyyy` - año
|
||||
* etiqueta `$yy` - año en formato corto
|
||||
* etiqueta `$hh` - horas
|
||||
* etiqueta `$h` - horas sin ceros
|
||||
* etiqueta `$mm` - minutos
|
||||
* etiqueta `$m` - minutos sin ceros
|
||||
* etiqueta `$ss` - segundos
|
||||
* etiqueta `$s` - segundos sin ceros
|
||||
|
||||
**Tiempo de ejecución del sistema personalizado**
|
||||
|
||||
* etiqueta `$dd` - días
|
||||
* etiqueta `$d` - días sin ceros
|
||||
* etiqueta `$hh` - horas
|
||||
* etiqueta `$h` - horas sin ceros
|
||||
* etiqueta `$mm` - minutos
|
||||
* etiqueta `$m` - minutos sin ceros
|
||||
|
||||
**Unidades de temperatura**
|
||||
|
||||
Elija las unidades de temperatura. Las unidades disponibles son: Celsius, Farenheit y Kelvin.
|
||||
|
||||
**Dispositivos de temperatura**
|
||||
|
||||
El listado de dispositivos, será observado en la etiqueta de temperatura (los elementos de la lista desplegable provienen de `sensors`). El listado es editable, la tecla Suprimir borrará el elemento activo.
|
||||
|
||||
**Puntos de montaje**
|
||||
|
||||
El listado de puntos de montaje, será observado en la etiqueta de disco duro (los elementos de la lista desplegable provienen de `mount`). El listado es editable, la tecla Suprimir borrará el elemento activo.
|
||||
|
||||
**Disco duro (velocidad)**
|
||||
|
||||
Listado de dispositivos de disco duro, será observado en la etiqueta hddspeed (los elementos de la lista desplegable provienen de DataEngine).
|
||||
|
||||
**Disco duro (temperatura)**
|
||||
|
||||
El listado de dispositivos de disco duro, será observado desde la etiqueta disco duro (los elementos de la lista desplegable provienen de `find`). El listado es editable, la tecla Suprimir borrará el elemento activo.
|
||||
|
||||
**Directorio de red**
|
||||
|
||||
Ruta hacia el directorio que contiene información de los dispositivos de red. Por defecto es `/sys/class/net`. Se requiere para la selección automática del dispositivo de red.
|
||||
|
||||
**Dispositivo de red**
|
||||
|
||||
Usar el dispositivo especificado como activo. Los elementos de la lista desplegable provienen del **directorio de red**. Esto inhabilitará la selección automática del dispositivo de red.
|
||||
|
||||
**Dispositivo de batería**
|
||||
|
||||
El archivo que contiene información de la batería. El archivo (`/sys/class/power_supply/BAT0/capacity` por defecto) solo debería contener la carga de la batería en por ciento.
|
||||
|
||||
**Etiqueta alimentación conectada**
|
||||
|
||||
Línea que será mostrada cuando la alimentación esté conectada.
|
||||
|
||||
**Etiqueta alimentación conectada**
|
||||
|
||||
Línea que será mostrada cuando la alimentación esté desconectada.
|
||||
|
||||
**Dispositivo de alimentación**
|
||||
|
||||
El archivo con información de la alimentación. El archivo (`/sys/class/power_supply/AC/online` por defecto) debe contener `1` si la alimentación está conectada.
|
||||
|
||||
Ajustes de las ventanas emergentes
|
||||
----------------------------------
|
||||
|
||||
Desde la versión 1.7.0 las etiquetas CPU, frecuencia de la CPU, memoria, swap y red soportan ventanas emergentes. Para habilitarlas es necesario tener marcadas las casillas de verificación pertinentes. El número de valores almacenados puede ser establecido en la pestaña. También es posible configurar los colores de los gráficos.
|
||||
|
||||
Ajustes de DataEngine
|
||||
---------------------
|
||||
|
||||
**Comando personalizado**
|
||||
|
||||
*NOTA* Esto puede causar congelamiento de la computadora.
|
||||
|
||||
**Dispositivo GPU**
|
||||
|
||||
Elegir uno de los dispositivos GPU soportados. `auto` habilitará la selección automática, `disable` inhabilitará la definición de los estados de la GPU. El valor por defecto es `auto`.
|
||||
|
||||
**Disco duro**
|
||||
|
||||
Elegir uno de los discos duros para el monitor de temperatura del disco. `all` habilitará el monitor para todos los dispositivos, `disable` inhabilitará la definición de la temperatura del disco. El valor por defecto es `all`.
|
||||
|
||||
**Comando hddtemp**
|
||||
|
||||
Escriba el comando que será ejecutado por el DataEngine hddtemp. El valor por defecto es `sudo hddtemp`.
|
||||
|
||||
**Dirección MPD**
|
||||
|
||||
Dirección del servidor MPD. El valor por defecto es `localhost`.
|
||||
|
||||
**Puerto MPD**
|
||||
|
||||
Puerto del servidor MPD. El valor por defecto es `6600`.
|
||||
|
||||
**Gestor de paquetes**
|
||||
|
||||
Listado de comandos que serán ejecutados. La cantidad de líneas nulas es el número de líneas innecesarias. Predeterminados:
|
||||
|
||||
* *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`
|
||||
|
||||
**Reproductor de música**
|
||||
|
||||
Selecciona uno de los reproductores de música soportados para la etiqueta del reproductor.
|
||||
|
||||
Configuración de DataEngine
|
||||
---------------------------
|
||||
Se puede editar la configuración de DataEngine. Se encuentra en `/usr/share/config/extsysmon.conf` o `$HOME/share/config/extsysmon.conf` en dependencia del tipo de instalación. Quitar el comentario de la línea requerida y editarlo.
|
||||
|
||||
Instrucción
|
||||
===========
|
||||
|
||||
Dependencias
|
||||
------------
|
||||
|
||||
* kdebase-workspace
|
||||
* kdebindings-python2
|
||||
* lm_sensors (*para definir el dispositivo de temperatura*)
|
||||
|
||||
Dependencias opcionales
|
||||
-----------------------
|
||||
|
||||
* sysstat (*para las notificaciones*)
|
||||
* controlador propietario de video
|
||||
* hddtemp (asegúrate de que puede ser ejecutado con `sudo` y sin contraseña. Solo hay que agregar la siguiente línea al archivo `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
|
||||
* reproductor de música (amarok, clementine, mpd o qmmp)
|
||||
|
||||
Dependencias de construcción
|
||||
----------------------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
Instalación
|
||||
-----------
|
||||
* descargar fuentes
|
||||
* instalar
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
||||
make && make install
|
||||
|
||||
También es posible instalarlo en `/`:
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
||||
make && sudo make install
|
||||
|
||||
Información adicional
|
||||
=====================
|
||||
|
||||
TODO (funcionalidades solicitadas)
|
||||
----------------------------------
|
||||
|
||||
Enlaces
|
||||
-----
|
||||
* [Sitio oficial](http://arcanis.name/projects/pytextmonitor/)
|
||||
* Plasmoide en [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
||||
* DataEngine en [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
|
@ -1,268 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Informação
|
||||
-----------
|
||||
|
||||
PyTextMonitor é um script Plasmoid escrito em Python2. Assemelha-se com widgets no awesome-wm.
|
||||
|
||||
**NOTA** [PROCURA_SE TRADUTORES!](https://github.com/arcan1s/pytextmonitou/issues/14)
|
||||
|
||||
Configuração
|
||||
------------
|
||||
|
||||
Para editar o output, você deve abrir a janela de Configurações e configurar o formato de output na linhas:
|
||||
|
||||
* tag `$time` - hora no formato padrão. Por exemplo, *sex Nov 6 04:48:01 2013*
|
||||
* tag `$isotime` - hora no formato ISO.
|
||||
* tag `$shouttime` - hora em formato curto
|
||||
* tag `$longtime` - hora em formato longo
|
||||
* tag `$custom` - formato personalizado de houa
|
||||
* tag `$uptime` - tempo em atividade, *---d--h--m*
|
||||
* tag `$custom` - formato personalizado de tempo em atividade
|
||||
* tag `$cpu` - carga total da CPU, *%*
|
||||
* tag `$cpuN` - carga total da CPU no núcleo N, *%*
|
||||
* tag `$cpucl` - frequência média da CPU, *MHz*
|
||||
* tag `$cpuclN` - frequência do núcleo N da CPU, *MHz*
|
||||
* tag `$tempN` - temperatura do dispositivo N. Por exemplo, `$temp0`
|
||||
* tag `$gpu` - uso da GPU, *%*. `aticonfig` ou `nvidia-smi` devem estar instalados
|
||||
* tag `$gputemp` - temperatura da GPU. `aticonfig` ou `nvidia-smi` devem estar instalados
|
||||
* tag `$mem` - uso de memória, *%*
|
||||
* tag `$memmb` - uso de memória, *MB*
|
||||
* tag `$memgb` - uso de memória, *GB*
|
||||
* tag `$memtotmb` - RAM total, *MB*
|
||||
* tag `$memtotgb` - RAM total, *GB*
|
||||
* tag `$swap` - swap, *%*
|
||||
* tag `$swapmb` - swap, *MB*
|
||||
* tag `$swapgb` - swap, *GB*
|
||||
* tag `$swaptotmb` - swap total, *MB*
|
||||
* tag `$swaptotgb` - swap total, *GB*
|
||||
* tag `$hddN` - uso do ponto de montagem N, *%*. Pou exemplo, `$hdd0`
|
||||
* tag `$hddmbN` - uso do ponto de montagem, *MB*. Por exemplo, `$hddmb0`
|
||||
* tag `$hddgbN` - uso do ponto de montagem, *GB*. Por exemplo, `$hddgb0`
|
||||
* tag `$hddtotmbN` - tamanho total do ponto de montagem N, *MB*. Por exemplo, `$hddtotmb0`
|
||||
* tag `$hddtotgbN` - tamanho total do ponto de montagem N,, *GB*. Por exemplo, `$hddtotgb0`
|
||||
* tag `$hddrN` - velocidade de leitura do disco N, *KB/s*. Por exemplo, `$hddr0`
|
||||
* tag `$hddwN` - velocidade de escrita do disco N, *KB/s*. Por exemplo, `$hddw0`
|
||||
* tag `$hddtempN` - temperatura do HDD N. Por exemplo, `$hddtemp0`
|
||||
* tag `$down` - velocidade de download, *KB/s*
|
||||
* tag `$up` - velocidade de upload, *KB/s*
|
||||
* tag `$netdev` - dispositivo atual de rede
|
||||
* tag `$bat` - carga da bateria, *%*
|
||||
* tag `$ac` - status do dispositivo carregador. Retorna (\*) se o carregador estiver plugado ou *( )* se estiver desplugado
|
||||
* tag `$album` - álbum da música atual . Um dos reprodutores de músicas suportados deve estar instalado
|
||||
* tag `$artist` - artista da música atual. Um dos reprodutores de músicas suportados deve estar instalado
|
||||
* tag `$progress` - progresso da música atual. Um dos reprodutores de músicas suportados deve estar instalado
|
||||
* tag `$time` - tempo da música atual. Um dos reprodutores de músicas suportados deve estar instalado
|
||||
* tag `$title` - título da música atual. Um dos reprodutores de músicas suportados deve estar instalado
|
||||
* tag `$pscount` - número de processos rodando
|
||||
* tag `$pstotal` - número total de processos
|
||||
* tag `$ps` - lista de processos rodando
|
||||
* tag `$pkgcountN` - número de pacotes disponíveis para atualizar pelo comando N available to upgrade. Por exemplo, `$pkgcount0`
|
||||
* tag `$customN` - retorna o output do comando N. Por exemplo, `$custom0`
|
||||
|
||||
A ordem dos rótulos mudará se você mudar a posição do slider. Tags HTML funcionarão normalmente.
|
||||
|
||||
**NOTA** você não deve usar a tag `$cpu` no rótulo de swap, por exemplo. **`$cpu` somente funcionará no rótulo da cpu**.
|
||||
|
||||
Dicas & truques
|
||||
---------------
|
||||
|
||||
Você pode usar cores diferentes para os rótulos. Só coloque o texto do rótulo em código HTML. Veja este [issue](https://github.com/arcan1s/pytextmonitor/issues/9) para mais detalhes.
|
||||
|
||||
A numeração dos elementos de temperatura, uso de HDD, velocidade do HDD, temperatura do HDD refere à ordem dos elementos da segunda aba (*Configurações Avançadas*). Você deve adicionar o item para a lista requerida listWidget primeiro. E o primeiro elemento na listWidget será `$tag0`. Veja este [issue](https://github.com/arcan1s/pytextmonitor/issues/17) para mais detalhes.
|
||||
|
||||
Configurações Avançadas
|
||||
-----------------------
|
||||
|
||||
**Layout vertical**
|
||||
|
||||
Use o layout vertical ao invés do horizontal.
|
||||
|
||||
**Habilitar popup**
|
||||
|
||||
Desmarque esta caixa se não quiser usar mensagens popup
|
||||
|
||||
**Adicionar esticamento**
|
||||
|
||||
Adicionar esticamento (espaço) para o lado selecionado do widget.
|
||||
|
||||
**Hora customizada**
|
||||
|
||||
* tag `$dddd` - dia da semana em formato completo
|
||||
* tag `$ddd` - dia da semana em format curto
|
||||
* tag `$dd` - dia
|
||||
* tag `$d` - dia sem zeros
|
||||
* tag `$MMMM` - mês em formato completo
|
||||
* tag `$MMM` - mês em formato curto
|
||||
* tag `$MM` - mês
|
||||
* tag `$M` - mês sem zeros
|
||||
* tag `$yyyy` - ano
|
||||
* tag `$yy` - ano em formato curto
|
||||
* tag `$hh` - horas
|
||||
* tag `$h` - horas sem zeros
|
||||
* tag `$mm` - minutos
|
||||
* tag `$m` - minutos sem zeros
|
||||
* tag `$ss` - segundos
|
||||
* tag `$s` - segundos sem zeros
|
||||
|
||||
**Tempo em Atividade personalizado**
|
||||
|
||||
* tag `$dd` - tempo em atividade em dias
|
||||
* tag `$d` - tempo em atividade em dias sem zeros
|
||||
* tag `$hh` - tempo em atividade em horas
|
||||
* tag `$h` - tempo em atividade em horas sem zeros
|
||||
* tag `$mm` - tempo em atividade em minutos
|
||||
* tag `$m` - tempo em atividade em minutos sem zeros
|
||||
|
||||
**Unidades de Temperatura**
|
||||
|
||||
Seleciona as unidades de temperatura. Unidades disponíveis são Celsius, Farenheit e Kelvin.
|
||||
|
||||
**Dispositivos de Temperatura**
|
||||
|
||||
Lista de dispositovos, a serem observados no rótulo de temperatura (os itens de seleção vêm do `sensors`). A lista de widgets é editável, a tecla delete removerá o item selecionado.
|
||||
|
||||
**Pontos de Montagem**
|
||||
|
||||
Lista de pontos de montagem, a serem observados no rótulo de hdd (os itens de seleção vêm do `mount`). A lista de widgets é editável, a tecla delete removerá o item selecionado.
|
||||
|
||||
**HDD (velocidade)**
|
||||
|
||||
Lista de dispositivos HDD, a serem observados no rótulo de hddspeed (os itens de seleção vêm do DataEngine). A lista de widgets é editável, a tecla delete removerá o item selecionado.
|
||||
|
||||
**HDD (temperatura)**
|
||||
|
||||
Lista de dispositivos HDD, a serem observados no rótulo de hddtemp (os itens de seleção vêm do `find`). A lista de widgets é editável, a tecla delete removerá o item selecionado.
|
||||
|
||||
**Diretório de rede**
|
||||
|
||||
Caminho para o diretório, que contém a informação dos dispositivos de rede. O padrão é `/sys/class/net`. Requerido para seleção automática de dispositivo de rede.
|
||||
|
||||
**Dispositivo de rede**
|
||||
|
||||
Usa o dispositivo especificado como ativo. Os itens de seleção vêm do **diretório de rede**. Desativará a seleção automática do dispositivo de rede.
|
||||
|
||||
**Dispositivo de bateria**
|
||||
|
||||
Arquivo com informações da bateria. O arquivo (`/sys/class/power_supply/BAT0/capacity` por padrão) deve conter somente a carga da bateria em porcentagem.
|
||||
|
||||
**Tag do carregador plugado**
|
||||
|
||||
Linha a ser mostrada quando o carregador está plugado.
|
||||
|
||||
**Tag do carregador desplugado**
|
||||
|
||||
Linha a ser mostrada quando o carregador está desplugado.
|
||||
|
||||
**Dispositivo carregador**
|
||||
|
||||
Arquivo com informações do carregador. O arquivo (`/sys/class/power_supply/AC/online` por padrão) deve conter `1` se o carregador estiver plugado.
|
||||
|
||||
Configurações da dica de contexto
|
||||
---------------------------------
|
||||
|
||||
Desde a versão 1.7.0, os rótulos de CPU, frequência da CPU, memória, swap e rede suportam dica de contexto gráfica. Para ativar, certifique-se de ter marcado as caixas necessárias. O número de valores armazenados pode ser configurado nesta aba. Cores de gráficos também são configuráveis.
|
||||
|
||||
Configurações de DataEngine
|
||||
---------------------------
|
||||
|
||||
**Comando personalizado**
|
||||
|
||||
*NOTA* Isso pode travar o seu computador.
|
||||
|
||||
Comandos que serão executados para o rótulo personalizado.
|
||||
|
||||
**Dispositivo GPU**
|
||||
|
||||
Seleciona um dos dispositivos GPU sportador. `auto` ativará a seleção automática, `disable` desativará a definição dos estados de GPU. O padrão é `auto`.
|
||||
|
||||
**HDD**
|
||||
|
||||
Seleciona um dos HDDs para o monitor de temperatura do HDD. `all` ativará o monitoramento de todos dispositivos, `disable` desativará o monitoramento para todos dispositivos. O padrão é `all`.
|
||||
|
||||
**hddtemp cmd**
|
||||
|
||||
Digite um comando que será executado para o hddtemp DataEngine. O padrão é `sudo hddtemp`.
|
||||
|
||||
**Endereço MPD**
|
||||
|
||||
Endereço do servidor MPD. O padrão é `localhost`.
|
||||
|
||||
**Porta MPD**
|
||||
|
||||
Porta do servidor MPD. O padrão é `6600`.
|
||||
|
||||
**Gerenciador de pacotes**
|
||||
|
||||
Lista de comandos a serem executador. O número de linhas nulas é o número de linhas desnecessárias. Por padrão:
|
||||
|
||||
* *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`
|
||||
|
||||
**Reprodutor de música**
|
||||
|
||||
Selecione um dos reprodutores de música suportados para o rótulo de música.
|
||||
|
||||
Configuração do DataEngine
|
||||
--------------------------
|
||||
|
||||
Você pode editar a configuração do DataEngine. Ela está em `/usr/share/config/extsysmon.conf` ou `$HOME/share/config/extsysmon.conf` dependendo do tipo de instalação. Remova os comentários das linhas necessárias e edite-as.
|
||||
|
||||
Instruções
|
||||
==========
|
||||
|
||||
Dependências
|
||||
------------
|
||||
|
||||
* kdebase-workspace
|
||||
* kdebindings-python2
|
||||
* lm_sensors (*para definir a temperatura dos dispositivos*)
|
||||
|
||||
Dependências opcionais
|
||||
----------------------
|
||||
|
||||
* sysstat (*para notificações*)
|
||||
* driver de vídeo proprietário
|
||||
* hddtemp (certifique-se de que pode ser executado com `sudo` sem senha. Para isso, adicione a seguinte linha ao arquivo `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
|
||||
* music player (amarok, clementine, mpd or qmmp)
|
||||
|
||||
Dependências para compilar
|
||||
--------------------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
Instalação
|
||||
----------
|
||||
|
||||
* baixe o código-fonte
|
||||
* instale
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
||||
make && make install
|
||||
|
||||
Caso queira instalar na `/`:
|
||||
|
||||
mkdir build && cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
||||
make && sudo make install
|
||||
|
||||
Informações adicionais
|
||||
======================
|
||||
|
||||
TODO (lista de desejos)
|
||||
-----------------------
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
* [Homepage](http://arcanis.name/projects/pytextmonitor/)
|
||||
* Plasmoid na [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
|
||||
* DataEngine na [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||
* Pacote para ArchLinux no [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/)
|
268
md_readme/ru.md
@ -1,268 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Информация
|
||||
----------
|
||||
|
||||
PyTextMonitor - минималистичный плазмоид, написанный на Python2. Он выглядит как виджеты в Awesome WM.
|
||||
|
||||
**ВНИМАНИЕ** [НУЖНЫ ПЕРЕВОДЧИКИ!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
|
||||
Настройка
|
||||
---------
|
||||
|
||||
Для редактирования внешнего вида, откройте окно настроек и установите требуемый формат в поля:
|
||||
|
||||
* тег `$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*
|
||||
* тег `$memtotmb` - RAM, *MB*
|
||||
* тег `$memtotgb` - RAM, *GB*
|
||||
* тег `$swap` - swap, *%*
|
||||
* тег `$swapmb` - swap, *MB*
|
||||
* тег `$swapgb` - swap, *GB*
|
||||
* тег `$swaptotmb` - размер swap, *MB*
|
||||
* тег `$swaptotgb` - размер swap, *GB*
|
||||
* тег `$hddN` - использование точки монтирования N, *%*. Например, `$hdd0`
|
||||
* тег `$hddmbN` - использование точки монтирования N, *MB*. Например, `$hddmb0`
|
||||
* тег `$hddgbN` - использование точки монтирования N, *GB*. Например, `$hddgb0`
|
||||
* тег `$hddtotmbN` - размер точки монтирования N, *MB*. Например, `$hddtotmb0`
|
||||
* тег `$hddtotgbN` - размер точки монтирования N, *GB*. Например, `$hddtotgb0`
|
||||
* тег `$hddrN` - скорость записи на диск N, *KB/s*. Например, `$hddr0`
|
||||
* тег `$hddwN` - скорость чтения с диска N, *KB/s*. Например, `$hddw0`
|
||||
* тег `$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`
|
||||
* тег `$customN` - возвращает результат своей команды N. Например, `$custom0`
|
||||
|
||||
Порядок полей изменится, если вы измените позицию слайдеров. HTML теги в полях работают корректно.
|
||||
|
||||
**ЗАМЕЧАНИЕ** вы не можете установить тег `$cpu`, например, в поле swap. **`$cpu` будет работать только в поле CPU**.
|
||||
|
||||
Советы и хитрости
|
||||
-----------------
|
||||
|
||||
Вы можете использовать различные цвета в полях. Просто вставьте нужный текст в html код. Смотри [вопрос](https://github.com/arcan1s/pytextmonitor/issues/9) для более подробной информации.
|
||||
|
||||
Нумерация элементов в полях "Температура", "Использование HDD", "Скорость HDD", "Температура HDD" ссылается на порядок элементов во второй вкладке (*Расширенные настройки*). Вы должны сначала добавить требуемые элементы в нужный listWidget. И первый элемент в listWdiget будет связан c `$tag0`. Смотри [вопрос](https://github.com/arcan1s/pytextmonitor/issues/17) для более подробной информации.
|
||||
|
||||
Расширенные настройки
|
||||
---------------------
|
||||
|
||||
**Вертикальная разметка**
|
||||
|
||||
Использовать вертикальную разметку вместо горизонтальной.
|
||||
|
||||
**Включить всплывающие сообщения**
|
||||
|
||||
Нажмите на чекбокс, если вы не используете всплывающие сообщения.
|
||||
|
||||
**Добавить пустое пространство**
|
||||
|
||||
Добавить пустое пространство в указанное место виджета.
|
||||
|
||||
**Свой формат времени**
|
||||
|
||||
* тег `$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, которые будут наблюдаться в поле hddspeed (содержимое комбо бокса берется из DataEngine). Виджет редактируем, клавиша 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` включит автоматическое определение, `disable` отключит все мониторы GPU. По умолчанию `auto`.
|
||||
|
||||
**HDD**
|
||||
|
||||
Выберете один из HDD для монитора его температуры. `all` включит монитор для всех доступных устройств, `disable` отключит определение температуры HDD. По умолчанию `all`.
|
||||
|
||||
**Команда hddtemp**
|
||||
|
||||
Введите команду, которая будет запущена для hddtemp DataEngine. По умолчанию `sudo hddtemp`.
|
||||
|
||||
**Адрес 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, clementine, mpd или qmmp)
|
||||
|
||||
Зависимости сборки
|
||||
------------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
Установка
|
||||
---------
|
||||
|
||||
* скачать исходный архив
|
||||
* установить
|
||||
|
||||
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/)
|
263
md_readme/uk.md
@ -1,263 +0,0 @@
|
||||
pytextmonitor
|
||||
=============
|
||||
|
||||
Інформація
|
||||
----------
|
||||
|
||||
PyTextMonitor - мінімалістичний плазмоїд, що написаний на Python2. Він виглядає як віджети в Awesome WM.
|
||||
|
||||
**УВАГА** [ПОТРІБНІ ПЕРЕКЛАДАЧІ!](https://github.com/arcan1s/pytextmonitor/issues/14)
|
||||
|
||||
Налаштування
|
||||
------------
|
||||
|
||||
Для редагування зовнішного вигляду, відкрийте вікно налаштувань та встановіть потрібний формат в поля:
|
||||
|
||||
* тег `$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*
|
||||
* тег `$swaptotmb` - розмір swap, *MB*
|
||||
* тег `$swaptotgb` - розмір swap, *GB*
|
||||
* тег `$hddN` - використання точки монтування N, *%*. Наприклад, `$hdd0`
|
||||
* тег `$hddmbN` - використання точки монтування N, *MB*. Наприклад, `$hddmb0`
|
||||
* тег `$hddgbN` - використання точки монтування N, *GB*. Наприклад, `$hddgb0`
|
||||
* тег `$hddtotmbN` - розмір точки монтування N, *MB*. Наприклад, `$hddtotmb0`
|
||||
* тег `$hddtotgbN` - розмір точки монтування N, *GB*. Наприклад, `$hddtotgb0`
|
||||
* тег `$hddrN` - швидкість запису на диск N, *KB/s*. Наприклад, `$hddr0`
|
||||
* тег `$hddwN` - швидкість читання з диска N, *KB/s*. Наприклад, `$hddw0`
|
||||
* тег `$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`
|
||||
* тег `$customN` - повертає результат своєї команди N. Наприклад, `$custom0`
|
||||
|
||||
Порядок полів зміниться, якщо ви зміните позицію слайдерів. HTML теги в полях працюють коректно.
|
||||
|
||||
**ЗАУВАЖЕННЯ** ви не зможете встановити тег `$cpu`, наприклад, в полі swap. **`$cpu` буде працювати тільки в полі CPU**.
|
||||
|
||||
Поради та хитрощі
|
||||
-----------------
|
||||
|
||||
Ви можете використовувати різні кольори в полях. Просто встановіть потрібний текст в html код. Дивись [питання](https://github.com/arcan1s/pytextmonitor/issues/9) для більш детальної інформації.
|
||||
|
||||
Нумерація элементів в полях температура, використання HDD, швидкість HDD, температура HDD посилається на порядок елементів у другій вкладці (*Розширені налаштування*). Ви повинні спочатку додати потрібні елементи в потрібний listWidget. Тоді перший елемент в listWdiget буде пов’язаний з `$tag0`. Дивись [питання](https://github.com/arcan1s/pytextmonitor/issues/17) для більш детальної інформації.
|
||||
|
||||
Розширені налаштування
|
||||
----------------------
|
||||
|
||||
**Вертикальна розмітка**
|
||||
|
||||
Використовувати вертикальну розмітку замість горизонтальної.
|
||||
|
||||
**Включити спливаючі повідомлення**
|
||||
|
||||
Натисніть на чекбокс, якщо ви не користуєтесь спливаючими повідомленнями.
|
||||
|
||||
**Додати порожній простір**
|
||||
|
||||
Додати порожній простір у вказане місце віджета.
|
||||
|
||||
**Свій формат часу**
|
||||
|
||||
* тег `$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, які будуть спостерігатися в полі hddspeed (вміст комбо боксу береться із DataEngine). Віджет можна редагувати, клавіша delete видаляє поточний рядок.
|
||||
|
||||
**HDD (температура)**
|
||||
|
||||
Перелік HDD, які будуть спостерігатися в полі hddtemp (вміст комбо боксу береться iз `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`.
|
||||
|
||||
**Команда hddtemp**
|
||||
|
||||
Оберіть команду, яка буде запущена для hddtemp DataEngine. За замовчуванням `sudo hddtemp`.
|
||||
|
||||
**Адреса 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, clementine, mpd или qmmp)
|
||||
|
||||
Залежності збирання
|
||||
-------------------
|
||||
|
||||
* automoc4
|
||||
* cmake
|
||||
|
||||
Установка
|
||||
---------
|
||||
|
||||
* скачати вихідний архів
|
||||
* встановити
|
||||
|
||||
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,28 +1,46 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
cmake_policy (SET CMP0003 OLD)
|
||||
cmake_policy (SET CMP0002 OLD)
|
||||
cmake_policy (SET CMP0011 NEW)
|
||||
cmake_policy (SET CMP0015 NEW)
|
||||
|
||||
project (pytextmonitor)
|
||||
set (PROJECT_VERSION_MAJOR 1)
|
||||
set (PROJECT_VERSION_MINOR 10)
|
||||
set (PROJECT_VERSION_PATCH 2)
|
||||
project (awesomewidgets)
|
||||
set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set (PROJECT_LICENSE "GPLv3")
|
||||
set (PROJECT_VERSION_MAJOR 2)
|
||||
set (PROJECT_VERSION_MINOR 3)
|
||||
set (PROJECT_VERSION_PATCH 3)
|
||||
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 "Build date: ${CURRENT_DATE}")
|
||||
|
||||
# flags
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (ADD_CXX_FLAGS "-Wall")
|
||||
set (CMAKE_CXX_FLAGS "-O0 ${ADD_CXX_FLAGS}")
|
||||
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
||||
set (CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
||||
set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
# avoid newer gcc warnings
|
||||
add_definitions (-D_DEFAULT_SOURCE)
|
||||
else ()
|
||||
message (STATUS "Unknown compiler")
|
||||
endif ()
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||
endif ()
|
||||
|
||||
add_subdirectory (ext-sysmon)
|
||||
add_subdirectory (ptm)
|
||||
add_subdirectory (readme)
|
||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||
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>
|
111
sources/awesome-widget/package/contents/ui/about.qml
Normal file
@ -0,0 +1,111 @@
|
||||
/***************************************************************************
|
||||
* 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")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
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")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
245
sources/awesome-widget/package/contents/ui/main.qml
Normal file
@ -0,0 +1,245 @@
|
||||
/***************************************************************************
|
||||
* 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 dropSource(string sourceName)
|
||||
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
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
renderType: Text.NativeRendering
|
||||
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)
|
||||
// connect data
|
||||
AWKeys.dropSourceFromDataengine.connect(dropSource)
|
||||
AWKeys.needToBeUpdated.connect(needUpdate)
|
||||
}
|
||||
|
||||
onDropSource: {
|
||||
if (debug) console.log("[main::onDropSource]")
|
||||
if (debug) console.log("[main::onDropSource] : Source " + sourceName)
|
||||
|
||||
systemmonitorDE.disconnectSource(sourceName)
|
||||
}
|
||||
|
||||
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]")
|
||||
}
|
||||
}
|
327
sources/awesome-widget/package/contents/ui/widget.qml
Normal file
@ -0,0 +1,327 @@
|
||||
/***************************************************************************
|
||||
* 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>")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
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.3
|
||||
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 */
|
1519
sources/awesome-widget/plugin/awkeys.cpp
Normal file
130
sources/awesome-widget/plugin/awkeys.h
Normal file
@ -0,0 +1,130 @@
|
||||
/***************************************************************************
|
||||
* 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 void 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);
|
||||
|
||||
signals:
|
||||
void dropSourceFromDataengine(const QString source);
|
||||
void needToBeUpdated();
|
||||
|
||||
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>
|
111
sources/desktop-panel/package/contents/ui/about.qml
Normal file
@ -0,0 +1,111 @@
|
||||
/***************************************************************************
|
||||
* 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")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
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")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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]")
|
||||
}
|
||||
}
|
194
sources/desktop-panel/package/contents/ui/main.qml
Normal file
@ -0,0 +1,194 @@
|
||||
/***************************************************************************
|
||||
* 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
|
||||
renderType: Text.NativeRendering
|
||||
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
|
244
sources/desktop-panel/package/contents/ui/widget.qml
Normal file
@ -0,0 +1,244 @@
|
||||
/***************************************************************************
|
||||
* 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>")
|
||||
onLinkActivated: Qt.openUrlExternally(link);
|
||||
}
|
||||
|
||||
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.3
|
||||
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,32 +0,0 @@
|
||||
# Configuration file for Extended Systemmonitor DataEngine
|
||||
# $kdehome/share/config/extsysmon.conf
|
||||
|
||||
# Custom command, separator is '@@'
|
||||
#CUSTOM=wget -qO- http://ifconfig.me/ip
|
||||
|
||||
# Set GPU device
|
||||
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'disable' or 'auto'
|
||||
#GPUDEV=auto
|
||||
|
||||
# Set block device for hddtemp comma separated or use 'all' or 'disable'
|
||||
#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
|
||||
|
||||
# Player name. Supported players are amarok, clementine, mpd, qmmp
|
||||
#PLAYER=amarok
|
@ -1,778 +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 <QDebug>
|
||||
#include <QFile>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QRegExp>
|
||||
#include <QTextCodec>
|
||||
#include <QThread>
|
||||
|
||||
|
||||
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
|
||||
: Plasma::DataEngine(parent, args)
|
||||
{
|
||||
Q_UNUSED(args)
|
||||
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("PTM_DEBUG"), QString("no"));
|
||||
if (debugEnv == QString("yes"))
|
||||
debug = true;
|
||||
else
|
||||
debug = false;
|
||||
|
||||
setMinimumPollingInterval(333);
|
||||
readConfiguration();
|
||||
setProcesses();
|
||||
setKeys();
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getAllHdd()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getAllHdd]";
|
||||
QProcess command;
|
||||
QStringList devices;
|
||||
QString cmd = QString("find /dev -name [hms]d[a-z]");
|
||||
QString qoutput = QString("");
|
||||
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "Run cmd" << cmd;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "Cmd returns" << command.exitCode();
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
|
||||
devices.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
|
||||
if (debug) qDebug() << "[DE]" << "[getAllHdd]" << ":" << "Device list" << devices;
|
||||
return devices.join(QChar(','));
|
||||
}
|
||||
|
||||
|
||||
QString ExtendedSysMon::getAutoGpu()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoGpu]";
|
||||
QProcess command;
|
||||
QString gpu = QString("disable");
|
||||
QString cmd = QString("lspci");
|
||||
QString qoutput = QString("");
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Run cmd" << cmd;
|
||||
command.start(cmd);
|
||||
command.waitForFinished(-1);
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Cmd returns" << command.exitCode();
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
|
||||
if (qoutput.toLower().contains("nvidia"))
|
||||
gpu = QString("nvidia");
|
||||
else if (qoutput.toLower().contains("radeon"))
|
||||
gpu = QString("ati");
|
||||
if (debug) qDebug() << "[DE]" << "[getAutoGpu]" << ":" << "Device" << gpu;
|
||||
return gpu;
|
||||
}
|
||||
|
||||
|
||||
QStringList ExtendedSysMon::sources() const
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[sources]";
|
||||
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"));
|
||||
if (debug) qDebug() << "[DE]" << "[sources]" << ":" << "Sources" << source;
|
||||
return source;
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::initValues()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[initValues]";
|
||||
QStringList sourceList = sources();
|
||||
for (int i=0; i<sourceList.count(); i++)
|
||||
sourceRequestEvent(sourceList[i]);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[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("HDDTEMPCMD")] = QString("sudo hddtemp");
|
||||
rawConfig[QString("MPDADDRESS")] = QString("localhost");
|
||||
rawConfig[QString("MPDPORT")] = QString("6600");
|
||||
rawConfig[QString("PKGCMD")] = QString("pacman -Qu");
|
||||
rawConfig[QString("PKGNULL")] = QString("0");
|
||||
rawConfig[QString("PLAYER")] = QString("amarok");
|
||||
|
||||
QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
|
||||
if (debug) qDebug() << "[DE]" << "[readConfiguration]" << ":" << "Configuration file" << fileName;
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setKeys()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[setKeys]";
|
||||
QString key, source;
|
||||
// custom
|
||||
source = QString("custom");
|
||||
for (int i=0; i<configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts).count(); i++) {
|
||||
key = QString("custom") + QString::number(i);
|
||||
setData(source, key, QString(""));
|
||||
}
|
||||
// gpu
|
||||
source = QString("gpu");
|
||||
key = QString("GPU");
|
||||
setData(source, key, float(0.0));
|
||||
// gputemp
|
||||
source = QString("gputemp");
|
||||
key = QString("GPUTemp");
|
||||
setData(source, key, float(0.0));
|
||||
// hddtemp
|
||||
source = QString("hddtemp");
|
||||
for (int i=0; i<configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts).count(); i++) {
|
||||
key = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts)[i];
|
||||
setData(source, key, float(0.0));
|
||||
}
|
||||
// pkg
|
||||
source = QString("pkg");
|
||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++) {
|
||||
key = QString("pkgCount") + QString::number(i);
|
||||
setData(source, key, 0);
|
||||
}
|
||||
// player
|
||||
source = QString("player");
|
||||
key = QString("album");
|
||||
setData(source, key, QString("unknown"));
|
||||
key = QString("artist");
|
||||
setData(source, key, QString("unknown"));
|
||||
key = QString("duration");
|
||||
setData(source, key, QString("0"));
|
||||
key = QString("progress");
|
||||
setData(source, key, QString("0"));
|
||||
key = QString("title");
|
||||
setData(source, key, QString("unknown"));
|
||||
// ps
|
||||
source = QString("ps");
|
||||
key = QString("psCount");
|
||||
setData(source, key, QString("0"));
|
||||
key = QString("ps");
|
||||
setData(source, key, QString(""));
|
||||
key = QString("psTotal");
|
||||
setData(source, key, QString("0"));
|
||||
// initialization of values
|
||||
initValues();
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setProcesses()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[setProcesses]";
|
||||
// custom
|
||||
for (int i=0; i<configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts).count(); i++) {
|
||||
processes[QString("custom")].append(new QProcess);
|
||||
connect(processes[QString("custom")][i], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setCustomCmd(int, QProcess::ExitStatus)));
|
||||
}
|
||||
// gpu
|
||||
processes[QString("gpu")].append(new QProcess);
|
||||
connect(processes[QString("gpu")][0], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setGpu(int, QProcess::ExitStatus)));
|
||||
// gputemp
|
||||
processes[QString("gputemp")].append(new QProcess);
|
||||
connect(processes[QString("gputemp")][0], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setGpuTemp(int, QProcess::ExitStatus)));
|
||||
// hddtemp
|
||||
for (int i=0; i<configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts).count(); i++) {
|
||||
processes[QString("hddtemp")].append(new QProcess);
|
||||
connect(processes[QString("hddtemp")][i], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setHddTemp(int, QProcess::ExitStatus)));
|
||||
}
|
||||
// pkg
|
||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++) {
|
||||
processes[QString("pkg")].append(new QProcess);
|
||||
connect(processes[QString("pkg")][i], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setUpgradeInfo(int, QProcess::ExitStatus)));
|
||||
}
|
||||
// player
|
||||
processes[QString("player")].append(new QProcess);
|
||||
connect(processes[QString("player")][0], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setPlayer(int, QProcess::ExitStatus)));
|
||||
// ps
|
||||
// pscount && ps
|
||||
processes[QString("ps")].append(new QProcess);
|
||||
// pstotal
|
||||
processes[QString("ps")].append(new QProcess);
|
||||
connect(processes[QString("ps")][1], SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
this, SLOT(setPs(int, QProcess::ExitStatus)));
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[updateConfiguration]";
|
||||
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("HDDTEMPCMD")) &&
|
||||
(key != QString("PKGCMD")))
|
||||
value.remove(QChar(' '));
|
||||
config[key] = value;
|
||||
}
|
||||
// update values
|
||||
// gpudev
|
||||
if (config[QString("GPUDEV")] == QString("disable"))
|
||||
config[QString("GPUDEV")] = QString("disable");
|
||||
else if (config[QString("GPUDEV")] == QString("auto"))
|
||||
config[QString("GPUDEV")] = getAutoGpu();
|
||||
else if ((config[QString("GPUDEV")] != QString("ati")) &&
|
||||
(config[QString("GPUDEV")] != QString("nvidia")))
|
||||
config[QString("GPUDEV")] = getAutoGpu();
|
||||
// hdddev
|
||||
if (config[QString("HDDDEV")] == QString("all"))
|
||||
config[QString("HDDDEV")] = getAllHdd();
|
||||
else if (config[QString("HDDDEV")] == QString("disable"))
|
||||
config[QString("HDDDEV")] = QString("");
|
||||
else {
|
||||
QStringList deviceList = config[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
QStringList devices;
|
||||
QRegExp diskRegexp = QRegExp("/dev/[hms]d[a-z]$");
|
||||
for (int i=0; i<deviceList.count(); i++)
|
||||
if ((QFile::exists(deviceList[i])) &&
|
||||
(diskRegexp.indexIn(deviceList[i]) > -1))
|
||||
devices.append(deviceList[i]);
|
||||
if (devices.isEmpty())
|
||||
config[QString("HDDDEV")] = getAllHdd();
|
||||
else
|
||||
config[QString("HDDDEV")] = devices.join(QChar(','));
|
||||
}
|
||||
// pkgcmd
|
||||
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");
|
||||
// player
|
||||
if ((config[QString("PLAYER")] != QString("amarok")) &&
|
||||
(config[QString("PLAYER")] != QString("clementine")) &&
|
||||
(config[QString("PLAYER")] != QString("mpd")) &&
|
||||
(config[QString("PLAYER")] != QString("qmmp")))
|
||||
config[QString("PLAYER")] = QString("amarok");
|
||||
|
||||
for (int i=0; i<config.keys().count(); i++)
|
||||
if (debug) qDebug() << "[DE]" << "[updateConfiguration]" << ":" <<
|
||||
config.keys()[i] + QString("=") + config[config.keys()[i]];
|
||||
return config;
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getCustomCmd(const QString cmd, const int number)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getCustomCmd]";
|
||||
if (debug) qDebug() << "[DE]" << "[getCustomCmd]" << ":" << "Run function with cmd" << cmd;
|
||||
if (debug) qDebug() << "[DE]" << "[getCustomCmd]" << ":" << "Run function with number" << number;
|
||||
if (debug) qDebug() << "[DE]" << "[getCustomCmd]" << ":" << "Run cmd" << QString("bash -c \"") + cmd + QString("\"");
|
||||
if ((processes[QString("custom")][number]->state() != QProcess::Running) &&
|
||||
(processes[QString("custom")][number]->state() != QProcess::Starting))
|
||||
processes[QString("custom")][number]->start(QString("bash -c \"") + cmd + QString("\""));
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setCustomCmd(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setCustomCmd]";
|
||||
if (debug) qDebug() << "[DE]" << "[setCustomCmd]" << ":" << "Cmd returns" << exitCode;
|
||||
for (int i=0; i<processes[QString("custom")].count(); i++) {
|
||||
QString value = QString("");
|
||||
value = QTextCodec::codecForMib(106)->toUnicode(processes[QString("custom")][i]->readAllStandardOutput()).trimmed();
|
||||
if (!value.isEmpty()) {
|
||||
if (debug) qDebug() << "[DE]" << "[setCustomCmd]" << ":" << "Found data for cmd" << i;
|
||||
if (debug) qDebug() << "[DE]" << "[setCustomCmd]" << ":" << "Return" << value;
|
||||
QString source = QString("custom");
|
||||
QString key = QString("custom") + QString::number(i);
|
||||
setData(source, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getGpu(const QString device)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getGpu]";
|
||||
if (debug) qDebug() << "[DE]" << "[getGpu]" << ":" << "Run function with device" << device;
|
||||
if ((device != QString("nvidia")) && (device != QString("ati")))
|
||||
return;
|
||||
QString cmd = QString("");
|
||||
if (device == QString("nvidia"))
|
||||
cmd = QString("nvidia-smi -q -d UTILIZATION");
|
||||
else if (device == QString("ati"))
|
||||
cmd = QString("aticonfig --od-getclocks");
|
||||
if (debug) qDebug() << "[DE]" << "[getGpu]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("gpu")][0]->state() != QProcess::Running) &&
|
||||
(processes[QString("gpu")][0]->state() != QProcess::Starting))
|
||||
processes[QString("gpu")][0]->start(cmd);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setGpu(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setGpu]";
|
||||
if (debug) qDebug() << "[DE]" << "[setGpu]" << ":" << "Cmd returns" << exitCode;
|
||||
float value = 0.0;
|
||||
QString qoutput;
|
||||
if (configuration[QString("GPUDEV")] == QString("nvidia")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("gpu")][0]->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('%'));
|
||||
value = load.toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (configuration[QString("GPUDEV")] == QString("ati")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("gpu")][0]->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('%'));
|
||||
value = load.toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug) qDebug() << "[DE]" << "[setGpu]" << ":" << "Return" << value;
|
||||
QString source = QString("gpu");
|
||||
QString key = QString("GPU");
|
||||
setData(source, key, value);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getGpuTemp(const QString device)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getGpuTemp]";
|
||||
if (debug) qDebug() << "[DE]" << "[getGpuTemp]" << ":" << "Run function with device" << device;
|
||||
if ((device != QString("nvidia")) && (device != QString("ati")))
|
||||
return;
|
||||
QString cmd = QString("");
|
||||
if (device == QString("nvidia"))
|
||||
cmd = QString("nvidia-smi -q -d TEMPERATURE");
|
||||
else if (device == QString("ati"))
|
||||
cmd = QString("aticonfig --od-gettemperature");
|
||||
if (debug) qDebug() << "[DE]" << "[getGpuTemp]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("gputemp")][0]->state() != QProcess::Running) &&
|
||||
(processes[QString("gputemp")][0]->state() != QProcess::Running))
|
||||
processes[QString("gputemp")][0]->start(cmd);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setGpuTemp(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setGpuTemp]";
|
||||
if (debug) qDebug() << "[DE]" << "[setGpuTemp]" << ":" << "Cmd returns" << exitCode;
|
||||
float value = 0.0;
|
||||
QString qoutput;
|
||||
if (configuration[QString("GPUDEV")] == QString("nvidia")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("gputemp")][0]->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];
|
||||
value = temp.toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (configuration[QString("GPUDEV")] == QString("ati")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("gputemp")][0]->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];
|
||||
value = temp.toFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (debug) qDebug() << "[DE]" << "[setGpuTemp]" << ":" << "Return" << value;
|
||||
QString source = QString("gputemp");
|
||||
QString key = QString("GPUTemp");
|
||||
setData(source, key, value);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getHddTemp(const QString cmd, const QString device, const int number)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getHddTemp]";
|
||||
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with cmd" << cmd;
|
||||
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with device" << device;
|
||||
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run function with number" << number;
|
||||
if (debug) qDebug() << "[DE]" << "[getHddTemp]" << ":" << "Run cmd" << cmd + QString(" ") + device;
|
||||
if ((processes[QString("hddtemp")][number]->state() != QProcess::Running) &&
|
||||
(processes[QString("hddtemp")][number]->state() != QProcess::Starting))
|
||||
processes[QString("hddtemp")][number]->start(cmd + QString(" ") + device);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setHddTemp(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setHddTemp]";
|
||||
if (debug) qDebug() << "[DE]" << "[setHddTemp]" << ":" << "Cmd returns" << exitCode;
|
||||
for (int i=0; i<processes[QString("hddtemp")].count(); i++) {
|
||||
float value = 0.0;
|
||||
QString qoutput = QString("");
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("hddtemp")][i]->readAllStandardOutput()).trimmed();
|
||||
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
|
||||
if (debug) qDebug() << "[DE]" << "[setHddTemp]" << ":" << "Found data for cmd" << i;
|
||||
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts)[2];
|
||||
temp.remove(QChar(0260)).remove(QChar('C'));
|
||||
value = temp.toFloat();
|
||||
if (debug) qDebug() << "[DE]" << "[setHddTemp]" << ":" << "Return" << value;
|
||||
QString source = QString("hddtemp");
|
||||
QString key = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts)[i];
|
||||
setData(source, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getPlayerInfo(const QString playerName,
|
||||
const QString mpdAddress,
|
||||
const QString mpdPort)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]";
|
||||
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "Run function with player" << playerName;
|
||||
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "Run function with MPD parameters" <<
|
||||
mpdAddress + QString(":") + mpdPort;
|
||||
QString cmd;
|
||||
if (playerName == QString("amarok"))
|
||||
// amarok
|
||||
cmd = QString("bash -c \"qdbus org.kde.amarok /Player GetMetadata && qdbus org.kde.amarok /Player PositionGet\"");
|
||||
else if (playerName == QString("clementine"))
|
||||
// clementine
|
||||
cmd = QString("bash -c \"qdbus org.mpris.clementine /Player GetMetadata && qdbus org.mpris.clementine /Player PositionGet\"");
|
||||
else if (playerName == QString("mpd"))
|
||||
// mpd
|
||||
cmd = QString("bash -c \"echo 'currentsong\nstatus\nclose' | curl --connect-timeout 1 -fsm 3 telnet://") +
|
||||
mpdAddress + QString(":") + mpdPort + QString("\"");
|
||||
else if (playerName == QString("qmmp"))
|
||||
// qmmp
|
||||
cmd = QString("bash -c \"pgrep qmmp && qmmp --status || echo 'null'\"");
|
||||
if (debug) qDebug() << "[DE]" << "[getPlayerInfo]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("player")][0]->state() != QProcess::Running) &&
|
||||
(processes[QString("player")][0]->state() != QProcess::Starting))
|
||||
processes[QString("player")][0]->start(cmd);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setPlayer(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setPlayer]";
|
||||
if (debug) qDebug() << "[DE]" << "[setPlayer]" << ":" << "Cmd returns" << exitCode;
|
||||
QString playerName = configuration[QString("PLAYER")];
|
||||
QString qoutput = QString("");
|
||||
QString qstr = QString("");
|
||||
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")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("player")][0]->readAllStandardOutput());
|
||||
if (!qoutput.isEmpty()) {
|
||||
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();
|
||||
}
|
||||
else {
|
||||
int time = qstr.toInt() / 1000;
|
||||
info[2] = QString::number(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playerName == QString("clementine")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("player")][0]->readAllStandardOutput());
|
||||
if (!qoutput.isEmpty()) {
|
||||
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();
|
||||
}
|
||||
else {
|
||||
int time = qstr.toInt() / 1000;
|
||||
info[2] = QString::number(time);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (playerName == QString("mpd")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("player")][0]->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")) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("player")][0]->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();
|
||||
}
|
||||
}
|
||||
}
|
||||
QString source = QString("player");
|
||||
QString key;
|
||||
key = QString("album");
|
||||
setData(source, key, info[0]);
|
||||
key = QString("artist");
|
||||
setData(source, key, info[1]);
|
||||
key = QString("progress");
|
||||
setData(source, key, info[2]);
|
||||
key = QString("duration");
|
||||
setData(source, key, info[3]);
|
||||
key = QString("title");
|
||||
setData(source, key, info[4]);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getPsStats()
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getPsStats]";
|
||||
QString cmd;
|
||||
cmd = QString("ps --no-headers -o command");
|
||||
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("ps")][0]->state() != QProcess::Running) &&
|
||||
(processes[QString("ps")][0]->state() != QProcess::Starting))
|
||||
processes[QString("ps")][0]->start(cmd);
|
||||
cmd = QString("ps -e --no-headers -o command");
|
||||
if (debug) qDebug() << "[DE]" << "[getPsStats]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("ps")][1]->state() != QProcess::Running) &&
|
||||
(processes[QString("ps")][1]->state() != QProcess::Starting))
|
||||
processes[QString("ps")][1]->start(cmd);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setPs(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setPs]";
|
||||
if (debug) qDebug() << "[DE]" << "[setPs]" << ":" << "Cmd returns" << exitCode;
|
||||
QString qoutput = QString("");
|
||||
for (int i=0; i<processes[QString("ps")].count(); i++) {
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("ps")][i]->readAllStandardOutput()).trimmed();
|
||||
if (!qoutput.isEmpty()) {
|
||||
if (debug) qDebug() << "[DE]" << "[setPs]" << ":" << "Found data for cmd" << i;
|
||||
if (i == 0) {
|
||||
// pscount && ps
|
||||
QStringList psList;
|
||||
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
|
||||
if (!qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].
|
||||
contains(QString("ps ")))
|
||||
psList.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
|
||||
QString source = QString("ps");
|
||||
QString key = QString("psCount");
|
||||
setData(source, key, psList.count());
|
||||
key = QString("ps");
|
||||
setData(source, key, psList.join(QString(",")));
|
||||
}
|
||||
else if (i == 1) {
|
||||
// pstotal
|
||||
QString source = QString("ps");
|
||||
QString key = QString("psTotal");
|
||||
setData(source, key, qoutput.split(QChar('\n'), QString::SkipEmptyParts).count());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::getUpgradeInfo(const QString pkgCommand, const int number)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]";
|
||||
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run function with cmd" << pkgCommand;
|
||||
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run function with number" << number;
|
||||
QString cmd = QString("bash -c \"") + pkgCommand + QString(" | wc -l\"");
|
||||
if (debug) qDebug() << "[DE]" << "[getUpgradeInfo]" << ":" << "Run cmd" << cmd;
|
||||
if ((processes[QString("pkg")][number]->state() != QProcess::Running) &&
|
||||
(processes[QString("pkg")][number]->state() != QProcess::Starting))
|
||||
processes[QString("pkg")][number]->start(cmd);
|
||||
}
|
||||
|
||||
|
||||
void ExtendedSysMon::setUpgradeInfo(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
{
|
||||
Q_UNUSED(exitStatus)
|
||||
|
||||
if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]";
|
||||
if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Cmd returns" << exitCode;
|
||||
for (int i=0; i<processes[QString("pkg")].count(); i++) {
|
||||
int pkgNull = 0;
|
||||
int value = 0;
|
||||
QString qoutput = QString("");
|
||||
qoutput = QTextCodec::codecForMib(106)->toUnicode(processes[QString("pkg")][i]->readAllStandardOutput()).trimmed();
|
||||
if (!qoutput.isEmpty()) {
|
||||
if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Found data for cmd" << i;
|
||||
pkgNull = configuration[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts)[i].toInt();
|
||||
value = qoutput.toInt();
|
||||
if (debug) qDebug() << "[DE]" << "[setUpgradeInfo]" << ":" << "Return" << value;
|
||||
QString source = QString("pkg");
|
||||
QString key = QString("pkgCount") + QString::number(i);
|
||||
setData(source, key, value - pkgNull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ExtendedSysMon::sourceRequestEvent(const QString &name)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]";
|
||||
if (debug) qDebug() << "[DE]" << "[sourceRequestEvent]" << ":" << "Run function with source name" << name;
|
||||
return updateSourceEvent(name);
|
||||
}
|
||||
|
||||
|
||||
bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
{
|
||||
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]";
|
||||
if (debug) qDebug() << "[DE]" << "[updateSourceEvent]" << ":" << "Run function with source name" << source;
|
||||
if (source == QString("custom")) {
|
||||
for (int i=0; i<configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts).count(); i++)
|
||||
getCustomCmd(configuration[QString("CUSTOM")].split(QString("@@"), QString::SkipEmptyParts)[i], i);
|
||||
}
|
||||
else if (source == QString("gpu")) {
|
||||
getGpu(configuration[QString("GPUDEV")]);
|
||||
}
|
||||
else if (source == QString("gputemp")) {
|
||||
getGpuTemp(configuration[QString("GPUDEV")]);
|
||||
}
|
||||
else if (source == QString("hddtemp")) {
|
||||
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
|
||||
for (int i=0; i<deviceList.count(); i++)
|
||||
getHddTemp(configuration[QString("HDDTEMPCMD")], deviceList[i], i);
|
||||
}
|
||||
else if (source == QString("pkg")) {
|
||||
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++)
|
||||
getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i], i);
|
||||
}
|
||||
else if (source == QString("player")) {
|
||||
getPlayerInfo(configuration[QString("PLAYER")],
|
||||
configuration[QString("MPDADDRESS")],
|
||||
configuration[QString("MPDPORT")]);
|
||||
}
|
||||
else if (source == QString("ps")) {
|
||||
getPsStats();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
|
||||
|
||||
#include "extsysmon.moc"
|
@ -1,74 +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>
|
||||
#include <QProcess>
|
||||
|
||||
class ExtendedSysMon : public Plasma::DataEngine
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExtendedSysMon(QObject *parent, const QVariantList &args);
|
||||
// update functions
|
||||
void getCustomCmd(const QString cmd,
|
||||
const int number = 0);
|
||||
void getGpu(const QString device);
|
||||
void getGpuTemp(const QString device);
|
||||
void getHddTemp(const QString cmd, const QString device,
|
||||
const int number = 0);
|
||||
void getPlayerInfo(const QString playerName,
|
||||
const QString mpdAddress = 0,
|
||||
const QString mpdPort = 0);
|
||||
void getPsStats();
|
||||
void getUpgradeInfo(const QString pkgCommand,
|
||||
const int number = 0);
|
||||
|
||||
protected:
|
||||
bool sourceRequestEvent(const QString &name);
|
||||
bool updateSourceEvent(const QString &source);
|
||||
QStringList sources() const;
|
||||
|
||||
private slots:
|
||||
void setCustomCmd(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setGpu(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setGpuTemp(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setHddTemp(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setUpgradeInfo(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setPlayer(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void setPs(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
// processes
|
||||
QMap<QString, QList<QProcess*> > processes;
|
||||
// configuration
|
||||
QMap<QString, QString> configuration;
|
||||
bool debug;
|
||||
// reread configuration
|
||||
QString getAllHdd();
|
||||
QString getAutoGpu();
|
||||
void initValues();
|
||||
void readConfiguration();
|
||||
void setKeys();
|
||||
void setProcesses();
|
||||
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})
|