Compare commits

...

394 Commits

Author SHA1 Message Date
494590475a release 2.3.2 2015-07-04 02:35:09 +03:00
27ab7d9cd7 fix cast int as float 2015-07-03 00:05:47 +03:00
1869a68122 fix bug with no actions
set network speed units as MB/s if the value more than 1k KB/s
2015-07-03 00:04:03 +03:00
aa0a4b417d improve battery support 2015-07-01 01:14:04 +03:00
41deb8ef72 fix plasma crash with extquotes
rewrite main widget to use signal-slot model
2015-06-30 07:13:58 +03:00
aa15e13713 update fr translations 2015-06-14 17:19:38 +03:00
ad63f78929 update links to opensuse packages 2015-06-12 15:05:56 +03:00
224e558a98 release 2.3.1 2015-06-11 01:49:22 +03:00
a391df2804 - fix bug with invalid values updates from configuration UI
* merge fan tags to temp ones for better handling
2015-06-10 10:31:41 +03:00
755d0b39f8 Merge pull request #56 from underr/master
Update PT-BR translations
2015-06-06 13:18:40 +03:00
fcd612880f Update PT-BR translations 2015-06-05 21:54:24 -03:00
5aff2d2e4e update Spain translations 2015-06-05 00:19:02 +03:00
5a52c056a7 update Ukrainian translation 2015-06-04 01:54:26 +03:00
42615a6fdc update translation, fix #53 2015-06-02 01:21:03 +03:00
b431d2c6cf Release 2.3.0 2015-06-01 01:40:06 +03:00
f96b3fcb07 implement \r to default json of ExtScripts
some refactoring
bump ApiVer of ExtQuotes
update changelog
2015-05-31 02:57:43 +03:00
f534a6854a try to implement timeouts support to quotes (ref to #54) 2015-05-29 18:29:13 +03:00
b51c97abbb drop qxml, port quotes from xml to json (xml has been used for qt4
branch)
2015-05-28 09:16:27 +03:00
8dc3510a30 more pretty configuration interface
implement quotes changes
2015-05-25 02:28:09 +03:00
fce098cb5c improve work with filters for custom scripts
implement new line filters for widget text
fix bug with html parsing
implement key sorting in combo boxes
2015-05-24 00:03:54 +03:00
5f4bf9ec29 edit readme.md
implement initial support of filters (dep #53)
2015-05-23 02:07:16 +03:00
8c73b2560b Release 2.2.2
* update screenshots
+ add error logging to extquotes
- fix paragraph bug
- fix bug with DP settings
2015-05-22 00:18:14 +03:00
78931b3ae0 fix CMake 2015-05-20 00:39:07 +03:00
a53c5ec38c drop kde4 from master 2015-05-20 00:36:48 +03:00
3bac9ac09f * fix hddtemp definition (create workaround)
* create git pkgbuild
* fix plugin build
* replace hddtemp to smartctl by default
2015-05-19 09:41:15 +03:00
b82d78bcbe implement #51 for upgrade and scripts 2015-05-18 00:57:47 +03:00
396fa95ec3 some refactoring
update resizing
2015-05-17 14:09:08 +03:00
c6cadba4b6 some part of refactoring
move plugin from private
fix translation issue (#50)
2015-05-12 00:19:08 +03:00
daa362fc16 Merge branch 'master' of github.com:arcan1s/awesome-widgets 2015-05-11 01:29:57 +03:00
26c51007e0 some fixes in ui 2015-05-11 01:29:42 +03:00
7919e6d250 update DP paint 2015-05-08 16:49:13 +03:00
88c3e780cf implement tag number support to widget
bump api ver to 2
2015-05-07 00:17:35 +03:00
7f4dfe1060 * more correct sizes in the configuration interface
* remove additional debug information
* increase limits for extscripts intervals to 10000 (fix #48)
2015-05-06 00:31:37 +03:00
15d88ee3ba more correct widget resizing. Create width and height options (#47) 2015-05-05 02:18:39 +03:00
104bb52557 add work with key cache
fix bug with invalid dataengine settings in UI
2015-05-03 03:49:39 +03:00
9a6b883905 fixed bugs with dataengine settings saving 2015-05-02 01:40:20 +03:00
fd8f2127d9 initial support of quotes 2015-04-28 16:43:34 +03:00
7ae90bf82d release 2.2.1 2015-02-24 00:14:04 +03:00
bcf26156d1 * implement interval to extupgrade (ApiVer = 1) (fix #45)
* improve extscript logic
* add cache values to both of them
2015-02-24 00:02:59 +03:00
4cee2535ee add desktop files reconfiguring
fix target on cmake builds
improve cmake version check logic
2015-02-17 03:37:06 +03:00
e1ebd87871 update pkg logic 2015-02-16 13:12:38 +03:00
4cef889fd4 implement is-active properties 2015-02-16 03:45:49 +03:00
d785839d1d remote sensors from deplist 2015-02-16 02:20:22 +03:00
cf6ccc293b update readme 2015-02-16 02:13:37 +03:00
e9ee6150c1 release 2.2.0 (KF5 developer preview) 2015-02-15 19:14:19 +03:00
30577e91ec changes in notifications 2015-02-14 21:25:18 +03:00
e5006ed2d6 fix update pkg
add notify flag
2015-02-13 08:11:56 +03:00
3bd73d0458 fix cppcheck warnings
improvements of interaction with items
2015-02-12 02:57:05 +03:00
4dbf5150fc update supporting files 2015-02-11 07:38:30 +03:00
061244b1d0 update translations
add notifications
edit resizing
fix reading ps
some fixes
2015-02-11 05:04:56 +03:00
8055647f34 * remove panel hidding functions (comment in)
* remove ps calls from DE. Now processes are reading from /proc
* remove qdbus calls from DE. Now mpris information is reading using
  native DBus functions
* update graphicalitem in KDE4

TODO:
* widgets resizing
* tests and optimizations
* update DE configuration for KDE4 package
2015-02-10 18:50:36 +03:00
d74c7cb030 add forgotten freeing 2015-02-09 14:09:18 +03:00
f5006af977 add remove button 2015-02-09 14:08:51 +03:00
16d7d2bc20 update DP
update aw-kde4
2015-02-08 12:57:25 +03:00
6e27717dc8 rollback gi 2015-02-07 01:29:22 +03:00
d1f1d79752 Merge branch 'master' of github.com:arcan1s/awesome-widgets
Conflicts:
	sources/awesome-widget-kde4/graphicalitem.cpp
2015-02-07 01:28:14 +03:00
862d14dc0e udpate aw-kde4 2015-02-06 16:22:31 +03:00
685c0390b4 end porting core part
todo: panels control, windows preview
2015-02-05 12:31:34 +03:00
35a5aa6a6c fix memory leak 2015-02-05 05:32:38 +03:00
681fec4cac start work on desktop panel 2015-02-05 04:26:19 +03:00
bb88892125 add notifications
edit widget.qml
fix bug in monitor
2015-02-04 05:20:00 +03:00
f01fd96cf6 add support of smartctl (TODO remove qdbus calls)
end work on awesome-widget (prerelease state)
2015-02-04 04:17:40 +03:00
eac1319889 some work on tooltip 2015-02-03 08:33:46 +03:00
86d4bd76ea some fixes 2015-02-03 02:01:43 +03:00
27fd4e8f1e end work on awesomewidget
edit setdatabysource method
2015-02-02 08:21:56 +03:00
9611677254 some updates 2015-02-01 03:34:16 +03:00
a61cff7caa remove fucking connector 2015-01-31 07:20:22 +03:00
4966a0a5bf some work on configuration interface
correct file locations
create configuration slots
TODO сделать этот ебаный коннектор или выкинуть его нахуй
2015-01-31 06:10:21 +03:00
b1abf74e89 work on interface 2015-01-30 08:35:22 +03:00
16170c72b0 move back desktop files
add widget configuration
append plugin slots
rewrite KF5 and DE to use ExtUpgrade class
some fixes
2015-01-30 02:43:31 +03:00
c5a0ba3796 end work on core part. Now widget works normally
(except for configuration and appearance)
2015-01-28 07:53:31 +03:00
cce37d66e5 dataengine fixes 2015-01-25 17:26:54 +03:00
c850aaf2a3 some work on porting 2015-01-24 19:16:00 +03:00
43efbbba72 minor changes 2015-01-23 08:36:27 +03:00
3a0cbee39f realize keys methods 2015-01-21 08:06:48 +03:00
213595b3c1 split plugin to classes
rewrite extscripts
fix building
implement several methods
2015-01-20 01:08:21 +03:00
f5fbb80d91 work on plugin 2015-01-19 08:31:48 +03:00
0288e6e1eb edit translations build 2015-01-18 04:16:40 +03:00
6667b45919 edit translations 2015-01-17 23:24:14 +03:00
9ff07241b1 implement general methods to plugin 2015-01-17 02:30:16 +03:00
cc7b7b5659 create skel for aw 2015-01-16 05:27:41 +03:00
3e709f549d port dataengine to kf5 2015-01-16 04:09:39 +03:00
adcf6c942f start work on porting 2015-01-15 18:46:56 +03:00
7415a6830f release 2.1.0 2014-12-31 01:04:50 +03:00
c23846f7b4 update readme 2014-12-28 16:49:43 +03:00
e957a2723b Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-12-26 02:31:29 +03:00
5369bbda65 remove script 2014-12-26 02:31:13 +03:00
6a8842163e update text in version.h 2014-12-25 00:14:03 +03:00
56e7ee3d11 approve translation 2014-12-24 00:05:40 +03:00
ce72c46cd9 Merge pull request #40 from underr/master
pt_BR translation
2014-12-24 00:00:59 +03:00
78ab09c1da pt_BR translation 2014-12-23 14:21:32 -02:00
498a965488 add skel to create rpm and debs 2014-12-23 10:32:18 +03:00
d1d4a97fa4 apply fix to extscripts 2014-12-22 06:19:25 +03:00
8f1e8606d4 update Ukrainian transaltion 2014-12-18 01:37:06 +03:00
b682c6dbd6 update Spanish translation 2014-12-16 09:36:02 +03:00
c8bf047e76 implement #36
fix (?) initialization
update translations
2014-12-15 02:41:39 +03:00
a336d9aa04 fix #37 2014-12-12 01:04:31 +03:00
2272b0c2c0 auto commit 2014-12-12 00:02:48 +03:00
0533ee8cd5 add #38 2014-12-07 03:04:35 +03:00
be792a4c5a add graphical settings 2014-12-03 04:33:13 +00:00
997e13706b add comments to template 2014-11-29 22:48:52 +03:00
6bcb6798a2 fix #37 2014-11-28 21:02:45 +03:00
4e3593a2a9 fix build 2014-11-25 04:00:01 +03:00
4b471593c7 update changelogs 2014-11-24 09:36:17 +03:00
695a85be29 update translations, implement copy method 2014-11-21 05:13:01 +03:00
bae34ba898 update translations, version and readme 2014-11-21 03:28:11 +03:00
93db63b16c * fix naming
* fix notification
2014-11-20 06:13:09 +03:00
0cd2ff6813 rewrite all ui interfaces t oKDE standards 2014-11-20 06:01:56 +03:00
222db43dc1 update extscripts and dp ui files to kde standards 2014-11-20 04:21:24 +03:00
e4be3b2e02 simplify custom script class
remove QGraphicsView border
2014-11-20 04:07:14 +03:00
543e39a7ac Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-11-20 03:18:53 +03:00
ca60a85241 update graphicalitem 2014-11-19 16:19:23 +03:00
2c3c575493 * add .desktop suffix to files if they have not
* remove frameshape
2014-11-19 15:04:10 +03:00
5f37a9d8c7 fix direction 2014-11-19 12:28:43 +03:00
c3420a8393 some simplification of graphicalitem 2014-11-19 12:08:54 +03:00
5ce3a5c213 fix configuration 2014-11-19 11:14:55 +03:00
179a97b01b implement tooltip to configuration interface 2014-11-18 12:58:56 +03:00
f0c79a4dab implement contextual menu to listWidgets 2014-11-18 11:54:23 +03:00
f56f319075 some update on graphical items 2014-11-18 06:56:22 +03:00
f7b7d5b6b4 fix run 2014-11-17 17:38:02 +03:00
3193de1a85 implement ExtScripts configuration 2014-11-17 17:04:31 +03:00
8cdfdd4e81 start work on porting extscripts to *.desktop configuration 2014-11-17 10:29:09 +03:00
16d7ca2005 update extscript to inherit from QDialog 2014-11-17 10:01:57 +03:00
e54ab7e1a5 small update 2014-11-16 22:37:55 +03:00
a335979830 implement grapicalitem settings 2014-11-16 13:33:09 +03:00
8460d07875 implement tryDelete() method 2014-11-16 11:40:16 +03:00
5ec26c7747 implement graphical item to aw (except for configuration) 2014-11-14 07:16:55 +03:00
8aafdb6fc4 update gi to use desktop conf files 2014-11-14 04:19:53 +03:00
9eedaf246f rename ring to circle 2014-11-13 12:03:48 +03:00
e7714042bb yet another fix margin 2014-11-13 11:21:51 +03:00
0f4bbbfba1 some intermediate commit 2014-11-12 05:16:05 +03:00
7069758b73 add colorsettings to DP tooltip
remove deprecated settings from AW
2014-11-10 01:53:27 +03:00
bbc9d72606 fix margin 2014-11-10 00:51:43 +03:00
b53b1111f9 fix tooltip to DP 2014-11-09 08:22:05 +03:00
64fdc4bebe move tooltip to proxydiwget 2014-11-09 04:50:22 +03:00
583046e195 update translations 2014-11-08 18:41:33 +03:00
71b3a4e6ab implement #35 2014-11-07 05:36:36 +03:00
4b90fac0c4 implement #28 2014-11-07 04:56:32 +03:00
2fa0acf13d some intermediate commit 2014-11-06 20:42:53 +03:00
0f9d2e52ab fix #24 2014-11-04 00:06:22 +03:00
373bab14db some edit of external scripts 2014-11-04 00:04:13 +03:00
7e095c4349 implement script function 2014-11-03 06:33:39 +03:00
a4af7ffc07 some improvemance of external scripts 2014-11-03 05:03:14 +03:00
0ab4878b22 update translations 2014-11-01 23:26:47 +03:00
1748829901 implement script feature to the widget 2014-10-31 07:20:14 +03:00
6a41fa2b8a implement script feature to dataengine 2014-10-31 06:13:49 +03:00
2cd04e1f7f end work on extscript class 2014-10-31 04:43:17 +03:00
0a61d926f8 create properties 2014-10-31 01:54:35 +03:00
45c248b101 some intermediate commit 2014-10-30 01:05:09 +03:00
6a784d2e28 remove install script from git pkgbuild 2014-10-27 04:33:16 +03:00
13023a4985 add workaround for #34 to AW 2014-10-27 04:20:13 +03:00
6463ed3bf7 add pkgbuild-git 2014-10-26 17:06:39 +03:00
5bf3847bc9 add checkupdates function 2014-10-15 16:41:31 +04:00
4fc2e238bd fix regexp matching 2014-10-14 05:15:13 +04:00
c18bb61521 implement about window 2014-10-12 15:01:07 +04:00
9e82210463 implement autoupdate function to aw (see #32) 2014-10-11 03:38:19 +04:00
171d545562 add skel for #32 2014-10-10 23:36:11 +04:00
c6fa1f2a79 update tasks 2014-10-08 22:39:39 +04:00
14cee9dbc7 release 2.0.5 2014-10-05 00:20:09 +04:00
5759273e4c add workaroud for resizing 2014-10-04 01:17:34 +04:00
4387bb1e76 some fixes which was introduced with the latest patches 2014-10-02 06:13:10 +04:00
03af5f0e49 upd task, add ability to use $ symbol over $$ 2014-10-02 05:10:02 +04:00
7f6afbcb4d add resizing 2014-10-01 03:15:28 +04:00
4a320bc5d6 more correct destuction 2014-10-01 02:59:47 +04:00
29d34525a3 fix plasma crash caused by label destruction 2014-10-01 02:57:06 +04:00
0ab74b493c fix #31, update submodules 2014-10-01 02:33:10 +04:00
952fa97fcc Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-10-01 02:02:13 +04:00
677ed1ab5e fix update netdev 2014-10-01 02:01:18 +04:00
deb0b3bdbb chenge forceupdate logic 2014-09-29 00:59:19 +04:00
20c85f0d42 fix number of issue 2014-09-28 23:12:33 +04:00
f9a37f0cb2 edit echange log, fix #20 2014-09-26 01:43:22 +04:00
0c8013c26b add tooltip bottom 2014-09-26 01:41:27 +04:00
6b9e19ed58 Merge branch 'master' of github.com:arcan1s/awesome-widgets 2014-09-25 23:25:08 +04:00
432ab694fd update changelog 2014-09-25 23:24:33 +04:00
c506183247 fix battery tooltip 2014-09-24 09:51:46 +04:00
fe822518d5 release 2014-09-21 21:50:03 +04:00
1f9e8221f0 release 2.0.4
battery fixes
2014-09-21 21:49:02 +04:00
d7e93e83a3 release 2.0.3 2014-09-21 21:23:26 +04:00
17c3383616 fix aw geometry 2014-09-21 20:43:27 +04:00
830bab7cb6 add support of several $bat tags. Update translations 2014-09-21 20:19:57 +04:00
0b3832cc32 some work 2014-09-18 21:57:59 +04:00
e64ca5ec08 update TODO 2014-09-16 08:54:08 +04:00
84b93098f2 release 2.0.2 2014-09-16 00:04:31 +04:00
17bef06c98 some fixes, prepare to release 2.0.2 2014-09-15 20:28:09 +04:00
db7573de80 update DP translations 2014-09-15 10:04:57 +04:00
4907496a2e fix text edit dp configuration interface 2014-09-14 00:01:23 +04:00
43daae5529 edit temp conversion 2014-09-13 03:06:00 +04:00
1d1fe469f8 rewrite DP configuration interface 2014-09-12 19:29:31 +04:00
99049164be fix cpu* tags
fix notifiations
2014-09-12 00:03:18 +04:00
f61948d9b3 fix (?) notifications 2014-09-11 00:00:08 +04:00
ea54c54d42 add fan tags 2014-09-10 23:51:14 +04:00
c843c5260d Merge pull request #23 from Lemueler/master
Add Chinese translation for awesome-widgets
2014-09-10 21:52:44 +04:00
a8912074dd Modify Chinese translations 2014-09-10 22:56:21 +08:00
2be0edcb40 Add Chinese translations 2014-09-10 22:40:32 +08:00
fcf7ca233f release 2.0.1 2014-09-10 11:18:36 +04:00
aa127574c4 fix label edge's shading 2014-09-09 03:12:20 +04:00
d72f827984 fix empty values 2014-09-09 02:29:59 +04:00
b7d607bfcc add support of custom interfaces 2014-09-09 02:09:58 +04:00
c727947557 update install script 2014-09-09 00:39:02 +04:00
6864e5bda0 update screenshots and link 2014-09-09 00:34:20 +04:00
4babb3ba04 release 2.0.0 2014-09-09 00:19:20 +04:00
e0aadc48c4 fix acoffline variable 2014-09-09 00:00:57 +04:00
18b6fc6eef update changelog 2014-09-08 02:22:50 +04:00
5406f6f66f update readme 2014-09-08 01:57:18 +04:00
ab966504cc update translations, fix layout, some edit of formating
prepare to release 2.0.0
(I plan to update all translations with next releases)
2014-09-08 01:52:40 +04:00
ce761db924 change layout to gridlayout
remove deprecated functions
2014-09-08 00:36:55 +04:00
f91c80b5b1 rollback taging 2014-09-08 00:09:41 +04:00
97fbb4acc1 update install scripts 2014-09-07 19:40:12 +04:00
554354ce36 update trasnaltions 2014-09-06 16:06:47 +04:00
c007fabe12 some fixes 2014-09-06 15:43:53 +04:00
3b11e39e99 change color 2014-09-05 19:43:04 +04:00
653cc4fd84 add button to insert tag 2014-09-05 11:47:05 +04:00
eae742c559 update translations 2014-09-05 11:22:56 +04:00
e339f5aa1a start porting translations 2014-09-05 11:16:56 +04:00
21a1d8cd1b update to upstream changes 2014-09-04 21:20:44 +04:00
0ea17555b1 update to use cfontdialog 2014-09-04 21:04:44 +04:00
eec87be7a2 add html text interaction 2014-09-04 03:32:37 +04:00
0cd293c4c3 add support of battery tooltip 2014-09-03 22:14:50 +04:00
e5c70b9535 more correct interaction with DataEngines 2014-09-03 15:08:33 +04:00
3ef68f7a43 fix tooltip adding processing 2014-09-03 14:58:01 +04:00
1fbc9e315e update formating 2014-09-03 14:52:52 +04:00
28dafcb721 add ex name 2014-09-02 22:52:17 +04:00
4164c7fe04 commit before renaming 2014-09-02 22:49:17 +04:00
bc8aadc17b fix temperature 2014-09-02 22:20:43 +04:00
cd48ac8245 fix cpu reading 2014-09-02 22:16:13 +04:00
0751d080eb move back layout settings 2014-09-02 22:06:01 +04:00
6c6cfe9a04 fix time and uptime 2014-09-02 21:55:23 +04:00
b61d514cb2 add notification module
fix definition of network deivce
2014-09-02 04:30:43 +04:00
a5c352bc06 add contextual actions
fix icons
2014-09-02 03:56:34 +04:00
54174974b1 edit supported information
update desktop panel to tag changes
2014-09-02 03:29:17 +04:00
fd81fda9a1 fix tooltip
fix memory
remove layout settings
more correct parsing
2014-09-02 02:42:34 +04:00
c69957e905 add configuration interface slots 2014-09-02 01:10:27 +04:00
a65f4cb02f commit before tests 2014-09-01 20:58:47 +04:00
3b89b30a98 fix formating 2014-09-01 12:57:10 +04:00
5921bd4c1d add tooltip 2014-09-01 12:35:43 +04:00
5b26d835df end work on deinteraction module 2014-09-01 03:49:00 +04:00
38c4d3bfaf work on data update 2014-08-31 20:21:06 +04:00
eac50a8799 plasmoid fixes 2014-08-31 18:45:43 +04:00
6e5a068ad2 add battery dataengine 2014-08-31 18:35:35 +04:00
7f639805e6 add connectToEngine() function 2014-08-31 18:07:18 +04:00
8a6650f833 add findKeys() function
it's time to drink!
2014-08-30 18:17:37 +04:00
96cfeb520d add keys 2014-08-30 18:14:56 +04:00
7cd80e14a7 create initialization skeleton 2014-08-30 17:40:25 +04:00
b55d453aeb add checkboxes to tooltip window 2014-08-30 16:30:58 +04:00
7eb5197318 add configChanged() function 2014-08-30 16:17:42 +04:00
e603ad9977 add configAccepted() function 2014-08-30 15:56:05 +04:00
068a976499 add createConfigurationInterface() function 2014-08-30 15:24:19 +04:00
5b44fa5c75 starting of porting ptm to C++ 2014-08-29 10:50:37 +04:00
87614084ab more pretty deconfig page 2014-08-29 10:22:47 +04:00
8ccad0b86c more temperature units: Reaumur, cm^-1, kJ/mol, kcal/mol (really, I use
cm^-1)
2014-08-29 02:19:34 +04:00
0240dee6ea rewrite advanced config to better view 2014-08-29 01:59:14 +04:00
81105fb12d remove dublicates 2014-08-28 23:00:08 +04:00
93abb86340 update to use submodules 2014-08-28 15:35:57 +04:00
5584ba0e9f update to use submodules 2014-08-28 15:21:41 +04:00
2c35031549 add toggle panel configuration 2014-08-28 12:28:52 +04:00
d28d7156ce add raw support to hide panels 2014-08-28 03:06:48 +04:00
123cfcb475 fix according to netctl#9 2014-08-09 20:21:30 +04:00
7fa541bc06 rewrite dataengine to use task 2014-08-07 19:44:29 +04:00
03574461a9 update notifications 2014-08-02 18:36:12 +04:00
f588c9af8d update files 2014-08-02 18:21:39 +04:00
ee39ac9203 add background settings to the tooltip 2014-08-02 17:49:25 +04:00
5ea8c97094 add mpris support 2014-08-02 11:54:57 +04:00
edf3a72564 edited todo list 2014-07-30 19:57:23 +04:00
b9c9aac686 fix twinkle of desktop panel 2014-07-23 17:58:01 +04:00
7dd7251a45 fixes in desktop-panel 2014-07-22 09:49:55 +04:00
1ccbc264ed fix naming 2014-07-21 22:45:22 +04:00
334189b8a1 prerelease 1.11.0 2014-07-21 22:02:54 +04:00
6c7d6a5443 update russian readme 2014-07-09 18:54:54 +04:00
e37f2a7190 add support of tags to cmd 2014-07-09 13:50:46 +04:00
baf21549d5 update eng readme and changlelog 2014-07-09 13:32:33 +04:00
07c2abd5bc update translations 2014-07-09 13:14:48 +04:00
2ea73b2261 add support of desktop label to ptm 2014-07-09 13:12:52 +04:00
7c3b47693e update translations 2014-07-09 10:53:54 +04:00
0fe67ce323 initialization of translation files 2014-07-09 10:34:38 +04:00
bfb7d72faf change lineedit to combobox 2014-07-09 09:59:04 +04:00
662b952961 ended work on ptm-desktop-panel 2014-07-09 09:42:58 +04:00
a81cbe3d9c add interaction with craphical interface 2014-07-09 08:55:33 +04:00
0462bb186e Started work on ptm-desktop-panel widget 2014-07-09 01:00:24 +04:00
9985fe6260 add desktop section to the sysmon 2014-07-08 19:08:08 +04:00
11a6f01ae3 prepare to release 1.10.3
+ added ability to set transparent background
2014-07-08 10:12:20 +04:00
43ee40a65d release 1.10.2 2014-06-11 04:23:46 +04:00
f9eb27964f release 1.10.1 2014-06-10 10:44:34 +04:00
bab9f58b35 try again fix of initialization 2014-06-10 10:42:15 +04:00
608908fd02 fix checking of qmmp 2014-06-10 09:57:30 +04:00
178bbd0bc0 fix first initialization 2014-06-10 09:42:21 +04:00
f8a02a48ac fix 2014-06-10 09:30:31 +04:00
cf39fba9c2 fix error in ps dataengine 2014-06-10 09:27:26 +04:00
6643852822 edit desktop files 2014-06-10 07:59:05 +04:00
7145a1d33e release 1.10.0 2014-06-09 16:57:25 +04:00
a3c1f4ea66 fix force update function 2014-06-09 16:55:51 +04:00
a6ddd53308 small fix 2014-06-09 15:58:04 +04:00
744f3bc04b add setKeys() function 2014-06-09 15:57:15 +04:00
afdf86f03a update archives 2014-06-09 15:41:30 +04:00
8f2784d2a2 prepare to release 1.10.0 2014-06-09 15:41:01 +04:00
926da88c10 fix ps 2014-06-09 15:39:55 +04:00
ea287c21b1 fix player 2014-06-09 15:34:11 +04:00
c0561a95e0 fix hddtemp 2014-06-09 15:20:22 +04:00
b7d1802ca8 fix gpu and gputemp 2014-06-09 15:17:31 +04:00
c659f16d7e fix custom command 2014-06-09 15:10:51 +04:00
79cbfc4b32 fix pkg 2014-06-09 15:04:40 +04:00
61e2a380b9 add support of multithreading to all functions of dataengine 2014-06-09 13:35:52 +04:00
64bc89ba75 edit changelog (prerelease 1.10.0?) 2014-06-09 03:35:58 +04:00
926d112d22 add support of multithreading to dataengine (only for custom command
now)
2014-06-09 03:23:14 +04:00
e205664fec small fix pt_BR files 2014-06-09 01:48:45 +04:00
5d13c8289f Merge branch 'master' of https://github.com/underr/pytextmonitor into underr-master
Conflicts:
	README.md
	sources/ptm/po/pt_BR.po
2014-06-09 01:37:44 +04:00
7ac5d68b02 Fixed 'u's problem 2014-06-08 14:53:13 -03:00
69b5bdec66 Updated Brazillian Portuguese translation and README 2014-06-08 14:51:24 -03:00
5ce7aac9dd edit header of uk.po 2014-06-06 11:48:52 +04:00
80eb7983fc update Ukrainian translation 2014-06-06 01:24:44 +04:00
7e2b1384ae edited script 2014-06-05 19:30:23 +04:00
d573cc7491 update fr translation 2014-06-05 19:25:09 +04:00
b380000d2f Merge pull request #18 from Mermouy/master
fr-translation update
2014-06-05 19:06:09 +04:00
50d96574f5 fr-translation update 2014-06-05 16:19:09 +02:00
d6819e3771 update spanish translation 2014-06-05 10:25:20 +04:00
a54b3064fe add debug information 2014-06-04 22:55:29 +04:00
a0288bcf96 edited readme and changelog 2014-06-04 22:53:51 +04:00
f1e22f122e add support of stretch 2014-06-04 22:49:47 +04:00
52f85836a2 edit size of fields in configuration interface 2014-06-04 16:32:54 +04:00
2ad638c158 edit changelog 2014-06-02 16:00:55 +04:00
cebf3b9aea add support of debug to widget 2014-06-02 15:59:11 +04:00
e32a37043a debug settings for dataengine is read now from environment 2014-06-02 14:44:48 +04:00
246430dc28 small edit of PKGBUILD 2014-06-02 14:29:35 +04:00
dd4471a0d2 fix typo 2014-06-02 14:18:48 +04:00
31c612cfd2 add debug support in DataEngine 2014-06-02 14:16:18 +04:00
2201f4d4a2 remove runtime libraries from dep list, since they aren't needed 2014-06-02 12:16:29 +04:00
886e24d4af add double quotes 2014-06-01 23:34:53 +04:00
fbf5f649ee update Ukrainian translation
fix typo and errors in Russian texts (thanks to Viktor Slobodyan)
2014-06-01 23:29:28 +04:00
7fc7b68358 added support of $hddtotmb and $hddtotgb tags 2014-05-31 14:12:04 +04:00
9904e5d6c6 fix typo 2014-05-29 18:17:15 +04:00
e10f3396b9 added ability to use vertical layout 2014-05-29 18:13:32 +04:00
25ff5a9189 fix charset 2014-05-29 00:54:43 +04:00
41b1282488 edited readme 2014-05-29 00:42:38 +04:00
5d46988745 small fix 2014-05-29 00:33:23 +04:00
71823471cc fix bug with saving settings
added 'enable popup message'
2014-05-29 00:30:23 +04:00
fe580ef806 removed util.py
removed createNotifyrc function
2014-05-28 23:27:05 +04:00
b1f8340774 fix version 2014-05-28 22:43:19 +04:00
e868b03454 fix icons 2014-05-28 22:23:49 +04:00
632adfa54c refactoring of configuration interface 2014-05-28 21:52:55 +04:00
4476ec8e45 fix default tab in configuration interface 2014-05-28 20:27:17 +04:00
b4f7b6e65a updated readme 2014-05-28 18:07:11 +04:00
77349e797f small changes in supporting scripts 2014-05-28 10:24:26 +04:00
e7b6e4a3bf added support of disable ooption to dataengine 2014-05-27 16:15:49 +04:00
3d8f88d935 added support of disable option to dataengine 2014-05-27 15:52:08 +04:00
1eed0f458c update notification for clementine 2014-05-27 12:09:41 +04:00
9b581a882f updated gui translations 2014-05-27 12:07:03 +04:00
6ba1288c50 moved player settings from plasmoid to dataengine
try to fix creating a lot of zombies
2014-05-27 09:11:53 +04:00
926c283338 updated changlelog 2014-05-27 01:31:32 +04:00
8519eb51bd added create_diff
+added tags $*tot*
2014-05-27 01:30:20 +04:00
f05b256306 updated changelog 2014-05-26 12:22:00 +04:00
6fd7bad8f9 changed from md readme to html 2014-05-26 12:18:39 +04:00
6f4ecbd107 fix typo 2014-05-24 20:27:07 +04:00
9f392c3a19 edited update netdevice 2014-05-24 18:08:03 +04:00
e04430e36c added Ukrainian readme 2014-05-24 17:09:08 +04:00
68759513a9 added Ukrainian translation. Thanks to Виктор Слободян 2014-05-24 16:27:24 +04:00
62164f8229 added support of text update contextual action 2014-05-24 16:06:45 +04:00
7c5e02217b prepare to add updateText function 2014-05-24 14:15:48 +04:00
23cd74132a set pkgcmd combobox untranslatable 2014-05-23 12:08:38 +04:00
5dfb02bf9d removed checking playerName in getPlayerInfo() 2014-05-23 12:04:24 +04:00
2d0a92eec1 fix reading clementine 2014-05-23 11:52:04 +04:00
359e81ff93 yaf of pt_BR translation 2014-05-23 11:48:15 +04:00
1bd80ba786 updated changelog 2014-05-22 11:51:18 +04:00
2a04414600 update readme 2014-05-22 11:49:46 +04:00
fe51e67ba4 added support of clementine to plasmoid 2014-05-22 11:45:20 +04:00
e208be7894 added support of clementine to dataengine 2014-05-22 11:41:39 +04:00
26bf118d50 remove message from install 2014-05-22 03:07:11 +04:00
86da48bbca update readme 2014-05-22 03:06:43 +04:00
d081a64889 edited supporting materials 2014-05-22 02:49:28 +04:00
3d2c09647a update pt_BR translation and fix small typos 2014-05-22 02:46:27 +04:00
c7a99a6d0d Merge pull request #16 from underr/master
Brazillian Portuguese translation
2014-05-22 02:45:35 +04:00
c0a273f9f7 added support of hddtempcmd to GUI
edited readme call
2014-05-22 02:43:54 +04:00
5d724ac688 Brazillian Portuguese translation 2014-05-21 19:18:44 -03:00
8e318a99d0 added support of cmd to dataengine 2014-05-22 01:27:50 +04:00
5c861b3814 release 1.9.0 2014-05-21 19:56:59 +04:00
5cf068875c Merge pull request #15 from Mermouy/master
update fr translation
2014-05-21 19:47:00 +04:00
80366e59bb fr translation 2014-05-21 17:01:15 +02:00
a6a94f0e49 update 2014-05-20 11:13:02 +04:00
6a74802261 fix typo 2014-05-20 11:08:21 +04:00
c44e98d8a1 fix 2014-05-20 11:07:24 +04:00
b872a66088 added status of translation 2014-05-20 11:06:50 +04:00
74d54d6268 fix typo 2014-05-20 10:48:52 +04:00
2ad6d76d4e updated readme (added link) 2014-05-20 10:47:15 +04:00
878dac158e added TRANSLATORS.md 2014-05-20 10:44:51 +04:00
2de09cec32 prepare to release 1.9.0
+ added support of several custom commands
* fix parsing pkg label
2014-05-20 10:07:01 +04:00
90ca8c89f5 added support of several custom commands to dataengine 2014-05-20 09:48:07 +04:00
757d7b703f update Spain translations 2014-05-19 23:05:32 +04:00
5d3e377ffb yet another update readme (hope actual for 1.9.0) 2014-05-19 21:29:10 +04:00
9b5a6908d7 fix typo 2014-05-19 21:23:22 +04:00
f54ba7a6cf updated en readme 2014-05-19 21:22:11 +04:00
7427183981 fix typo 2014-05-19 11:57:06 +04:00
109328e33b rollback fr translation 2014-05-19 11:55:28 +04:00
ec62e93e4e prepare to add support of several custom command 2014-05-19 03:06:29 +04:00
1a6d97800c added hdd speed label 2014-05-19 02:48:00 +04:00
b09e90a0e5 added context menu 2014-05-19 00:59:48 +04:00
c1f18a31bf release 1.8.3 2014-05-12 23:56:52 +04:00
166 changed files with 21849 additions and 9203 deletions

7
.gitignore vendored
View File

@ -1,4 +1,7 @@
sources/build
sources/usr
*src.tar.xz
*src.tar.gz
*src.tar.[gx]z
*pkg.tar.[gx]z
build
src
pkg

12
.gitmodules vendored Normal file
View 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

View File

@ -2,4 +2,8 @@ Current developers:
Evgeniy Alekseev aka arcanis <esalexeev (at) gmail (dot) com>
Translators:
@Mermouy (french translations)
@Mermouy (French translation)
Ernesto Avilés Vzqz (Spanish translation)
@underr (Brazillian Portuguese translation)
Виктор Слободян (Ukrainian translation)
Steve Lemuel (Chinese translation)

286
CHANGELOG
View File

@ -1,26 +1,206 @@
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
Ver.1.10.1:
- fix error with number formats in ps label
- fix first initialization of DataEngine
- fix checking of qmmp
Ver.1.10.0:
+ add tags $hddtotmb, $hddtotgb
+ add tags $memtotmb, $memtotgb, $swaptotmb, $swaptotgb
+ add ability for force update text
+ add support of clementine
+ add support of hddtemp cmd
+ add support of disable option for HDDDEV and GPUDEV
+ add error checking of DataEngine variables
+ add multithreading to DataEngine
+ add ability to disable popup messages
+ add ability to use vertical layout
+ add ability to add stretch
+ add ability to show debug information (set environment variable 'PTM_DEBUG' to 'yes')
+ add Brazillian Portuguese translation (@underr)
+ add Ukrainian translation (Виктор Слободян)
- remove util.py
- remove createNotifyrc since it isn't needed
* refactoring of configuration interface
* player settings was moved from plasmoid to DataEngine
* edit readme call
* change readme from md to html
Ver.1.9.0:
+ add support of several custom commands ($customN)
+ add hdd speed label ($hddrN, $hddwN)
+ add actions to context menu (open readme and run ksysguard)
- remove doubleclick event
* fix parsing pkg label
Ver.1.8.3:
+ add Spanish translation (thanks to Ernesto Avilés Vzqz)
+ add readme to the package
Ver.1.8.2:
+ 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
@ -29,108 +209,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

View File

@ -1,3 +1,183 @@
Вер.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
Вер.1.10.1:
- пофикшена ошибка с форматами чисел в поле ps
- пофикшена инициализация значений в DataEngine
- пофикшена проверка qmmp
Вер.1.10.0:
+ добавлены теги $hddtotmb, $hddtotgb
+ добавлены теги $memtotmb, $memtotgb, $swaptotmb, $swaptotgb
+ добавлена возможность форсированного обновления
+ добавлена поддержка clementine
+ добавлена поддержка команды hddtemp
+ добавлены поддержка disable для HDDDEV и GPUDEV
+ добавлена многопоточность в DataEngine
+ добавлена проверка ошибок для переменных DataEngine
+ добавлена возможность отключения всплывающих сообщений
+ добавлена возможность использовать вертикальную разметку
+ добавлена возможность добавить пустое пространство
+ добавлена возможность вывода отладочной информации (установите переменную окружения 'PTM_DEBUG' в 'yes')
+ добавлен перевод Brazillian Portuguese (@underr)
+ добавлена украинская локализация (Виктор Слободян)
- удален util.py
- удалены функции createNotifyrc, поскольку они больше не нужны
* рефакторинг конфигурационного интерфейса
* настройки плеера были перенесены из виджета в DataEngine
* исправлен вызов readme под четырехсимвольное обозначение
* перенос readme с md на html
Вер.1.9.0:
+ добавлена поддержка нескольких кастомных команд ($customN)
+ добавлено поле скорости hdd ($hddrN, $hddwN)
+ добавлены действия в контекстное меню (открыть readme и запустить ksysguard)
* исправлен парсинг поля pkg
- убрано событие по двойному клику
Вер.1.8.3:
+ добавлен испанский перевод (Ernesto Avilés Vzqz)
+ добавлены файлы readme
Вер.1.8.2:
+ добавлены различные температурные единицы (Farenheit и Kelvin)

View File

@ -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.

View File

@ -1,42 +0,0 @@
# Maintainer: Evgeniy "arcanis" Alexeev <arcanis.arch at gmail dot com>
pkgname=kdeplasma-applets-pytextmonitor
_pkgname=pytextmonitor
pkgver=1.8.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=('GPLv3')
depends=('kdebase-workspace' 'kdebindings-python2' 'lm_sensors')
optdepends=("amarok: for music player monitor"
"catalyst: for GPU monitor"
"hddtemp: for HDD temperature monitor"
"mpd: for music player monitor"
"net-tools: for popup messages"
"nvidia-utils: for GPU monitor"
"qmmp: for music player monitor"
"sysstat: for popup messages")
makedepends=('automoc4' 'cmake')
source=(https://github.com/arcan1s/pytextmonitor/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
install=${pkgname}.install
md5sums=('2d5f5a2587c32cce3721ea217564a4ec')
backup=('usr/share/config/extsysmon.conf')
prepare() {
[[ -d ${srcdir}/build ]] && rm -rf "${srcdir}/build"
mkdir "${srcdir}/build"
}
build () {
cd "${srcdir}/build"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) \
"../${_pkgname}"
make
}
package() {
cd "${srcdir}/build"
make DESTDIR="${pkgdir}" install
}

213
README.md
View File

@ -1,220 +1,75 @@
pytextmonitor
=============
awesome-widgets (ex-pytextmonitor)
==================================
Information
-----------
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
**NOTE** LOOKING FOR TRANSLATORS!
A collection of minimalistic widgets which looks like Awesome Window Manager widgets.
Configuration
-------------
For edited output you must open Settings window and setup output format in lines:
* tag `$time` - time in default format. For example, *fri Nov 6 04:48:01 2013*
* tag `$isotime` - time in iso format
* tag `$shorttime` - time in short locale format
* tag `$longtime` - time in long locale format
* tag `$custom` - custom time format
* tag `$uptime` - uptime, *---d--h--m*
* tag `$custom` - custom uptime format
* tag `$cpu` - total load cpu, *%*
* tag `$cpuN` - load CPU for core N, *%*
* tag `$cpucl` - average cpu clock, *MHz*
* tag `$cpuclN` - cpu clock for core N, *MHz*
* tag `$tempN` - temperature for device N. For example, `$temp0`
* tag `$gpu` - GPU usage, *%*. `aticonfig` or `nvidia-smi` must be installed
* tag `$gputemp` - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
* tag `$mem` - usage memory, *%*
* tag `$memmb` - usage memory, *MB*
* tag `$memgb` - usage memory, *GB*
* tag `$swap` - swap, *%*
* tag `$swapmb` - swap, *MB*
* tag `$swapgb` - swap, *GB*
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
* tag `$hddtempN` - temperature for HDD N. For example, `$hddtemp0`
* tag `$down` - download speed, *KB/s*
* tag `$up` - upload speed, *KB/s*
* tag `$netdev` - current network device
* tag `$bat` - battery charge, *%*
* tag `$ac` - status AC device. Return (\*) if AC device is online or *( )* if offline
* tag `$album` - current song album. One of supported music players must be installed
* tag `$artist` - current song artist. One of supported music players must be installed
* tag `$progress` - current song progress. One of supported music players must be installed
* tag `$time` - current song duration. One of supported music players must be installed
* tag `$title` - current song title. One of supported music players must be installed
* tag `$pscount` - number of running processes
* tag `$pstotal` - total number of processes
* tag `$ps` - list of running processes
* tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
* tag `$custom` - returns output for custom command
**NOTE** [LOOKING FOR TRANSLATORS!](https://github.com/arcan1s/awesome-widgets/issues/14)
Label order will changed if you change slider position. HTML tags in label work normally.
Features
========
**NOTE** you don't may set to show `$cpu` tag in swap label for example. **`$cpu` will work only in cpu label**.
* easy and fully configurable native Plasma widget which may be used as Conky widget or as Awesome-like information panel
* panel which shows active desktop status
* clear Conky-like configuration with html tags support
* custom command support (it may be simple action as well as special custom tag)
* graphical item support - tooltips, bars
Advanced settings
-----------------
**Custom time**
See [links](#Links) for more details.
* 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**
List of hard disk devices, which will be observed in hddtem label (combo box items come from `find`). List widget is editable, delete key will remove current item.
**Network directory**
Path to directory, which contains network devices information. Default is `/sys/class/net`. Required for auto select network device.
**Network device**
Use specified device as active. Combo box items come from **network directory**. Will disable auto select network device.
**Battery device**
File with battery information. File (`/sys/class/power_supply/BAT0/capacity` by default) should contain only battery charge in percent.
**AC online tag**
Line which will be shown when AC is online.
**AC offline tag**
Line which will be shown when AC is offline.
**AC device**
File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online.
**Music player**
Select one of supported music playes for player label.
Tooltip settings
----------------
Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.
DataEngine settings
-------------------
**Custom command**
*NOTE* This can cause the computer freeze.
A command, which will be run for custom label.
**GPU device**
Select one of supported GPU devices. `auto` will enable auto selection. Default is `auto`.
**HDD**
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices. Default is `all`.
**MPD address**
Address of MPD server. Default is `localhost`.
**MPD port**
Port of MPD server. Default is `6600`.
**Package manager**
List of commands, which will be run. Number of null lines is a number of unneeded lines. Defaults:
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
DataEngine configuration
------------------------
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
**Didn't find required feature?** [Just ask for it!](https://github.com/arcan1s/awesome-widgets/issues)
Instruction
===========
Dependencies
------------
* kdebase-workspace
* kdebindings-python2
* lm_sensors (*for definition temperature device*)
* sysstat (*for notification*)
* plasma-framework
Optional dependencies
---------------------
* proprietary video driver
* hddtemp (make sure that it may be run with `sudo` without password. Just add following line to `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
* music player (amarok, mpd or qmmp)
* hddtemp
* smartmontools
* music player (mpd or supported MPRIS)
Make dependencies
-----------------
* automoc4
* cmake
* kdebase-runtime
* extra-cmake-modules
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` ../
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

40
arch/PKGBUILD Normal file
View File

@ -0,0 +1,40 @@
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
pkgname=plasma5-applet-awesome-widgets
_pkgname=awesome-widgets
pkgver=2.3.2
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=('8902769bcfd223c8c28fa6a9cf492b41')
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
View 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
}

View File

@ -0,0 +1,11 @@
post_install() {
kbuildsycoca5 > /dev/null 2>&1
}
post_upgrade() {
post_install "$1"
}
post_remove() {
post_install "$1"
}

View File

@ -1,15 +1,16 @@
#!/bin/bash
# update english readme
cp README.md readme/en.md
SRCDIR="sources"
VERSION=$(grep -m1 PROJECT_VERSION_MAJOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
$(grep -m1 PROJECT_VERSION_MINOR sources/CMakeLists.txt | awk '{print $3}' | cut -c 1).\
$(grep -m1 PROJECT_VERSION_PATCH sources/CMakeLists.txt | awk '{print $3}' | cut -c 1)
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,19 +19,23 @@ tar cJf "${ARCHIVE}-${VERSION}-src.tar.xz" "${ARCHIVE}"
rm -rf "${ARCHIVE}"
# build widget
ARCHIVE="pytextmonitor"
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING readme"
IGNORELIST="build usr"
ARCHIVE="awesome-widgets"
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
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}"
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}"
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 {} \;

View File

@ -1,24 +0,0 @@
func_update() {
cat << EOF
Update plasmoids...
EOF
kbuildsycoca4 > /dev/null 2>&1
}
post_install() {
func_update
cat << EOF
Make sure that \`hddtemp\` can be run with sudo without password
EOF
}
post_upgrade() {
func_update
cat << EOF
Make sure that \`hddtemp\` can be run with sudo without password
EOF
}
post_remove() {
func_update
}

View File

@ -1,220 +0,0 @@
pytextmonitor
=============
Information
-----------
PyTextMonitor is a minimalistic Plasmoid script written on Python2. It looks like widgets in awesome-wm.
**NOTE** LOOKING FOR TRANSLATORS!
Configuration
-------------
For edited output you must open Settings window and setup output format in lines:
* tag `$time` - time in default format. For example, *fri Nov 6 04:48:01 2013*
* tag `$isotime` - time in iso format
* tag `$shorttime` - time in short locale format
* tag `$longtime` - time in long locale format
* tag `$custom` - custom time format
* tag `$uptime` - uptime, *---d--h--m*
* tag `$custom` - custom uptime format
* tag `$cpu` - total load cpu, *%*
* tag `$cpuN` - load CPU for core N, *%*
* tag `$cpucl` - average cpu clock, *MHz*
* tag `$cpuclN` - cpu clock for core N, *MHz*
* tag `$tempN` - temperature for device N. For example, `$temp0`
* tag `$gpu` - GPU usage, *%*. `aticonfig` or `nvidia-smi` must be installed
* tag `$gputemp` - GPU temperature. `aticonfig` or `nvidia-smi` must be installed
* tag `$mem` - usage memory, *%*
* tag `$memmb` - usage memory, *MB*
* tag `$memgb` - usage memory, *GB*
* tag `$swap` - swap, *%*
* tag `$swapmb` - swap, *MB*
* tag `$swapgb` - swap, *GB*
* tag `$hddN` - usage for mount point N, *%*. For example, `$hdd0`
* tag `$hddtempN` - temperature for HDD N. For example, `$hddtemp0`
* tag `$down` - download speed, *KB/s*
* tag `$up` - upload speed, *KB/s*
* tag `$netdev` - current network device
* tag `$bat` - battery charge, *%*
* tag `$ac` - status AC device. Return (\*) if AC device is online or *( )* if offline
* tag `$album` - current song album. One of supported music players must be installed
* tag `$artist` - current song artist. One of supported music players must be installed
* tag `$progress` - current song progress. One of supported music players must be installed
* tag `$time` - current song duration. One of supported music players must be installed
* tag `$title` - current song title. One of supported music players must be installed
* tag `$pscount` - number of running processes
* tag `$pstotal` - total number of processes
* tag `$ps` - list of running processes
* tag `$pkgcountN` - number of packages, which available to upgrade for command N. For example, `$pkgcount0`
* tag `$custom` - returns output for custom command
Label order will changed if you change slider position. HTML tags in label work normally.
**NOTE** you don't may set to show `$cpu` tag in swap label for example. **`$cpu` will work only in cpu label**.
Advanced settings
-----------------
**Custom time**
* tag `$dddd` - weekday in long format
* tag `$ddd` - weekday in short format
* tag `$dd` - day
* tag `$d` - day without zero
* tag `$MMMM` - month in long format
* tag `$MMM` - month in short format
* tag `$MM` - month
* tag `$M` - month without zero
* tag `$yyyy` - year
* tag `$yy` - year in short format
* tag `$hh` - hours
* tag `$h` - hours without zero
* tag `$mm` - minutes
* tag `$m` - minutes without zero
* tag `$ss` - seconds
* tag `$s` - seconds without zero
**Custom uptime**
* tag `$dd` - uptime days
* tag `$d` - uptime days without zero
* tag `$hh` - uptime hours
* tag `$h` - uptime hours without zero
* tag `$mm` - uptime minutes
* tag `$m` - uptime minutes without zero
**Temperature 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**
List of hard disk devices, which will be observed in hddtem label (combo box items come from `find`). List widget is editable, delete key will remove current item.
**Network directory**
Path to directory, which contains network devices information. Default is `/sys/class/net`. Required for auto select network device.
**Network device**
Use specified device as active. Combo box items come from **network directory**. Will disable auto select network device.
**Battery device**
File with battery information. File (`/sys/class/power_supply/BAT0/capacity` by default) should contain only battery charge in percent.
**AC online tag**
Line which will be shown when AC is online.
**AC offline tag**
Line which will be shown when AC is offline.
**AC device**
File with AC information. File (`/sys/class/power_supply/AC/online` by default) must contain `1` if AC is online.
**Music player**
Select one of supported music playes for player label.
Tooltip settings
----------------
Since version 1.7.0 CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make the needed checkboxes a fully checked. The number of stored values can be set in the tab. Colors of graphs are configurable too.
DataEngine settings
-------------------
**Custom command**
*NOTE* This can cause the computer freeze.
A command, which will be run for custom label.
**GPU device**
Select one of supported GPU devices. `auto` will enable auto selection. Default is `auto`.
**HDD**
Select one of HDDs for HDD temperature monitor. `all` will enable monitor for all devices. Default is `all`.
**MPD address**
Address of MPD server. Default is `localhost`.
**MPD port**
Port of MPD server. Default is `6600`.
**Package manager**
List of commands, which will be run. Number of null lines is a number of unneeded lines. Defaults:
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
DataEngine configuration
------------------------
You may edit DataEngine configuration. It is `/usr/share/config/extsysmon.conf` or `$HOME/share/config/extsysmon.conf` depending on the type of installation. Uncomment needed line and edit it.
Instruction
===========
Dependencies
------------
* kdebase-workspace
* kdebindings-python2
* lm_sensors (*for definition temperature device*)
* sysstat (*for notification*)
Optional dependencies
---------------------
* proprietary video driver
* hddtemp (make sure that it may be run with `sudo` without password. Just add following line to `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
* music player (amarok, mpd or qmmp)
Make dependencies
-----------------
* automoc4
* cmake
* kdebase-runtime
Installation
------------
* download sources
* install
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
make && make install
Also you may install it to `/`:
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
make && sudo make install
Additional information
======================
TODO (wish list)
----------------
Links
-----
* [Homepage](http://arcanis.name/projects/pytextmonitor/)
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/) package

View File

@ -1,217 +0,0 @@
pytextmonitor
=============
Информация
----------
PyTextMonitor - минималистичный плазмоид, написанный на Python2. Он выглядит, как виджеты в Awesome WM.
Настройка
---------
Для редактирования внешнего виде, откройте окно настроек и установите требуемый формат в поля:
* тег `$time` - время в стандартном формате. Например, *fri Nov 6 04:48:01 2013*
* тег `$isotime` - время в ISO формате
* тег `$shorttime` - время в коротком формате
* тег `$longtime` - время в длинном формате
* тег `$custom` - свой формат времени
* тег `$uptime` - время работы, *---d--h--m*
* тег `$custom` - свой формат аптайма
* тег `$cpu` - общая загрузка CPU, *%*
* тег `$cpuN` - загрузка CPU для ядра N, *%*
* тег `$cpucl` - средняя частота CPU, *MHz*
* тег `$cpuclN` - частота CPU для ядра N, *MHz
* тег `$tempN` - температура для устройства N. Например, `$temp0`
* тег `$gpu` - использование GPU, *%*. `aticonfig` или `nvidia-smi` должны быть установлены
* тег `$gputemp` - температура GPU. `aticonfig` или `nvidia-smi` должны быть установлены
* тег `$mem` - использование RAM, *%*
* тег `$memmb` - использование RAM, *MB*
* тег `$memgb` - использование RAM, *GB*
* тег `$swap` - swap, *%*
* тег `$swapmb` - swap, *MB*
* тег `$swapgb` - swap, *GB*
* тег `$hddN` - использование точки монтирования N, *%*. Например, `$hdd0`
* тег `$hddtempN` - температура HDD N. Например, `$hddtemp0`
* тег `$down` - скорость загрузки, *KB/s*
* тег `$up` - скорость отдачи, *KB/s*
* тег `$netdev` - текущий сетевой интерфейс
* тег `$bat` - заряд батареи, *%*
* тег `$ac` - статус адаптора питания. Возвращает (\*), если AC подключен или *( )*, если нет
* тег `$album` - альбом. Один из поддерживаемых плееров должен быть установлен
* тег `$artist` - исполнитель. Один из поддерживаемых плееров должен быть установлен
* тег `$progress` - прогресс. Один из поддерживаемых плееров должен быть установлен
* тег `$time` - длительность. Один из поддерживаемых плееров должен быть установлен
* тег `$title` - название. Один из поддерживаемых плееров должен быть установлен
* тег `$pscount` - число запущенных процессов
* тег `$pstotal` - общее число процессов
* тег `$ps` - список процессов
* тег `$pkgcountN` - число пакетов, которые могут быть обновлены, для команды N. Например, `$pkgcount0`
* тег `$custom` - возвращает результат своей команды
Порядок полей изменится, если вы измените позицию слайдеров. HTML теги в полях работают корректно.
**ЗАМЕЧАНИЕ** вы не можете установить тег `$cpu`, например, в поле swap. **`$cpu` будет работать только в поле CPU**.
Расширенные настройки
---------------------
**Свой формат времени**
* тег `$dddd` - день недели в длинном формате
* тег `$ddd` - день недели в коротком формате
* тег `$dd` - день
* тег `$d` - день без нуля
* тег `$MMMM` - месяц в длинном формате
* тег `$MMM` - месяц в коротком формате
* тег `$MM` - месяц
* тег `$M` - месяц без нуля
* тег `$yyyy` - год
* тег `$yy` - год в коротком формате
* тег `$hh` - часы
* тег `$h` - часы без нуля
* тег `$mm` - минуты
* тег `$m` - минуты без нуля
* тег `$ss` - секунды
* тег `$s` - секунды без нуля
**Свой формат аптайма**
* тег `$dd` - дни аптайма
* тег `$d` - дни аптайма без нуля
* тег `$hh` - часы аптайма
* тег `$h` - часы аптайма без нуля
* тег `$mm` - минуты аптайма
* тег `$m` - минуты аптайма без нуля
**Температурные единицы**
Выберете единицы температуры. Доступные единицы следующие: Цельсий, Фаренгейт и Кельвин.
**Датчики температуры**
Список датчиков, которые будут наблюдаться в поле temo (содержимое комбо бокса берется из `sensors`). Виджет редактируем, клавиша delete удалит текущую строку.
**Точки монтирования**
Список точек монтирования, которые будут наблюдаться в поле hdd (содержимое комбо бокса берется из `mount`). Виджет редактируем, клавиша delete удалит текущую строку.
**HDD**
Список HDD, которые будут наблюдаться в поле hddtemp (содержимое комбо бокса берется из `find`). Виджет редактируем, клавиша delete удалит текущую строку.
**Директория с сетевыми интерфейсами**
Путь к директории, которая содержит информацию о сетевых интерфейсах. По умолчанию `/sys/class/net`. Требуется для определения сетевого устройства.
**Сетевое устройство**
Использовать указанный интерфейс, как активный. Содержимое комбо бокса берется из **директории с сетевыми интерфейсами**. Эта опция отключит авто определение интерфейса.
**Устройство батареи**
Файл с информацией о батарее. Данный файл (`/sys/class/power_supply/BAT0/capacity` по умолчанию) должен содержать только заряд батареи в процентах.
**AC online тег**
Строка, которая будет показана, когда AC онлайн.
**AC offline тег**
Строка, которая будет показана, когда AC оффлайн.
**Устройство AC**
Файл с информацией об адапторе питания. Данный файл (`/sys/class/power_supply/AC/online` по умолчанию) должен содержать `1`, если адаптор подключен.
**Музыкальные плеер**
Выберете один из поддерживаемых музыкальных плееров.
Настройки тултипа
-----------------
Начиная с версии 1.7.0 поля CPU, частота CPU, память, swap и сеть поддерживают графический тултип. Чтобы включить их, просто сделайте требуемые чекбоксы полностью чекнутыми. Число хранимых значений может быть выставленно в данной вкладке. Цвета графиков также настраиваются.
Настройки DataEngine
--------------------
**Своя команда**
*ЗАМЕЧАНИЕ* Может вызвать зависание компьютера.
Команда, которая будет запущена для соответствующего поля.
**Устройство GPU**
Выберете одно из поддерживаемых устройств GPU. `auto` включит автоматическое определение. По умолчанию `auto`.
**HDD**
Выберете один из HDD для монитора его температуры. `all` включит монитор для всех доступных устройств. По умолчанию `all`.
**Адрес MPD**
Адрес MPD сервера. По умолчанию `localhost`.
**Порт MPD**
Порт MPD сервера. По умолчанию `6600`.
**Package manager**
Список команд, которые будут запущены. Число пустых строк - число ненужных для подсчета строк. Стандартные настройки:
* *Arch*: `PKGCMD=pacman -Qu`, `PKGNULL=0`
* *Debian*: `PKGCMD=apt-show-versions -u -b`, `PKGNULL=0`
* *Ubuntu*: `PKGCMD=aptitude search '~U'`, `PKGNULL=0`
* *Fedora*: `PKGCMD=yum list updates`, `PKGNULL=3`
* *FreeBSD*: `PKGCMD=pkg_version -I -l '<'`, `PKGNULL=0`
* *Mandriva*: `PKGCMD=urpmq --auto-select`, `PKGNULL=0`
Настройка DataEngine
--------------------
Вы можете отредактировать настройки DataEngine вручную. Откройте файл `/usr/share/config/extsysmon.conf` или `$HOME/.kde4/share/config/extsysmon.conf`, в зависимости от типа установки. Раскомментируйте требуемые строки и отредактируйте их.
Инструкция
==========
Зависимости
-----------
* kdebase-workspace
* kdebindings-python2
* lm_sensors (*для определения датчиков температуры*)
* sysstat (*для уведомлений*)
Опциональные зависимости
------------------------
* проприетарный видеодрайвер
* hddtemp (убедитесь, что может быть запущен с `sudo` без пароля. Просто добавьте следующую строку в `/etc/sudoers`: `$USERNAME ALL=NOPASSWD: /usr/bin/hddtemp`)
* музыкальный плеер (amarok, mpd или qmmp)
Зависимости сборки
------------------
* automoc4
* cmake
* kdebase-runtime
Установка
---------
* скачать исходный архив
* установить
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
make && make install
Для установки в `/`:
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
make && sudo make install
Дополнительная информация
=========================
TODO (wish list)
----------------
Ссылки
------
* [Домашняя страница](http://arcanis.name/projects/pytextmonitor/)
* Виджет на [kde-look](http://kde-look.org/content/show.php/Py+Text+Monitor?content=157124)
* DataEngine на [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
* Пакет для Archlinux в [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-pytextmonitor/)

BIN
screenshots/config_01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
screenshots/config_02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
screenshots/config_03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
screenshots/config_04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

BIN
screenshots/config_05.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
screenshots/config_06.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

View 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

View 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
View 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

Submodule sources/3rdparty/pdebug added at 294a590bb9

1
sources/3rdparty/task vendored Submodule

Submodule sources/3rdparty/task added at d2798204a1

1
sources/3rdparty/tasks vendored Submodule

Submodule sources/3rdparty/tasks added at 230bdecd2c

View File

@ -1,27 +1,46 @@
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 2.8.12)
cmake_policy (SET CMP0003 OLD)
cmake_policy (SET CMP0002 OLD)
cmake_policy (SET CMP0011 NEW)
cmake_policy (SET CMP0015 NEW)
project (pytextmonitor)
set (PROJECT_VERSION_MAJOR 1)
set (PROJECT_VERSION_MINOR 8)
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 2)
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)
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)

View 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)

View 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

View 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"
}
}

View 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>

View 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]")
}
}

View 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]")
}
}

