mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 16:07:19 +00:00
drop kf5, create branch for 2.2.1
This commit is contained in:
parent
7ae90bf82d
commit
4a6ec00b20
@ -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")
|
||||
@ -42,13 +36,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,19 +0,0 @@
|
||||
# set project name
|
||||
set (SUBPROJECT plasma_applet_awesome-widget)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# prepare
|
||||
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Network Qml)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_subdirectory (plugin)
|
||||
plasma_install_package (package org.kde.plasma.awesomewidget)
|
@ -1,28 +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-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -1,59 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: i18n("Widget")
|
||||
icon: "utilities-system-monitor"
|
||||
source: "widget.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Advanced")
|
||||
icon: "system-run"
|
||||
source: "advanced.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Tooltip")
|
||||
icon: "preferences-desktop-color"
|
||||
source: "tooltip.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Appearance")
|
||||
icon: "preferences-desktop-theme"
|
||||
source: "appearance.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("DataEngine")
|
||||
icon: "utilities-system-monitor"
|
||||
source: "dataengine.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("About")
|
||||
icon: "help-about"
|
||||
source: "about.qml"
|
||||
}
|
||||
}
|
@ -1,122 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="Widget">
|
||||
<!-- widget -->
|
||||
<entry name="text" type="string">
|
||||
<default>[cpu: $cpu%] [mem: $mem%] [swap: $swap%] [$netdev: $down/$upKB/s]</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
<group name="Advanced">
|
||||
<!-- advanced -->
|
||||
<entry name="notify" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="background" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="customTime" type="string">
|
||||
<default>$hh:$mm</default>
|
||||
</entry>
|
||||
<entry name="customUptime" type="string">
|
||||
<default>$dd,$hh,$mm</default>
|
||||
</entry>
|
||||
<entry name="tempUnits" type="string">
|
||||
<default>Celsius</default>
|
||||
</entry>
|
||||
<entry name="acOnline" type="string">
|
||||
<default>(*)</default>
|
||||
</entry>
|
||||
<entry name="acOffline" type="string">
|
||||
<default>( )</default>
|
||||
</entry>
|
||||
<entry name="checkUpdates" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
<group name="Tooltip">
|
||||
<entry name="tooltipNumber" type="int">
|
||||
<default>100</default>
|
||||
</entry>
|
||||
<entry name="useTooltipBackground" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="tooltipBackground" type="string">
|
||||
<default>#ffffff</default>
|
||||
</entry>
|
||||
<entry name="cpuTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="cpuTooltipColor" type="string">
|
||||
<default>#ff0000</default>
|
||||
</entry>
|
||||
<entry name="cpuclTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="cpuclTooltipColor" type="string">
|
||||
<default>#00ff00</default>
|
||||
</entry>
|
||||
<entry name="memTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="memTooltipColor" type="string">
|
||||
<default>#0000ff</default>
|
||||
</entry>
|
||||
<entry name="swapTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="swapTooltipColor" type="string">
|
||||
<default>#ffff00</default>
|
||||
</entry>
|
||||
<entry name="downTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="downTooltipColor" type="string">
|
||||
<default>#00ffff</default>
|
||||
</entry>
|
||||
<entry name="upTooltipColor" type="string">
|
||||
<default>#ff00ff</default>
|
||||
</entry>
|
||||
<entry name="batTooltip" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="batTooltipColor" type="string">
|
||||
<default>#008800</default>
|
||||
</entry>
|
||||
<entry name="batInTooltipColor" type="string">
|
||||
<default>#880000</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
<group name="Appearance">
|
||||
<!-- appearance -->
|
||||
<entry name="interval" type="int">
|
||||
<default>1000</default>
|
||||
</entry>
|
||||
<entry name="textAlign" type="string">
|
||||
<default>center</default>
|
||||
</entry>
|
||||
<entry name="fontFamily" type="string">
|
||||
<default>Terminus</default>
|
||||
</entry>
|
||||
<entry name="fontSize" type="int">
|
||||
<default>12</default>
|
||||
</entry>
|
||||
<entry name="fontColor" type="string">
|
||||
<default>#000000</default>
|
||||
</entry>
|
||||
<entry name="fontWeight" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="fontStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
@ -1,99 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: aboutPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
QtControls.TabView {
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
QtControls.Tab {
|
||||
title: i18n("About")
|
||||
|
||||
QtLayouts.ColumnLayout {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: AWActions.getAboutText("header")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("description")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("links")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
font.capitalization: Font.SmallCaps
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("copy")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Tab {
|
||||
title: i18n("Acknowledgment")
|
||||
|
||||
QtLayouts.ColumnLayout {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: AWActions.getAboutText("translators")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
textFormat: Text.RichText
|
||||
text: AWActions.getAboutText("3rdparty")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[about::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,290 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: advancedPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant settings: {
|
||||
"customTime": plasmoid.configuration.customTime,
|
||||
"customUptime": plasmoid.configuration.customUptime,
|
||||
"tempUnits": plasmoid.configuration.tempUnits,
|
||||
"acOnline": plasmoid.configuration.acOnline,
|
||||
"acOffline": plasmoid.configuration.acOffline
|
||||
}
|
||||
property variant tooltipSettings: {
|
||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||
"memTooltip": plasmoid.configuration.memTooltip,
|
||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||
"downTooltip": plasmoid.configuration.downTooltip,
|
||||
"upTooltip": plasmoid.configuration.downTooltip,
|
||||
"batTooltip": plasmoid.configuration.batTooltip,
|
||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
|
||||
property alias cfg_notify: notify.checked
|
||||
property alias cfg_background: background.checked
|
||||
property alias cfg_customTime: customTime.text
|
||||
property alias cfg_customUptime: customUptime.text
|
||||
property string cfg_tempUnits: tempUnits.currentText
|
||||
property alias cfg_acOnline: acOnline.text
|
||||
property alias cfg_acOffline: acOffline.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.heigth
|
||||
width: parent.width * 2 / 5
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: notify
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Enable notifications")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.heigth
|
||||
width: parent.width * 2 / 5
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: background
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Enable background")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Custom time format")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: customTime
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.customTime
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Custom uptime format")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: customUptime
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.customUptime
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Temperature units")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: tempUnits
|
||||
width: parent.width * 3 / 5
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("Celsius"),
|
||||
'name': "Celsius"
|
||||
},
|
||||
{
|
||||
'label': i18n("Fahrenheit"),
|
||||
'name': "Fahrenheit"
|
||||
},
|
||||
{
|
||||
'label': i18n("Kelvin"),
|
||||
'name': "Kelvin"
|
||||
},
|
||||
{
|
||||
'label': i18n("Reaumur"),
|
||||
'name': "Reaumur"
|
||||
},
|
||||
{
|
||||
'label': i18n("cm^-1"),
|
||||
'name': "cm^-1"
|
||||
},
|
||||
{
|
||||
'label': i18n("kJ/mol"),
|
||||
'name': "kJ/mol"
|
||||
},
|
||||
{
|
||||
'label': i18n("kcal/mol"),
|
||||
'name': "kcal/mol"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_tempUnits = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.tempUnits) {
|
||||
tempUnits.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("AC online tag")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: acOnline
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.acOnline
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("AC offline tag")
|
||||
}
|
||||
QtControls.TextField {
|
||||
id: acOffline
|
||||
width: parent.width * 3 / 5
|
||||
text: plasmoid.configuration.acOffline
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Bars")
|
||||
}
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit bars")
|
||||
onClicked: AWKeys.editItem("graphicalitem")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// we need to initializate DataEngines here too
|
||||
// because we need to get keys and values
|
||||
PlasmaCore.DataSource {
|
||||
id: systemmonitorDE
|
||||
engine: "systemmonitor"
|
||||
connectedSources: systemmonitorDE.sources
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: extsysmonDE
|
||||
engine: "extsysmon"
|
||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: timeDE
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[advanced::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[advanced::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||
}
|
||||
}
|
@ -1,239 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: appearancePage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
63: 3,
|
||||
75: 4,
|
||||
87: 5
|
||||
}
|
||||
|
||||
property alias cfg_interval: update.value
|
||||
property alias cfg_fontFamily: selectFont.text
|
||||
property alias cfg_fontSize: fontSize.value
|
||||
property string cfg_fontWeight: fontWeight.currentText
|
||||
property string cfg_fontStyle: fontStyle.currentText
|
||||
property alias cfg_fontColor: selectColor.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Time interval")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: update
|
||||
width: parent.width * 2 / 3
|
||||
minimumValue: 1000
|
||||
maximumValue: 10000
|
||||
stepSize: 500
|
||||
value: plasmoid.configuration.interval
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.fontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font size")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: fontSize
|
||||
width: parent.width * 2 / 3
|
||||
minimumValue: 8
|
||||
maximumValue: 32
|
||||
stepSize: 1
|
||||
value: plasmoid.configuration.fontSize
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font weight")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontWeight
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("light"),
|
||||
'name': "light"
|
||||
},
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("demi bold"),
|
||||
'name': "demibold"
|
||||
},
|
||||
{
|
||||
'label': i18n("bold"),
|
||||
'name': "bold"
|
||||
},
|
||||
{
|
||||
'label': i18n("black"),
|
||||
'name': "black"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
|
||||
fontWeight.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font style")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontStyle
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("italic"),
|
||||
'name': "italic"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
|
||||
fontStyle.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectColor
|
||||
width: parent.width * 2 / 3
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.fontColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.fontColor
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: colorDialog
|
||||
title: i18n("Select a color")
|
||||
color: selectColor.text
|
||||
onAccepted: selectColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[appearance::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,271 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.0 as QtControls
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: dataenginePage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant tooltipSettings: {
|
||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||
"memTooltip": plasmoid.configuration.memTooltip,
|
||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||
"downTooltip": plasmoid.configuration.downTooltip,
|
||||
"upTooltip": plasmoid.configuration.downTooltip,
|
||||
"batTooltip": plasmoid.configuration.batTooltip,
|
||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
|
||||
property variant cfg_dataengine: AWActions.readDataEngineConfiguration()
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("ACPI path")
|
||||
}
|
||||
QtControls.TextField {
|
||||
width: parent.width * 3 / 5
|
||||
text: cfg_dataengine["ACPIPATH"]
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Custom scripts")
|
||||
}
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit scripts")
|
||||
onClicked: AWKeys.editItem("extscript")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("GPU device")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: gpuDev
|
||||
width: parent.width * 3 / 5
|
||||
model: ["auto", "disable", "ati", "nvidia"]
|
||||
onCurrentIndexChanged: cfg_dataengine["GPUDEV"] = gpuDev.currentText
|
||||
Component.onCompleted: {
|
||||
for (var i=0; i<model.length; i++) {
|
||||
if (model[i] == cfg_dataengine["GPUDEV"]) {
|
||||
gpuDev.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("HDD")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: hdd
|
||||
width: parent.width * 3 / 5
|
||||
model: AWKeys.getHddDevices(true)
|
||||
onCurrentIndexChanged: cfg_dataengine["HDDDEV"] = hdd.currentText
|
||||
Component.onCompleted: {
|
||||
for (var i=0; i<model.length; i++) {
|
||||
if (model[i] == cfg_dataengine["HDDDEV"]) {
|
||||
hdd.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("hddtemp cmd")
|
||||
}
|
||||
QtControls.TextField {
|
||||
width: parent.width * 3 / 5
|
||||
text: cfg_dataengine["HDDTEMPCMD"]
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("MPD address")
|
||||
}
|
||||
QtControls.TextField {
|
||||
width: parent.width * 3 / 5
|
||||
text: cfg_dataengine["MPDADDRESS"]
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("MPD port")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
width: parent.width * 3 / 5
|
||||
minimumValue: 1000
|
||||
maximumValue: 65535
|
||||
stepSize: 1
|
||||
value: cfg_dataengine["MPDPORT"]
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("MPRIS player name")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: mpris
|
||||
width: parent.width * 3 / 5
|
||||
editable: true
|
||||
model: ["auto", "amarok", "audacious", "clementine", "deadbeef",
|
||||
"vlc", "qmmp", "xmms2", cfg_dataengine["MPRIS"]]
|
||||
currentIndex: model.length - 1
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Music player")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: player
|
||||
width: parent.width * 3 / 5
|
||||
model: ["mpris", "mpd"]
|
||||
onCurrentIndexChanged: cfg_dataengine["PLAYER"] = model[currentIndex]
|
||||
Component.onCompleted: {
|
||||
for (var i=0; i<model.length; i++) {
|
||||
if (model[i] == cfg_dataengine["PLAYER"]) {
|
||||
player.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Package manager")
|
||||
}
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Edit command")
|
||||
onClicked: AWKeys.editItem("extupgrade")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[dataengine::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
if (debug) console.log("[dataengine::onDestruction]")
|
||||
|
||||
cfg_dataengine["MPRIS"] = mpris.currentText
|
||||
AWActions.writeDataEngineConfiguration(cfg_dataengine)
|
||||
}
|
||||
}
|
@ -1,36 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
pragma Singleton
|
||||
import QtQuick 2.0
|
||||
|
||||
|
||||
QtObject {
|
||||
property variant fontWeight: {
|
||||
"light": Font.Light,
|
||||
"normal": Font.Normal,
|
||||
"demibold": Font.DemiBold,
|
||||
"bold": Font.Bold,
|
||||
"black": Font.Black
|
||||
}
|
||||
property variant align: {
|
||||
"left": Text.AlignLeft,
|
||||
"center": Text.AlignHCenter,
|
||||
"right": Text.AlignRight,
|
||||
"justify": Text.AlignJustify
|
||||
}
|
||||
}
|
@ -1,208 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
import "."
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant settings: {
|
||||
"customTime": plasmoid.configuration.customTime,
|
||||
"customUptime": plasmoid.configuration.customUptime,
|
||||
"tempUnits": plasmoid.configuration.tempUnits,
|
||||
"acOnline": plasmoid.configuration.acOnline,
|
||||
"acOffline": plasmoid.configuration.acOffline
|
||||
}
|
||||
property variant tooltipSettings: {
|
||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||
"tooltipBackground": plasmoid.configuration.tooltipBackground,
|
||||
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||
"memTooltip": plasmoid.configuration.memTooltip,
|
||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||
"downTooltip": plasmoid.configuration.downTooltip,
|
||||
"upTooltip": plasmoid.configuration.downTooltip,
|
||||
"batTooltip": plasmoid.configuration.batTooltip,
|
||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
|
||||
signal needUpdate
|
||||
|
||||
|
||||
// init
|
||||
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||
|
||||
Layout.fillWidth: plasmoid.formFactor != PlasmaCore.Planar
|
||||
Layout.fillHeight: plasmoid.formFactor != PlasmaCore.Planar
|
||||
Layout.minimumHeight: text.contentHeight
|
||||
Layout.minimumWidth: text.contentWidth
|
||||
|
||||
Plasmoid.icon: "utilities-system-monitor"
|
||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||
Plasmoid.associatedApplication: "ksysguard"
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: systemmonitorDE
|
||||
engine: "systemmonitor"
|
||||
connectedSources: systemmonitorDE.sources
|
||||
interval: plasmoid.configuration.interval
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
if (AWKeys.setDataBySource(sourceName, data, settings)) disconnectSource(sourceName)
|
||||
}
|
||||
|
||||
onSourceAdded: {
|
||||
if (debug) console.log("[main::onSourceAdded] : Source " + source)
|
||||
|
||||
AWKeys.addDevice(source)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: extsysmonDE
|
||||
engine: "extsysmon"
|
||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||
interval: plasmoid.configuration.interval
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
if (AWKeys.setDataBySource(sourceName, data, settings)) needUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: timeDE
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 1000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[main::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ui
|
||||
Grid {
|
||||
columns: 1
|
||||
|
||||
Text {
|
||||
id: text
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
horizontalAlignment: general.align[plasmoid.configuration.textAlign]
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
color: plasmoid.configuration.fontColor
|
||||
font.family: plasmoid.configuration.fontFamily
|
||||
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||
font.pointSize: plasmoid.configuration.fontSize
|
||||
font.weight: general.fontWeight[plasmoid.configuration.fontWeight]
|
||||
|
||||
text: plasmoid.configuration.text
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
height: tooltip.height
|
||||
width: tooltip.width
|
||||
mainItem: Text {
|
||||
id: tooltip
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[main::onCompleted]")
|
||||
|
||||
// actions
|
||||
plasmoid.setAction("requestKey", i18n("Request key"), "utilities-system-monitor")
|
||||
plasmoid.setAction("showReadme", i18n("Show README"), "text-x-readme")
|
||||
plasmoid.setAction("checkUpdates", i18n("Check updates"), "system-software-update")
|
||||
// plasmoid.setAction("report", i18n("Mail to developers"), "email")
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(true)
|
||||
}
|
||||
|
||||
onNeedUpdate: {
|
||||
if (debug) console.log("[main::onNeedUpdate]")
|
||||
|
||||
text.text = AWKeys.parsePattern(plasmoid.configuration.text)
|
||||
tooltip.text = AWKeys.toolTipImage()
|
||||
}
|
||||
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings, plasmoid.configuration.notify)
|
||||
}
|
||||
|
||||
function action_checkUpdates() {
|
||||
if (debug) console.log("[main::action_checkUpdates]")
|
||||
|
||||
AWActions.checkUpdates()
|
||||
}
|
||||
|
||||
function action_showReadme() {
|
||||
if (debug) console.log("[main::action_showReadme]")
|
||||
|
||||
AWActions.showReadme()
|
||||
}
|
||||
|
||||
function action_report() {
|
||||
if (debug) console.log("[main::action_report]")
|
||||
|
||||
AWActions.sendEmail()
|
||||
}
|
||||
|
||||
function action_requestKey() {
|
||||
if (debug) console.log("[main::action_requestKey]")
|
||||
|
||||
AWKeys.graphicalValueByKey()
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
singleton general general.qml
|
@ -1,513 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: tooltipPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
|
||||
property alias cfg_tooltipNumber: tooltipNumber.value
|
||||
property alias cfg_useTooltipBackground: useTooltipBackground.checked
|
||||
property alias cfg_tooltipBackground: tooltipBackground.text
|
||||
property alias cfg_cpuTooltip: cpuTooltip.checked
|
||||
property alias cfg_cpuTooltipColor: cpuTooltipColor.text
|
||||
property alias cfg_cpuclTooltip: cpuclTooltip.checked
|
||||
property alias cfg_cpuclTooltipColor: cpuclTooltipColor.text
|
||||
property alias cfg_memTooltip: memTooltip.checked
|
||||
property alias cfg_memTooltipColor: memTooltipColor.text
|
||||
property alias cfg_swapTooltip: swapTooltip.checked
|
||||
property alias cfg_swapTooltipColor: swapTooltipColor.text
|
||||
property alias cfg_downTooltip: downTooltip.checked
|
||||
property alias cfg_downTooltipColor: downTooltipColor.text
|
||||
property alias cfg_upTooltipColor: upTooltipColor.text
|
||||
property alias cfg_batTooltip: batTooltip.checked
|
||||
property alias cfg_batTooltipColor: batTooltipColor.text
|
||||
property alias cfg_batInTooltipColor: batInTooltipColor.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
QtControls.Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("CPU, CPU clock, memory, swap and network labels support graphical tooltip. To enable them just make needed checkbox fully checked.")
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Number of values for tooltips")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: tooltipNumber
|
||||
width: parent.width * 3 / 5
|
||||
minimumValue: 50
|
||||
maximumValue: 1000
|
||||
stepSize: 25
|
||||
value: plasmoid.configuration.tooltipNumber
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - useTooltipBackground.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Background")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: useTooltipBackground
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: tooltipBackground
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.tooltipBackground
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.tooltipBackground
|
||||
onClicked: tooltipBackgroundDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: tooltipBackgroundDialog
|
||||
title: i18n("Select a color")
|
||||
color: tooltipBackground.text
|
||||
onAccepted: tooltipBackground.text = tooltipBackgroundDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - cpuTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("CPU color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: cpuTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: cpuTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.cpuTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.cpuTooltipColor
|
||||
onClicked: cpuTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: cpuTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: cpuTooltipColor.text
|
||||
onAccepted: cpuTooltipColor.text = cpuTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - cpuclTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("CPU clock color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: cpuclTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: cpuclTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.cpuclTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.cpuclTooltipColor
|
||||
onClicked: cpuclTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: cpuclTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: cpuclTooltipColor.text
|
||||
onAccepted: cpuclTooltipColor.text = cpuclTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - memTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Memory color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: memTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: memTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.memTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.memTooltipColor
|
||||
onClicked: memTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: memTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: memTooltipColor.text
|
||||
onAccepted: memTooltipColor.text = memTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - swapTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Swap color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: swapTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: swapTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.swapTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.swapTooltipColor
|
||||
onClicked: swapTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: swapTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: swapTooltipColor.text
|
||||
onAccepted: swapTooltipColor.text = swapTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - downTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Download speed color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: downTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: downTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.downTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.downTooltipColor
|
||||
onClicked: downTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: downTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: downTooltipColor.text
|
||||
onAccepted: downTooltipColor.text = downTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Upload speed color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: upTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.upTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.upTooltipColor
|
||||
onClicked: upTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: upTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: upTooltipColor.text
|
||||
onAccepted: upTooltipColor.text = upTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5 - batTooltip.width
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Battery active color")
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: batTooltip
|
||||
height: parent.height
|
||||
width: implicitWidth
|
||||
style: QtStyles.CheckBoxStyle {
|
||||
indicator: Rectangle {
|
||||
implicitWidth: 16
|
||||
implicitHeight: 16
|
||||
radius: 3
|
||||
border.width: 1
|
||||
border.color: control.activeFocus ? "darkblue" : "gray"
|
||||
Rectangle {
|
||||
visible: control.checked
|
||||
radius: 1
|
||||
anchors.fill: parent
|
||||
anchors.margins: 4
|
||||
color: "#555555"
|
||||
border.color: "#333333"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: batTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.batTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.batTooltipColor
|
||||
onClicked: batTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: batTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: batTooltipColor.text
|
||||
onAccepted: batTooltipColor.text = batTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Battery inactive color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: batInTooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.batInTooltipColor
|
||||
onClicked: batInTooltipColorDialog.visible = true
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: batInTooltipColorDialog
|
||||
title: i18n("Select a color")
|
||||
color: batInTooltipColor.text
|
||||
onAccepted: batInTooltipColor.text = batInTooltipColorDialog.color
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[tooltip::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,306 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: widgetPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant settings: {
|
||||
"customTime": plasmoid.configuration.customTime,
|
||||
"customUptime": plasmoid.configuration.customUptime,
|
||||
"tempUnits": plasmoid.configuration.tempUnits,
|
||||
"acOnline": plasmoid.configuration.acOnline,
|
||||
"acOffline": plasmoid.configuration.acOffline
|
||||
}
|
||||
property variant tooltipSettings: {
|
||||
"tooltipNumber": plasmoid.configuration.tooltipNumber,
|
||||
"useTooltipBackground": plasmoid.configuration.useTooltipBackground,
|
||||
"tooltipBackgroung": plasmoid.configuration.tooltipBackgroung,
|
||||
"cpuTooltip": plasmoid.configuration.cpuTooltip,
|
||||
"cpuclTooltip": plasmoid.configuration.cpuclTooltip,
|
||||
"memTooltip": plasmoid.configuration.memTooltip,
|
||||
"swapTooltip": plasmoid.configuration.swapTooltip,
|
||||
"downTooltip": plasmoid.configuration.downTooltip,
|
||||
"upTooltip": plasmoid.configuration.downTooltip,
|
||||
"batTooltip": plasmoid.configuration.batTooltip,
|
||||
"cpuTooltipColor": plasmoid.configuration.cpuTooltipColor,
|
||||
"cpuclTooltipColor": plasmoid.configuration.cpuclTooltipColor,
|
||||
"memTooltipColor": plasmoid.configuration.memTooltipColor,
|
||||
"swapTooltipColor": plasmoid.configuration.swapTooltipColor,
|
||||
"downTooltipColor": plasmoid.configuration.downTooltipColor,
|
||||
"upTooltipColor": plasmoid.configuration.upTooltipColor,
|
||||
"batTooltipColor": plasmoid.configuration.batTooltipColor,
|
||||
"batInTooltipColor": plasmoid.configuration.batInTooltipColor
|
||||
}
|
||||
|
||||
property alias cfg_text: textPattern.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
QtControls.Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Button {
|
||||
text: i18n("Font")
|
||||
iconName: "font"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Font button")
|
||||
|
||||
var defaultFont = {
|
||||
"color": plasmoid.configuration.fontColor,
|
||||
"family": plasmoid.configuration.fontFamily,
|
||||
"size": plasmoid.configuration.fontSize
|
||||
}
|
||||
var font = AWActions.getFont(defaultFont)
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<span style=\"color:" + font.color +
|
||||
"; font-family:'" + font.family +
|
||||
"'; font-size:" + font.size + "pt;\">" +
|
||||
selected + "</span>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-indent-more"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Indent button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, selected + "<br>\n")
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
iconName: "format-text-bold"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Bold button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<b>" + selected + "</b>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-italic"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Italic button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<i>" + selected + "</i>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-underline"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Underline button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<u>" + selected + "</u>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-strikethrough"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Strike button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<s>" + selected + "</s>")
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-left"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Left button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-center"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Center button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-right"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Right button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-fill"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Justify button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.ComboBox {
|
||||
id: tags
|
||||
width: parent.width - addTagButton.width - showValueButton.width
|
||||
}
|
||||
QtControls.Button {
|
||||
id: addTagButton
|
||||
text: i18n("Add")
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Add tag button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, selected + "$" + tags.currentText)
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: showValueButton
|
||||
text: i18n("Show value")
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||
|
||||
var message = i18n("Tag: %1", tags.currentText)
|
||||
message += "<br>"
|
||||
message += i18n("Value: %1", AWKeys.valueByKey(tags.currentText))
|
||||
message += "<br>"
|
||||
message += i18n("Info: %1", AWKeys.infoByKey(tags.currentText))
|
||||
AWActions.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.TextArea {
|
||||
id: textPattern
|
||||
width: parent.width
|
||||
textFormat: TextEdit.PlainText
|
||||
text: plasmoid.configuration.text
|
||||
}
|
||||
}
|
||||
|
||||
// we need to initializate DataEngines here too
|
||||
// because we need to get keys and values
|
||||
PlasmaCore.DataSource {
|
||||
id: systemmonitorDE
|
||||
engine: "systemmonitor"
|
||||
connectedSources: systemmonitorDE.sources
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: extsysmonDE
|
||||
engine: "extsysmon"
|
||||
connectedSources: ["battery", "custom", "desktop", "netdev", "gpu",
|
||||
"gputemp", "hddtemp", "pkg", "player", "ps", "update"]
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
PlasmaCore.DataSource {
|
||||
id: timeDE
|
||||
engine: "time"
|
||||
connectedSources: ["Local"]
|
||||
interval: 5000
|
||||
|
||||
onNewData: {
|
||||
if (debug) console.log("[widget::onNewData] : Update source " + sourceName)
|
||||
|
||||
AWKeys.setDataBySource(sourceName, data, settings)
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[widget::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
AWKeys.initKeys(plasmoid.configuration.text, tooltipSettings)
|
||||
tags.model = AWKeys.dictKeys()
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
set (PLUGIN_NAME awplugin)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR})
|
||||
set (Kf5_LIBRARIES KF5::I18n
|
||||
KF5::Notifications)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
../../extsysmon
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../../extsysmon
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
file (GLOB SUBPROJECT_UI *.ui)
|
||||
# task source is required by extscripts
|
||||
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)
|
||||
set (SUBPROJECT_DESKTOPS ${CMAKE_CURRENT_SOURCE_DIR}/desktops)
|
||||
|
||||
qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER})
|
||||
qt5_wrap_ui (SUBPROJECT_UI_HEADER ${SUBPROJECT_UI})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${SUBPROJECT_UI_HEADER} ${TASK_MOC_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/awesomewidget)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_DESKTOPS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
@ -1,251 +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 "awactions.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QProcess>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "extscript.h"
|
||||
#include "graphicalitem.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
AWActions::AWActions(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
}
|
||||
|
||||
|
||||
AWActions::~AWActions()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
void AWActions::checkUpdates()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
|
||||
connect(manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(versionReplyRecieved(QNetworkReply *)));
|
||||
|
||||
manager->get(QNetworkRequest(QUrl(VERSION_API)));
|
||||
}
|
||||
|
||||
|
||||
void AWActions::runCmd(const QString cmd)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Cmd" << cmd;
|
||||
|
||||
QProcess command;
|
||||
sendNotification(QString("Info"), i18n("Run %1", cmd));
|
||||
|
||||
command.startDetached(cmd);
|
||||
}
|
||||
|
||||
|
||||
void AWActions::sendEmail()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showReadme()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QDesktopServices::openUrl(QString(HOMEPAGE));
|
||||
}
|
||||
|
||||
|
||||
QString AWActions::getAboutText(const QString type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||
|
||||
QString text;
|
||||
if (type == QString("header"))
|
||||
text = QString(NAME);
|
||||
else if (type == QString("description"))
|
||||
text = i18n("A set of minimalistic plasmoid widgets");
|
||||
else if (type == QString("links"))
|
||||
text = i18n("Links:") + QString("<br>") +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
|
||||
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
|
||||
else if (type == QString("copy"))
|
||||
text = QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>");
|
||||
else if (type == QString("translators"))
|
||||
text = i18n("Translators: %1", QString(TRANSLATORS));
|
||||
else if (type == QString("3rdparty")) {
|
||||
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<trdPartyList.count(); i++)
|
||||
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> AWActions::getFont(const QMap<QString, QVariant> defaultFont)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QVariant> fontMap;
|
||||
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||
defaultFont[QString("size")].toInt(),
|
||||
400, false, defaultFont[QString("color")].toString());
|
||||
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont,
|
||||
false, false);
|
||||
fontMap[QString("color")] = font.color().name();
|
||||
fontMap[QString("family")] = font.family();
|
||||
fontMap[QString("size")] = font.pointSize();
|
||||
|
||||
return fontMap;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> AWActions::readDataEngineConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-extsysmon.conf"));
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QMap<QString, QVariant> configuration;
|
||||
|
||||
settings.beginGroup(QString("Configuration"));
|
||||
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/"));
|
||||
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto"));
|
||||
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all"));
|
||||
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo hddtemp"));
|
||||
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost"));
|
||||
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600"));
|
||||
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto"));
|
||||
configuration[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris"));
|
||||
settings.endGroup();
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
|
||||
void AWActions::writeDataEngineConfiguration(const QMap<QString, QVariant> configuration)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/plasma-dataengine-extsysmon.conf");
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
settings.beginGroup(QString("Configuration"));
|
||||
settings.setValue(QString("ACPIPATH"), configuration[QString("ACPIPATH")]);
|
||||
settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]);
|
||||
settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]);
|
||||
settings.setValue(QString("HDDTEMPCMD"), configuration[QString("HDDTEMPCMD")]);
|
||||
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]);
|
||||
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
|
||||
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
|
||||
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
|
||||
settings.endGroup();
|
||||
|
||||
settings.sync();
|
||||
}
|
||||
|
||||
|
||||
void AWActions::sendNotification(const QString eventId, const QString message, const bool enablePopup)
|
||||
{
|
||||
if ((eventId == QString("event")) && (!enablePopup)) return;
|
||||
|
||||
KNotification *notification = KNotification::event(eventId, QString("Awesome Widget ::: ") + eventId, message);
|
||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget"));
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showUpdates(QString version)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString text;
|
||||
text += i18n("Current version : %1", QString(VERSION)) + QString("\n");
|
||||
text += i18n("New version : %1", version) + QString("\n\n");
|
||||
text += i18n("Click \"Ok\" to download");
|
||||
|
||||
int select = QMessageBox::information(0, i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel);
|
||||
switch (select) {
|
||||
case QMessageBox::Ok:
|
||||
QDesktopServices::openUrl(QString(RELEASES) + version);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AWActions::versionReplyRecieved(QNetworkReply *reply)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString answer = reply->readAll();
|
||||
if (!answer.contains(QString("tag_name"))) return;
|
||||
QString version = QString(VERSION);
|
||||
if (debug) qDebug() << PDEBUG << answer;
|
||||
for (int i=0; i<answer.split(QString("tag_name")).count(); i++) {
|
||||
version = answer.split(QString("tag_name"))[1].split(QChar(','))[0];
|
||||
version.remove(QChar('"'));
|
||||
version.remove(QChar(':'));
|
||||
version.remove(QString("V."));
|
||||
break;
|
||||
}
|
||||
|
||||
int old_major = QString(VERSION).split(QChar('.'))[0].toInt();
|
||||
int old_minor = QString(VERSION).split(QChar('.'))[1].toInt();
|
||||
int old_patch = QString(VERSION).split(QChar('.'))[2].toInt();
|
||||
int new_major = QString(version).split(QChar('.'))[0].toInt();
|
||||
int new_minor = QString(version).split(QChar('.'))[1].toInt();
|
||||
int new_patch = QString(version).split(QChar('.'))[2].toInt();
|
||||
if ((old_major < new_major) ||
|
||||
((old_major == new_major) && (old_minor < new_minor)) ||
|
||||
((old_major == new_major) && (old_minor == new_minor) && (old_patch < new_patch)))
|
||||
showUpdates(version);
|
||||
}
|
@ -1,61 +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 AWACTIONS_H
|
||||
#define AWACTIONS_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class QNetworkReply;
|
||||
|
||||
class AWActions : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AWActions(QObject *parent = 0);
|
||||
~AWActions();
|
||||
|
||||
Q_INVOKABLE void checkUpdates();
|
||||
Q_INVOKABLE void runCmd(const QString cmd = QString("/usr/bin/true"));
|
||||
Q_INVOKABLE void sendEmail();
|
||||
Q_INVOKABLE void showReadme();
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
||||
// dataengine
|
||||
Q_INVOKABLE QMap<QString, QVariant> readDataEngineConfiguration();
|
||||
Q_INVOKABLE void writeDataEngineConfiguration(const QMap<QString, QVariant> configuration);
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message, const bool enablePopup = false);
|
||||
|
||||
private slots:
|
||||
void showUpdates(QString version);
|
||||
void versionReplyRecieved(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
// variables
|
||||
bool debug = false;
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWACTIONS_H */
|
@ -1,50 +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 "awesomewidget.h"
|
||||
|
||||
#include <QtQml>
|
||||
|
||||
#include "awactions.h"
|
||||
#include "awkeys.h"
|
||||
|
||||
|
||||
static QObject *awactions_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new AWActions();
|
||||
}
|
||||
|
||||
|
||||
static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new AWKeys();
|
||||
}
|
||||
|
||||
|
||||
void AWPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget"));
|
||||
|
||||
qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider);
|
||||
qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider);
|
||||
}
|
@ -1,37 +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 AWPLUGIN_H
|
||||
#define AWPLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
|
||||
class QQmlEngine;
|
||||
|
||||
class AWPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWPLUGIN_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,121 +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 AWKEYS_H
|
||||
#define AWKEYS_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QListWidget>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QPushButton>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class AWToolTip;
|
||||
class ExtScript;
|
||||
class ExtUpgrade;
|
||||
class GraphicalItem;
|
||||
|
||||
class AWKeys : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum RequestedItem {
|
||||
Nothing,
|
||||
RequestedGraphicalItem,
|
||||
RequestedExtScript,
|
||||
RequestedExtUpgrade
|
||||
};
|
||||
|
||||
public:
|
||||
AWKeys(QObject *parent = 0);
|
||||
~AWKeys();
|
||||
|
||||
Q_INVOKABLE void initKeys(const QString pattern,
|
||||
const QMap<QString, QVariant> tooltipParams,
|
||||
const bool popup = false);
|
||||
Q_INVOKABLE bool isDebugEnabled();
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern);
|
||||
Q_INVOKABLE QString toolTipImage();
|
||||
Q_INVOKABLE QSize toolTipSize();
|
||||
// keys
|
||||
Q_INVOKABLE bool addDevice(const QString source);
|
||||
Q_INVOKABLE QStringList dictKeys();
|
||||
Q_INVOKABLE QStringList getDiskDevices();
|
||||
Q_INVOKABLE QStringList getFanDevices();
|
||||
Q_INVOKABLE QStringList getHddDevices(const bool needAbstract = false);
|
||||
Q_INVOKABLE QStringList getMountDevices();
|
||||
Q_INVOKABLE QStringList getNetworkDevices();
|
||||
Q_INVOKABLE QStringList getTempDevices();
|
||||
Q_INVOKABLE bool setDataBySource(const QString sourceName,
|
||||
const QMap<QString, QVariant> data,
|
||||
const QMap<QString, QVariant> params);
|
||||
// values
|
||||
Q_INVOKABLE void graphicalValueByKey();
|
||||
Q_INVOKABLE QString infoByKey(QString key);
|
||||
Q_INVOKABLE QString valueByKey(QString key);
|
||||
// configuration
|
||||
Q_INVOKABLE void editItem(const QString type);
|
||||
|
||||
private slots:
|
||||
void editItemButtonPressed(QAbstractButton *button);
|
||||
void copyBar(const QString original);
|
||||
void copyScript(const QString original);
|
||||
void copyUpgrade(const QString original);
|
||||
|
||||
private:
|
||||
// methods
|
||||
bool checkKeys(const QMap<QString, QVariant> data);
|
||||
QString networkDevice();
|
||||
int numberCpus();
|
||||
float temperature(const float temp, const QString units = QString("Celsius"));
|
||||
// find methods
|
||||
QStringList findGraphicalItems(const QString pattern);
|
||||
QStringList findKeys(const QString pattern);
|
||||
// get methods
|
||||
QList<ExtScript *> getExtScripts();
|
||||
QList<ExtUpgrade *> getExtUpgrade();
|
||||
QList<GraphicalItem *> getGraphicalItems();
|
||||
GraphicalItem *getItemByTag(const QString tag);
|
||||
QStringList getTimeKeys();
|
||||
AWToolTip *toolTip = nullptr;
|
||||
// graphical elements
|
||||
QDialog *dialog = nullptr;
|
||||
QListWidget *widgetDialog = nullptr;
|
||||
QDialogButtonBox *dialogButtons = nullptr;
|
||||
QPushButton *copyButton = nullptr;
|
||||
QPushButton *createButton = nullptr;
|
||||
QPushButton *deleteButton = nullptr;
|
||||
RequestedItem requestedItem = Nothing;
|
||||
// variables
|
||||
bool debug = false;
|
||||
bool enablePopup = false;
|
||||
bool ready = false;
|
||||
QList<GraphicalItem *> graphicalItems;
|
||||
QList<ExtScript *> extScripts;
|
||||
QList<ExtUpgrade *> extUpgrade;
|
||||
QStringList foundBars, foundKeys, keys;
|
||||
QMap<QString, QString> values;
|
||||
QStringList diskDevices, fanDevices, mountDevices, tempDevices;
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWKEYS_H */
|
@ -1,155 +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 "awtooltip.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QProcessEnvironment>
|
||||
#include <math.h>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
|
||||
AWToolTip::AWToolTip(QObject *parent,
|
||||
QMap<QString, QVariant> settings)
|
||||
: QObject(parent),
|
||||
configuration(settings)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
|
||||
toolTipScene = new QGraphicsScene();
|
||||
toolTipView = new QGraphicsView(toolTipScene);
|
||||
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
counts += configuration[QString("cpuTooltip")].toInt();
|
||||
counts += configuration[QString("cpuclTooltip")].toInt();
|
||||
counts += configuration[QString("memTooltip")].toInt();
|
||||
counts += configuration[QString("swapTooltip")].toInt();
|
||||
counts += configuration[QString("downTooltip")].toInt();
|
||||
counts += configuration[QString("batTooltip")].toInt();
|
||||
|
||||
boundaries[QString("cpuTooltip")] = 100.0;
|
||||
boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||
boundaries[QString("memTooltip")] = 100.0;
|
||||
boundaries[QString("swapTooltip")] = 100.0;
|
||||
boundaries[QString("downTooltip")] = 1.0;
|
||||
boundaries[QString("upTooltip")] = 1.0;
|
||||
boundaries[QString("batTooltip")] = 100.0;
|
||||
size.setHeight(105.0);
|
||||
size.setWidth(100.0 * counts);
|
||||
|
||||
if (configuration[QString("cpuTooltip")].toBool()) requiredKeys.append(QString("cpuTooltip"));
|
||||
if (configuration[QString("cpuclTooltip")].toBool()) requiredKeys.append(QString("cpuclTooltip"));
|
||||
if (configuration[QString("memTooltip")].toBool()) requiredKeys.append(QString("memTooltip"));
|
||||
if (configuration[QString("swapTooltip")].toBool()) requiredKeys.append(QString("swapTooltip"));
|
||||
if (configuration[QString("downTooltip")].toBool()) requiredKeys.append(QString("downTooltip"));
|
||||
if (configuration[QString("upTooltip")].toBool()) requiredKeys.append(QString("upTooltip"));
|
||||
if (configuration[QString("batTooltip")].toBool()) requiredKeys.append(QString("batTooltip"));
|
||||
}
|
||||
|
||||
|
||||
AWToolTip::~AWToolTip()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete toolTipView;
|
||||
delete toolTipScene;
|
||||
}
|
||||
|
||||
|
||||
QSize AWToolTip::getSize()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
QPixmap AWToolTip::image()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
toolTipView->resize(size);
|
||||
// create image
|
||||
toolTipScene->clear();
|
||||
QPen pen = QPen();
|
||||
// background
|
||||
if (configuration[QString("useTooltipBackground")].toBool())
|
||||
toolTipScene->setBackgroundBrush(QBrush(QColor(configuration[QString("tooltipBackground")].toString())));
|
||||
else
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
bool down = false;
|
||||
for (int i=0; i<requiredKeys.count(); i++) {
|
||||
float normX = 100.0 / static_cast<float>(data[requiredKeys[i]].count());
|
||||
float normY = 100.0 / (1.5 * boundaries[requiredKeys[i]]);
|
||||
if (requiredKeys[i] != QString("batTooltip"))
|
||||
pen.setColor(QColor(configuration[requiredKeys[i] + QString("Color")].toString()));
|
||||
float shift = i * 100.0;
|
||||
if (down) shift -= 100.0;
|
||||
for (int j=0; j<data[requiredKeys[i]].count()-1; j++) {
|
||||
float x1 = j * normX + shift;
|
||||
float y1 = - fabs(data[requiredKeys[i]][j]) * normY + 5.0;
|
||||
float x2 = (j + 1) * normX + shift;
|
||||
float y2 = - fabs(data[requiredKeys[i]][j+1]) * normY + 5.0;
|
||||
if (requiredKeys[i] == QString("batTooltip")) {
|
||||
if (data[requiredKeys[i]][j+1] > 0)
|
||||
pen.setColor(QColor(configuration[QString("batTooltipColor")].toString()));
|
||||
else
|
||||
pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString()));
|
||||
}
|
||||
toolTipScene->addLine(x1, y1, x2, y2, pen);
|
||||
}
|
||||
if (requiredKeys[i] == QString("downTooltip")) down = true;
|
||||
}
|
||||
|
||||
return toolTipView->grab();
|
||||
}
|
||||
|
||||
|
||||
void AWToolTip::setData(const QString source, float value, const bool ac)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
if (data[source].count() == 0)
|
||||
data[source].append(0.0);
|
||||
else if (data[source].count() > configuration[QString("tooltipNumber")].toInt())
|
||||
data[source].takeFirst();
|
||||
if (isnan(value)) value = 0.0;
|
||||
|
||||
if (ac)
|
||||
data[source].append(value);
|
||||
else
|
||||
data[source].append(-value);
|
||||
|
||||
if ((source == QString("downTooltip")) || (source == QString("upTooltip"))) {
|
||||
for (int i=0; i<data[QString("downTooltip")].count(); i++)
|
||||
if (boundaries[QString("downTooltip")] < data[QString("downTooltip")][i])
|
||||
boundaries[QString("downTooltip")] = data[QString("downTooltip")][i];
|
||||
for (int i=0; i<data[QString("upTooltip")].count(); i++)
|
||||
if (boundaries[QString("downTooltip")] < data[QString("upTooltip")][i])
|
||||
boundaries[QString("downTooltip")] = data[QString("upTooltip")][i];
|
||||
boundaries[QString("downTooltip")] *= 1.2;
|
||||
boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")];
|
||||
}
|
||||
}
|
@ -1,59 +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 AWTOOLTIP_H
|
||||
#define AWTOOLTIP_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QPixmap>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class AWToolTip : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AWToolTip(QObject *parent = 0,
|
||||
QMap<QString, QVariant> settings = QMap<QString, QVariant>());
|
||||
~AWToolTip();
|
||||
|
||||
QSize getSize();
|
||||
QPixmap image();
|
||||
void setData(const QString source, float value,
|
||||
const bool ac = true);
|
||||
|
||||
private:
|
||||
// ui
|
||||
QGraphicsScene *toolTipScene = nullptr;
|
||||
QGraphicsView *toolTipView = nullptr;
|
||||
// variables
|
||||
bool debug = false;
|
||||
int counts = 0;
|
||||
QMap<QString, QVariant> configuration;
|
||||
QMap<QString, float> boundaries;
|
||||
QMap<QString, QList<float>> data;
|
||||
QStringList requiredKeys;
|
||||
QSize size;
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWTOOLTIP_H */
|
@ -1,12 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=bar3
|
||||
Comment=Simple bat bar
|
||||
X-AW-Value=bat
|
||||
X-AW-ActiveColor="0,0,0,255"
|
||||
X-AW-InactiveColor="255,255,255,255"
|
||||
X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
@ -1,12 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=bar0
|
||||
Comment=Simple cpu bar
|
||||
X-AW-Value=cpu
|
||||
X-AW-ActiveColor="0,0,0,255"
|
||||
X-AW-InactiveColor="255,255,255,255"
|
||||
X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
@ -1,12 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=bar1
|
||||
Comment=Simple mem bar
|
||||
X-AW-Value=mem
|
||||
X-AW-ActiveColor="0,0,0,255"
|
||||
X-AW-InactiveColor="255,255,255,255"
|
||||
X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
@ -1,12 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=bar2
|
||||
Comment=Simple swap bar
|
||||
X-AW-Value=swap
|
||||
X-AW-ActiveColor="0,0,0,255"
|
||||
X-AW-InactiveColor="255,255,255,255"
|
||||
X-AW-Type=Horizontal
|
||||
X-AW-Direction=LeftToRight
|
||||
X-AW-Height=25
|
||||
X-AW-Width=100
|
||||
X-AW-ApiVersion=1
|
@ -1,25 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
# name should be barN and uniq
|
||||
Name=bar100500
|
||||
Comment=Template for the AW bars
|
||||
# value to show. Supported types are
|
||||
# cpu, cpu[0-9], mem, swap, bat
|
||||
X-AW-Value=cpu
|
||||
# active color, RGBA
|
||||
# you should use double quotes
|
||||
X-AW-ActiveColor="0,0,0,255"
|
||||
# inactive color, RGBA
|
||||
# you should use double quotes
|
||||
X-AW-InactiveColor="255,255,255,255"
|
||||
# bar type. Supported types are
|
||||
# Horizontal, Vertical, Circle
|
||||
X-AW-Type=Horizontal
|
||||
# direction. LeftToRight or RightToLeft
|
||||
X-AW-Direction=LeftToRight
|
||||
# height in pixels
|
||||
X-AW-Height=25
|
||||
# width in pixels
|
||||
X-AW-Width=100
|
||||
# API version
|
||||
X-AW-ApiVersion=1
|
@ -1,525 +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 <KI18n/KLocalizedString>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QColorDialog>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QSettings>
|
||||
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, const QStringList directories, const bool debugCmd)
|
||||
: QDialog(parent),
|
||||
m_fileName(desktopName),
|
||||
m_dirs(directories),
|
||||
debug(debugCmd),
|
||||
ui(new Ui::GraphicalItem)
|
||||
{
|
||||
readConfiguration();
|
||||
|
||||
ui->setupUi(this);
|
||||
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor()));
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::~GraphicalItem()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::image(const float value)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Value" << value;
|
||||
if (m_bar == QString("none")) return QString("");
|
||||
|
||||
QColor active = stringToColor(m_activeColor);
|
||||
QColor inactive = stringToColor(m_inactiveColor);
|
||||
float percent = value / 100.0;
|
||||
int scale[2] = {1, 1};
|
||||
QPen pen = QPen();
|
||||
QGraphicsScene *scene = new QGraphicsScene();
|
||||
scene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
QGraphicsView *view = new QGraphicsView(scene);
|
||||
view->setStyleSheet(QString("background: transparent"));
|
||||
view->setContentsMargins(0, 0, 0, 0);
|
||||
view->setFrameShape(QFrame::NoFrame);
|
||||
view->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
view->resize(m_width + 5.0, m_height + 5.0);
|
||||
|
||||
// paint
|
||||
switch (m_type) {
|
||||
case Vertical:
|
||||
pen.setWidth(m_width);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
scene->addLine(0.5 * m_width, -0.5 * m_width, 0.5 * m_width,
|
||||
(1.0 - percent) * m_height - 0.5 * m_width, pen);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
scene->addLine(0.5 * m_width, (1.0 - percent) * m_height + 0.5 * m_width,
|
||||
0.5 * m_width, m_height + 0.5 * m_width, pen);
|
||||
// scale
|
||||
scale[1] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
case Circle:
|
||||
QGraphicsEllipseItem *circle;
|
||||
pen.setWidth(1.0);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(inactive, Qt::SolidPattern));
|
||||
circle->setSpanAngle(- (1.0 - percent) * 360.0 * 16.0);
|
||||
circle->setStartAngle(90.0 * 16.0 - percent * 360.0 * 16.0);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
circle = scene->addEllipse(0.0, 0.0, m_width, m_height, pen, QBrush(active, Qt::SolidPattern));
|
||||
circle->setSpanAngle(- percent * 360.0 * 16.0);
|
||||
circle->setStartAngle(90.0 * 16.0);
|
||||
// scale
|
||||
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
default:
|
||||
pen.setWidth(m_height);
|
||||
// inactive
|
||||
pen.setColor(inactive);
|
||||
scene->addLine(percent * m_width + 0.5 * m_height, 0.5 * m_height,
|
||||
m_width + 0.5 * m_height, 0.5 * m_height, pen);
|
||||
// active
|
||||
pen.setColor(active);
|
||||
scene->addLine(-0.5 * m_height, 0.5 * m_height,
|
||||
percent * m_width - 0.5 * m_height, 0.5 * m_height, pen);
|
||||
// scale
|
||||
scale[0] = -2 * static_cast<int>(m_direction) + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
// convert
|
||||
QPixmap pixmap = view->grab().transformed(QTransform().scale(scale[0], scale[1]));
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
pixmap.save(&buffer, "PNG");
|
||||
QString url = QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
||||
delete view;
|
||||
delete scene;
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::fileName()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_fileName;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::apiVersion()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_apiVersion;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::name()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_name;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::comment()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_comment;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::bar()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_bar;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::activeColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_activeColor;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::inactiveColor()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_inactiveColor;
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Type GraphicalItem::type()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strType()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString value;
|
||||
switch (m_type) {
|
||||
case Vertical:
|
||||
value = QString("Vertical");
|
||||
break;
|
||||
case Circle:
|
||||
value = QString("Circle");
|
||||
break;
|
||||
default:
|
||||
value = QString("Horizontal");
|
||||
break;
|
||||
}\
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
GraphicalItem::Direction GraphicalItem::direction()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
|
||||
QString GraphicalItem::strDirection()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString value;
|
||||
switch (m_direction) {
|
||||
case RightToLeft:
|
||||
value = QString("RightToLeft");
|
||||
break;
|
||||
default:
|
||||
value = QString("LeftToRight");
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::height()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_height;
|
||||
}
|
||||
|
||||
|
||||
int GraphicalItem::width()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return m_width;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setApiVersion(const int _apiVersion)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Version" << _apiVersion;
|
||||
|
||||
m_apiVersion = _apiVersion;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setName(const QString _name)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Name" << _name;
|
||||
|
||||
m_name = _name;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setComment(const QString _comment)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Comment" << _comment;
|
||||
|
||||
m_comment = _comment;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setBar(const QString _bar)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Bar" << _bar;
|
||||
|
||||
if ((!_bar.contains(QRegExp(QString("cpu(?!cl).*")))) &&
|
||||
(!_bar.contains(QRegExp(QString("gpu")))) &&
|
||||
(!_bar.contains(QRegExp(QString("mem")))) &&
|
||||
(!_bar.contains(QRegExp(QString("swap")))) &&
|
||||
(!_bar.contains(QRegExp(QString("hdd[0-9].*")))) &&
|
||||
(!_bar.contains(QRegExp(QString("bat.*")))))
|
||||
m_bar = QString("none");
|
||||
else
|
||||
m_bar = _bar;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setActiveColor(const QString _color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
|
||||
m_activeColor = _color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setInactiveColor(const QString _color)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Color" << _color;
|
||||
|
||||
m_inactiveColor = _color;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setType(const Type _type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||
|
||||
m_type = _type;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setStrType(const QString _type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << _type;
|
||||
|
||||
if (_type == QString("Vertical"))
|
||||
setType(Vertical);
|
||||
else if (_type == QString("Circle"))
|
||||
setType(Circle);
|
||||
else
|
||||
setType(Horizontal);
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setDirection(const Direction _direction)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||
|
||||
m_direction = _direction;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setStrDirection(const QString _direction)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Direction" << _direction;
|
||||
|
||||
if (_direction == QString("RightToLeft"))
|
||||
setDirection(RightToLeft);
|
||||
else
|
||||
setDirection(LeftToRight);
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setHeight(const int _height)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Height" << _height;
|
||||
if (_height <= 0) return;
|
||||
|
||||
m_height = _height;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::setWidth(const int _width)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Width" << _width;
|
||||
if (_width <= 0) return;
|
||||
|
||||
m_width = _width;
|
||||
}
|
||||
|
||||
|
||||
void GraphicalItem::readConfiguration()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
for (int i=m_dirs.count()-1; i>=0; i--) {
|
||||
if (!QDir(m_dirs[i]).entryList(QDir::Files).contains(m_fileName)) continue;
|
||||
QSettings settings(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,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,24 +0,0 @@
|
||||
[Global]
|
||||
IconName=system
|
||||
Name=Awesome Widget
|
||||
Comment=Awesome widget notifications
|
||||
|
||||
[info]
|
||||
Name=Information
|
||||
Comment=Information
|
||||
Action=Popup
|
||||
|
||||
[Event/event]
|
||||
Name=Event
|
||||
Comment=Some event occurs
|
||||
Action=Popup
|
||||
|
||||
[Event/system]
|
||||
Name=System information
|
||||
Comment=System information
|
||||
Action=Popup
|
||||
|
||||
[Event/tag]
|
||||
Name=Tag information
|
||||
Comment=Tag information
|
||||
Action=Popup
|
@ -1,3 +0,0 @@
|
||||
module org.kde.plasma.private.awesomewidget
|
||||
|
||||
plugin awplugin
|
@ -1,19 +0,0 @@
|
||||
# set project name
|
||||
set (SUBPROJECT plasma_applet_desktop-panel)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# prepare
|
||||
configure_file (metadata.desktop ${CMAKE_CURRENT_SOURCE_DIR}/package/metadata.desktop)
|
||||
|
||||
find_package (ECM 0.0.12 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core Qml)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma Service WindowSystem)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_subdirectory (plugin)
|
||||
plasma_install_package (package org.kde.plasma.desktoppanel)
|
@ -1,28 +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-ServiceTypes=Plasma/Applet
|
||||
X-Plasma-API=declarativeappletscript
|
||||
X-Plasma-MainScript=ui/main.qml
|
||||
X-Plasma-RemoteLocation=
|
||||
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
|
||||
X-KDE-PluginInfo-Version=@PROJECT_VERSION@
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
X-KDE-PluginInfo-License=GPLv3
|
||||
X-KDE-PluginInfo-EnabledByDefault=true
|
@ -1,53 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
import org.kde.plasma.configuration 2.0
|
||||
|
||||
|
||||
ConfigModel {
|
||||
ConfigCategory {
|
||||
name: i18n("Widget")
|
||||
icon: "utilities-system-monitor"
|
||||
source: "widget.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Advanced")
|
||||
icon: "system-run"
|
||||
source: "advanced.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Active desktop")
|
||||
icon: "preferences-desktop-theme"
|
||||
source: "activeapp.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("Inactive desktop")
|
||||
icon: "preferences-desktop-theme"
|
||||
source: "inactiveapp.qml"
|
||||
}
|
||||
|
||||
ConfigCategory {
|
||||
name: i18n("About")
|
||||
icon: "help-about"
|
||||
source: "about.qml"
|
||||
}
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="Widget">
|
||||
<!-- widget -->
|
||||
<entry name="text" type="string">
|
||||
<default>[$mark$number/$total: $name]</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
<group name="Advanced">
|
||||
<!-- advanced -->
|
||||
<entry name="tooltipType" type="string">
|
||||
<default>windows</default>
|
||||
</entry>
|
||||
<entry name="tooltipWidth" type="int">
|
||||
<default>200</default>
|
||||
</entry>
|
||||
<entry name="tooltipColor" type="string">
|
||||
<default>#ffffff</default>
|
||||
</entry>
|
||||
<entry name="background" type="bool">
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="verticalLayout" type="bool">
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="mark" type="string">
|
||||
<default>¤</default>
|
||||
</entry>
|
||||
<entry name="panels" type="int">
|
||||
<default>-1</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
<group name="Appearance">
|
||||
<!-- appearance -->
|
||||
<entry name="textAlign" type="string">
|
||||
<default>center</default>
|
||||
</entry>
|
||||
<entry name="fontFamily" type="string">
|
||||
<default>Terminus</default>
|
||||
</entry>
|
||||
<entry name="fontSize" type="int">
|
||||
<default>12</default>
|
||||
</entry>
|
||||
<entry name="fontColor" type="string">
|
||||
<default>#000000</default>
|
||||
</entry>
|
||||
<entry name="fontWeight" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="fontStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<!-- current -->
|
||||
<entry name="currentTextAlign" type="string">
|
||||
<default>center</default>
|
||||
</entry>
|
||||
<entry name="currentFontFamily" type="string">
|
||||
<default>Terminus</default>
|
||||
</entry>
|
||||
<entry name="currentFontSize" type="int">
|
||||
<default>12</default>
|
||||
</entry>
|
||||
<entry name="currentFontColor" type="string">
|
||||
<default>#ff0000</default>
|
||||
</entry>
|
||||
<entry name="currentFontWeight" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
<entry name="currentFontStyle" type="string">
|
||||
<default>normal</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
@ -1,99 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.0 as QtLayouts
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: aboutPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
QtControls.TabView {
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
QtControls.Tab {
|
||||
title: i18n("About")
|
||||
|
||||
QtLayouts.ColumnLayout {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: DPAdds.getAboutText("header")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: DPAdds.getAboutText("description")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("links")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
font.capitalization: Font.SmallCaps
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("copy")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Tab {
|
||||
title: i18n("Acknowledgment")
|
||||
|
||||
QtLayouts.ColumnLayout {
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
wrapMode: Text.WordWrap
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
text: DPAdds.getAboutText("translators")
|
||||
}
|
||||
|
||||
QtControls.Label {
|
||||
QtLayouts.Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignJustify
|
||||
textFormat: Text.RichText
|
||||
text: DPAdds.getAboutText("3rdparty")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[about::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,219 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: activeAppearancePage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
63: 3,
|
||||
75: 4,
|
||||
87: 5
|
||||
}
|
||||
|
||||
property alias cfg_currentFontFamily: selectFont.text
|
||||
property alias cfg_currentFontSize: fontSize.value
|
||||
property string cfg_currentFontWeight: fontWeight.currentText
|
||||
property string cfg_currentFontStyle: fontStyle.currentText
|
||||
property alias cfg_currentFontColor: selectColor.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.currentFontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font size")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: fontSize
|
||||
width: parent.width * 2 / 3
|
||||
minimumValue: 8
|
||||
maximumValue: 32
|
||||
stepSize: 1
|
||||
value: plasmoid.configuration.currentFontSize
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font weight")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontWeight
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("light"),
|
||||
'name': "light"
|
||||
},
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("demi bold"),
|
||||
'name': "demibold"
|
||||
},
|
||||
{
|
||||
'label': i18n("bold"),
|
||||
'name': "bold"
|
||||
},
|
||||
{
|
||||
'label': i18n("black"),
|
||||
'name': "black"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_currentFontWeight = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.currentFontWeight) {
|
||||
currentFontWeight.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font style")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontStyle
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("italic"),
|
||||
'name': "italic"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_currentFontStyle = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.currentFontStyle) {
|
||||
currentFontStyle.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectColor
|
||||
width: parent.width * 2 / 3
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.currentFontColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.currentFontColor
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: colorDialog
|
||||
title: i18n("Select a color")
|
||||
color: selectColor.text
|
||||
onAccepted: selectColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[activeapp::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,213 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: advancedPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
|
||||
property string cfg_tooltipType: tooltipType.currentText
|
||||
property alias cfg_tooltipWidth: tooltipWidth.value
|
||||
property alias cfg_tooltipColor: tooltipColor.text
|
||||
property alias cfg_background: background.checked
|
||||
property alias cfg_verticalLayout: verticalLayout.checked
|
||||
property string cfg_mark: mark.currentText
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Tooltip type")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: tooltipType
|
||||
width: parent.width * 3 / 5
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("contours"),
|
||||
'name': "contours"
|
||||
},
|
||||
{
|
||||
'label': i18n("windows"),
|
||||
'name': "windows"
|
||||
},
|
||||
{
|
||||
'label': i18n("clean desktop"),
|
||||
'name': "clean"
|
||||
},
|
||||
{
|
||||
'label': i18n("names"),
|
||||
'name': "names"
|
||||
},
|
||||
{
|
||||
'label': i18n("none"),
|
||||
'name': "none"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_tooltipType = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.tooltipType) {
|
||||
tooltipType.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Tooltip width")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: tooltipWidth
|
||||
width: parent.width * 3 / 5
|
||||
minimumValue: 100
|
||||
maximumValue: 1000
|
||||
stepSize: 50
|
||||
value: plasmoid.configuration.tooltipWidth
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: tooltipColor
|
||||
width: parent.width * 3 / 5
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.tooltipColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.tooltipColor
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.heigth
|
||||
width: parent.width * 2 / 5
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: background
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Enable background")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.heigth
|
||||
width: parent.width * 2 / 5
|
||||
}
|
||||
QtControls.CheckBox {
|
||||
id: verticalLayout
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Vertical layout")
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width * 2 / 5
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Mark")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: mark
|
||||
width: parent.width * 3 / 5
|
||||
editable: true
|
||||
model: ["#", "$", "%", "&", "*", "@", "¤", "¶", "·", "º",
|
||||
plasmoid.configuration.mark]
|
||||
currentIndex: model.length - 1
|
||||
onCurrentIndexChanged: cfg_mark = currentText
|
||||
}
|
||||
}
|
||||
|
||||
// Row {
|
||||
// height: implicitHeight
|
||||
// width: parent.width
|
||||
// QtControls.Label {
|
||||
// height: parent.height
|
||||
// width: parent.width * 2 / 5
|
||||
// horizontalAlignment: Text.AlignRight
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// text: i18n("Panels to be hidden")
|
||||
// }
|
||||
// QtControls.Button {
|
||||
// width: parent.width * 3 / 5
|
||||
// text: i18n("Edit panels")
|
||||
// onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: colorDialog
|
||||
title: i18n("Select a color")
|
||||
color: tooltipColor.text
|
||||
onAccepted: tooltipColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[advanced::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,36 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
pragma Singleton
|
||||
import QtQuick 2.0
|
||||
|
||||
|
||||
QtObject {
|
||||
property variant fontWeight: {
|
||||
"light": Font.Light,
|
||||
"normal": Font.Normal,
|
||||
"demibold": Font.DemiBold,
|
||||
"bold": Font.Bold,
|
||||
"black": Font.Black
|
||||
}
|
||||
property variant align: {
|
||||
"left": Text.AlignLeft,
|
||||
"center": Text.AlignHCenter,
|
||||
"right": Text.AlignRight,
|
||||
"justify": Text.AlignJustify
|
||||
}
|
||||
}
|
@ -1,218 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Controls.Styles 1.3 as QtStyles
|
||||
import QtQuick.Dialogs 1.1 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: inactiveAppearancePage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: AWKeys.isDebugEnabled()
|
||||
property variant weight: {
|
||||
25: 0,
|
||||
50: 1,
|
||||
63: 3,
|
||||
75: 4,
|
||||
87: 5
|
||||
}
|
||||
|
||||
property alias cfg_fontFamily: selectFont.text
|
||||
property alias cfg_fontSize: fontSize.value
|
||||
property string cfg_fontWeight: fontWeight.currentText
|
||||
property string cfg_fontStyle: fontStyle.currentText
|
||||
property alias cfg_fontColor: selectColor.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectFont
|
||||
width: parent.width * 2 / 3
|
||||
text: plasmoid.configuration.fontFamily
|
||||
onClicked: fontDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font size")
|
||||
}
|
||||
QtControls.SpinBox {
|
||||
id: fontSize
|
||||
width: parent.width * 2 / 3
|
||||
minimumValue: 8
|
||||
maximumValue: 32
|
||||
stepSize: 1
|
||||
value: plasmoid.configuration.fontSize
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font weight")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontWeight
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("light"),
|
||||
'name': "light"
|
||||
},
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("demi bold"),
|
||||
'name': "demibold"
|
||||
},
|
||||
{
|
||||
'label': i18n("bold"),
|
||||
'name': "bold"
|
||||
},
|
||||
{
|
||||
'label': i18n("black"),
|
||||
'name': "black"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
|
||||
fontWeight.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font style")
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
id: fontStyle
|
||||
width: parent.width * 2 / 3
|
||||
textRole: "label"
|
||||
model: [
|
||||
{
|
||||
'label': i18n("normal"),
|
||||
'name': "normal"
|
||||
},
|
||||
{
|
||||
'label': i18n("italic"),
|
||||
'name': "italic"
|
||||
}
|
||||
]
|
||||
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
|
||||
Component.onCompleted: {
|
||||
for (var i = 0; i < model.length; i++) {
|
||||
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
|
||||
fontStyle.currentIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Label {
|
||||
height: parent.height
|
||||
width: parent.width / 3
|
||||
horizontalAlignment: Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
text: i18n("Font color")
|
||||
}
|
||||
QtControls.Button {
|
||||
id: selectColor
|
||||
width: parent.width * 2 / 3
|
||||
style: QtStyles.ButtonStyle {
|
||||
background: Rectangle {
|
||||
color: plasmoid.configuration.fontColor
|
||||
}
|
||||
}
|
||||
text: plasmoid.configuration.fontColor
|
||||
onClicked: colorDialog.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.ColorDialog {
|
||||
id: colorDialog
|
||||
title: i18n("Select a color")
|
||||
color: selectColor.text
|
||||
onAccepted: selectColor.text = colorDialog.color
|
||||
}
|
||||
|
||||
QtDialogs.FontDialog {
|
||||
id: fontDialog
|
||||
title: i18n("Select a font")
|
||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||
onAccepted: {
|
||||
selectFont.text = fontDialog.font.family
|
||||
fontSize.value = fontDialog.font.pointSize
|
||||
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
|
||||
fontWeight.currentIndex = weight[fontDialog.font.weight]
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[inactiveapp::onCompleted]")
|
||||
}
|
||||
}
|
@ -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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
import "."
|
||||
|
||||
|
||||
Item {
|
||||
id: main
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
property variant tooltipSettings: {
|
||||
"tooltipColor": plasmoid.configuration.tooltipColor,
|
||||
"tooltipType": plasmoid.configuration.tooltipType,
|
||||
"tooltipWidth": plasmoid.configuration.tooltipWidth
|
||||
}
|
||||
|
||||
signal needUpdate
|
||||
signal needTooltipUpdate
|
||||
|
||||
|
||||
// init
|
||||
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
|
||||
Plasmoid.compactRepresentation: Plasmoid.fullRepresentation
|
||||
|
||||
Plasmoid.icon: "utilities-system-monitor"
|
||||
Plasmoid.backgroundHints: plasmoid.configuration.background ? "DefaultBackground" : "NoBackground"
|
||||
|
||||
|
||||
// ui
|
||||
Grid {
|
||||
columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops()
|
||||
rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
height: implicitHeight
|
||||
width: implicitWidth
|
||||
model: DPAdds.numberOfDesktops()
|
||||
Text {
|
||||
id: text
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
wrapMode: Text.NoWrap
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1)
|
||||
property alias tooltip: tooltip
|
||||
|
||||
MouseArea {
|
||||
hoverEnabled: true
|
||||
anchors.fill: parent
|
||||
onClicked: DPAdds.setCurrentDesktop(index + 1);
|
||||
onEntered: needTooltipUpdate()
|
||||
}
|
||||
|
||||
PlasmaCore.ToolTipArea {
|
||||
height: tooltip.height
|
||||
width: tooltip.width
|
||||
mainItem: Text {
|
||||
id: tooltip
|
||||
height: contentHeight
|
||||
width: contentWidth
|
||||
textFormat: Text.RichText
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: timer
|
||||
interval: 1000
|
||||
onTriggered: needUpdate()
|
||||
}
|
||||
|
||||
onNeedUpdate: {
|
||||
if (debug) console.log("[main::onNeedUpdate]")
|
||||
|
||||
var newHeight = 0
|
||||
var newWidth = 0
|
||||
for (var i=0; i<repeater.count; i++) {
|
||||
if (!repeater.itemAt(i)) {
|
||||
if (debug) console.log("[main::onNeedUpdate] : Nothing to do here " + i)
|
||||
timer.start()
|
||||
return
|
||||
}
|
||||
repeater.itemAt(i).text = DPAdds.parsePattern(plasmoid.configuration.text, i + 1)
|
||||
if (DPAdds.currentDesktop() == i + 1) {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.currentFontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.currentFontSize
|
||||
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.currentFontWeight]
|
||||
} else {
|
||||
repeater.itemAt(i).color = plasmoid.configuration.fontColor
|
||||
repeater.itemAt(i).font.family = plasmoid.configuration.fontFamily
|
||||
repeater.itemAt(i).font.italic = plasmoid.configuration.fontStyle == "italic" ? true : false
|
||||
repeater.itemAt(i).font.pointSize = plasmoid.configuration.fontSize
|
||||
repeater.itemAt(i).font.weight = general.fontWeight[plasmoid.configuration.fontWeight]
|
||||
}
|
||||
repeater.itemAt(i).update()
|
||||
newHeight += repeater.itemAt(i).contentHeight
|
||||
newWidth += repeater.itemAt(i).contentWidth
|
||||
}
|
||||
Layout.minimumHeight = newHeight
|
||||
Layout.minimumWidth = newWidth
|
||||
|
||||
needTooltipUpdate()
|
||||
}
|
||||
|
||||
onNeedTooltipUpdate: {
|
||||
if (debug) console.log("[main::onNeedTooltipUpdate]")
|
||||
|
||||
for (var i=0; i<repeater.count; i++) {
|
||||
repeater.itemAt(i).tooltip.text = DPAdds.toolTipImage(i + 1)
|
||||
}
|
||||
}
|
||||
|
||||
Plasmoid.onActivated: {
|
||||
if (debug) console.log("[main::onActivated]")
|
||||
|
||||
// DPAdds.changePanelsState()
|
||||
}
|
||||
|
||||
Plasmoid.onUserConfiguringChanged: {
|
||||
if (debug) console.log("[main::onUserConfiguringChanged]")
|
||||
|
||||
DPAdds.setMark(plasmoid.configuration.mark)
|
||||
DPAdds.setPanelsToControl(plasmoid.configuration.panels)
|
||||
DPAdds.setToolTipData(tooltipSettings)
|
||||
needUpdate()
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[main::onCompleted]")
|
||||
|
||||
// init submodule
|
||||
Plasmoid.userConfiguringChanged(true)
|
||||
DPAdds.desktopChanged.connect(needUpdate)
|
||||
DPAdds.windowListChanged.connect(needTooltipUpdate)
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
singleton general general.qml
|
@ -1,232 +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/ *
|
||||
***************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
|
||||
import org.kde.plasma.private.desktoppanel 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: widgetPage
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
implicitWidth: pageColumn.implicitWidth
|
||||
implicitHeight: pageColumn.implicitHeight
|
||||
|
||||
property bool debug: DPAdds.isDebugEnabled()
|
||||
|
||||
property alias cfg_text: textPattern.text
|
||||
|
||||
|
||||
Column {
|
||||
id: pageColumn
|
||||
width: units.gridUnit * 25
|
||||
QtControls.Label {
|
||||
width: parent.width
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
wrapMode: Text.WordWrap
|
||||
text: i18n("Detailed information may be found on <a href=\"http://arcanis.name/projects/awesome-widgets/\">project homepage</a>")
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.Button {
|
||||
text: i18n("Font")
|
||||
iconName: "font"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Font button")
|
||||
|
||||
var defaultFont = {
|
||||
"color": plasmoid.configuration.fontColor,
|
||||
"family": plasmoid.configuration.fontFamily,
|
||||
"size": plasmoid.configuration.fontSize
|
||||
}
|
||||
var font = DPAdds.getFont(defaultFont)
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<span style=\"color:" + font.color +
|
||||
"; font-family:'" + font.family +
|
||||
"'; font-size:" + font.size + "pt;\">" +
|
||||
selected + "</span>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-indent-more"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Indent button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, selected + "<br>\n")
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
iconName: "format-text-bold"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Bold button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<b>" + selected + "</b>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-italic"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Italic button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<i>" + selected + "</i>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-underline"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Underline button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<u>" + selected + "</u>")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-text-strikethrough"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Strike button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<s>" + selected + "</s>")
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-left"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Left button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"left\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-center"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Center button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"center\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-right"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Right button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"right\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "format-justify-fill"
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Justify button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
height: implicitHeight
|
||||
width: parent.width
|
||||
QtControls.ComboBox {
|
||||
id: tags
|
||||
width: parent.width - addTagButton.width - showValueButton.width
|
||||
model: DPAdds.dictKeys()
|
||||
}
|
||||
QtControls.Button {
|
||||
id: addTagButton
|
||||
text: i18n("Add")
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Add tag button")
|
||||
|
||||
var pos = textPattern.cursorPosition
|
||||
var selected = textPattern.selectedText
|
||||
textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
|
||||
textPattern.insert(pos, selected + "$" + tags.currentText)
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
id: showValueButton
|
||||
text: i18n("Show value")
|
||||
|
||||
onClicked: {
|
||||
if (debug) console.log("[widget::onClicked] : Show tag button")
|
||||
|
||||
var message = i18n("Tag: %1", tags.currentText)
|
||||
message += "<br>"
|
||||
message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText))
|
||||
DPAdds.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QtControls.TextArea {
|
||||
id: textPattern
|
||||
width: parent.width
|
||||
textFormat: TextEdit.PlainText
|
||||
text: plasmoid.configuration.text
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.log("[widget::onCompleted]")
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
set (PLUGIN_NAME dpplugin)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR}
|
||||
${Plasma_INCLUDE_DIR})
|
||||
set (Kf5_LIBRARIES KF5::I18n
|
||||
KF5::Notifications
|
||||
KF5::Plasma
|
||||
KF5::WindowSystem)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE})
|
||||
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/fontdialog/*.cpp)
|
||||
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_LIBRARIES})
|
||||
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||
install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/desktoppanel)
|
||||
install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${KNOTIFYRC_INSTALL_DIR})
|
@ -1,39 +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 "desktoppanel.h"
|
||||
|
||||
#include <QtQml>
|
||||
|
||||
#include "dpadds.h"
|
||||
|
||||
|
||||
static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new DPAdds();
|
||||
}
|
||||
|
||||
|
||||
void DPPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel"));
|
||||
|
||||
qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider);
|
||||
}
|
@ -1,37 +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 DPPLUGIN_H
|
||||
#define DPPLUGIN_H
|
||||
|
||||
#include <QQmlExtensionPlugin>
|
||||
|
||||
|
||||
class QQmlEngine;
|
||||
|
||||
class DPPlugin : public QQmlExtensionPlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
|
||||
#endif /* DPPLUGIN_H */
|
@ -1,489 +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 "dpadds.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
#include <KWindowSystem/KWindowSystem>
|
||||
|
||||
#include <QBuffer>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsView>
|
||||
#include <QHBoxLayout>
|
||||
#include <QListWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QProcessEnvironment>
|
||||
#include <QScreen>
|
||||
|
||||
#include <fontdialog/fontdialog.h>
|
||||
#include <pdebug/pdebug.h>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
|
||||
DPAdds::DPAdds(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
|
||||
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SLOT(changeDesktop(int)));
|
||||
connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SLOT(changeWindowList(WId)));
|
||||
connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SLOT(changeWindowList(WId)));
|
||||
}
|
||||
|
||||
|
||||
DPAdds::~DPAdds()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
}
|
||||
|
||||
|
||||
bool DPAdds::isDebugEnabled()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::currentDesktop()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return KWindowSystem::currentDesktop();
|
||||
}
|
||||
|
||||
|
||||
QStringList DPAdds::dictKeys()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QStringList allKeys;
|
||||
allKeys.append(QString("mark"));
|
||||
allKeys.append(QString("name"));
|
||||
allKeys.append(QString("number"));
|
||||
allKeys.append(QString("total"));
|
||||
|
||||
return allKeys;
|
||||
}
|
||||
|
||||
|
||||
int DPAdds::numberOfDesktops()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
return KWindowSystem::numberOfDesktops();
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::toolTipImage(const int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
if (tooltipType == QString("none")) return QString();
|
||||
|
||||
// prepare
|
||||
DesktopWindowsInfo info = getInfoByDesktop(desktop);
|
||||
if (tooltipType == QString("names")) {
|
||||
QStringList windowList;
|
||||
for (int i=0; i<info.windowsData.count(); i++)
|
||||
windowList.append(info.windowsData[i].name);
|
||||
return QString("<ul><li>") + windowList.join(QString("</li><li>")) + QString("</li></ul>");
|
||||
}
|
||||
// init
|
||||
QGraphicsScene *toolTipScene = new QGraphicsScene();
|
||||
QGraphicsView *toolTipView = new QGraphicsView(toolTipScene);
|
||||
toolTipView->setStyleSheet(QString("background: transparent"));
|
||||
toolTipView->setContentsMargins(0, 0, 0, 0);
|
||||
toolTipView->setFrameShape(QFrame::NoFrame);
|
||||
toolTipView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
// update
|
||||
float margin = 5.0 * info.desktop.width() / 400.0;
|
||||
toolTipView->resize(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
|
||||
toolTipScene->clear();
|
||||
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
|
||||
// borders
|
||||
toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
|
||||
toolTipScene->addLine(0, info.desktop.height() + 2.0 * margin,
|
||||
info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin);
|
||||
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin,
|
||||
info.desktop.width() + 2.0 * margin, 0);
|
||||
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
|
||||
|
||||
if (tooltipType == QString("contours")) {
|
||||
QPen pen = QPen();
|
||||
pen.setWidthF(2.0 * info.desktop.width() / 400.0);
|
||||
pen.setColor(QColor(tooltipColor));
|
||||
for (int i=0; i<info.windowsData.count(); i++) {
|
||||
QRect rect = info.windowsData[i].rect;
|
||||
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
|
||||
rect.left() + margin, rect.top() + margin, pen);
|
||||
toolTipScene->addLine(rect.left() + margin, rect.top() + margin,
|
||||
rect.right() + margin, rect.top() + margin, pen);
|
||||
toolTipScene->addLine(rect.right() + margin, rect.top() + margin,
|
||||
rect.right() + margin, rect.bottom() + margin, pen);
|
||||
toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin,
|
||||
rect.left() + margin, rect.bottom() + margin, pen);
|
||||
}
|
||||
} else if (tooltipType == QString("clean")) {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||
toolTipScene->addPixmap(desktop)
|
||||
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||
}
|
||||
} else if (tooltipType == QString("windows")) {
|
||||
QScreen *screen = QGuiApplication::primaryScreen();
|
||||
for (int i=0; i<info.desktopsData.count(); i++) {
|
||||
QPixmap desktop = screen->grabWindow(info.desktopsData[i].id);
|
||||
toolTipScene->addPixmap(desktop)
|
||||
->setOffset(info.desktopsData[i].rect.left(), info.desktopsData[i].rect.top());
|
||||
}
|
||||
for (int i=0; i<info.windowsData.count(); i++) {
|
||||
QPixmap window = screen->grabWindow(info.windowsData[i].id);
|
||||
toolTipScene->addPixmap(window)
|
||||
->setOffset(info.windowsData[i].rect.left(), info.windowsData[i].rect.top());
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap image = toolTipView->grab().scaledToWidth(tooltipWidth);
|
||||
QByteArray byteArray;
|
||||
QBuffer buffer(&byteArray);
|
||||
image.save(&buffer, "PNG");
|
||||
|
||||
delete toolTipView;
|
||||
delete toolTipScene;
|
||||
|
||||
return QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64()));
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::parsePattern(const QString pattern, const int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString parsed = pattern;
|
||||
QStringList keys = dictKeys();
|
||||
parsed.replace(QString("$$"), QString("$\\$\\"));
|
||||
for (int i=0; i<keys.count(); i++)
|
||||
parsed.replace(QString("$") + keys[i], valueByKey(keys[i], desktop));
|
||||
parsed.replace(QString(" "), QString(" "));
|
||||
parsed.replace(QString("$\\$\\"), QString("$$"));
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setMark(const QString newMark)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Mark" << newMark;
|
||||
|
||||
mark = newMark;
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setPanelsToControl(const QString newPanels)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Panels" << newPanels;
|
||||
|
||||
panelsToControl.clear();
|
||||
if (newPanels == QString("-1")) {
|
||||
int count = getPanels().count();
|
||||
for (int i=0; i<count; i++)
|
||||
panelsToControl.append(i);
|
||||
} else
|
||||
for (int i=0; i<newPanels.split(QChar(',')).count(); i++)
|
||||
panelsToControl.append(newPanels.split(QChar(','))[i].toInt());
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setToolTipData(const QMap<QString, QVariant> tooltipData)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Data" << tooltipData;
|
||||
|
||||
tooltipColor = tooltipData[QString("tooltipColor")].toString();
|
||||
tooltipType = tooltipData[QString("tooltipType")].toString();
|
||||
tooltipWidth = tooltipData[QString("tooltipWidth")].toInt();
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::valueByKey(const QString key, int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Requested key" << key;
|
||||
if (desktop == -1) desktop = currentDesktop();
|
||||
|
||||
QString currentMark;
|
||||
if (currentDesktop() == desktop)
|
||||
currentMark = mark;
|
||||
else
|
||||
currentMark = QString("");
|
||||
if (key == QString("mark"))
|
||||
return QString("%1").arg(currentMark, mark.count(), QLatin1Char(' '));
|
||||
else if (key == QString("name"))
|
||||
return KWindowSystem::desktopName(desktop);
|
||||
else if (key == QString("number"))
|
||||
return QString::number(desktop);
|
||||
else if (key == QString("total"))
|
||||
return QString::number(numberOfDesktops());
|
||||
else
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::editPanelsToContol(const QString current)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// paint
|
||||
QDialog *dialog = new QDialog(0);
|
||||
QListWidget *widget = new QListWidget(dialog);
|
||||
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close,
|
||||
Qt::Vertical, dialog);
|
||||
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
||||
layout->addWidget(widget);
|
||||
layout->addWidget(buttons);
|
||||
dialog->setLayout(layout);
|
||||
connect(buttons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
connect(buttons, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||
|
||||
// fill
|
||||
QList<Plasma::Containment *> panels = getPanels();
|
||||
for (int i=0; i<panels.count(); i++) {
|
||||
QListWidgetItem *item = new QListWidgetItem(panelLocationToStr(panels[i]->location()), widget);
|
||||
if ((current.split(QChar(',')).contains(QString::number(i))) ||
|
||||
(current == QString("-1")))
|
||||
item->setCheckState(Qt::Checked);
|
||||
else
|
||||
item->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
|
||||
// exec
|
||||
QString value;
|
||||
QStringList indexes;
|
||||
int ret = dialog->exec();
|
||||
switch (ret) {
|
||||
case QDialog::Accepted:
|
||||
for (int i=0; i<widget->count(); i++)
|
||||
if (widget->item(i)->checkState() == Qt::Checked)
|
||||
indexes.append(QString::number(i));
|
||||
if (indexes.count() == widget->count())
|
||||
value = QString("-1");
|
||||
else
|
||||
value = indexes.join(QChar(','));
|
||||
break;
|
||||
default:
|
||||
value = current;
|
||||
break;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::getAboutText(const QString type)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Type" << type;
|
||||
|
||||
QString text;
|
||||
if (type == QString("header"))
|
||||
text = QString(NAME);
|
||||
else if (type == QString("description"))
|
||||
text = i18n("A set of minimalistic plasmoid widgets");
|
||||
else if (type == QString("links"))
|
||||
text = i18n("Links:") + QString("<br>") +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) +
|
||||
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) +
|
||||
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages"));
|
||||
else if (type == QString("copy"))
|
||||
text = QString("<small>© %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) +
|
||||
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>");
|
||||
else if (type == QString("translators"))
|
||||
text = i18n("Translators: %1", QString(TRANSLATORS));
|
||||
else if (type == QString("3rdparty")) {
|
||||
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts);
|
||||
for (int i=0; i<trdPartyList.count(); i++)
|
||||
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
|
||||
.arg(trdPartyList[i].split(QChar(','))[0])
|
||||
.arg(trdPartyList[i].split(QChar(','))[1])
|
||||
.arg(trdPartyList[i].split(QChar(','))[2]);
|
||||
text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
QMap<QString, QVariant> DPAdds::getFont(const QMap<QString, QVariant> defaultFont)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QVariant> fontMap;
|
||||
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
|
||||
defaultFont[QString("size")].toInt(),
|
||||
400, false, defaultFont[QString("color")].toString());
|
||||
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont,
|
||||
false, false);
|
||||
fontMap[QString("color")] = font.color().name();
|
||||
fontMap[QString("family")] = font.family();
|
||||
fontMap[QString("size")] = font.pointSize();
|
||||
|
||||
return fontMap;
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changePanelsState()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (panelsToControl.isEmpty()) return;
|
||||
|
||||
QList<Plasma::Containment *> panels = getPanels();
|
||||
// for (int i=0; i<panels.count(); i++) {
|
||||
// if (!panelsToControl.contains(i)) continue;
|
||||
// bool wasVisible = panels[i]->view()->isVisible();
|
||||
// int winId = panels[i]->view()->winId();
|
||||
// if (wasVisible) {
|
||||
// if (debug) qDebug() << PDEBUG << ":" << "Hide panel";
|
||||
// KWindowInfo oldInfo = KWindowSystem::windowInfo(winId, NET::WMState);
|
||||
// oldState = oldInfo.state();
|
||||
// panels[i]->view()->setVisible(false);
|
||||
// } else {
|
||||
// if (debug) qDebug() << PDEBUG << ":" << "Show panel";
|
||||
// panels[i]->view()->setVisible(true);
|
||||
// KWindowSystem::clearState(winId, NET::KeepAbove);
|
||||
// KWindowSystem::setState(winId, oldState | NET::StaysOnTop);
|
||||
// KWindowSystem::setOnAllDesktops(winId, true);
|
||||
// }
|
||||
// }
|
||||
panels.clear();
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::sendNotification(const QString eventId, const QString message)
|
||||
{
|
||||
KNotification *notification = KNotification::event(eventId, QString("Desktop Panel ::: ") + eventId, message);
|
||||
notification->setComponentName(QString("plasma-applet-org.kde.plasma.desktop-panel"));
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::setCurrentDesktop(const int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
|
||||
KWindowSystem::setCurrentDesktop(desktop);
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changeDesktop(const int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
|
||||
emit(desktopChanged());
|
||||
}
|
||||
|
||||
|
||||
void DPAdds::changeWindowList(const WId window)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Window" << window;
|
||||
|
||||
emit(windowListChanged());
|
||||
}
|
||||
|
||||
|
||||
DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Desktop" << desktop;
|
||||
|
||||
|
||||
DesktopWindowsInfo info;
|
||||
info.desktop = KWindowSystem::workArea(desktop);
|
||||
|
||||
QList<WId> windows = KWindowSystem::windows();
|
||||
for (int i=0; i<windows.count(); i++) {
|
||||
KWindowInfo winInfo = KWindowInfo(windows[i],
|
||||
NET::Property::WMDesktop | NET::Property::WMGeometry |
|
||||
NET::Property::WMState | NET::Property::WMWindowType |
|
||||
NET::Property::WMVisibleName);
|
||||
if (!winInfo.isOnDesktop(desktop)) continue;
|
||||
WindowData data;
|
||||
data.id = windows[i];
|
||||
data.name = winInfo.visibleName();
|
||||
data.rect = winInfo.geometry();
|
||||
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) {
|
||||
if (winInfo.isMinimized()) continue;
|
||||
info.windowsData.append(data);
|
||||
} else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask) == NET::WindowType::Desktop) {
|
||||
info.desktopsData.append(data);
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
QList<Plasma::Containment *> DPAdds::getPanels()
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
// Plasma::Corona *corona = new Plasma::Corona(this);
|
||||
QList<Plasma::Containment *> panels;
|
||||
// for (int i=0; i<corona->containments().count(); i++)
|
||||
// if (corona->containments()[i]->containmentType() == Plasma::Types::ContainmentType::PanelContainment)
|
||||
// panels.append(corona->containments()[i]);
|
||||
// delete corona;
|
||||
|
||||
return panels;
|
||||
}
|
||||
|
||||
|
||||
QString DPAdds::panelLocationToStr(Plasma::Types::Location location)
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Location" << location;
|
||||
|
||||
switch (location) {
|
||||
case Plasma::Types::Location::TopEdge:
|
||||
return i18n("Top Edge");
|
||||
case Plasma::Types::Location::BottomEdge:
|
||||
return i18n("Bottom Edge");
|
||||
case Plasma::Types::Location::LeftEdge:
|
||||
return i18n("Left Edge");
|
||||
case Plasma::Types::Location::RightEdge:
|
||||
return i18n("Right Edge");
|
||||
default:
|
||||
return i18n("Unknown location (%1)", location);
|
||||
}
|
||||
}
|
@ -1,92 +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 DPADDS_H
|
||||
#define DPADDS_H
|
||||
|
||||
#include <Plasma/Containment>
|
||||
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class DPAdds : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
typedef struct {
|
||||
WId id;
|
||||
QString name;
|
||||
QRect rect;
|
||||
} WindowData;
|
||||
|
||||
typedef struct {
|
||||
QRect desktop;
|
||||
QList<WindowData> desktopsData;
|
||||
QList<WindowData> windowsData;
|
||||
} DesktopWindowsInfo;
|
||||
|
||||
public:
|
||||
DPAdds(QObject *parent = 0);
|
||||
~DPAdds();
|
||||
|
||||
Q_INVOKABLE bool isDebugEnabled();
|
||||
Q_INVOKABLE int currentDesktop();
|
||||
Q_INVOKABLE QStringList dictKeys();
|
||||
Q_INVOKABLE int numberOfDesktops();
|
||||
Q_INVOKABLE QString toolTipImage(const int desktop);
|
||||
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop);
|
||||
// values
|
||||
Q_INVOKABLE void setMark(const QString newMark);
|
||||
Q_INVOKABLE void setPanelsToControl(const QString newPanels);
|
||||
Q_INVOKABLE void setToolTipData(const QMap<QString, QVariant> tooltipData);
|
||||
Q_INVOKABLE QString valueByKey(const QString key, int desktop = -1);
|
||||
// configuration slots
|
||||
Q_INVOKABLE QString editPanelsToContol(const QString current);
|
||||
Q_INVOKABLE QString getAboutText(const QString type = "header");
|
||||
Q_INVOKABLE QMap<QString, QVariant> getFont(const QMap<QString, QVariant> defaultFont);
|
||||
|
||||
signals:
|
||||
void desktopChanged();
|
||||
void windowListChanged();
|
||||
|
||||
public slots:
|
||||
Q_INVOKABLE void changePanelsState();
|
||||
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message);
|
||||
Q_INVOKABLE void setCurrentDesktop(const int desktop);
|
||||
|
||||
private slots:
|
||||
void changeDesktop(const int desktop);
|
||||
void changeWindowList(const WId window);
|
||||
|
||||
private:
|
||||
DesktopWindowsInfo getInfoByDesktop(const int desktop);
|
||||
QList<Plasma::Containment *> getPanels();
|
||||
QString panelLocationToStr(Plasma::Types::Location location);
|
||||
// variables
|
||||
bool debug = false;
|
||||
int oldState, tooltipWidth = 200;
|
||||
QString mark = QString("*");
|
||||
QString tooltipColor = QString("#000000");
|
||||
QString tooltipType = QString("none");
|
||||
QList<int> panelsToControl;
|
||||
};
|
||||
|
||||
|
||||
#endif /* DPADDS_H */
|
@ -1,24 +0,0 @@
|
||||
[Global]
|
||||
IconName=system
|
||||
Name=Desktop Panel
|
||||
Comment=Desktop panel notifications
|
||||
|
||||
[info]
|
||||
Name=Information
|
||||
Comment=Information
|
||||
Action=Popup
|
||||
|
||||
[Event/event]
|
||||
Name=Event
|
||||
Comment=Some event occurs
|
||||
Action=Popup
|
||||
|
||||
[Event/system]
|
||||
Name=System information
|
||||
Comment=System information
|
||||
Action=Popup
|
||||
|
||||
[Event/tag]
|
||||
Name=Tag information
|
||||
Comment=Tag information
|
||||
Action=Popup
|
@ -1,3 +0,0 @@
|
||||
module org.kde.plasma.private.desktoppanel
|
||||
|
||||
plugin dpplugin
|
@ -4,30 +4,11 @@ set (PLUGIN_NAME ${SUBPROJECT})
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
# find required libaries
|
||||
if (BUILD_KDE4)
|
||||
find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
find_package (KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||
else ()
|
||||
find_package (Qt5 REQUIRED COMPONENTS DBus Network Widgets)
|
||||
find_package (ECM 0.0.11 REQUIRED NO_MODULE)
|
||||
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
|
||||
find_package (KF5 REQUIRED COMPONENTS Plasma Service WindowSystem)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS}
|
||||
${Qt5Network_DEFINITIONS} ${Qt5Widgets_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS})
|
||||
set (KDE_INCLUDE ${Plasma_INCLUDE_DIR})
|
||||
endif ()
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
set (KDE_INCLUDE ${KDE4_INCLUDES})
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
@ -50,26 +31,13 @@ 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})
|
||||
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})
|
||||
kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP})
|
||||
endif ()
|
||||
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})
|
||||
|
||||
# install
|
||||
if (BUILD_KDE4)
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
else ()
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine)
|
||||
endif ()
|
||||
install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})
|
||||
install (DIRECTORY ${SUBPROJECT_SCRIPTS} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
|
||||
|
@ -308,8 +308,8 @@ QString ExtScript::run()
|
||||
}
|
||||
|
||||
// update value
|
||||
times++;
|
||||
if (times >= m_interval) times = 0;
|
||||
times++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -41,13 +41,8 @@
|
||||
#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)
|
||||
@ -127,23 +122,11 @@ void ExtendedSysMon::initScripts()
|
||||
// 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 = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/scripts");
|
||||
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 names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
@ -166,23 +149,11 @@ void ExtendedSysMon::initUpgrade()
|
||||
// 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 = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
|
||||
QString("/awesomewidgets/upgrade");
|
||||
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 names;
|
||||
for (int i=0; i<dirs.count(); i++) {
|
||||
@ -225,11 +196,7 @@ 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 */
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QMap<QString, QString> rawConfig;
|
||||
@ -706,10 +673,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"
|
||||
|
@ -215,8 +215,8 @@ int ExtUpgrade::run()
|
||||
}
|
||||
|
||||
// update value
|
||||
times++;
|
||||
if (times >= m_interval) times = 0;
|
||||
times++;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
@ -1,13 +1,6 @@
|
||||
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 (KDE4 REQUIRED)
|
||||
|
||||
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_awesome-widget.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_desktop-panel.mo)
|
||||
|
||||
file (GLOB _po_files *.po)
|
||||
set (_gmoFiles)
|
||||
|
@ -30,6 +30,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