* create cppcheck and clangformat targets

* apply code style (#67)
* send values by reference
* fix warnings on plugin destruction by disconnecting dataengines first
* fix invalid hddtemp group definition
This commit is contained in:
arcan1s 2015-10-18 00:05:42 +03:00
parent 8645260f99
commit 17a8a1734b
80 changed files with 2134 additions and 1022 deletions

View File

@ -126,6 +126,12 @@ HIG
The recommended HIG is [KDE one](https://techbase.kde.org/Projects/Usability/HIG). The recommended HIG is [KDE one](https://techbase.kde.org/Projects/Usability/HIG).
Licensing
---------
All files should be licensed under GPLv3, the owner of the license should be the
project (i.e. **awesome-widgets**). See **Tools** section for more details.
Logging Logging
------- -------
@ -212,7 +218,7 @@ Tools
// declare with default value // declare with default value
bool m_prop = false; bool m_prop = false;
``` ```
* Use `cppcheck` to avoid common errors in the code. Refer to `utils` for more * Use `cppcheck` to avoid common errors in the code. To start application just
details. run `make cppcheck`.
* Use `clang-format` to apply valid code format. Refer to `utils` for more * Use `clang-format` to apply valid code format. To start application just run
details. `make clangformat`.

View File

@ -9,7 +9,7 @@ AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterDefinitionReturnType: None
@ -37,7 +37,7 @@ IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 2
NamespaceIndentation: None NamespaceIndentation: None
ObjCBlockIndentWidth: 2 ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false ObjCSpaceAfterProperty: false

41
sources/.idea/codeStyleSettings.xml generated Normal file
View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value>
<Objective-C-extensions>
<option name="GENERATE_INSTANCE_VARIABLES_FOR_PROPERTIES" value="ASK" />
<option name="RELEASE_STYLE" value="IVAR" />
<option name="TYPE_QUALIFIERS_PLACEMENT" value="BEFORE" />
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" />
<pair source="c" header="h" />
</extensions>
</Objective-C-extensions>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
</value>
</option>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Qt" />
</component>
</project>

View File

@ -66,6 +66,8 @@
<sourceFolder url="file://$MODULE_DIR$/awesomewidgets/graphicalitem.h" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/awesomewidgets/graphicalitem.h" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/awesomewidgets/graphicalitem.ui" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/awesomewidgets/graphicalitem.ui" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/checkgit.cmake" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/checkgit.cmake" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/clang-format.cmake" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/cppcheck.cmake" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/desktop-panel/CMakeLists.txt" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/desktop-panel/CMakeLists.txt" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/desktop-panel/metadata.desktop" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/desktop-panel/metadata.desktop" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/desktop-panel/plugin/CMakeLists.txt" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/desktop-panel/plugin/CMakeLists.txt" isTestSource="false" />

View File

@ -6,8 +6,10 @@
<config projectName="awesomewidgets" targetName="awplugin" /> <config projectName="awesomewidgets" targetName="awplugin" />
<config projectName="awesomewidgets" targetName="awesomewidgets" /> <config projectName="awesomewidgets" targetName="awesomewidgets" />
<config projectName="awesomewidgets" targetName="dpplugin_automoc" /> <config projectName="awesomewidgets" targetName="dpplugin_automoc" />
<config projectName="awesomewidgets" targetName="cppcheck" />
<config projectName="awesomewidgets" targetName="plasma_dataengine_extsysmon" /> <config projectName="awesomewidgets" targetName="plasma_dataengine_extsysmon" />
<config projectName="awesomewidgets" targetName="uninstall" /> <config projectName="awesomewidgets" targetName="uninstall" />
<config projectName="awesomewidgets" targetName="clangformat" />
<config projectName="awesomewidgets" targetName="awplugin_automoc" /> <config projectName="awesomewidgets" targetName="awplugin_automoc" />
<config projectName="awesomewidgets" targetName="dpplugin" /> <config projectName="awesomewidgets" targetName="dpplugin" />
<config projectName="awesomewidgets" targetName="plasma_dataengine_extsysmon_automoc" /> <config projectName="awesomewidgets" targetName="plasma_dataengine_extsysmon_automoc" />
@ -21,38 +23,88 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="2abf8d0d-47d8-4127-8499-2d7068a74152" name="Default" comment=""> <list default="true" id="2abf8d0d-47d8-4127-8499-2d7068a74152" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/clang-format.cmake" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/.idea/codeStyleSettings.xml" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/cppcheck.cmake" />
<change type="DELETED" beforePath="$PROJECT_DIR$/../utils/cpp-check.sh" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/../utils/qt-code-style.sh" afterPath="" />
<change type="MOVED" beforePath="$PROJECT_DIR$/../utils/.clang-format" afterPath="$PROJECT_DIR$/.clang-format" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/../CHANGELOG-RU" afterPath="$PROJECT_DIR$/../CHANGELOG-RU" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../CHANGELOG-RU" afterPath="$PROJECT_DIR$/../CHANGELOG-RU" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/../CHANGELOG" afterPath="$PROJECT_DIR$/../CHANGELOG" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../CHANGELOG" afterPath="$PROJECT_DIR$/../CHANGELOG" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/CMakeLists.txt" afterPath="$PROJECT_DIR$/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt" afterPath="$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/CMakeLists.txt" afterPath="$PROJECT_DIR$/awesomewidgets/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/desktop-panel/plugin/CMakeLists.txt" afterPath="$PROJECT_DIR$/desktop-panel/plugin/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/CMakeLists.txt" afterPath="$PROJECT_DIR$/extsysmon/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/translations/CMakeLists.txt" afterPath="$PROJECT_DIR$/translations/CMakeLists.txt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/../CONTRIBUTING.md" afterPath="$PROJECT_DIR$/../CONTRIBUTING.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/../packages/PKGBUILD" afterPath="$PROJECT_DIR$/../packages/PKGBUILD" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/../packages/PKGBUILD" afterPath="$PROJECT_DIR$/../packages/PKGBUILD" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/about.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/about.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/abstractextitem.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/abstractextitem.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/abstractextitem.h" afterPath="$PROJECT_DIR$/awesomewidgets/abstractextitem.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/appearance.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/appearance.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/abstractextitemaggregator.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/abstractextitemaggregator.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/abstractextsysmonsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/abstractextsysmonsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awactions.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awactions.h" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awactions.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awactions.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awesomewidget.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awesomewidget.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awdebug.cpp" afterPath="$PROJECT_DIR$/awdebug.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awdebug.h" afterPath="$PROJECT_DIR$/awdebug.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.kdev4/awesomewidgets.kdev4" afterPath="$PROJECT_DIR$/.kdev4/awesomewidgets.kdev4" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.kdev4/awesomewidgets.kdev4" afterPath="$PROJECT_DIR$/.kdev4/awesomewidgets.kdev4" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awkeys.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awkeys.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.cpp" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.h" afterPath="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/batterysource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/batterysource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/batterysource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/batterysource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/checkgit.cmake" afterPath="$PROJECT_DIR$/checkgit.cmake" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/customsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/customsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/customsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/customsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/desktopsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/desktopsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/desktopsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/desktopsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.cpp" afterPath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.cpp" afterPath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.h" afterPath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.h" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.h" afterPath="$PROJECT_DIR$/desktop-panel/plugin/dpadds.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extitemaggregator.h" afterPath="$PROJECT_DIR$/awesomewidgets/extitemaggregator.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extquotes.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extquotes.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extquotes.h" afterPath="$PROJECT_DIR$/awesomewidgets/extquotes.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extscript.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extscript.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extscript.h" afterPath="$PROJECT_DIR$/awesomewidgets/extscript.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/extsysmon.cpp" afterPath="$PROJECT_DIR$/extsysmon/extsysmon.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/extsysmon.cpp" afterPath="$PROJECT_DIR$/extsysmon/extsysmon.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/extsysmon.h" afterPath="$PROJECT_DIR$/extsysmon/extsysmon.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/extsysmonaggregator.cpp" afterPath="$PROJECT_DIR$/extsysmon/extsysmonaggregator.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/extsysmonaggregator.h" afterPath="$PROJECT_DIR$/extsysmon/extsysmonaggregator.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extupgrade.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extupgrade.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extupgrade.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extupgrade.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extupgrade.h" afterPath="$PROJECT_DIR$/awesomewidgets/extupgrade.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extweather.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extweather.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extweather.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/extweather.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/extweather.h" afterPath="$PROJECT_DIR$/awesomewidgets/extweather.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/gpuloadsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gputempsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/gputempsource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gputempsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/gputempsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/gputempsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/gputempsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/graphicalitem.cpp" afterPath="$PROJECT_DIR$/awesomewidgets/graphicalitem.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesomewidgets/graphicalitem.h" afterPath="$PROJECT_DIR$/awesomewidgets/graphicalitem.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/hddtempsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/libraries.cmake" afterPath="$PROJECT_DIR$/libraries.cmake" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/loadsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/loadsource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/loadsource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/loadsource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/main.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/main.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/loadsource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/loadsource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/misc.xml" afterPath="$PROJECT_DIR$/.idea/misc.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/networksource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/networksource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/networksource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/networksource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/networksource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/networksource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/packages-recipe.cmake" afterPath="$PROJECT_DIR$/packages-recipe.cmake" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/playersource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/playersource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/playersource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/playersource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/playersource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/playersource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/processessource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/processessource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/processessource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/processessource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/quotessource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/quotessource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/quotessource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/quotessource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/quotessource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/quotessource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/sources.iml" afterPath="$PROJECT_DIR$/.idea/sources.iml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/sources.iml" afterPath="$PROJECT_DIR$/.idea/sources.iml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/tooltip.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/tooltip.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/updatesource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/updatesource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/vcs.xml" afterPath="$PROJECT_DIR$/.idea/vcs.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/upgradesource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/upgradesource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/upgradesource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/upgradesource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/weathersource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/weathersource.cpp" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/weathersource.cpp" afterPath="$PROJECT_DIR$/extsysmon/sources/weathersource.cpp" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/awesome-widget/package/contents/ui/widget.qml" afterPath="$PROJECT_DIR$/awesome-widget/package/contents/ui/widget.qml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/extsysmon/sources/weathersource.h" afterPath="$PROJECT_DIR$/extsysmon/sources/weathersource.h" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list> </list>
<ignored path="sources.iws" /> <ignored path="sources.iws" />
@ -74,40 +126,68 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf> <leaf>
<file leaf-file-name="awconfighelper.cpp" pinned="false" current-in-tab="false"> <file leaf-file-name="awkeys.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp"> <entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="143" column="33" selection-start-line="143" selection-start-column="33" selection-end-line="143" selection-end-column="33" /> <caret line="779" column="42" selection-start-line="779" selection-start-column="42" selection-end-line="779" selection-end-column="42" />
<folding>
<element signature="e#1234#1261#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="awconfighelper.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
<folding>
<element signature="e#1286#1304#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="advanced.qml" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="8.986733">
<caret line="391" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="402" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="awkeys.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="awdataaggregator.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="49" column="8" selection-start-line="49" selection-start-column="8" selection-end-line="49" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="awdataaggregator.cpp" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.27768594">
<caret line="312" column="12" selection-start-line="312" selection-start-column="12" selection-end-line="312" selection-end-column="12" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="awkeysaggregator.h" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="67" column="58" selection-start-line="67" selection-start-column="58" selection-end-line="67" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="awkeysaggregator.cpp" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="43" column="1" selection-start-line="43" selection-start-column="1" selection-end-line="43" selection-end-column="1" />
<folding>
<element signature="e#1234#1263#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="Git.Settings"> <component name="Git.Settings">
@ -116,10 +196,37 @@
<component name="IdeDocumentHistory"> <component name="IdeDocumentHistory">
<option name="CHANGED_PATHS"> <option name="CHANGED_PATHS">
<list> <list>
<option value="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h" /> <option value="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp" /> <option value="$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp" />
<option value="$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml" /> <option value="$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.h" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.cpp" />
<option value="$PROJECT_DIR$/../utils/cpp-check.sh" />
<option value="$PROJECT_DIR$/cppcheck-target.cmake" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt" />
<option value="$PROJECT_DIR$/checkgit.cmake" />
<option value="$PROJECT_DIR$/clang-format.cmake" />
<option value="$PROJECT_DIR$/CMakeLists.txt" />
<option value="$PROJECT_DIR$/libraries.cmake" />
<option value="$PROJECT_DIR$/packages-recipe.cmake" />
<option value="$PROJECT_DIR$/awesomewidgets/CMakeLists.txt" />
<option value="$PROJECT_DIR$/desktop-panel/plugin/CMakeLists.txt" />
<option value="$PROJECT_DIR$/extsysmon/CMakeLists.txt" />
<option value="$PROJECT_DIR$/translations/CMakeLists.txt" />
<option value="$PROJECT_DIR$/awesomewidgets/extweather.cpp" />
<option value="$PROJECT_DIR$/awesomewidgets/extquotes.cpp" />
<option value="$PROJECT_DIR$/awdebug.h" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp" />
<option value="$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml" />
<option value="$PROJECT_DIR$/extsysmon/extsysmonaggregator.h" />
<option value="$PROJECT_DIR$/extsysmon/extsysmonaggregator.cpp" />
<option value="$PROJECT_DIR$/awesomewidgets/extscript.h" />
<option value="$PROJECT_DIR$/cppcheck.cmake" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.h" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.cpp" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h" />
<option value="$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp" />
</list> </list>
</option> </option>
</component> </component>
@ -191,6 +298,24 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="extsysmon" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="sources" /> <option name="myItemId" value="sources" />
@ -209,6 +334,28 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" /> <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT> </PATH_ELEMENT>
</PATH> </PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.jetbrains.cidr.projectView.CidrFilesViewHelper$MyProjectTreeStructure$1" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewModuleNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="sources" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="awesomewidgets" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="desktops" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH> <PATH>
<PATH_ELEMENT> <PATH_ELEMENT>
<option name="myItemId" value="sources" /> <option name="myItemId" value="sources" />
@ -339,10 +486,30 @@
<property name="restartRequiresConfirmation" value="true" /> <property name="restartRequiresConfirmation" value="true" />
</component> </component>
<component name="RunManager" selected="Application.Release"> <component name="RunManager" selected="Application.Release">
<configuration default="true" type="BashConfigurationType" factoryName="Bash">
<option name="INTERPRETER_OPTIONS" value="" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="WORKING_DIRECTORY" value="" />
<option name="PARENT_ENVS" value="true" />
<option name="SCRIPT_NAME" value="" />
<option name="PARAMETERS" value="" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="awesomewidgets" TARGET_NAME="uninstall" CONFIG_NAME="Debug"> <configuration default="true" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="awesomewidgets" TARGET_NAME="uninstall" CONFIG_NAME="Debug">
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<node-options />
<gulpfile />
<tasks />
<arguments />
<pass-parent-envs>true</pass-parent-envs>
<envs />
<method />
</configuration>
<configuration default="false" name="Release" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Release" EXPLICIT_BUILD_TARGET_NAME="all"> <configuration default="false" name="Release" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS="FALSE" CONFIG_NAME="Release" EXPLICIT_BUILD_TARGET_NAME="all">
<envs /> <envs />
<method /> <method />
@ -387,7 +554,15 @@
<envs /> <envs />
<method /> <method />
</configuration> </configuration>
<list size="11"> <configuration default="false" name="clangformat" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="awesomewidgets" TARGET_NAME="clangformat" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<configuration default="false" name="cppcheck" type="CMakeRunConfiguration" factoryName="Application" PASS_PARENT_ENVS="FALSE" PROJECT_NAME="awesomewidgets" TARGET_NAME="cppcheck" CONFIG_NAME="Debug">
<envs />
<method />
</configuration>
<list size="13">
<item index="0" class="java.lang.String" itemvalue="Application.Release" /> <item index="0" class="java.lang.String" itemvalue="Application.Release" />
<item index="1" class="java.lang.String" itemvalue="Application.uninstall" /> <item index="1" class="java.lang.String" itemvalue="Application.uninstall" />
<item index="2" class="java.lang.String" itemvalue="Application.awplugin" /> <item index="2" class="java.lang.String" itemvalue="Application.awplugin" />
@ -399,6 +574,8 @@
<item index="8" class="java.lang.String" itemvalue="Application.plasma_dataengine_extsysmon" /> <item index="8" class="java.lang.String" itemvalue="Application.plasma_dataengine_extsysmon" />
<item index="9" class="java.lang.String" itemvalue="Application.plasma_dataengine_extsysmon_automoc" /> <item index="9" class="java.lang.String" itemvalue="Application.plasma_dataengine_extsysmon_automoc" />
<item index="10" class="java.lang.String" itemvalue="Application.aw_pofiles" /> <item index="10" class="java.lang.String" itemvalue="Application.aw_pofiles" />
<item index="11" class="java.lang.String" itemvalue="Application.clangformat" />
<item index="12" class="java.lang.String" itemvalue="Application.cppcheck" />
</list> </list>
</component> </component>
<component name="ShelveChangesManager" show_recycled="false" /> <component name="ShelveChangesManager" show_recycled="false" />
@ -415,27 +592,46 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="1280" y="21" width="1366" height="747" extended-state="6" /> <frame x="1280" y="21" width="1366" height="747" extended-state="7" />
<editor active="true" /> <editor active="true" />
<layout> <layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24981412" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24535316" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.4944238" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32753164" sideWeight="0.4944238" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.5055762" order="-1" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.5055762" order="10" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout> </layout>
<layout-to-restore>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="CMake" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32753164" sideWeight="0.4944238" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.5055762" order="10" side_tool="true" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32857144" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24535316" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout-to-restore>
</component> </component>
<component name="Vcs.Log.UiProperties"> <component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS"> <option name="RECENTLY_FILTERED_USER_GROUPS">
@ -448,46 +644,28 @@
<component name="VcsContentAnnotationSettings"> <component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" /> <option name="myLimit" value="2678400000" />
</component> </component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$USER_HOME$" />
<path value="$PROJECT_DIR$/3rdparty/task" />
<path value="$PROJECT_DIR$/3rdparty/tasks" />
<path value="$PROJECT_DIR$/3rdparty/fontdialog" />
</ignored-roots>
</component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager /> <breakpoint-manager />
<watches-manager /> <watches-manager />
</component> </component>
<component name="editorHistoryManager"> <component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h"> <entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.74242425">
<caret line="21" column="15" selection-start-line="21" selection-start-column="15" selection-end-line="21" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-1.3466003">
<caret line="68" column="31" selection-start-line="68" selection-start-column="31" selection-end-line="68" selection-end-column="31" />
<folding>
<element signature="e#1234#1263#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/extscript.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="389" column="104" selection-start-line="389" selection-start-column="21" selection-end-line="389" selection-end-column="104" /> <caret line="38" column="37" selection-start-line="38" selection-start-column="37" selection-end-line="38" selection-end-column="37" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/appearance.qml"> <entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.h">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
@ -495,13 +673,25 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h"> <entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" /> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding> <folding />
<element signature="e#1286#1304#0" expanded="true" /> </state>
</folding> </provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state> </state>
</provider> </provider>
</entry> </entry>
@ -509,16 +699,333 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.0">
<caret line="143" column="33" selection-start-line="143" selection-start-column="33" selection-end-line="143" selection-end-column="33" /> <caret line="143" column="33" selection-start-line="143" selection-start-column="33" selection-end-line="143" selection-end-column="33" />
<folding> </state>
<element signature="e#1234#1261#0" expanded="true" /> </provider>
</folding> </entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml"> <entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="8.986733"> <state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/appearance.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/advanced.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.60862356">
<caret line="391" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="402" selection-end-column="0" /> <caret line="391" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="402" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.094527364">
<caret line="25" column="0" selection-start-line="25" selection-start-column="0" selection-end-line="25" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awconfighelper.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="143" column="33" selection-start-line="143" selection-start-column="33" selection-end-line="143" selection-end-column="33" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.5356551">
<caret line="34" column="0" selection-start-line="34" selection-start-column="0" selection-end-line="34" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataengineaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.16252074">
<caret line="39" column="0" selection-start-line="39" selection-start-column="0" selection-end-line="39" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/checkgit.cmake">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.25454545">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="1.2958678">
<caret line="56" column="12" selection-start-line="56" selection-start-column="12" selection-end-line="56" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/libraries.cmake">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/packages-recipe.cmake">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.13884297">
<caret line="6" column="15" selection-start-line="6" selection-start-column="15" selection-end-line="6" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/desktop-panel/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/desktop-panel/plugin/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extsysmon/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/translations/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/abstractextitem.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/extquotes.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.4859504">
<caret line="63" column="0" selection-start-line="63" selection-start-column="0" selection-end-line="63" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/extweather.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.069421485">
<caret line="54" column="4" selection-start-line="54" selection-start-column="4" selection-end-line="56" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets.kdev4">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awdebug.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awdebug.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.25950414">
<caret line="23" column="18" selection-start-line="23" selection-start-column="18" selection-end-line="23" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awactions.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="1.8925476">
<caret line="78" column="40" selection-start-line="78" selection-start-column="23" selection-end-line="78" selection-end-column="40" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/awesomewidgets-extweather-ids.json">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.09638554">
<caret line="4" column="25" selection-start-line="4" selection-start-column="25" selection-end-line="4" selection-end-column="25" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/CMakeLists.txt">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-0.041322313">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/dataengine.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.30082646">
<caret line="44" column="49" selection-start-line="44" selection-start-column="49" selection-end-line="44" selection-end-column="49" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/desktop-panel/package/contents/ui/advanced.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-5.016529">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="76" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/clang-format.cmake">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.04628099">
<caret line="2" column="0" selection-start-line="2" selection-start-column="0" selection-end-line="9" selection-end-column="13" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extsysmon/extsysmon.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="31" column="24" selection-start-line="31" selection-start-column="18" selection-end-line="31" selection-end-column="24" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extsysmon/extsysmonaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="33" column="46" selection-start-line="33" selection-start-column="46" selection-end-line="33" selection-end-column="46" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/extsysmon/extsysmonaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="61" column="1" selection-start-line="61" selection-start-column="1" selection-end-line="61" selection-end-column="1" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/extscript.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-6.857143">
<caret line="389" column="43" selection-start-line="389" selection-start-column="36" selection-end-line="389" selection-end-column="43" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/extscript.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-6.857143">
<caret line="34" column="39" selection-start-line="34" selection-start-column="35" selection-end-line="34" selection-end-column="39" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/cppcheck.cmake">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.46280992">
<caret line="20" column="62" selection-start-line="20" selection-start-column="62" selection-end-line="20" selection-end-column="62" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="779" column="42" selection-start-line="779" selection-start-column="42" selection-end-line="779" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeys.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="43" column="1" selection-start-line="43" selection-start-column="1" selection-end-line="43" selection-end-column="1" />
<folding>
<element signature="e#1234#1263#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awkeysaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="67" column="58" selection-start-line="67" selection-start-column="58" selection-end-line="67" selection-end-column="58" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.h">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="49" column="8" selection-start-line="49" selection-start-column="8" selection-end-line="49" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/main.qml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-0.41652894">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#1232#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/package/contents/ui/qmldir">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesomewidgets/desktops/aw-bat-bar.desktop">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.13884297">
<caret line="6" column="36" selection-start-line="6" selection-start-column="36" selection-end-line="6" selection-end-column="36" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/awesome-widget/plugin/awdataaggregator.cpp">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.27768594">
<caret line="312" column="12" selection-start-line="312" selection-start-column="12" selection-end-line="312" selection-end-column="12" />
<folding /> <folding />
</state> </state>
</provider> </provider>

View File

@ -8,7 +8,7 @@ ProjectRootRelative=./
[CMake][CMake Build Directory 0] [CMake][CMake Build Directory 0]
Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build Build Directory Path=file:///home/arcanis/Documents/github/awesome-widgets/build
Build Type=Optimizaton Build Type=Optimization
CMake Binary=file:///usr/bin/cmake CMake Binary=file:///usr/bin/cmake
Environment Profile= Environment Profile=
Extra Arguments= Extra Arguments=

View File

@ -35,6 +35,9 @@ option(BUILD_RPM_PACKAGE "Build rpm package" OFF)
# build details # build details
option(BUILD_FUTURE "Build with the features which will be marked as stable later" OFF) option(BUILD_FUTURE "Build with the features which will be marked as stable later" OFF)
option(BUILD_TESTING "Build with additional test abilities" OFF) option(BUILD_TESTING "Build with additional test abilities" OFF)
# some additional targets
set(CPPCHECK_EXECUTABLE "/usr/bin/cppcheck" CACHE STRING "Path to cppcheck executable")
set(CLANGFORMAT_EXECUTABLE "/usr/bin/clang-format" CACHE STRING "Path to clang-format executable")
# flags # flags
if (CMAKE_COMPILER_IS_GNUCXX) if (CMAKE_COMPILER_IS_GNUCXX)
@ -64,6 +67,8 @@ configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/vers
set(PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) set(PROJECT_TRDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty)
set(PROJECT_LIBRARY awesomewidgets) set(PROJECT_LIBRARY awesomewidgets)
include(libraries.cmake) include(libraries.cmake)
include(clang-format.cmake)
include(cppcheck.cmake)
add_subdirectory(awesomewidgets) add_subdirectory(awesomewidgets)
add_subdirectory(extsysmon) add_subdirectory(extsysmon)

View File

@ -19,7 +19,10 @@
#include "awdebug.h" #include "awdebug.h"
Q_LOGGING_CATEGORY(LOG_AW, "org.kde.plasma.awesomewidget", QtMsgType::QtWarningMsg) Q_LOGGING_CATEGORY(LOG_AW, "org.kde.plasma.awesomewidget",
Q_LOGGING_CATEGORY(LOG_DP, "org.kde.plasma.desktoppanel", QtMsgType::QtWarningMsg) QtMsgType::QtWarningMsg)
Q_LOGGING_CATEGORY(LOG_DP, "org.kde.plasma.desktoppanel",
QtMsgType::QtWarningMsg)
Q_LOGGING_CATEGORY(LOG_ESM, "org.kde.plasma.extsysmon", QtMsgType::QtWarningMsg) Q_LOGGING_CATEGORY(LOG_ESM, "org.kde.plasma.extsysmon", QtMsgType::QtWarningMsg)
Q_LOGGING_CATEGORY(LOG_LIB, "org.kde.plasma.awesomewidgets", QtMsgType::QtWarningMsg) Q_LOGGING_CATEGORY(LOG_LIB, "org.kde.plasma.awesomewidgets",
QtMsgType::QtWarningMsg)

View File

@ -22,7 +22,11 @@
#include <QLoggingCategory> #include <QLoggingCategory>
#ifndef LOG_FORMAT #ifndef LOG_FORMAT
#define LOG_FORMAT "[%{time yyyy-MM-ddTHH:mm:ss.zzz}][%{if-debug}DD%{endif}%{if-info}II%{endif}%{if-warning}WW%{endif}%{if-critical}CC%{endif}%{if-fatal}FF%{endif}][%{category}][%{function}] %{message}" #define LOG_FORMAT \
"[%{time " \
"yyyy-MM-ddTHH:mm:ss.zzz}][%{if-debug}DD%{endif}%{if-info}II%{endif}%{if-" \
"warning}WW%{endif}%{if-critical}CC%{endif}%{if-fatal}FF%{endif}][%{" \
"category}][%{function}] %{message}"
#endif /* LOG_FORMAT */ #endif /* LOG_FORMAT */
// define info log level // define info log level

View File

@ -342,9 +342,9 @@ Item {
// update hdd model // update hdd model
hdd.model = awKeys.getHddDevices() hdd.model = awKeys.getHddDevices()
for (var i=0; i<model.length; i++) { for (var i=0; i<hdd.model.length; i++) {
if (model[i] == cfg_dataengine["HDDDEV"]) { if (hdd.model[i] == cfg_dataengine["HDDDEV"]) {
if (debug) console.info("Found", model[i], "on", i) if (debug) console.info("Found", hdd.model[i], "on", i)
hdd.currentIndex = i; hdd.currentIndex = i;
} }
} }

View File

@ -57,7 +57,7 @@ void AWActions::checkUpdates(const bool showAnyway)
// showAnyway options requires to show message if no updates found on direct // showAnyway options requires to show message if no updates found on direct
// request. In case of automatic check no message will be shown // request. In case of automatic check no message will be shown
QNetworkAccessManager *manager = new QNetworkAccessManager(this); QNetworkAccessManager *manager = new QNetworkAccessManager(nullptr);
connect(manager, &QNetworkAccessManager::finished, connect(manager, &QNetworkAccessManager::finished,
[showAnyway, this](QNetworkReply *reply) { [showAnyway, this](QNetworkReply *reply) {
return versionReplyRecieved(reply, showAnyway); return versionReplyRecieved(reply, showAnyway);
@ -106,32 +106,50 @@ QString AWActions::getAboutText(const QString type) const
if (type == QString("header")) { if (type == QString("header")) {
text = QString(NAME); text = QString(NAME);
} else if (type == QString("version")) { } else if (type == QString("version")) {
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE)); text = i18n("Version %1 (build date %2)", QString(VERSION),
if (!QString(COMMIT_SHA).isEmpty()) text += QString(" (%1)").arg(QString(COMMIT_SHA)); QString(BUILD_DATE));
if (!QString(COMMIT_SHA).isEmpty())
text += QString(" (%1)").arg(QString(COMMIT_SHA));
} else if (type == QString("description")) { } else if (type == QString("description")) {
text = i18n("A set of minimalistic plasmoid widgets"); text = i18n("A set of minimalistic plasmoid widgets");
} else if (type == QString("links")) { } else if (type == QString("links")) {
text = i18n("Links:") + QString("<br>") 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>")
+ QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) .arg(QString(HOMEPAGE))
+ QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) .arg(i18n("Homepage"))
+ QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) + QString("<a href=\"%1\">%2</a><br>")
+ QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) .arg(QString(REPOSITORY))
+ QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages")); .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")) { } else if (type == QString("copy")) {
text = QString("<small>&copy; %1 <a href=\"mailto:%2\">%3</a><br>"). text = QString("<small>&copy; %1 <a href=\"mailto:%2\">%3</a><br>")
arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) .arg(QString(DATE))
.arg(QString(EMAIL))
.arg(QString(AUTHOR))
+ i18n("This software is licensed under %1", QString(LICENSE)) + i18n("This software is licensed under %1", QString(LICENSE))
+ QString("</small>"); + QString("</small>");
} else if (type == QString("translators")) { } else if (type == QString("translators")) {
text = i18n("Translators: %1", QString(TRANSLATORS)); text = i18n("Translators: %1", QString(TRANSLATORS));
} else if (type == QString("3rdparty")) { } else if (type == QString("3rdparty")) {
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts); QStringList trdPartyList
= QString(TRDPARTY_LICENSE)
.split(QChar(';'), QString::SkipEmptyParts);
for (int i = 0; i < trdPartyList.count(); i++) for (int i = 0; i < trdPartyList.count(); i++)
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)"). trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)")
arg(trdPartyList.at(i).split(QChar(','))[0]). .arg(trdPartyList.at(i).split(QChar(','))[0])
arg(trdPartyList.at(i).split(QChar(','))[1]). .arg(trdPartyList.at(i).split(QChar(','))[1])
arg(trdPartyList.at(i).split(QChar(','))[2]); .arg(trdPartyList.at(i).split(QChar(','))[2]);
text = i18n("This software uses: %1", trdPartyList.join(QString(", "))); text = i18n("This software uses: %1", trdPartyList.join(QString(", ")));
} }
@ -146,10 +164,10 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
QVariantMap fontMap; QVariantMap fontMap;
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(), CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
defaultFont[QString("size")].toInt(), defaultFont[QString("size")].toInt(), 400, false,
400, false, defaultFont[QString("color")].toString()); defaultFont[QString("color")].toString());
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, CFont font
false, false); = CFontDialog::getFont(i18n("Select font"), defaultCFont, false, false);
fontMap[QString("color")] = font.color().name(); fontMap[QString("color")] = font.color().name();
fontMap[QString("family")] = font.family(); fontMap[QString("family")] = font.family();
fontMap[QString("size")] = font.pointSize(); fontMap[QString("size")] = font.pointSize();
@ -158,7 +176,6 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
} }
// to avoid additional object definition this method is static // to avoid additional object definition this method is static
void AWActions::sendNotification(const QString eventId, const QString message) void AWActions::sendNotification(const QString eventId, const QString message)
{ {
@ -166,10 +183,10 @@ void AWActions::sendNotification(const QString eventId, const QString message)
qCDebug(LOG_AW) << "Event" << eventId; qCDebug(LOG_AW) << "Event" << eventId;
qCDebug(LOG_AW) << "Message" << message; qCDebug(LOG_AW) << "Message" << message;
KNotification *notification = KNotification::event(eventId, KNotification *notification = KNotification::event(
QString("Awesome Widget ::: %1").arg(eventId), eventId, QString("Awesome Widget ::: %1").arg(eventId), message);
message); notification->setComponentName(
notification->setComponentName(QString("plasma-applet-org.kde.plasma.awesome-widget")); QString("plasma-applet-org.kde.plasma.awesome-widget"));
} }
@ -185,7 +202,6 @@ void AWActions::showInfo(const QString version) const
} }
void AWActions::showUpdates(const QString version) const void AWActions::showUpdates(const QString version) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -193,11 +209,14 @@ void AWActions::showUpdates(const QString version) const
QString text; QString text;
text += i18n("Current version : %1", QString(VERSION)); text += i18n("Current version : %1", QString(VERSION));
text += QString(COMMIT_SHA).isEmpty() ? QString("\n") : QString(" (%1)\n").arg(QString(COMMIT_SHA)); text += QString(COMMIT_SHA).isEmpty()
? QString("\n")
: QString(" (%1)\n").arg(QString(COMMIT_SHA));
text += i18n("New version : %1", version) + QString("\n\n"); text += i18n("New version : %1", version) + QString("\n\n");
text += i18n("Click \"Ok\" to download"); text += i18n("Click \"Ok\" to download");
int select = QMessageBox::information(nullptr, i18n("There are updates"), text, int select
= QMessageBox::information(nullptr, i18n("There are updates"), text,
QMessageBox::Ok | QMessageBox::Cancel); QMessageBox::Ok | QMessageBox::Cancel);
switch (select) { switch (select) {
case QMessageBox::Ok: case QMessageBox::Ok:
@ -210,7 +229,8 @@ void AWActions::showUpdates(const QString version) const
} }
void AWActions::versionReplyRecieved(QNetworkReply *reply, const bool showAnyway) const void AWActions::versionReplyRecieved(QNetworkReply *reply,
const bool showAnyway) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Return code" << reply->error(); qCDebug(LOG_AW) << "Return code" << reply->error();
@ -241,7 +261,8 @@ void AWActions::versionReplyRecieved(QNetworkReply *reply, const bool showAnyway
int new_patch = QString(version).split(QChar('.')).at(2).toInt(); int new_patch = QString(version).split(QChar('.')).at(2).toInt();
if ((old_major < new_major) if ((old_major < new_major)
|| ((old_major == new_major) && (old_minor < new_minor)) || ((old_major == new_major) && (old_minor < new_minor))
|| ((old_major == new_major) && (old_minor == new_minor) && (old_patch < new_patch))) || ((old_major == new_major) && (old_minor == new_minor)
&& (old_patch < new_patch)))
return showUpdates(version); return showUpdates(version);
else if (showAnyway) else if (showAnyway)
return showInfo(version); return showInfo(version);

View File

@ -36,16 +36,19 @@ public:
Q_INVOKABLE bool runCmd(const QString cmd = QString("/usr/bin/true")) const; Q_INVOKABLE bool runCmd(const QString cmd = QString("/usr/bin/true")) const;
Q_INVOKABLE void showReadme() const; Q_INVOKABLE void showReadme() const;
// configuration slots // configuration slots
Q_INVOKABLE QString getAboutText(const QString type = QString("header")) const; Q_INVOKABLE QString getAboutText(const QString type
= QString("header")) const;
Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const; Q_INVOKABLE QVariantMap getFont(const QVariantMap defaultFont) const;
public slots: public slots:
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message); Q_INVOKABLE static void sendNotification(const QString eventId,
const QString message);
private slots: private slots:
void showInfo(const QString version) const; void showInfo(const QString version) const;
void showUpdates(const QString version) const; void showUpdates(const QString version) const;
void versionReplyRecieved(QNetworkReply *reply, const bool showAnyway) const; void versionReplyRecieved(QNetworkReply *reply,
const bool showAnyway) const;
}; };