View 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]")
}
}

View 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)
}
}

View 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
}
}

View 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.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
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()
}
}

View File

@ -0,0 +1 @@
singleton general general.qml

View 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]")
}
}

View 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)
}
}

View 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.2
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

View 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})

View 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>&copy; %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);
}

View 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 */

View 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);
}

View 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 */

File diff suppressed because it is too large Load Diff

View 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 */

View 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")];
}
}

View 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 */

View 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

View 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

View 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

View 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

View 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;
}

View 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 */

View 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>

View File

@ -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

View File

@ -0,0 +1,3 @@
module org.kde.plasma.awesomewidget
plugin awplugin

View File

@ -0,0 +1,3 @@
[Project]
Manager=KDevCMakeManager
Name=awesome-widgets

View 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)

View 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

View 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"
}
}

View 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>

View 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]")
}
}

View 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]")
}
}

View 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]")
}
}

View 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
}
}

View 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]")
}
}

View File

@ -0,0 +1,193 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.4
import QtQuick.Controls 1.3 as QtControls
import QtQuick.Layouts 1.1
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.desktoppanel 1.0
import "."
Item {
id: main
property bool debug: DPAdds.isDebugEnabled()
property variant tooltipSettings: {
"tooltipColor": plasmoid.configuration.tooltipColor,
"tooltipType": plasmoid.configuration.tooltipType,
"tooltipWidth": plasmoid.configuration.tooltipWidth
}
signal needUpdate
signal needTooltipUpdate
signal sizeUpdate
// init
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
Plasmoid.icon: "utilities-system-monitor"
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
// ui
GridLayout {
anchors.fill: parent
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
Repeater {
id: repeater
Layout.columnSpan: 0
Layout.rowSpan: 0
model: DPAdds.numberOfDesktops()
Text {
id: text
height: contentHeight
width: contentWidth
textFormat: Text.RichText
wrapMode: Text.NoWrap
verticalAlignment: Text.AlignVCenter
text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1)
property alias tooltip: tooltip
MouseArea {
hoverEnabled: true
anchors.fill: parent
onClicked: DPAdds.setCurrentDesktop(index + 1);
onEntered: needTooltipUpdate()
}
PlasmaCore.ToolTipArea {
height: tooltip.height
width: tooltip.width
mainItem: Text {
id: tooltip
height: contentHeight
width: contentWidth
textFormat: Text.RichText
}
}
}
}
}
Timer {
id: timer
interval: 1000
onTriggered: needUpdate()
}
onNeedUpdate: {
if (debug) console.log("[main::onNeedUpdate]")
for (var i=0; i<repeater.count; i++) {
if (!repeater.itemAt(i)) {
if (debug) console.log("[main::onNeedUpdate] : Nothing to do here " + i)
timer.start()
return
}
repeater.itemAt(i).text = DPAdds.parsePattern(plasmoid.configuration.text, i + 1)
if (DPAdds.currentDesktop() == i + 1) {
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.currentFontWeight]
} else {
repeater.itemAt(i).color = plasmoid.configuration.fontColor
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
}
repeater.itemAt(i).update()
}
sizeUpdate()
needTooltipUpdate()
}
onNeedTooltipUpdate: {
if (debug) console.log("[main::onNeedTooltipUpdate]")
for (var i=0; i<repeater.count; i++) {
repeater.itemAt(i).tooltip.text = DPAdds.toolTipImage(i + 1)
}
}
onSizeUpdate: {
if (debug) console.log("[main::onSizeUpdate]")
if (plasmoid.configuration.height == 0) {
var newHeight = 0
for (var i=0; i<repeater.count; i++)
newHeight += repeater.itemAt(i).contentHeight
Layout.minimumHeight = newHeight
Layout.maximumHeight = -1
} else {
Layout.minimumHeight = plasmoid.configuration.height
Layout.maximumHeight = plasmoid.configuration.height
}
if (plasmoid.configuration.width == 0) {
var newWidth = 0
for (var i=0; i<repeater.count; i++)
newWidth += repeater.itemAt(i).contentWidth
Layout.minimumWidth = newWidth
Layout.maximumWidth = -1
} else {
Layout.minimumWidth = plasmoid.configuration.width
Layout.maximumWidth = plasmoid.configuration.width
}
}
Plasmoid.onActivated: {
if (debug) console.log("[main::onActivated]")
// DPAdds.changePanelsState()
}
Plasmoid.onUserConfiguringChanged: {
if (plasmoid.userConfiguring) return
if (debug) console.log("[main::onUserConfiguringChanged]")
DPAdds.setMark(plasmoid.configuration.mark)
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
DPAdds.setToolTipData(tooltipSettings)
needUpdate()
}
Component.onCompleted: {
if (debug) console.log("[main::onCompleted]")
// init submodule
Plasmoid.userConfiguringChanged(false)
DPAdds.desktopChanged.connect(needUpdate)
DPAdds.windowListChanged.connect(needTooltipUpdate)
}
}

