Compare commits
37 Commits
Author | SHA1 | Date | |
---|---|---|---|
224e558a98 | |||
a391df2804 | |||
755d0b39f8 | |||
fcd612880f | |||
5aff2d2e4e | |||
5a52c056a7 | |||
42615a6fdc | |||
b431d2c6cf | |||
f96b3fcb07 | |||
f534a6854a | |||
b51c97abbb | |||
8dc3510a30 | |||
fce098cb5c | |||
5f4bf9ec29 | |||
8c73b2560b | |||
78931b3ae0 | |||
a53c5ec38c | |||
3bac9ac09f | |||
b82d78bcbe | |||
396fa95ec3 | |||
c6cadba4b6 | |||
daa362fc16 | |||
26c51007e0 | |||
7919e6d250 | |||
88c3e780cf | |||
7f4dfe1060 | |||
15d88ee3ba | |||
104bb52557 | |||
9a6b883905 | |||
fd8f2127d9 | |||
7ae90bf82d | |||
bcf26156d1 | |||
4cee2535ee | |||
e1ebd87871 | |||
4cef889fd4 | |||
d785839d1d | |||
cf6ccc293b |
52
CHANGELOG
@ -1,3 +1,45 @@
|
|||||||
|
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:
|
Ver.2.2.0:
|
||||||
* port to Plasma 5
|
* port to Plasma 5
|
||||||
+ add support of windows list in tooltip
|
+ add support of windows list in tooltip
|
||||||
@ -10,7 +52,7 @@ Ver.2.2.0:
|
|||||||
* small changes in widget logic
|
* small changes in widget logic
|
||||||
* edit window preview painting
|
* edit window preview painting
|
||||||
* KDE4 code upgrade to new ABI
|
* KDE4 code upgrade to new ABI
|
||||||
* dataengine optimization
|
* DataEngine optimization
|
||||||
* PKGCMD was replaced by ExtUpgrade
|
* PKGCMD was replaced by ExtUpgrade
|
||||||
|
|
||||||
Ver.2.1.0:
|
Ver.2.1.0:
|
||||||
@ -85,7 +127,7 @@ Ver.1.11.0:
|
|||||||
+ add desktop label (tags $name, $number, $total)
|
+ add desktop label (tags $name, $number, $total)
|
||||||
+ add ability to interact with players using mpris
|
+ add ability to interact with players using mpris
|
||||||
* rewrite to use submodules
|
* rewrite to use submodules
|
||||||
* rewrite dataengine to use tasks
|
* rewrite DataEngine to use tasks
|
||||||
* fix nvidia temperature definition
|
* fix nvidia temperature definition
|
||||||
|
|
||||||
Ver.1.10.2:
|
Ver.1.10.2:
|
||||||
@ -114,7 +156,7 @@ Ver.1.10.0:
|
|||||||
- remove util.py
|
- remove util.py
|
||||||
- remove createNotifyrc since it isn't needed
|
- remove createNotifyrc since it isn't needed
|
||||||
* refactoring of configuration interface
|
* refactoring of configuration interface
|
||||||
* player settings was moved from plasmoid to dataengine
|
* player settings was moved from plasmoid to DataEngine
|
||||||
* edit readme call
|
* edit readme call
|
||||||
* change readme from md to html
|
* change readme from md to html
|
||||||
|
|
||||||
@ -162,8 +204,8 @@ Ver.1.7.3:
|
|||||||
Ver.1.7.2:
|
Ver.1.7.2:
|
||||||
+ add tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
+ add tags $dd, $d, $hh, $h, $mm, $m to custom uptime format
|
||||||
+ add scalling to tooltips
|
+ add scalling to tooltips
|
||||||
+ add dataengine configuration from ptm
|
+ add DataEngine configuration from ptm
|
||||||
+ add custom command to dataengine
|
+ add custom command to DataEngine
|
||||||
- remove custom command from ptm
|
- remove custom command from ptm
|
||||||
- remove tags $ds, $hs, $ms
|
- remove tags $ds, $hs, $ms
|
||||||
|
|
||||||
|
48
CHANGELOG-RU
@ -1,3 +1,45 @@
|
|||||||
|
Вер.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:
|
Вер.2.2.0:
|
||||||
* портирование на Plasma 5
|
* портирование на Plasma 5
|
||||||
+ добавлена поддержка списка окон в тултипе
|
+ добавлена поддержка списка окон в тултипе
|
||||||
@ -10,7 +52,7 @@
|
|||||||
* незначительно изменена логика работы виджета
|
* незначительно изменена логика работы виджета
|
||||||
* исправлена отрисовка превью окон
|
* исправлена отрисовка превью окон
|
||||||
* обновление кодовой базы KDE4 под новый ABI
|
* обновление кодовой базы KDE4 под новый ABI
|
||||||
* оптимизация работы dataengine
|
* оптимизация работы DataEngine
|
||||||
* PKGCMD были заменены на ExtUpgrade
|
* PKGCMD были заменены на ExtUpgrade
|
||||||
|
|
||||||
Вер.2.1.0:
|
Вер.2.1.0:
|
||||||
@ -85,7 +127,7 @@
|
|||||||
+ добавлено поле текущий рабочий стол (теги $name, $number, $total)
|
+ добавлено поле текущий рабочий стол (теги $name, $number, $total)
|
||||||
+ добавлена возможность взаимодействия с плеерами через mpris
|
+ добавлена возможность взаимодействия с плеерами через mpris
|
||||||
* добавлено использование сабмодулей
|
* добавлено использование сабмодулей
|
||||||
* dataengine переписан с использованием tasks
|
* DataEngine переписан с использованием tasks
|
||||||
* фикс чтения температуры nvidia
|
* фикс чтения температуры nvidia
|
||||||
|
|
||||||
Вер.1.10.2:
|
Вер.1.10.2:
|
||||||
@ -114,7 +156,7 @@
|
|||||||
- удален util.py
|
- удален util.py
|
||||||
- удалены функции createNotifyrc, поскольку они больше не нужны
|
- удалены функции createNotifyrc, поскольку они больше не нужны
|
||||||
* рефакторинг конфигурационного интерфейса
|
* рефакторинг конфигурационного интерфейса
|
||||||
* настройки плеера были перенесены из виджета в dataengine
|
* настройки плеера были перенесены из виджета в DataEngine
|
||||||
* исправлен вызов readme под четырехсимвольное обозначение
|
* исправлен вызов readme под четырехсимвольное обозначение
|
||||||
* перенос readme с md на html
|
* перенос readme с md на html
|
||||||
|
|
||||||
|
19
README.md
@ -27,21 +27,21 @@ Instruction
|
|||||||
Dependencies
|
Dependencies
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* kdebase-workspace
|
* plasma-framework
|
||||||
* lm_sensors (*for definition temperature device*)
|
|
||||||
|
|
||||||
Optional dependencies
|
Optional dependencies
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
* proprietary video driver
|
* proprietary video driver
|
||||||
* hddtemp
|
* hddtemp
|
||||||
|
* smartmontools
|
||||||
* music player (mpd or supported MPRIS)
|
* music player (mpd or supported MPRIS)
|
||||||
|
|
||||||
Make dependencies
|
Make dependencies
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
* automoc4
|
|
||||||
* cmake
|
* cmake
|
||||||
|
* extra-cmake-modules
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
------------
|
------------
|
||||||
@ -50,15 +50,11 @@ Installation
|
|||||||
* install
|
* install
|
||||||
|
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --localprefix` ../
|
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||||
make && make install
|
|
||||||
|
|
||||||
Also you may install it to `/`:
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ../
|
|
||||||
make && sudo make install
|
make && sudo make install
|
||||||
|
|
||||||
|
**NOTE** on Plasma 5 it may require `-DKDE_INSTALL_USE_QT_SYS_PATHS=ON` flag
|
||||||
|
|
||||||
Additional information
|
Additional information
|
||||||
======================
|
======================
|
||||||
|
|
||||||
@ -75,4 +71,5 @@ Links
|
|||||||
* [Scripts and bars](http://arcanis.name/en/2014/12/19/aw-v21-bells-and-whistles/)
|
* [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)
|
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Awesome+Widgets?content=157124)
|
||||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||||
* Archlinux [AUR](https://aur.archlinux.org/packages/kdeplasma-applets-awesome-widgets/) package
|
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma5-applet-awesome-widgets/) package
|
||||||
|
* [OpenSuse](http://software.opensuse.org/package/awesome-widgets) package
|
||||||
|
@ -2,25 +2,22 @@
|
|||||||
|
|
||||||
pkgname=plasma5-applet-awesome-widgets
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
_pkgname=awesome-widgets
|
_pkgname=awesome-widgets
|
||||||
pkgver=2.2.0
|
pkgver=2.3.1
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||||
arch=('i686' 'x86_64')
|
arch=('i686' 'x86_64')
|
||||||
url="http://arcanis.name/projects/awesome-widgets"
|
url="http://arcanis.name/projects/awesome-widgets"
|
||||||
license=('GPL3')
|
license=('GPL3')
|
||||||
depends=('lm_sensors' 'plasma-framework')
|
depends=('plasma-framework')
|
||||||
optdepends=("amarok: for music player monitor"
|
optdepends=("catalyst: for GPU monitor"
|
||||||
"clementine: for music player monitor"
|
|
||||||
"catalyst: for GPU monitor"
|
|
||||||
"hddtemp: for HDD temperature monitor"
|
"hddtemp: for HDD temperature monitor"
|
||||||
"smartmontools: for HDD temperature monitor"
|
"smartmontools: for HDD temperature monitor"
|
||||||
"mpd: for music player monitor"
|
"mpd: for music player monitor"
|
||||||
"nvidia-utils: for GPU monitor"
|
"nvidia-utils: for GPU monitor")
|
||||||
"qmmp: for music player monitor")
|
|
||||||
makedepends=('cmake' 'extra-cmake-modules')
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||||
install=${pkgname}.install
|
install=${pkgname}.install
|
||||||
md5sums=('a8b46415c387b98d5df1a79bb985f709')
|
md5sums=('90e640b6679b4cf0f6f99cf6da2848f3')
|
||||||
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
54
arch/PKGBUILD-git
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
|
||||||
|
|
||||||
|
pkgname=plasma5-applet-awesome-widgets
|
||||||
|
_pkgname=awesome-widgets
|
||||||
|
pkgver=2.2.1.r15.g78931b3
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor). Git version"
|
||||||
|
arch=('i686' 'x86_64')
|
||||||
|
url="http://arcanis.name/projects/awesome-widgets"
|
||||||
|
license=('GPL3')
|
||||||
|
depends=('plasma-framework')
|
||||||
|
optdepends=("amarok: for music player monitor"
|
||||||
|
"clementine: for music player monitor"
|
||||||
|
"catalyst: for GPU monitor"
|
||||||
|
"hddtemp: for HDD temperature monitor"
|
||||||
|
"smartmontools: for HDD temperature monitor"
|
||||||
|
"mpd: for music player monitor"
|
||||||
|
"nvidia-utils: for GPU monitor"
|
||||||
|
"qmmp: for music player monitor")
|
||||||
|
makedepends=('cmake' 'extra-cmake-modules')
|
||||||
|
source=(${_pkgname}::git+https://github.com/arcan1s/awesome-widgets/)
|
||||||
|
install=${pkgname}.install
|
||||||
|
md5sums=('SKIP')
|
||||||
|
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
git describe --tags --long | sed 's/V\.//' | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
rm -rf "${srcdir}/${_pkgname}/build"
|
||||||
|
mkdir "${srcdir}/${_pkgname}/build"
|
||||||
|
|
||||||
|
# update submobules
|
||||||
|
cd "${srcdir}/${_pkgname}"
|
||||||
|
git submodule init
|
||||||
|
git submodule update --recursive
|
||||||
|
echo "$pkgver"
|
||||||
|
}
|
||||||
|
|
||||||
|
build () {
|
||||||
|
cd "${srcdir}/${_pkgname}/build"
|
||||||
|
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||||
|
"../sources"
|
||||||
|
make
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "${srcdir}/${_pkgname}/build"
|
||||||
|
make DESTDIR="${pkgdir}" install
|
||||||
|
}
|
@ -1,43 +0,0 @@
|
|||||||
# Maintainer: Evgeniy Alekseev <arcanis at archlinux dot org>
|
|
||||||
|
|
||||||
pkgname=kdeplasma-applets-awesome-widgets
|
|
||||||
_pkgname=awesome-widgets
|
|
||||||
pkgver=2.2.0
|
|
||||||
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=('kdebase-workspace' 'lm_sensors')
|
|
||||||
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=('automoc4' 'cmake')
|
|
||||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
|
||||||
install=${pkgname}.install
|
|
||||||
md5sums=('a8b46415c387b98d5df1a79bb985f709')
|
|
||||||
backup=('usr/share/config/plasma-dataengine-extsysmon.conf')
|
|
||||||
|
|
||||||
prepare() {
|
|
||||||
rm -rf "${srcdir}/build"
|
|
||||||
mkdir "${srcdir}/build"
|
|
||||||
}
|
|
||||||
|
|
||||||
build () {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
cmake -DBUILD_KDE4=ON \
|
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
|
||||||
-DCMAKE_INSTALL_PREFIX=$(kde4-config --prefix) \
|
|
||||||
"../${_pkgname}"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "${srcdir}/build"
|
|
||||||
make DESTDIR="${pkgdir}" install
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
post_install() {
|
|
||||||
kbuildsycoca4 > /dev/null 2>&1
|
|
||||||
}
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
post_remove() {
|
|
||||||
post_install "$1"
|
|
||||||
}
|
|
@ -21,7 +21,7 @@ rm -rf "${ARCHIVE}"
|
|||||||
# build widget
|
# build widget
|
||||||
ARCHIVE="awesome-widgets"
|
ARCHIVE="awesome-widgets"
|
||||||
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
|
FILES="AUTHORS CHANGELOG CHANGELOG-RU COPYING"
|
||||||
IGNORELIST="build usr .kdev4 sources.kdev4"
|
IGNORELIST="build usr .kdev4 *.kdev4"
|
||||||
# create archive
|
# create archive
|
||||||
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
[[ -e ${ARCHIVE}-${VERSION}-src.tar.xz ]] && rm -f "${ARCHIVE}-${VERSION}-src.tar.xz"
|
||||||
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
[[ -d ${ARCHIVE} ]] && rm -rf "${ARCHIVE}"
|
||||||
@ -34,8 +34,8 @@ rm -rf "${ARCHIVE}"
|
|||||||
|
|
||||||
# update md5sum
|
# update md5sum
|
||||||
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
MD5SUMS=$(md5sum ${ARCHIVE}-${VERSION}-src.tar.xz | awk '{print $1}')
|
||||||
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD{-kf5,-kde4}
|
sed -i "/md5sums=('[0-9A-Fa-f]*/s/[^'][^)]*/md5sums=('${MD5SUMS}'/" arch/PKGBUILD
|
||||||
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD{-kf5,-kde4}
|
sed -i "s/pkgver=[0-9.]*/pkgver=${VERSION}/" arch/PKGBUILD
|
||||||
# clear
|
# clear
|
||||||
find . -type f -name '*src.tar.xz' -not -name "*${VERSION}-src.tar.xz" -exec rm -rf {} \;
|
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 {} \;
|
find arch -type l -xtype l -exec rm -rf {} \;
|
||||||
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 55 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 53 KiB |
BIN
screenshots/config_06.png
Normal file
After Width: | Height: | Size: 49 KiB |
BIN
screenshots/dp_config_01.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
screenshots/dp_config_02.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
screenshots/dp_config_03.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
screenshots/dp_config_04.png
Normal file
After Width: | Height: | Size: 38 KiB |
23
sources/.kdev4/awesomewidgets.kdev4
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
[Buildset]
|
||||||
|
BuildItems=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x01\x00\x00\x00\x0b\x00\x00\x00\x00\x01\x00\x00\x00\x1e\x00a\x00w\x00e\x00s\x00o\x00m\x00e\x00-\x00w\x00i\x00d\x00g\x00e\x00t\x00s)
|
||||||
|
|
||||||
|
[CMake]
|
||||||
|
Build Directory Count=1
|
||||||
|
Current Build Directory Index=0
|
||||||
|
ProjectRootRelative=./
|
||||||
|
|
||||||
|
[CMake][CMake Build Directory 0]
|
||||||
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||||
|
Build Type=Release
|
||||||
|
CMake Binary=file:///usr/bin/cmake
|
||||||
|
Environment Profile=
|
||||||
|
Extra Arguments=
|
||||||
|
Install Directory=file:///usr
|
||||||
|
|
||||||
|
[Defines And Includes][Compiler]
|
||||||
|
Name=GCC
|
||||||
|
Path=gcc
|
||||||
|
Type=GCC
|
||||||
|
|
||||||
|
[Project]
|
||||||
|
VersionControlSupport=kdevgit
|
@ -8,7 +8,7 @@ ProjectRootRelative=./
|
|||||||
|
|
||||||
[CMake][CMake Build Directory 0]
|
[CMake][CMake Build Directory 0]
|
||||||
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
|
||||||
Build Type=Debug
|
Build Type=Release
|
||||||
CMake Binary=file:///usr/bin/cmake
|
CMake Binary=file:///usr/bin/cmake
|
||||||
Environment Profile=
|
Environment Profile=
|
||||||
Extra Arguments=
|
Extra Arguments=
|
||||||
|
@ -10,8 +10,8 @@ set (PROJECT_AUTHOR "Evgeniy Alekseev")
|
|||||||
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
set (PROJECT_CONTACT "esalexeev@gmail.com")
|
||||||
set (PROJECT_LICENSE "GPLv3")
|
set (PROJECT_LICENSE "GPLv3")
|
||||||
set (PROJECT_VERSION_MAJOR 2)
|
set (PROJECT_VERSION_MAJOR 2)
|
||||||
set (PROJECT_VERSION_MINOR 2)
|
set (PROJECT_VERSION_MINOR 3)
|
||||||
set (PROJECT_VERSION_PATCH 0)
|
set (PROJECT_VERSION_PATCH 1)
|
||||||
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
set (PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
|
||||||
|
|
||||||
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
string (TIMESTAMP CURRENT_DATE "%Y-%m-%d %H:%M" UTC)
|
||||||
@ -21,8 +21,6 @@ message (STATUS "Project: ${PROJECT_NAME}")
|
|||||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||||
|
|
||||||
option (BUILD_KDE4 "Build on KDE4" OFF)
|
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
||||||
@ -33,18 +31,16 @@ if (CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
else ()
|
else ()
|
||||||
message (STATUS "Unknown compiler")
|
message (STATUS "Unknown compiler")
|
||||||
endif ()
|
endif ()
|
||||||
|
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
|
endif ()
|
||||||
|
|
||||||
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
|
||||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||||
|
|
||||||
add_subdirectory (extsysmon)
|
add_subdirectory (extsysmon)
|
||||||
if (BUILD_KDE4)
|
add_subdirectory (awesome-widget)
|
||||||
add_subdirectory (awesome-widget-kde4)
|
add_subdirectory (desktop-panel)
|
||||||
add_subdirectory (desktop-panel-kde4)
|
|
||||||
else ()
|
|
||||||
add_subdirectory (awesome-widget-kf5)
|
|
||||||
add_subdirectory (desktop-panel-kf5)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# translations
|
# translations
|
||||||
add_subdirectory (translations)
|
add_subdirectory (translations)
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
# set project name
|
|
||||||
set (SUBPROJECT plasma_applet_awesome-widget)
|
|
||||||
set (PLUGIN_NAME ${SUBPROJECT})
|
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
|
||||||
|
|
||||||
# find required libaries
|
|
||||||
find_package (KDE4 REQUIRED)
|
|
||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
|
||||||
|
|
||||||
include (KDE4Defaults)
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
${KDE4_INCLUDES}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
|
||||||
${PROJECT_TRDPARTY_DIR}
|
|
||||||
../extsysmon
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../extsysmon)
|
|
||||||
|
|
||||||
# set sources
|
|
||||||
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
|
|
||||||
${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
|
||||||
../extsysmon/extscript.cpp
|
|
||||||
../extsysmon/extupgrade.cpp)
|
|
||||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
|
||||||
file (GLOB SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)
|
|
||||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
|
||||||
set (SUBPROJECT_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
|
||||||
|
|
||||||
# prepare
|
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
|
||||||
|
|
||||||
# make
|
|
||||||
qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
|
||||||
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE})
|
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_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_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
|
|
||||||
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
|
|
@ -1,534 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AdvancedWindow</class>
|
|
||||||
<widget class="QWidget" name="AdvancedWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>700</width>
|
|
||||||
<height>588</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Advanced</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_advanced">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="contents_advanced">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>-250</y>
|
|
||||||
<width>675</width>
|
|
||||||
<height>822</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_popup">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_popup">
|
|
||||||
<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_popup">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable popup on mouse click</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_background">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_background">
|
|
||||||
<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_background">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable background</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_timeFormat">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_timeFormat">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom time format</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_timeFormat">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>$dddd - long weekday
|
|
||||||
$ddd - short weekday
|
|
||||||
$dd - day
|
|
||||||
$d - day w\o zero
|
|
||||||
$MMMM - long month
|
|
||||||
$MMM - short month
|
|
||||||
$MM - month
|
|
||||||
$M - month w\o zero
|
|
||||||
$yyyy - year
|
|
||||||
$yy - short year
|
|
||||||
$hh - hours (24 only)
|
|
||||||
$h - hours w\o zero (24 only)
|
|
||||||
$mm - minutes
|
|
||||||
$m - minutes w\o zero
|
|
||||||
$ss - seconds
|
|
||||||
$s - seconds w\o zero</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_uptimeFormat">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_uptimeFormat">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom uptime format</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_uptimeFormat">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>$dd - uptime days
|
|
||||||
$d - uptime days without zero
|
|
||||||
$hh - uptime hours
|
|
||||||
$h - uptime hours without zero
|
|
||||||
$mm - uptime minutes
|
|
||||||
$m - uptime minutes without zero</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_tempUnits">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tempUnits">
|
|
||||||
<property name="text">
|
|
||||||
<string>Temperature units</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_tempUnits">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Celsius</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Fahrenheit</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Kelvin</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">Reaumur</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">cm^-1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">kJ/mol</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">kcal/mol</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_tempDevice">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tempDevice">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Temperature devices</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_tempDevice">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_fanDevice">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fanDevice">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Fan devices</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_fanDevice">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_mount">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mount">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Mount points</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_mount">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_hddSpeedDevice">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_hddSpeedDevice">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HDD devices (speed)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_hddSpeedDevice">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_hddDevice">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_hddDevice">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>HDD devices (temp)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_hddDevice">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Editable</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_netdev">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_netdev">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Disable auto select device and set specified device</string>
|
|
||||||
</property>
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Set network device</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_netdev">
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_acOnline">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_acOnline">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>AC online tag</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_acOnline">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Line, which returns when AC is online</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_acOffline">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_acOffline">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>AC offline tag</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_acOffline">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Line, which returns when AC is offline</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QVBoxLayout" name="layout_bars">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_barsAdd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_bars">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bars</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_bars">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_bars">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_bars">
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_updates">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_updates">
|
|
||||||
<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_updates">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Check for updates</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_advanced">
|
|
||||||
<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>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,237 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AppearanceWindow</class>
|
|
||||||
<widget class="QWidget" name="AppearanceWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>700</width>
|
|
||||||
<height>594</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Appearance</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_appearance">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="contents_appearance">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>684</width>
|
|
||||||
<height>578</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_interval">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_interval">
|
|
||||||
<property name="text">
|
|
||||||
<string>Time 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>500</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>2000</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_font">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_font">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFontComboBox" name="fontComboBox">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>180</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_size">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_size">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font size</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_size">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>99</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>12</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_color">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_color">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font color</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_style">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_style">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font style</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_style">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">normal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">italic</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_weight">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_weight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font weight</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_weight">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>900</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>400</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_text">
|
|
||||||
<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>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KColorCombo</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>kcolorcombo.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,503 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 "awesome-widget.h"
|
|
||||||
|
|
||||||
#include <KStandardDirs>
|
|
||||||
#include <Plasma/ToolTipManager>
|
|
||||||
#include <QDesktopServices>
|
|
||||||
#include <QDir>
|
|
||||||
#include <QGraphicsGridLayout>
|
|
||||||
#include <QGraphicsProxyWidget>
|
|
||||||
#include <QGraphicsScene>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QNetworkAccessManager>
|
|
||||||
#include <QNetworkInterface>
|
|
||||||
#include <QNetworkRequest>
|
|
||||||
#include <QNetworkReply>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QTextCodec>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include "customlabel.h"
|
|
||||||
#include "graphicalitem.h"
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
#include <task/taskadds.h>
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
|
|
||||||
AwesomeWidget::AwesomeWidget(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::Applet(parent, args)
|
|
||||||
{
|
|
||||||
// debug
|
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
|
||||||
if (debugEnv == QString("yes"))
|
|
||||||
debug = true;
|
|
||||||
else
|
|
||||||
debug = false;
|
|
||||||
|
|
||||||
setBackgroundHints(DefaultBackground);
|
|
||||||
setAspectRatioMode(Plasma::IgnoreAspectRatio);
|
|
||||||
setHasConfigurationInterface(true);
|
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
// text format init
|
|
||||||
formatLine.append(QString(""));
|
|
||||||
formatLine.append(QString(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
AwesomeWidget::~AwesomeWidget()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::checkUpdates()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
|
||||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(replyRecieved(QNetworkReply *)));
|
|
||||||
manager->get(QNetworkRequest(QUrl(VERSION_API)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<QAction *> AwesomeWidget::contextualActions()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return contextMenu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::createActions()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
contextMenu.clear();
|
|
||||||
contextMenu.append(new QAction(QIcon::fromTheme(QString("utilities-system-monitor")),
|
|
||||||
i18n("Run ksysguard"), this));
|
|
||||||
connect(contextMenu[0], SIGNAL(triggered(bool)), this, SLOT(showKsysguard()));
|
|
||||||
contextMenu.append(new QAction(QIcon::fromTheme(QString("text-x-readme")),
|
|
||||||
i18n("Show README"), this));
|
|
||||||
connect(contextMenu[1], SIGNAL(triggered(bool)), this, SLOT(showReadme()));
|
|
||||||
contextMenu.append(new QAction(QIcon::fromTheme(QString("stock-refresh")),
|
|
||||||
i18n("Update text"), this));
|
|
||||||
connect(contextMenu[2], SIGNAL(triggered(bool)), this, SLOT(updateNetworkDevice()));
|
|
||||||
connect(contextMenu[2], SIGNAL(triggered(bool)), extsysmonEngine, SLOT(updateAllSources()));
|
|
||||||
connect(contextMenu[2], SIGNAL(triggered(bool)), sysmonEngine, SLOT(updateAllSources()));
|
|
||||||
contextMenu.append(new QAction(QIcon::fromTheme(QString("system-software-update")),
|
|
||||||
i18n("Check for updates"), this));
|
|
||||||
connect(contextMenu[3], SIGNAL(triggered(bool)), this, SLOT(checkUpdates()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString AwesomeWidget::getNetworkDevice()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString device = QString("lo");
|
|
||||||
if (configuration[QString("useCustomNetdev")].toInt() == 2)
|
|
||||||
device = configuration[QString("customNetdev")];
|
|
||||||
else {
|
|
||||||
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces();
|
|
||||||
for (int i=0; i<rawInterfaceList.count(); i++)
|
|
||||||
if ((rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsUp)) &&
|
|
||||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsLoopBack)) &&
|
|
||||||
(!rawInterfaceList[i].flags().testFlag(QNetworkInterface::IsPointToPoint)))
|
|
||||||
device = rawInterfaceList[i].name();
|
|
||||||
}
|
|
||||||
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int AwesomeWidget::getNumberCpus()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString cmd = QString("grep -c ^processor /proc/cpuinfo");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
TaskResult process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
return QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed().toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float AwesomeWidget::getTemp(const float temp)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
float convertedTemp = temp;
|
|
||||||
if (configuration[QString("tempUnits")] == QString("Celsius"))
|
|
||||||
;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("Fahrenheit"))
|
|
||||||
convertedTemp = temp * 9.0 / 5.0 + 32.0;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("Kelvin"))
|
|
||||||
convertedTemp = temp + 273.15;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("Reaumur"))
|
|
||||||
convertedTemp = temp * 0.8;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("cm^-1"))
|
|
||||||
convertedTemp = (temp + 273.15) * 0.695;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("kJ/mol"))
|
|
||||||
convertedTemp = (temp + 273.15) * 8.31;
|
|
||||||
else if (configuration[QString("tempUnits")] == QString("kcal/mol"))
|
|
||||||
convertedTemp = (temp + 273.15) * 1.98;
|
|
||||||
|
|
||||||
return convertedTemp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AwesomeWidget::getTimeKeys()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList timeKeys;
|
|
||||||
timeKeys.append(QString("dddd"));
|
|
||||||
timeKeys.append(QString("ddd"));
|
|
||||||
timeKeys.append(QString("dd"));
|
|
||||||
timeKeys.append(QString("d"));
|
|
||||||
timeKeys.append(QString("MMMM"));
|
|
||||||
timeKeys.append(QString("MMM"));
|
|
||||||
timeKeys.append(QString("MM"));
|
|
||||||
timeKeys.append(QString("M"));
|
|
||||||
timeKeys.append(QString("yyyy"));
|
|
||||||
timeKeys.append(QString("yy"));
|
|
||||||
timeKeys.append(QString("hh"));
|
|
||||||
timeKeys.append(QString("h"));
|
|
||||||
timeKeys.append(QString("mm"));
|
|
||||||
timeKeys.append(QString("m"));
|
|
||||||
timeKeys.append(QString("ss"));
|
|
||||||
timeKeys.append(QString("s"));
|
|
||||||
|
|
||||||
return timeKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::init()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
// dataengines
|
|
||||||
extsysmonEngine = dataEngine(QString("extsysmon"));
|
|
||||||
sysmonEngine = dataEngine(QString("systemmonitor"));
|
|
||||||
connect(sysmonEngine, SIGNAL(sourceAdded(QString)), this, SLOT(addDiskDevice(QString)));
|
|
||||||
timeEngine = dataEngine(QString("time"));
|
|
||||||
|
|
||||||
// tooltip
|
|
||||||
toolTip = Plasma::ToolTipContent();
|
|
||||||
toolTip.setMainText(QString("Awesome Widget"));
|
|
||||||
toolTip.setSubText(QString(""));
|
|
||||||
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);
|
|
||||||
Plasma::ToolTipManager::self()->setContent(this, toolTip);
|
|
||||||
|
|
||||||
// body
|
|
||||||
createActions();
|
|
||||||
mainLayout = new QGraphicsGridLayout();
|
|
||||||
mainLayout->setContentsMargins(1, 1, 1, 1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
textLabel = new CustomLabel(this, debug);
|
|
||||||
textLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
QGraphicsProxyWidget *pw = new QGraphicsProxyWidget(this);
|
|
||||||
pw->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
|
||||||
textLabel->setAttribute(Qt::WA_TranslucentBackground, true);
|
|
||||||
pw->setWidget(textLabel);
|
|
||||||
mainLayout->addItem(pw, 0, 0);
|
|
||||||
|
|
||||||
// read variables
|
|
||||||
configChanged();
|
|
||||||
timer = new QTimer(this);
|
|
||||||
timer->setSingleShot(false);
|
|
||||||
timer->setInterval(configuration[QString("interval")].toInt());
|
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateText()));
|
|
||||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateTooltip()));
|
|
||||||
timer->start();
|
|
||||||
// check for updates
|
|
||||||
connect(this, SIGNAL(thereIsUpdates(QString)), this, SLOT(showUpdates(QString)));
|
|
||||||
if (configuration[QString("checkUpdates")].toInt() == 2)
|
|
||||||
checkUpdates();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::replyRecieved(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)))
|
|
||||||
emit(thereIsUpdates(version));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::addDiskDevice(const QString source)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
|
|
||||||
if (diskRegexp.indexIn(source) > -1) {
|
|
||||||
QStringList splitSource = source.split(QChar('/'));
|
|
||||||
QString device = splitSource[0] + QString("/") + splitSource[1];
|
|
||||||
diskDevices.append(device);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AwesomeWidget::findKeys()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList selectedKeys;
|
|
||||||
for (int i=0; i<keys.count(); i++)
|
|
||||||
if (configuration[QString("text")].contains(QString("$") + keys[i])) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found key" << keys[i];
|
|
||||||
selectedKeys.append(keys[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return selectedKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AwesomeWidget::getKeys()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList allKeys;
|
|
||||||
// time
|
|
||||||
allKeys.append(QString("time"));
|
|
||||||
allKeys.append(QString("isotime"));
|
|
||||||
allKeys.append(QString("shorttime"));
|
|
||||||
allKeys.append(QString("longtime"));
|
|
||||||
allKeys.append(QString("ctime"));
|
|
||||||
// uptime
|
|
||||||
allKeys.append(QString("uptime"));
|
|
||||||
allKeys.append(QString("cuptime"));
|
|
||||||
// cpuclock
|
|
||||||
for (int i=counts[QString("cpu")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("cpucl") + QString::number(i));
|
|
||||||
allKeys.append(QString("cpucl"));
|
|
||||||
// cpu
|
|
||||||
for (int i=counts[QString("cpu")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("cpu") + QString::number(i));
|
|
||||||
allKeys.append(QString("cpu"));
|
|
||||||
// temperature
|
|
||||||
for (int i=counts[QString("temp")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("temp") + QString::number(i));
|
|
||||||
for (int i=counts[QString("fan")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("fan") + QString::number(i));
|
|
||||||
// gputemp
|
|
||||||
allKeys.append(QString("gputemp"));
|
|
||||||
// gpu
|
|
||||||
allKeys.append(QString("gpu"));
|
|
||||||
// memory
|
|
||||||
allKeys.append(QString("memmb"));
|
|
||||||
allKeys.append(QString("memgb"));
|
|
||||||
allKeys.append(QString("memfreemb"));
|
|
||||||
allKeys.append(QString("memfreegb"));
|
|
||||||
allKeys.append(QString("memtotmb"));
|
|
||||||
allKeys.append(QString("memtotgb"));
|
|
||||||
allKeys.append(QString("memusedmb"));
|
|
||||||
allKeys.append(QString("memusedgb"));
|
|
||||||
allKeys.append(QString("mem"));
|
|
||||||
// swap
|
|
||||||
allKeys.append(QString("swapmb"));
|
|
||||||
allKeys.append(QString("swapgb"));
|
|
||||||
allKeys.append(QString("swapfreemb"));
|
|
||||||
allKeys.append(QString("swapfreegb"));
|
|
||||||
allKeys.append(QString("swaptotmb"));
|
|
||||||
allKeys.append(QString("swaptotgb"));
|
|
||||||
allKeys.append(QString("swap"));
|
|
||||||
// hdd
|
|
||||||
for (int i=counts[QString("mount")]-1; i>=0; i--) {
|
|
||||||
allKeys.append(QString("hddmb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddgb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddfreemb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddfreegb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddtotmb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddtotgb") + QString::number(i));
|
|
||||||
allKeys.append(QString("hdd") + QString::number(i));
|
|
||||||
}
|
|
||||||
// hdd speed
|
|
||||||
for (int i=counts[QString("disk")]-1; i>=0; i--) {
|
|
||||||
allKeys.append(QString("hddr") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddw") + QString::number(i));
|
|
||||||
}
|
|
||||||
// hdd temp
|
|
||||||
for (int i=counts[QString("hddtemp")]-1; i>=0; i--) {
|
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
|
||||||
allKeys.append(QString("hddtemp") + QString::number(i));
|
|
||||||
}
|
|
||||||
// network
|
|
||||||
allKeys.append(QString("down"));
|
|
||||||
allKeys.append(QString("up"));
|
|
||||||
allKeys.append(QString("netdev"));
|
|
||||||
// battery
|
|
||||||
allKeys.append(QString("ac"));
|
|
||||||
for (int i=counts[QString("bat")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("bat") + QString::number(i));
|
|
||||||
allKeys.append(QString("bat"));
|
|
||||||
// player
|
|
||||||
allKeys.append(QString("album"));
|
|
||||||
allKeys.append(QString("artist"));
|
|
||||||
allKeys.append(QString("duration"));
|
|
||||||
allKeys.append(QString("progress"));
|
|
||||||
allKeys.append(QString("title"));
|
|
||||||
// ps
|
|
||||||
allKeys.append(QString("pscount"));
|
|
||||||
allKeys.append(QString("pstotal"));
|
|
||||||
allKeys.append(QString("ps"));
|
|
||||||
// package manager
|
|
||||||
for (int i=counts[QString("pkg")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("pkgcount") + QString::number(i));
|
|
||||||
// custom
|
|
||||||
for (int i=counts[QString("custom")]-1; i>=0; i--)
|
|
||||||
allKeys.append(QString("custom") + QString::number(i));
|
|
||||||
// desktop
|
|
||||||
allKeys.append(QString("desktop"));
|
|
||||||
allKeys.append(QString("ndesktop"));
|
|
||||||
allKeys.append(QString("tdesktops"));
|
|
||||||
|
|
||||||
return allKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QStringList AwesomeWidget::findGraphicalItems()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QStringList orderedKeys;
|
|
||||||
for (int i=0; i<graphicalItems.count(); i++)
|
|
||||||
orderedKeys.append(graphicalItems[i]->name() + graphicalItems[i]->bar());
|
|
||||||
orderedKeys.sort();
|
|
||||||
QStringList selectedKeys;
|
|
||||||
for (int i=orderedKeys.count()-1; i>=0; i--)
|
|
||||||
if (configuration[QString("text")].contains(QString("$") + orderedKeys[i])) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found key" << orderedKeys[i];
|
|
||||||
selectedKeys.append(orderedKeys[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return selectedKeys;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::getGraphicalItems()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
graphicalItems.clear();
|
|
||||||
// create directory at $HOME
|
|
||||||
QString localDir = KStandardDirs::locateLocal("data", "plasma_applet_awesome-widget/desktops");
|
|
||||||
if (KStandardDirs::makeDir(localDir))
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
|
||||||
|
|
||||||
QStringList dirs = KGlobal::dirs()->findDirs("data", "plasma_applet_awesome-widget/desktops");
|
|
||||||
QStringList names;
|
|
||||||
for (int i=0; i<dirs.count(); i++) {
|
|
||||||
QStringList files = QDir(dirs[i]).entryList(QDir::Files, QDir::Name);
|
|
||||||
for (int j=0; j<files.count(); j++) {
|
|
||||||
if (!files[j].endsWith(QString(".desktop"))) continue;
|
|
||||||
if (names.contains(files[j])) continue;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Found file" << files[j] << "in" << dirs[i];
|
|
||||||
names.append(files[j]);
|
|
||||||
graphicalItems.append(new GraphicalItem(0, files[j], dirs, debug));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GraphicalItem *AwesomeWidget::getItemByTag(const QString tag)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
GraphicalItem *item = nullptr;
|
|
||||||
for (int i=0; i< graphicalItems.count(); i++) {
|
|
||||||
if ((graphicalItems[i]->name() + graphicalItems[i]->bar()) != tag) continue;
|
|
||||||
item = graphicalItems[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::showKsysguard()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString cmd = QString("ksysguard");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
TaskResult process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::showReadme()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QDesktopServices::openUrl(QString("http://arcanis.name/projects/awesome-widgets/"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET(awesome-widget, AwesomeWidget)
|
|
@ -1,154 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 AWESOME_WIDGET_H
|
|
||||||
#define AWESOME_WIDGET_H
|
|
||||||
|
|
||||||
#include <Plasma/Applet>
|
|
||||||
#include <Plasma/DataEngine>
|
|
||||||
#include <Plasma/ToolTipContent>
|
|
||||||
|
|
||||||
#include <ui_about.h>
|
|
||||||
#include <ui_advanced.h>
|
|
||||||
#include <ui_appearance.h>
|
|
||||||
#include <ui_deconfig.h>
|
|
||||||
#include <ui_tooltipconfig.h>
|
|
||||||
#include <ui_widget.h>
|
|
||||||
|
|
||||||
|
|
||||||
class CustomLabel;
|
|
||||||
class ExtScript;
|
|
||||||
class ExtUpgrade;
|
|
||||||
class GraphicalItem;
|
|
||||||
class QGraphicsGridLayout;
|
|
||||||
class QGraphicsScene;
|
|
||||||
class QNetworkReply;
|
|
||||||
|
|
||||||
class AwesomeWidget : public Plasma::Applet
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
AwesomeWidget(QObject *parent, const QVariantList &args);
|
|
||||||
~AwesomeWidget();
|
|
||||||
QString getNetworkDevice();
|
|
||||||
int getNumberCpus();
|
|
||||||
float getTemp(const float temp);
|
|
||||||
QStringList getTimeKeys();
|
|
||||||
void init();
|
|
||||||
// de configuration
|
|
||||||
QMap<QString, QString> readDataEngineConfiguration();
|
|
||||||
void writeDataEngineConfiguration(const QMap<QString, QString> settings);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
// contextual actions
|
|
||||||
void showKsysguard();
|
|
||||||
void showReadme();
|
|
||||||
void showUpdates(QString version);
|
|
||||||
// dataengine
|
|
||||||
void addDiskDevice(const QString source);
|
|
||||||
void connectToEngine();
|
|
||||||
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data);
|
|
||||||
void disconnectFromEngine();
|
|
||||||
// configuration interface
|
|
||||||
void configAccepted();
|
|
||||||
void configChanged();
|
|
||||||
// update events
|
|
||||||
void sendNotification(const QString eventId, const QString message);
|
|
||||||
void updateNetworkDevice(const bool delay = true);
|
|
||||||
void updateText(const bool clear = false);
|
|
||||||
void updateTooltip();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void checkUpdates();
|
|
||||||
void reinit();
|
|
||||||
void replyRecieved(QNetworkReply *reply);
|
|
||||||
// configuration interface
|
|
||||||
void addBar();
|
|
||||||
void addCustomScript();
|
|
||||||
void addPkgCommand();
|
|
||||||
void contextMenuBars(const QPoint pos);
|
|
||||||
void contextMenuCustomCommand(const QPoint pos);
|
|
||||||
void contextMenuPkgCommand(const QPoint pos);
|
|
||||||
void copyBar(const QString original);
|
|
||||||
void copyCustomCommand(const QString original);
|
|
||||||
void copyPkgCommand(const QString original);
|
|
||||||
void editBar(QListWidgetItem *item);
|
|
||||||
void editCustomCommand(QListWidgetItem *item);
|
|
||||||
void editPkgCommand(QListWidgetItem *item);
|
|
||||||
void editFanItem(QListWidgetItem *item);
|
|
||||||
void editHddItem(QListWidgetItem *item);
|
|
||||||
void editHddSpeedItem(QListWidgetItem *item);
|
|
||||||
void editMountItem(QListWidgetItem *item);
|
|
||||||
void editTempItem(QListWidgetItem *item);
|
|
||||||
void setFontFormating();
|
|
||||||
void setFormating();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void thereIsUpdates(QString version);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QList<QAction *> contextualActions();
|
|
||||||
void createConfigurationInterface(KConfigDialog *parent);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// functions
|
|
||||||
void createActions();
|
|
||||||
QStringList findKeys();
|
|
||||||
QStringList getKeys();
|
|
||||||
QStringList findGraphicalItems();
|
|
||||||
void getGraphicalItems();
|
|
||||||
GraphicalItem *getItemByTag(const QString tag);
|
|
||||||
QList<ExtScript *> initScripts();
|
|
||||||
QList<ExtUpgrade *> initUpgrades();
|
|
||||||
// ui
|
|
||||||
QGraphicsGridLayout *mainLayout = nullptr;
|
|
||||||
CustomLabel *textLabel = nullptr;
|
|
||||||
QTimer *timer = nullptr;
|
|
||||||
QList<QAction *> contextMenu;
|
|
||||||
// tooltip
|
|
||||||
Plasma::ToolTipContent toolTip;
|
|
||||||
QGraphicsScene *toolTipScene = nullptr;
|
|
||||||
QGraphicsView *toolTipView = nullptr;
|
|
||||||
// values
|
|
||||||
int networkDeviceUpdate = 0;
|
|
||||||
QMap<QString, int> counts;
|
|
||||||
QMap<QString, QList<float>> tooltipValues;
|
|
||||||
QMap<QString, QString> values;
|
|
||||||
// debug
|
|
||||||
bool debug;
|
|
||||||
// data engine
|
|
||||||
Plasma::DataEngine *extsysmonEngine = nullptr;
|
|
||||||
Plasma::DataEngine *sysmonEngine = nullptr;
|
|
||||||
Plasma::DataEngine *timeEngine = nullptr;
|
|
||||||
// configuration interface
|
|
||||||
Ui::About uiAboutConfig;
|
|
||||||
Ui::AdvancedWindow uiAdvancedConfig;
|
|
||||||
Ui::AppearanceWindow uiAppConfig;
|
|
||||||
Ui::ConfigWindow uiWidConfig;
|
|
||||||
Ui::DEWindow uiDEConfig;
|
|
||||||
Ui::TooltipWindow uiTooltipConfig;
|
|
||||||
// configuration
|
|
||||||
QMap<QString, QString> configuration;
|
|
||||||
QStringList diskDevices, keys, formatLine, foundKeys;
|
|
||||||
QList<GraphicalItem *> graphicalItems;
|
|
||||||
QStringList foundBars;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* AWESOME_WIDGET_H */
|
|
@ -1,97 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 "customlabel.h"
|
|
||||||
|
|
||||||
#include <QGraphicsSceneMouseEvent>
|
|
||||||
#include <QTextCodec>
|
|
||||||
|
|
||||||
#include "awesome-widget.h"
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
#include <task/taskadds.h>
|
|
||||||
|
|
||||||
|
|
||||||
CustomLabel::CustomLabel(AwesomeWidget *wid, const bool debugCmd)
|
|
||||||
: QLabel(0),
|
|
||||||
widget(wid),
|
|
||||||
debug(debugCmd)
|
|
||||||
{
|
|
||||||
setWordWrap(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CustomLabel::~CustomLabel()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CustomLabel::setPopupEnabled(const bool state)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "State" << state;
|
|
||||||
|
|
||||||
enablePopup = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CustomLabel::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
|
|
||||||
|
|
||||||
if ((enablePopup) && (event->button() == Qt::LeftButton)) {
|
|
||||||
QString cmd, text;
|
|
||||||
TaskResult process;
|
|
||||||
|
|
||||||
// kernel
|
|
||||||
cmd = QString("uname -rsm");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
text += QString("Kernel: %1<br>").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed());
|
|
||||||
// hostname
|
|
||||||
cmd = QString("uname -n");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
text += QString("Hostname: %1<br>").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed());
|
|
||||||
// whoami
|
|
||||||
cmd = QString("whoami");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
text += QString("Whoami: %1<br>").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed());
|
|
||||||
// uptime
|
|
||||||
cmd = QString("uptime");
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd;
|
|
||||||
process = runTask(cmd);
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd returns" << process.exitCode;
|
|
||||||
if (process.exitCode != 0)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Error" << process.error;
|
|
||||||
text += QString("Uptime: %1").arg(QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed());
|
|
||||||
|
|
||||||
widget->sendNotification(QString("system"), text);
|
|
||||||
}
|
|
||||||
emit(QWidget::mousePressEvent(event));
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 CUSTOMLABEL_H
|
|
||||||
#define CUSTOMLABEL_H
|
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
|
|
||||||
class AwesomeWidget;
|
|
||||||
|
|
||||||
class CustomLabel : public QLabel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CustomLabel(AwesomeWidget *wid, const bool debugCmd = false);
|
|
||||||
~CustomLabel();
|
|
||||||
void setPopupEnabled(const bool state);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void mousePressEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
AwesomeWidget *widget;
|
|
||||||
bool debug;
|
|
||||||
bool enablePopup = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* CUSTOMLABEL_H */
|
|
@ -1,440 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>DEWindow</class>
|
|
||||||
<widget class="QWidget" name="DEWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>700</width>
|
|
||||||
<height>582</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">DE</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_dattaengine">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="contents_dattaengine">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>684</width>
|
|
||||||
<height>566</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="4" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_hddtempCmd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_hddtempCmd">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>hddtemp cmd</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_hddtempCmd"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_gpudev">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_gpudev">
|
|
||||||
<property name="text">
|
|
||||||
<string>GPU device</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_gpudev">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">auto</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">disable</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">nvidia</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">ati</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_hdddev">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_hdddev">
|
|
||||||
<property name="text">
|
|
||||||
<string>HDD</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_hdddev"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_playerSelect">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_playerSelect">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Music player</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_playerSelect">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">mpris</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">mpd</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_mpdport">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mpdport">
|
|
||||||
<property name="text">
|
|
||||||
<string>MPD port</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_mpdport">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>50000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>6600</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_mpdaddress">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mpdaddress">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>MPD address</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_mpdaddress"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0">
|
|
||||||
<spacer name="spacer_dataengine">
|
|
||||||
<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 row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_acpi">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_acpi">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>ACPI path</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="lineEdit_acpi">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>"/sys/class/power_supply/" by default</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="layout_mpris">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mprisInfo">
|
|
||||||
<property name="text">
|
|
||||||
<string><b>NOTE:</b> Player DBus interface should be an active</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_mprisSelect">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mpris">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>MPRIS player name</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_mpris">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">auto</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">amarok</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">audacious</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">clementine</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">deadbeef</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">vlc</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">qmmp</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">xmms2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="layout_custom">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_customAdd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_custom">
|
|
||||||
<property name="text">
|
|
||||||
<string>Custom scripts</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_custom">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_custom">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_custom">
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
|
||||||
<layout class="QVBoxLayout" name="layout_pkgCommand">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_pkgCommandAdd">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_pkgCommand">
|
|
||||||
<property name="text">
|
|
||||||
<string>Package manager</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_pkgCommand">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_pkgCommand">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_pkgCommand">
|
|
||||||
<property name="contextMenuPolicy">
|
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,606 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 "awesome-widget.h"
|
|
||||||
|
|
||||||
#include <QRegExp>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "graphicalitem.h"
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::connectToEngine()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
QRegExp regExp;
|
|
||||||
|
|
||||||
// battery
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)(ac|bat.*)"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("batteryTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
extsysmonEngine->connectSource(QString("battery"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// cpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)cpu(?!cl).*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("cpuTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->connectSource(QString("cpu/system/TotalLoad"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
for (int i=0; i<counts[QString("cpu")]; i++)
|
|
||||||
sysmonEngine->connectSource(QString("cpu/cpu") + QString::number(i) + QString("/TotalLoad"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// cpuclock
|
|
||||||
regExp = QRegExp(QString("cpucl.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("cpuclTooltip")].toInt() == 2)) {
|
|
||||||
sysmonEngine->connectSource(QString("cpu/system/AverageClock"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
for (int i=0; i<counts[QString("cpu")]; i++)
|
|
||||||
sysmonEngine->connectSource(QString("cpu/cpu") + QString::number(i) + QString("/clock"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// custom command
|
|
||||||
regExp = QRegExp(QString("custom.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("custom"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// desktop
|
|
||||||
regExp = QRegExp(QString(".*desktop.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("desktop"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// disk speed
|
|
||||||
regExp = QRegExp(QString("hdd[rw].*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("disk")].split(QString("@@")).count(); i++) {
|
|
||||||
sysmonEngine->connectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/rblk"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/wblk"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// fan
|
|
||||||
regExp = QRegExp(QString("fan.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("fanDevice")].split(QString("@@")).count(); i++)
|
|
||||||
sysmonEngine->connectSource(configuration[QString("fanDevice")].split(QString("@@"))[i],
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// gpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)gpu"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
extsysmonEngine->connectSource(QString("gpu"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// gputemp
|
|
||||||
regExp = QRegExp(QString("gputemp"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("gputemp"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// mount
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb).*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
for (int i=0; i<configuration[QString("mount")].split(QString("@@")).count(); i++) {
|
|
||||||
sysmonEngine->connectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/filllevel"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/freespace"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/usedspace"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// hddtemp
|
|
||||||
regExp = QRegExp(QString("hddtemp.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("hddtemp"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// memory
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)mem.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("memTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->connectSource(QString("mem/physical/free"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("mem/physical/used"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("mem/physical/application"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// network
|
|
||||||
networkDeviceUpdate = 0;
|
|
||||||
regExp = QRegExp(QString("(down|up|netdev)"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("downTooltip")].toInt() == 2)) {
|
|
||||||
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// package manager
|
|
||||||
regExp = QRegExp(QString("pkgcount.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("pkg"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// player
|
|
||||||
regExp = QRegExp(QString("(album|artist|duration|progress|title)"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("player"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// ps
|
|
||||||
regExp = QRegExp(QString("ps.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->connectSource(QString("ps"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// swap
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)swap.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("swapTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->connectSource(QString("mem/swap/free"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("mem/swap/used"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
// temp
|
|
||||||
regExp = QRegExp(QString("temp.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("tempDevice")].split(QString("@@")).count(); i++)
|
|
||||||
sysmonEngine->connectSource(configuration[QString("tempDevice")].split(QString("@@"))[i],
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
// time
|
|
||||||
regExp = QRegExp(QString("(^|iso|short|long|c)time"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
timeEngine->connectSource(QString("Local"),
|
|
||||||
this, 1000);
|
|
||||||
// uptime
|
|
||||||
regExp = QRegExp(QString("(^|c)uptime"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
sysmonEngine->connectSource(QString("system/uptime"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName;
|
|
||||||
|
|
||||||
// regular expressions
|
|
||||||
QRegExp cpuRegExp = QRegExp(QString("cpu/cpu.*/TotalLoad"));
|
|
||||||
QRegExp cpuclRegExp = QRegExp(QString("cpu/cpu.*/clock"));
|
|
||||||
QRegExp hddrRegExp = QRegExp(QString("disk/.*/Rate/rblk"));
|
|
||||||
QRegExp hddwRegExp = QRegExp(QString("disk/.*/Rate/wblk"));
|
|
||||||
QRegExp mountFillRegExp = QRegExp(QString("partitions/.*/filllevel"));
|
|
||||||
QRegExp mountFreeRegExp = QRegExp(QString("partitions/.*/freespace"));
|
|
||||||
QRegExp mountUsedRegExp = QRegExp(QString("partitions/.*/usedspace"));
|
|
||||||
QRegExp netRecRegExp = QRegExp(QString("network/interfaces/.*/receiver/data"));
|
|
||||||
QRegExp netTransRegExp = QRegExp(QString("network/interfaces/.*/transmitter/data"));
|
|
||||||
QRegExp tempRegExp = QRegExp(QString("lmsensors/.*"));
|
|
||||||
|
|
||||||
if (data.keys().isEmpty()) return;
|
|
||||||
if (sourceName == QString("battery")) {
|
|
||||||
for (int i=0; i<data.keys().count(); i++) {
|
|
||||||
if (data.keys()[i] == QString("ac")) {
|
|
||||||
if (data[QString("ac")].toBool())
|
|
||||||
values[QString("ac")] = configuration[QString("acOnline")];
|
|
||||||
else
|
|
||||||
values[QString("ac")] = configuration[QString("acOffline")];
|
|
||||||
} else {
|
|
||||||
values[data.keys()[i]] = QString("%1").arg(data[data.keys()[i]].toFloat(), 3, 'f', 0);
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*bat"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != data.keys()[i]) continue;
|
|
||||||
values[foundBars[j]] = values[data.keys()[i]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((configuration[QString("batteryTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(data[QString("bat")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("bat")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("bat")].takeFirst();
|
|
||||||
if (data[QString("ac")].toBool())
|
|
||||||
tooltipValues[QString("bat")].append(data[QString("bat")].toFloat());
|
|
||||||
else
|
|
||||||
tooltipValues[QString("bat")].append(-data[QString("bat")].toFloat());
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("cpu/system/TotalLoad")) {
|
|
||||||
values[QString("cpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != QString("cpu")) continue;
|
|
||||||
values[foundBars[j]] = QString("%1").arg(data[QString("value")].toFloat());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((configuration[QString("cpuTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(data[QString("value")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("cpu")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("cpu")].takeFirst();
|
|
||||||
tooltipValues[QString("cpu")].append(data[QString("value")].toFloat());
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(cpuRegExp)) {
|
|
||||||
QString number = sourceName;
|
|
||||||
number.remove(QString("cpu/cpu"));
|
|
||||||
number.remove(QString("/TotalLoad"));
|
|
||||||
values[QString("cpu") + number] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*cpu(?!cl).*"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != (QString("cpu") + number)) continue;
|
|
||||||
values[foundBars[j]] = values[QString("cpu") + number];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("cpu/system/AverageClock")) {
|
|
||||||
values[QString("cpucl")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
|
||||||
if ((configuration[QString("cpuclTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(data[QString("value")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("cpucl")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("cpucl")].takeFirst();
|
|
||||||
tooltipValues[QString("cpucl")].append(data[QString("value")].toFloat());
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(cpuclRegExp)) {
|
|
||||||
QString number = sourceName;
|
|
||||||
number.remove(QString("cpu/cpu"));
|
|
||||||
number.remove(QString("/clock"));
|
|
||||||
values[QString("cpucl") + number] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
|
||||||
} else if (sourceName == QString("custom")) {
|
|
||||||
for (int i=0; i<data.keys().count(); i++)
|
|
||||||
values[data.keys()[i]] = data[data.keys()[i]].toString();
|
|
||||||
} else if (sourceName == QString("desktop")) {
|
|
||||||
values[QString("desktop")] = data[QString("currentName")].toString();
|
|
||||||
values[QString("ndesktop")] = QString("%1").arg(data[QString("currentNumber")].toInt());
|
|
||||||
values[QString("tdesktops")] = QString("%1").arg(data[QString("number")].toInt());
|
|
||||||
} else if (sourceName.contains(hddrRegExp)) {
|
|
||||||
QString device = sourceName;
|
|
||||||
device.remove(QString("/Rate/rblk"));
|
|
||||||
for (int i=0; i<counts[QString("disk")]; i++)
|
|
||||||
if (configuration[QString("disk")].split(QString("@@"))[i] == device) {
|
|
||||||
values[QString("hddr") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(hddwRegExp)) {
|
|
||||||
QString device = sourceName;
|
|
||||||
device.remove(QString("/Rate/wblk"));
|
|
||||||
for (int i=0; i<counts[QString("disk")]; i++)
|
|
||||||
if (configuration[QString("disk")].split(QString("@@"))[i] == device) {
|
|
||||||
values[QString("hddw") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("gpu")) {
|
|
||||||
values[QString("gpu")] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*gpu"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != QString("gpu")) continue;
|
|
||||||
values[foundBars[j]] = values[QString("gpu")];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("gputemp")) {
|
|
||||||
values[QString("gputemp")] = QString("%1").arg(getTemp(data[QString("value")].toFloat()), 4, 'f', 1);
|
|
||||||
} else if (sourceName.contains(mountFillRegExp)) {
|
|
||||||
QString mount = sourceName;
|
|
||||||
mount.remove(QString("partitions"));
|
|
||||||
mount.remove(QString("/filllevel"));
|
|
||||||
for (int i=0; i<counts[QString("mount")]; i++)
|
|
||||||
if (configuration[QString("mount")].split(QString("@@"))[i] == mount) {
|
|
||||||
values[QString("hdd") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 5, 'f', 1);
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*hdd([0-9].*"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != (QString("hdd") + QString::number(i))) continue;
|
|
||||||
values[foundBars[j]] = values[QString("hdd") + QString::number(i)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(mountFreeRegExp)) {
|
|
||||||
QString mount = sourceName;
|
|
||||||
mount.remove(QString("partitions"));
|
|
||||||
mount.remove(QString("/freespace"));
|
|
||||||
for (int i=0; i<counts[QString("mount")]; i++)
|
|
||||||
if (configuration[QString("mount")].split(QString("@@"))[i] == mount) {
|
|
||||||
values[QString("hddfreemb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("hddfreegb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(mountUsedRegExp)) {
|
|
||||||
QString mount = sourceName;
|
|
||||||
mount.remove(QString("partitions"));
|
|
||||||
mount.remove(QString("/usedspace"));
|
|
||||||
for (int i=0; i<counts[QString("mount")]; i++)
|
|
||||||
if (configuration[QString("mount")].split(QString("@@"))[i] == mount) {
|
|
||||||
values[QString("hddmb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("hddgb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
|
||||||
// total
|
|
||||||
values[QString("hddtotmb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
values[QString("hddfreemb") + QString::number(i)].toInt() +
|
|
||||||
values[QString("hddmb") + QString::number(i)].toInt());
|
|
||||||
values[QString("hddtotgb") + QString::number(i)] = QString("%1").arg(
|
|
||||||
values[QString("hddfreegb") + QString::number(i)].toFloat() +
|
|
||||||
values[QString("hddgb") + QString::number(i)].toFloat(),
|
|
||||||
5, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("hddtemp")) {
|
|
||||||
for (int i=0; i<data.keys().count(); i++)
|
|
||||||
for (int j=0; j<counts[QString("hddtemp")]; j++)
|
|
||||||
if (data.keys()[i] == configuration[QString("hdd")].split(QString("@@"))[j]) {
|
|
||||||
values[QString("hddtemp") + QString::number(j)] = QString("%1").arg(getTemp(data[data.keys()[i]].toFloat()), 4, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("mem/physical/application")) {
|
|
||||||
values[QString("memmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("memgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
|
|
||||||
} else if (sourceName == QString("mem/physical/free")) {
|
|
||||||
values[QString("memfreemb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("memfreegb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
|
||||||
} else if (sourceName == QString("mem/physical/used")) {
|
|
||||||
values[QString("memusedmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 0, 'f', 0);
|
|
||||||
values[QString("memusedgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
|
||||||
// total
|
|
||||||
values[QString("memtotmb")] = QString("%1").arg(
|
|
||||||
values[QString("memusedmb")].toInt() + values[QString("memfreemb")].toInt(), 5);
|
|
||||||
values[QString("memtotgb")] = QString("%1").arg(
|
|
||||||
values[QString("memusedgb")].toFloat() + values[QString("memfreegb")].toFloat(),
|
|
||||||
4, 'f', 1);
|
|
||||||
// percentage
|
|
||||||
values[QString("mem")] = QString("%1").arg(100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat(),
|
|
||||||
5, 'f', 1);
|
|
||||||
if ((configuration[QString("memTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(values[QString("mem")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("mem")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("mem")].takeFirst();
|
|
||||||
tooltipValues[QString("mem")].append(values[QString("mem")].toFloat());
|
|
||||||
}
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*mem"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != QString("mem")) continue;
|
|
||||||
values[foundBars[j]] = values[QString("mem")];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(netRecRegExp)) {
|
|
||||||
values[QString("down")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
|
||||||
if ((configuration[QString("downTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(data[QString("value")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("down")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("down")].takeFirst();
|
|
||||||
tooltipValues[QString("down")].append(data[QString("value")].toFloat());
|
|
||||||
}
|
|
||||||
networkDeviceUpdate++;
|
|
||||||
if (networkDeviceUpdate >= 30) {
|
|
||||||
networkDeviceUpdate = 0;
|
|
||||||
if (configuration[QString("useCustomNetdev")].toInt() == 0) {
|
|
||||||
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this);
|
|
||||||
updateNetworkDevice(false);
|
|
||||||
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
sysmonEngine->connectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"),
|
|
||||||
this, configuration[QString("interval")].toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(netTransRegExp)) {
|
|
||||||
values[QString("up")] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 0);
|
|
||||||
if ((configuration[QString("downTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(data[QString("value")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("up")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("up")].takeFirst();
|
|
||||||
tooltipValues[QString("up")].append(data[QString("value")].toFloat());
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("pkg")) {
|
|
||||||
for (int i=0; i<data.keys().count(); i++)
|
|
||||||
values[data.keys()[i].toLower()] = QString("%1").arg(data[data.keys()[i]].toInt(), 2);
|
|
||||||
} else if (sourceName == QString("player")) {
|
|
||||||
values[QString("album")] = data[QString("album")].toString();
|
|
||||||
values[QString("artist")] = data[QString("artist")].toString();
|
|
||||||
values[QString("duration")] = data[QString("duration")].toString();
|
|
||||||
values[QString("progress")] = data[QString("progress")].toString();
|
|
||||||
values[QString("title")] = data[QString("title")].toString();
|
|
||||||
} else if (sourceName == QString("ps")) {
|
|
||||||
values[QString("ps")] = data[QString("ps")].toString();
|
|
||||||
values[QString("pscount")] = QString("%1").arg(data[QString("psCount")].toInt(), 2);
|
|
||||||
values[QString("pstotal")] = QString("%1").arg(data[QString("psTotal")].toInt(), 3);
|
|
||||||
} else if (sourceName == QString("mem/swap/free")) {
|
|
||||||
values[QString("swapfreemb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("swapfreegb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
|
||||||
} else if (sourceName == QString("mem/swap/used")) {
|
|
||||||
values[QString("swapmb")] = QString("%1").arg(data[QString("value")].toFloat() / 1024.0, 5, 'f', 0);
|
|
||||||
values[QString("swapgb")] = QString("%1").arg(data[QString("value")].toFloat() / (1024.0 * 1024.0), 4, 'f', 1);
|
|
||||||
// total
|
|
||||||
values[QString("swaptotmb")] = QString("%1").arg(
|
|
||||||
values[QString("swapmb")].toInt() + values[QString("swapfreemb")].toInt(), 5);
|
|
||||||
values[QString("swaptotgb")] = QString("%1").arg(
|
|
||||||
values[QString("swapgb")].toFloat() + values[QString("swapfreegb")].toFloat(), 4, 'f', 1);
|
|
||||||
// percentage
|
|
||||||
values[QString("swap")] = QString("%1").arg(100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat(),
|
|
||||||
5, 'f', 1);
|
|
||||||
if ((configuration[QString("swapTooltip")].toInt() == 2) &&
|
|
||||||
(!isnan(values[QString("swap")].toFloat()))) {
|
|
||||||
if (tooltipValues[QString("swap")].count() > configuration[QString("tooltipNumber")].toInt())
|
|
||||||
tooltipValues[QString("swap")].takeFirst();
|
|
||||||
tooltipValues[QString("swap")].append(values[QString("swap")].toFloat());
|
|
||||||
}
|
|
||||||
if (foundBars.indexOf(QRegExp(QString("bar[0-9].*swap"))) > -1) {
|
|
||||||
for (int j=0; j<foundBars.count(); j++) {
|
|
||||||
if (getItemByTag(foundBars[j])->bar() != QString("swap")) continue;
|
|
||||||
values[foundBars[j]] = values[QString("swap")];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName.contains(tempRegExp)) {
|
|
||||||
if (data[QString("units")].toString() == QString("rpm")) {
|
|
||||||
for (int i=0; i<counts[QString("fan")]; i++)
|
|
||||||
if (sourceName == configuration[QString("fanDevice")].split(QString("@@"))[i]) {
|
|
||||||
values[QString("fan") + QString::number(i)] = QString("%1").arg(data[QString("value")].toFloat(), 4, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i=0; i<counts[QString("temp")]; i++)
|
|
||||||
if (sourceName == configuration[QString("tempDevice")].split(QString("@@"))[i]) {
|
|
||||||
values[QString("temp") + QString::number(i)] = QString("%1").arg(getTemp(data[QString("value")].toFloat()), 4, 'f', 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (sourceName == QString("Local")) {
|
|
||||||
values[QString("time")] = data[QString("DateTime")].toDateTime().toString(Qt::TextDate);
|
|
||||||
values[QString("isotime")] = data[QString("DateTime")].toDateTime().toString(Qt::ISODate);
|
|
||||||
values[QString("shorttime")] = data[QString("DateTime")].toDateTime().toString(Qt::SystemLocaleShortDate);
|
|
||||||
values[QString("longtime")] = data[QString("DateTime")].toDateTime().toString(Qt::SystemLocaleLongDate);
|
|
||||||
QStringList timeKeys = getTimeKeys();
|
|
||||||
values[QString("ctime")] = configuration[QString("customTime")];
|
|
||||||
for (int i=0; i<timeKeys.count(); i++)
|
|
||||||
values[QString("ctime")].replace(QString("$") + timeKeys[i],
|
|
||||||
data[QString("DateTime")].toDateTime().toString(timeKeys[i]));
|
|
||||||
} else if (sourceName == QString("system/uptime")) {
|
|
||||||
int uptime = data[QString("value")].toFloat();
|
|
||||||
int seconds = uptime - uptime % 60;
|
|
||||||
int minutes = seconds / 60 % 60;
|
|
||||||
int hours = ((seconds / 60) - minutes) / 60 % 24;
|
|
||||||
int days = (((seconds / 60) - minutes) / 60 - hours) / 24;
|
|
||||||
values[QString("uptime")] = QString("%1d%2h%3m").arg(days, 3).arg(hours, 2).arg(minutes, 2);
|
|
||||||
values[QString("cuptime")] = configuration[QString("customUptime")];
|
|
||||||
values[QString("cuptime")].replace(QString("$dd"), QString("%1").arg(days, 3, 10, QChar('0')));
|
|
||||||
values[QString("cuptime")].replace(QString("$d"), QString("%1").arg(days));
|
|
||||||
values[QString("cuptime")].replace(QString("$hh"), QString("%1").arg(hours, 2, 10, QChar('0')));
|
|
||||||
values[QString("cuptime")].replace(QString("$h"), QString("%1").arg(hours));
|
|
||||||
values[QString("cuptime")].replace(QString("$mm"), QString("%1").arg(minutes, 2, 10, QChar('0')));
|
|
||||||
values[QString("cuptime")].replace(QString("$m"), QString("%1").arg(minutes));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::disconnectFromEngine()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
QRegExp regExp;
|
|
||||||
|
|
||||||
// battery
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)(ac|bat.*)"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("batteryTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
extsysmonEngine->disconnectSource(QString("battery"), this);
|
|
||||||
// cpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)cpu(?!cl).*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("cpuTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->disconnectSource(QString("cpu/system/TotalLoad"), this);
|
|
||||||
for (int i=0; i<counts[QString("cpu")]; i++)
|
|
||||||
sysmonEngine->disconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/TotalLoad"), this);
|
|
||||||
}
|
|
||||||
// cpuclock
|
|
||||||
regExp = QRegExp(QString("cpucl.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("cpuclTooltip")].toInt() == 2)) {
|
|
||||||
sysmonEngine->disconnectSource(QString("cpu/system/AverageClock"), this);
|
|
||||||
for (int i=0; i<counts[QString("cpu")]; i++)
|
|
||||||
sysmonEngine->disconnectSource(QString("cpu/cpu") + QString::number(i) + QString("/clock"), this);
|
|
||||||
}
|
|
||||||
// custom command
|
|
||||||
regExp = QRegExp(QString("custom.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("custom"), this);
|
|
||||||
// desktop
|
|
||||||
regExp = QRegExp(QString(".*desktop.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("desktop"), this);
|
|
||||||
// disk speed
|
|
||||||
regExp = QRegExp(QString("hdd[rw].*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("disk")].split(QString("@@")).count(); i++) {
|
|
||||||
sysmonEngine->disconnectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/rblk"), this);
|
|
||||||
sysmonEngine->disconnectSource(configuration[QString("disk")].split(QString("@@"))[i] + QString("/Rate/wblk"), this);
|
|
||||||
}
|
|
||||||
// fan
|
|
||||||
regExp = QRegExp(QString("fan.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("fanDevice")].split(QString("@@")).count(); i++)
|
|
||||||
sysmonEngine->disconnectSource(configuration[QString("fanDevice")].split(QString("@@"))[i], this);
|
|
||||||
// gpu
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)gpu"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
extsysmonEngine->disconnectSource(QString("gpu"), this);
|
|
||||||
// gputemp
|
|
||||||
regExp = QRegExp(QString("gputemp"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("gputemp"), this);
|
|
||||||
// mount
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb).*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1))
|
|
||||||
for (int i=0; i<configuration[QString("mount")].split(QString("@@")).count(); i++) {
|
|
||||||
sysmonEngine->disconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/filllevel"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/freespace"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("partitions") + configuration[QString("mount")].split(QString("@@"))[i] + QString("/usedspace"), this);
|
|
||||||
}
|
|
||||||
// hddtemp
|
|
||||||
regExp = QRegExp(QString("hddtemp.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("hddtemp"), this);
|
|
||||||
// memory
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)mem.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("memTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->disconnectSource(QString("mem/physical/free"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("mem/physical/used"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("mem/physical/application"), this);
|
|
||||||
}
|
|
||||||
// network
|
|
||||||
regExp = QRegExp(QString("(down|up|netdev)"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("downTooltip")].toInt() == 2)) {
|
|
||||||
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/transmitter/data"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("network/interfaces/") + values[QString("netdev")] + QString("/receiver/data"), this);
|
|
||||||
}
|
|
||||||
// package manager
|
|
||||||
regExp = QRegExp(QString("pkgcount.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("pkg"), this);
|
|
||||||
// player
|
|
||||||
regExp = QRegExp(QString("(album|artist|duration|progress|title)"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("player"), this);
|
|
||||||
// ps
|
|
||||||
regExp = QRegExp(QString("ps.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
extsysmonEngine->disconnectSource(QString("ps"), this);
|
|
||||||
// swap
|
|
||||||
regExp = QRegExp(QString("(^|bar[0-9].*)swap.*"));
|
|
||||||
if ((foundKeys.indexOf(regExp) > -1) ||
|
|
||||||
(configuration[QString("swapTooltip")].toInt() == 2) ||
|
|
||||||
(foundBars.indexOf(regExp) > -1)) {
|
|
||||||
sysmonEngine->disconnectSource(QString("mem/swap/free"), this);
|
|
||||||
sysmonEngine->disconnectSource(QString("mem/swap/used"), this);
|
|
||||||
}
|
|
||||||
// temp
|
|
||||||
regExp = QRegExp(QString("temp.*"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
for (int i=0; i<configuration[QString("tempDevice")].split(QString("@@")).count(); i++)
|
|
||||||
sysmonEngine->disconnectSource(configuration[QString("tempDevice")].split(QString("@@"))[i], this);
|
|
||||||
// time
|
|
||||||
regExp = QRegExp(QString("(^|iso|short|long|c)time"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
timeEngine->disconnectSource(QString("Local"), this);
|
|
||||||
// uptime
|
|
||||||
regExp = QRegExp(QString("(^|c)uptime"));
|
|
||||||
if (foundKeys.indexOf(regExp) > -1)
|
|
||||||
sysmonEngine->disconnectSource(QString("system/uptime"), this);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
# name should be barN and uniq
|
|
||||||
Name=bar100500
|
|
||||||
Comment=Template for the AW bars
|
|
||||||
# value to show. Supported types are
|
|
||||||
# cpu, cpu[0-9], mem, swap, bat
|
|
||||||
X-AW-Value=cpu
|
|
||||||
# active color, RGBA
|
|
||||||
# you should use double quotes
|
|
||||||
X-AW-ActiveColor="0,0,0,255"
|
|
||||||
# inactive color, RGBA
|
|
||||||
# you should use double quotes
|
|
||||||
X-AW-InactiveColor="255,255,255,255"
|
|
||||||
# bar type. Supported types are
|
|
||||||
# Horizontal, Vertical, Circle
|
|
||||||
X-AW-Type=Horizontal
|
|
||||||
# direction. LeftToRight or RightToLeft
|
|
||||||
X-AW-Direction=LeftToRight
|
|
||||||
# height in pixels
|
|
||||||
X-AW-Height=25
|
|
||||||
# width in pixels
|
|
||||||
X-AW-Width=100
|
|
||||||
# API version
|
|
||||||
X-AW-ApiVersion=1
|
|
@ -1,523 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 <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 = QPixmap::grabWidget(view).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(m_dirs[i] + QDir::separator() + 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::tryDelete()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
for (int i=0; i<m_dirs.count(); i++)
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << m_dirs[i] + QDir::separator() + m_fileName <<
|
|
||||||
QFile::remove(m_dirs[i] + QDir::separator() + m_fileName);
|
|
||||||
|
|
||||||
// check if exists
|
|
||||||
for (int i=0; i<m_dirs.count(); i++)
|
|
||||||
if (QFile::exists(m_dirs[i] + QDir::separator() + m_fileName)) return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GraphicalItem::writeConfiguration()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QSettings settings(m_dirs[0] + QDir::separator() + 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(((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;
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
[Global]
|
|
||||||
IconName=system
|
|
||||||
Name=Awesome Widget
|
|
||||||
Comment=Awesome widget information
|
|
||||||
|
|
||||||
[Event/system]
|
|
||||||
Name=System information
|
|
||||||
Comment=System information
|
|
||||||
Action=Popup
|
|
||||||
|
|
||||||
[Event/tag]
|
|
||||||
Name=Tag information
|
|
||||||
Comment=Tag information
|
|
||||||
Action=Popup
|
|
@ -1,166 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 "awesome-widget.h"
|
|
||||||
|
|
||||||
#include <KNotification>
|
|
||||||
#include <Plasma/ToolTipManager>
|
|
||||||
#include <QGraphicsGridLayout>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
#include "customlabel.h"
|
|
||||||
#include "graphicalitem.h"
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::reinit()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (configuration[QString("background")].toInt() == 0)
|
|
||||||
setBackgroundHints(NoBackground);
|
|
||||||
if (configuration[QString("popup")].toInt() == 0)
|
|
||||||
textLabel->setPopupEnabled(false);
|
|
||||||
else
|
|
||||||
textLabel->setPopupEnabled(true);
|
|
||||||
updateText(true);
|
|
||||||
|
|
||||||
keys = getKeys();
|
|
||||||
foundKeys = findKeys();
|
|
||||||
getGraphicalItems();
|
|
||||||
foundBars = findGraphicalItems();
|
|
||||||
updateNetworkDevice(false);
|
|
||||||
connectToEngine();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::sendNotification(const QString eventId, const QString message)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Event" << eventId;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Message" << message;
|
|
||||||
|
|
||||||
KNotification *notification = new KNotification(eventId);
|
|
||||||
notification->setComponentData(KComponentData("plasma_applet_awesome-widget"));
|
|
||||||
notification->setTitle(QString("Awesome Widget ::: ") + eventId);
|
|
||||||
notification->setText(message);
|
|
||||||
notification->sendEvent();
|
|
||||||
delete notification;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::updateNetworkDevice(const bool delay)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
if (delay)
|
|
||||||
networkDeviceUpdate = 30;
|
|
||||||
else
|
|
||||||
values[QString("netdev")] = getNetworkDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::updateText(const bool clear)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString text = configuration[QString("text")];
|
|
||||||
if (!clear) {
|
|
||||||
text.replace(QString("$$"), QString("$\\$\\"));
|
|
||||||
for (int i=0; i<foundKeys.count(); i++)
|
|
||||||
text.replace(QString("$") + foundKeys[i], values[foundKeys[i]]);
|
|
||||||
for (int i=0; i<foundBars.count(); i++)
|
|
||||||
text.replace(QString("$") + foundBars[i], getItemByTag(foundBars[i])->image(values[foundBars[i]].toFloat()));
|
|
||||||
text.replace(QString("$\\$\\"), QString("$$"));
|
|
||||||
}
|
|
||||||
textLabel->setText(formatLine[0] + text + formatLine[1]);
|
|
||||||
mainLayout->itemAt(0, 0)->updateGeometry();
|
|
||||||
updateGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void AwesomeWidget::updateTooltip()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
toolTipView->resize(100.0 * counts[QString("tooltip")], 105.0);
|
|
||||||
// boundaries
|
|
||||||
QMap<QString, float> boundaries;
|
|
||||||
boundaries[QString("cpu")] = 100.0;
|
|
||||||
boundaries[QString("cpucl")] = 4000.0;
|
|
||||||
boundaries[QString("mem")] = 100.0;
|
|
||||||
boundaries[QString("swap")] = 100.0;
|
|
||||||
boundaries[QString("down")] = 1.0;
|
|
||||||
if (configuration[QString("downTooltip")].toInt() == 2) {
|
|
||||||
for (int i=0; i<tooltipValues[QString("down")].count(); i++)
|
|
||||||
if (boundaries[QString("down")] < tooltipValues[QString("down")][i])
|
|
||||||
boundaries[QString("down")] = tooltipValues[QString("down")][i];
|
|
||||||
for (int i=0; i<tooltipValues[QString("up")].count(); i++)
|
|
||||||
if (boundaries[QString("down")] < tooltipValues[QString("up")][i])
|
|
||||||
boundaries[QString("down")] = tooltipValues[QString("up")][i];
|
|
||||||
boundaries[QString("down")] *= 1.2;
|
|
||||||
}
|
|
||||||
boundaries[QString("up")] = boundaries[QString("down")];
|
|
||||||
boundaries[QString("bat")] = 100.0;
|
|
||||||
|
|
||||||
// create image
|
|
||||||
toolTipScene->clear();
|
|
||||||
QPen pen = QPen();
|
|
||||||
if (configuration[QString("useTooltipBackground")].toInt() == 2)
|
|
||||||
toolTipScene->setBackgroundBrush(QColor(configuration[QString("tooltipBackground")]));
|
|
||||||
else
|
|
||||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
|
||||||
bool down = false;
|
|
||||||
bool isBattery = false;
|
|
||||||
QStringList trueKeys;
|
|
||||||
if (tooltipValues.contains(QString("cpu"))) trueKeys.append(QString("cpu"));
|
|
||||||
if (tooltipValues.contains(QString("cpucl"))) trueKeys.append(QString("cpucl"));
|
|
||||||
if (tooltipValues.contains(QString("mem"))) trueKeys.append(QString("mem"));
|
|
||||||
if (tooltipValues.contains(QString("swap"))) trueKeys.append(QString("swap"));
|
|
||||||
if (tooltipValues.contains(QString("down"))) trueKeys.append(QString("down"));
|
|
||||||
if (tooltipValues.contains(QString("up"))) trueKeys.append(QString("up"));
|
|
||||||
if (tooltipValues.contains(QString("bat"))) trueKeys.append(QString("bat"));
|
|
||||||
for (int i=0; i<trueKeys.count(); i++) {
|
|
||||||
float normX = 100.0 / (float)tooltipValues[trueKeys[i]].count();
|
|
||||||
float normY = 100.0 / (1.5 * boundaries[trueKeys[i]]);
|
|
||||||
if (trueKeys[i] == QString("bat"))
|
|
||||||
isBattery = true;
|
|
||||||
else
|
|
||||||
isBattery = false;
|
|
||||||
if (!isBattery) pen.setColor(QColor(configuration[trueKeys[i] + QString("Color")]));
|
|
||||||
float shift = i * 100.0;
|
|
||||||
if (down) shift -= 100.0;
|
|
||||||
for (int j=0; j<tooltipValues[trueKeys[i]].count()-1; j++) {
|
|
||||||
float x1 = j * normX + shift;
|
|
||||||
float y1 = - fabs(tooltipValues[trueKeys[i]][j]) * normY + 5.0;
|
|
||||||
float x2 = (j + 1) * normX + shift;
|
|
||||||
float y2 = - fabs(tooltipValues[trueKeys[i]][j+1]) * normY + 5.0;
|
|
||||||
if (isBattery) {
|
|
||||||
if (tooltipValues[trueKeys[i]][j+1] > 0)
|
|
||||||
pen.setColor(QColor(configuration[QString("batteryColor")]));
|
|
||||||
else
|
|
||||||
pen.setColor(QColor(configuration[QString("batteryInColor")]));
|
|
||||||
}
|
|
||||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
|
||||||
}
|
|
||||||
if (trueKeys[i] == QString("down")) down = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
toolTip.setImage(QPixmap::grabWidget(toolTipView));
|
|
||||||
Plasma::ToolTipManager::self()->setContent(this, toolTip);
|
|
||||||
}
|
|
@ -1,295 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>TooltipWindow</class>
|
|
||||||
<widget class="QWidget" name="TooltipWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>700</width>
|
|
||||||
<height>594</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Tooltip</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tooltip">
|
|
||||||
<property name="text">
|
|
||||||
<string>CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox fully checked.</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QScrollArea" name="scrollArea_tooltip">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="contents_tooltip">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>684</width>
|
|
||||||
<height>542</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_tooltipNum">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tooltipNum">
|
|
||||||
<property name="text">
|
|
||||||
<string>Number of values for tooltips</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_tooltipNum">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>50</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>1000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>25</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_background">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_background">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Background</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_background"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_cpuColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_cpu">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>CPU color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_cpu"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_cpuclockColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_cpuclock">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>CPU clock color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_cpuclock"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_memColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_mem">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Memory color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_mem"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_swapColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_swap">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Swap color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_swap"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_downColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_down">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Download speed color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_down"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_upColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_up">
|
|
||||||
<property name="text">
|
|
||||||
<string>Upload speed color</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_up"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_batteryColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_battery">
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Battery active color</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_battery"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_batteryInColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_batteryIn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Battery inactive color</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_batteryIn"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_tooltip">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>289</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KColorCombo</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>kcolorcombo.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,228 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ConfigWindow</class>
|
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>700</width>
|
|
||||||
<height>600</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>600</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Widget</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Detailed information may be found on <a href="http://arcanis.name/projects/awesome-widgets/">project homepage</a></string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layput_mainFormating">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_font">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_br">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="stock_text_indent">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter1">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_bold">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-bold">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+B</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_italic">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-italic">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+I</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_underline">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-underline">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+U</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_strike">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-strikethrough">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_left">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-left">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_center">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-center">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_right">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-right">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_fill">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-fill">
|
|
||||||
<normaloff/>
|
|
||||||
</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_tags">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_tags">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTextEdit" name="textEdit_elements">
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,12 +0,0 @@
|
|||||||
[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
|
|
@ -1,12 +0,0 @@
|
|||||||
[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
|
|
@ -1,12 +0,0 @@
|
|||||||
[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
|
|
@ -1,12 +0,0 @@
|
|||||||
[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
|
|
@ -1,25 +0,0 @@
|
|||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
# name should be barN and uniq
|
|
||||||
Name=bar100500
|
|
||||||
Comment=Template for the AW bars
|
|
||||||
# value to show. Supported types are
|
|
||||||
# cpu, cpu[0-9], mem, swap, bat
|
|
||||||
X-AW-Value=cpu
|
|
||||||
# active color, RGBA
|
|
||||||
# you should use double quotes
|
|
||||||
X-AW-ActiveColor="0,0,0,255"
|
|
||||||
# inactive color, RGBA
|
|
||||||
# you should use double quotes
|
|
||||||
X-AW-InactiveColor="255,255,255,255"
|
|
||||||
# bar type. Supported types are
|
|
||||||
# Horizontal, Vertical, Circle
|
|
||||||
X-AW-Type=Horizontal
|
|
||||||
# direction. LeftToRight or RightToLeft
|
|
||||||
X-AW-Direction=LeftToRight
|
|
||||||
# height in pixels
|
|
||||||
X-AW-Height=25
|
|
||||||
# width in pixels
|
|
||||||
X-AW-Width=100
|
|
||||||
# API version
|
|
||||||
X-AW-ApiVersion=1
|
|
@ -1,115 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 = 0, 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());
|
|
||||||
int 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 */
|
|
@ -1,3 +0,0 @@
|
|||||||
module org.kde.plasma.private.awesomewidget
|
|
||||||
|
|
||||||
plugin awplugin
|
|
@ -2,6 +2,9 @@
|
|||||||
set (SUBPROJECT plasma_applet_awesome-widget)
|
set (SUBPROJECT plasma_applet_awesome-widget)
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
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)
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
@ -14,9 +14,18 @@
|
|||||||
|
|
||||||
<group name="Advanced">
|
<group name="Advanced">
|
||||||
<!-- 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">
|
<entry name="notify" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="wrapNewLines" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
<entry name="background" type="bool">
|
<entry name="background" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
|||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -34,7 +34,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.TabView {
|
QtControls.TabView {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -48,6 +48,12 @@ Item {
|
|||||||
text: AWActions.getAboutText("header")
|
text: AWActions.getAboutText("header")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: AWActions.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
@ -62,9 +68,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
font.capitalization: Font.SmallCaps
|
font.capitalization: Font.SmallCaps
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: AWActions.getAboutText("copy")
|
text: AWActions.getAboutText("copy")
|
||||||
}
|
}
|
||||||
@ -83,8 +91,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: AWActions.getAboutText("3rdparty")
|
text: AWActions.getAboutText("3rdparty")
|
||||||
}
|
}
|
@ -17,9 +17,8 @@
|
|||||||
|
|
||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -30,35 +29,11 @@ Item {
|
|||||||
implicitHeight: pageColumn.implicitHeight
|
implicitHeight: pageColumn.implicitHeight
|
||||||
|
|
||||||
property bool debug: AWKeys.isDebugEnabled()
|
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_height: widgetHeight.value
|
||||||
|
property alias cfg_width: widgetWidth.value
|
||||||
property alias cfg_notify: notify.checked
|
property alias cfg_notify: notify.checked
|
||||||
|
property alias cfg_wrapNewLines: wrapNewLines.checked
|
||||||
property alias cfg_background: background.checked
|
property alias cfg_background: background.checked
|
||||||
property alias cfg_customTime: customTime.text
|
property alias cfg_customTime: customTime.text
|
||||||
property alias cfg_customUptime: customUptime.text
|
property alias cfg_customUptime: customUptime.text
|
||||||
@ -69,7 +44,47 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
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 {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -84,6 +99,20 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -220,71 +249,9 @@ Item {
|
|||||||
text: plasmoid.configuration.acOffline
|
text: plasmoid.configuration.acOffline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
|
||||||
height: implicitHeight
|
|
||||||
width: parent.width
|
|
||||||
QtControls.Label {
|
|
||||||
height: parent.height
|
|
||||||
width: parent.width * 2 / 5
|
|
||||||
horizontalAlignment: Text.AlignRight
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
text: i18n("Bars")
|
|
||||||
}
|
|
||||||
QtControls.Button {
|
|
||||||
width: parent.width * 3 / 5
|
|
||||||
text: i18n("Edit bars")
|
|
||||||
onClicked: AWKeys.editItem("graphicalitem")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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("[advanced::onNewData] : Update source " + sourceName)
|
|
||||||
|
|
||||||
AWKeys.setDataBySource(sourceName, data, settings)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: extsysmonDE
|
|
||||||
engine: "extsysmon"
|
|
||||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
|
||||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
|
||||||
interval: 5000
|
|
||||||
|
|
||||||
onNewData: {
|
|
||||||
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
|
||||||
|
|
||||||
AWKeys.setDataBySource(sourceName, data, settings)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaCore.DataSource {
|
|
||||||
id: timeDE
|
|
||||||
engine: "time"
|
|
||||||
connectedSources: ["Local"]
|
|
||||||
interval: 5000
|
|
||||||
|
|
||||||
onNewData: {
|
|
||||||
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
|
||||||
|
|
||||||
AWKeys.setDataBySource(sourceName, data, settings)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (debug) console.log("[advanced::onCompleted]")
|
if (debug) console.log("[advanced::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -49,7 +49,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
@ -21,7 +21,7 @@ import QtQuick.Dialogs 1.1 as QtDialogs
|
|||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -57,7 +57,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -105,11 +105,10 @@ Item {
|
|||||||
id: gpuDev
|
id: gpuDev
|
||||||
width: parent.width * 3 / 5
|
width: parent.width * 3 / 5
|
||||||
model: ["auto", "disable", "ati", "nvidia"]
|
model: ["auto", "disable", "ati", "nvidia"]
|
||||||
onCurrentIndexChanged: cfg_dataengine["GPUDEV"] = gpuDev.currentText
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i=0; i<model.length; i++) {
|
for (var i=0; i<model.length; i++) {
|
||||||
if (model[i] == cfg_dataengine["GPUDEV"]) {
|
if (model[i] == cfg_dataengine["GPUDEV"]) {
|
||||||
gpuDev.currentIndex = i;
|
currentIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -130,7 +129,6 @@ Item {
|
|||||||
id: hdd
|
id: hdd
|
||||||
width: parent.width * 3 / 5
|
width: parent.width * 3 / 5
|
||||||
model: AWKeys.getHddDevices(true)
|
model: AWKeys.getHddDevices(true)
|
||||||
onCurrentIndexChanged: cfg_dataengine["HDDDEV"] = hdd.currentText
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i=0; i<model.length; i++) {
|
for (var i=0; i<model.length; i++) {
|
||||||
if (model[i] == cfg_dataengine["HDDDEV"]) {
|
if (model[i] == cfg_dataengine["HDDDEV"]) {
|
||||||
@ -226,7 +224,6 @@ Item {
|
|||||||
id: player
|
id: player
|
||||||
width: parent.width * 3 / 5
|
width: parent.width * 3 / 5
|
||||||
model: ["mpris", "mpd"]
|
model: ["mpris", "mpd"]
|
||||||
onCurrentIndexChanged: cfg_dataengine["PLAYER"] = model[currentIndex]
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i=0; i<model.length; i++) {
|
for (var i=0; i<model.length; i++) {
|
||||||
if (model[i] == cfg_dataengine["PLAYER"]) {
|
if (model[i] == cfg_dataengine["PLAYER"]) {
|
||||||
@ -237,6 +234,23 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -259,12 +273,15 @@ Item {
|
|||||||
if (debug) console.log("[dataengine::onCompleted]")
|
if (debug) console.log("[dataengine::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
if (debug) console.log("[dataengine::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
|
cfg_dataengine["MPRIS"] = mpris.currentText
|
||||||
AWActions.writeDataEngineConfiguration(cfg_dataengine)
|
AWActions.writeDataEngineConfiguration(cfg_dataengine)
|
||||||
}
|
}
|
@ -22,7 +22,7 @@ import org.kde.plasma.plasmoid 2.0
|
|||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
|
||||||
@ -59,6 +59,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
signal needUpdate
|
signal needUpdate
|
||||||
|
signal sizeUpdate
|
||||||
|
|
||||||
|
|
||||||
// init
|
// init
|
||||||
@ -67,8 +68,7 @@ Item {
|
|||||||
|
|
||||||
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
||||||
Layout.minimumHeight: text.contentHeight
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||||
Layout.minimumWidth: text.contentWidth
|
|
||||||
|
|
||||||
Plasmoid.icon: "utilities-system-monitor"
|
Plasmoid.icon: "utilities-system-monitor"
|
||||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||||
@ -82,6 +82,8 @@ Item {
|
|||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
// FIXME: ugly workaround to make some sources working
|
||||||
|
systemmonitorDE.interval = plasmoid.configuration.interval
|
||||||
|
|
||||||
if (AWKeys.setDataBySource(sourceName, data, settings)) disconnectSource(sourceName)
|
if (AWKeys.setDataBySource(sourceName, data, settings)) disconnectSource(sourceName)
|
||||||
}
|
}
|
||||||
@ -96,12 +98,13 @@ Item {
|
|||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: extsysmonDE
|
id: extsysmonDE
|
||||||
engine: "extsysmon"
|
engine: "extsysmon"
|
||||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
connectedSources: extsysmonDE.sources
|
||||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
|
||||||
interval: plasmoid.configuration.interval
|
interval: plasmoid.configuration.interval
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||||
|
// FIXME: ugly workaround to make some sources working
|
||||||
|
extsysmonDE.interval = plasmoid.configuration.interval
|
||||||
|
|
||||||
if (AWKeys.setDataBySource(sourceName, data, settings)) needUpdate()
|
if (AWKeys.setDataBySource(sourceName, data, settings)) needUpdate()
|
||||||
}
|
}
|
||||||
@ -122,36 +125,31 @@ Item {
|
|||||||
|
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
Grid {
|
Text {
|
||||||
columns: 1
|
id: text
|
||||||
|
anchors.fill: parent
|
||||||
|
textFormat: Text.RichText
|
||||||
|
wrapMode: Text.NoWrap
|
||||||
|
|
||||||
Text {
|
horizontalAlignment: general.align[plasmoid.configuration.textAlign]
|
||||||
id: text
|
verticalAlignment: Text.AlignVCenter
|
||||||
height: contentHeight
|
|
||||||
width: contentWidth
|
|
||||||
textFormat: Text.RichText
|
|
||||||
wrapMode: Text.NoWrap
|
|
||||||
|
|
||||||
horizontalAlignment: general.align[plasmoid.configuration.textAlign]
|
color: plasmoid.configuration.fontColor
|
||||||
verticalAlignment: Text.AlignVCenter
|
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]
|
||||||
|
|
||||||
color: plasmoid.configuration.fontColor
|
text: plasmoid.configuration.text
|
||||||
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
|
||||||
PlasmaCore.ToolTipArea {
|
width: tooltip.width
|
||||||
height: tooltip.height
|
mainItem: Text {
|
||||||
width: tooltip.width
|
id: tooltip
|
||||||
mainItem: Text {
|
height: contentHeight
|
||||||
id: tooltip
|
width: contentWidth
|
||||||
height: contentHeight
|
textFormat: Text.RichText
|
||||||
width: contentWidth
|
|
||||||
textFormat: Text.RichText
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,21 +163,48 @@ Item {
|
|||||||
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
||||||
// plasmoid.setAction("report", i18n("Mail to developers"), "email")
|
// plasmoid.setAction("report", i18n("Mail to developers"), "email")
|
||||||
// init submodule
|
// init submodule
|
||||||
Plasmoid.userConfiguringChanged(true)
|
Plasmoid.userConfiguringChanged(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
onNeedUpdate: {
|
onNeedUpdate: {
|
||||||
if (debug) console.log("[main::onNeedUpdate]")
|
if (debug) console.log("[main::onNeedUpdate]")
|
||||||
|
|
||||||
text.text = AWKeys.parsePattern(plasmoid.configuration.text)
|
text.text = AWKeys.parsePattern()
|
||||||
tooltip.text = AWKeys.toolTipImage()
|
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: {
|
Plasmoid.onUserConfiguringChanged: {
|
||||||
|
if (plasmoid.userConfiguring) return
|
||||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings, plasmoid.configuration.notify)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
|
AWKeys.initTooltip(tooltipSettings)
|
||||||
|
AWKeys.setPopupEnabled(plasmoid.configuration.notify)
|
||||||
|
AWKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines)
|
||||||
|
|
||||||
|
needUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
function action_checkUpdates() {
|
function action_checkUpdates() {
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -53,7 +53,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
|||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
||||||
import org.kde.plasma.private.awesomewidget 1.0
|
import org.kde.plasma.awesomewidget 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -63,7 +63,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@ -76,6 +76,7 @@ Item {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
iconName: "font"
|
iconName: "font"
|
||||||
|
|
||||||
@ -98,6 +99,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-indent-more"
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -111,6 +113,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-bold"
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -123,6 +126,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-italic"
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -135,6 +139,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-underline"
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -147,6 +152,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-strikethrough"
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -160,6 +166,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-left"
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -168,10 +175,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-center"
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -180,10 +188,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-right"
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -192,10 +201,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-fill"
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -204,7 +214,7 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,9 +256,20 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row {
|
||||||
|
height: implicitHeight
|
||||||
|
width: parent.width
|
||||||
|
QtControls.Button {
|
||||||
|
width: parent.width
|
||||||
|
text: i18n("Edit bars")
|
||||||
|
onClicked: AWKeys.editItem("graphicalitem")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QtControls.TextArea {
|
QtControls.TextArea {
|
||||||
id: textPattern
|
id: textPattern
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: parent.height * 4 / 5
|
||||||
textFormat: TextEdit.PlainText
|
textFormat: TextEdit.PlainText
|
||||||
text: plasmoid.configuration.text
|
text: plasmoid.configuration.text
|
||||||
}
|
}
|
||||||
@ -272,8 +293,7 @@ Item {
|
|||||||
PlasmaCore.DataSource {
|
PlasmaCore.DataSource {
|
||||||
id: extsysmonDE
|
id: extsysmonDE
|
||||||
engine: "extsysmon"
|
engine: "extsysmon"
|
||||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
connectedSources: extsysmonDE.sources
|
||||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
|
||||||
interval: 5000
|
interval: 5000
|
||||||
|
|
||||||
onNewData: {
|
onNewData: {
|
||||||
@ -300,7 +320,7 @@ Item {
|
|||||||
if (debug) console.log("[widget::onCompleted]")
|
if (debug) console.log("[widget::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
AWKeys.initKeys(plasmoid.configuration.text)
|
||||||
tags.model = AWKeys.dictKeys()
|
tags.model = AWKeys.dictKeys(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,12 +12,15 @@ X-KDE-ServiceTypes=Plasma/Applet
|
|||||||
Type=Service
|
Type=Service
|
||||||
Icon=utilities-system-monitor
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
X-KDE-Library=plasma_applet_awesome-widget
|
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-Author=Evgeniy Alekseev aka arcanis
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=awesome-widget
|
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
X-KDE-PluginInfo-Version=2.3.0
|
||||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
X-KDE-PluginInfo-Category=System Information
|
X-KDE-PluginInfo-Category=System Information
|
||||||
X-KDE-PluginInfo-Depends=
|
X-KDE-PluginInfo-Depends=
|
@ -1,12 +1,9 @@
|
|||||||
set (PLUGIN_NAME awplugin)
|
set (PLUGIN_NAME awplugin)
|
||||||
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidget\")
|
||||||
|
|
||||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS})
|
||||||
${Qt5Network_INCLUDE_DIRS}
|
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Qml_LIBRARIES})
|
||||||
${Qt5Qml_INCLUDE_DIRS})
|
|
||||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
|
||||||
${Qt5Network_LIBRARIES}
|
|
||||||
${Qt5Qml_LIBRARIES})
|
|
||||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||||
${Notifications_INCLUDE_DIR})
|
${Notifications_INCLUDE_DIR})
|
||||||
set (Kf5_LIBRARIES KF5::I18n
|
set (Kf5_LIBRARIES KF5::I18n
|
||||||
@ -22,23 +19,20 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
${Qt_INCLUDE}
|
${Qt_INCLUDE}
|
||||||
${Kf5_INCLUDE})
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
|
||||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
|
||||||
file (GLOB SUBPROJECT_UI *.ui)
|
|
||||||
# task source is required by extscripts
|
# task source is required by extscripts
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
||||||
${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp
|
../../extsysmon/extquotes.cpp
|
||||||
../../extsysmon/extscript.cpp
|
../../extsysmon/extscript.cpp
|
||||||
../../extsysmon/extupgrade.cpp)
|
../../extsysmon/extupgrade.cpp)
|
||||||
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
|
file (GLOB SUBPROJECT_UI *.ui)
|
||||||
set (SUBPROJECT_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
set (SUBPROJECT_DESKTOP ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||||
|
|
||||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
|
||||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/awesomewidget)
|
||||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||||
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
install (DIRECTORY ${SUBPROJECT_DESKTOP} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
@ -101,6 +101,8 @@ QString AWActions::getAboutText(const QString type)
|
|||||||
QString text;
|
QString text;
|
||||||
if (type == QString("header"))
|
if (type == QString("header"))
|
||||||
text = QString(NAME);
|
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"))
|
else if (type == QString("description"))
|
||||||
text = i18n("A set of minimalistic plasmoid widgets");
|
text = i18n("A set of minimalistic plasmoid widgets");
|
||||||
else if (type == QString("links"))
|
else if (type == QString("links"))
|
||||||
@ -130,11 +132,11 @@ QString AWActions::getAboutText(const QString type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> defaultFont)
|
QVariantMap AWActions::getFont(const QVariantMap defaultFont)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QMap<QString, QVariant> fontMap;
|
QVariantMap fontMap;
|
||||||
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||||
defaultFont[QString("size")].toInt(),
|
defaultFont[QString("size")].toInt(),
|
||||||
400, false, defaultFont[QString("color")].toString());
|
400, false, defaultFont[QString("color")].toString());
|
||||||
@ -148,20 +150,20 @@ QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> default
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
QVariantMap AWActions::readDataEngineConfiguration()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||||
QSettings settings(fileName, QSettings::IniFormat);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
QMap<QString, QVariant> configuration;
|
QVariantMap configuration;
|
||||||
|
|
||||||
settings.beginGroup(QString("Configuration"));
|
settings.beginGroup(QString("Configuration"));
|
||||||
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||||
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
||||||
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
||||||
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp"));
|
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a"));
|
||||||
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
||||||
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
||||||
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
||||||
@ -172,7 +174,7 @@ QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AWActions::writeDataEngineConfiguration(const QMap<QString, QVariant> configuration)
|
void AWActions::writeDataEngineConfiguration(const QVariantMap configuration)
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ void AWActions::sendNotification(const QString eventId, const QString message, c
|
|||||||
{
|
{
|
||||||
if ((eventId == QString("event")) && (!enablePopup)) return;
|
if ((eventId == QString("event")) && (!enablePopup)) return;
|
||||||
|
|
||||||
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: ") + eventId, message);
|
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: %1").arg(eventId), message);
|
||||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget"));
|
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget"));
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +31,7 @@ class AWActions : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AWActions(QObject *parent = 0);
|
AWActions(QObject *parent = nullptr);
|
||||||
~AWActions();
|
~AWActions();
|
||||||
|
|
||||||
Q_INVOKABLE void checkUpdates();
|
Q_INVOKABLE void checkUpdates();
|
||||||
@ -39,14 +39,15 @@ public:
|
|||||||
Q_INVOKABLE void sendEmail();
|
Q_INVOKABLE void sendEmail();
|
||||||
Q_INVOKABLE void showReadme();
|
Q_INVOKABLE void showReadme();
|
||||||
// configuration slots
|
// configuration slots
|
||||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
Q_INVOKABLE QString getAboutText(const QString type = QString("header"));
|
||||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont);
|
||||||
// dataengine
|
// dataengine
|
||||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
Q_INVOKABLE QVariantMap readDataEngineConfiguration();
|
||||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, const bool enablePopup = false);
|
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message,
|
||||||
|
const bool enablePopup = false);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void showUpdates(QString version);
|
void showUpdates(QString version);
|
@ -43,7 +43,7 @@ static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scr
|
|||||||
|
|
||||||
void AWPlugin::registerTypes(const char *uri)
|
void AWPlugin::registerTypes(const char *uri)
|
||||||
{
|
{
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget"));
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.awesomewidget"));
|
||||||
|
|
||||||
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||||
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
@ -22,8 +22,6 @@
|
|||||||
#include <QQmlExtensionPlugin>
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
|
||||||
class QQmlEngine;
|
|
||||||
|
|
||||||
class AWPlugin : public QQmlExtensionPlugin
|
class AWPlugin : public QQmlExtensionPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
|
|
||||||
class AWToolTip;
|
class AWToolTip;
|
||||||
|
class ExtQuotes;
|
||||||
class ExtScript;
|
class ExtScript;
|
||||||
class ExtUpgrade;
|
class ExtUpgrade;
|
||||||
class GraphicalItem;
|
class GraphicalItem;
|
||||||
@ -41,33 +42,29 @@ class AWKeys : public QObject
|
|||||||
enum RequestedItem {
|
enum RequestedItem {
|
||||||
Nothing,
|
Nothing,
|
||||||
RequestedGraphicalItem,
|
RequestedGraphicalItem,
|
||||||
|
RequestedExtQuotes,
|
||||||
RequestedExtScript,
|
RequestedExtScript,
|
||||||
RequestedExtUpgrade
|
RequestedExtUpgrade
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AWKeys(QObject *parent = 0);
|
AWKeys(QObject *parent = nullptr);
|
||||||
~AWKeys();
|
~AWKeys();
|
||||||
|
|
||||||
Q_INVOKABLE void initKeys(const QString pattern,
|
Q_INVOKABLE void initKeys(const QString currentPattern);
|
||||||
const QMap<QString, QVariant> tooltipParams,
|
Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams);
|
||||||
const bool popup = false);
|
Q_INVOKABLE void setPopupEnabled(const bool popup = false);
|
||||||
|
Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
|
||||||
Q_INVOKABLE bool isDebugEnabled();
|
Q_INVOKABLE bool isDebugEnabled();
|
||||||
Q_INVOKABLE QString parsePattern(const QString pattern);
|
Q_INVOKABLE QString parsePattern();
|
||||||
Q_INVOKABLE QString toolTipImage();
|
Q_INVOKABLE QString toolTipImage();
|
||||||
Q_INVOKABLE QSize toolTipSize();
|
Q_INVOKABLE QSize toolTipSize();
|
||||||
// keys
|
// keys
|
||||||
Q_INVOKABLE bool addDevice(const QString source);
|
Q_INVOKABLE void addDevice(const QString source);
|
||||||
Q_INVOKABLE QStringList dictKeys();
|
Q_INVOKABLE QStringList dictKeys(const bool sorted = false);
|
||||||
Q_INVOKABLE QStringList getDiskDevices();
|
Q_INVOKABLE QStringList getHddDevices();
|
||||||
Q_INVOKABLE QStringList getFanDevices();
|
Q_INVOKABLE bool setDataBySource(const QString sourceName, const QVariantMap data,
|
||||||
Q_INVOKABLE QStringList getHddDevices(const bool needAbstract = false);
|
const QVariantMap params);
|
||||||
Q_INVOKABLE QStringList getMountDevices();
|
|
||||||
Q_INVOKABLE QStringList getNetworkDevices();
|
|
||||||
Q_INVOKABLE QStringList getTempDevices();
|
|
||||||
Q_INVOKABLE bool setDataBySource(const QString sourceName,
|
|
||||||
const QMap<QString, QVariant> data,
|
|
||||||
const QMap<QString, QVariant> params);
|
|
||||||
// values
|
// values
|
||||||
Q_INVOKABLE void graphicalValueByKey();
|
Q_INVOKABLE void graphicalValueByKey();
|
||||||
Q_INVOKABLE QString infoByKey(QString key);
|
Q_INVOKABLE QString infoByKey(QString key);
|
||||||
@ -76,21 +73,27 @@ public:
|
|||||||
Q_INVOKABLE void editItem(const QString type);
|
Q_INVOKABLE void editItem(const QString type);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void loadKeysFromCache();
|
||||||
|
void reinitKeys();
|
||||||
|
// editor
|
||||||
void editItemButtonPressed(QAbstractButton *button);
|
void editItemButtonPressed(QAbstractButton *button);
|
||||||
void copyBar(const QString original);
|
void copyBar(const QString original);
|
||||||
|
void copyQuotes(const QString original);
|
||||||
void copyScript(const QString original);
|
void copyScript(const QString original);
|
||||||
void copyUpgrade(const QString original);
|
void copyUpgrade(const QString original);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// methods
|
// methods
|
||||||
bool checkKeys(const QMap<QString, QVariant> data);
|
void addKeyToCache(const QString type, const QString key = QString(""));
|
||||||
QString networkDevice();
|
bool checkKeys(const QVariantMap data);
|
||||||
|
QString htmlValue(QString key);
|
||||||
int numberCpus();
|
int numberCpus();
|
||||||
float temperature(const float temp, const QString units = QString("Celsius"));
|
float temperature(const float temp, const QString units);
|
||||||
// find methods
|
// find methods
|
||||||
QStringList findGraphicalItems(const QString pattern);
|
QStringList findGraphicalItems();
|
||||||
QStringList findKeys(const QString pattern);
|
QStringList findKeys();
|
||||||
// get methods
|
// get methods
|
||||||
|
QList<ExtQuotes *> getExtQuotes();
|
||||||
QList<ExtScript *> getExtScripts();
|
QList<ExtScript *> getExtScripts();
|
||||||
QList<ExtUpgrade *> getExtUpgrade();
|
QList<ExtUpgrade *> getExtUpgrade();
|
||||||
QList<GraphicalItem *> getGraphicalItems();
|
QList<GraphicalItem *> getGraphicalItems();
|
||||||
@ -108,13 +111,15 @@ private:
|
|||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
bool enablePopup = false;
|
bool enablePopup = false;
|
||||||
bool ready = false;
|
bool wrapNewLines = false;
|
||||||
QList<GraphicalItem *> graphicalItems;
|
QList<GraphicalItem *> graphicalItems;
|
||||||
|
QList<ExtQuotes *> extQuotes;
|
||||||
QList<ExtScript *> extScripts;
|
QList<ExtScript *> extScripts;
|
||||||
QList<ExtUpgrade *> extUpgrade;
|
QList<ExtUpgrade *> extUpgrade;
|
||||||
QStringList foundBars, foundKeys, keys;
|
QStringList foundBars, foundKeys, keys;
|
||||||
|
QString pattern;
|
||||||
QMap<QString, QString> values;
|
QMap<QString, QString> values;
|
||||||
QStringList diskDevices, fanDevices, mountDevices, tempDevices;
|
QStringList diskDevices, hddDevices, mountDevices, networkDevices, tempDevices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -24,8 +24,7 @@
|
|||||||
#include <pdebug/pdebug.h>
|
#include <pdebug/pdebug.h>
|
||||||
|
|
||||||
|
|
||||||
AWToolTip::AWToolTip(QObject *parent,
|
AWToolTip::AWToolTip(QObject *parent, QVariantMap settings)
|
||||||
QMap<QString, QVariant> settings)
|
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
configuration(settings)
|
configuration(settings)
|
||||||
{
|
{
|
||||||
@ -104,7 +103,7 @@ QPixmap AWToolTip::image()
|
|||||||
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||||
if (requiredKeys[i] != QString("batTooltip"))
|
if (requiredKeys[i] != QString("batTooltip"))
|
||||||
pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
|
pen.setColor(QColor(configuration[QString("%1Color").arg(requiredKeys[i])].toString()));
|
||||||
float shift = i * 100.0;
|
float shift = i * 100.0;
|
||||||
if (down) shift -= 100.0;
|
if (down) shift -= 100.0;
|
||||||
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
@ -32,8 +32,7 @@ class AWToolTip : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AWToolTip(QObject *parent = 0,
|
AWToolTip(QObject *parent = nullptr, QVariantMap settings = QVariantMap());
|
||||||
QMap<QString, QVariant> settings = QMap<QString, QVariant>());
|
|
||||||
~AWToolTip();
|
~AWToolTip();
|
||||||
|
|
||||||
QSize getSize();
|
QSize getSize();
|
||||||
@ -48,7 +47,7 @@ private:
|
|||||||
// variables
|
// variables
|
||||||
bool debug = false;
|
bool debug = false;
|
||||||
int counts = 0;
|
int counts = 0;
|
||||||
QMap<QString, QVariant> configuration;
|
QVariantMap configuration;
|
||||||
QMap<QString, float> boundaries;
|
QMap<QString, float> boundaries;
|
||||||
QMap<QString, QList<float>> data;
|
QMap<QString, QList<float>> data;
|
||||||
QStringList requiredKeys;
|
QStringList requiredKeys;
|
@ -396,7 +396,7 @@ void GraphicalItem::readConfiguration()
|
|||||||
|
|
||||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||||
QSettings settings(m_dirs[i] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
QSettings settings(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName), QSettings::IniFormat);
|
||||||
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
setName(settings.value(QString("Name"), m_name).toString());
|
setName(settings.value(QString("Name"), m_name).toString());
|
||||||
@ -449,18 +449,18 @@ int GraphicalItem::showConfiguration(const QStringList tags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GraphicalItem::tryDelete()
|
bool GraphicalItem::tryDelete()
|
||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
for (int i=0; i<m_dirs.count(); i++)
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << m_dirs[i] + QDir::separator() + m_fileName <<
|
if (debug) qDebug() << PDEBUG << ":" << "Remove file" << QString("%1/%2").arg(m_dirs[i]).arg(m_fileName) <<
|
||||||
QFile::remove(m_dirs[i] + QDir::separator() + m_fileName);
|
QFile::remove(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName));
|
||||||
|
|
||||||
// check if exists
|
// check if exists
|
||||||
for (int i=0; i<m_dirs.count(); i++)
|
for (int i=0; i<m_dirs.count(); i++)
|
||||||
if (QFile::exists(m_dirs[i] + QDir::separator() + m_fileName)) return 0;
|
if (QFile::exists(QString("%1/%2").arg(m_dirs[i]).arg(m_fileName))) return false;
|
||||||
return 1;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ void GraphicalItem::writeConfiguration()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QSettings settings(m_dirs[0] + QDir::separator() + m_fileName, QSettings::IniFormat);
|
QSettings settings(QString("%1/%2").arg(m_dirs[0]).arg(m_fileName), QSettings::IniFormat);
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||||
|
|
||||||
settings.beginGroup(QString("Desktop Entry"));
|
settings.beginGroup(QString("Desktop Entry"));
|
||||||
@ -493,7 +493,7 @@ void GraphicalItem::changeColor()
|
|||||||
{
|
{
|
||||||
if (debug) qDebug() << PDEBUG;
|
if (debug) qDebug() << PDEBUG;
|
||||||
|
|
||||||
QColor color = stringToColor(((QPushButton *)sender())->text());
|
QColor color = stringToColor((dynamic_cast<QPushButton *>(sender()))->text());
|
||||||
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
QColor newColor = QColorDialog::getColor(color, 0, i18n("Select color"),
|
||||||
QColorDialog::ShowAlphaChannel);
|
QColorDialog::ShowAlphaChannel);
|
||||||
if (!newColor.isValid()) return;
|
if (!newColor.isValid()) return;
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class GraphicalItem;
|
class GraphicalItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
class GraphicalItem : public QDialog
|
class GraphicalItem : public QDialog
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
Circle
|
Circle
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit GraphicalItem(QWidget *parent = 0, const QString desktopName = QString(),
|
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(),
|
||||||
const QStringList directories = QStringList(), const bool debugCmd = false);
|
const QStringList directories = QStringList(), const bool debugCmd = false);
|
||||||
~GraphicalItem();
|
~GraphicalItem();
|
||||||
QString fileName();
|
QString fileName();
|
||||||
@ -86,7 +86,7 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void readConfiguration();
|
void readConfiguration();
|
||||||
int showConfiguration(const QStringList tags = QStringList());
|
int showConfiguration(const QStringList tags = QStringList());
|
||||||
int tryDelete();
|
bool tryDelete();
|
||||||
void writeConfiguration();
|
void writeConfiguration();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
3
sources/awesome-widget/plugin/qmldir
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module org.kde.plasma.awesomewidget
|
||||||
|
|
||||||
|
plugin awplugin
|
@ -1,34 +0,0 @@
|
|||||||
# set project name
|
|
||||||
set (SUBPROJECT plasma_applet_desktop-panel)
|
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
|
||||||
|
|
||||||
# find required libaries
|
|
||||||
find_package (KDE4 REQUIRED)
|
|
||||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
|
||||||
|
|
||||||
include (KDE4Defaults)
|
|
||||||
include_directories (${CMAKE_SOURCE_DIR}
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
${KDE4_INCLUDES}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
|
||||||
${PROJECT_TRDPARTY_DIR})
|
|
||||||
|
|
||||||
# set sources
|
|
||||||
set (PLUGIN_NAME ${SUBPROJECT})
|
|
||||||
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}/fontdialog/*.cpp)
|
|
||||||
file (GLOB SUBPROJECT_UI *.ui)
|
|
||||||
|
|
||||||
# prepare
|
|
||||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
|
||||||
|
|
||||||
# make
|
|
||||||
kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI})
|
|
||||||
kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE})
|
|
||||||
target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS})
|
|
||||||
|
|
||||||
# install
|
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
|
||||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
|
@ -1,357 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>AppearanceWidget</class>
|
|
||||||
<widget class="QWidget" name="AppearanceWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>480</width>
|
|
||||||
<height>343</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>480</width>
|
|
||||||
<height>320</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Apearance</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab_active">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Active desktop</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_active">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_active">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>448</width>
|
|
||||||
<height>289</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontActive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontActive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFontComboBox" name="fontComboBox_fontActive"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontSizeActive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontSizeActive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font size</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_fontSizeActive">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>7</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>48</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>12</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontColorActive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontColorActive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font color</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_fontColorActive"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontWeightActive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontWeightActive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font weight</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_fontWeightActive">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>900</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>400</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontStyleActive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontStyleActive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font style</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_fontStyleActive">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">normal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">italic</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_active">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>119</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_inactive">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Inactive desktop</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea_inactive">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents_inactive">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>448</width>
|
|
||||||
<height>289</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontInactive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontInactive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QFontComboBox" name="fontComboBox_fontInactive"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontSizeInactive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontSizeInactive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font size</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_fontSizeInactive">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>7</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>48</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>12</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontColorInactive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontColorInactive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font color</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_fontColorInactive"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontWeightInactive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontWeightInactive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font weight</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_fontWeightInactive">
|
|
||||||
<property name="minimum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>900</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>400</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="layout_fontStyleInactive">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_fontStyleInactive">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font style</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_fontStyleInactive">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">normal</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">italic</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_inactive">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>119</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KColorCombo</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>kcolorcombo.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,634 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 "desktop-panel.h"
|
|
||||||
|
|
||||||
#include <KConfigDialog>
|
|
||||||
#include <KGlobal>
|
|
||||||
#include <KStandardDirs>
|
|
||||||
#include <KWindowSystem>
|
|
||||||
#include <Plasma/Containment>
|
|
||||||
#include <Plasma/Corona>
|
|
||||||
#include <Plasma/Theme>
|
|
||||||
#include <Plasma/ToolTipManager>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QDesktopWidget>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QGraphicsGridLayout>
|
|
||||||
#include <QGraphicsProxyWidget>
|
|
||||||
#include <QGraphicsView>
|
|
||||||
#include <QMouseEvent>
|
|
||||||
#include <QProcessEnvironment>
|
|
||||||
#include <QTextCodec>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <fontdialog/fontdialog.h>
|
|
||||||
#include <pdebug/pdebug.h>
|
|
||||||
|
|
||||||
|
|
||||||
CustomPlasmaLabel::CustomPlasmaLabel(DesktopPanel *wid, const int num, const bool debugCmd)
|
|
||||||
: QLabel(0),
|
|
||||||
debug(debugCmd),
|
|
||||||
number(num),
|
|
||||||
widget(wid)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Init label" << number;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CustomPlasmaLabel::~CustomPlasmaLabel()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int CustomPlasmaLabel::getNumber()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
return number;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CustomPlasmaLabel::enterEvent(QEvent *event)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Event" << event->type();
|
|
||||||
|
|
||||||
if (event->type() == QEvent::Enter)
|
|
||||||
widget->paintTooltip(number);
|
|
||||||
|
|
||||||
emit(QLabel::enterEvent(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CustomPlasmaLabel::mousePressEvent(QMouseEvent *event)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Get signal" << event->button();
|
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton)
|
|
||||||
widget->setCurrentDesktop(number);
|
|
||||||
emit(QLabel::mousePressEvent(event));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DesktopPanel::DesktopPanel(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::Applet(parent, args)
|
|
||||||
{
|
|
||||||
// debug
|
|
||||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
|
||||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
|
||||||
if (debugEnv == QString("yes"))
|
|
||||||
debug = true;
|
|
||||||
else
|
|
||||||
debug = false;
|
|
||||||
|
|
||||||
setBackgroundHints(DefaultBackground);
|
|
||||||
setAspectRatioMode(Plasma::IgnoreAspectRatio);
|
|
||||||
setHasConfigurationInterface(true);
|
|
||||||
// text format init
|
|
||||||
currentFormatLine.append(QString(""));
|
|
||||||
currentFormatLine.append(QString(""));
|
|
||||||
formatLine.append(QString(""));
|
|
||||||
formatLine.append(QString(""));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DesktopPanel::~DesktopPanel()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::init()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
layout = new QGraphicsGridLayout();
|
|
||||||
layout->setContentsMargins(1, 1, 1, 1);
|
|
||||||
setLayout(layout);
|
|
||||||
|
|
||||||
// tooltip
|
|
||||||
toolTip = Plasma::ToolTipContent();
|
|
||||||
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);
|
|
||||||
Plasma::ToolTipManager::self()->setContent(this, toolTip);
|
|
||||||
|
|
||||||
// read variables
|
|
||||||
configChanged();
|
|
||||||
connect(this, SIGNAL(activate()), this, SLOT(changePanelsState()));
|
|
||||||
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(updateText(int)));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DesktopPanel::DesktopWindowsInfo DesktopPanel::getInfoByDesktop(const int num)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << num;
|
|
||||||
|
|
||||||
|
|
||||||
DesktopWindowsInfo info;
|
|
||||||
info.desktop = KWindowSystem::workArea(num);
|
|
||||||
|
|
||||||
QList<WId> windows = KWindowSystem::windows();
|
|
||||||
for (int i=0; i<windows.count(); i++) {
|
|
||||||
KWindowInfo winInfo = KWindowSystem::windowInfo(windows[i],
|
|
||||||
NET::Property::WMDesktop | NET::Property::WMGeometry |
|
|
||||||
NET::Property::WMState | NET::Property::WMWindowType);
|
|
||||||
if (!winInfo.isOnDesktop(num)) continue;
|
|
||||||
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) {
|
|
||||||
if (winInfo.isMinimized()) continue;
|
|
||||||
info.windows.append(winInfo.geometry());
|
|
||||||
info.winId.append(windows[i]);
|
|
||||||
} else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask) == NET::WindowType::Desktop) {
|
|
||||||
info.desktopId.append(windows[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> DesktopPanel::getPanels()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> panels;
|
|
||||||
for (int i=0; i<containment()->corona()->containments().count(); i++)
|
|
||||||
if (containment()->corona()->containments()[i]->containmentType() == Plasma::Containment::PanelContainment)
|
|
||||||
panels.append(containment()->corona()->containments()[i]);
|
|
||||||
|
|
||||||
return panels;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString DesktopPanel::panelLocationToStr(Plasma::Location loc)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Location" << loc;
|
|
||||||
|
|
||||||
switch (loc) {
|
|
||||||
case Plasma::TopEdge:
|
|
||||||
return i18n("Top Edge");
|
|
||||||
case Plasma::BottomEdge:
|
|
||||||
return i18n("Bottom Edge");
|
|
||||||
case Plasma::LeftEdge:
|
|
||||||
return i18n("Left Edge");
|
|
||||||
case Plasma::RightEdge:
|
|
||||||
return i18n("Right Edge");
|
|
||||||
default:
|
|
||||||
return i18n("Unknown Position (%1)", loc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString DesktopPanel::parsePattern(const QString rawLine, const int num)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Raw line" << rawLine;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Number" << num;
|
|
||||||
|
|
||||||
QString line, fullMark, mark;
|
|
||||||
line = rawLine;
|
|
||||||
if (KWindowSystem::currentDesktop() == num + 1)
|
|
||||||
mark = configuration[QString("mark")];
|
|
||||||
else
|
|
||||||
mark = QString("");
|
|
||||||
fullMark = QString("%1").arg(mark, configuration[QString("mark")].count(), QLatin1Char(' '));
|
|
||||||
if (line.contains(QString("$fullmark")))
|
|
||||||
line.replace(QString("$fullmark"), fullMark);
|
|
||||||
if (line.contains(QString("$mark")))
|
|
||||||
line.replace(QString("$mark"), mark);
|
|
||||||
if (line.contains(QString("$name")))
|
|
||||||
line.replace(QString("$name"), desktopNames[num]);
|
|
||||||
if (line.contains(QString("$number")))
|
|
||||||
line.replace(QString("$number"), QString::number(num + 1));
|
|
||||||
if (line.contains(QString("$total")))
|
|
||||||
line.replace(QString("$total"), QString::number(desktopNames.count()));
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::reinit()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
// clear
|
|
||||||
// labels
|
|
||||||
for (int i=0; i<proxyWidgets.count(); i++) {
|
|
||||||
layout->removeItem(proxyWidgets[i]);
|
|
||||||
proxyWidgets[i]->setWidget(0);
|
|
||||||
delete labels[i];
|
|
||||||
delete proxyWidgets[i];
|
|
||||||
}
|
|
||||||
labels.clear();
|
|
||||||
proxyWidgets.clear();
|
|
||||||
desktopNames.clear();
|
|
||||||
|
|
||||||
// add
|
|
||||||
int total = KWindowSystem::numberOfDesktops();
|
|
||||||
for (int i=1; i<total+1; i++)
|
|
||||||
desktopNames.append(KWindowSystem::desktopName(i));
|
|
||||||
// layout
|
|
||||||
if (configuration[QString("background")].toInt() == 0)
|
|
||||||
setBackgroundHints(NoBackground);
|
|
||||||
// labels
|
|
||||||
for (int i=0; i<desktopNames.count(); i++) {
|
|
||||||
proxyWidgets.append(new QGraphicsProxyWidget(this));
|
|
||||||
labels.append(new CustomPlasmaLabel(this, i, debug));
|
|
||||||
labels[i]->setWordWrap(false);
|
|
||||||
labels[i]->setAttribute(Qt::WA_TranslucentBackground, true);
|
|
||||||
proxyWidgets[i]->setWidget(labels[i]);
|
|
||||||
if (configuration[QString("layout")].toInt() == 0)
|
|
||||||
layout->addItem(proxyWidgets[i], 0, i);
|
|
||||||
else
|
|
||||||
layout->addItem(proxyWidgets[i], i, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateText(KWindowSystem::currentDesktop());
|
|
||||||
for (int i=0; i<proxyWidgets.count(); i++) {
|
|
||||||
labels[i]->adjustSize();
|
|
||||||
proxyWidgets[i]->setGeometry(labels[i]->geometry());
|
|
||||||
}
|
|
||||||
emit(KWindowSystem::setCurrentDesktop(KWindowSystem::currentDesktop()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::changePanelsState()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QList<Plasma::Containment *> panels = getPanels();
|
|
||||||
for (int i=0; i<panels.count(); i++) {
|
|
||||||
if ((!configuration[QString("panels")].split(QChar(','))
|
|
||||||
.contains(QString::number(i))) &&
|
|
||||||
(configuration[QString("panels")] != QString("-1")))
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::paintTooltip(const int active)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (active == activeTooltip) return;
|
|
||||||
|
|
||||||
// prepare
|
|
||||||
// clear
|
|
||||||
toolTip.setImage(0);
|
|
||||||
toolTip.setWindowsToPreview(QList<WId>());
|
|
||||||
activeTooltip = active;
|
|
||||||
DesktopWindowsInfo info = getInfoByDesktop(active + 1);
|
|
||||||
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 (configuration[QString("tooltipType")].toInt() == 1) {
|
|
||||||
// only contours
|
|
||||||
QPen pen = QPen();
|
|
||||||
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
|
||||||
pen.setColor(QColor(configuration[QString("tooltipColor")]));
|
|
||||||
for (int i=0; i<info.windows.count(); i++) {
|
|
||||||
toolTipScene->addLine(info.windows[i].left() + margin, info.windows[i].bottom() + margin,
|
|
||||||
info.windows[i].left() + margin, info.windows[i].top() + margin, pen);
|
|
||||||
toolTipScene->addLine(info.windows[i].left() + margin, info.windows[i].top() + margin,
|
|
||||||
info.windows[i].right() + margin, info.windows[i].top() + margin, pen);
|
|
||||||
toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].top() + margin,
|
|
||||||
info.windows[i].right() + margin, info.windows[i].bottom() + margin, pen);
|
|
||||||
toolTipScene->addLine(info.windows[i].right() + margin, info.windows[i].bottom() + margin,
|
|
||||||
info.windows[i].left() + margin, info.windows[i].bottom() + margin, pen);
|
|
||||||
}
|
|
||||||
toolTip.setImage(QPixmap::grabWidget(toolTipView).scaledToWidth(configuration[QString("tooltipWidth")].toInt()));
|
|
||||||
} else if (configuration[QString("tooltipType")].toInt() == 2) {
|
|
||||||
// clean desktop
|
|
||||||
toolTip.setWindowsToPreview(info.desktopId);
|
|
||||||
} else {
|
|
||||||
// desktop preview
|
|
||||||
toolTip.setWindowsToPreview(info.winId);
|
|
||||||
}
|
|
||||||
|
|
||||||
Plasma::ToolTipManager::self()->setContent(this, toolTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::setCurrentDesktop(const int number)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Set desktop" << number + 1;
|
|
||||||
|
|
||||||
KWindowSystem::setCurrentDesktop(number + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::updateText(const int active)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QString line, text;
|
|
||||||
for (int i=0; i<labels.count(); i++) {
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Label" << i;
|
|
||||||
line = parsePattern(configuration[QString("pattern")], i);
|
|
||||||
if (active == i + 1)
|
|
||||||
text = currentFormatLine[0] + line + currentFormatLine[1];
|
|
||||||
else
|
|
||||||
text = formatLine[0] + line + formatLine[1];
|
|
||||||
labels[i]->setText(text);
|
|
||||||
}
|
|
||||||
int height = 0;
|
|
||||||
int width = 0;
|
|
||||||
for (int i=0; i<proxyWidgets.count(); i++) {
|
|
||||||
labels[i]->adjustSize();
|
|
||||||
proxyWidgets[i]->setGeometry(labels[i]->geometry());
|
|
||||||
if (configuration[QString("layout")].toInt() == 0) {
|
|
||||||
width += proxyWidgets[i]->geometry().width();
|
|
||||||
if (height < proxyWidgets[i]->geometry().height())
|
|
||||||
height = proxyWidgets[i]->geometry().height();
|
|
||||||
} else {
|
|
||||||
height += proxyWidgets[i]->geometry().height();
|
|
||||||
if (width < proxyWidgets[i]->geometry().width())
|
|
||||||
width = proxyWidgets[i]->geometry().width();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
layout->setMinimumSize(width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// configuration interface
|
|
||||||
void DesktopPanel::createConfigurationInterface(KConfigDialog *parent)
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
QWidget *appWidget = new QWidget;
|
|
||||||
uiAppConfig.setupUi(appWidget);
|
|
||||||
QWidget *configWidget = new QWidget;
|
|
||||||
uiWidConfig.setupUi(configWidget);
|
|
||||||
QWidget *toggleWidget = new QWidget;
|
|
||||||
uiToggleConfig.setupUi(toggleWidget);
|
|
||||||
|
|
||||||
uiWidConfig.textEdit_elements->setPlainText(configuration[QString("pattern")]);
|
|
||||||
if (configuration[QString("tooltip")].toInt() == 0)
|
|
||||||
uiWidConfig.checkBox_tooltip->setCheckState(Qt::Unchecked);
|
|
||||||
else
|
|
||||||
uiWidConfig.checkBox_tooltip->setCheckState(Qt::Checked);
|
|
||||||
uiWidConfig.comboBox_tooltipType->setCurrentIndex(configuration[QString("tooltipType")].toInt());
|
|
||||||
uiWidConfig.spinBox_tooltip->setValue(configuration[QString("tooltipWidth")].toInt());
|
|
||||||
uiWidConfig.kcolorcombo_tooltipColor->setColor(QColor(configuration[QString("tooltipColor")]));
|
|
||||||
if (configuration[QString("background")].toInt() == 0)
|
|
||||||
uiWidConfig.checkBox_background->setCheckState(Qt::Unchecked);
|
|
||||||
else
|
|
||||||
uiWidConfig.checkBox_background->setCheckState(Qt::Checked);
|
|
||||||
if (configuration[QString("layout")].toInt() == 0)
|
|
||||||
uiWidConfig.checkBox_layout->setCheckState(Qt::Unchecked);
|
|
||||||
else
|
|
||||||
uiWidConfig.checkBox_layout->setCheckState(Qt::Checked);
|
|
||||||
uiWidConfig.comboBox_mark->setItemText(uiWidConfig.comboBox_mark->count()-1, configuration[QString("mark")]);
|
|
||||||
uiWidConfig.comboBox_mark->setCurrentIndex(uiWidConfig.comboBox_mark->count()-1);
|
|
||||||
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
CFont font(cg.readEntry("currentFontFamily", "Terminus"));
|
|
||||||
font.setPointSize(cg.readEntry("currentFontSize", 10));
|
|
||||||
font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000")));
|
|
||||||
font.setHtmlWeight(cg.readEntry("currentFontWeight", 400));
|
|
||||||
font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic"));
|
|
||||||
uiAppConfig.fontComboBox_fontActive->setCurrentFont(font.toQFont());
|
|
||||||
uiAppConfig.spinBox_fontSizeActive->setValue(font.pointSize());
|
|
||||||
uiAppConfig.kcolorcombo_fontColorActive->setColor(font.color());
|
|
||||||
if (font.italic())
|
|
||||||
uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(1);
|
|
||||||
else
|
|
||||||
uiAppConfig.comboBox_fontStyleActive->setCurrentIndex(0);
|
|
||||||
uiAppConfig.spinBox_fontWeightActive->setValue(font.htmlWeight());
|
|
||||||
|
|
||||||
font = CFont(cg.readEntry("fontFamily", "Terminus"));
|
|
||||||
font.setPointSize(cg.readEntry("fontSize", 10));
|
|
||||||
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
|
|
||||||
font.setHtmlWeight(cg.readEntry("fontWeight", 400));
|
|
||||||
font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic"));
|
|
||||||
uiAppConfig.fontComboBox_fontInactive->setCurrentFont(font.toQFont());
|
|
||||||
uiAppConfig.spinBox_fontSizeInactive->setValue(font.pointSize());
|
|
||||||
uiAppConfig.kcolorcombo_fontColorInactive->setColor(font.color());
|
|
||||||
if (font.italic())
|
|
||||||
uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(1);
|
|
||||||
else
|
|
||||||
uiAppConfig.comboBox_fontStyleInactive->setCurrentIndex(0);
|
|
||||||
uiAppConfig.spinBox_fontWeightInactive->setValue(font.htmlWeight());
|
|
||||||
|
|
||||||
uiToggleConfig.listWidget_list->clear();
|
|
||||||
QList<Plasma::Containment *> panels = getPanels();
|
|
||||||
for (int i=0; i<panels.count(); i++) {
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(panelLocationToStr(panels[i]->location()), uiToggleConfig.listWidget_list);
|
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
|
||||||
if ((configuration[QString("panels")].split(QChar(','))
|
|
||||||
.contains(QString::number(i))) ||
|
|
||||||
(configuration[QString("panels")] == QString("-1")))
|
|
||||||
item->setCheckState(Qt::Checked);
|
|
||||||
else
|
|
||||||
item->setCheckState(Qt::Unchecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
parent->addPage(configWidget, i18n("Widget"), Applet::icon());
|
|
||||||
parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme"));
|
|
||||||
parent->addPage(toggleWidget, i18n("Toggle panels"), QString("plasma"));
|
|
||||||
|
|
||||||
connect(uiWidConfig.pushButton_tags, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_br, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_font, SIGNAL(clicked(bool)), this, SLOT(setFontFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_bold, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_italic, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_underline, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_strike, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_left, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_center, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_right, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
connect(uiWidConfig.pushButton_fill, SIGNAL(clicked(bool)), this, SLOT(setFormating()));
|
|
||||||
|
|
||||||
connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted()));
|
|
||||||
connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::configAccepted()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
|
|
||||||
cg.writeEntry("pattern", uiWidConfig.textEdit_elements->toPlainText());
|
|
||||||
cg.writeEntry("tooltip", QString::number(uiWidConfig.checkBox_tooltip->checkState()));
|
|
||||||
cg.writeEntry("tooltipType", QString::number(uiWidConfig.comboBox_tooltipType->currentIndex()));
|
|
||||||
cg.writeEntry("tooltipWidth", QString::number(uiWidConfig.spinBox_tooltip->value()));
|
|
||||||
cg.writeEntry("tooltipColor", uiWidConfig.kcolorcombo_tooltipColor->color().name());
|
|
||||||
cg.writeEntry("background", QString::number(uiWidConfig.checkBox_background->checkState()));
|
|
||||||
cg.writeEntry("layout", QString::number(uiWidConfig.checkBox_layout->checkState()));
|
|
||||||
cg.writeEntry("mark", uiWidConfig.comboBox_mark->currentText());
|
|
||||||
|
|
||||||
cg.writeEntry("currentFontFamily", uiAppConfig.fontComboBox_fontActive->currentFont().family());
|
|
||||||
cg.writeEntry("currentFontSize", uiAppConfig.spinBox_fontSizeActive->value());
|
|
||||||
cg.writeEntry("currentFontColor", uiAppConfig.kcolorcombo_fontColorActive->color().name());
|
|
||||||
cg.writeEntry("currentFontWeight", uiAppConfig.spinBox_fontWeightActive->value());
|
|
||||||
cg.writeEntry("currentFontStyle", uiAppConfig.comboBox_fontStyleActive->currentText());
|
|
||||||
|
|
||||||
cg.writeEntry("fontFamily", uiAppConfig.fontComboBox_fontInactive->currentFont().family());
|
|
||||||
cg.writeEntry("fontSize", uiAppConfig.spinBox_fontSizeInactive->value());
|
|
||||||
cg.writeEntry("fontColor", uiAppConfig.kcolorcombo_fontColorInactive->color().name());
|
|
||||||
cg.writeEntry("fontWeight", uiAppConfig.spinBox_fontWeightInactive->value());
|
|
||||||
cg.writeEntry("fontStyle", uiAppConfig.comboBox_fontStyleInactive->currentText());
|
|
||||||
|
|
||||||
QStringList indexes;
|
|
||||||
for (int i=0; i<uiToggleConfig.listWidget_list->count(); i++)
|
|
||||||
if (uiToggleConfig.listWidget_list->item(i)->checkState() == Qt::Checked)
|
|
||||||
indexes.append(QString::number(i));
|
|
||||||
if (indexes.count() == uiToggleConfig.listWidget_list->count())
|
|
||||||
cg.writeEntry("panels", QString("-1"));
|
|
||||||
else
|
|
||||||
cg.writeEntry("panels", indexes.join(QChar(',')));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::configChanged()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
|
|
||||||
configuration[QString("pattern")] = cg.readEntry("pattern", "[$fullmark$number/$total: $name]");
|
|
||||||
configuration[QString("tooltip")] = cg.readEntry("tooltip", "2");
|
|
||||||
configuration[QString("tooltipType")] = cg.readEntry("tooltipType", "0");
|
|
||||||
configuration[QString("tooltipWidth")] = cg.readEntry("tooltipWidth", "200");
|
|
||||||
configuration[QString("tooltipColor")] = cg.readEntry("tooltipColor", "#ffffff");
|
|
||||||
configuration[QString("background")] = cg.readEntry("background", "2");
|
|
||||||
configuration[QString("layout")] = cg.readEntry("layout", "0");
|
|
||||||
configuration[QString("mark")] = cg.readEntry("mark", "¤");
|
|
||||||
configuration[QString("panels")] = cg.readEntry("panels", "-1");
|
|
||||||
|
|
||||||
CFont font = CFont(cg.readEntry("currentFontFamily", "Terminus"));
|
|
||||||
font.setPointSize(cg.readEntry("currentFontSize", 10));
|
|
||||||
font.setCurrentColor(QColor(cg.readEntry("currentFontColor", "#ff0000")));
|
|
||||||
font.setHtmlWeight(cg.readEntry("currentFontWeight", 400));
|
|
||||||
font.setItalic(cg.readEntry("currentFontStyle", "normal") == QString("italic"));
|
|
||||||
QString fontStyle;
|
|
||||||
if (font.italic())
|
|
||||||
fontStyle = QString("italic");
|
|
||||||
else
|
|
||||||
fontStyle = QString("normal");
|
|
||||||
currentFormatLine[0] = QString("<html><head><style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\
|
|
||||||
</head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
|
|
||||||
.arg(font.family())
|
|
||||||
.arg(font.pointSize())
|
|
||||||
.arg(font.htmlWeight())
|
|
||||||
.arg(fontStyle)
|
|
||||||
.arg(font.color().name());
|
|
||||||
currentFormatLine[1] = QString("</body></html>");
|
|
||||||
|
|
||||||
font = CFont(cg.readEntry("fontFamily", "Terminus"));
|
|
||||||
font.setPointSize(cg.readEntry("fontSize", 10));
|
|
||||||
font.setCurrentColor(QColor(cg.readEntry("fontColor", "#000000")));
|
|
||||||
font.setHtmlWeight(cg.readEntry("fontWeight", 400));
|
|
||||||
font.setItalic(cg.readEntry("fontStyle", "normal") == QString("italic"));
|
|
||||||
if (font.italic())
|
|
||||||
fontStyle = QString("italic");
|
|
||||||
else
|
|
||||||
fontStyle = QString("normal");
|
|
||||||
formatLine[0] = QString("<html><head><style type=\"text/css\">p, li { white-space: pre-wrap; }</style>\
|
|
||||||
</head><body style=\"font-family:'%1'; font-size:%2pt; font-weight:%3; font-style:%4; color:%5;\">")
|
|
||||||
.arg(font.family())
|
|
||||||
.arg(font.pointSize())
|
|
||||||
.arg(font.htmlWeight())
|
|
||||||
.arg(fontStyle)
|
|
||||||
.arg(font.color().name());
|
|
||||||
formatLine[1] = QString("</body></html>");
|
|
||||||
|
|
||||||
reinit();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::setFontFormating()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
|
|
||||||
CFont defaultFont = CFont(uiAppConfig.fontComboBox_fontInactive->currentFont().family(),
|
|
||||||
uiAppConfig.spinBox_fontSizeInactive->value(),
|
|
||||||
400, false, uiAppConfig.kcolorcombo_fontColorInactive->color());
|
|
||||||
CFont font = CFontDialog::getFont(i18n("Select font"), defaultFont,
|
|
||||||
false, false);
|
|
||||||
QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText();
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<span style=\"color:%1; font-family:'%2'; font-size:%3pt;\">")
|
|
||||||
.arg(font.color().name()).arg(font.family()).arg(font.pointSize()) +
|
|
||||||
selectedText + QString("</span>"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DesktopPanel::setFormating()
|
|
||||||
{
|
|
||||||
if (debug) qDebug() << PDEBUG;
|
|
||||||
if (debug) qDebug() << PDEBUG << ":" << "Sender" << sender();
|
|
||||||
|
|
||||||
QString selectedText = uiWidConfig.textEdit_elements->textCursor().selectedText();
|
|
||||||
if (sender() == uiWidConfig.pushButton_tags)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("$") + uiWidConfig.comboBox_tags->currentText());
|
|
||||||
else if (sender() == uiWidConfig.pushButton_br)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<br>\n"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_bold)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<b>") + selectedText + QString("</b>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_italic)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<i>") + selectedText + QString("</i>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_underline)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<u>") + selectedText + QString("</u>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_strike)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<s>") + selectedText + QString("</s>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_left)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"left\">") + selectedText + QString("</p>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_center)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"center\">") + selectedText + QString("</p>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_right)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"right\">") + selectedText + QString("</p>"));
|
|
||||||
else if (sender() == uiWidConfig.pushButton_fill)
|
|
||||||
uiWidConfig.textEdit_elements->insertPlainText(QString("<p align=\"justify\">") + selectedText + QString("</p>"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#include "desktop-panel.moc"
|
|
@ -1,125 +0,0 @@
|
|||||||
/***************************************************************************
|
|
||||||
* 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 DESKTOP_PANEL_H
|
|
||||||
#define DESKTOP_PANEL_H
|
|
||||||
|
|
||||||
#include <Plasma/Applet>
|
|
||||||
#include <Plasma/ToolTipContent>
|
|
||||||
#include <QLabel>
|
|
||||||
|
|
||||||
#include <ui_appearance.h>
|
|
||||||
#include <ui_toggle.h>
|
|
||||||
#include <ui_widget.h>
|
|
||||||
|
|
||||||
|
|
||||||
class QGraphicsGridLayout;
|
|
||||||
class QGraphicsProxyWidget;
|
|
||||||
class QGraphicsScene;
|
|
||||||
class DesktopPanel;
|
|
||||||
|
|
||||||
|
|
||||||
class CustomPlasmaLabel : public QLabel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CustomPlasmaLabel(DesktopPanel *wid,
|
|
||||||
const int num,
|
|
||||||
const bool debugCmd = false);
|
|
||||||
~CustomPlasmaLabel();
|
|
||||||
int getNumber();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void enterEvent(QEvent *event);
|
|
||||||
void mousePressEvent(QMouseEvent *event);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// debug
|
|
||||||
bool debug;
|
|
||||||
// variables
|
|
||||||
int number;
|
|
||||||
DesktopPanel *widget;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class DesktopPanel : public Plasma::Applet
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
QRect desktop;
|
|
||||||
QList<WId> desktopId;
|
|
||||||
QList<QRect> windows;
|
|
||||||
QList<WId> winId;
|
|
||||||
} DesktopWindowsInfo;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DesktopPanel(QObject *parent, const QVariantList &args);
|
|
||||||
~DesktopPanel();
|
|
||||||
void init();
|
|
||||||
DesktopWindowsInfo getInfoByDesktop(const int num);
|
|
||||||
QString parsePattern(const QString rawLine, const int num);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
// configuration interface
|
|
||||||
void configAccepted();
|
|
||||||
void configChanged();
|
|
||||||
// events
|
|
||||||
void changePanelsState();
|
|
||||||
void paintTooltip(const int active);
|
|
||||||
void setCurrentDesktop(const int number);
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void reinit();
|
|
||||||
void setFontFormating();
|
|
||||||
void setFormating();
|
|
||||||
void updateText(const int active);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void createConfigurationInterface(KConfigDialog *parent);
|
|
||||||
|
|
||||||
private:
|
|
||||||
// functions
|
|
||||||
QList<Plasma::Containment *> getPanels();
|
|
||||||
QString panelLocationToStr(Plasma::Location loc);
|
|
||||||
// ui
|
|
||||||
QGraphicsGridLayout *layout = nullptr;
|
|
||||||
QList<QGraphicsProxyWidget *> proxyWidgets;
|
|
||||||
QList<CustomPlasmaLabel *> labels;
|
|
||||||
// tooltip
|
|
||||||
Plasma::ToolTipContent toolTip;
|
|
||||||
QGraphicsScene *toolTipScene = nullptr;
|
|
||||||
QGraphicsView *toolTipView = nullptr;
|
|
||||||
// debug
|
|
||||||
bool debug;
|
|
||||||
int activeTooltip = -1;
|
|
||||||
int oldState = 0;
|
|
||||||
// configuration interface
|
|
||||||
Ui::AppearanceWidget uiAppConfig;
|
|
||||||
Ui::ConfigWindow uiWidConfig;
|
|
||||||
Ui::ToggleWindow uiToggleConfig;
|
|
||||||
// configuration
|
|
||||||
QMap<QString, QString> configuration;
|
|
||||||
QStringList desktopNames, currentFormatLine, formatLine;
|
|
||||||
};
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_APPLET(desktop-panel, DesktopPanel)
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* DESKTOP_PANEL_H */
|
|
@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ToggleWindow</class>
|
|
||||||
<widget class="QWidget" name="ToggleWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>480</width>
|
|
||||||
<height>343</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>480</width>
|
|
||||||
<height>320</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Toggle</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>464</width>
|
|
||||||
<height>327</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_info">
|
|
||||||
<property name="text">
|
|
||||||
<string>To control panels please set widget shortcut.</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="listWidget_list"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,472 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>ConfigWindow</class>
|
|
||||||
<widget class="QWidget" name="ConfigWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>721</width>
|
|
||||||
<height>420</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>700</width>
|
|
||||||
<height>320</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string notr="true">Widget</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="9" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_mark">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_mark">
|
|
||||||
<property name="text">
|
|
||||||
<string>Mark</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_mark">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>A mark which will be shown if this desktop is active</string>
|
|
||||||
</property>
|
|
||||||
<property name="editable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">#</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">$</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">%</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">&</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">*</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">@</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">¤</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">¶</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">·</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">º</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">×</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">†</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">•</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">(current)</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layput_mainFormating">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_font">
|
|
||||||
<property name="text">
|
|
||||||
<string>Font</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_br">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="stock_text_indent">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter1">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_bold">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-bold">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+B</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_italic">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-italic">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+I</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_underline">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-underline">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="shortcut">
|
|
||||||
<string>Ctrl+U</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_strike">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-text-strikethrough">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter2">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_left">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-left">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_center">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-center">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_right">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-right">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_fill">
|
|
||||||
<property name="icon">
|
|
||||||
<iconset theme="format-justify-fill">
|
|
||||||
<normaloff>../awesome-widget</normaloff>../awesome-widget</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_mainFormatingCenter3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_tags">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">fullmark</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">mark</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">name</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">number</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string notr="true">total</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_tags">
|
|
||||||
<property name="text">
|
|
||||||
<string>Add</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QTextEdit" name="textEdit_elements">
|
|
||||||
<property name="lineWrapMode">
|
|
||||||
<enum>QTextEdit::NoWrap</enum>
|
|
||||||
</property>
|
|
||||||
<property name="acceptRichText">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_tooltip">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tooltip">
|
|
||||||
<property name="text">
|
|
||||||
<string>Tooltip width</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSpinBox" name="spinBox_tooltip">
|
|
||||||
<property name="suffix">
|
|
||||||
<string>px</string>
|
|
||||||
</property>
|
|
||||||
<property name="minimum">
|
|
||||||
<number>100</number>
|
|
||||||
</property>
|
|
||||||
<property name="maximum">
|
|
||||||
<number>1000</number>
|
|
||||||
</property>
|
|
||||||
<property name="singleStep">
|
|
||||||
<number>25</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_tooltipColor">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_tooltipColor">
|
|
||||||
<property name="text">
|
|
||||||
<string>Window border color on tooltip</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="KColorCombo" name="kcolorcombo_tooltipColor"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_background">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_background">
|
|
||||||
<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_background">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable background</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_layout">
|
|
||||||
<item>
|
|
||||||
<spacer name="spacer_layout">
|
|
||||||
<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_layout">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Vertical layout</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="layout_tooltip_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="checkBox_tooltip">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="layoutDirection">
|
|
||||||
<enum>Qt::RightToLeft</enum>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Enable tooltip</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="comboBox_tooltipType">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Windows</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Contours</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Clean desktop</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>KColorCombo</class>
|
|
||||||
<extends>QComboBox</extends>
|
|
||||||
<header>kcolorcombo.h</header>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@ -1,3 +0,0 @@
|
|||||||
module org.kde.plasma.private.desktoppanel
|
|
||||||
|
|
||||||
plugin dpplugin
|
|
@ -2,6 +2,9 @@
|
|||||||
set (SUBPROJECT plasma_applet_desktop-panel)
|
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||||
message (STATUS "Subproject ${SUBPROJECT}")
|
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)
|
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||||
|
|
@ -14,6 +14,12 @@
|
|||||||
|
|
||||||
<group name="Advanced">
|
<group name="Advanced">
|
||||||
<!-- 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">
|
<entry name="tooltipType" type="string">
|
||||||
<default>windows</default>
|
<default>windows</default>
|
||||||
</entry>
|
</entry>
|
@ -19,7 +19,7 @@ import QtQuick 2.0
|
|||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
import QtQuick.Layouts 1.0 as QtLayouts
|
import QtQuick.Layouts 1.0 as QtLayouts
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -34,7 +34,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.TabView {
|
QtControls.TabView {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -48,6 +48,12 @@ Item {
|
|||||||
text: DPAdds.getAboutText("header")
|
text: DPAdds.getAboutText("header")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: DPAdds.getAboutText("version")
|
||||||
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
@ -62,9 +68,11 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
font.capitalization: Font.SmallCaps
|
font.capitalization: Font.SmallCaps
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
verticalAlignment: Text.AlignBottom
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: DPAdds.getAboutText("copy")
|
text: DPAdds.getAboutText("copy")
|
||||||
}
|
}
|
||||||
@ -83,8 +91,10 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
|
QtLayouts.Layout.fillHeight: true
|
||||||
QtLayouts.Layout.fillWidth: true
|
QtLayouts.Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignJustify
|
horizontalAlignment: Text.AlignJustify
|
||||||
|
verticalAlignment: Text.AlignTop
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
text: DPAdds.getAboutText("3rdparty")
|
text: DPAdds.getAboutText("3rdparty")
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -48,8 +48,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
@ -128,7 +127,7 @@ Item {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i = 0; i < model.length; i++) {
|
for (var i = 0; i < model.length; i++) {
|
||||||
if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
|
if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
|
||||||
currentFontWeight.currentIndex = i;
|
fontWeight.currentIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,7 +162,7 @@ Item {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
for (var i = 0; i < model.length; i++) {
|
for (var i = 0; i < model.length; i++) {
|
||||||
if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
|
if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
|
||||||
currentFontStyle.currentIndex = i;
|
fontStyle.currentIndex = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -32,6 +32,8 @@ Item {
|
|||||||
|
|
||||||
property bool debug: DPAdds.isDebugEnabled()
|
property bool debug: DPAdds.isDebugEnabled()
|
||||||
|
|
||||||
|
property alias cfg_height: widgetHeight.value
|
||||||
|
property alias cfg_width: widgetWidth.value
|
||||||
property string cfg_tooltipType: tooltipType.currentText
|
property string cfg_tooltipType: tooltipType.currentText
|
||||||
property alias cfg_tooltipWidth: tooltipWidth.value
|
property alias cfg_tooltipWidth: tooltipWidth.value
|
||||||
property alias cfg_tooltipColor: tooltipColor.text
|
property alias cfg_tooltipColor: tooltipColor.text
|
||||||
@ -42,7 +44,47 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
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 {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
@ -20,7 +20,7 @@ import QtQuick.Controls 1.3 as QtControls
|
|||||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -48,7 +48,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
Row {
|
Row {
|
||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
@ -22,7 +22,7 @@ import org.kde.plasma.plasmoid 2.0
|
|||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
|
||||||
@ -38,26 +38,31 @@ Item {
|
|||||||
|
|
||||||
signal needUpdate
|
signal needUpdate
|
||||||
signal needTooltipUpdate
|
signal needTooltipUpdate
|
||||||
|
signal sizeUpdate
|
||||||
|
|
||||||
|
|
||||||
// init
|
// init
|
||||||
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||||
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||||
|
|
||||||
|
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
|
||||||
|
|
||||||
Plasmoid.icon: "utilities-system-monitor"
|
Plasmoid.icon: "utilities-system-monitor"
|
||||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||||
|
|
||||||
|
|
||||||
// ui
|
// ui
|
||||||
Grid {
|
GridLayout {
|
||||||
|
anchors.fill: parent
|
||||||
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
|
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
|
||||||
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
|
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
id: repeater
|
id: repeater
|
||||||
height: implicitHeight
|
Layout.columnSpan: 0
|
||||||
width: implicitWidth
|
Layout.rowSpan: 0
|
||||||
model: DPAdds.numberOfDesktops()
|
model: DPAdds.numberOfDesktops()
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: text
|
id: text
|
||||||
height: contentHeight
|
height: contentHeight
|
||||||
@ -100,8 +105,6 @@ Item {
|
|||||||
onNeedUpdate: {
|
onNeedUpdate: {
|
||||||
if (debug) console.log("[main::onNeedUpdate]")
|
if (debug) console.log("[main::onNeedUpdate]")
|
||||||
|
|
||||||
var newHeight = 0
|
|
||||||
var newWidth = 0
|
|
||||||
for (var i=0; i<repeater.count; i++) {
|
for (var i=0; i<repeater.count; i++) {
|
||||||
if (!repeater.itemAt(i)) {
|
if (!repeater.itemAt(i)) {
|
||||||
if (debug) console.log("[main::onNeedUpdate] : Nothing to do here " + i)
|
if (debug) console.log("[main::onNeedUpdate] : Nothing to do here " + i)
|
||||||
@ -123,12 +126,9 @@ Item {
|
|||||||
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
|
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
|
||||||
}
|
}
|
||||||
repeater.itemAt(i).update()
|
repeater.itemAt(i).update()
|
||||||
newHeight += repeater.itemAt(i).contentHeight
|
|
||||||
newWidth += repeater.itemAt(i).contentWidth
|
|
||||||
}
|
}
|
||||||
Layout.minimumHeight = newHeight
|
|
||||||
Layout.minimumWidth = newWidth
|
|
||||||
|
|
||||||
|
sizeUpdate()
|
||||||
needTooltipUpdate()
|
needTooltipUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +140,31 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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: {
|
Plasmoid.onActivated: {
|
||||||
if (debug) console.log("[main::onActivated]")
|
if (debug) console.log("[main::onActivated]")
|
||||||
|
|
||||||
@ -147,11 +172,13 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Plasmoid.onUserConfiguringChanged: {
|
Plasmoid.onUserConfiguringChanged: {
|
||||||
|
if (plasmoid.userConfiguring) return
|
||||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||||
|
|
||||||
DPAdds.setMark(plasmoid.configuration.mark)
|
DPAdds.setMark(plasmoid.configuration.mark)
|
||||||
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
|
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
|
||||||
DPAdds.setToolTipData(tooltipSettings)
|
DPAdds.setToolTipData(tooltipSettings)
|
||||||
|
|
||||||
needUpdate()
|
needUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +186,7 @@ Item {
|
|||||||
if (debug) console.log("[main::onCompleted]")
|
if (debug) console.log("[main::onCompleted]")
|
||||||
|
|
||||||
// init submodule
|
// init submodule
|
||||||
Plasmoid.userConfiguringChanged(true)
|
Plasmoid.userConfiguringChanged(false)
|
||||||
DPAdds.desktopChanged.connect(needUpdate)
|
DPAdds.desktopChanged.connect(needUpdate)
|
||||||
DPAdds.windowListChanged.connect(needTooltipUpdate)
|
DPAdds.windowListChanged.connect(needTooltipUpdate)
|
||||||
}
|
}
|
@ -18,7 +18,7 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
import QtQuick.Controls 1.3 as QtControls
|
import QtQuick.Controls 1.3 as QtControls
|
||||||
|
|
||||||
import org.kde.plasma.private.desktoppanel 1.0
|
import org.kde.plasma.desktoppanel 1.0
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
@ -35,7 +35,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: pageColumn
|
id: pageColumn
|
||||||
width: units.gridUnit * 25
|
anchors.fill: parent
|
||||||
QtControls.Label {
|
QtControls.Label {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
@ -48,6 +48,7 @@ Item {
|
|||||||
height: implicitHeight
|
height: implicitHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width * 3 / 12
|
||||||
text: i18n("Font")
|
text: i18n("Font")
|
||||||
iconName: "font"
|
iconName: "font"
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-indent-more"
|
iconName: "format-indent-more"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -83,6 +85,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-bold"
|
iconName: "format-text-bold"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -95,6 +98,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-italic"
|
iconName: "format-text-italic"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -107,6 +111,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-underline"
|
iconName: "format-text-underline"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -119,6 +124,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-text-strikethrough"
|
iconName: "format-text-strikethrough"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -132,6 +138,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-left"
|
iconName: "format-justify-left"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -140,10 +147,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-center"
|
iconName: "format-justify-center"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -152,10 +160,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-right"
|
iconName: "format-justify-right"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -164,10 +173,11 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
|
width: parent.width / 12
|
||||||
iconName: "format-justify-fill"
|
iconName: "format-justify-fill"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
@ -176,7 +186,7 @@ Item {
|
|||||||
var pos = textPattern.cursorPosition
|
var pos = textPattern.cursorPosition
|
||||||
var selected = textPattern.selectedText
|
var selected = textPattern.selectedText
|
||||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||||
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p")
|
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,6 +230,7 @@ Item {
|
|||||||
QtControls.TextArea {
|
QtControls.TextArea {
|
||||||
id: textPattern
|
id: textPattern
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
height: parent.height * 4 / 5
|
||||||
textFormat: TextEdit.PlainText
|
textFormat: TextEdit.PlainText
|
||||||
text: plasmoid.configuration.text
|
text: plasmoid.configuration.text
|
||||||
}
|
}
|
@ -12,12 +12,15 @@ X-KDE-ServiceTypes=Plasma/Applet
|
|||||||
Type=Service
|
Type=Service
|
||||||
Icon=utilities-system-monitor
|
Icon=utilities-system-monitor
|
||||||
|
|
||||||
X-KDE-Library=plasma_applet_desktop-panel
|
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-Author=Evgeniy Alekseev aka arcanis
|
||||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||||
X-KDE-PluginInfo-Name=desktop-panel
|
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
|
||||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
X-KDE-PluginInfo-Version=2.3.0
|
||||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||||
X-KDE-PluginInfo-Category=System Information
|
X-KDE-PluginInfo-Category=System Information
|
||||||
X-KDE-PluginInfo-Depends=
|
X-KDE-PluginInfo-Depends=
|
@ -1,4 +1,5 @@
|
|||||||
set (PLUGIN_NAME dpplugin)
|
set (PLUGIN_NAME dpplugin)
|
||||||
|
add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.desktoppanel\")
|
||||||
|
|
||||||
add_definitions (${Qt5Core_DEFINITIONS})
|
add_definitions (${Qt5Core_DEFINITIONS})
|
||||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||||
@ -21,13 +22,12 @@ include_directories (${CMAKE_SOURCE_DIR}
|
|||||||
${Qt_INCLUDE}
|
${Qt_INCLUDE}
|
||||||
${Kf5_INCLUDE})
|
${Kf5_INCLUDE})
|
||||||
|
|
||||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
|
||||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
|
||||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||||
|
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||||
|
|
||||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||||
|
|
||||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/desktoppanel)
|
||||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
@ -33,7 +33,7 @@ static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scr
|
|||||||
|
|
||||||
void DPPlugin::registerTypes(const char *uri)
|
void DPPlugin::registerTypes(const char *uri)
|
||||||
{
|
{
|
||||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel"));
|
Q_ASSERT(uri == QLatin1String("org.kde.plasma.desktoppanel"));
|
||||||
|
|
||||||
qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
||||||
}
|
}
|
@ -22,8 +22,6 @@
|
|||||||
#include <QQmlExtensionPlugin>
|
#include <QQmlExtensionPlugin>
|
||||||
|
|
||||||
|
|
||||||
class QQmlEngine;
|
|
||||||
|
|
||||||
class DPPlugin : public QQmlExtensionPlugin
|
class DPPlugin : public QQmlExtensionPlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|