View File

@ -48,8 +48,9 @@ bool AWConfigHelper::dropCache() const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
QString fileName = QString("%1/awesomewidgets.ndx"). QString fileName = QString("%1/awesomewidgets.ndx")
arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)); .arg(QStandardPaths::writableLocation(
QStandardPaths::GenericCacheLocation));
return QFile(fileName).remove(); return QFile(fileName).remove();
} }
@ -67,7 +68,8 @@ void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
QSettings settings(fileName, QSettings::IniFormat); QSettings settings(fileName, QSettings::IniFormat);
// plasmoid configuration // plasmoid configuration
QQmlPropertyMap *configuration = static_cast<QQmlPropertyMap *>(nativeConfig); QQmlPropertyMap *configuration
= static_cast<QQmlPropertyMap *>(nativeConfig);
settings.beginGroup(QString("plasmoid")); settings.beginGroup(QString("plasmoid"));
foreach (QString key, configuration->keys()) { foreach (QString key, configuration->keys()) {
QVariant value = configuration->value(key); QVariant value = configuration->value(key);
@ -77,10 +79,12 @@ void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
} }
settings.endGroup(); settings.endGroup();
// extenstions // extensions
foreach (QString item, m_dirs) { foreach (QString item, m_dirs) {
QStringList items = QDir(QString("%1/%2").arg(m_baseDir).arg(item)).entryList( QStringList items
QStringList() << QString("*.desktop"), QDir::Files); = QDir(QString("%1/%2").arg(m_baseDir).arg(item))
.entryList(QStringList() << QString("*.desktop"),
QDir::Files);
settings.beginGroup(item); settings.beginGroup(item);
foreach (QString it, items) foreach (QString it, items)
copyExtensions(it, item, settings, false); copyExtensions(it, item, settings, false);
@ -91,10 +95,12 @@ void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
settings.beginGroup(QString("json")); settings.beginGroup(QString("json"));
// script filters // script filters
readFile(settings, QString("filters"), readFile(settings, QString("filters"),
QString("%1/scripts/awesomewidgets-extscripts-filters.json").arg(m_baseDir)); QString("%1/scripts/awesomewidgets-extscripts-filters.json")
.arg(m_baseDir));
// weather icon settings // weather icon settings
readFile(settings, QString("weathers"), readFile(settings, QString("weathers"),
QString("%1/weather/awesomewidgets-extweather-ids.json").arg(m_baseDir)); QString("%1/weather/awesomewidgets-extweather-ids.json")
.arg(m_baseDir));
settings.endGroup(); settings.endGroup();
// sync settings // sync settings
@ -115,8 +121,8 @@ QVariantMap AWConfigHelper::importConfiguration() const
QSettings settings(fileName, QSettings::IniFormat); QSettings settings(fileName, QSettings::IniFormat);
QHash<QString, bool> selection = selectImport(); QHash<QString, bool> selection = selectImport();
// extenstions // extensions
if (selection[QString("extenstions")]) { if (selection[QString("extensions")]) {
foreach (QString item, m_dirs) { foreach (QString item, m_dirs) {
settings.beginGroup(item); settings.beginGroup(item);
foreach (QString it, settings.childGroups()) foreach (QString it, settings.childGroups())
@ -130,10 +136,12 @@ QVariantMap AWConfigHelper::importConfiguration() const
settings.beginGroup(QString("json")); settings.beginGroup(QString("json"));
// script filters // script filters
writeFile(settings, QString("filters"), writeFile(settings, QString("filters"),
QString("%1/scripts/awesomewidgets-extscripts-filters.json").arg(m_baseDir)); QString("%1/scripts/awesomewidgets-extscripts-filters.json")
.arg(m_baseDir));
// weather icon settings // weather icon settings
writeFile(settings, QString("weathers"), writeFile(settings, QString("weathers"),
QString("%1/weather/awesomewidgets-extweather-ids.json").arg(m_baseDir)); QString("%1/weather/awesomewidgets-extweather-ids.json")
.arg(m_baseDir));
settings.endGroup(); settings.endGroup();
} }
@ -153,22 +161,32 @@ QVariantMap AWConfigHelper::readDataEngineConfiguration() const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString fileName
= QStandardPaths::locate(QStandardPaths::ConfigLocation,
QString("plasma-dataengine-extsysmon.conf")); QString("plasma-dataengine-extsysmon.conf"));
qCInfo(LOG_AW) << "Configuration file" << fileName; qCInfo(LOG_AW) << "Configuration file" << fileName;
QSettings settings(fileName, QSettings::IniFormat); QSettings settings(fileName, QSettings::IniFormat);
QVariantMap configuration; QVariantMap configuration;
settings.beginGroup(QString("Configuration")); settings.beginGroup(QString("Configuration"));
configuration[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/")); configuration[QString("ACPIPATH")] = settings.value(
configuration[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto")); QString("ACPIPATH"), QString("/sys/class/power_supply/"));
configuration[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all")); configuration[QString("GPUDEV")]
configuration[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a")); = settings.value(QString("GPUDEV"), QString("auto"));
configuration[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost")); configuration[QString("HDDDEV")]
configuration[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600")); = settings.value(QString("HDDDEV"), QString("all"));
configuration[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto")); configuration[QString("HDDTEMPCMD")]
configuration[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris")); = settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a"));
configuration[QString("PLAYERSYMBOLS")] = settings.value(QString("PLAYERSYMBOLS"), QString("10")); 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"));
configuration[QString("PLAYERSYMBOLS")]
= settings.value(QString("PLAYERSYMBOLS"), QString("10"));
settings.endGroup(); settings.endGroup();
qCInfo(LOG_AW) << "Configuration" << configuration; qCInfo(LOG_AW) << "Configuration" << configuration;
@ -177,11 +195,13 @@ QVariantMap AWConfigHelper::readDataEngineConfiguration() const
} }
void AWConfigHelper::writeDataEngineConfiguration(const QVariantMap configuration) const void AWConfigHelper::writeDataEngineConfiguration(
const QVariantMap configuration) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) QString fileName
= QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)
+ QString("/plasma-dataengine-extsysmon.conf"); + QString("/plasma-dataengine-extsysmon.conf");
QSettings settings(fileName, QSettings::IniFormat); QSettings settings(fileName, QSettings::IniFormat);
qCInfo(LOG_AW) << "Configuration file" << settings.fileName(); qCInfo(LOG_AW) << "Configuration file" << settings.fileName();
@ -190,12 +210,15 @@ void AWConfigHelper::writeDataEngineConfiguration(const QVariantMap configuratio
settings.setValue(QString("ACPIPATH"), configuration[QString("ACPIPATH")]); settings.setValue(QString("ACPIPATH"), configuration[QString("ACPIPATH")]);
settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]); settings.setValue(QString("GPUDEV"), configuration[QString("GPUDEV")]);
settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]); settings.setValue(QString("HDDDEV"), configuration[QString("HDDDEV")]);
settings.setValue(QString("HDDTEMPCMD"), configuration[QString("HDDTEMPCMD")]); settings.setValue(QString("HDDTEMPCMD"),
settings.setValue(QString("MPDADDRESS"), configuration[QString("MPDADDRESS")]); configuration[QString("HDDTEMPCMD")]);
settings.setValue(QString("MPDADDRESS"),
configuration[QString("MPDADDRESS")]);
settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]); settings.setValue(QString("MPDPORT"), configuration[QString("MPDPORT")]);
settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]); settings.setValue(QString("MPRIS"), configuration[QString("MPRIS")]);
settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]); settings.setValue(QString("PLAYER"), configuration[QString("PLAYER")]);
settings.setValue(QString("PLAYERSYMBOLS"), configuration[QString("PLAYERSYMBOLS")]); settings.setValue(QString("PLAYERSYMBOLS"),
configuration[QString("PLAYERSYMBOLS")]);
settings.endGroup(); settings.endGroup();
settings.sync(); settings.sync();
@ -203,7 +226,8 @@ void AWConfigHelper::writeDataEngineConfiguration(const QVariantMap configuratio
void AWConfigHelper::copyExtensions(const QString item, const QString type, void AWConfigHelper::copyExtensions(const QString item, const QString type,
QSettings &settings, const bool inverse) const QSettings &settings,
const bool inverse) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Extension" << item; qCDebug(LOG_AW) << "Extension" << item;
@ -211,7 +235,9 @@ void AWConfigHelper::copyExtensions(const QString item, const QString type,
qCDebug(LOG_AW) << "Inverse" << inverse; qCDebug(LOG_AW) << "Inverse" << inverse;
settings.beginGroup(item); settings.beginGroup(item);
QSettings itemSettings(QString("%1/%2/%3").arg(m_baseDir).arg(type).arg(item), QSettings::IniFormat); QSettings itemSettings(
QString("%1/%2/%3").arg(m_baseDir).arg(type).arg(item),
QSettings::IniFormat);
itemSettings.beginGroup(QString("Desktop Entry")); itemSettings.beginGroup(QString("Desktop Entry"));
if (inverse) if (inverse)
copySettings(settings, itemSettings); copySettings(settings, itemSettings);
@ -234,7 +260,8 @@ void AWConfigHelper::copySettings(QSettings &from, QSettings &to) const
} }
void AWConfigHelper::readFile(QSettings &settings, const QString key, const QString fileName) const void AWConfigHelper::readFile(QSettings &settings, const QString key,
const QString fileName) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Key" << key; qCDebug(LOG_AW) << "Key" << key;
@ -256,13 +283,17 @@ QHash<QString, bool> AWConfigHelper::selectImport() const
qCDebug(LOG_AW); qCDebug(LOG_AW);
QDialog *dialog = new QDialog(nullptr); QDialog *dialog = new QDialog(nullptr);
QCheckBox *importPlasmoidSettings = new QCheckBox(i18n("Import plasmoid settings"), dialog); QCheckBox *importPlasmoidSettings
= new QCheckBox(i18n("Import plasmoid settings"), dialog);
importPlasmoidSettings->setChecked(true); importPlasmoidSettings->setChecked(true);
QCheckBox *importExtensionsSettings = new QCheckBox(i18n("Import extenstions"), dialog); QCheckBox *importExtensionsSettings
= new QCheckBox(i18n("Import extensions"), dialog);
importExtensionsSettings->setChecked(true); importExtensionsSettings->setChecked(true);
QCheckBox *importAddsSettings = new QCheckBox(i18n("Import additional files"), dialog); QCheckBox *importAddsSettings
= new QCheckBox(i18n("Import additional files"), dialog);
importAddsSettings->setChecked(true); importAddsSettings->setChecked(true);
QDialogButtonBox *dialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, QDialogButtonBox *dialogButtons
= new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
Qt::Horizontal, dialog); Qt::Horizontal, dialog);
QVBoxLayout *layout = new QVBoxLayout(dialog); QVBoxLayout *layout = new QVBoxLayout(dialog);
layout->addWidget(importPlasmoidSettings); layout->addWidget(importPlasmoidSettings);
@ -275,12 +306,12 @@ QHash<QString, bool> AWConfigHelper::selectImport() const
// get parameters // get parameters
QHash<QString, bool> import; QHash<QString, bool> import;
import[QString("plasmoid")] = false; import[QString("plasmoid")] = false;
import[QString("extenstions")] = false; import[QString("extensions")] = false;
import[QString("adds")] = false; import[QString("adds")] = false;
switch (int ret = dialog->exec()) { switch (int ret = dialog->exec()) {
case QDialog::Accepted: case QDialog::Accepted:
import[QString("plasmoid")] = importPlasmoidSettings->isChecked(); import[QString("plasmoid")] = importPlasmoidSettings->isChecked();
import[QString("extenstions")] = importExtensionsSettings->isChecked(); import[QString("extensions")] = importExtensionsSettings->isChecked();
import[QString("adds")] = importAddsSettings->isChecked(); import[QString("adds")] = importAddsSettings->isChecked();
break; break;
case QDialog::Rejected: case QDialog::Rejected:
@ -293,7 +324,8 @@ QHash<QString, bool> AWConfigHelper::selectImport() const
} }
void AWConfigHelper::writeFile(QSettings &settings, const QString key, const QString fileName) const void AWConfigHelper::writeFile(QSettings &settings, const QString key,
const QString fileName) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Key" << key; qCDebug(LOG_AW) << "Key" << key;

View File

@ -37,21 +37,27 @@ public:
Q_INVOKABLE QVariantMap importConfiguration() const; Q_INVOKABLE QVariantMap importConfiguration() const;
// dataengine // dataengine
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const; Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
Q_INVOKABLE void writeDataEngineConfiguration(const QVariantMap configuration) const; Q_INVOKABLE void
writeDataEngineConfiguration(const QVariantMap configuration) const;
private: private:
// methods // methods
void copyExtensions(const QString item, const QString type, void copyExtensions(const QString item, const QString type,
QSettings &settings, const bool inverse) const; QSettings &settings, const bool inverse) const;
void copySettings(QSettings &from, QSettings &to) const; void copySettings(QSettings &from, QSettings &to) const;
void readFile(QSettings &settings, const QString key, const QString fileName) const; void readFile(QSettings &settings, const QString key,
const QString fileName) const;
QHash<QString, bool> selectImport() const; QHash<QString, bool> selectImport() const;
void writeFile(QSettings &settings, const QString key, const QString fileName) const; void writeFile(QSettings &settings, const QString key,
const QString fileName) const;
// properties // properties
QString m_baseDir = QString("%1/awesomewidgets"). QString m_baseDir = QString("%1/awesomewidgets")
arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)); .arg(QStandardPaths::writableLocation(
QStringList m_dirs = QStringList() << QString("desktops") << QString("quotes") QStandardPaths::GenericDataLocation));
<< QString("scripts") << QString("upgrade") << QString("weather"); QStringList m_dirs = QStringList()
<< QString("desktops") << QString("quotes")
<< QString("scripts") << QString("upgrade")
<< QString("weather");
}; };

View File

@ -39,8 +39,8 @@ AWDataAggregator::AWDataAggregator(QObject *parent)
qRegisterMetaType<QHash<QString, QString>>("QHash<QString, QString>"); qRegisterMetaType<QHash<QString, QString>>("QHash<QString, QString>");
initScene(); initScene();
connect(this, SIGNAL(updateData(const QHash<QString, QString>)), connect(this, SIGNAL(updateData(const QHash<QString, QString> &)), this,
this, SLOT(dataUpdate(const QHash<QString, QString>))); SLOT(dataUpdate(const QHash<QString, QString> &)));
} }
@ -61,7 +61,7 @@ QList<float> AWDataAggregator::getData(const QString key) const
} }
QString AWDataAggregator::htmlImage(const QPixmap source) const QString AWDataAggregator::htmlImage(const QPixmap &source) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -71,7 +71,8 @@ QString AWDataAggregator::htmlImage(const QPixmap source) const
return byteArray.isEmpty() return byteArray.isEmpty()
? QString() ? QString()
: QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64())); : QString("<img src=\"data:image/png;base64,%1\"/>")
.arg(QString(byteArray.toBase64()));
} }
@ -104,17 +105,26 @@ void AWDataAggregator::setParameters(QVariantMap settings)
boundaries[QString("batTooltip")] = 100.0; boundaries[QString("batTooltip")] = 100.0;
requiredKeys.clear(); requiredKeys.clear();
if (configuration[QString("cpuTooltip")].toBool()) requiredKeys.append(QString("cpuTooltip")); if (configuration[QString("cpuTooltip")].toBool())
if (configuration[QString("cpuclTooltip")].toBool()) requiredKeys.append(QString("cpuclTooltip")); requiredKeys.append(QString("cpuTooltip"));
if (configuration[QString("memTooltip")].toBool()) requiredKeys.append(QString("memTooltip")); if (configuration[QString("cpuclTooltip")].toBool())
if (configuration[QString("swapTooltip")].toBool()) requiredKeys.append(QString("swapTooltip")); requiredKeys.append(QString("cpuclTooltip"));
if (configuration[QString("downTooltip")].toBool()) requiredKeys.append(QString("downTooltip")); if (configuration[QString("memTooltip")].toBool())
if (configuration[QString("upTooltip")].toBool()) requiredKeys.append(QString("upTooltip")); requiredKeys.append(QString("memTooltip"));
if (configuration[QString("batTooltip")].toBool()) requiredKeys.append(QString("batTooltip")); 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"));
// background // background
toolTipScene->setBackgroundBrush(configuration[QString("useTooltipBackground")].toBool() toolTipScene->setBackgroundBrush(
? QBrush(QColor(configuration[QString("tooltipBackground")].toString())) configuration[QString("useTooltipBackground")].toBool()
? QBrush(QColor(
configuration[QString("tooltipBackground")].toString()))
: QBrush(Qt::NoBrush)); : QBrush(Qt::NoBrush));
} }
@ -136,7 +146,8 @@ QPixmap AWDataAggregator::tooltipImage()
shift -= 100.0; shift -= 100.0;
// apply pen color // apply pen color
if (key != QString("batTooltip")) if (key != QString("batTooltip"))
pen.setColor(QColor(configuration[QString("%1Color").arg(key)].toString())); pen.setColor(
QColor(configuration[QString("%1Color").arg(key)].toString()));
// paint data inside frame // paint data inside frame
for (int j = 0; j < data[key].count() - 1; j++) { for (int j = 0; j < data[key].count() - 1; j++) {
// some magic here // some magic here
@ -146,9 +157,12 @@ QPixmap AWDataAggregator::tooltipImage()
float y2 = -fabs(data[key].at(j + 1)) * normY + 5.0; float y2 = -fabs(data[key].at(j + 1)) * normY + 5.0;
if (key == QString("batTooltip")) { if (key == QString("batTooltip")) {
if (data[key].at(j + 1) > 0) if (data[key].at(j + 1) > 0)
pen.setColor(QColor(configuration[QString("batTooltipColor")].toString())); pen.setColor(QColor(
configuration[QString("batTooltipColor")].toString()));
else else
pen.setColor(QColor(configuration[QString("batInTooltipColor")].toString())); pen.setColor(
QColor(configuration[QString("batInTooltipColor")]
.toString()));
} }
toolTipScene->addLine(x1, y1, x2, y2, pen); toolTipScene->addLine(x1, y1, x2, y2, pen);
} }
@ -160,7 +174,7 @@ QPixmap AWDataAggregator::tooltipImage()
} }
void AWDataAggregator::dataUpdate(const QHash<QString, QString> values) void AWDataAggregator::dataUpdate(const QHash<QString, QString> &values)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -178,11 +192,15 @@ void AWDataAggregator::checkValue(const QString source, const float value,
qCDebug(LOG_AW) << "Called with extremum" << extremum; qCDebug(LOG_AW) << "Called with extremum" << extremum;
if (value >= 0.0) { if (value >= 0.0) {
if ((m_enablePopup) && (value > extremum) && (data[source].last() < extremum)) if ((m_enablePopup) && (value > extremum)
return AWActions::sendNotification(QString("event"), notificationText(source, value)); && (data[source].last() < extremum))
return AWActions::sendNotification(QString("event"),
notificationText(source, value));
} else { } else {
if ((m_enablePopup) && (value < extremum) && (data[source].last() > extremum)) if ((m_enablePopup) && (value < extremum)
return AWActions::sendNotification(QString("event"), notificationText(source, value)); && (data[source].last() > extremum))
return AWActions::sendNotification(QString("event"),
notificationText(source, value));
} }
} }
@ -196,7 +214,8 @@ void AWDataAggregator::checkValue(const QString source, const QString current,
qCDebug(LOG_AW) << "Received value" << received; qCDebug(LOG_AW) << "Received value" << received;
if ((m_enablePopup) && (current != received) && (!received.isEmpty())) if ((m_enablePopup) && (current != received) && (!received.isEmpty()))
return AWActions::sendNotification(QString("event"), notificationText(source, received)); return AWActions::sendNotification(QString("event"),
notificationText(source, received));
} }
@ -214,7 +233,8 @@ void AWDataAggregator::initScene()
} }
QString AWDataAggregator::notificationText(const QString source, const float value) const QString AWDataAggregator::notificationText(const QString source,
const float value) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Notification source" << source; qCDebug(LOG_AW) << "Notification source" << source;
@ -236,7 +256,8 @@ QString AWDataAggregator::notificationText(const QString source, const float val
} }
QString AWDataAggregator::notificationText(const QString source, const QString value) const QString AWDataAggregator::notificationText(const QString source,
const QString value) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Notification source" << source; qCDebug(LOG_AW) << "Notification source" << source;
@ -250,7 +271,7 @@ QString AWDataAggregator::notificationText(const QString source, const QString v
} }
void AWDataAggregator::setData(const QHash< QString, QString > values) void AWDataAggregator::setData(const QHash<QString, QString> &values)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -277,7 +298,8 @@ void AWDataAggregator::setData(const QHash< QString, QString > values)
} }
void AWDataAggregator::setData(const QString source, float value, const float extremum) void AWDataAggregator::setData(const QString &source, float value,
const float extremum)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << source; qCDebug(LOG_AW) << "Source" << source;
@ -286,7 +308,8 @@ void AWDataAggregator::setData(const QString source, float value, const float ex
if (data[source].count() == 0) if (data[source].count() == 0)
data[source].append(0.0); data[source].append(0.0);
else if (data[source].count() > configuration[QString("tooltipNumber")].toInt()) else if (data[source].count()
> configuration[QString("tooltipNumber")].toInt())
data[source].removeFirst(); data[source].removeFirst();
if (isnan(value)) if (isnan(value))
value = 0.0; value = 0.0;
@ -296,14 +319,17 @@ void AWDataAggregator::setData(const QString source, float value, const float ex
data[source].append(value); data[source].append(value);
if (source == QString("downTooltip")) { if (source == QString("downTooltip")) {
QList<float> netValues = data[QString("downTooltip")] + data[QString("upTooltip")]; QList<float> netValues
boundaries[QString("downTooltip")] = 1.2 * *std::max_element(netValues.cbegin(), netValues.cend()); = data[QString("downTooltip")] + data[QString("upTooltip")];
boundaries[QString("downTooltip")]
= 1.2 * *std::max_element(netValues.cbegin(), netValues.cend());
boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")]; boundaries[QString("upTooltip")] = boundaries[QString("downTooltip")];
} }
} }
void AWDataAggregator::setData(const bool dontInvert, const QString source, float value) void AWDataAggregator::setData(const bool dontInvert, const QString &source,
float value)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Do not invert value" << dontInvert; qCDebug(LOG_AW) << "Do not invert value" << dontInvert;