View File

@ -0,0 +1 @@
singleton general general.qml

View 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]")
}
}

View 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.2
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

View 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})

View 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);
}

View 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 */

View 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("&nbsp;"));
else if (key == QString("name"))
return KWindowSystem::desktopName(desktop).replace(QString(" "), QString("&nbsp;"));
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>&copy; %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);
}
}

View 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 */

View File

@ -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

View File

@ -0,0 +1,3 @@
module org.kde.plasma.desktoppanel
plugin dpplugin

View File

@ -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})

View File

@ -1,29 +0,0 @@
# Configuration file for Extended Systemmonitor DataEngine
# Uncomment needed lines
# Custom command
#CUSTOM=wget -qO- http://ifconfig.me/ip
# Set GPU device
# May be 'nvidia' (for nvidia), 'ati' (for ATI RADEON), 'ignore' or 'auto'
#GPUDEV=auto
# Set block device for hddtemp comma separated or use 'all'
#HDDDEV=all
# Set MPD settings
#MPDADDRESS=localhost
#MPDPORT=6600
# Package upgrade info
## from vicious
## Arch: PKGCMD=pacman -Qu PKGNULL=0
## Debian: PKGCMD=apt-show-versions -u -b PKGNULL=0
## Ubuntu: PKGCMD=aptitude search '~U' PKGNULL=0
## Fedora: PKGCMD=yum list updates PKGNULL=3
## FreeBSD: PKGCMD=pkg_version -I -l '<' PKGNULL=0
## Mandriva: PKGCMD=urpmq --auto-select PKGNULL=0
# Commands to run, comma separated
#PKGCMD=pacman -Qu
# Number of null lines for commands, comma separated
#PKGNULL=0

