mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
drop kde4 from master
This commit is contained in:
parent
3bac9ac09f
commit
a53c5ec38c
@ -49,6 +49,6 @@ build () {
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/build"
|
||||
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.1
|
||||
pkgrel=1
|
||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||
arch=('i686' 'x86_64')
|
||||
url="http://arcanis.name/projects/awesome-widgets"
|
||||
license=('GPL3')
|
||||
depends=('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=('74099a8150aa1992b8a168934878d928')
|
||||
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"
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
cmake_policy (SET CMP0003 OLD)
|
||||
cmake_policy (SET CMP0002 OLD)
|
||||
@ -21,12 +21,6 @@ message (STATUS "Project: ${PROJECT_NAME}")
|
||||
message (STATUS "Version: ${PROJECT_VERSION}")
|
||||
message (STATUS "Build date: ${CURRENT_DATE}")
|
||||
|
||||
option (BUILD_KDE4 "Build on KDE4" OFF)
|
||||
# update minimum cmake version
|
||||
if (NOT BUILD_KDE4)
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
endif ()
|
||||
|
||||
# flags
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set (CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
|
||||
@ -45,13 +39,8 @@ configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/ver
|
||||
set (PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
|
||||
|
||||
add_subdirectory (extsysmon)
|
||||
if (BUILD_KDE4)
|
||||
add_subdirectory (awesome-widget-kde4)
|
||||
add_subdirectory (desktop-panel-kde4)
|
||||
else ()
|
||||
add_subdirectory (awesome-widget-kf5)
|
||||
add_subdirectory (desktop-panel-kf5)
|
||||
endif ()
|
||||
add_subdirectory (awesome-widget)
|
||||
add_subdirectory (desktop-panel)
|
||||
|
||||
# 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 */
|
File diff suppressed because it is too large
Load Diff
@ -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,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,25 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Awesome Widget
|
||||
Comment=A minimalistic Plasmoid
|
||||
Comment[en]=A minimalistic Plasmoid
|
||||
Comment[es]=Un plasmoide minimalista
|
||||
Comment[es]=Un script Plasmoïde minimaliste
|
||||
Comment[pt_BR]=Um script Plasmoid
|
||||
Comment[ru]=Минималистичный плазмоид
|
||||
Comment[uk]=Мінімалістичний плазмоїд
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
Type=Service
|
||||
Icon=utilities-system-monitor
|
||||
|
||||
X-KDE-Library=plasma_applet_awesome-widget
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=awesome-widget
|
||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -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,293 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GraphicalItem</class>
|
||||
<widget class="QDialog" name="GraphicalItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>416</width>
|
||||
<height>325</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Configuration</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_name">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="text">
|
||||
<string>Name</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_nameValue">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_comment">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_comment">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Comment</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_comment"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_value">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_value">
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_value">
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_activeColor">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_activeColor">
|
||||
<property name="text">
|
||||
<string>Active color</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_activeColor">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_inactiveColor">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_inactiveColor">
|
||||
<property name="text">
|
||||
<string>Inactive color</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_inactiveColor">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_type">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_type">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_type">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Horizontal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Vertical</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">Circle</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_direction">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_direction">
|
||||
<property name="text">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_direction">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">LeftToRight</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string notr="true">RightToLeft</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_height">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_height">
|
||||
<property name="text">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_height">
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layout_width">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_width">
|
||||
<property name="text">
|
||||
<string>Width</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinBox_width">
|
||||
<property name="maximum">
|
||||
<number>2000</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>GraphicalItem</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>GraphicalItem</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -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,25 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Desktop Panel
|
||||
Comment=A minimalistic Plasmoid
|
||||
Comment[en]=A minimalistic Plasmoid
|
||||
Comment[es]=Un plasmoide minimalista
|
||||
Comment[es]=Un script Plasmoïde minimaliste
|
||||
Comment[pt_BR]=Um script Plasmoid
|
||||
Comment[ru]=Минималистичный плазмоид
|
||||
Comment[uk]=Мінімалістичний плазмоїд
|
||||
X-KDE-ServiceTypes=Plasma/Applet
|
||||
Type=Service
|
||||
Icon=utilities-system-monitor
|
||||
|
||||
X-KDE-Library=plasma_applet_desktop-panel
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=desktop-panel
|
||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -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>
|
@ -4,28 +4,20 @@ set (PLUGIN_NAME ${SUBPROJECT})
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# find required libaries
|
||||
if (BUILD_KDE4)
|
||||
find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml)
|
||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||
else ()
|
||||
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets Xml)
|
||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
|
||||
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||
endif ()
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} ${Qt5Xml_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Xml_INCLUDE_DIRS})
|
||||
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
@ -49,26 +41,15 @@ set (SUBPROJECT_UPGRADE ${CMAKE_CURRENT_SOURCE_DIR}/upgrade)
|
||||
configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# make
|
||||
if (BUILD_KDE4)
|
||||
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_KDECORE_LIBS} ${KDE4_PLASMA_LIBS}
|
||||
${QT_QTNETWORK_LIBRARY} ${QT_QTXML_LIBRARY})
|
||||
else ()
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
|
||||
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
|
||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
endif ()
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} KF5::WindowSystem
|
||||
${Qt5DBus_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Xml_LIBRARIES})
|
||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
|
||||
# install
|
||||
if (BUILD_KDE4)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
else ()
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
endif ()
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <QRegExp>
|
||||
#include <QTextCodec>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
#include <task/taskadds.h>
|
||||
@ -42,14 +43,6 @@
|
||||
#include "extupgrade.h"
|
||||
#include "version.h"
|
||||
|
||||
// KF5-KDE4 compability
|
||||
#ifdef BUILD_KDE4
|
||||
#include <KGlobal>
|
||||
#include <KStandardDirs>
|
||||
#else
|
||||
#include <QStandardPaths>
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
||||
|
||||
ExtendedSysMon::ExtendedSysMon(QObject* parent, const QVariantList &args)
|
||||
: Plasma::DataEngine(parent, args)
|
||||
@ -137,25 +130,15 @@ void ExtendedSysMon::initQuotes()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir;
|
||||
QStringList dirs;
|
||||
#ifdef BUILD_KDE4
|
||||
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/quotes");
|
||||
if (KStandardDirs::makeDir(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/quotes");
|
||||
#else
|
||||
localDir = QString("%1/awesomewidgets/quotes")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QString localDir = QString("%1/awesomewidgets/quotes")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/quotes"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif /* BUILD_KDE4 */
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/quotes"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
@ -176,25 +159,15 @@ void ExtendedSysMon::initScripts()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir;
|
||||
QStringList dirs;
|
||||
#ifdef BUILD_KDE4
|
||||
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/scripts");
|
||||
if (KStandardDirs::makeDir(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/scripts");
|
||||
#else
|
||||
localDir = QString("%1/awesomewidgets/scripts")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QString localDir = QString("%1/awesomewidgets/scripts")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif /* BUILD_KDE4 */
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/scripts"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
@ -215,25 +188,15 @@ void ExtendedSysMon::initUpgrade()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// create directory at $HOME and create dirs list
|
||||
QString localDir;
|
||||
QStringList dirs;
|
||||
#ifdef BUILD_KDE4
|
||||
localDir = KStandardDirs::locateLocal("data", "awesomewidgets/upgrade");
|
||||
if (KStandardDirs::makeDir(localDir))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = KGlobal::dirs()->findDirs("data", "awesomewidgets/upgrade");
|
||||
#else
|
||||
localDir = QString("%1/awesomewidgets/upgrade")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QString localDir = QString("%1/awesomewidgets/upgrade")
|
||||
.arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation));
|
||||
QDir localDirectory;
|
||||
if ((!localDirectory.exists(localDir)) && (localDirectory.mkpath(localDir)))
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Created directory" << localDir;
|
||||
|
||||
dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
#endif /* BUILD_KDE4 */
|
||||
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation,
|
||||
QString("awesomewidgets/upgrade"),
|
||||
QStandardPaths::LocateDirectory);
|
||||
|
||||
QStringList names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
@ -276,12 +239,8 @@ void ExtendedSysMon::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName;
|
||||
#ifdef BUILD_KDE4
|
||||
fileName = KGlobal::dirs()->findResource("config", "plasma-dataengine-extsysmon.conf");
|
||||
#else
|
||||
fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||
#endif /* BUILD_KDE4 */
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation,
|
||||
QString("plasma-dataengine-extsysmon.conf"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QMap<QString, QString> rawConfig;
|
||||
@ -763,10 +722,6 @@ bool ExtendedSysMon::updateSourceEvent(const QString &source)
|
||||
}
|
||||
|
||||
|
||||
#ifdef BUILD_KDE4
|
||||
K_EXPORT_PLASMA_DATAENGINE(extsysmon, ExtendedSysMon)
|
||||
#else
|
||||
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json")
|
||||
#endif /* BUILD_KDE4 */
|
||||
|
||||
#include "extsysmon.moc"
|
||||
|
@ -1,13 +1,9 @@
|
||||
find_package(Gettext REQUIRED)
|
||||
|
||||
if (BUILD_KDE4)
|
||||
find_package (KDE4 REQUIRED)
|
||||
else ()
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n)
|
||||
include (KDEInstallDirs)
|
||||
endif ()
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n)
|
||||
include (KDEInstallDirs)
|
||||
|
||||
add_subdirectory (awesome-widget)
|
||||
add_subdirectory (desktop-panel)
|
||||
|
@ -1,8 +1,4 @@
|
||||
if (BUILD_KDE4)
|
||||
set (MO_NAME plasma_applet_awesome-widget.mo)
|
||||
else ()
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo)
|
||||
endif ()
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.awesomewidget.mo)
|
||||
|
||||
file (GLOB _po_files *.po)
|
||||
set (_gmoFiles)
|
||||
|
@ -1,8 +1,4 @@
|
||||
if (BUILD_KDE4)
|
||||
set (MO_NAME plasma_applet_desktop-panel.mo)
|
||||
else ()
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo)
|
||||
endif ()
|
||||
set (MO_NAME plasma_applet_org.kde.plasma.desktoppanel.mo)
|
||||
|
||||
file (GLOB _po_files *.po)
|
||||
set (_gmoFiles)
|
||||
|
@ -35,6 +35,5 @@
|
||||
// cmake properties
|
||||
#define CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@"
|
||||
#define CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||
#cmakedefine BUILD_KDE4
|
||||
|
||||
#endif /* VERSION_H */
|
||||
|
Loading…
Reference in New Issue
Block a user