View File

@ -36,31 +36,34 @@ public:
explicit AWDataAggregator(QObject *parent = nullptr); explicit AWDataAggregator(QObject *parent = nullptr);
virtual ~AWDataAggregator(); virtual ~AWDataAggregator();
QList<float> getData(const QString key) const; QList<float> getData(const QString key) const;
QString htmlImage(const QPixmap source) const; QString htmlImage(const QPixmap &source) const;
void setParameters(QVariantMap settings); void setParameters(QVariantMap settings);
QPixmap tooltipImage(); QPixmap tooltipImage();
signals: signals:
void updateData(const QHash<QString, QString> values); void updateData(const QHash<QString, QString> &values);
void toolTipPainted(const QString image) const; void toolTipPainted(const QString image) const;
public slots: public slots:
void dataUpdate(const QHash<QString, QString> values); void dataUpdate(const QHash<QString, QString> &values);
private: private:
// ui // ui
QGraphicsScene *toolTipScene = nullptr; QGraphicsScene *toolTipScene = nullptr;
QGraphicsView *toolTipView = nullptr; QGraphicsView *toolTipView = nullptr;
void checkValue(const QString source, const float value, const float extremum) const; void checkValue(const QString source, const float value,
void checkValue(const QString source, const QString current, const QString received) const; const float extremum) const;
void checkValue(const QString source, const QString current,
const QString received) const;
void initScene(); void initScene();
QString notificationText(const QString source, const float value) const; QString notificationText(const QString source, const float value) const;
QString notificationText(const QString source, const QString value) const; QString notificationText(const QString source, const QString value) const;
// main method // main method
void setData(const QHash<QString, QString> values); void setData(const QHash<QString, QString> &values);
void setData(const QString source, float value, const float extremum = -1.0); void setData(const QString &source, float value,
const float extremum = -1.0);
// different signature for battery device // different signature for battery device
void setData(const bool dontInvert, const QString source, float value); void setData(const bool dontInvert, const QString &source, float value);
// variables // variables
int counts = 0; int counts = 0;
QVariantHash configuration; QVariantHash configuration;

View File

@ -23,7 +23,8 @@
#include "awkeys.h" #include "awkeys.h"
AWDataEngineAggregator::AWDataEngineAggregator(QObject *parent, const int interval) AWDataEngineAggregator::AWDataEngineAggregator(QObject *parent,
const int interval)
: QObject(parent) : QObject(parent)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -37,10 +38,22 @@ AWDataEngineAggregator::~AWDataEngineAggregator()
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
// disconnect sources first
disconnectSources();
m_dataEngines.clear(); m_dataEngines.clear();
} }
void AWDataEngineAggregator::disconnectSources()
{
qCDebug(LOG_AW);
foreach (QString dataengine, m_dataEngines.keys())
foreach (QString source, m_dataEngines[dataengine]->sources())
m_dataEngines[dataengine]->disconnectSource(source, parent());
}
void AWDataEngineAggregator::setInterval(const int _interval) void AWDataEngineAggregator::setInterval(const int _interval)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
@ -55,7 +68,8 @@ void AWDataEngineAggregator::dropSource(const QString source)
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << source; qCDebug(LOG_AW) << "Source" << source;
// FIXME there is no possiblibity to check to which dataengine source connected // FIXME there is no possibility to check to which dataengine source
// connected
// we will try to disconnect it from systemmonitor and extsysmon // we will try to disconnect it from systemmonitor and extsysmon
m_dataEngines[QString("systemmonitor")]->disconnectSource(source, parent()); m_dataEngines[QString("systemmonitor")]->disconnectSource(source, parent());
m_dataEngines[QString("extsysmon")]->disconnectSource(source, parent()); m_dataEngines[QString("extsysmon")]->disconnectSource(source, parent());
@ -66,9 +80,12 @@ void AWDataEngineAggregator::reconnectSources()
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
m_dataEngines[QString("systemmonitor")]->connectAllSources(parent(), m_interval); m_dataEngines[QString("systemmonitor")]->connectAllSources(parent(),
m_dataEngines[QString("extsysmon")]->connectAllSources(parent(), m_interval); m_interval);
m_dataEngines[QString("time")]->connectSource(QString("Local"), parent(), 1000); m_dataEngines[QString("extsysmon")]->connectAllSources(parent(),
m_interval);
m_dataEngines[QString("time")]->connectSource(QString("Local"), parent(),
1000);
} }
@ -77,14 +94,17 @@ void AWDataEngineAggregator::initDataEngines()
qCDebug(LOG_AW); qCDebug(LOG_AW);
Plasma::DataEngineConsumer *deConsumer = new Plasma::DataEngineConsumer(); Plasma::DataEngineConsumer *deConsumer = new Plasma::DataEngineConsumer();
m_dataEngines[QString("systemmonitor")] = deConsumer->dataEngine(QString("systemmonitor")); m_dataEngines[QString("systemmonitor")]
m_dataEngines[QString("extsysmon")] = deConsumer->dataEngine(QString("extsysmon")); = deConsumer->dataEngine(QString("systemmonitor"));
m_dataEngines[QString("extsysmon")]
= deConsumer->dataEngine(QString("extsysmon"));
m_dataEngines[QString("time")] = deConsumer->dataEngine(QString("time")); m_dataEngines[QString("time")] = deConsumer->dataEngine(QString("time"));
// additional method required by systemmonitor structure // additional method required by systemmonitor structure
connect(m_dataEngines[QString("systemmonitor")], &Plasma::DataEngine::sourceAdded, connect(m_dataEngines[QString("systemmonitor")],
[this](const QString source) { &Plasma::DataEngine::sourceAdded, [this](const QString source) {
static_cast<AWKeys *>(parent())->addDevice(source); static_cast<AWKeys *>(parent())->addDevice(source);
m_dataEngines[QString("systemmonitor")]->connectSource(source, parent(), m_interval); m_dataEngines[QString("systemmonitor")]->connectSource(
source, parent(), m_interval);
}); });
} }

View File

@ -29,8 +29,10 @@ class AWDataEngineAggregator : public QObject
Q_PROPERTY(int interval MEMBER m_interval WRITE setInterval); Q_PROPERTY(int interval MEMBER m_interval WRITE setInterval);
public: public:
explicit AWDataEngineAggregator(QObject *parent = nullptr, const int interval = 1000); explicit AWDataEngineAggregator(QObject *parent = nullptr,
const int interval = 1000);
virtual ~AWDataEngineAggregator(); virtual ~AWDataEngineAggregator();
void disconnectSources();
// properties // properties
void setInterval(const int _interval); void setInterval(const int _interval);

View File