View File

@ -1,486 +0,0 @@
/***************************************************************************
* This file is part of pytextmonitor *
* *
* pytextmonitor is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* pytextmonitor is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with pytextmonitor. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "extsysmon.h"
#include <Plasma/DataContainer>
#include <KDE/KGlobal>
#include <KDE/KStandardDirs>
#include <QFile>
#include <QProcess>
#include <QTextCodec>
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList& args)
: Plasma::DataEngine(parent, args)
{
Q_UNUSED(args)
setMinimumPollingInterval(333);
readConfiguration();
}
QString ExtendedSysMon::getAllHdd()
{
QProcess command;
QStringList devices;
QString qoutput = QString("");
QString dev;
command.start("find /dev -name [hs]d[a-z]");
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
dev = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
devices.append(dev);
}
return devices.join(QChar(','));
}
QString ExtendedSysMon::getAutoGpu()
{
QProcess command;
QString gpu = QString("");
QString qoutput = QString("");
command.start("lspci");
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
if (qoutput.toLower().contains("nvidia"))
gpu = QString("nvidia");
else if (qoutput.toLower().contains("radeon"))
gpu = QString("ati");
return gpu;
}
QStringList ExtendedSysMon::sources() const
{
QStringList source;
source.append(QString("custom"));
source.append(QString("gpu"));
source.append(QString("gputemp"));
source.append(QString("hddtemp"));
source.append(QString("pkg"));
source.append(QString("player"));
source.append(QString("ps"));
return source;
}
void ExtendedSysMon::readConfiguration()
{
// pre-setup
QMap<QString, QString> rawConfig;
rawConfig[QString("CUSTOM")] = QString("wget -qO- http://ifconfig.me/ip");
rawConfig[QString("GPUDEV")] = QString("auto");
rawConfig[QString("HDDDEV")] = QString("all");
rawConfig[QString("MPDADDRESS")] = QString("localhost");
rawConfig[QString("MPDPORT")] = QString("6600");
rawConfig[QString("PKGCMD")] = QString("pacman -Qu");
rawConfig[QString("PKGNULL")] = QString("0");
QString fileName = KGlobal::dirs()->findResource("config", "extsysmon.conf");
QFile confFile(fileName);
bool ok = confFile.open(QIODevice::ReadOnly);
if (!ok) {
configuration = updateConfiguration(rawConfig);
return;
}
QString fileStr;
QStringList value;
while (true) {
fileStr = QString(confFile.readLine()).trimmed();
if (fileStr[0] == QChar('#')) continue;
if (fileStr[0] == QChar(';')) continue;
if (fileStr.contains(QChar('='))) {
value.clear();
for (int i=1; i<fileStr.split(QChar('=')).count(); i++)
value.append(fileStr.split(QChar('='))[i]);
rawConfig[fileStr.split(QChar('='))[0]] = value.join(QChar('='));
}
if (confFile.atEnd())
break;
}
confFile.close();
configuration = updateConfiguration(rawConfig);
return;
}
QMap<QString, QString> ExtendedSysMon::updateConfiguration(const QMap<QString, QString> rawConfig)
{
QMap<QString, QString> config;
QString key, value;
// remove spaces and copy source map
for (int i=0; i<rawConfig.keys().count(); i++) {
key = rawConfig.keys()[i];
value = rawConfig[key];
key.remove(QChar(' '));
if ((key != QString("CUSTOM")) && (key != QString("PKGCMD")))
value.remove(QChar(' '));
config[key] = value;
}
// update values
if (config[QString("GPUDEV")] == QString("auto"))
config[QString("GPUDEV")] = getAutoGpu();
if (config[QString("HDDDEV")] == QString("all"))
config[QString("HDDDEV")] = getAllHdd();
for (int i=config[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts).count();
i<config[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count()+1;
i++)
config[QString("PKGNULL")] += QString(",0");
return config;
}
QString ExtendedSysMon::getCustomCmd(const QString cmd)
{
QProcess command;
QString qoutput = QString("");
command.start(QString("bash -c \"") + cmd + QString("\""));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
return qoutput;
}
float ExtendedSysMon::getGpu(const QString device)
{
float gpu = 0.0;
if ((device != QString("nvidia")) && (device != QString("ati")))
return gpu;
QProcess command;
QString qoutput;
if (device == QString("nvidia")) {
command.start(QString("nvidia-smi -q -d UTILIZATION"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Gpu"))) {
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
.split(QChar(' '), QString::SkipEmptyParts)[2]
.remove(QChar('%'));
gpu = load.toFloat();
}
}
}
else if (device == QString("ati")) {
command.start(QString("aticonfig --od-getclocks"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("load"))) {
QString load = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
.split(QChar(' '), QString::SkipEmptyParts)[3]
.remove(QChar('%'));
gpu = load.toFloat();
}
}
}
return gpu;
}
float ExtendedSysMon::getGpuTemp(const QString device)
{
float gpuTemp = 0.0;
if ((device != QString("nvidia")) && (device != QString("ati")))
return gpuTemp;
QProcess command;
QString qoutput;
if (device == QString("nvidia")) {
command.start(QString("nvidia-smi -q -d TEMPERATURE"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Gpu"))) {
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
.split(QChar(' '), QString::SkipEmptyParts)[2];
gpuTemp = temp.toFloat();
}
}
}
else if (device == QString("ati")) {
command.start(QString("aticonfig --od-gettemperature"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i].contains(QString("Temperature"))) {
QString temp = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]
.split(QChar(' '), QString::SkipEmptyParts)[4];
gpuTemp = temp.toFloat();
}
}
}
return gpuTemp;
}
float ExtendedSysMon::getHddTemp(const QString device)
{
float hddTemp = 0.0;
QProcess command;
QString qoutput = QString("");
command.start(QString("sudo hddtemp ") + device);
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts)[2];
temp.remove(QChar(0260)).remove(QChar('C'));
hddTemp = temp.toFloat();
}
return hddTemp;
}
QStringList ExtendedSysMon::getPlayerInfo(const QString playerName,
const QString mpdAddress,
const QString mpdPort)
{
QStringList info;
// album
info.append(QString("unknown"));
// artist
info.append(QString("unknown"));
// progress
info.append(QString("0"));
// duration
info.append(QString("0"));
// title
info.append(QString("unknown"));
if ((playerName != QString("amarok")) &&
(playerName != QString("mpd")) &&
(playerName != QString("qmmp")))
return info;
QProcess command;
QString qoutput = QString("");
QString qstr;
if (playerName == QString("amarok")) {
// amarok
command.start("qdbus org.kde.amarok /Player GetMetadata");
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("album"))
info[0] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("artist"))
info[1] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time"))
info[3] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("title"))
info[4] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
}
}
command.start("qdbus org.kde.amarok /Player PositionGet");
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
int time = qstr.toInt() / 1000;
info[2] = QString::number(time);
}
}
else if (playerName == QString("mpd")) {
// mpd
command.start(QString("bash -c \"echo 'currentsong\nstatus\nclose' | curl --connect-timeout 1 -fsm 3 telnet://") +
mpdAddress + QString(":") + mpdPort + QString("\""));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
if (qstr.split(QString(": "), QString::SkipEmptyParts).count() > 1) {
if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Album"))
info[0] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Artist"))
info[1] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("time")) {
info[3] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[0];
info[2] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed().split(QString(":"))[1];
}
else if (qstr.split(QString(": "), QString::SkipEmptyParts)[0] == QString("Title"))
info[4] = qstr.split(QString(": "), QString::SkipEmptyParts)[1].trimmed();
}
}
}
else if (playerName == QString("qmmp")) {
// qmmp
command.start("qmmp --status");
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput());
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++) {
qstr = qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i];
if ((qstr.split(QString(" = "), QString::SkipEmptyParts).count() > 1) || (qstr.at(0) == QChar('['))) {
if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ALBUM"))
info[0] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("ARTIST"))
info[1] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
else if ((qstr.at(0) == QChar('[')) && (!qstr.contains("[stopped]"))) {
QString time = qstr.split(QString(" "), QString::SkipEmptyParts)[2].trimmed();
info[2] = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[0].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
info[3] = QString::number(time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[0].toInt() * 60 +
time.split(QString("/"), QString::SkipEmptyParts)[1].split(QString(":"), QString::SkipEmptyParts)[1].toInt());
}
else if (qstr.split(QString(" = "), QString::SkipEmptyParts)[0] == QString("TITLE"))
info[4] = qstr.split(QString(" = "), QString::SkipEmptyParts)[1].trimmed();
}
}
}
return info;
}
QStringList ExtendedSysMon::getPsStats()
{
int psCount = 0;
QStringList psList;
QProcess command;
QString qoutput = QString("");
command.start(QString("ps --no-headers -o command"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
for (int i=0; i<qoutput.split(QChar('\n'), QString::SkipEmptyParts).count(); i++)
if (qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i] != QString("ps --no-headers -o command")) {
psCount++;
psList.append(qoutput.split(QChar('\n'), QString::SkipEmptyParts)[i]);
}
QStringList psStats;
psStats.append(QString::number(psCount));
psStats.append(psList.join(QString(",")));
command.start(QString("ps -e --no-headers -o command"));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
int psTotal = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
psStats.append(QString::number(psTotal));
return psStats;
}
int ExtendedSysMon::getUpgradeInfo(const QString pkgCommand, const int pkgNull)
{
int count = 0;
QProcess command;
QString qoutput = QString("");
command.start(QString("bash -c \"") + pkgCommand + QString("\""));
command.waitForFinished(-1);
qoutput = QTextCodec::codecForMib(106)->toUnicode(command.readAllStandardOutput()).trimmed();
count = qoutput.split(QChar('\n'), QString::SkipEmptyParts).count();
return (count - pkgNull);
}
bool ExtendedSysMon::sourceRequestEvent(const QString &name)
{
return updateSourceEvent(name);
}
bool ExtendedSysMon::updateSourceEvent(const QString &source)
{
QString key;
if (source == QString("custom")) {
key = QString("custom");
QString value = getCustomCmd(configuration[QString("CUSTOM")]);
setData(source, key, value);
}
else if (source == QString("gpu")) {
key = QString("GPU");
float value = getGpu(configuration[QString("GPUDEV")]);
setData(source, key, value);
}
else if (source == QString("gputemp")) {
key = QString("GPUTemp");
float value = getGpuTemp(configuration[QString("GPUDEV")]);
setData(source, key, value);
}
else if (source == QString("hddtemp")) {
QStringList deviceList = configuration[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts);
for (int i=0; i<deviceList.count(); i++) {
float value = getHddTemp(deviceList[i]);
setData(source, deviceList[i], value);
}
}
else if (source == QString("pkg")) {
for (int i=0; i<configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts).count(); i++) {
key = QString("pkgCount") + QString::number(i);
int value = getUpgradeInfo(configuration[QString("PKGCMD")].split(QString(","), QString::SkipEmptyParts)[i],
configuration[QString("PKGNULL")].split(QString(","), QString::SkipEmptyParts)[i].toInt());
setData(source, key, value);
}
}
else if (source == QString("player")) {
QStringList value;
// amarok
value = getPlayerInfo(QString("amarok"));
key = QString("amarok_album");
setData(source, key, value[0]);
key = QString("amarok_artist");
setData(source, key, value[1]);
key = QString("amarok_progress");
setData(source, key, value[2]);
key = QString("amarok_duration");
setData(source, key, value[3]);
key = QString("amarok_title");
setData(source, key, value[4]);
// mpd
value = getPlayerInfo(QString("mpd"),
configuration[QString("MPDADDRESS")],
configuration[QString("MPDPORT")]);
key = QString("mpd_album");
setData(source, key, value[0]);
key = QString("mpd_artist");
setData(source, key, value[1]);
key = QString("mpd_progress");
setData(source, key, value[2]);
key = QString("mpd_duration");
setData(source, key, value[3]);
key = QString("mpd_title");
setData(source, key, value[4]);
// qmmp
value = getPlayerInfo(QString("qmmp"));
key = QString("qmmp_album");
setData(source, key, value[0]);
key = QString("qmmp_artist");
setData(source, key, value[1]);
key = QString("qmmp_progress");
setData(source, key, value[2]);
key = QString("qmmp_duration");
setData(source, key, value[3]);
key = QString("qmmp_title");
setData(source, key, value[4]);
}
else if (source == QString("ps")) {
QStringList value = getPsStats();
key = QString("psCount");
setData(source, key, value[0].toInt());
key = QString("ps");
setData(source, key, value[1]);
key = QString("psTotal");
setData(source, key, value[2].toInt());
}
return true;
}
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
#include "extsysmon.moc"

View File

@ -1,56 +0,0 @@
/***************************************************************************
* This file is part of pytextmonitor *
* *
* pytextmonitor is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* pytextmonitor is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with pytextmonitor. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef EXTSYSMON_H
#define EXTSYSMON_H
#include <Plasma/DataEngine>
class ExtendedSysMon : public Plasma::DataEngine
{
Q_OBJECT
public:
ExtendedSysMon(QObject *parent, const QVariantList &args);
// update functions
QString getCustomCmd(const QString cmd);
float getGpu(const QString device);
float getGpuTemp(const QString device);
float getHddTemp(const QString device);
QStringList getPlayerInfo(const QString playerName,
const QString mpdAddress = 0,
const QString mpdPort = 0);
QStringList getPsStats();
int getUpgradeInfo(const QString pkgCommand,
const int pkgNull = 0);
protected:
bool sourceRequestEvent(const QString &name);
bool updateSourceEvent(const QString &source);
QStringList sources() const;
private:
// configuration
QMap<QString, QString> configuration;
// reread configuration
QString getAllHdd();
QString getAutoGpu();
void readConfiguration();
QMap<QString, QString> updateConfiguration(const QMap<QString, QString> rawConfig);
};
#endif /* EXTSYSMON_H */