@ -55,8 +55,8 @@ AWKeys::AWKeys(QObject *parent)
aggregator = new AWKeysAggregator(this); aggregator = new AWKeysAggregator(this);
dataAggregator = new AWDataAggregator(this); dataAggregator = new AWDataAggregator(this);
// transfer signal from AWDataAggregator object to QML ui // transfer signal from AWDataAggregator object to QML ui
connect(dataAggregator, SIGNAL(toolTipPainted(const QString)), connect(dataAggregator, SIGNAL(toolTipPainted(const QString)), this,
this, SIGNAL(needToolTipToBeUpdated(const QString))); SIGNAL(needToolTipToBeUpdated(const QString)));
connect(this, SIGNAL(needToBeUpdated()), this, SLOT(updateTextData())); connect(this, SIGNAL(needToBeUpdated()), this, SLOT(updateTextData()));
} }
@ -66,15 +66,22 @@ AWKeys::~AWKeys()
qCDebug(LOG_AW); qCDebug(LOG_AW);
// extensions // extensions
if (graphicalItems != nullptr) delete graphicalItems; if (graphicalItems != nullptr)
if (extQuotes != nullptr) delete extQuotes; delete graphicalItems;
if (extScripts != nullptr) delete extScripts; if (extQuotes != nullptr)
if (extUpgrade != nullptr) delete extUpgrade; delete extQuotes;
if (extWeather != nullptr) delete extWeather; if (extScripts != nullptr)
delete extScripts;
if (extUpgrade != nullptr)
delete extUpgrade;
if (extWeather != nullptr)
delete extWeather;
// core // core
if (dataEngineAggregator != nullptr) delete dataEngineAggregator; if (dataEngineAggregator != nullptr)
if (m_threadPool != nullptr) delete m_threadPool; delete dataEngineAggregator;
if (m_threadPool != nullptr)
delete m_threadPool;
delete aggregator; delete aggregator;
delete dataAggregator; delete dataAggregator;
} }
@ -89,7 +96,8 @@ void AWKeys::initDataAggregator(const QVariantMap tooltipParams)
} }
void AWKeys::initKeys(const QString currentPattern, const int interval, const int limit) void AWKeys::initKeys(const QString currentPattern, const int interval,
const int limit)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Pattern" << currentPattern; qCDebug(LOG_AW) << "Pattern" << currentPattern;
@ -105,7 +113,8 @@ void AWKeys::initKeys(const QString currentPattern, const int interval, const in
} else } else
dataEngineAggregator->setInterval(interval); dataEngineAggregator->setInterval(interval);
#ifdef BUILD_FUTURE #ifdef BUILD_FUTURE
m_threadPool->setMaxThreadCount(limit == 0 ? QThread::idealThreadCount() : limit); m_threadPool->setMaxThreadCount(limit == 0 ? QThread::idealThreadCount()
: limit);
#endif /* BUILD_FUTURE */ #endif /* BUILD_FUTURE */
updateCache(); updateCache();
@ -149,12 +158,18 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
QStringList allKeys; QStringList allKeys;
// weather // weather
for (int i = extWeather->activeItems().count() - 1; i >= 0; i--) { for (int i = extWeather->activeItems().count() - 1; i >= 0; i--) {
allKeys.append(extWeather->activeItems().at(i)->tag(QString("weatherId"))); allKeys.append(
allKeys.append(extWeather->activeItems().at(i)->tag(QString("weather"))); extWeather->activeItems().at(i)->tag(QString("weatherId")));
allKeys.append(extWeather->activeItems().at(i)->tag(QString("humidity"))); allKeys.append(
allKeys.append(extWeather->activeItems().at(i)->tag(QString("pressure"))); extWeather->activeItems().at(i)->tag(QString("weather")));
allKeys.append(extWeather->activeItems().at(i)->tag(QString("temperature"))); allKeys.append(
allKeys.append(extWeather->activeItems().at(i)->tag(QString("timestamp"))); extWeather->activeItems().at(i)->tag(QString("humidity")));
allKeys.append(
extWeather->activeItems().at(i)->tag(QString("pressure")));
allKeys.append(
extWeather->activeItems().at(i)->tag(QString("temperature")));
allKeys.append(
extWeather->activeItems().at(i)->tag(QString("timestamp")));
} }
// time // time
allKeys.append(QString("time")); allKeys.append(QString("time"));
@ -233,10 +248,10 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
allKeys.append(QString("netdev")); allKeys.append(QString("netdev"));
// battery // battery
allKeys.append(QString("ac")); allKeys.append(QString("ac"));
QStringList allBatteryDevices = QDir(QString("/sys/class/power_supply")). QStringList allBatteryDevices
entryList(QStringList() << QString("BAT*"), = QDir(QString("/sys/class/power_supply"))
QDir::Dirs | QDir::NoDotAndDotDot, .entryList(QStringList() << QString("BAT*"),
QDir::Name); QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
for (int i = allBatteryDevices.count() - 1; i >= 0; i--) for (int i = allBatteryDevices.count() - 1; i >= 0; i--)
allKeys.append(QString("bat%1").arg(i)); allKeys.append(QString("bat%1").arg(i));
allKeys.append(QString("bat")); allKeys.append(QString("bat"));
@ -258,18 +273,23 @@ QStringList AWKeys::dictKeys(const bool sorted, const QString regexp) const
allKeys.append(QString("ps")); allKeys.append(QString("ps"));
// package manager // package manager
for (int i = extUpgrade->activeItems().count() - 1; i >= 0; i--) for (int i = extUpgrade->activeItems().count() - 1; i >= 0; i--)
allKeys.append(extUpgrade->activeItems().at(i)->tag(QString("pkgcount"))); allKeys.append(
extUpgrade->activeItems().at(i)->tag(QString("pkgcount")));
// quotes // quotes
for (int i = extQuotes->activeItems().count() - 1; i >= 0; i--) { for (int i = extQuotes->activeItems().count() - 1; i >= 0; i--) {
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask"))); allKeys.append(extQuotes->activeItems().at(i)->tag(QString("ask")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg"))); allKeys.append(extQuotes->activeItems().at(i)->tag(QString("askchg")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percaskchg"))); allKeys.append(
extQuotes->activeItems().at(i)->tag(QString("percaskchg")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid"))); allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bid")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg"))); allKeys.append(extQuotes->activeItems().at(i)->tag(QString("bidchg")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percbidchg"))); allKeys.append(
extQuotes->activeItems().at(i)->tag(QString("percbidchg")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price"))); allKeys.append(extQuotes->activeItems().at(i)->tag(QString("price")));
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("pricechg"))); allKeys.append(
allKeys.append(extQuotes->activeItems().at(i)->tag(QString("percpricechg"))); extQuotes->activeItems().at(i)->tag(QString("pricechg")));
allKeys.append(
extQuotes->activeItems().at(i)->tag(QString("percpricechg")));
} }
// custom // custom
for (int i = extScripts->activeItems().count() - 1; i >= 0; i--) for (int i = extScripts->activeItems().count() - 1; i >= 0; i--)
@ -318,23 +338,47 @@ QString AWKeys::infoByKey(QString key) const
key.remove(QRegExp(QString("^bar[0-9]{1,}"))); key.remove(QRegExp(QString("^bar[0-9]{1,}")));
if (key.startsWith(QString("custom"))) if (key.startsWith(QString("custom")))
return extScripts->itemByTagNumber(key.remove(QString("custom")).toInt())->uniq(); return extScripts->itemByTagNumber(
key.remove(QString("custom")).toInt())
->uniq();
else if (key.contains(QRegExp(QString("^hdd[rw]")))) else if (key.contains(QRegExp(QString("^hdd[rw]"))))
return QString("%1").arg(m_devices[QString("disk")][key.remove(QRegExp(QString("hdd[rw]"))).toInt()]); return QString("%1").arg(m_devices[QString(
else if (key.contains(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))) "disk")][key.remove(QRegExp(QString("hdd[rw]"))).toInt()]);
return QString("%1").arg(m_devices[QString("mount")][key.remove(QRegExp(QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))).toInt()]); else if (key.contains(QRegExp(
QString("^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)"))))
return QString("%1").arg(m_devices[QString(
"mount")][key
.remove(QRegExp(QString(
"^hdd([0-9]|mb|gb|freemb|freegb|totmb|totgb)")))
.toInt()]);
else if (key.startsWith(QString("hddtemp"))) else if (key.startsWith(QString("hddtemp")))
return QString("%1").arg(m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()]); return QString("%1").arg(
m_devices[QString("hdd")][key.remove(QString("hddtemp")).toInt()]);
else if (key.contains(QRegExp(QString("^(down|up)[0-9]")))) else if (key.contains(QRegExp(QString("^(down|up)[0-9]"))))
return QString("%1").arg(m_devices[QString("net")][key.remove(QRegExp(QString("^(down|up)"))).toInt()]); return QString("%1").arg(m_devices[QString(
"net")][key.remove(QRegExp(QString("^(down|up)"))).toInt()]);
else if (key.startsWith(QString("pkgcount"))) else if (key.startsWith(QString("pkgcount")))
return extUpgrade->itemByTagNumber(key.remove(QString("pkgcount")).toInt())->uniq(); return extUpgrade->itemByTagNumber(
key.remove(QString("pkgcount")).toInt())
->uniq();
else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)")))) else if (key.contains(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))))
return extQuotes->itemByTagNumber(key.remove(QRegExp(QString("(^|perc)(ask|bid|price)(chg|)"))).toInt())->uniq(); return extQuotes->itemByTagNumber(
else if (key.contains(QRegExp(QString("(weather|weatherId|humidity|pressure|temperature)")))) key.remove(QRegExp(QString(
return extWeather->itemByTagNumber(key.remove(QRegExp(QString("(weather|weatherId|humidity|pressure|temperature)"))).toInt())->uniq(); "(^|perc)(ask|bid|price)(chg|)")))
.toInt())
->uniq();
else if (key.contains(QRegExp(
QString("(weather|weatherId|humidity|pressure|temperature)"))))
return extWeather
->itemByTagNumber(
key
.remove(QRegExp(QString(
"(weather|weatherId|humidity|pressure|temperature)")))
.toInt())
->uniq();
else if (key.startsWith(QString("temp"))) else if (key.startsWith(QString("temp")))
return QString("%1").arg(m_devices[QString("temp")][key.remove(QString("temp")).toInt()]); return QString("%1").arg(
m_devices[QString("temp")][key.remove(QString("temp")).toInt()]);
return QString("(none)"); return QString("(none)");
} }
@ -346,7 +390,8 @@ QString AWKeys::valueByKey(QString key) const
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Requested key" << key; qCDebug(LOG_AW) << "Requested key" << key;
return values.value(key.remove(QRegExp(QString("^bar[0-9]{1,}"))), QString("")); return values.value(key.remove(QRegExp(QString("^bar[0-9]{1,}"))),
QString(""));
} }
@ -356,7 +401,8 @@ void AWKeys::editItem(const QString type)
qCDebug(LOG_AW) << "Item type" << type; qCDebug(LOG_AW) << "Item type" << type;
if (type == QString("graphicalitem")) { if (type == QString("graphicalitem")) {
graphicalItems->setConfigArgs(dictKeys(true, QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)"))); graphicalItems->setConfigArgs(dictKeys(
true, QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")));
return graphicalItems->editItems(); return graphicalItems->editItems();
} else if (type == QString("extquotes")) { } else if (type == QString("extquotes")) {
return extQuotes->editItems(); return extQuotes->editItems();
@ -375,7 +421,8 @@ void AWKeys::addDevice(const QString source)
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << source; qCDebug(LOG_AW) << "Source" << source;
QRegExp diskRegexp = QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)")); QRegExp diskRegexp
= QRegExp(QString("disk/(?:md|sd|hd)[a-z|0-9]_.*/Rate/(?:rblk)"));
QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel")); QRegExp mountRegexp = QRegExp(QString("partitions/.*/filllevel"));
if (source.contains(diskRegexp)) { if (source.contains(diskRegexp)) {
@ -392,7 +439,8 @@ void AWKeys::addDevice(const QString source)
} }
void AWKeys::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) void AWKeys::dataUpdated(const QString &sourceName,
const Plasma::DataEngine::Data &data)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << sourceName; qCDebug(LOG_AW) << "Source" << sourceName;
@ -403,7 +451,8 @@ void AWKeys::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Da
#ifdef BUILD_FUTURE #ifdef BUILD_FUTURE
// run concurrent data update // run concurrent data update
QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sourceName, data); QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sourceName,
data);
#else /* BUILD_FUTURE */ #else /* BUILD_FUTURE */
return setDataBySource(sourceName, data); return setDataBySource(sourceName, data);
#endif /* BUILD_FUTURE */ #endif /* BUILD_FUTURE */
@ -414,8 +463,9 @@ void AWKeys::loadKeysFromCache()
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
QString fileName = QString("%1/awesomewidgets.ndx"). QString fileName = QString("%1/awesomewidgets.ndx")
arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)); .arg(QStandardPaths::writableLocation(
QStandardPaths::GenericCacheLocation));
qCInfo(LOG_AW) << "Cache file" << fileName; qCInfo(LOG_AW) << "Cache file" << fileName;
QSettings cache(fileName, QSettings::IniFormat); QSettings cache(fileName, QSettings::IniFormat);
@ -437,13 +487,19 @@ void AWKeys::reinitKeys()
// renew extensions // renew extensions
// delete them if any // delete them if any
if (graphicalItems != nullptr) delete graphicalItems; if (graphicalItems != nullptr)
if (extQuotes != nullptr) delete extQuotes; delete graphicalItems;
if (extScripts != nullptr) delete extScripts; if (extQuotes != nullptr)
if (extUpgrade != nullptr) delete extUpgrade; delete extQuotes;
if (extWeather != nullptr) delete extWeather; if (extScripts != nullptr)
delete extScripts;
if (extUpgrade != nullptr)
delete extUpgrade;
if (extWeather != nullptr)
delete extWeather;
// create // create
graphicalItems = new ExtItemAggregator<GraphicalItem>(nullptr, QString("desktops")); graphicalItems
= new ExtItemAggregator<GraphicalItem>(nullptr, QString("desktops"));
extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes")); extQuotes = new ExtItemAggregator<ExtQuotes>(nullptr, QString("quotes"));
extScripts = new ExtItemAggregator<ExtScript>(nullptr, QString("scripts")); extScripts = new ExtItemAggregator<ExtScript>(nullptr, QString("scripts"));
extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade")); extUpgrade = new ExtItemAggregator<ExtUpgrade>(nullptr, QString("upgrade"));
@ -467,8 +523,8 @@ void AWKeys::reinitKeys()
m_foundBars = [allKeys](QString pattern) { m_foundBars = [allKeys](QString pattern) {
QStringList selectedKeys; QStringList selectedKeys;
foreach (QString key, allKeys) foreach (QString key, allKeys)
if ((key.startsWith(QString("bar"))) && if ((key.startsWith(QString("bar")))
(pattern.contains(QString("$%1").arg(key)))) { && (pattern.contains(QString("$%1").arg(key)))) {
qCInfo(LOG_AW) << "Found bar" << key; qCInfo(LOG_AW) << "Found bar" << key;
selectedKeys.append(key); selectedKeys.append(key);
} }
@ -481,8 +537,8 @@ void AWKeys::reinitKeys()
m_foundKeys = [allKeys](QString pattern) { m_foundKeys = [allKeys](QString pattern) {
QStringList selectedKeys; QStringList selectedKeys;
foreach (QString key, allKeys) foreach (QString key, allKeys)
if ((!key.startsWith(QString("bar"))) && if ((!key.startsWith(QString("bar")))
(pattern.contains(QString("$%1").arg(key)))) { && (pattern.contains(QString("$%1").arg(key)))) {
qCInfo(LOG_AW) << "Found key" << key; qCInfo(LOG_AW) << "Found key" << key;
selectedKeys.append(key); selectedKeys.append(key);
} }
@ -495,8 +551,10 @@ void AWKeys::reinitKeys()
m_foundLambdas = [](QString pattern) { m_foundLambdas = [](QString pattern) {
QStringList selectedKeys; QStringList selectedKeys;
// substring inside ${{ }} (with brackets) which should not contain ${{ // substring inside ${{ }} (with brackets) which should not contain ${{
QRegularExpression lambdaRegexp(QString("\\$\\{\\{((?!\\$\\{\\{).)*?\\}\\}")); QRegularExpression lambdaRegexp(
lambdaRegexp.setPatternOptions(QRegularExpression::DotMatchesEverythingOption); QString("\\$\\{\\{((?!\\$\\{\\{).)*?\\}\\}"));
lambdaRegexp.setPatternOptions(
QRegularExpression::DotMatchesEverythingOption);
QRegularExpressionMatchIterator it = lambdaRegexp.globalMatch(pattern); QRegularExpressionMatchIterator it = lambdaRegexp.globalMatch(pattern);
while (it.hasNext()) { while (it.hasNext()) {
@ -535,8 +593,9 @@ void AWKeys::addKeyToCache(const QString type, const QString key)
qCDebug(LOG_AW) << "Key type" << type; qCDebug(LOG_AW) << "Key type" << type;
qCDebug(LOG_AW) << "Key" << key; qCDebug(LOG_AW) << "Key" << key;
QString fileName = QString("%1/awesomewidgets.ndx"). QString fileName = QString("%1/awesomewidgets.ndx")
arg(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)); .arg(QStandardPaths::writableLocation(
QStandardPaths::GenericCacheLocation));
qCInfo(LOG_AW) << "Cache file" << fileName; qCInfo(LOG_AW) << "Cache file" << fileName;
QSettings cache(fileName, QSettings::IniFormat); QSettings cache(fileName, QSettings::IniFormat);
@ -546,29 +605,37 @@ void AWKeys::addKeyToCache(const QString type, const QString key)
cachedValues.append(cache.value(key).toString()); cachedValues.append(cache.value(key).toString());
if (type == QString("hdd")) { if (type == QString("hdd")) {
QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name); QStringList allDevices
QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$"))); = QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
QStringList devices
= allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
foreach (QString dev, devices) { foreach (QString dev, devices) {
QString device = QString("/dev/%1").arg(dev); QString device = QString("/dev/%1").arg(dev);
if (cachedValues.contains(device)) if (cachedValues.contains(device))
continue; continue;
qCInfo(LOG_AW) << "Found new key" << device << "for type" << type; qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
cache.setValue(QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), device); cache.setValue(
QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
device);
} }
} else if (type == QString("net")) { } else if (type == QString("net")) {
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces(); QList<QNetworkInterface> rawInterfaceList
= QNetworkInterface::allInterfaces();
foreach (QNetworkInterface interface, rawInterfaceList) { foreach (QNetworkInterface interface, rawInterfaceList) {
QString device = interface.name(); QString device = interface.name();
if (cachedValues.contains(device)) if (cachedValues.contains(device))
continue; continue;
qCInfo(LOG_AW) << "Found new key" << device << "for type" << type; qCInfo(LOG_AW) << "Found new key" << device << "for type" << type;
cache.setValue(QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), device); cache.setValue(
QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')),
device);
} }
} else { } else {
if (cachedValues.contains(key)) if (cachedValues.contains(key))
return; return;
qCInfo(LOG_AW) << "Found new key" << key << "for type" << type; qCInfo(LOG_AW) << "Found new key" << key << "for type" << type;
cache.setValue(QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), key); cache.setValue(
QString("%1").arg(cache.allKeys().count(), 3, 10, QChar('0')), key);
} }
cache.endGroup(); cache.endGroup();
@ -586,22 +653,29 @@ void AWKeys::calculateValues()
// hddtot* // hddtot*
foreach (QString device, m_devices[QString("mount")]) { foreach (QString device, m_devices[QString("mount")]) {
int index = m_devices[QString("mount")].indexOf(device); int index = m_devices[QString("mount")].indexOf(device);
values[QString("hddtotmb%1").arg(index)] = QString("%1"). values[QString("hddtotmb%1").arg(index)] = QString("%1").arg(
arg(values[QString("hddfreemb%1").arg(index)].toFloat() values[QString("hddfreemb%1").arg(index)].toFloat()
+ values[QString("hddmb%1").arg(index)].toFloat(), 5, 'f', 0); + values[QString("hddmb%1").arg(index)].toFloat(),
values[QString("hddtotgb%1").arg(index)] = QString("%1"). 5, 'f', 0);
arg(values[QString("hddfreegb%1").arg(index)].toFloat() values[QString("hddtotgb%1").arg(index)] = QString("%1").arg(
+ values[QString("hddgb%1").arg(index)].toFloat(), 5, 'f', 1); values[QString("hddfreegb%1").arg(index)].toFloat()
+ values[QString("hddgb%1").arg(index)].toFloat(),
5, 'f', 1);
} }
// memtot* // memtot*
values[QString("memtotmb")] = QString("%1"). values[QString("memtotmb")]
arg(values[QString("memusedmb")].toInt() + values[QString("memfreemb")].toInt(), 5); = QString("%1").arg(values[QString("memusedmb")].toInt()
values[QString("memtotgb")] = QString("%1"). + values[QString("memfreemb")].toInt(),
arg(values[QString("memusedgb")].toFloat() + values[QString("memfreegb")].toFloat(), 5, 'f', 1); 5);
values[QString("memtotgb")]
= QString("%1").arg(values[QString("memusedgb")].toFloat()
+ values[QString("memfreegb")].toFloat(),
5, 'f', 1);
// mem // mem
values[QString("mem")] = QString("%1"). values[QString("mem")]
arg(100.0 * values[QString("memmb")].toFloat() / values[QString("memtotmb")].toFloat(), = QString("%1").arg(100.0 * values[QString("memmb")].toFloat()
/ values[QString("memtotmb")].toFloat(),
5, 'f', 1); 5, 'f', 1);
// up, down, upkb, downkb, upunits, downunits // up, down, upkb, downkb, upunits, downunits
@ -614,13 +688,18 @@ void AWKeys::calculateValues()
values[QString("upunits")] = values[QString("upunits%1").arg(netIndex)]; values[QString("upunits")] = values[QString("upunits%1").arg(netIndex)];
// swaptot* // swaptot*
values[QString("swaptotmb")] = QString("%1"). values[QString("swaptotmb")]
arg(values[QString("swapmb")].toInt() + values[QString("swapfreemb")].toInt(), 5); = QString("%1").arg(values[QString("swapmb")].toInt()
values[QString("swaptotgb")] = QString("%1"). + values[QString("swapfreemb")].toInt(),
arg(values[QString("swapgb")].toFloat() + values[QString("swapfreegb")].toFloat(), 5, 'f', 1); 5);
values[QString("swaptotgb")]
= QString("%1").arg(values[QString("swapgb")].toFloat()
+ values[QString("swapfreegb")].toFloat(),
5, 'f', 1);
// swap // swap
values[QString("swap")] = QString("%1"). values[QString("swap")]
arg(100.0 * values[QString("swapmb")].toFloat() / values[QString("swaptotmb")].toFloat(), = QString("%1").arg(100.0 * values[QString("swapmb")].toFloat()
/ values[QString("swaptotmb")].toFloat(),
5, 'f', 1); 5, 'f', 1);
// lambdas // lambdas
@ -634,7 +713,8 @@ void AWKeys::calculateValues()
qCInfo(LOG_AW) << "Expression" << key; qCInfo(LOG_AW) << "Expression" << key;
QJSValue result = engine.evaluate(key); QJSValue result = engine.evaluate(key);
if (result.isError()) { if (result.isError()) {
qCWarning(LOG_AW) << "Uncaught exception at line" << result.property("lineNumber").toInt() qCWarning(LOG_AW) << "Uncaught exception at line"
<< result.property("lineNumber").toInt()
<< ":" << result.toString(); << ":" << result.toString();
return QString(); return QString();
} else { } else {
@ -657,7 +737,8 @@ QString AWKeys::parsePattern(QString pattern) const
// main keys // main keys
foreach (QString key, m_foundKeys) foreach (QString key, m_foundKeys)
pattern.replace(QString("$%1").arg(key), [](QString key, QString value) { pattern.replace(QString("$%1").arg(key),
[](QString key, QString value) {
if ((!key.startsWith(QString("custom"))) if ((!key.startsWith(QString("custom")))
&& (!key.startsWith(QString("weather")))) && (!key.startsWith(QString("weather"))))
value.replace(QString(" "), QString("&nbsp;")); value.replace(QString(" "), QString("&nbsp;"));
@ -670,7 +751,8 @@ QString AWKeys::parsePattern(QString pattern) const
QString key = bar; QString key = bar;
key.remove(QRegExp(QString("^bar[0-9]{1,}"))); key.remove(QRegExp(QString("^bar[0-9]{1,}")));
if (item->type() == GraphicalItem::Graph) if (item->type() == GraphicalItem::Graph)
pattern.replace(QString("$%1").arg(bar), item->image([](const QList<float> data) { pattern.replace(QString("$%1").arg(bar),
item->image([](const QList<float> data) {
return QVariant::fromValue<QList<float>>(data); return QVariant::fromValue<QList<float>>(data);
}(dataAggregator->getData(key)))); }(dataAggregator->getData(key))));
else else
@ -695,7 +777,8 @@ void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
// first list init // first list init
QStringList tags = aggregator->keysFromSource(sourceName); QStringList tags = aggregator->keysFromSource(sourceName);
if (tags.isEmpty()) if (tags.isEmpty())
tags = aggregator->registerSource(sourceName, data[QString("units")].toString()); tags = aggregator->registerSource(sourceName,
data[QString("units")].toString());
// update data or drop source if there are no matches // update data or drop source if there are no matches
if (tags.isEmpty()) { if (tags.isEmpty()) {
@ -705,9 +788,13 @@ void AWKeys::setDataBySource(const QString &sourceName, const QVariantMap &data)
#ifdef BUILD_FUTURE #ifdef BUILD_FUTURE
m_mutex.lock(); m_mutex.lock();
#endif /* BUILD_FUTURE */ #endif /* BUILD_FUTURE */
// HACK workaround for time values which are stored in the different path // HACK workaround for time values which are stored in the different
QVariant value = sourceName == QString("Local") ? data[QString("DateTime")] : data[QString("value")]; // path
std::for_each(tags.cbegin(), tags.cend(), [this, value](const QString tag) { QVariant value = sourceName == QString("Local")
? data[QString("DateTime")]
: data[QString("value")];
std::for_each(tags.cbegin(), tags.cend(),
[this, value](const QString tag) {
values[tag] = aggregator->formater(value, tag); values[tag] = aggregator->formater(value, tag);
}); });
#ifdef BUILD_FUTURE #ifdef BUILD_FUTURE

View File

@ -46,7 +46,8 @@ public:
Q_INVOKABLE void initDataAggregator(const QVariantMap tooltipParams); Q_INVOKABLE void initDataAggregator(const QVariantMap tooltipParams);
Q_INVOKABLE void initKeys(const QString currentPattern, const int interval, Q_INVOKABLE void initKeys(const QString currentPattern, const int interval,
const int limit); const int limit);
Q_INVOKABLE void setAggregatorProperty(const QString key, const QVariant value); Q_INVOKABLE void setAggregatorProperty(const QString key,
const QVariant value);
Q_INVOKABLE void setWrapNewLines(const bool wrap = false); Q_INVOKABLE void setWrapNewLines(const bool wrap = false);
Q_INVOKABLE void updateCache(); Q_INVOKABLE void updateCache();
// keys // keys
@ -61,7 +62,8 @@ public:
public slots: public slots:
void addDevice(const QString source); void addDevice(const QString source);
void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); void dataUpdated(const QString &sourceName,
const Plasma::DataEngine::Data &data);
// dummy method required by DataEngine connections // dummy method required by DataEngine connections
void modelChanged(QString, QAbstractItemModel *){}; void modelChanged(QString, QAbstractItemModel *){};

View File

@ -39,7 +39,8 @@ AWKeysAggregator::~AWKeysAggregator()
} }
QString AWKeysAggregator::formater(const QVariant data, const QString key) const QString AWKeysAggregator::formater(const QVariant &data,
const QString &key) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Data" << data; qCDebug(LOG_AW) << "Data" << data;
@ -68,7 +69,8 @@ QString AWKeysAggregator::formater(const QVariant data, const QString key) const
output = data.toBool() ? m_acOnline : m_acOffline; output = data.toBool() ? m_acOnline : m_acOffline;
break; break;
case MemGBFormat: case MemGBFormat:
output = QString("%1").arg(data.toFloat() / (1024.0 * 1024.0), 5, 'f', 1); output
= QString("%1").arg(data.toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
break; break;
case MemMBFormat: case MemMBFormat:
output = QString("%1").arg(data.toFloat() / 1024.0, 5, 'f', 0); output = QString("%1").arg(data.toFloat() / 1024.0, 5, 'f', 0);
@ -116,19 +118,25 @@ QString AWKeysAggregator::formater(const QVariant data, const QString key) const
break; break;
case Uptime: case Uptime:
case UptimeCustom: case UptimeCustom:
output = [](QString source, const int uptime) { output =
[](QString source, const int uptime) {
int seconds = uptime - uptime % 60; int seconds = uptime - uptime % 60;
int minutes = seconds / 60 % 60; int minutes = seconds / 60 % 60;
int hours = ((seconds / 60) - minutes) / 60 % 24; int hours = ((seconds / 60) - minutes) / 60 % 24;
int days = (((seconds / 60) - minutes) / 60 - hours) / 24; int days = (((seconds / 60) - minutes) / 60 - hours) / 24;
source.replace(QString("$dd"), QString("%1").arg(days, 3, 10, QChar('0'))); source.replace(QString("$dd"),
QString("%1").arg(days, 3, 10, QChar('0')));
source.replace(QString("$d"), QString("%1").arg(days)); source.replace(QString("$d"), QString("%1").arg(days));
source.replace(QString("$hh"), QString("%1").arg(hours, 2, 10, QChar('0'))); source.replace(QString("$hh"),
QString("%1").arg(hours, 2, 10, QChar('0')));
source.replace(QString("$h"), QString("%1").arg(hours)); source.replace(QString("$h"), QString("%1").arg(hours));
source.replace(QString("$mm"), QString("%1").arg(minutes, 2, 10, QChar('0'))); source.replace(QString("$mm"),
QString("%1").arg(minutes, 2, 10, QChar('0')));
source.replace(QString("$m"), QString("%1").arg(minutes)); source.replace(QString("$m"), QString("%1").arg(minutes));
return source; return source;
}(m_formater[key] == Uptime ? QString("$ddd$hhh$mmm") : m_customUptime, data.toFloat()); }(m_formater[key] == Uptime ? QString("$ddd$hhh$mmm")
: m_customUptime,
data.toFloat());
break; break;
case NoFormat: case NoFormat:
default: default:
@ -140,7 +148,7 @@ QString AWKeysAggregator::formater(const QVariant data, const QString key) const
} }
QStringList AWKeysAggregator::keysFromSource(const QString source) const QStringList AWKeysAggregator::keysFromSource(const QString &source) const
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Search for source" << source; qCDebug(LOG_AW) << "Search for source" << source;
@ -212,8 +220,10 @@ void AWKeysAggregator::setTranslate(const bool translate)
} }
// HACK units required to define should the value be calculated as temperature or fan data // HACK units required to define should the value be calculated as temperature
QStringList AWKeysAggregator::registerSource(const QString source, const QString units) // or fan data
QStringList AWKeysAggregator::registerSource(const QString &source,
const QString &units)
{ {
qCDebug(LOG_AW); qCDebug(LOG_AW);
qCDebug(LOG_AW) << "Source" << source; qCDebug(LOG_AW) << "Source" << source;
@ -227,7 +237,8 @@ QStringList AWKeysAggregator::registerSource(const QString source, const QString
QRegExp mountFillRegExp = QRegExp(QString("partitions/.*/filllevel")); QRegExp mountFillRegExp = QRegExp(QString("partitions/.*/filllevel"));
QRegExp mountFreeRegExp = QRegExp(QString("partitions/.*/freespace")); QRegExp mountFreeRegExp = QRegExp(QString("partitions/.*/freespace"));
QRegExp mountUsedRegExp = QRegExp(QString("partitions/.*/usedspace")); QRegExp mountUsedRegExp = QRegExp(QString("partitions/.*/usedspace"));
QRegExp netRegExp = QRegExp(QString("network/interfaces/.*/(receiver|transmitter)/data$")); QRegExp netRegExp = QRegExp(
QString("network/interfaces/.*/(receiver|transmitter)/data$"));
if (source == QString("battery/ac")) { if (source == QString("battery/ac")) {
// AC // AC
@ -393,8 +404,10 @@ QStringList AWKeysAggregator::registerSource(const QString source, const QString
m_formater[QString("netdev")] = NoFormat; m_formater[QString("netdev")] = NoFormat;
} else if (source.contains(netRegExp)) { } else if (source.contains(netRegExp)) {
// network speed // network speed
QString type = source.contains(QString("receiver")) ? QString("down") : QString("up"); QString type = source.contains(QString("receiver")) ? QString("down")
int index = m_devices[QString("net")].indexOf(source.split(QChar('/'))[2]); : QString("up");
int index
= m_devices[QString("net")].indexOf(source.split(QChar('/'))[2]);
if (index > -1) { if (index > -1) {
// kb // kb
QString key = QString("%1kb%2").arg(type).arg(index); QString key = QString("%1kb%2").arg(type).arg(index);
@ -459,7 +472,8 @@ QStringList AWKeysAggregator::registerSource(const QString source, const QString
// temperature // temperature
int index = m_devices[QString("temp")].indexOf(source); int index = m_devices[QString("temp")].indexOf(source);
// FIXME on DE initialization there are no units key // FIXME on DE initialization there are no units key
if (units.isEmpty()) return QStringList() << QString("temp%1").arg(index); if (units.isEmpty())
return QStringList() << QString("temp%1").arg(index);
if (index > -1) { if (index > -1) {
QString key = QString("temp%1").arg(index); QString key = QString("temp%1").arg(index);
m_map[source] = key; m_map[source] = key;

View File

@ -31,7 +31,8 @@ class AWKeysAggregator : public QObject
Q_PROPERTY(QString acOffline MEMBER m_acOffline WRITE setAcOffline); Q_PROPERTY(QString acOffline MEMBER m_acOffline WRITE setAcOffline);
Q_PROPERTY(QString acOnline MEMBER m_acOnline WRITE setAcOnline); Q_PROPERTY(QString acOnline MEMBER m_acOnline WRITE setAcOnline);
Q_PROPERTY(QString customTime MEMBER m_customTime WRITE setCustomTime); Q_PROPERTY(QString customTime MEMBER m_customTime WRITE setCustomTime);
Q_PROPERTY(QString customUptime MEMBER m_customUptime WRITE setCustomUptime); Q_PROPERTY(
QString customUptime MEMBER m_customUptime WRITE setCustomUptime);
Q_PROPERTY(QString tempUnits MEMBER m_tempUnits WRITE setTempUnits); Q_PROPERTY(QString tempUnits MEMBER m_tempUnits WRITE setTempUnits);
Q_PROPERTY(bool translate MEMBER m_translate WRITE setTranslate); Q_PROPERTY(bool translate MEMBER m_translate WRITE setTranslate);
@ -64,8 +65,8 @@ public:
explicit AWKeysAggregator(QObject *parent = nullptr); explicit AWKeysAggregator(QObject *parent = nullptr);
virtual ~AWKeysAggregator(); virtual ~AWKeysAggregator();
// get methods // get methods
QString formater(const QVariant data, const QString key) const; QString formater(const QVariant &data, const QString &key) const;
QStringList keysFromSource(const QString source) const; QStringList keysFromSource(const QString &source) const;
// set methods // set methods
void setAcOffline(const QString inactive); void setAcOffline(const QString inactive);
void setAcOnline(const QString active); void setAcOnline(const QString active);
@ -76,7 +77,7 @@ public:
void setTranslate(const bool translate); void setTranslate(const bool translate);
public slots: public slots:
QStringList registerSource(const QString source, const QString units); QStringList registerSource(const QString &source, const QString &units);
private: private:
float temperature(const float temp) const; float temperature(const float temp) const;
@ -90,7 +91,7 @@ private:
QHash<QString, FormaterType> m_formater; QHash<QString, FormaterType> m_formater;
QHash<QString, QString> m_map; QHash<QString, QString> m_map;
QString m_tempUnits; QString m_tempUnits;
bool m_translate; bool m_translate = false;
}; };

View File

@ -28,9 +28,9 @@
AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName, AbstractExtItem::AbstractExtItem(QWidget *parent, const QString desktopName,
const QStringList directories) const QStringList directories)
: QDialog(parent), : QDialog(parent)
m_fileName(desktopName), , m_fileName(desktopName)
m_dirs(directories) , m_dirs(directories)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Desktop name" << desktopName; qCDebug(LOG_LIB) << "Desktop name" << desktopName;
@ -46,8 +46,7 @@ AbstractExtItem::~AbstractExtItem()
} }
template <class T> template <class T> T *AbstractExtItem::copy(const QString, const int)
T *AbstractExtItem::copy(const QString, const int)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -56,7 +55,6 @@ T *AbstractExtItem::copy(const QString, const int)
} }
int AbstractExtItem::apiVersion() const int AbstractExtItem::apiVersion() const
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -207,9 +205,13 @@ void AbstractExtItem::readConfiguration()
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
setName(settings.value(QString("Name"), m_name).toString()); setName(settings.value(QString("Name"), m_name).toString());
setComment(settings.value(QString("Comment"), m_comment).toString()); setComment(settings.value(QString("Comment"), m_comment).toString());
setApiVersion(settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt()); setApiVersion(
setActive(settings.value(QString("X-AW-Active"), QVariant(m_active)).toString() == QString("true")); settings.value(QString("X-AW-ApiVersion"), m_apiVersion).toInt());
setInterval(settings.value(QString("X-AW-Interval"), m_interval).toInt()); setActive(settings.value(QString("X-AW-Active"), QVariant(m_active))
.toString()
== QString("true"));
setInterval(
settings.value(QString("X-AW-Interval"), m_interval).toInt());
setNumber(settings.value(QString("X-AW-Number"), m_number).toInt()); setNumber(settings.value(QString("X-AW-Number"), m_number).toInt());
settings.endGroup(); settings.endGroup();
} }
@ -222,7 +224,8 @@ bool AbstractExtItem::tryDelete() const
foreach (QString dir, m_dirs) { foreach (QString dir, m_dirs) {
bool status = QFile::remove(QString("%1/%2").arg(dir).arg(m_fileName)); bool status = QFile::remove(QString("%1/%2").arg(dir).arg(m_fileName));
qCInfo(LOG_LIB) << "Remove file" << QString("%1/%2").arg(dir).arg(m_fileName) << status; qCInfo(LOG_LIB) << "Remove file"
<< QString("%1/%2").arg(dir).arg(m_fileName) << status;
} }
// check if exists // check if exists
@ -237,7 +240,8 @@ void AbstractExtItem::writeConfiguration() const
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
QSettings settings(QString("%1/%2").arg(m_dirs.first()).arg(m_fileName), QSettings::IniFormat); QSettings settings(QString("%1/%2").arg(m_dirs.first()).arg(m_fileName),
QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));

View File

@ -36,7 +36,8 @@ class AbstractExtItem : public QDialog
Q_PROPERTY(QString uniq READ uniq) Q_PROPERTY(QString uniq READ uniq)
public: public:
explicit AbstractExtItem(QWidget *parent = nullptr, const QString desktopName = QString(), explicit AbstractExtItem(QWidget *parent = nullptr,
const QString desktopName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~AbstractExtItem(); virtual ~AbstractExtItem();
template <class T> T *copy(const QString, const int); template <class T> T *copy(const QString, const int);

View File

@ -33,21 +33,24 @@ AbstractExtItemAggregator::AbstractExtItemAggregator(QWidget *parent)
dialog = new QDialog(this); dialog = new QDialog(this);
widgetDialog = new QListWidget(dialog); widgetDialog = new QListWidget(dialog);
dialogButtons = new QDialogButtonBox(QDialogButtonBox::Open | QDialogButtonBox::Close, dialogButtons = new QDialogButtonBox(
Qt::Vertical, dialog); QDialogButtonBox::Open | QDialogButtonBox::Close, Qt::Vertical, dialog);
copyButton = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole); copyButton
createButton = dialogButtons->addButton(i18n("Create"), QDialogButtonBox::ActionRole); = dialogButtons->addButton(i18n("Copy"), QDialogButtonBox::ActionRole);
deleteButton = dialogButtons->addButton(i18n("Remove"), QDialogButtonBox::ActionRole); createButton = dialogButtons->addButton(i18n("Create"),
QDialogButtonBox::ActionRole);
deleteButton = dialogButtons->addButton(i18n("Remove"),
QDialogButtonBox::ActionRole);
QHBoxLayout *layout = new QHBoxLayout(dialog); QHBoxLayout *layout = new QHBoxLayout(dialog);
layout->addWidget(widgetDialog); layout->addWidget(widgetDialog);
layout->addWidget(dialogButtons); layout->addWidget(dialogButtons);
dialog->setLayout(layout); dialog->setLayout(layout);
connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), connect(dialogButtons, SIGNAL(clicked(QAbstractButton *)), this,
this, SLOT(editItemButtonPressed(QAbstractButton *))); SLOT(editItemButtonPressed(QAbstractButton *)));
connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject())); connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
connect(widgetDialog, SIGNAL(itemActivated(QListWidgetItem *)), connect(widgetDialog, SIGNAL(itemActivated(QListWidgetItem *)), this,
this, SLOT(editItemActivated(QListWidgetItem *))); SLOT(editItemActivated(QListWidgetItem *)));
} }

View File

@ -29,13 +29,12 @@
#include "abstractextitemaggregator.h" #include "abstractextitemaggregator.h"
template <class T> template <class T> class ExtItemAggregator : public AbstractExtItemAggregator
class ExtItemAggregator : public AbstractExtItemAggregator
{ {
public: public:
explicit ExtItemAggregator(QWidget *parent, const QString type) explicit ExtItemAggregator(QWidget *parent, const QString type)
: AbstractExtItemAggregator(parent), : AbstractExtItemAggregator(parent)
m_type(type) , m_type(type)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Type" << type; qCDebug(LOG_LIB) << "Type" << type;
@ -121,7 +120,8 @@ public:
break; break;
} }
if (found == nullptr) if (found == nullptr)
qCWarning(LOG_LIB) << "Could not find item by name" << widgetItem->text(); qCWarning(LOG_LIB) << "Could not find item by name"
<< widgetItem->text();
return found; return found;
}; };
@ -138,7 +138,8 @@ public:
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
QList<int> tagList; QList<int> tagList;
foreach(T *item, m_items) tagList.append(item->number()); foreach (T *item, m_items)
tagList.append(item->number());
int number = 0; int number = 0;
while (tagList.contains(number)) while (tagList.contains(number))
number++; number++;
@ -157,14 +158,16 @@ private:
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
// create directory at $HOME // create directory at $HOME
QString localDir = QString("%1/awesomewidgets/%2"). QString localDir = QString("%1/awesomewidgets/%2")
arg(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)). .arg(QStandardPaths::writableLocation(
arg(m_type); QStandardPaths::GenericDataLocation))
.arg(m_type);
QDir localDirectory; QDir localDirectory;
if (localDirectory.mkpath(localDir)) if (localDirectory.mkpath(localDir))
qCInfo(LOG_LIB) << "Created directory" << localDir; qCInfo(LOG_LIB) << "Created directory" << localDir;
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringList dirs = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/%1").arg(m_type), QString("awesomewidgets/%1").arg(m_type),
QStandardPaths::LocateDirectory); QStandardPaths::LocateDirectory);
QStringList names; QStringList names;
@ -209,7 +212,8 @@ private:
widgetDialog->clear(); widgetDialog->clear();
foreach (T *_item, m_items) { foreach (T *_item, m_items) {
QListWidgetItem *item = new QListWidgetItem(_item->fileName(), widgetDialog); QListWidgetItem *item
= new QListWidgetItem(_item->fileName(), widgetDialog);
QStringList tooltip; QStringList tooltip;
tooltip.append(i18n("Name: %1", _item->name())); tooltip.append(i18n("Name: %1", _item->name()));
tooltip.append(i18n("Comment: %1", _item->comment())); tooltip.append(i18n("Comment: %1", _item->comment()));
@ -227,8 +231,7 @@ private:
T *source = itemFromWidget(); T *source = itemFromWidget();
QString fileName = getName(); QString fileName = getName();
int number = uniqNumber(); int number = uniqNumber();
if ((source == nullptr) if ((source == nullptr) || (fileName.isEmpty())) {
|| (fileName.isEmpty())) {
qCWarning(LOG_LIB) << "Nothing to copy"; qCWarning(LOG_LIB) << "Nothing to copy";
return; return;
} }
@ -246,7 +249,8 @@ private:
QString fileName = getName(); QString fileName = getName();
int number = uniqNumber(); int number = uniqNumber();
QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringList dirs = QStandardPaths::locateAll(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/%1").arg(m_type), QString("awesomewidgets/%1").arg(m_type),
QStandardPaths::LocateDirectory); QStandardPaths::LocateDirectory);
if (fileName.isEmpty()) { if (fileName.isEmpty()) {

View File

@ -35,8 +35,8 @@
ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName, ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
const QStringList directories) const QStringList directories)
: AbstractExtItem(parent, quotesName, directories), : AbstractExtItem(parent, quotesName, directories)
ui(new Ui::ExtQuotes) , ui(new Ui::ExtQuotes)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -54,9 +54,11 @@ ExtQuotes::ExtQuotes(QWidget *parent, const QString quotesName,
values[tag(QString("pricechg"))] = 0.0; values[tag(QString("pricechg"))] = 0.0;
values[tag(QString("percpricechg"))] = 0.0; values[tag(QString("percpricechg"))] = 0.0;
manager = new QNetworkAccessManager(this); // HACK declare as child of nullptr to avoid crash with plasmawindowed
connect(manager, SIGNAL(finished(QNetworkReply *)), // in the destructor
this, SLOT(quotesReplyReceived(QNetworkReply *))); manager = new QNetworkAccessManager(nullptr);
connect(manager, SIGNAL(finished(QNetworkReply *)), this,
SLOT(quotesReplyReceived(QNetworkReply *)));
} }
@ -64,10 +66,10 @@ ExtQuotes::~ExtQuotes()
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
disconnect(manager, SIGNAL(finished(QNetworkReply *)), disconnect(manager, SIGNAL(finished(QNetworkReply *)), this,
this, SLOT(quotesReplyReceived(QNetworkReply *))); SLOT(quotesReplyReceived(QNetworkReply *)));
delete manager; manager->deleteLater();
delete ui; delete ui;
} }
@ -78,8 +80,8 @@ ExtQuotes *ExtQuotes::copy(const QString _fileName, const int _number)
qCDebug(LOG_LIB) << "File" << _fileName; qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number; qCDebug(LOG_LIB) << "Number" << _number;
ExtQuotes *item = new ExtQuotes(static_cast<QWidget *>(parent()), ExtQuotes *item = new ExtQuotes(static_cast<QWidget *>(parent()), _fileName,
_fileName, directories()); directories());
item->setActive(isActive()); item->setActive(isActive());
item->setApiVersion(apiVersion()); item->setApiVersion(apiVersion());
item->setComment(comment()); item->setComment(comment());
@ -123,9 +125,12 @@ void ExtQuotes::readConfiguration()
AbstractExtItem::readConfiguration(); AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) { for (int i = directories().count() - 1; i >= 0; i--) {
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) if (!QDir(directories().at(i))
.entryList(QDir::Files)
.contains(fileName()))
continue; continue;
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().at(i)).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
@ -135,7 +140,8 @@ void ExtQuotes::readConfiguration()
// update for current API // update for current API
if ((apiVersion() > 0) && (apiVersion() < AWEQAPI)) { if ((apiVersion() > 0) && (apiVersion() < AWEQAPI)) {
qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWEQAPI; qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to"
<< AWEQAPI;
setApiVersion(AWEQAPI); setApiVersion(AWEQAPI);
writeConfiguration(); writeConfiguration();
} }
@ -173,7 +179,8 @@ int ExtQuotes::showConfiguration(const QVariant args)
ui->lineEdit_comment->setText(comment()); ui->lineEdit_comment->setText(comment());
ui->label_numberValue->setText(QString("%1").arg(number())); ui->label_numberValue->setText(QString("%1").arg(number()));
ui->lineEdit_ticker->setText(m_ticker); ui->lineEdit_ticker->setText(m_ticker);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked); ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
: Qt::Unchecked);
ui->spinBox_interval->setValue(interval()); ui->spinBox_interval->setValue(interval());
int ret = exec(); int ret = exec();
@ -197,7 +204,8 @@ void ExtQuotes::writeConfiguration() const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration(); AbstractExtItem::writeConfiguration();
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().first()).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
@ -223,34 +231,42 @@ void ExtQuotes::quotesReplyReceived(QNetworkReply *reply)
qCWarning(LOG_LIB) << "Parse error" << error.errorString(); qCWarning(LOG_LIB) << "Parse error" << error.errorString();
return; return;
} }
QVariantMap jsonQuotes = jsonDoc.toVariant().toMap()[QString("query")].toMap(); QVariantMap jsonQuotes
jsonQuotes = jsonQuotes[QString("results")].toMap()[QString("quote")].toMap(); = jsonDoc.toVariant().toMap()[QString("query")].toMap();
jsonQuotes
= jsonQuotes[QString("results")].toMap()[QString("quote")].toMap();
double value; double value;
// ask // ask
value = jsonQuotes[QString("Ask")].toString().toDouble(); value = jsonQuotes[QString("Ask")].toString().toDouble();
values[tag(QString("askchg"))] = values[QString("ask")].toDouble() == 0.0 values[tag(QString("askchg"))]
= values[QString("ask")].toDouble() == 0.0
? 0.0 ? 0.0
: value - values[QString("ask")].toDouble(); : value - values[QString("ask")].toDouble();
values[tag(QString("percaskchg"))] = 100.0 * values[QString("askchg")].toDouble() values[tag(QString("percaskchg"))] = 100.0
* values[QString("askchg")].toDouble()
/ values[QString("ask")].toDouble(); / values[QString("ask")].toDouble();
values[tag(QString("ask"))] = value; values[tag(QString("ask"))] = value;
// bid // bid
value = jsonQuotes[QString("Bid")].toString().toDouble(); value = jsonQuotes[QString("Bid")].toString().toDouble();
values[tag(QString("bidchg"))] = values[QString("bid")].toDouble() == 0.0 values[tag(QString("bidchg"))]
= values[QString("bid")].toDouble() == 0.0
? 0.0 ? 0.0
: value - values[QString("bid")].toDouble(); : value - values[QString("bid")].toDouble();
values[tag(QString("percbidchg"))] = 100.0 * values[QString("bidchg")].toDouble() values[tag(QString("percbidchg"))] = 100.0
* values[QString("bidchg")].toDouble()
/ values[QString("bid")].toDouble(); / values[QString("bid")].toDouble();
values[tag(QString("bid"))] = value; values[tag(QString("bid"))] = value;
// last trade // last trade
value = jsonQuotes[QString("LastTradePriceOnly")].toString().toDouble(); value = jsonQuotes[QString("LastTradePriceOnly")].toString().toDouble();
values[tag(QString("pricechg"))] = values[QString("price")].toDouble() == 0.0 values[tag(QString("pricechg"))]
= values[QString("price")].toDouble() == 0.0
? 0.0 ? 0.0
: value - values[QString("price")].toDouble(); : value - values[QString("price")].toDouble();
values[tag(QString("percpricechg"))] = 100.0 * values[QString("pricechg")].toDouble() values[tag(QString("percpricechg"))]
= 100.0 * values[QString("pricechg")].toDouble()
/ values[QString("price")].toDouble(); / values[QString("price")].toDouble();
values[tag(QString("price"))] = value; values[tag(QString("price"))] = value;
} }
@ -263,7 +279,8 @@ void ExtQuotes::translate()
ui->label_name->setText(i18n("Name")); ui->label_name->setText(i18n("Name"));
ui->label_comment->setText(i18n("Comment")); ui->label_comment->setText(i18n("Comment"));
ui->label_number->setText(i18n("Tag")); ui->label_number->setText(i18n("Tag"));
ui->label->setText(i18n("<html><head/><body><p>Use YAHOO! finance ticker to \ ui->label->setText(
i18n("<html><head/><body><p>Use YAHOO! finance ticker to \
get quotes for the instrument. Refer to <a href=\"http://finance.yahoo.com/\">\ get quotes for the instrument. Refer to <a href=\"http://finance.yahoo.com/\">\
<span style=\" text-decoration: underline; color:#0057ae;\">http://finance.yahoo.com/\ <span style=\" text-decoration: underline; color:#0057ae;\">http://finance.yahoo.com/\
</span></a></p></body></html>")); </span></a></p></body></html>"));

View File

@ -22,10 +22,15 @@
#include "abstractextitem.h" #include "abstractextitem.h"
#define YAHOO_URL "https://query.yahooapis.com/v1/public/yql?q=select * from yahoo.finance.quotes where symbol=\"$TICKER\"&env=store://datatables.org/alltableswithkeys&format=json" #define YAHOO_URL \
"https://query.yahooapis.com/v1/public/yql?q=select * from " \
"yahoo.finance.quotes where " \
"symbol=\"$TICKER\"&env=store://datatables.org/" \
"alltableswithkeys&format=json"
namespace Ui { namespace Ui
{
class ExtQuotes; class ExtQuotes;
} }
@ -35,7 +40,8 @@ class ExtQuotes : public AbstractExtItem
Q_PROPERTY(QString ticker READ ticker WRITE setTicker) Q_PROPERTY(QString ticker READ ticker WRITE setTicker)
public: public:
explicit ExtQuotes(QWidget *parent = nullptr, const QString quotesName = QString(), explicit ExtQuotes(QWidget *parent = nullptr,
const QString quotesName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~ExtQuotes(); virtual ~ExtQuotes();
ExtQuotes *copy(const QString _fileName, const int _number); ExtQuotes *copy(const QString _fileName, const int _number);

View File

@ -33,8 +33,8 @@
ExtScript::ExtScript(QWidget *parent, const QString scriptName, ExtScript::ExtScript(QWidget *parent, const QString scriptName,
const QStringList directories) const QStringList directories)
: AbstractExtItem(parent, scriptName, directories), : AbstractExtItem(parent, scriptName, directories)
ui(new Ui::ExtScript) , ui(new Ui::ExtScript)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -46,7 +46,8 @@ ExtScript::ExtScript(QWidget *parent, const QString scriptName,
value[tag(QString("custom"))] = QString(""); value[tag(QString("custom"))] = QString("");
process = new QProcess(this); process = new QProcess(this);
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(updateValue())); connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this,
SLOT(updateValue()));
process->waitForFinished(0); process->waitForFinished(0);
} }
@ -67,8 +68,8 @@ ExtScript *ExtScript::copy(const QString _fileName, const int _number)
qCDebug(LOG_LIB) << "File" << _fileName; qCDebug(LOG_LIB) << "File" << _fileName;
qCDebug(LOG_LIB) << "Number" << _number; qCDebug(LOG_LIB) << "Number" << _number;
ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), ExtScript *item = new ExtScript(static_cast<QWidget *>(parent()), _fileName,
_fileName, directories()); directories());
item->setActive(isActive()); item->setActive(isActive());
item->setApiVersion(apiVersion()); item->setApiVersion(apiVersion());
item->setComment(comment()); item->setComment(comment());
@ -162,9 +163,8 @@ void ExtScript::setFilters(const QStringList _filters)
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Filters" << _filters; qCDebug(LOG_LIB) << "Filters" << _filters;
std::for_each(_filters.cbegin(), _filters.cend(), [this](QString filter) { std::for_each(_filters.cbegin(), _filters.cend(),
return updateFilter(filter); [this](QString filter) { return updateFilter(filter); });
});
} }
@ -211,7 +211,8 @@ QString ExtScript::applyFilters(QString _value) const
qCInfo(LOG_LIB) << "Found filter" << filt; qCInfo(LOG_LIB) << "Found filter" << filt;
QVariantMap filter = jsonFilters[filt].toMap(); QVariantMap filter = jsonFilters[filt].toMap();
if (filter.isEmpty()) { if (filter.isEmpty()) {
qCWarning(LOG_LIB) << "Could not find filter" << _value << "in the json"; qCWarning(LOG_LIB) << "Could not find filter" << _value
<< "in the json";
continue; continue;
} }
foreach (QString f, filter.keys()) foreach (QString f, filter.keys())
@ -244,23 +245,30 @@ void ExtScript::readConfiguration()
AbstractExtItem::readConfiguration(); AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) { for (int i = directories().count() - 1; i >= 0; i--) {
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) if (!QDir(directories().at(i))
.entryList(QDir::Files)
.contains(fileName()))
continue; continue;
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings::IniFormat); QSettings settings(
QString("%1/%2").arg(directories().at(i)).arg(fileName()),
QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
setExecutable(settings.value(QString("Exec"), m_executable).toString()); setExecutable(settings.value(QString("Exec"), m_executable).toString());
setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString()); setPrefix(settings.value(QString("X-AW-Prefix"), m_prefix).toString());
setStrRedirect(settings.value(QString("X-AW-Redirect"), strRedirect()).toString()); setStrRedirect(
settings.value(QString("X-AW-Redirect"), strRedirect()).toString());
// api == 3 // api == 3
setFilters(settings.value(QString("X-AW-Filters"), m_filters).toString(). setFilters(settings.value(QString("X-AW-Filters"), m_filters)
split(QChar(','), QString::SkipEmptyParts)); .toString()
.split(QChar(','), QString::SkipEmptyParts));
settings.endGroup(); settings.endGroup();
} }
// update for current API // update for current API
if ((apiVersion() > 0) && (apiVersion() < AWESAPI)) { if ((apiVersion() > 0) && (apiVersion() < AWESAPI)) {
qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWESAPI; qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to"
<< AWESAPI;
setApiVersion(AWESAPI); setApiVersion(AWESAPI);
writeConfiguration(); writeConfiguration();
} }
@ -271,8 +279,10 @@ void ExtScript::readJsonFilters()
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString fileName = QStandardPaths::locate(
QString("awesomewidgets/scripts/awesomewidgets-extscripts-filters.json")); QStandardPaths::GenericDataLocation,
QString(
"awesomewidgets/scripts/awesomewidgets-extscripts-filters.json"));
qCInfo(LOG_LIB) << "Filters file" << fileName; qCInfo(LOG_LIB) << "Filters file" << fileName;
QFile jsonFile(fileName); QFile jsonFile(fileName);
if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) { if (!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
@ -326,19 +336,17 @@ int ExtScript::showConfiguration(const QVariant args)
ui->label_numberValue->setText(QString("%1").arg(number())); ui->label_numberValue->setText(QString("%1").arg(number()));
ui->lineEdit_command->setText(m_executable); ui->lineEdit_command->setText(m_executable);
ui->lineEdit_prefix->setText(m_prefix); ui->lineEdit_prefix->setText(m_prefix);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked); ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
: Qt::Unchecked);
ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect)); ui->comboBox_redirect->setCurrentIndex(static_cast<int>(m_redirect));
ui->spinBox_interval->setValue(interval()); ui->spinBox_interval->setValue(interval());
// filters // filters
ui->checkBox_colorFilter->setCheckState(m_filters.contains(QString("color")) ui->checkBox_colorFilter->setCheckState(
? Qt::Checked m_filters.contains(QString("color")) ? Qt::Checked : Qt::Unchecked);
: Qt::Unchecked); ui->checkBox_linesFilter->setCheckState(
ui->checkBox_linesFilter->setCheckState(m_filters.contains(QString("newline")) m_filters.contains(QString("newline")) ? Qt::Checked : Qt::Unchecked);
? Qt::Checked ui->checkBox_spaceFilter->setCheckState(
: Qt::Unchecked); m_filters.contains(QString("space")) ? Qt::Checked : Qt::Unchecked);
ui->checkBox_spaceFilter->setCheckState(m_filters.contains(QString("space"))
? Qt::Checked
: Qt::Unchecked);
int ret = exec(); int ret = exec();
if (ret != 1) if (ret != 1)
@ -353,9 +361,12 @@ int ExtScript::showConfiguration(const QVariant args)
setStrRedirect(ui->comboBox_redirect->currentText()); setStrRedirect(ui->comboBox_redirect->currentText());
setInterval(ui->spinBox_interval->value()); setInterval(ui->spinBox_interval->value());
// filters // filters
updateFilter(QString("color"), ui->checkBox_colorFilter->checkState() == Qt::Checked); updateFilter(QString("color"),
updateFilter(QString("newline"), ui->checkBox_linesFilter->checkState() == Qt::Checked); ui->checkBox_colorFilter->checkState() == Qt::Checked);
updateFilter(QString("space"), ui->checkBox_spaceFilter->checkState() == Qt::Checked); updateFilter(QString("newline"),
ui->checkBox_linesFilter->checkState() == Qt::Checked);
updateFilter(QString("space"),
ui->checkBox_spaceFilter->checkState() == Qt::Checked);
writeConfiguration(); writeConfiguration();
return ret; return ret;
@ -367,7 +378,8 @@ void ExtScript::writeConfiguration() const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration(); AbstractExtItem::writeConfiguration();
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().first()).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
@ -387,9 +399,13 @@ void ExtScript::updateValue()
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode(); qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode();
QString qdebug = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardError()).trimmed(); QString qdebug = QTextCodec::codecForMib(106)
->toUnicode(process->readAllStandardError())
.trimmed();
qCInfo(LOG_LIB) << "Error" << qdebug; qCInfo(LOG_LIB) << "Error" << qdebug;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed(); QString qoutput = QTextCodec::codecForMib(106)
->toUnicode(process->readAllStandardOutput())
.trimmed();
qCInfo(LOG_LIB) << "Output" << qoutput; qCInfo(LOG_LIB) << "Output" << qoutput;
QString strValue; QString strValue;

View File

@ -23,7 +23,8 @@
#include "abstractextitem.h" #include "abstractextitem.h"
namespace Ui { namespace Ui
{
class ExtScript; class ExtScript;
} }
@ -36,14 +37,10 @@ class ExtScript : public AbstractExtItem
Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect) Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
public: public:
enum Redirect { enum Redirect { stdout2stderr = 0, nothing, stderr2stdout, swap };
stdout2stderr = 0,
nothing,
stderr2stdout,
swap
};
explicit ExtScript(QWidget *parent = nullptr, const QString scriptName = QString(), explicit ExtScript(QWidget *parent = nullptr,
const QString scriptName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~ExtScript(); virtual ~ExtScript();
ExtScript *copy(const QString _fileName, const int _number); ExtScript *copy(const QString _fileName, const int _number);

View File

@ -31,8 +31,8 @@
ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName, ExtUpgrade::ExtUpgrade(QWidget *parent, const QString upgradeName,
const QStringList directories) const QStringList directories)
: AbstractExtItem(parent, upgradeName, directories), : AbstractExtItem(parent, upgradeName, directories)
ui(new Ui::ExtUpgrade) , ui(new Ui::ExtUpgrade)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -134,7 +134,8 @@ void ExtUpgrade::setNull(const int _null)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Null lines" << _null; qCDebug(LOG_LIB) << "Null lines" << _null;
if (_null < 0) return; if (_null < 0)
return;
m_null = _null; m_null = _null;
} }
@ -146,9 +147,12 @@ void ExtUpgrade::readConfiguration()
AbstractExtItem::readConfiguration(); AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) { for (int i = directories().count() - 1; i >= 0; i--) {
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) if (!QDir(directories().at(i))
.entryList(QDir::Files)
.contains(fileName()))
continue; continue;
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().at(i)).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
@ -161,7 +165,8 @@ void ExtUpgrade::readConfiguration()
// update for current API // update for current API
if ((apiVersion() > 0) && (apiVersion() < AWEUAPI)) { if ((apiVersion() > 0) && (apiVersion() < AWEUAPI)) {
qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWEUAPI; qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to"
<< AWEUAPI;
setApiVersion(AWEUAPI); setApiVersion(AWEUAPI);
writeConfiguration(); writeConfiguration();
} }
@ -197,7 +202,8 @@ int ExtUpgrade::showConfiguration(const QVariant args)
ui->label_numberValue->setText(QString("%1").arg(number())); ui->label_numberValue->setText(QString("%1").arg(number()));
ui->lineEdit_command->setText(m_executable); ui->lineEdit_command->setText(m_executable);
ui->lineEdit_filter->setText(m_filter); ui->lineEdit_filter->setText(m_filter);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked); ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
: Qt::Unchecked);
ui->spinBox_null->setValue(m_null); ui->spinBox_null->setValue(m_null);
ui->spinBox_interval->setValue(interval()); ui->spinBox_interval->setValue(interval());
@ -224,7 +230,8 @@ void ExtUpgrade::writeConfiguration() const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration(); AbstractExtItem::writeConfiguration();
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().first()).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
@ -245,11 +252,16 @@ void ExtUpgrade::updateValue()
qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode(); qCInfo(LOG_LIB) << "Cmd returns" << process->exitCode();
qCInfo(LOG_LIB) << "Error" << process->readAllStandardError(); qCInfo(LOG_LIB) << "Error" << process->readAllStandardError();
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process->readAllStandardOutput()).trimmed(); QString qoutput = QTextCodec::codecForMib(106)
->toUnicode(process->readAllStandardOutput())
.trimmed();
value[tag(QString("pkgcount"))] = [this](QString output) { value[tag(QString("pkgcount"))] = [this](QString output) {
return m_filter.isEmpty() return m_filter.isEmpty()
? output.split(QChar('\n'), QString::SkipEmptyParts).count() - m_null ? output.split(QChar('\n'), QString::SkipEmptyParts).count()
: output.split(QChar('\n'), QString::SkipEmptyParts).filter(QRegExp(m_filter)).count(); - m_null
: output.split(QChar('\n'), QString::SkipEmptyParts)
.filter(QRegExp(m_filter))
.count();
}(qoutput); }(qoutput);
} }

View File

@ -23,7 +23,8 @@
#include "abstractextitem.h" #include "abstractextitem.h"
namespace Ui { namespace Ui
{
class ExtUpgrade; class ExtUpgrade;
} }
@ -35,7 +36,8 @@ class ExtUpgrade : public AbstractExtItem
Q_PROPERTY(int null READ null WRITE setNull) Q_PROPERTY(int null READ null WRITE setNull)
public: public:
explicit ExtUpgrade(QWidget *parent = nullptr, const QString upgradeName = QString(), explicit ExtUpgrade(QWidget *parent = nullptr,
const QString upgradeName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~ExtUpgrade(); virtual ~ExtUpgrade();
ExtUpgrade *copy(const QString _fileName, const int _number); ExtUpgrade *copy(const QString _fileName, const int _number);

View File

@ -36,8 +36,8 @@
ExtWeather::ExtWeather(QWidget *parent, const QString weatherName, ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
const QStringList directories) const QStringList directories)
: AbstractExtItem(parent, weatherName, directories), : AbstractExtItem(parent, weatherName, directories)
ui(new Ui::ExtWeather) , ui(new Ui::ExtWeather)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -52,9 +52,11 @@ ExtWeather::ExtWeather(QWidget *parent, const QString weatherName,
values[tag(QString("pressure"))] = 0.0; values[tag(QString("pressure"))] = 0.0;
values[tag(QString("temperature"))] = 0.0; values[tag(QString("temperature"))] = 0.0;
manager = new QNetworkAccessManager(this); // HACK declare as child of nullptr to avoid crash with plasmawindowed
connect(manager, SIGNAL(finished(QNetworkReply *)), // in the destructor
this, SLOT(weatherReplyReceived(QNetworkReply *))); manager = new QNetworkAccessManager(nullptr);
connect(manager, SIGNAL(finished(QNetworkReply *)), this,
SLOT(weatherReplyReceived(QNetworkReply *)));
} }
@ -62,10 +64,10 @@ ExtWeather::~ExtWeather()
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
disconnect(manager, SIGNAL(finished(QNetworkReply *)), disconnect(manager, SIGNAL(finished(QNetworkReply *)), this,
this, SLOT(weatherReplyReceived(QNetworkReply *))); SLOT(weatherReplyReceived(QNetworkReply *)));
delete manager; manager->deleteLater();
delete ui; delete ui;
} }
@ -98,7 +100,8 @@ QString ExtWeather::weatherFromInt(const int _id) const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Weather ID" << _id; qCDebug(LOG_LIB) << "Weather ID" << _id;
QVariantMap map = jsonMap[m_image ? QString("image") : QString("text")].toMap(); QVariantMap map
= jsonMap[m_image ? QString("image") : QString("text")].toMap();
return map.value(QString::number(_id), map[QString("default")]).toString(); return map.value(QString::number(_id), map[QString("default")]).toString();
} }
@ -185,23 +188,30 @@ void ExtWeather::readConfiguration()
AbstractExtItem::readConfiguration(); AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) { for (int i = directories().count() - 1; i >= 0; i--) {
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) if (!QDir(directories().at(i))
.entryList(QDir::Files)
.contains(fileName()))
continue; continue;
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().at(i)).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
setCity(settings.value(QString("X-AW-City"), m_city).toString()); setCity(settings.value(QString("X-AW-City"), m_city).toString());
setCountry(settings.value(QString("X-AW-Country"), m_country).toString()); setCountry(
settings.value(QString("X-AW-Country"), m_country).toString());
setTs(settings.value(QString("X-AW-TS"), m_ts).toInt()); setTs(settings.value(QString("X-AW-TS"), m_ts).toInt());
// api == 2 // api == 2
setImage(settings.value(QString("X-AW-Image"), QVariant(m_image)).toString() == QString("true")); setImage(
settings.value(QString("X-AW-Image"), QVariant(m_image)).toString()
== QString("true"));
settings.endGroup(); settings.endGroup();
} }
// update for current API // update for current API
if ((apiVersion() > 0) && (apiVersion() < AWEWAPI)) { if ((apiVersion() > 0) && (apiVersion() < AWEWAPI)) {
qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWEWAPI; qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to"
<< AWEWAPI;
setApiVersion(AWEWAPI); setApiVersion(AWEWAPI);
writeConfiguration(); writeConfiguration();
} }
@ -212,7 +222,8 @@ void ExtWeather::readJsonMap()
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
QString fileName = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QString fileName = QStandardPaths::locate(
QStandardPaths::GenericDataLocation,
QString("awesomewidgets/weather/awesomewidgets-extweather-ids.json")); QString("awesomewidgets/weather/awesomewidgets-extweather-ids.json"));
qCInfo(LOG_LIB) << "Map file" << fileName; qCInfo(LOG_LIB) << "Map file" << fileName;
QFile jsonFile(fileName); QFile jsonFile(fileName);
@ -244,7 +255,8 @@ QVariantHash ExtWeather::run()
if (times == 1) { if (times == 1) {
qCInfo(LOG_LIB) << "Send request"; qCInfo(LOG_LIB) << "Send request";
isRunning = true; isRunning = true;
QNetworkReply *reply = manager->get(QNetworkRequest(QUrl(url(m_ts != 0)))); QNetworkReply *reply
= manager->get(QNetworkRequest(QUrl(url(m_ts != 0))));
new QReplyTimeout(reply, 1000); new QReplyTimeout(reply, 1000);
} }
@ -269,7 +281,8 @@ int ExtWeather::showConfiguration(const QVariant args)
ui->lineEdit_country->setText(m_country); ui->lineEdit_country->setText(m_country);
ui->spinBox_timestamp->setValue(m_ts); ui->spinBox_timestamp->setValue(m_ts);
ui->checkBox_image->setCheckState(m_image ? Qt::Checked : Qt::Unchecked); ui->checkBox_image->setCheckState(m_image ? Qt::Checked : Qt::Unchecked);
ui->checkBox_active->setCheckState(isActive() ? Qt::Checked : Qt::Unchecked); ui->checkBox_active->setCheckState(isActive() ? Qt::Checked
: Qt::Unchecked);
ui->spinBox_interval->setValue(interval()); ui->spinBox_interval->setValue(interval());
int ret = exec(); int ret = exec();
@ -296,7 +309,8 @@ void ExtWeather::writeConfiguration() const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration(); AbstractExtItem::writeConfiguration();
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().first()).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
@ -330,7 +344,8 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
// convert to map // convert to map
QVariantMap json = jsonDoc.toVariant().toMap(); QVariantMap json = jsonDoc.toVariant().toMap();
if (json[QString("cod")].toInt() != 200) { if (json[QString("cod")].toInt() != 200) {
qCWarning(LOG_LIB) << "Invalid OpenWeatherMap return code" << json[QString("cod")].toInt(); qCWarning(LOG_LIB) << "Invalid OpenWeatherMap return code"
<< json[QString("cod")].toInt();
return; return;
} }
@ -339,8 +354,7 @@ void ExtWeather::weatherReplyReceived(QNetworkReply *reply)
data = parseSingleJson(json); data = parseSingleJson(json);
} else { } else {
QVariantList list = json[QString("list")].toList(); QVariantList list = json[QString("list")].toList();
data = parseSingleJson(list.count() <= m_ts data = parseSingleJson(list.count() <= m_ts ? list.at(m_ts - 1).toMap()
? list.at(m_ts-1).toMap()
: list.last().toMap()); : list.last().toMap());
} }
foreach (QString key, data.keys()) foreach (QString key, data.keys())
@ -366,8 +380,10 @@ QVariantHash ExtWeather::parseSingleJson(const QVariantMap json) const
// main data // main data
QVariantMap mainWeather = json[QString("main")].toMap(); QVariantMap mainWeather = json[QString("main")].toMap();
if (!weather.isEmpty()) { if (!weather.isEmpty()) {
output[QString("humidity")] = mainWeather[QString("humidity")].toFloat(); output[QString("humidity")]
output[QString("pressure")] = mainWeather[QString("pressure")].toFloat(); = mainWeather[QString("humidity")].toFloat();
output[QString("pressure")]
= mainWeather[QString("pressure")].toFloat();
output[QString("temperature")] = mainWeather[QString("temp")].toFloat(); output[QString("temperature")] = mainWeather[QString("temp")].toFloat();
} }