View 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})

View File

@ -0,0 +1,372 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "extquotes.h"
#include "ui_extquotes.h"
#include <QDebug>
#include <QDir>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QSettings>
#include <QTime>
#include <pdebug/pdebug.h>
#include "version.h"
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, const QStringList directories, const bool debugCmd)
: QDialog(parent),
m_fileName(quotesName),
m_dirs(directories),
debug(debugCmd),
ui(new Ui::ExtQuotes)
{
m_name = m_fileName;
readConfiguration();
ui->setupUi(this);
values[QString("ask")] = 0.0;
values[QString("askchg")] = 0.0;
values[QString("percaskchg")] = 0.0;
values[QString("bid")] = 0.0;
values[QString("bidchg")] = 0.0;
values[QString("percbidchg")] = 0.0;
values[QString("price")] = 0.0;
values[QString("pricechg")] = 0.0;
values[QString("percpricechg")] = 0.0;
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
}
ExtQuotes::~ExtQuotes()
{
if (debug) qDebug() << PDEBUG;
disconnect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(quotesReplyReceived(QNetworkReply *)));
delete manager;
delete ui;
}
int ExtQuotes::apiVersion()
{
if (debug) qDebug() << PDEBUG;
return m_apiVersion;
}
QString ExtQuotes::comment()
{
if (debug) qDebug() << PDEBUG;
return m_comment;
}
QString ExtQuotes::fileName()
{
if (debug) qDebug() << PDEBUG;
return m_fileName;
}
int ExtQuotes::interval()
{
if (debug) qDebug() << PDEBUG;
return m_interval;
}
bool ExtQuotes::isActive()
{
if (debug) qDebug() << PDEBUG;
return m_active;
}
QString ExtQuotes::name()
{
if (debug) qDebug() << PDEBUG;
return m_name;
}
int ExtQuotes::number()
{
if (debug) qDebug() << PDEBUG;
return m_number;
}
QString ExtQuotes::tag(const QString _type)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Tag type" << _type;
return QString("%1%2").arg(_type).arg(m_number);
}
QString ExtQuotes::ticker()
{
if (debug) qDebug() << PDEBUG;
return m_ticker;
}
void ExtQuotes::setApiVersion(const int _apiVersion)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
m_apiVersion = _apiVersion;
}
void ExtQuotes::setActive(const bool state)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
m_active = state;
}
void ExtQuotes::setComment(const QString _comment)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
m_comment = _comment;
}
void ExtQuotes::setInterval(const int _interval)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
m_interval = _interval;
}
void ExtQuotes::setName(const QString _name)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
m_name = _name;
}
void ExtQuotes::setNumber(int _number)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
if (_number == -1) {
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
qsrand(QTime::currentTime().msec());
_number = qrand() % 1000;
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
}
m_number = _number;
}
void ExtQuotes::setTicker(const QString _ticker)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Ticker" << _ticker;
m_ticker = _ticker;
}
void ExtQuotes::readConfiguration()
{
if (debug) qDebug() << PDEBUG;
for (int i=m_dirs.count()-1; i>=0; i--) {
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry"));
setName(settings.value(QString("Name"), m_name).toString());
setComment(settings.value(QString("Comment"), m_comment).toString());
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
setTicker(settings.value(QString("X-AW-Ticker"), m_ticker).toString());
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
settings.endGroup();
}
// update for current API
if ((m_apiVersion > 0) && (m_apiVersion < AWEQAPI)) {
setApiVersion(AWEQAPI);
writeConfiguration();
}
}
QMap<QString, float> ExtQuotes::run()
{
if (debug) qDebug() << PDEBUG;
if ((!m_active) || (isRunning)) return values;
if (times == 1) {
if (debug) qDebug() << PDEBUG << ":" << "Send request";
isRunning = true;
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url())));
new QReplyTimeout(reply, 1000);
}
// update value
if (times >= m_interval) times = 0;
times++;
return values;
}
int ExtQuotes::showConfiguration()
{
if (debug) qDebug() << PDEBUG;
ui->lineEdit_name->setText(m_name);
ui->lineEdit_comment->setText(m_comment);
ui->label_numberValue->setText(QString("%1").arg(m_number));
ui->lineEdit_ticker->setText(m_ticker);
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
ui->spinBox_interval->setValue(m_interval);
int ret = exec();
if (ret != 1) return ret;
setName(ui->lineEdit_name->text());
setComment(ui->lineEdit_comment->text());
setNumber(ui->label_numberValue->text().toInt());
setApiVersion(AWEQAPI);
setTicker(ui->lineEdit_ticker->text());
setActive(ui->checkBox_active->checkState() == Qt::Checked);
setInterval(ui->spinBox_interval->value());
writeConfiguration();
return ret;
}
bool ExtQuotes::tryDelete()
{
if (debug) qDebug() << PDEBUG;
for (int i=0; i<m_dirs.count(); i++)
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
// check if exists
for (int i=0; i<m_dirs.count(); i++)
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
return true;
}
void ExtQuotes::writeConfiguration()
{
if (debug) qDebug() << PDEBUG;
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
settings.beginGroup(QString("Desktop Entry"));
settings.setValue(QString("Encoding"), QString("UTF-8"));
settings.setValue(QString("Name"), m_name);
settings.setValue(QString("Comment"), m_comment);
settings.setValue(QString("X-AW-Ticker"), m_ticker);
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
settings.setValue(QString("X-AW-Interval"), m_interval);
settings.setValue(QString("X-AW-Number"), m_number);
settings.endGroup();
settings.sync();
}
void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Return code" << reply->error();
if (debug) qDebug() << PDEBUG << ":" << "Reply error message" << reply->errorString();
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(reply->readAll(), &error);
reply->deleteLater();
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
if ((reply->error() != QNetworkReply::NoError) ||
(error.error != QJsonParseError::NoError)) {
return;
}
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap();
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
float value;
// ask
value = jsonQuotes[QString("Ask")].toString().toFloat();
values[QString("askchg")] = values[QString("ask")] == 0 ? 0.0 : value - values[QString("ask")];
values[QString("percaskchg")] = 100 * values[QString("askchg")] / values[QString("ask")];
values[QString("ask")] = value;
// bid
value = jsonQuotes[QString("Bid")].toString().toFloat();
values[QString("bidchg")] = values[QString("bid")] == 0 ? 0.0 : value - values[QString("bid")];
values[QString("percbidchg")] = 100 * values[QString("bidchg")] / values[QString("bid")];
values[QString("bid")] = value;
// last trade
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toFloat();
values[QString("pricechg")] = values[QString("price")] == 0 ? 0.0 : value - values[QString("price")];
values[QString("percpricechg")] = 100 * values[QString("pricechg")] / values[QString("price")];
values[QString("price")] = value;
isRunning = false;
}
QString ExtQuotes::url()
{
if (debug) qDebug() << PDEBUG;
QString apiUrl = QString(YAHOO_URL);
apiUrl.replace(QString("$TICKER"), m_ticker);
if (debug) qDebug() << PDEBUG << ":" << "API url" << apiUrl;
return apiUrl;
}