View File

@ -22,11 +22,16 @@
#include "abstractextitem.h" #include "abstractextitem.h"
#define OWM_URL "http://api.openweathermap.org/data/2.5/weather?q=$CITY,$COUNTRY&units=metric" #define OWM_URL \
#define OWM_FORECAST_URL "http://api.openweathermap.org/data/2.5/forecast?q=$CITY,$COUNTRY&units=metric" "http://api.openweathermap.org/data/2.5/" \
"weather?q=$CITY,$COUNTRY&units=metric"
#define OWM_FORECAST_URL \
"http://api.openweathermap.org/data/2.5/" \
"forecast?q=$CITY,$COUNTRY&units=metric"
namespace Ui { namespace Ui
{
class ExtWeather; class ExtWeather;
} }
@ -39,7 +44,8 @@ class ExtWeather : public AbstractExtItem
Q_PROPERTY(int ts READ ts WRITE setTs) Q_PROPERTY(int ts READ ts WRITE setTs)
public: public:
explicit ExtWeather(QWidget *parent = nullptr, const QString weatherName = QString(), explicit ExtWeather(QWidget *parent = nullptr,
const QString weatherName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~ExtWeather(); virtual ~ExtWeather();
ExtWeather *copy(const QString _fileName, const int _number); ExtWeather *copy(const QString _fileName, const int _number);

View File

@ -36,8 +36,8 @@
GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName, GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
const QStringList directories) const QStringList directories)
: AbstractExtItem(parent, desktopName, directories), : AbstractExtItem(parent, desktopName, directories)
ui(new Ui::GraphicalItem) , ui(new Ui::GraphicalItem)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
@ -47,8 +47,10 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
initScene(); initScene();
connect(ui->pushButton_activeColor, SIGNAL(clicked()), this, SLOT(changeColor())); connect(ui->pushButton_activeColor, SIGNAL(clicked()), this,
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this, SLOT(changeColor())); SLOT(changeColor()));
connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this,
SLOT(changeColor()));
} }
@ -91,7 +93,8 @@ QString GraphicalItem::image(const QVariant value)
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Value" << value; qCDebug(LOG_LIB) << "Value" << value;
if (m_bar == QString("none")) return QString(""); if (m_bar == QString("none"))
return QString("");
m_scene->clear(); m_scene->clear();
int scale[2] = {1, 1}; int scale[2] = {1, 1};
@ -121,12 +124,13 @@ QString GraphicalItem::image(const QVariant value)
} }
// convert // convert
QPixmap pixmap = m_view->grab().transformed(QTransform().scale(scale[0], scale[1])); QPixmap pixmap
= m_view->grab().transformed(QTransform().scale(scale[0], scale[1]));
QByteArray byteArray; QByteArray byteArray;
QBuffer buffer(&byteArray); QBuffer buffer(&byteArray);
pixmap.save(&buffer, "PNG"); pixmap.save(&buffer, "PNG");
QString url = QString("<img src=\"data:image/png;base64,%1\"/>"). QString url = QString("<img src=\"data:image/png;base64,%1\"/>")
arg(QString(byteArray.toBase64())); .arg(QString(byteArray.toBase64()));
return url; return url;
} }
@ -253,7 +257,8 @@ void GraphicalItem::setBar(const QString _bar)
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
qCDebug(LOG_LIB) << "Bar" << _bar; qCDebug(LOG_LIB) << "Bar" << _bar;
if (!_bar.contains(QRegExp(QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")))) { if (!_bar.contains(QRegExp(
QString("^(cpu(?!cl).*|gpu$|mem$|swap$|hdd[0-9].*|bat.*)")))) {
qCWarning(LOG_LIB) << "Unsupported bar type" << _bar; qCWarning(LOG_LIB) << "Unsupported bar type" << _bar;
m_bar = QString("none"); m_bar = QString("none");
} else { } else {
@ -354,17 +359,26 @@ void GraphicalItem::readConfiguration()
AbstractExtItem::readConfiguration(); AbstractExtItem::readConfiguration();
for (int i = directories().count() - 1; i >= 0; i--) { for (int i = directories().count() - 1; i >= 0; i--) {
if (!QDir(directories().at(i)).entryList(QDir::Files).contains(fileName())) if (!QDir(directories().at(i))
.entryList(QDir::Files)
.contains(fileName()))
continue; continue;
QSettings settings(QString("%1/%2").arg(directories().at(i)).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().at(i)).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
settings.beginGroup(QString("Desktop Entry")); settings.beginGroup(QString("Desktop Entry"));
setBar(settings.value(QString("X-AW-Value"), m_bar).toString()); setBar(settings.value(QString("X-AW-Value"), m_bar).toString());
setActiveColor(settings.value(QString("X-AW-ActiveColor"), m_activeColor).toString()); setActiveColor(
setInactiveColor(settings.value(QString("X-AW-InactiveColor"), m_inactiveColor).toString()); 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()); setStrType(settings.value(QString("X-AW-Type"), strType()).toString());
setStrDirection(settings.value(QString("X-AW-Direction"), strDirection()).toString()); setStrDirection(
settings.value(QString("X-AW-Direction"), strDirection())
.toString());
setHeight(settings.value(QString("X-AW-Height"), m_height).toInt()); setHeight(settings.value(QString("X-AW-Height"), m_height).toInt());
setWidth(settings.value(QString("X-AW-Width"), m_width).toInt()); setWidth(settings.value(QString("X-AW-Width"), m_width).toInt());
// api == 2 // api == 2
@ -375,7 +389,8 @@ void GraphicalItem::readConfiguration()
// update for current API // update for current API
if ((apiVersion() > 0) && (apiVersion() < AWGIAPI)) { if ((apiVersion() > 0) && (apiVersion() < AWGIAPI)) {
qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to" << AWGIAPI; qCWarning(LOG_LIB) << "Bump API version from" << apiVersion() << "to"
<< AWGIAPI;
setApiVersion(AWGIAPI); setApiVersion(AWGIAPI);
writeConfiguration(); writeConfiguration();
} }
@ -433,7 +448,8 @@ void GraphicalItem::writeConfiguration() const
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
AbstractExtItem::writeConfiguration(); AbstractExtItem::writeConfiguration();
QSettings settings(QString("%1/%2").arg(directories().first()).arg(fileName()), QSettings settings(
QString("%1/%2").arg(directories().first()).arg(fileName()),
QSettings::IniFormat); QSettings::IniFormat);
qCInfo(LOG_LIB) << "Configuration file" << settings.fileName(); qCInfo(LOG_LIB) << "Configuration file" << settings.fileName();
@ -455,7 +471,8 @@ void GraphicalItem::changeColor()
{ {
qCDebug(LOG_LIB); qCDebug(LOG_LIB);
QColor color = stringToColor((static_cast<QPushButton *>(sender()))->text()); QColor color
= stringToColor((static_cast<QPushButton *>(sender()))->text());
QColor newColor = QColorDialog::getColor(color, this, tr("Select color"), QColor newColor = QColorDialog::getColor(color, this, tr("Select color"),
QColorDialog::ShowAlphaChannel); QColorDialog::ShowAlphaChannel);
if (!newColor.isValid()) if (!newColor.isValid())
@ -468,7 +485,8 @@ void GraphicalItem::changeColor()
colorText.append(QString("%1").arg(newColor.blue())); colorText.append(QString("%1").arg(newColor.blue()));
colorText.append(QString("%1").arg(newColor.alpha())); colorText.append(QString("%1").arg(newColor.alpha()));
return static_cast<QPushButton *>(sender())->setText(colorText.join(QChar(','))); return static_cast<QPushButton *>(sender())
->setText(colorText.join(QChar(',')));
} }
@ -528,7 +546,8 @@ void GraphicalItem::paintGraph(const QList<float> value)
pen.setColor(stringToColor(m_activeColor)); pen.setColor(stringToColor(m_activeColor));
// default norms // default norms
float normX = static_cast<float>(m_width) / static_cast<float>(value.count()); float normX
= static_cast<float>(m_width) / static_cast<float>(value.count());
float normY = static_cast<float>(m_height) / (1.5 * 100.0); float normY = static_cast<float>(m_height) / (1.5 * 100.0);
// paint graph // paint graph
for (int i = 0; i < value.count() - 1; i++) { for (int i = 0; i < value.count() - 1; i++) {

View File

@ -26,7 +26,8 @@
class QGraphicsScene; class QGraphicsScene;
class QGraphicsView; class QGraphicsView;
namespace Ui { namespace Ui
{
class GraphicalItem; class GraphicalItem;
} }
@ -42,18 +43,11 @@ class GraphicalItem : public AbstractExtItem
Q_PROPERTY(int width READ width WRITE setWidth) Q_PROPERTY(int width READ width WRITE setWidth)
public: public:
enum Direction { enum Direction { LeftToRight = 0, RightToLeft };
LeftToRight = 0, enum Type { Horizontal = 0, Vertical, Circle, Graph };
RightToLeft
};
enum Type {
Horizontal = 0,
Vertical,
Circle,
Graph
};
explicit GraphicalItem(QWidget *parent = nullptr, const QString desktopName = QString(), explicit GraphicalItem(QWidget *parent = nullptr,
const QString desktopName = QString(),
const QStringList directories = QStringList()); const QStringList directories = QStringList());
virtual ~GraphicalItem(); virtual ~GraphicalItem();
GraphicalItem *copy(const QString _fileName, const int _number); GraphicalItem *copy(const QString _fileName, const int _number);

View File

@ -0,0 +1,18 @@
# additional target to perform clang-format run, requires clang-format
# get all project files
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h)
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
string(FIND ${SOURCE_FILE} ${PROJECT_TRDPARTY_DIR} PROJECT_TRDPARTY_DIR_FOUND)
if (NOT ${PROJECT_TRDPARTY_DIR_FOUND} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
add_custom_target(
clangformat
COMMAND ${CLANGFORMAT_EXECUTABLE}
-style=file
-i
${ALL_SOURCE_FILES}
)

23
sources/cppcheck.cmake Normal file
View File

@ -0,0 +1,23 @@
# additional target to perform cppcheck run, requires cppcheck
# get all project files
# HACK this workaround is required to avoid qml files checking ^_^
file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h)
foreach (SOURCE_FILE ${ALL_SOURCE_FILES})
string(FIND ${SOURCE_FILE} ${PROJECT_TRDPARTY_DIR} PROJECT_TRDPARTY_DIR_FOUND)
if (NOT ${PROJECT_TRDPARTY_DIR_FOUND} EQUAL -1)
list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE})
endif ()
endforeach ()
add_custom_target(
cppcheck
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,performance,portability,information,missingInclude
--std=c++11
--library=qt.cfg
--template="[{severity}][{id}] {message} {callstack} \(On {file}:{line}\)"
--verbose
--quiet
${ALL_SOURCE_FILES}
)

View File

@ -45,9 +45,12 @@ DPAdds::DPAdds(QObject *parent)
// logging // logging
qSetMessagePattern(LOG_FORMAT); qSetMessagePattern(LOG_FORMAT);
connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this, SIGNAL(desktopChanged())); connect(KWindowSystem::self(), SIGNAL(currentDesktopChanged(int)), this,
connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this, SIGNAL(windowListChanged())); SIGNAL(desktopChanged()));
connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this, SIGNAL(windowListChanged())); connect(KWindowSystem::self(), SIGNAL(windowAdded(WId)), this,
SIGNAL(windowListChanged()));
connect(KWindowSystem::self(), SIGNAL(windowRemoved(WId)), this,
SIGNAL(windowListChanged()));
} }
@ -101,16 +104,19 @@ QString DPAdds::toolTipImage(const int desktop) const
qCDebug(LOG_DP); qCDebug(LOG_DP);
qCDebug(LOG_DP) << "Desktop" << desktop; qCDebug(LOG_DP) << "Desktop" << desktop;
// drop if no tooltip required // drop if no tooltip required
if (m_tooltipType == QString("none")) return QString(); if (m_tooltipType == QString("none"))
return QString();
// prepare // prepare
DesktopWindowsInfo info = getInfoByDesktop(desktop); DesktopWindowsInfo info = getInfoByDesktop(desktop);
// special tooltip format for names // special tooltip format for names
if (m_tooltipType == QString("names")) { if (m_tooltipType == QString("names")) {
QStringList windowList; QStringList windowList;
std::for_each(info.windowsData.cbegin(), info.windowsData.cend(), std::for_each(
info.windowsData.cbegin(), info.windowsData.cend(),
[&windowList](WindowData data) { windowList.append(data.name); }); [&windowList](WindowData data) { windowList.append(data.name); });
return QString("<ul><li>%1</li></ul>").arg(windowList.join(QString("</li><li>"))); return QString("<ul><li>%1</li></ul>")
.arg(windowList.join(QString("</li><li>")));
} }
// init // init
QGraphicsScene *toolTipScene = new QGraphicsScene(); QGraphicsScene *toolTipScene = new QGraphicsScene();
@ -122,14 +128,17 @@ QString DPAdds::toolTipImage(const int desktop) const
toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); toolTipView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
// update // update
float margin = 5.0 * info.desktop.width() / 400.0; float margin = 5.0 * info.desktop.width() / 400.0;
toolTipView->resize(info.desktop.width() + 2.0 * margin, info.desktop.height() + 2.0 * margin); toolTipView->resize(info.desktop.width() + 2.0 * margin,
info.desktop.height() + 2.0 * margin);
toolTipScene->clear(); toolTipScene->clear();
toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush)); toolTipScene->setBackgroundBrush(QBrush(Qt::NoBrush));
// borders // borders
toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin); toolTipScene->addLine(0, 0, 0, info.desktop.height() + 2.0 * margin);
toolTipScene->addLine(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); info.desktop.width() + 2.0 * margin,
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, info.desktop.height() + 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); info.desktop.width() + 2.0 * margin, 0);
toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0); toolTipScene->addLine(info.desktop.width() + 2.0 * margin, 0, 0, 0);
@ -140,32 +149,39 @@ QString DPAdds::toolTipImage(const int desktop) const
foreach (WindowData data, info.windowsData) { foreach (WindowData data, info.windowsData) {
QRect rect = data.rect; QRect rect = data.rect;
toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin, toolTipScene->addLine(rect.left() + margin, rect.bottom() + margin,
rect.left() + margin, rect.top() + margin, pen); rect.left() + margin, rect.top() + margin,
pen);
toolTipScene->addLine(rect.left() + margin, rect.top() + margin, toolTipScene->addLine(rect.left() + margin, rect.top() + margin,
rect.right() + margin, rect.top() + margin, pen); rect.right() + margin, rect.top() + margin,
pen);
toolTipScene->addLine(rect.right() + margin, rect.top() + margin, toolTipScene->addLine(rect.right() + margin, rect.top() + margin,
rect.right() + margin, rect.bottom() + margin, pen); rect.right() + margin, rect.bottom() + margin,
pen);
toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin, toolTipScene->addLine(rect.right() + margin, rect.bottom() + margin,
rect.left() + margin, rect.bottom() + margin, pen); rect.left() + margin, rect.bottom() + margin,
pen);
} }
} else if (m_tooltipType == QString("clean")) { } else if (m_tooltipType == QString("clean")) {
QScreen *screen = QGuiApplication::primaryScreen(); QScreen *screen = QGuiApplication::primaryScreen();
std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(), std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(),
[&toolTipScene, &screen](WindowData data) { [&toolTipScene, &screen](WindowData data) {
QPixmap desktop = screen->grabWindow(data.id); QPixmap desktop = screen->grabWindow(data.id);
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top()); toolTipScene->addPixmap(desktop)
->setOffset(data.rect.left(), data.rect.top());
}); });
} else if (m_tooltipType == QString("windows")) { } else if (m_tooltipType == QString("windows")) {
QScreen *screen = QGuiApplication::primaryScreen(); QScreen *screen = QGuiApplication::primaryScreen();
std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(), std::for_each(info.desktopsData.cbegin(), info.desktopsData.cend(),
[&toolTipScene, &screen](WindowData data) { [&toolTipScene, &screen](WindowData data) {
QPixmap desktop = screen->grabWindow(data.id); QPixmap desktop = screen->grabWindow(data.id);
toolTipScene->addPixmap(desktop)->setOffset(data.rect.left(), data.rect.top()); toolTipScene->addPixmap(desktop)
->setOffset(data.rect.left(), data.rect.top());
}); });
std::for_each(info.windowsData.cbegin(), info.windowsData.cend(), std::for_each(info.windowsData.cbegin(), info.windowsData.cend(),
[&toolTipScene, &screen](WindowData data) { [&toolTipScene, &screen](WindowData data) {
QPixmap window = screen->grabWindow(data.id); QPixmap window = screen->grabWindow(data.id);
toolTipScene->addPixmap(window)->setOffset(data.rect.left(), data.rect.top()); toolTipScene->addPixmap(window)
->setOffset(data.rect.left(), data.rect.top());
}); });
} }
@ -177,7 +193,8 @@ QString DPAdds::toolTipImage(const int desktop) const
delete toolTipView; delete toolTipView;
delete toolTipScene; delete toolTipScene;
return QString("<img src=\"data:image/png;base64,%1\"/>").arg(QString(byteArray.toBase64())); return QString("<img src=\"data:image/png;base64,%1\"/>")
.arg(QString(byteArray.toBase64()));
} }
@ -222,14 +239,17 @@ QString DPAdds::valueByKey(const QString key, int desktop) const
qCDebug(LOG_DP); qCDebug(LOG_DP);
qCDebug(LOG_DP) << "Requested key" << key; qCDebug(LOG_DP) << "Requested key" << key;
qCDebug(LOG_DP) << "Desktop number" << desktop; qCDebug(LOG_DP) << "Desktop number" << desktop;
if (desktop == -1) desktop = currentDesktop(); if (desktop == -1)
desktop = currentDesktop();
QString currentMark = currentDesktop() == desktop ? m_mark : QString(""); QString currentMark = currentDesktop() == desktop ? m_mark : QString("");
if (key == QString("mark")) if (key == QString("mark"))
return QString("%1").arg(currentMark, m_mark.count(), QLatin1Char(' ')) return QString("%1")
.arg(currentMark, m_mark.count(), QLatin1Char(' '))
.replace(QString(" "), QString("&nbsp;")); .replace(QString(" "), QString("&nbsp;"));
else if (key == QString("name")) else if (key == QString("name"))
return KWindowSystem::desktopName(desktop).replace(QString(" "), QString("&nbsp;")); return KWindowSystem::desktopName(desktop)
.replace(QString(" "), QString("&nbsp;"));
else if (key == QString("number")) else if (key == QString("number"))
return QString::number(desktop); return QString::number(desktop);
else if (key == QString("total")) else if (key == QString("total"))
@ -246,30 +266,51 @@ QString DPAdds::getAboutText(const QString type) const
qCDebug(LOG_DP) << "Type" << type; qCDebug(LOG_DP) << "Type" << type;
QString text; QString text;
if (type == QString("header")) if (type == QString("header")) {
text = QString(NAME); text = QString(NAME);
else if (type == QString("version")) { } else if (type == QString("version")) {
text = i18n("Version %1 (build date %2)", QString(VERSION), QString(BUILD_DATE)); text = i18n("Version %1 (build date %2)", QString(VERSION),
if (!QString(COMMIT_SHA).isEmpty()) text += QString(" (%1)").arg(QString(COMMIT_SHA)); QString(BUILD_DATE));
} else if (type == QString("description")) if (!QString(COMMIT_SHA).isEmpty())
text += QString(" (%1)").arg(QString(COMMIT_SHA));
} else if (type == QString("description")) {
text = i18n("A set of minimalistic plasmoid widgets"); text = i18n("A set of minimalistic plasmoid widgets");
else if (type == QString("links")) } else if (type == QString("links")) {
text = i18n("Links:") + QString("<br>") + 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>")
QString("<a href=\"%1\">%2</a><br>").arg(QString(REPOSITORY)).arg(i18n("Repository")) + .arg(QString(HOMEPAGE))
QString("<a href=\"%1\">%2</a><br>").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) + .arg(i18n("Homepage"))
QString("<a href=\"%1\">%2</a><br>").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) + + QString("<a href=\"%1\">%2</a><br>")
QString("<a href=\"%1\">%2</a><br>").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")) + .arg(QString(REPOSITORY))
QString("<a href=\"%1\">%2</a>").arg(QString(OPENSUSE_PACKAGES)).arg(i18n("openSUSE packages")); .arg(i18n("Repository"))
else if (type == QString("copy")) + QString("<a href=\"%1\">%2</a><br>")
text = QString("<small>&copy; %1 <a href=\"mailto:%2\">%3</a><br>").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + .arg(QString(BUGTRACKER))
i18n("This software is licensed under %1", QString(LICENSE)) + QString("</small>"); .arg(i18n("Bugtracker"))
else if (type == QString("translators")) + QString("<a href=\"%1\">%2</a><br>")
.arg(QString(TRANSLATION))
.arg(i18n("Translation issue"))
+ QString("<a href=\"%1\">%2</a><br>")
.arg(QString(AUR_PACKAGES))
.arg(i18n("AUR packages"))
+ QString("<a href=\"%1\">%2</a>")
.arg(QString(OPENSUSE_PACKAGES))
.arg(i18n("openSUSE packages"));
} else if (type == QString("copy")) {
text = QString("<small>&copy; %1 <a href=\"mailto:%2\">%3</a><br>")
.arg(QString(DATE))
.arg(QString(EMAIL))
.arg(QString(AUTHOR))
+ i18n("This software is licensed under %1", QString(LICENSE))
+ QString("</small>");
} else if (type == QString("translators")) {
text = i18n("Translators: %1", QString(TRANSLATORS)); text = i18n("Translators: %1", QString(TRANSLATORS));
else if (type == QString("3rdparty")) { } else if (type == QString("3rdparty")) {
QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts); QStringList trdPartyList
= QString(TRDPARTY_LICENSE)
.split(QChar(';'), QString::SkipEmptyParts);
for (int i = 0; i < trdPartyList.count(); i++) for (int i = 0; i < trdPartyList.count(); i++)
trdPartyList[i] = QString("<a href=\"%3\">%1</a> (%2 license)") trdPartyList[i]
= QString("<a href=\"%3\">%1</a> (%2 license)")
.arg(trdPartyList.at(i).split(QChar(',')).at(0)) .arg(trdPartyList.at(i).split(QChar(',')).at(0))
.arg(trdPartyList.at(i).split(QChar(',')).at(1)) .arg(trdPartyList.at(i).split(QChar(',')).at(1))
.arg(trdPartyList.at(i).split(QChar(',')).at(2)); .arg(trdPartyList.at(i).split(QChar(',')).at(2));
@ -287,10 +328,10 @@ QVariantMap DPAdds::getFont(const QVariantMap defaultFont) const
QVariantMap fontMap; QVariantMap fontMap;
CFont defaultCFont = CFont(defaultFont[QString("family")].toString(), CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
defaultFont[QString("size")].toInt(), defaultFont[QString("size")].toInt(), 400, false,
400, false, defaultFont[QString("color")].toString()); defaultFont[QString("color")].toString());
CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, CFont font
false, false); = CFontDialog::getFont(i18n("Select font"), defaultCFont, false, false);
fontMap[QString("color")] = font.color().name(); fontMap[QString("color")] = font.color().name();
fontMap[QString("family")] = font.family(); fontMap[QString("family")] = font.family();
fontMap[QString("size")] = font.pointSize(); fontMap[QString("size")] = font.pointSize();
@ -306,8 +347,10 @@ void DPAdds::sendNotification(const QString eventId, const QString message)
qCDebug(LOG_DP) << "Event" << eventId; qCDebug(LOG_DP) << "Event" << eventId;
qCDebug(LOG_DP) << "Message" << message; qCDebug(LOG_DP) << "Message" << message;
KNotification *notification = KNotification::event(eventId, QString("Desktop Panel ::: %1").arg(eventId), message); KNotification *notification = KNotification::event(
notification->setComponentName(QString("plasma-applet-org.kde.plasma.desktop-panel")); eventId, QString("Desktop Panel ::: %1").arg(eventId), message);
notification->setComponentName(
QString("plasma-applet-org.kde.plasma.desktop-panel"));
} }
@ -331,19 +374,23 @@ DPAdds::DesktopWindowsInfo DPAdds::getInfoByDesktop(const int desktop) const
info.desktop = KWindowSystem::workArea(desktop); info.desktop = KWindowSystem::workArea(desktop);
foreach (WId id, KWindowSystem::windows()) { foreach (WId id, KWindowSystem::windows()) {
KWindowInfo winInfo = KWindowInfo(id, KWindowInfo winInfo = KWindowInfo(
NET::Property::WMDesktop | NET::Property::WMGeometry | id, NET::Property::WMDesktop | NET::Property::WMGeometry
NET::Property::WMState | NET::Property::WMWindowType | | NET::Property::WMState | NET::Property::WMWindowType
NET::Property::WMVisibleName); | NET::Property::WMVisibleName);
if (!winInfo.isOnDesktop(desktop)) continue; if (!winInfo.isOnDesktop(desktop))
continue;
WindowData data; WindowData data;
data.id = id; data.id = id;
data.name = winInfo.visibleName(); data.name = winInfo.visibleName();
data.rect = winInfo.geometry(); data.rect = winInfo.geometry();
if (winInfo.windowType(NET::WindowTypeMask::NormalMask) == NET::WindowType::Normal) { if (winInfo.windowType(NET::WindowTypeMask::NormalMask)
if (winInfo.isMinimized()) continue; == NET::WindowType::Normal) {
if (winInfo.isMinimized())
continue;
info.windowsData.append(data); info.windowsData.append(data);
} else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask) == NET::WindowType::Desktop) { } else if (winInfo.windowType(NET::WindowTypeMask::DesktopMask)
== NET::WindowType::Desktop) {
info.desktopsData.append(data); info.desktopsData.append(data);
} }
} }

View File

@ -43,13 +43,13 @@ class DPAdds : public QObject
public: public:
explicit DPAdds(QObject *parent = nullptr); explicit DPAdds(QObject *parent = nullptr);
virtual ~DPAdds(); virtual ~DPAdds();
Q_INVOKABLE bool isDebugEnabled() const; Q_INVOKABLE bool isDebugEnabled() const;
Q_INVOKABLE int currentDesktop() const; Q_INVOKABLE int currentDesktop() const;
Q_INVOKABLE QStringList dictKeys() const; Q_INVOKABLE QStringList dictKeys() const;
Q_INVOKABLE int numberOfDesktops() const; Q_INVOKABLE int numberOfDesktops() const;
Q_INVOKABLE QString toolTipImage(const int desktop) const; Q_INVOKABLE QString toolTipImage(const int desktop) const;
Q_INVOKABLE QString parsePattern(const QString pattern, const int desktop) const; Q_INVOKABLE QString parsePattern(const QString pattern,
const int desktop) const;
// values // values
Q_INVOKABLE void setMark(const QString newMark); Q_INVOKABLE void setMark(const QString newMark);
Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData); Q_INVOKABLE void setToolTipData(const QVariantMap tooltipData);
@ -63,7 +63,8 @@ signals:
void windowListChanged() const; void windowListChanged() const;
public slots: public slots:
Q_INVOKABLE static void sendNotification(const QString eventId, const QString message); Q_INVOKABLE static void sendNotification(const QString eventId,
const QString message);
Q_INVOKABLE void setCurrentDesktop(const int desktop) const; Q_INVOKABLE void setCurrentDesktop(const int desktop) const;
private: private:

View File

@ -92,7 +92,8 @@ QStringList ExtendedSysMon::getAllHdd() const
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
QStringList allDevices = QDir(QString("/dev")).entryList(QDir::System, QDir::Name); QStringList allDevices
= QDir(QString("/dev")).entryList(QDir::System, QDir::Name);
QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$"))); QStringList devices = allDevices.filter(QRegExp(QString("^[hms]d[a-z]$")));
for (int i = 0; i < devices.count(); i++) for (int i = 0; i < devices.count(); i++)
devices[i] = QString("/dev/%1").arg(devices.at(i)); devices[i] = QString("/dev/%1").arg(devices.at(i));
@ -108,7 +109,8 @@ QString ExtendedSysMon::getAutoGpu() const
QString gpu = QString("disable"); QString gpu = QString("disable");
QFile moduleFile(QString("/proc/modules")); QFile moduleFile(QString("/proc/modules"));
if (!moduleFile.open(QIODevice::ReadOnly)) return gpu; if (!moduleFile.open(QIODevice::ReadOnly))
return gpu;
QString output = moduleFile.readAll(); QString output = moduleFile.readAll();
if (output.contains(QString("fglrx"))) if (output.contains(QString("fglrx")))
@ -125,29 +127,44 @@ void ExtendedSysMon::readConfiguration()
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString fileName
= QStandardPaths::locate(QStandardPaths::ConfigLocation,
QString("plasma-dataengine-extsysmon.conf")); QString("plasma-dataengine-extsysmon.conf"));
qCInfo(LOG_ESM) << "Configuration file" << fileName; qCInfo(LOG_ESM) << "Configuration file" << fileName;
QSettings settings(fileName, QSettings::IniFormat); QSettings settings(fileName, QSettings::IniFormat);
QHash<QString, QString> rawConfig; QHash<QString, QString> rawConfig;
settings.beginGroup(QString("Configuration")); settings.beginGroup(QString("Configuration"));
rawConfig[QString("ACPIPATH")] = settings.value(QString("ACPIPATH"), QString("/sys/class/power_supply/")).toString(); rawConfig[QString("ACPIPATH")]
rawConfig[QString("GPUDEV")] = settings.value(QString("GPUDEV"), QString("auto")).toString(); = settings.value(QString("ACPIPATH"),
rawConfig[QString("HDDDEV")] = settings.value(QString("HDDDEV"), QString("all")).toString(); QString("/sys/class/power_supply/"))
rawConfig[QString("HDDTEMPCMD")] = settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a")).toString(); .toString();
rawConfig[QString("MPDADDRESS")] = settings.value(QString("MPDADDRESS"), QString("localhost")).toString(); rawConfig[QString("GPUDEV")]
rawConfig[QString("MPDPORT")] = settings.value(QString("MPDPORT"), QString("6600")).toString(); = settings.value(QString("GPUDEV"), QString("auto")).toString();
rawConfig[QString("MPRIS")] = settings.value(QString("MPRIS"), QString("auto")).toString(); rawConfig[QString("HDDDEV")]
rawConfig[QString("PLAYER")] = settings.value(QString("PLAYER"), QString("mpris")).toString(); = settings.value(QString("HDDDEV"), QString("all")).toString();
rawConfig[QString("PLAYERSYMBOLS")] = settings.value(QString("PLAYERSYMBOLS"), QString("10")).toString(); rawConfig[QString("HDDTEMPCMD")]
= settings.value(QString("HDDTEMPCMD"), QString("sudo smartctl -a"))
.toString();
rawConfig[QString("MPDADDRESS")]
= settings.value(QString("MPDADDRESS"), QString("localhost"))
.toString();
rawConfig[QString("MPDPORT")]
= settings.value(QString("MPDPORT"), QString("6600")).toString();
rawConfig[QString("MPRIS")]
= settings.value(QString("MPRIS"), QString("auto")).toString();
rawConfig[QString("PLAYER")]
= settings.value(QString("PLAYER"), QString("mpris")).toString();
rawConfig[QString("PLAYERSYMBOLS")]
= settings.value(QString("PLAYERSYMBOLS"), QString("10")).toString();
settings.endGroup(); settings.endGroup();
configuration = updateConfiguration(rawConfig); configuration = updateConfiguration(rawConfig);
} }
QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const QHash<QString, QString>
ExtendedSysMon::updateConfiguration(QHash<QString, QString> rawConfig) const
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Raw configuration" << rawConfig; qCDebug(LOG_ESM) << "Raw configuration" << rawConfig;
@ -157,17 +174,18 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
rawConfig[QString("GPUDEV")] = QString("disable"); rawConfig[QString("GPUDEV")] = QString("disable");
else if (rawConfig[QString("GPUDEV")] == QString("auto")) else if (rawConfig[QString("GPUDEV")] == QString("auto"))
rawConfig[QString("GPUDEV")] = getAutoGpu(); rawConfig[QString("GPUDEV")] = getAutoGpu();
else if ((rawConfig[QString("GPUDEV")] != QString("ati")) && else if ((rawConfig[QString("GPUDEV")] != QString("ati"))
(rawConfig[QString("GPUDEV")] != QString("nvidia"))) && (rawConfig[QString("GPUDEV")] != QString("nvidia")))
rawConfig[QString("GPUDEV")] = getAutoGpu(); rawConfig[QString("GPUDEV")] = getAutoGpu();
// hdddev // hdddev
QStringList allHddDevices = getAllHdd(); QStringList allHddDevices = getAllHdd();
if (rawConfig[QString("HDDDEV")] == QString("all")) if (rawConfig[QString("HDDDEV")] == QString("all")) {
rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(',')); rawConfig[QString("HDDDEV")] = allHddDevices.join(QChar(','));
else if (rawConfig[QString("HDDDEV")] == QString("disable")) } else if (rawConfig[QString("HDDDEV")] == QString("disable")) {
rawConfig[QString("HDDDEV")] = QString(""); rawConfig[QString("HDDDEV")] = QString("");
else { } else {
QStringList deviceList = rawConfig[QString("HDDDEV")].split(QChar(','), QString::SkipEmptyParts); QStringList deviceList = rawConfig[QString("HDDDEV")].split(
QChar(','), QString::SkipEmptyParts);
QStringList devices; QStringList devices;
QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$"); QRegExp diskRegexp = QRegExp("^/dev/[hms]d[a-z]$");
foreach (QString device, deviceList) foreach (QString device, deviceList)
@ -179,9 +197,9 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
rawConfig[QString("HDDDEV")] = devices.join(QChar(',')); rawConfig[QString("HDDDEV")] = devices.join(QChar(','));
} }
// player // player
if ((rawConfig[QString("PLAYER")] != QString("mpd")) && if ((rawConfig[QString("PLAYER")] != QString("mpd"))
(rawConfig[QString("PLAYER")] != QString("mpris")) && && (rawConfig[QString("PLAYER")] != QString("mpris"))
(rawConfig[QString("PLAYER")] != QString("disable"))) && (rawConfig[QString("PLAYER")] != QString("disable")))
rawConfig[QString("PLAYER")] = QString("mpris"); rawConfig[QString("PLAYER")] = QString("mpris");
// player symbols // player symbols
if (rawConfig[QString("PLAYERSYMBOLS")].toInt() <= 0) if (rawConfig[QString("PLAYERSYMBOLS")].toInt() <= 0)
@ -193,6 +211,7 @@ QHash<QString, QString> ExtendedSysMon::updateConfiguration(QHash<QString, QStri
} }
K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon, "plasma-dataengine-extsysmon.json") K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(extsysmon, ExtendedSysMon,
"plasma-dataengine-extsysmon.json")
#include "extsysmon.moc" #include "extsysmon.moc"

View File

@ -44,7 +44,8 @@ private:
QStringList getAllHdd() const; QStringList getAllHdd() const;
QString getAutoGpu() const; QString getAutoGpu() const;
void readConfiguration(); void readConfiguration();
QHash<QString, QString> updateConfiguration(QHash<QString, QString> rawConfig) const; QHash<QString, QString>
updateConfiguration(QHash<QString, QString> rawConfig) const;
}; };

View File

@ -35,7 +35,8 @@
#include "sources/weathersource.h" #include "sources/weathersource.h"
ExtSysMonAggregator::ExtSysMonAggregator(QObject *parent, const QHash<QString, QString> config) ExtSysMonAggregator::ExtSysMonAggregator(QObject *parent,
const QHash<QString, QString> config)
: QObject(parent) : QObject(parent)
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
@ -61,15 +62,6 @@ QVariant ExtSysMonAggregator::data(const QString source) const
} }
AbstractExtSysMonSource *ExtSysMonAggregator::engine(const QString source)
{
qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Source" << source;
return hasSource(source) ? m_map[source] : nullptr;
}
bool ExtSysMonAggregator::hasSource(const QString source) const bool ExtSysMonAggregator::hasSource(const QString source) const
{ {
return m_map.contains(source); return m_map.contains(source);
@ -81,7 +73,8 @@ QVariantMap ExtSysMonAggregator::initialData(const QString source) const
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Source" << source; qCDebug(LOG_ESM) << "Source" << source;
return hasSource(source) ? m_map[source]->initialData(source) : QVariantMap(); return hasSource(source) ? m_map[source]->initialData(source)
: QVariantMap();
} }
@ -100,7 +93,8 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> config)
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
// battery // battery
AbstractExtSysMonSource *batteryItem = new BatterySource(this, QStringList() << config[QString("ACPIPATH")]); AbstractExtSysMonSource *batteryItem
= new BatterySource(this, QStringList() << config[QString("ACPIPATH")]);
foreach (QString source, batteryItem->sources()) foreach (QString source, batteryItem->sources())
m_map[source] = batteryItem; m_map[source] = batteryItem;
// custom // custom
@ -108,34 +102,42 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> config)
foreach (QString source, customItem->sources()) foreach (QString source, customItem->sources())
m_map[source] = customItem; m_map[source] = customItem;
// desktop // desktop
AbstractExtSysMonSource *desktopItem = new DesktopSource(this, QStringList()); AbstractExtSysMonSource *desktopItem
= new DesktopSource(this, QStringList());
foreach (QString source, desktopItem->sources()) foreach (QString source, desktopItem->sources())
m_map[source] = desktopItem; m_map[source] = desktopItem;
// gpu load // gpu load
AbstractExtSysMonSource *gpuLoadItem = new GPULoadSource(this, QStringList() << config[QString("GPUDEV")]); AbstractExtSysMonSource *gpuLoadItem
= new GPULoadSource(this, QStringList() << config[QString("GPUDEV")]);
foreach (QString source, gpuLoadItem->sources()) foreach (QString source, gpuLoadItem->sources())
m_map[source] = gpuLoadItem; m_map[source] = gpuLoadItem;
// gpu temperature // gpu temperature
AbstractExtSysMonSource *gpuTempItem = new GPUTemperatureSource(this, QStringList() << config[QString("GPUDEV")]); AbstractExtSysMonSource *gpuTempItem = new GPUTemperatureSource(
this, QStringList() << config[QString("GPUDEV")]);
foreach (QString source, gpuTempItem->sources()) foreach (QString source, gpuTempItem->sources())
m_map[source] = gpuTempItem; m_map[source] = gpuTempItem;
// hdd temperature // hdd temperature
AbstractExtSysMonSource *hddTempItem = new HDDTemperatureSource(this, AbstractExtSysMonSource *hddTempItem = new HDDTemperatureSource(
QStringList() << config[QString("HDDDEV")] << config[QString("HDDTEMPCMD")]); this, QStringList() << config[QString("HDDDEV")]
<< config[QString("HDDTEMPCMD")]);
foreach (QString source, hddTempItem->sources()) foreach (QString source, hddTempItem->sources())
m_map[source] = hddTempItem; m_map[source] = hddTempItem;
// network // network
AbstractExtSysMonSource *networkItem = new NetworkSource(this, QStringList()); AbstractExtSysMonSource *networkItem
= new NetworkSource(this, QStringList());
foreach (QString source, networkItem->sources()) foreach (QString source, networkItem->sources())
m_map[source] = networkItem; m_map[source] = networkItem;
// player // player
AbstractExtSysMonSource *playerItem = new PlayerSource(this, AbstractExtSysMonSource *playerItem = new PlayerSource(
QStringList() << config[QString("PLAYER")] << config[QString("MPDADDRESS")] this, QStringList()
<< config[QString("MPDPORT")] << config[QString("MPRIS")] << config[QString("PLAYERSYMBOLS")]); << config[QString("PLAYER")] << config[QString("MPDADDRESS")]
<< config[QString("MPDPORT")] << config[QString("MPRIS")]
<< config[QString("PLAYERSYMBOLS")]);
foreach (QString source, playerItem->sources()) foreach (QString source, playerItem->sources())
m_map[source] = playerItem; m_map[source] = playerItem;
// processes // processes
AbstractExtSysMonSource *processesItem = new ProcessesSource(this, QStringList()); AbstractExtSysMonSource *processesItem
= new ProcessesSource(this, QStringList());
foreach (QString source, processesItem->sources()) foreach (QString source, processesItem->sources())
m_map[source] = processesItem; m_map[source] = processesItem;
// quotes // quotes
@ -147,11 +149,13 @@ void ExtSysMonAggregator::init(const QHash<QString, QString> config)
foreach (QString source, updateItem->sources()) foreach (QString source, updateItem->sources())
m_map[source] = updateItem; m_map[source] = updateItem;
// upgrade // upgrade
AbstractExtSysMonSource *upgradeItem = new UpgradeSource(this, QStringList()); AbstractExtSysMonSource *upgradeItem
= new UpgradeSource(this, QStringList());
foreach (QString source, upgradeItem->sources()) foreach (QString source, upgradeItem->sources())
m_map[source] = upgradeItem; m_map[source] = upgradeItem;
// weather // weather
AbstractExtSysMonSource *weatherItem = new WeatherSource(this, QStringList()); AbstractExtSysMonSource *weatherItem
= new WeatherSource(this, QStringList());
foreach (QString source, weatherItem->sources()) foreach (QString source, weatherItem->sources())
m_map[source] = weatherItem; m_map[source] = weatherItem;
#ifdef BUILD_TESTING #ifdef BUILD_TESTING

View File

@ -28,10 +28,10 @@ class ExtSysMonAggregator : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ExtSysMonAggregator(QObject *parent, const QHash<QString, QString> config); explicit ExtSysMonAggregator(QObject *parent,
const QHash<QString, QString> config);
virtual ~ExtSysMonAggregator(); virtual ~ExtSysMonAggregator();
QVariant data(const QString source) const; QVariant data(const QString source) const;
AbstractExtSysMonSource *engine(const QString source);
bool hasSource(const QString source) const; bool hasSource(const QString source) const;
QVariantMap initialData(const QString source) const; QVariantMap initialData(const QString source) const;
QStringList sources() const; QStringList sources() const;

View File

@ -26,7 +26,8 @@
class AbstractExtSysMonSource : public QObject class AbstractExtSysMonSource : public QObject
{ {
public: public:
explicit AbstractExtSysMonSource(QObject *parent, const QStringList) : QObject(parent) {}; explicit AbstractExtSysMonSource(QObject *parent, const QStringList)
: QObject(parent){};
virtual ~AbstractExtSysMonSource(){}; virtual ~AbstractExtSysMonSource(){};
virtual QVariant data(QString source) = 0; virtual QVariant data(QString source) = 0;
virtual QVariantMap initialData(QString source) const = 0; virtual QVariantMap initialData(QString source) const = 0;

View File

@ -45,7 +45,8 @@ QVariant BatterySource::data(QString source)
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Source" << source; qCDebug(LOG_ESM) << "Source" << source;
if (source == QString("battery/ac")) run(); if (source == QString("battery/ac"))
run();
return values[source]; return values[source];
} }
@ -87,27 +88,34 @@ void BatterySource::run()
// adaptor // adaptor
QFile acFile(QString("%1/AC/online").arg(m_acpiPath)); QFile acFile(QString("%1/AC/online").arg(m_acpiPath));
if (acFile.open(QIODevice::ReadOnly)) if (acFile.open(QIODevice::ReadOnly))
values[QString("battery/ac")] = (QString(acFile.readLine()).trimmed().toInt() == 1); values[QString("battery/ac")]
= (QString(acFile.readLine()).trimmed().toInt() == 1);
acFile.close(); acFile.close();
// batterites // batterites
float currentLevel = 0.0; float currentLevel = 0.0;
float fullLevel = 0.0; float fullLevel = 0.0;
for (int i = 0; i < m_batteriesCount; i++) { for (int i = 0; i < m_batteriesCount; i++) {
QFile currentLevelFile(QString("%1/BAT%2/energy_now").arg(m_acpiPath).arg(i)); QFile currentLevelFile(
QFile fullLevelFile(QString("%1/BAT%2/energy_full").arg(m_acpiPath).arg(i)); QString("%1/BAT%2/energy_now").arg(m_acpiPath).arg(i));
if ((currentLevelFile.open(QIODevice::ReadOnly)) && QFile fullLevelFile(
(fullLevelFile.open(QIODevice::ReadOnly))) { QString("%1/BAT%2/energy_full").arg(m_acpiPath).arg(i));
float batCurrent = QString(currentLevelFile.readLine()).trimmed().toFloat(); if ((currentLevelFile.open(QIODevice::ReadOnly))
float batFull = QString(fullLevelFile.readLine()).trimmed().toFloat(); && (fullLevelFile.open(QIODevice::ReadOnly))) {
values[QString("battery/bat%1").arg(i)] = static_cast<int>(100 * batCurrent / batFull); float batCurrent
= QString(currentLevelFile.readLine()).trimmed().toFloat();
float batFull
= QString(fullLevelFile.readLine()).trimmed().toFloat();
values[QString("battery/bat%1").arg(i)]
= static_cast<int>(100 * batCurrent / batFull);
currentLevel += batCurrent; currentLevel += batCurrent;
fullLevel += batFull; fullLevel += batFull;
} }
currentLevelFile.close(); currentLevelFile.close();
fullLevelFile.close(); fullLevelFile.close();
} }
values[QString("battery/bat")] = static_cast<int>(100 * currentLevel / fullLevel); values[QString("battery/bat")]
= static_cast<int>(100 * currentLevel / fullLevel);
} }
@ -126,13 +134,15 @@ QStringList BatterySource::getSources()
QStringList sources; QStringList sources;
sources.append(QString("battery/ac")); sources.append(QString("battery/ac"));
sources.append(QString("battery/bat")); sources.append(QString("battery/bat"));
m_batteriesCount = QDir(m_acpiPath).entryList(QStringList() << QString("BAT*"), m_batteriesCount
QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name).count(); = QDir(m_acpiPath)
.entryList(QStringList() << QString("BAT*"),
QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name)
.count();
qCInfo(LOG_ESM) << "Init batteries count as" << m_batteriesCount; qCInfo(LOG_ESM) << "Init batteries count as" << m_batteriesCount;
for (int i = 0; i < m_batteriesCount; i++) for (int i = 0; i < m_batteriesCount; i++)
sources.append(QString("battery/bat%1").arg(i)); sources.append(QString("battery/bat%1").arg(i));
qCInfo(LOG_ESM) << "Sources list" << sources; qCInfo(LOG_ESM) << "Sources list" << sources;
return sources; return sources;
} }

View File

@ -59,7 +59,9 @@ QVariantMap CustomSource::initialData(QString source) const
QVariantMap data; QVariantMap data;
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Custom command '%1' output").arg(extScripts->itemByTagNumber(index(source))->uniq()); data[QString("name")]
= QString("Custom command '%1' output")
.arg(extScripts->itemByTagNumber(index(source))->uniq());
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");

View File

@ -51,29 +51,39 @@ QVariant GPULoadSource::data(QString source)
if ((m_device != QString("nvidia")) && (m_device != QString("ati"))) if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
return value; return value;
// build cmd // build cmd
QString cmd = m_device == QString("nvidia") ? QString("nvidia-smi -q -x") : QString("aticonfig --od-getclocks"); QString cmd = m_device == QString("nvidia")
? QString("nvidia-smi -q -x")
: QString("aticonfig --od-getclocks");
qCInfo(LOG_ESM) << "cmd" << cmd; qCInfo(LOG_ESM) << "cmd" << cmd;
TaskResult process = runTask(cmd); TaskResult process = runTask(cmd);
qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode; qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode;
qCInfo(LOG_ESM) << "Error" << process.error; qCInfo(LOG_ESM) << "Error" << process.error;
// parse // parse
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed(); QString qoutput
if (m_device == QString("nvidia")) = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { if (m_device == QString("nvidia")) {
if (!str.contains(QString("<gpu_util>"))) continue; foreach (QString str,
QString load = str.remove(QString("<gpu_util>")).remove(QString("</gpu_util>")) qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("<gpu_util>")))
continue;
QString load = str.remove(QString("<gpu_util>"))
.remove(QString("</gpu_util>"))
.remove(QChar('%')); .remove(QChar('%'));
value = load.toFloat(); value = load.toFloat();
break; break;
} }
else if (m_device == QString("ati")) } else if (m_device == QString("ati")) {
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { foreach (QString str,
if (!str.contains(QString("load"))) continue; qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
QString load = str.split(QChar(' '), QString::SkipEmptyParts)[3] if (!str.contains(QString("load")))
.remove(QChar('%')); continue;
QString load
= str.split(QChar(' '), QString::SkipEmptyParts)[3].remove(
QChar('%'));
value = load.toFloat(); value = load.toFloat();
break; break;
} }
}
// return // return
return value; return value;
} }

View File

@ -25,7 +25,8 @@
#include "awdebug.h" #include "awdebug.h"
GPUTemperatureSource::GPUTemperatureSource(QObject *parent, const QStringList args) GPUTemperatureSource::GPUTemperatureSource(QObject *parent,
const QStringList args)
: AbstractExtSysMonSource(parent, args) : AbstractExtSysMonSource(parent, args)
{ {
Q_ASSERT(args.count() == 1); Q_ASSERT(args.count() == 1);
@ -51,27 +52,37 @@ QVariant GPUTemperatureSource::data(QString source)
if ((m_device != QString("nvidia")) && (m_device != QString("ati"))) if ((m_device != QString("nvidia")) && (m_device != QString("ati")))
return value; return value;
// build cmd // build cmd
QString cmd = m_device == QString("nvidia") ? QString("nvidia-smi -q -x") : QString("aticonfig --od-gettemperature"); QString cmd = m_device == QString("nvidia")
? QString("nvidia-smi -q -x")
: QString("aticonfig --od-gettemperature");
qCInfo(LOG_ESM) << "cmd" << cmd; qCInfo(LOG_ESM) << "cmd" << cmd;
TaskResult process = runTask(cmd); TaskResult process = runTask(cmd);
qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode; qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode;
qCInfo(LOG_ESM) << "Error" << process.error; qCInfo(LOG_ESM) << "Error" << process.error;
// parse // parse
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed(); QString qoutput
if (m_device == QString("nvidia")) = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { if (m_device == QString("nvidia")) {
if (!str.contains(QString("<gpu_temp>"))) continue; foreach (QString str,
QString temp = str.remove(QString("<gpu_temp>")).remove(QString("C</gpu_temp>")); qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (!str.contains(QString("<gpu_temp>")))
continue;
QString temp = str.remove(QString("<gpu_temp>"))
.remove(QString("C</gpu_temp>"));
value = temp.toFloat(); value = temp.toFloat();
break; break;
} }
else if (m_device == QString("ati")) } else if (m_device == QString("ati")) {
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { foreach (QString str,
if (!str.contains(QString("Temperature"))) continue; qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
QString temp = str.split(QChar(' '), QString::SkipEmptyParts).at(4); if (!str.contains(QString("Temperature")))
continue;
QString temp
= str.split(QChar(' '), QString::SkipEmptyParts).at(4);
value = temp.toFloat(); value = temp.toFloat();
break; break;
} }
}
// return // return
return value; return value;
} }

View File