View File

@ -0,0 +1,117 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#ifndef EXTQUOTES_H
#define EXTQUOTES_H
#include <QDialog>
#include <QMap>
#include <QNetworkReply>
#include <QTimer>
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json"
class QReplyTimeout : public QObject
{
Q_OBJECT
public:
QReplyTimeout(QNetworkReply *reply, const int timeout) : QObject(reply)
{
QTimer::singleShot(timeout, this, SLOT(timeout()));
}
public slots:
void timeout()
{
QNetworkReply *reply = static_cast<QNetworkReply *>(parent());
if (reply->isRunning()) reply->close();
}
};
namespace Ui {
class ExtQuotes;
}
class ExtQuotes : public QDialog
{
Q_OBJECT
Q_PROPERTY(int apiVersion READ apiVersion WRITE setApiVersion)
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString comment READ comment WRITE setComment)
Q_PROPERTY(int interval READ interval WRITE setInterval)
Q_PROPERTY(bool active READ isActive WRITE setActive)
Q_PROPERTY(int number READ number WRITE setNumber)
Q_PROPERTY(QString ticker READ ticker WRITE setTicker)
public:
explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(),
const QStringList directories = QStringList(), const bool debugCmd = false);
~ExtQuotes();
// get methods
int apiVersion();
QString comment();
QString fileName();
int interval();
bool isActive();
QString name();
int number();
QString tag(const QString _type = QString("price"));
QString ticker();
// set methods
void setApiVersion(const int _apiVersion = 0);
void setActive(const bool _state = true);
void setComment(const QString _comment = QString("empty"));
void setInterval(const int _interval = 0);
void setName(const QString _name = QString("none"));
void setNumber(int _number = -1);
void setTicker(const QString _ticker = QString("EURUSD=X"));
public slots:
void readConfiguration();
QMap<QString, float> run();
int showConfiguration();
bool tryDelete();
void writeConfiguration();
private slots:
void quotesReplyReceived(QNetworkReply *reply);
private:
QString m_fileName;
QStringList m_dirs;
bool debug;
QNetworkAccessManager *manager;
bool isRunning = false;
Ui::ExtQuotes *ui;
QString url();
// properties
int m_apiVersion = 0;
bool m_active = true;
QString m_comment = QString("empty");
int m_interval = 60;
QString m_name = QString("none");
int m_number = -1;
QString m_ticker = QString("EURUSD=X");
// values
int times = 0;
QMap<QString, float> values;
};
#endif /* EXTQUOTES_H */