@ -25,7 +25,8 @@
#include "awdebug.h" #include "awdebug.h"
HDDTemperatureSource::HDDTemperatureSource(QObject *parent, const QStringList args) HDDTemperatureSource::HDDTemperatureSource(QObject *parent,
const QStringList args)
: AbstractExtSysMonSource(parent, args) : AbstractExtSysMonSource(parent, args)
{ {
Q_ASSERT(args.count() == 2); Q_ASSERT(args.count() == 2);
@ -58,17 +59,24 @@ QVariant HDDTemperatureSource::data(QString source)
qCInfo(LOG_ESM) << "Error" << process.error; qCInfo(LOG_ESM) << "Error" << process.error;
// parse // parse
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed(); QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
if (m_smartctl) { if (m_smartctl) {
foreach(QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { foreach (QString str,
if (!str.startsWith(QString("194"))) continue; qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (str.split(QChar(' '), QString::SkipEmptyParts).count() < 9) break; if (!str.startsWith(QString("194")))
value = str.split(QChar(' '), QString::SkipEmptyParts).at(9).toFloat(); continue;
if (str.split(QChar(' '), QString::SkipEmptyParts).count() < 9)
break;
value = str.split(QChar(' '), QString::SkipEmptyParts)
.at(9)
.toFloat();
break; break;
} }
} else { } else {
if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) { if (qoutput.split(QChar(':'), QString::SkipEmptyParts).count() >= 3) {
QString temp = qoutput.split(QChar(':'), QString::SkipEmptyParts).at(2); QString temp
= qoutput.split(QChar(':'), QString::SkipEmptyParts).at(2);
temp.remove(QChar(0260)).remove(QChar('C')); temp.remove(QChar(0260)).remove(QChar('C'));
value = temp.toFloat(); value = temp.toFloat();
} }

View File

@ -44,13 +44,16 @@ QVariant NetworkSource::data(QString source)
if (source == QString("network/current/name")) { if (source == QString("network/current/name")) {
QString device = QString("lo"); QString device = QString("lo");
QList<QNetworkInterface> rawInterfaceList = QNetworkInterface::allInterfaces(); QList<QNetworkInterface> rawInterfaceList
= QNetworkInterface::allInterfaces();
qCInfo(LOG_ESM) << "Devices" << rawInterfaceList; qCInfo(LOG_ESM) << "Devices" << rawInterfaceList;
foreach (QNetworkInterface interface, rawInterfaceList) { foreach (QNetworkInterface interface, rawInterfaceList) {
if ((interface.flags().testFlag(QNetworkInterface::IsLoopBack)) || if ((interface.flags().testFlag(QNetworkInterface::IsLoopBack))
(interface.flags().testFlag(QNetworkInterface::IsPointToPoint))) || (interface.flags().testFlag(
QNetworkInterface::IsPointToPoint)))
continue;
if (interface.addressEntries().isEmpty())
continue; continue;
if (interface.addressEntries().isEmpty()) continue;
device = interface.name(); device = interface.name();
break; break;
} }

View File

@ -53,7 +53,8 @@ QVariant PlayerSource::data(QString source)
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Source" << source; qCDebug(LOG_ESM) << "Source" << source;
if (source == QString("player/title")) run(); if (source == QString("player/title"))
run();
return values[source]; return values[source];
} }
@ -73,13 +74,16 @@ QVariantMap PlayerSource::initialData(QString source) const
} else if (source == QString("player/salbum")) { } else if (source == QString("player/salbum")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song album (%1 symbols)").arg(m_symbols); data[QString("name")]
= QString("Current song album (%1 symbols)").arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source == QString("player/dalbum")) { } else if (source == QString("player/dalbum")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song album (%1 symbols, dynamic)").arg(m_symbols); data[QString("name")]
= QString("Current song album (%1 symbols, dynamic)")
.arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source == QString("player/artist")) { } else if (source == QString("player/artist")) {
@ -91,13 +95,16 @@ QVariantMap PlayerSource::initialData(QString source) const
} else if (source == QString("player/sartist")) { } else if (source == QString("player/sartist")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song artist (%1 symbols)").arg(m_symbols); data[QString("name")]
= QString("Current song artist (%1 symbols)").arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source == QString("player/dartist")) { } else if (source == QString("player/dartist")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song artist (%1 symbols, dynamic)").arg(m_symbols); data[QString("name")]
= QString("Current song artist (%1 symbols, dynamic)")
.arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source == QString("player/duration")) { } else if (source == QString("player/duration")) {
@ -121,13 +128,16 @@ QVariantMap PlayerSource::initialData(QString source) const
} else if (source == QString("player/stitle")) { } else if (source == QString("player/stitle")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song title (%1 symbols)").arg(m_symbols); data[QString("name")]
= QString("Current song title (%1 symbols)").arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source == QString("player/dtitle")) { } else if (source == QString("player/dtitle")) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Current song title (%1 symbols, dynamic)").arg(m_symbols); data[QString("name")]
= QString("Current song title (%1 symbols, dynamic)")
.arg(m_symbols);
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} }
@ -144,32 +154,34 @@ void PlayerSource::run()
if (m_player == QString("mpd")) { if (m_player == QString("mpd")) {
// mpd // mpd
QHash<QString, QVariant> data = getPlayerMpdInfo(m_mpdAddress); QHash<QString, QVariant> data = getPlayerMpdInfo(m_mpdAddress);
foreach(QString key, data.keys()) values[key] = data[key]; foreach (QString key, data.keys())
values[key] = data[key];
} else if (m_player == QString("mpris")) { } else if (m_player == QString("mpris")) {
// players which supports mpris // players which supports mpris
QString mpris = m_mpris == QString("auto") ? getAutoMpris() : m_mpris; QString mpris = m_mpris == QString("auto") ? getAutoMpris() : m_mpris;
QHash<QString, QVariant> data = getPlayerMprisInfo(mpris); QHash<QString, QVariant> data = getPlayerMprisInfo(mpris);
foreach(QString key, data.keys()) values[key] = data[key]; foreach (QString key, data.keys())
values[key] = data[key];
} }
// dymanic properties // dymanic properties
// solid // solid
values[QString("player/salbum")] = stripString(values[QString("player/album")].toString(), values[QString("player/salbum")]
m_symbols); = stripString(values[QString("player/album")].toString(), m_symbols);
values[QString("player/sartist")] = stripString(values[QString("player/artist")].toString(), values[QString("player/sartist")]
m_symbols); = stripString(values[QString("player/artist")].toString(), m_symbols);
values[QString("player/stitle")] = stripString(values[QString("player/title")].toString(), values[QString("player/stitle")]
m_symbols); = stripString(values[QString("player/title")].toString(), m_symbols);
// dynamic // dynamic
values[QString("player/dalbum")] = buildString(values[QString("player/dalbum")].toString(), values[QString("player/dalbum")]
values[QString("player/album")].toString(), = buildString(values[QString("player/dalbum")].toString(),
m_symbols); values[QString("player/album")].toString(), m_symbols);
values[QString("player/dartist")] = buildString(values[QString("player/dartist")].toString(), values[QString("player/dartist")]
values[QString("player/artist")].toString(), = buildString(values[QString("player/dartist")].toString(),
m_symbols); values[QString("player/artist")].toString(), m_symbols);
values[QString("player/dtitle")] = buildString(values[QString("player/dtitle")].toString(), values[QString("player/dtitle")]
values[QString("player/title")].toString(), = buildString(values[QString("player/dtitle")].toString(),
m_symbols); values[QString("player/title")].toString(), m_symbols);
} }
@ -211,12 +223,15 @@ QString PlayerSource::getAutoMpris() const
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(QDBus::BlockWithGui, QString("ListNames")); QDBusMessage listServices = QDBusConnection::sessionBus().interface()->call(
if (listServices.arguments().isEmpty()) return QString(); QDBus::BlockWithGui, QString("ListNames"));
if (listServices.arguments().isEmpty())
return QString();
QStringList arguments = listServices.arguments().first().toStringList(); QStringList arguments = listServices.arguments().first().toStringList();
foreach (QString arg, arguments) { foreach (QString arg, arguments) {
if (!arg.startsWith(QString("org.mpris.MediaPlayer2."))) continue; if (!arg.startsWith(QString("org.mpris.MediaPlayer2.")))
continue;
qCInfo(LOG_ESM) << "Service found" << arg; qCInfo(LOG_ESM) << "Service found" << arg;
QString service = arg; QString service = arg;
service.remove(QString("org.mpris.MediaPlayer2.")); service.remove(QString("org.mpris.MediaPlayer2."));
@ -235,19 +250,25 @@ QVariantHash PlayerSource::getPlayerMpdInfo(const QString mpdAddress) const
QVariantHash info = defaultInfo(); QVariantHash info = defaultInfo();
// build cmd // build cmd
QString cmd = QString("bash -c \"echo 'currentsong\nstatus\nclose' | curl --connect-timeout 1 -fsm 3 telnet://%1\"") QString cmd = QString("bash -c \"echo 'currentsong\nstatus\nclose' | curl "
"--connect-timeout 1 -fsm 3 telnet://%1\"")
.arg(mpdAddress); .arg(mpdAddress);
qCInfo(LOG_ESM) << "cmd" << cmd; qCInfo(LOG_ESM) << "cmd" << cmd;
TaskResult process = runTask(cmd); TaskResult process = runTask(cmd);
qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode; qCInfo(LOG_ESM) << "Cmd returns" << process.exitCode;
qCInfo(LOG_ESM) << "Error" << process.error; qCInfo(LOG_ESM) << "Error" << process.error;
QString qoutput = QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed(); QString qoutput
= QTextCodec::codecForMib(106)->toUnicode(process.output).trimmed();
foreach (QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) { foreach (QString str, qoutput.split(QChar('\n'), QString::SkipEmptyParts)) {
if (str.split(QString(": "), QString::SkipEmptyParts).count() == 2) { if (str.split(QString(": "), QString::SkipEmptyParts).count() == 2) {
// "Metadata: data" // "Metadata: data"
QString metadata = str.split(QString(": "), QString::SkipEmptyParts).first().toLower(); QString metadata = str.split(QString(": "), QString::SkipEmptyParts)
QString data = str.split(QString(": "), QString::SkipEmptyParts).last().trimmed(); .first()
.toLower();
QString data = str.split(QString(": "), QString::SkipEmptyParts)
.last()
.trimmed();
// there are one more time... // there are one more time...
if ((metadata == QString("time")) && (data.contains(QChar(':')))) { if ((metadata == QString("time")) && (data.contains(QChar(':')))) {
QStringList times = data.split(QString(":")); QStringList times = data.split(QString(":"));
@ -269,44 +290,63 @@ QVariantHash PlayerSource::getPlayerMprisInfo(const QString mpris) const
qCDebug(LOG_ESM) << "MPRIS" << mpris; qCDebug(LOG_ESM) << "MPRIS" << mpris;
QVariantHash info = defaultInfo(); QVariantHash info = defaultInfo();
if (mpris.isEmpty()) return info; if (mpris.isEmpty())
return info;
QDBusConnection bus = QDBusConnection::sessionBus(); QDBusConnection bus = QDBusConnection::sessionBus();
// comes from the following request: // comes from the following request:
// qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player Metadata // qdbus org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2
// org.freedesktop.DBus.Properties.Get org.mpris.MediaPlayer2.Player
// Metadata
// or the same but using dbus-send: // or the same but using dbus-send:
// dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' // dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc
QVariantList args = QVariantList() << QString("org.mpris.MediaPlayer2.Player") << QString("Metadata"); // /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get
QDBusMessage request = QDBusMessage::createMethodCall(QString("org.mpris.MediaPlayer2.%1").arg(mpris), // string:'org.mpris.MediaPlayer2.Player' string:'Metadata'
QString("/org/mpris/MediaPlayer2"), QVariantList args = QVariantList()
QString(""), << QString("org.mpris.MediaPlayer2.Player")
QString("Get")); << QString("Metadata");
QDBusMessage request = QDBusMessage::createMethodCall(
QString("org.mpris.MediaPlayer2.%1").arg(mpris),
QString("/org/mpris/MediaPlayer2"), QString(""), QString("Get"));
request.setArguments(args); request.setArguments(args);
QDBusMessage response = bus.call(request, QDBus::BlockWithGui); QDBusMessage response = bus.call(request, QDBus::BlockWithGui);
if ((response.type() != QDBusMessage::ReplyMessage) || (response.arguments().isEmpty())) { if ((response.type() != QDBusMessage::ReplyMessage)
|| (response.arguments().isEmpty())) {
qCWarning(LOG_ESM) << "Error message" << response.errorMessage(); qCWarning(LOG_ESM) << "Error message" << response.errorMessage();
} else { } else {
// another portion of dirty magic // another portion of dirty magic
QVariantHash map = qdbus_cast<QVariantHash>(response.arguments().first() QVariantHash map
.value<QDBusVariant>().variant() = qdbus_cast<QVariantHash>(response.arguments()
.first()
.value<QDBusVariant>()
.variant()
.value<QDBusArgument>()); .value<QDBusArgument>());
info[QString("player/album")] = map.value(QString("xesam:album"), QString("unknown")); info[QString("player/album")]
= map.value(QString("xesam:album"), QString("unknown"));
// artist is array // artist is array
info[QString("player/artist")] = map.value(QString("xesam:artist"), QString("unknown")).toString(); info[QString("player/artist")]
info[QString("player/duration")] = map.value(QString("mpris:length"), 0).toInt() / (1000 * 1000); = map.value(QString("xesam:artist"), QString("unknown")).toString();
info[QString("player/title")] = map.value(QString("xesam:title"), QString("unknown")); info[QString("player/duration")]
= map.value(QString("mpris:length"), 0).toInt() / (1000 * 1000);
info[QString("player/title")]
= map.value(QString("xesam:title"), QString("unknown"));
} }
// position // position
args[1] = QString("Position"); args[1] = QString("Position");
request.setArguments(args); request.setArguments(args);
response = bus.call(request, QDBus::BlockWithGui); response = bus.call(request, QDBus::BlockWithGui);
if ((response.type() != QDBusMessage::ReplyMessage) || (response.arguments().isEmpty())) { if ((response.type() != QDBusMessage::ReplyMessage)
|| (response.arguments().isEmpty())) {
qCWarning(LOG_ESM) << "Error message" << response.errorMessage(); qCWarning(LOG_ESM) << "Error message" << response.errorMessage();
} else { } else {
// this cast is simpler than the previous one ;) // this cast is simpler than the previous one ;)
info[QString("player/progress")] = response.arguments().first().value<QDBusVariant>() info[QString("player/progress")] = response.arguments()
.variant().toLongLong() / (1000 * 1000); .first()
.value<QDBusVariant>()
.variant()
.toLongLong()
/ (1000 * 1000);
} }
return info; return info;
@ -322,11 +362,12 @@ QString PlayerSource::buildString(const QString current, const QString value,
qCDebug(LOG_ESM) << "Strip after" << s; qCDebug(LOG_ESM) << "Strip after" << s;
int index = value.indexOf(current); int index = value.indexOf(current);
if ((current.isEmpty()) || ((index + s + 1) > value.count())) if ((current.isEmpty()) || ((index + s + 1) > value.count())) {
return QString("%1").arg(value.left(s), s, QLatin1Char(' ')); return QString("%1").arg(value.left(s), s, QLatin1Char(' '));
else } else {
return QString("%1").arg(value.mid(index + 1, s), s, QLatin1Char(' ')); return QString("%1").arg(value.mid(index + 1, s), s, QLatin1Char(' '));
} }
}
QString PlayerSource::stripString(const QString value, const int s) const QString PlayerSource::stripString(const QString value, const int s) const
@ -335,6 +376,6 @@ QString PlayerSource::stripString(const QString value, const int s) const
qCDebug(LOG_ESM) << "New value" << value; qCDebug(LOG_ESM) << "New value" << value;
qCDebug(LOG_ESM) << "Strip after" << s; qCDebug(LOG_ESM) << "Strip after" << s;
return value.count() > s ? QString("%1\u2026").arg(value.left(s - 1)) : return value.count() > s ? QString("%1\u2026").arg(value.left(s - 1))
value.leftJustified(s, QLatin1Char(' ')); : value.leftJustified(s, QLatin1Char(' '));
} }

View File

@ -39,14 +39,17 @@ private:
QVariantHash getPlayerMpdInfo(const QString mpdAddress) const; QVariantHash getPlayerMpdInfo(const QString mpdAddress) const;
QVariantHash getPlayerMprisInfo(const QString mpris) const; QVariantHash getPlayerMprisInfo(const QString mpris) const;
// additional method to build dynamic tags // additional method to build dynamic tags
QString buildString(const QString current, const QString value, const int s) const; QString buildString(const QString current, const QString value,
const int s) const;
QString stripString(const QString value, const int s) const; QString stripString(const QString value, const int s) const;
// configuration and values // configuration and values
QString m_mpdAddress; QString m_mpdAddress;
QString m_mpris; QString m_mpris;
QString m_player; QString m_player;
int m_symbols; int m_symbols;
QStringList m_metadata = QStringList() << QString("album") << QString("artist") << QString("title"); QStringList m_metadata = QStringList() << QString("album")
<< QString("artist")
<< QString("title");
QVariantHash values; QVariantHash values;
}; };

View File

@ -42,7 +42,8 @@ QVariant ProcessesSource::data(QString source)
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
qCDebug(LOG_ESM) << "Source" << source; qCDebug(LOG_ESM) << "Source" << source;
if (source == QString("ps/running/count")) run(); if (source == QString("ps/running/count"))
run();
return values[source]; return values[source];
} }
@ -81,19 +82,23 @@ void ProcessesSource::run()
{ {
qCDebug(LOG_ESM); qCDebug(LOG_ESM);
QStringList allDirectories = QDir(QString("/proc")).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QStringList allDirectories
QDir::Name); = QDir(QString("/proc"))
.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
QStringList directories = allDirectories.filter(QRegExp(QString("(\\d+)"))); QStringList directories = allDirectories.filter(QRegExp(QString("(\\d+)")));
QStringList running; QStringList running;
foreach (QString dir, directories) { foreach (QString dir, directories) {
QFile statusFile(QString("/proc/%1/status").arg(dir)); QFile statusFile(QString("/proc/%1/status").arg(dir));
if (!statusFile.open(QIODevice::ReadOnly)) continue; if (!statusFile.open(QIODevice::ReadOnly))
continue;
QFile cmdFile(QString("/proc/%1/cmdline").arg(dir)); QFile cmdFile(QString("/proc/%1/cmdline").arg(dir));
if (!cmdFile.open(QIODevice::ReadOnly)) continue; if (!cmdFile.open(QIODevice::ReadOnly))
continue;
QString output = statusFile.readAll(); QString output = statusFile.readAll();
if (output.contains(QString("running"))) running.append(cmdFile.readAll()); if (output.contains(QString("running")))
running.append(cmdFile.readAll());
} }
values[QString("ps/running/count")] = running.count(); values[QString("ps/running/count")] = running.count();

View File

@ -48,7 +48,8 @@ QVariant QuotesSource::data(QString source)
if (source.startsWith(QString("quotes/percpricechg"))) { if (source.startsWith(QString("quotes/percpricechg"))) {
QVariantHash data = extQuotes->itemByTagNumber(index(source))->run(); QVariantHash data = extQuotes->itemByTagNumber(index(source))->run();
foreach(QString key, data.keys()) values[key] = data[key]; foreach (QString key, data.keys())
values[key] = data[key];
} }
QString key = QString(source).remove(QString("quotes/")); QString key = QString(source).remove(QString("quotes/"));
return values[key]; return values[key];
@ -65,55 +66,73 @@ QVariantMap QuotesSource::initialData(QString source) const
if (source.startsWith(QString("quotes/askchg"))) { if (source.startsWith(QString("quotes/askchg"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Absolute ask changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Absolute ask changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/ask"))) { } else if (source.startsWith(QString("quotes/ask"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Ask for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Ask for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percaskchg"))) { } else if (source.startsWith(QString("quotes/percaskchg"))) {
data[QString("min")] = -100.0; data[QString("min")] = -100.0;
data[QString("max")] = 100.0; data[QString("max")] = 100.0;
data[QString("name")] = QString("Ask changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Ask changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/bidchg"))) { } else if (source.startsWith(QString("quotes/bidchg"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Absolute bid changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Absolute bid changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/bid"))) { } else if (source.startsWith(QString("quotes/bid"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Bid for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Bid for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percbidchg"))) { } else if (source.startsWith(QString("quotes/percbidchg"))) {
data[QString("min")] = -100.0; data[QString("min")] = -100.0;
data[QString("max")] = 100.0; data[QString("max")] = 100.0;
data[QString("name")] = QString("Bid changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Bid changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/pricechg"))) { } else if (source.startsWith(QString("quotes/pricechg"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Absolute prie changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Absolute prie changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/price"))) { } else if (source.startsWith(QString("quotes/price"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Price for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Price for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("quotes/percpricechg"))) { } else if (source.startsWith(QString("quotes/percpricechg"))) {
data[QString("min")] = -100.0; data[QString("min")] = -100.0;
data[QString("max")] = 100.0; data[QString("max")] = 100.0;
data[QString("name")] = QString("Price changes for '%1'").arg(extQuotes->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Price changes for '%1'")
.arg(extQuotes->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("double"); data[QString("type")] = QString("double");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} }
@ -138,13 +157,17 @@ QStringList QuotesSource::getSources()
foreach (ExtQuotes *item, extQuotes->activeItems()) { foreach (ExtQuotes *item, extQuotes->activeItems()) {
sources.append(QString("quotes/%1").arg(item->tag(QString("ask")))); sources.append(QString("quotes/%1").arg(item->tag(QString("ask"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("askchg")))); sources.append(QString("quotes/%1").arg(item->tag(QString("askchg"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("percaskchg")))); sources.append(
QString("quotes/%1").arg(item->tag(QString("percaskchg"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("bid")))); sources.append(QString("quotes/%1").arg(item->tag(QString("bid"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("bidchg")))); sources.append(QString("quotes/%1").arg(item->tag(QString("bidchg"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("percbidchg")))); sources.append(
QString("quotes/%1").arg(item->tag(QString("percbidchg"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("price")))); sources.append(QString("quotes/%1").arg(item->tag(QString("price"))));
sources.append(QString("quotes/%1").arg(item->tag(QString("pricechg")))); sources.append(
sources.append(QString("quotes/%1").arg(item->tag(QString("percpricechg")))); QString("quotes/%1").arg(item->tag(QString("pricechg"))));
sources.append(
QString("quotes/%1").arg(item->tag(QString("percpricechg"))));
} }
return sources; return sources;

View File

@ -59,7 +59,9 @@ QVariantMap UpgradeSource::initialData(QString source) const
QVariantMap data; QVariantMap data;
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("Package manager '%1' metadata").arg(extUpgrade->itemByTagNumber(index(source))->uniq()); data[QString("name")]
= QString("Package manager '%1' metadata")
.arg(extUpgrade->itemByTagNumber(index(source))->uniq());
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
@ -81,7 +83,8 @@ QStringList UpgradeSource::getSources()
QStringList sources; QStringList sources;
foreach (ExtUpgrade *item, extUpgrade->activeItems()) foreach (ExtUpgrade *item, extUpgrade->activeItems())
sources.append(QString("upgrade/%1").arg(item->tag(QString("pkgcount")))); sources.append(
QString("upgrade/%1").arg(item->tag(QString("pkgcount"))));
return sources; return sources;
} }

View File

@ -48,7 +48,8 @@ QVariant WeatherSource::data(QString source)
if (source.startsWith(QString("weather/weatherId"))) { if (source.startsWith(QString("weather/weatherId"))) {
QVariantHash data = extWeather->itemByTagNumber(index(source))->run(); QVariantHash data = extWeather->itemByTagNumber(index(source))->run();
foreach(QString key, data.keys()) values[key] = data[key]; foreach (QString key, data.keys())
values[key] = data[key];
} }
QString key = QString(source).remove(QString("weather/")); QString key = QString(source).remove(QString("weather/"));
return values[key]; return values[key];
@ -65,31 +66,41 @@ QVariantMap WeatherSource::initialData(QString source) const
if (source.startsWith(QString("weather/weatherId"))) { if (source.startsWith(QString("weather/weatherId"))) {
data[QString("min")] = 0; data[QString("min")] = 0;
data[QString("max")] = 1000; data[QString("max")] = 1000;
data[QString("name")] = QString("Numeric weather ID for '%1'").arg(extWeather->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Numeric weather ID for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer"); data[QString("type")] = QString("integer");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("weather/weather"))) { } else if (source.startsWith(QString("weather/weather"))) {
data[QString("min")] = QString(""); data[QString("min")] = QString("");
data[QString("max")] = QString(""); data[QString("max")] = QString("");
data[QString("name")] = QString("ID string map for '%1'").arg(extWeather->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("ID string map for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("QString"); data[QString("type")] = QString("QString");
data[QString("units")] = QString(""); data[QString("units")] = QString("");
} else if (source.startsWith(QString("weather/humidity"))) { } else if (source.startsWith(QString("weather/humidity"))) {
data[QString("min")] = 0; data[QString("min")] = 0;
data[QString("max")] = 100; data[QString("max")] = 100;
data[QString("name")] = QString("Humidity for '%1'").arg(extWeather->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Humidity for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer"); data[QString("type")] = QString("integer");
data[QString("units")] = QString("%"); data[QString("units")] = QString("%");
} else if (source.startsWith(QString("weather/pressure"))) { } else if (source.startsWith(QString("weather/pressure"))) {
data[QString("min")] = 0; data[QString("min")] = 0;
data[QString("max")] = 0; data[QString("max")] = 0;
data[QString("name")] = QString("Atmospheric pressure for '%1'").arg(extWeather->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Atmospheric pressure for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("integer"); data[QString("type")] = QString("integer");
data[QString("units")] = QString("hPa"); data[QString("units")] = QString("hPa");
} else if (source.startsWith(QString("weather/temperature"))) { } else if (source.startsWith(QString("weather/temperature"))) {
data[QString("min")] = 0.0; data[QString("min")] = 0.0;
data[QString("max")] = 0.0; data[QString("max")] = 0.0;
data[QString("name")] = QString("Temperature for '%1'").arg(extWeather->itemByTagNumber(ind)->uniq()); data[QString("name")]
= QString("Temperature for '%1'")
.arg(extWeather->itemByTagNumber(ind)->uniq());
data[QString("type")] = QString("float"); data[QString("type")] = QString("float");
data[QString("units")] = QString("°C"); data[QString("units")] = QString("°C");
} }
@ -112,11 +123,16 @@ QStringList WeatherSource::getSources()
QStringList sources; QStringList sources;
foreach (ExtWeather *item, extWeather->activeItems()) { foreach (ExtWeather *item, extWeather->activeItems()) {
sources.append(QString("weather/%1").arg(item->tag(QString("weatherId")))); sources.append(
sources.append(QString("weather/%1").arg(item->tag(QString("weather")))); QString("weather/%1").arg(item->tag(QString("weatherId"))));
sources.append(QString("weather/%1").arg(item->tag(QString("humidity")))); sources.append(
sources.append(QString("weather/%1").arg(item->tag(QString("pressure")))); QString("weather/%1").arg(item->tag(QString("weather"))));
sources.append(QString("weather/%1").arg(item->tag(QString("temperature")))); sources.append(
QString("weather/%1").arg(item->tag(QString("humidity"))));
sources.append(
QString("weather/%1").arg(item->tag(QString("pressure"))));
sources.append(
QString("weather/%1").arg(item->tag(QString("temperature"))));
} }
return sources; return sources;

View File

@ -1,9 +0,0 @@
#!/bin/bash
# This code is used to check source files with cppcheck
cppcheck --enable=all \
--std=c++11 \
--verbose \
--quiet \
../sources 2>&1 | grep -v '3rdparty'

View File

@ -1,10 +0,0 @@
#!/bin/bash
# This script will check the source code by using clang-format with required arguments.
# The template comes from https://gist.github.com/Uflex/7086827
# More details may be found here http://clang.llvm.org/docs/ClangFormatStyleOptions.html
clang-format -i \
-style=file \
$(find ../sources -not -path '*3rdparty*' \
-and \( -name '*.cpp' -or -name '*.h' \))