View File

@ -0,0 +1,240 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ExtQuotes</class>
<widget class="QDialog" name="ExtQuotes">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>301</height>
</rect>
</property>
<property name="windowTitle">
<string>Configuration</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="layout_name">
<item>
<widget class="QLabel" name="label_name">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_name"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_comment">
<item>
<widget class="QLabel" name="label_comment">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Comment</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_comment"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_number">
<item>
<widget class="QLabel" name="label_number">
<property name="text">
<string>Tag</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_numberValue">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use YAHOO! finance ticker to get quotes for the instrument. Refer to &lt;a href=&quot;http://finance.yahoo.com/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0057ae;&quot;&gt;http://finance.yahoo.com/&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_ticker">
<item>
<widget class="QLabel" name="label_ticker">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Ticker</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_ticker"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_active">
<item>
<spacer name="spacer_active">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBox_active">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Active</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_interval">
<item>
<widget class="QLabel" name="label_interval">
<property name="text">
<string>Interval</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_interval">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>60</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ExtQuotes</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ExtQuotes</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,533 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
#include "extscript.h"
#include "ui_extscript.h"
#include <QDebug>
#include <QDir>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QSettings>
#include <QStandardPaths>
#include <QTextCodec>
#include <QTime>
#include <pdebug/pdebug.h>
#include "version.h"
ExtScript::ExtScript(QWidget *parent, const QString scriptName, const QStringList directories, const bool debugCmd)
: QDialog(parent),
m_fileName(scriptName),
m_dirs(directories),
debug(debugCmd),
ui(new Ui::ExtScript)
{
m_name = m_fileName;
readConfiguration();
readJsonFilters();
// init process
process = new QProcess(this);
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue()));
process->waitForFinished(0);
// init ui
ui->setupUi(this);
}
ExtScript::~ExtScript()
{
if (debug) qDebug() << PDEBUG;
process->kill();
delete process;
delete ui;
}
int ExtScript::apiVersion()
{
if (debug) qDebug() << PDEBUG;
return m_apiVersion;
}
QString ExtScript::comment()
{
if (debug) qDebug() << PDEBUG;
return m_comment;
}
QString ExtScript::executable()
{
if (debug) qDebug() << PDEBUG;
return m_executable;
}
QString ExtScript::fileName()
{
if (debug) qDebug() << PDEBUG;
return m_fileName;
}
QStringList ExtScript::filters()
{
if (debug) qDebug() << PDEBUG;
return m_filters;
}
bool ExtScript::hasOutput()
{
if (debug) qDebug() << PDEBUG;
return m_output;
}
int ExtScript::interval()
{
if (debug) qDebug() << PDEBUG;
return m_interval;
}
bool ExtScript::isActive()
{
if (debug) qDebug() << PDEBUG;
return m_active;
}
QString ExtScript::name()
{
if (debug) qDebug() << PDEBUG;
return m_name;
}
int ExtScript::number()
{
if (debug) qDebug() << PDEBUG;
return m_number;
}
QString ExtScript::prefix()
{
if (debug) qDebug() << PDEBUG;
return m_prefix;
}
ExtScript::Redirect ExtScript::redirect()
{
if (debug) qDebug() << PDEBUG;
return m_redirect;
}
QString ExtScript::strRedirect()
{
if (debug) qDebug() << PDEBUG;
QString value;
switch (m_redirect) {
case stdout2stderr:
value = QString("stdout2stderr");
break;
case stderr2stdout:
value = QString("stderr2stdout");
break;
case nothing:
default:
value = QString("nothing");
break;
}
return value;
}
QString ExtScript::tag()
{
if (debug) qDebug() << PDEBUG;
return QString("custom%1").arg(m_number);
}
void ExtScript::setApiVersion(const int _apiVersion)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
m_apiVersion = _apiVersion;
}
void ExtScript::setActive(const bool state)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
m_active = state;
}
void ExtScript::setComment(const QString _comment)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
m_comment = _comment;
}
void ExtScript::setExecutable(const QString _executable)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Executable" << _executable;
m_executable = _executable;
}
void ExtScript::setFilters(const QStringList _filters)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Filters" << _filters;
for (int i=0; i<_filters.count(); i++)
updateFilter(_filters[i]);
}
void ExtScript::setHasOutput(const bool _state)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "State" << _state;
m_output = _state;
}
void ExtScript::setInterval(const int _interval)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Interval" << _interval;
if (_interval <= 0) return;
m_interval = _interval;
}
void ExtScript::setName(const QString _name)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
m_name = _name;
}
void ExtScript::setNumber(int _number)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Number" << _number;
if (_number == -1) {
if (debug) qDebug() << PDEBUG << ":" << "Number is empty, generate new one";
qsrand(QTime::currentTime().msec());
_number = qrand() % 1000;
if (debug) qDebug() << PDEBUG << ":" << "Generated number is" << _number;
}
m_number = _number;
}
void ExtScript::setPrefix(const QString _prefix)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Prefix" << _prefix;
m_prefix = _prefix;
}
void ExtScript::setRedirect(const Redirect _redirect)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Redirect" << _redirect;
m_redirect = _redirect;
}
void ExtScript::setStrRedirect(const QString _redirect)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Redirect" << _redirect;
if (_redirect == QString("stdout2sdterr"))
m_redirect = stdout2stderr;
else if (_redirect == QString("stderr2sdtout"))
m_redirect = stderr2stdout;
else
m_redirect = nothing;
}
QString ExtScript::applyFilters(QString _value)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Value" << _value;
for (int i=0; i<m_filters.count(); i++) {
if (debug) qDebug() << PDEBUG << ":" << "Found filter" << m_filters[i];
QVariantMap filter = jsonFilters[m_filters[i]].toMap();
if (filter.isEmpty()) {
if (debug) qDebug() << PDEBUG << ":" << "Could not find filter in the json";
continue;
}
for (int j=0; j<filter.keys().count(); j++)
_value.replace(filter.keys()[j], filter[filter.keys()[j]].toString());
}
return _value;
}
void ExtScript::updateFilter(const QString _filter, const bool _add)
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Filter" << _filter;
if (debug) qDebug() << PDEBUG << ":" << "Should be added" << _add;
if (_add) {
if (m_filters.contains(_filter)) return;
m_filters.append(_filter);
} else {
m_filters.removeOne(_filter);
}
}
void ExtScript::readConfiguration()
{
if (debug) qDebug() << PDEBUG;
for (int i=m_dirs.count()-1; i>=0; i--) {
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry"));
setName(settings.value(QString("Name"), m_name).toString());
setComment(settings.value(QString("Comment"), m_comment).toString());
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
setExecutable(settings.value(QString("Exec"), m_executable).toString());
setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString());
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true"));
setHasOutput(settings.value(QString("X-AW-Output"), QVariant(m_output)).toString() == QString("true"));
setStrRedirect(settings.value(QString("X-AW-Redirect"), strRedirect()).toString());
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt());
// api == 2
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
// api == 3
setFilters(settings.value(QString("X-AW-Filters"), m_filters).toString()
.split(QChar(','), QString::SkipEmptyParts));
settings.endGroup();
}
if (!m_output)
setRedirect(stdout2stderr);
// update for current API
if ((m_apiVersion > 0) && (m_apiVersion < AWESAPI)) {
setApiVersion(AWESAPI);
writeConfiguration();
}
}
void ExtScript::readJsonFilters()
{
if (debug) qDebug() << PDEBUG;
QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
QString("awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
QFile jsonFile(fileName);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QString jsonText = jsonFile.readAll();
jsonFile.close();
QJsonParseError error;
QJsonDocument jsonDoc = QJsonDocument::fromJson(jsonText.toUtf8(), &error);
if (debug) qDebug() << PDEBUG << ":" << "Json parse error" << error.errorString();
if (error.error != QJsonParseError::NoError)
return;
jsonFilters = jsonDoc.toVariant().toMap();
if (debug) qDebug() << PDEBUG << ":" << "Filters" << jsonFilters;
}
QString ExtScript::run()
{
if (debug) qDebug() << PDEBUG;
if (!m_active) return value;
if ((times == 1) && (process->state() == QProcess::NotRunning)) {
QStringList cmdList;
if (!m_prefix.isEmpty()) cmdList.append(m_prefix);
cmdList.append(m_executable);
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmdList.join(QChar(' '));
process->start(cmdList.join(QChar(' ')));
} else if (times >= m_interval)
times = 0;
times++;
return value;
}
int ExtScript::showConfiguration()
{
if (debug) qDebug() << PDEBUG;
ui->lineEdit_name->setText(m_name);
ui->lineEdit_comment->setText(m_comment);
ui->label_numberValue->setText(QString("%1").arg(m_number));
ui->lineEdit_command->setText(m_executable);
ui->lineEdit_prefix->setText(m_prefix);
ui->checkBox_active->setCheckState(m_active ? Qt::Checked : Qt::Unchecked);
ui->checkBox_output->setCheckState(m_output ? Qt::Checked : Qt::Unchecked);
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
ui->spinBox_interval->setValue(m_interval);
// filters
ui->checkBox_colorFilter->setCheckState(m_filters.contains(QString("color")) ? Qt::Checked : Qt::Unchecked);
ui->checkBox_linesFilter->setCheckState(m_filters.contains(QString("newline")) ? Qt::Checked : Qt::Unchecked);
ui->checkBox_spaceFilter->setCheckState(m_filters.contains(QString("space")) ? Qt::Checked : Qt::Unchecked);
int ret = exec();
if (ret != 1) return ret;
setName(ui->lineEdit_name->text());
setComment(ui->lineEdit_comment->text());
setNumber(ui->label_numberValue->text().toInt());
setApiVersion(AWESAPI);
setExecutable(ui->lineEdit_command->text());
setPrefix(ui->lineEdit_prefix->text());
setActive(ui->checkBox_active->checkState() == Qt::Checked);
setHasOutput(ui->checkBox_output->checkState() == Qt::Checked);
setStrRedirect(ui->comboBox_redirect->currentText());
setInterval(ui->spinBox_interval->value());
// filters
updateFilter(QString("color"), ui->checkBox_colorFilter->checkState() == Qt::Checked);
updateFilter(QString("newline"), ui->checkBox_linesFilter->checkState() == Qt::Checked);
updateFilter(QString("space"), ui->checkBox_spaceFilter->checkState() == Qt::Checked);
writeConfiguration();
return ret;
}
bool ExtScript::tryDelete()
{
if (debug) qDebug() << PDEBUG;
for (int i=0; i<m_dirs.count(); i++)
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
// check if exists
for (int i=0; i<m_dirs.count(); i++)
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
return true;
}
void ExtScript::writeConfiguration()
{
if (debug) qDebug() << PDEBUG;
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
settings.beginGroup(QString("Desktop Entry"));
settings.setValue(QString("Encoding"), QString("UTF-8"));
settings.setValue(QString("Name"), m_name);
settings.setValue(QString("Comment"), m_comment);
settings.setValue(QString("Exec"), m_executable);
settings.setValue(QString("X-AW-ApiVersion"), m_apiVersion);
settings.setValue(QString("X-AW-Prefix"), m_prefix);
settings.setValue(QString("X-AW-Active"), QVariant(m_active).toString());
settings.setValue(QString("X-AW-Output"), QVariant(m_output).toString());
settings.setValue(QString("X-AW-Redirect"), strRedirect());
settings.setValue(QString("X-AW-Interval"), m_interval);
settings.setValue(QString("X-AW-Number"), m_number);
settings.setValue(QString("X-AW-Filters"), m_filters.join(QChar(',')));
settings.endGroup();
settings.sync();
}
void ExtScript::updateValue()
{
if (debug) qDebug() << PDEBUG;
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process->exitCode();
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardError()).trimmed();
if (debug) qDebug() << PDEBUG << ":" << "Error" << qdebug;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed();
switch (m_redirect) {
case stdout2stderr:
if (debug) qDebug() << PDEBUG << ":" << "Debug" << qdebug;
if (debug) qDebug() << PDEBUG << ":" << "Output" << qoutput;
break;
case stderr2stdout:
value = QString("%1\t%2").arg(qdebug).arg(qoutput);
break;
case nothing:
default:
if (debug) qDebug() << PDEBUG << ":" << "Debug" << qdebug;
value = qoutput;
break;
}
// filters
value = applyFilters(value);
}

Some files were not shown because too many files have changed in this diff Show More