mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-11-04 06:43:41 +00:00 
			
		
		
		
	
							
								
								
									
										37
									
								
								patches/total-memory-fix.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								patches/total-memory-fix.patch
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,37 @@
 | 
				
			|||||||
 | 
					diff --git a/sources/awesome-widget/plugin/awkeysaggregator.cpp b/sources/awesome-widget/plugin/awkeysaggregator.cpp
 | 
				
			||||||
 | 
					index 7a1887b..9f39e2f 100644
 | 
				
			||||||
 | 
					--- a/sources/awesome-widget/plugin/awkeysaggregator.cpp
 | 
				
			||||||
 | 
					+++ b/sources/awesome-widget/plugin/awkeysaggregator.cpp
 | 
				
			||||||
 | 
					@@ -34,8 +34,8 @@ AWKeysAggregator::AWKeysAggregator(QObject *parent)
 | 
				
			||||||
 | 
					     // default formaters
 | 
				
			||||||
 | 
					     // memory
 | 
				
			||||||
 | 
					     m_formater[QString("mem")] = Float;
 | 
				
			||||||
 | 
					-    m_formater[QString("memtotmb")] = IntegerFive;
 | 
				
			||||||
 | 
					-    m_formater[QString("memtotgb")] = Float;
 | 
				
			||||||
 | 
					+    m_formater[QString("memtotmb")] = MemMBFormat;
 | 
				
			||||||
 | 
					+    m_formater[QString("memtotgb")] = MemGBFormat;
 | 
				
			||||||
 | 
					     // network
 | 
				
			||||||
 | 
					     m_formater[QString("down")] = NetSmartFormat;
 | 
				
			||||||
 | 
					     m_formater[QString("downkb")] = Integer;
 | 
				
			||||||
 | 
					@@ -45,8 +45,8 @@ AWKeysAggregator::AWKeysAggregator(QObject *parent)
 | 
				
			||||||
 | 
					     m_formater[QString("upunits")] = NetSmartUnits;
 | 
				
			||||||
 | 
					     // swap
 | 
				
			||||||
 | 
					     m_formater[QString("swap")] = Float;
 | 
				
			||||||
 | 
					-    m_formater[QString("swaptotmb")] = IntegerFive;
 | 
				
			||||||
 | 
					-    m_formater[QString("swaptotgb")] = Float;
 | 
				
			||||||
 | 
					+    m_formater[QString("swaptotmb")] = MemMBFormat;
 | 
				
			||||||
 | 
					+    m_formater[QString("swaptotgb")] = MemGBFormat;
 | 
				
			||||||
 | 
					 }
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					@@ -338,8 +338,8 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			||||||
 | 
					             m_map[source] = key;
 | 
				
			||||||
 | 
					             m_formater[key] = Float;
 | 
				
			||||||
 | 
					             // additional keys
 | 
				
			||||||
 | 
					-            m_formater[QString("hddtotmb%1").arg(index)] = IntegerFive;
 | 
				
			||||||
 | 
					-            m_formater[QString("hddtotgb%1").arg(index)] = Float;
 | 
				
			||||||
 | 
					+            m_formater[QString("hddtotmb%1").arg(index)] = MemMBFormat;
 | 
				
			||||||
 | 
					+            m_formater[QString("hddtotgb%1").arg(index)] = MemGBFormat;
 | 
				
			||||||
 | 
					         }
 | 
				
			||||||
 | 
					     } else if (source.contains(mountFreeRegExp)) {
 | 
				
			||||||
 | 
					         // free space
 | 
				
			||||||
							
								
								
									
										2
									
								
								sources/3rdparty/fontdialog
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								sources/3rdparty/fontdialog
									
									
									
									
										vendored
									
									
								
							 Submodule sources/3rdparty/fontdialog updated: ef47b1146e...e7bcf8ee85
									
								
							@ -42,14 +42,14 @@ include(changelog.cmake)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# flags
 | 
					# flags
 | 
				
			||||||
if (CMAKE_COMPILER_IS_GNUCXX)
 | 
					if (CMAKE_COMPILER_IS_GNUCXX)
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++14")
 | 
					    set(CMAKE_CXX_FLAGS "-Wall -Wno-cpp -std=c++11")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
 | 
					    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
 | 
					    set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
 | 
					    set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
 | 
				
			||||||
    # avoid newer gcc warnings
 | 
					    # avoid newer gcc warnings
 | 
				
			||||||
    add_definitions(-D_DEFAULT_SOURCE)
 | 
					    add_definitions(-D_DEFAULT_SOURCE)
 | 
				
			||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 | 
					elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS "-Wall -std=c++14 -stdlib=libc++")
 | 
					    set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -stdlib=libc++")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
 | 
					    set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
 | 
					    set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
 | 
				
			||||||
    set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
 | 
					    set(CMAKE_CXX_FLAGS_OPTIMIZATION "-Ofast -DNDEBUG")
 | 
				
			||||||
 | 
				
			|||||||
@ -84,7 +84,7 @@ Item {
 | 
				
			|||||||
    // ui
 | 
					    // ui
 | 
				
			||||||
    Text {
 | 
					    Text {
 | 
				
			||||||
        id: text
 | 
					        id: text
 | 
				
			||||||
        anchors.fill: parent
 | 
					        anchors.fill: Layout
 | 
				
			||||||
        renderType: Text.NativeRendering
 | 
					        renderType: Text.NativeRendering
 | 
				
			||||||
        textFormat: Text.RichText
 | 
					        textFormat: Text.RichText
 | 
				
			||||||
        wrapMode: plasmoid.configuration.wrapText ? Text.WordWrap : Text.NoWrap
 | 
					        wrapMode: plasmoid.configuration.wrapText ? Text.WordWrap : Text.NoWrap
 | 
				
			||||||
 | 
				
			|||||||
@ -61,7 +61,22 @@ Item {
 | 
				
			|||||||
            height: implicitHeight
 | 
					            height: implicitHeight
 | 
				
			||||||
            width: parent.width
 | 
					            width: parent.width
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width * 3 / 12
 | 
					                width: parent.width * 3 / 15
 | 
				
			||||||
 | 
					                text: i18n("Bgcolor")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                onClicked: backgroundDialog.visible = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                QtDialogs.ColorDialog {
 | 
				
			||||||
 | 
					                    id: backgroundDialog
 | 
				
			||||||
 | 
					                    title: i18n("Select a color")
 | 
				
			||||||
 | 
					                    onAccepted: {
 | 
				
			||||||
 | 
					                        var text = textPattern.text
 | 
				
			||||||
 | 
					                        textPattern.text = "<body bgcolor=\"" + backgroundDialog.color + "\">" + text + "</body>"
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            QtControls.Button {
 | 
				
			||||||
 | 
					                width: parent.width * 3 / 15
 | 
				
			||||||
                text: i18n("Font")
 | 
					                text: i18n("Font")
 | 
				
			||||||
                iconName: "font"
 | 
					                iconName: "font"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -73,123 +88,119 @@ Item {
 | 
				
			|||||||
                        "size": plasmoid.configuration.fontSize
 | 
					                        "size": plasmoid.configuration.fontSize
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    var font = awActions.getFont(defaultFont)
 | 
					                    var font = awActions.getFont(defaultFont)
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					                    if (font.applied != 1) {
 | 
				
			||||||
 | 
					                        if (debug) console.debug("No font selected")
 | 
				
			||||||
 | 
					                        return
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<span style=\"color:" + font.color +
 | 
					                    textPattern.insert(textPattern.cursorPosition,
 | 
				
			||||||
 | 
					                        "<span style=\"color:" + font.color +
 | 
				
			||||||
                        "; font-family:'" + font.family +
 | 
					                        "; font-family:'" + font.family +
 | 
				
			||||||
                        "'; font-size:" + font.size + "pt;\">" +
 | 
					                        "'; font-size:" + font.size + "pt;\">" +
 | 
				
			||||||
                        selected + "</span>")
 | 
					                        selected + "</span>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-indent-more"
 | 
					                iconName: "format-indent-more"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Indent button")
 | 
					                    if (debug) console.debug("Indent button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, selected + "<br>\n")
 | 
					                    textPattern.insert(textPattern.cursorPosition, selected + "<br>\n")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-text-bold"
 | 
					                iconName: "format-text-bold"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Bold button")
 | 
					                    if (debug) console.debug("Bold button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<b>" + selected + "</b>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<b>" + selected + "</b>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-text-italic"
 | 
					                iconName: "format-text-italic"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Italic button")
 | 
					                    if (debug) console.debug("Italic button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<i>" + selected + "</i>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<i>" + selected + "</i>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-text-underline"
 | 
					                iconName: "format-text-underline"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Underline button")
 | 
					                    if (debug) console.debug("Underline button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<u>" + selected + "</u>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<u>" + selected + "</u>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-text-strikethrough"
 | 
					                iconName: "format-text-strikethrough"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Strike button")
 | 
					                    if (debug) console.debug("Strike button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<s>" + selected + "</s>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<s>" + selected + "</s>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-justify-left"
 | 
					                iconName: "format-justify-left"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Left button")
 | 
					                    if (debug) console.debug("Left button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<p align=\"left\">" + selected + "</p>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<p align=\"left\">" + selected + "</p>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-justify-center"
 | 
					                iconName: "format-justify-center"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Center button")
 | 
					                    if (debug) console.debug("Center button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<p align=\"center\">" + selected + "</p>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<p align=\"center\">" + selected + "</p>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-justify-right"
 | 
					                iconName: "format-justify-right"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Right button")
 | 
					                    if (debug) console.debug("Right button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<p align=\"right\">" + selected + "</p>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<p align=\"right\">" + selected + "</p>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            QtControls.Button {
 | 
					            QtControls.Button {
 | 
				
			||||||
                width: parent.width / 12
 | 
					                width: parent.width / 15
 | 
				
			||||||
                iconName: "format-justify-fill"
 | 
					                iconName: "format-justify-fill"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                onClicked: {
 | 
					                onClicked: {
 | 
				
			||||||
                    if (debug) console.debug("Justify button")
 | 
					                    if (debug) console.debug("Justify button")
 | 
				
			||||||
                    var pos = textPattern.cursorPosition
 | 
					 | 
				
			||||||
                    var selected = textPattern.selectedText
 | 
					                    var selected = textPattern.selectedText
 | 
				
			||||||
                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
					                    textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd)
 | 
				
			||||||
                    textPattern.insert(pos, "<p align=\"justify\">" + selected + "</p>")
 | 
					                    textPattern.insert(textPattern.cursorPosition, "<p align=\"justify\">" + selected + "</p>")
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -154,11 +154,14 @@ QVariantMap AWActions::getFont(const QVariantMap defaultFont) const
 | 
				
			|||||||
    qCDebug(LOG_AW) << "Default font is" << defaultFont;
 | 
					    qCDebug(LOG_AW) << "Default font is" << defaultFont;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QVariantMap fontMap;
 | 
					    QVariantMap fontMap;
 | 
				
			||||||
 | 
					    int ret = 0;
 | 
				
			||||||
    CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
 | 
					    CFont defaultCFont = CFont(defaultFont[QString("family")].toString(),
 | 
				
			||||||
                               defaultFont[QString("size")].toInt(), 400, false,
 | 
					                               defaultFont[QString("size")].toInt(), 400, false,
 | 
				
			||||||
                               defaultFont[QString("color")].toString());
 | 
					                               defaultFont[QString("color")].toString());
 | 
				
			||||||
    CFont font
 | 
					    CFont font = CFontDialog::getFont(i18n("Select font"), defaultCFont, false,
 | 
				
			||||||
        = CFontDialog::getFont(i18n("Select font"), defaultCFont, false, false);
 | 
					                                      false, &ret);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    fontMap[QString("applied")] = ret;
 | 
				
			||||||
    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();
 | 
				
			||||||
 | 
				
			|||||||
@ -312,14 +312,12 @@ QString AWKeys::parsePattern(QString pattern) const
 | 
				
			|||||||
    // bars
 | 
					    // bars
 | 
				
			||||||
    for (auto bar : m_foundBars) {
 | 
					    for (auto bar : m_foundBars) {
 | 
				
			||||||
        GraphicalItem *item = keyOperator->giByKey(bar);
 | 
					        GraphicalItem *item = keyOperator->giByKey(bar);
 | 
				
			||||||
        if (item->isCustom())
 | 
					        QString image
 | 
				
			||||||
            pattern.replace(
 | 
					            = item->isCustom()
 | 
				
			||||||
                QString("$%1").arg(bar),
 | 
					                  ? item->image(AWPatternFunctions::expandLambdas(
 | 
				
			||||||
                item->image(AWPatternFunctions::expandLambdas(
 | 
					                        item->bar(), aggregator, values, item->usedKeys()))
 | 
				
			||||||
                    item->bar(), aggregator, values, item->usedKeys())));
 | 
					                  : item->image(values[item->bar()]);
 | 
				
			||||||
        else
 | 
					        pattern.replace(QString("$%1").arg(bar), image);
 | 
				
			||||||
            pattern.replace(QString("$%1").arg(bar),
 | 
					 | 
				
			||||||
                            item->image(values[item->bar()]));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // prepare strings
 | 
					    // prepare strings
 | 
				
			||||||
 | 
				
			|||||||
@ -33,20 +33,20 @@ AWKeysAggregator::AWKeysAggregator(QObject *parent)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // default formaters
 | 
					    // default formaters
 | 
				
			||||||
    // memory
 | 
					    // memory
 | 
				
			||||||
    m_formater[QString("mem")] = Float;
 | 
					    m_formater[QString("mem")] = FormaterType::Float;
 | 
				
			||||||
    m_formater[QString("memtotmb")] = IntegerFive;
 | 
					    m_formater[QString("memtotmb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
    m_formater[QString("memtotgb")] = Float;
 | 
					    m_formater[QString("memtotgb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    // network
 | 
					    // network
 | 
				
			||||||
    m_formater[QString("down")] = NetSmartFormat;
 | 
					    m_formater[QString("down")] = FormaterType::NetSmartFormat;
 | 
				
			||||||
    m_formater[QString("downkb")] = Integer;
 | 
					    m_formater[QString("downkb")] = FormaterType::Integer;
 | 
				
			||||||
    m_formater[QString("downunits")] = NetSmartUnits;
 | 
					    m_formater[QString("downunits")] = FormaterType::NetSmartUnits;
 | 
				
			||||||
    m_formater[QString("up")] = NetSmartFormat;
 | 
					    m_formater[QString("up")] = FormaterType::NetSmartFormat;
 | 
				
			||||||
    m_formater[QString("upkb")] = Integer;
 | 
					    m_formater[QString("upkb")] = FormaterType::Integer;
 | 
				
			||||||
    m_formater[QString("upunits")] = NetSmartUnits;
 | 
					    m_formater[QString("upunits")] = FormaterType::NetSmartUnits;
 | 
				
			||||||
    // swap
 | 
					    // swap
 | 
				
			||||||
    m_formater[QString("swap")] = Float;
 | 
					    m_formater[QString("swap")] = FormaterType::Float;
 | 
				
			||||||
    m_formater[QString("swaptotmb")] = IntegerFive;
 | 
					    m_formater[QString("swaptotmb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
    m_formater[QString("swaptotgb")] = Float;
 | 
					    m_formater[QString("swaptotgb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -65,35 +65,35 @@ QString AWKeysAggregator::formater(const QVariant &data,
 | 
				
			|||||||
    QLocale loc = m_translate ? QLocale::system() : QLocale::c();
 | 
					    QLocale loc = m_translate ? QLocale::system() : QLocale::c();
 | 
				
			||||||
    // case block
 | 
					    // case block
 | 
				
			||||||
    switch (m_formater[key]) {
 | 
					    switch (m_formater[key]) {
 | 
				
			||||||
    case Float:
 | 
					    case FormaterType::Float:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat(), 5, 'f', 1);
 | 
					        output = QString("%1").arg(data.toFloat(), 5, 'f', 1);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case FloatTwoSymbols:
 | 
					    case FormaterType::FloatTwoSymbols:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat(), 5, 'f', 2);
 | 
					        output = QString("%1").arg(data.toFloat(), 5, 'f', 2);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Integer:
 | 
					    case FormaterType::Integer:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat(), 4, 'f', 0);
 | 
					        output = QString("%1").arg(data.toFloat(), 4, 'f', 0);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case IntegerFive:
 | 
					    case FormaterType::IntegerFive:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat(), 5, 'f', 0);
 | 
					        output = QString("%1").arg(data.toFloat(), 5, 'f', 0);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case IntegerThree:
 | 
					    case FormaterType::IntegerThree:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat(), 3, 'f', 0);
 | 
					        output = QString("%1").arg(data.toFloat(), 3, 'f', 0);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case List:
 | 
					    case FormaterType::List:
 | 
				
			||||||
        output = data.toStringList().join(QChar(','));
 | 
					        output = data.toStringList().join(QChar(','));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case ACFormat:
 | 
					    case FormaterType::ACFormat:
 | 
				
			||||||
        output = data.toBool() ? m_acOnline : m_acOffline;
 | 
					        output = data.toBool() ? m_acOnline : m_acOffline;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case MemGBFormat:
 | 
					    case FormaterType::MemGBFormat:
 | 
				
			||||||
        output
 | 
					        output
 | 
				
			||||||
            = QString("%1").arg(data.toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
 | 
					            = QString("%1").arg(data.toFloat() / (1024.0 * 1024.0), 5, 'f', 1);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case MemMBFormat:
 | 
					    case FormaterType::MemMBFormat:
 | 
				
			||||||
        output = QString("%1").arg(data.toFloat() / 1024.0, 5, 'f', 0);
 | 
					        output = QString("%1").arg(data.toFloat() / 1024.0, 5, 'f', 0);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case NetSmartFormat:
 | 
					    case FormaterType::NetSmartFormat:
 | 
				
			||||||
        output = [](const float value) {
 | 
					        output = [](const float value) {
 | 
				
			||||||
            if (value > 1024.0)
 | 
					            if (value > 1024.0)
 | 
				
			||||||
                return QString("%1").arg(value / 1024.0, 4, 'f', 1);
 | 
					                return QString("%1").arg(value / 1024.0, 4, 'f', 1);
 | 
				
			||||||
@ -101,41 +101,41 @@ QString AWKeysAggregator::formater(const QVariant &data,
 | 
				
			|||||||
                return QString("%1").arg(value, 4, 'f', 0);
 | 
					                return QString("%1").arg(value, 4, 'f', 0);
 | 
				
			||||||
        }(data.toFloat());
 | 
					        }(data.toFloat());
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case NetSmartUnits:
 | 
					    case FormaterType::NetSmartUnits:
 | 
				
			||||||
        if (data.toFloat() > 1024.0)
 | 
					        if (data.toFloat() > 1024.0)
 | 
				
			||||||
            output = m_translate ? i18n("MB/s") : QString("MB/s");
 | 
					            output = m_translate ? i18n("MB/s") : QString("MB/s");
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
            output = m_translate ? i18n("KB/s") : QString("KB/s");
 | 
					            output = m_translate ? i18n("KB/s") : QString("KB/s");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Quotes:
 | 
					    case FormaterType::Quotes:
 | 
				
			||||||
        // first cast
 | 
					        // first cast
 | 
				
			||||||
        output = QString("%1").arg(data.toDouble(), 0, 'f');
 | 
					        output = QString("%1").arg(data.toDouble(), 0, 'f');
 | 
				
			||||||
        output = output.rightJustified(8, QLatin1Char(' '), true);
 | 
					        output = output.rightJustified(8, QLatin1Char(' '), true);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Temperature:
 | 
					    case FormaterType::Temperature:
 | 
				
			||||||
        output = QString("%1").arg(temperature(data.toFloat()), 5, 'f', 1);
 | 
					        output = QString("%1").arg(temperature(data.toFloat()), 5, 'f', 1);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Time:
 | 
					    case FormaterType::Time:
 | 
				
			||||||
        output = data.toDateTime().toString();
 | 
					        output = data.toDateTime().toString();
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case TimeCustom:
 | 
					    case FormaterType::TimeCustom:
 | 
				
			||||||
        output = m_customTime;
 | 
					        output = m_customTime;
 | 
				
			||||||
        [&output, loc, this](const QDateTime dt) {
 | 
					        [&output, loc, this](const QDateTime dt) {
 | 
				
			||||||
            for (auto key : timeKeys)
 | 
					            for (auto key : timeKeys)
 | 
				
			||||||
                output.replace(QString("$%1").arg(key), loc.toString(dt, key));
 | 
					                output.replace(QString("$%1").arg(key), loc.toString(dt, key));
 | 
				
			||||||
        }(data.toDateTime());
 | 
					        }(data.toDateTime());
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case TimeISO:
 | 
					    case FormaterType::TimeISO:
 | 
				
			||||||
        output = data.toDateTime().toString(Qt::ISODate);
 | 
					        output = data.toDateTime().toString(Qt::ISODate);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case TimeLong:
 | 
					    case FormaterType::TimeLong:
 | 
				
			||||||
        output = loc.toString(data.toDateTime(), QLocale::LongFormat);
 | 
					        output = loc.toString(data.toDateTime(), QLocale::LongFormat);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case TimeShort:
 | 
					    case FormaterType::TimeShort:
 | 
				
			||||||
        output = loc.toString(data.toDateTime(), QLocale::ShortFormat);
 | 
					        output = loc.toString(data.toDateTime(), QLocale::ShortFormat);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Uptime:
 | 
					    case FormaterType::Uptime:
 | 
				
			||||||
    case UptimeCustom:
 | 
					    case FormaterType::UptimeCustom:
 | 
				
			||||||
        output =
 | 
					        output =
 | 
				
			||||||
            [](QString source, const int uptime) {
 | 
					            [](QString source, const int uptime) {
 | 
				
			||||||
                int seconds = uptime - uptime % 60;
 | 
					                int seconds = uptime - uptime % 60;
 | 
				
			||||||
@ -152,16 +152,13 @@ QString AWKeysAggregator::formater(const QVariant &data,
 | 
				
			|||||||
                               QString("%1").arg(minutes, 2, 10, QChar('0')));
 | 
					                               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_formater[key] == FormaterType::Uptime ? QString("$ddd$hhh$mmm")
 | 
				
			||||||
                                                      : m_customUptime,
 | 
					                                                      : m_customUptime,
 | 
				
			||||||
              static_cast<int>(data.toFloat()));
 | 
					              static_cast<int>(data.toFloat()));
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case NoFormat:
 | 
					    case FormaterType::NoFormat:
 | 
				
			||||||
        output = data.toString();
 | 
					        output = data.toString();
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        output = QString();
 | 
					 | 
				
			||||||
        break;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return output;
 | 
					    return output;
 | 
				
			||||||
@ -254,52 +251,52 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
    if (source == QString("battery/ac")) {
 | 
					    if (source == QString("battery/ac")) {
 | 
				
			||||||
        // AC
 | 
					        // AC
 | 
				
			||||||
        m_map[source] = QString("ac");
 | 
					        m_map[source] = QString("ac");
 | 
				
			||||||
        m_formater[QString("ac")] = ACFormat;
 | 
					        m_formater[QString("ac")] = FormaterType::ACFormat;
 | 
				
			||||||
    } else if (source.startsWith(QString("battery/"))) {
 | 
					    } else if (source.startsWith(QString("battery/"))) {
 | 
				
			||||||
        // battery stats
 | 
					        // battery stats
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("battery/"));
 | 
					        key.remove(QString("battery/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = IntegerThree;
 | 
					        m_formater[key] = FormaterType::IntegerThree;
 | 
				
			||||||
    } else if (source == QString("cpu/system/TotalLoad")) {
 | 
					    } else if (source == QString("cpu/system/TotalLoad")) {
 | 
				
			||||||
        // cpu
 | 
					        // cpu
 | 
				
			||||||
        m_map[source] = QString("cpu");
 | 
					        m_map[source] = QString("cpu");
 | 
				
			||||||
        m_formater[QString("cpu")] = Float;
 | 
					        m_formater[QString("cpu")] = FormaterType::Float;
 | 
				
			||||||
    } else if (source.contains(cpuRegExp)) {
 | 
					    } else if (source.contains(cpuRegExp)) {
 | 
				
			||||||
        // cpus
 | 
					        // cpus
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("cpu/")).remove(QString("/TotalLoad"));
 | 
					        key.remove(QString("cpu/")).remove(QString("/TotalLoad"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = Float;
 | 
					        m_formater[key] = FormaterType::Float;
 | 
				
			||||||
    } else if (source == QString("cpu/system/AverageClock")) {
 | 
					    } else if (source == QString("cpu/system/AverageClock")) {
 | 
				
			||||||
        // cpucl
 | 
					        // cpucl
 | 
				
			||||||
        m_map[source] = QString("cpucl");
 | 
					        m_map[source] = QString("cpucl");
 | 
				
			||||||
        m_formater[QString("cpucl")] = Integer;
 | 
					        m_formater[QString("cpucl")] = FormaterType::Integer;
 | 
				
			||||||
    } else if (source.contains(cpuclRegExp)) {
 | 
					    } else if (source.contains(cpuclRegExp)) {
 | 
				
			||||||
        // cpucls
 | 
					        // cpucls
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("cpu/cpu")).remove(QString("/clock"));
 | 
					        key.remove(QString("cpu/cpu")).remove(QString("/clock"));
 | 
				
			||||||
        key = QString("cpucl%1").arg(key);
 | 
					        key = QString("cpucl%1").arg(key);
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = Integer;
 | 
					        m_formater[key] = FormaterType::Integer;
 | 
				
			||||||
    } else if (source.startsWith(QString("custom"))) {
 | 
					    } else if (source.startsWith(QString("custom"))) {
 | 
				
			||||||
        // custom
 | 
					        // custom
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("custom/"));
 | 
					        key.remove(QString("custom/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = NoFormat;
 | 
					        m_formater[key] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source == QString("desktop/current/name")) {
 | 
					    } else if (source == QString("desktop/current/name")) {
 | 
				
			||||||
        // current desktop name
 | 
					        // current desktop name
 | 
				
			||||||
        m_map[source] = QString("desktop");
 | 
					        m_map[source] = QString("desktop");
 | 
				
			||||||
        m_formater[QString("desktop")] = NoFormat;
 | 
					        m_formater[QString("desktop")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source == QString("desktop/current/number")) {
 | 
					    } else if (source == QString("desktop/current/number")) {
 | 
				
			||||||
        // current desktop number
 | 
					        // current desktop number
 | 
				
			||||||
        m_map[source] = QString("ndesktop");
 | 
					        m_map[source] = QString("ndesktop");
 | 
				
			||||||
        m_formater[QString("ndesktop")] = NoFormat;
 | 
					        m_formater[QString("ndesktop")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source == QString("desktop/total/number")) {
 | 
					    } else if (source == QString("desktop/total/number")) {
 | 
				
			||||||
        // desktop count
 | 
					        // desktop count
 | 
				
			||||||
        m_map[source] = QString("tdesktops");
 | 
					        m_map[source] = QString("tdesktops");
 | 
				
			||||||
        m_formater[QString("tdesktops")] = NoFormat;
 | 
					        m_formater[QString("tdesktops")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source.contains(hddrRegExp)) {
 | 
					    } else if (source.contains(hddrRegExp)) {
 | 
				
			||||||
        // read speed
 | 
					        // read speed
 | 
				
			||||||
        QString device = source;
 | 
					        QString device = source;
 | 
				
			||||||
@ -308,7 +305,7 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        if (index > -1) {
 | 
					        if (index > -1) {
 | 
				
			||||||
            QString key = QString("hddr%1").arg(index);
 | 
					            QString key = QString("hddr%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = Integer;
 | 
					            m_formater[key] = FormaterType::Integer;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.contains(hddwRegExp)) {
 | 
					    } else if (source.contains(hddwRegExp)) {
 | 
				
			||||||
        // write speed
 | 
					        // write speed
 | 
				
			||||||
@ -318,16 +315,16 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        if (index > -1) {
 | 
					        if (index > -1) {
 | 
				
			||||||
            QString key = QString("hddw%1").arg(index);
 | 
					            QString key = QString("hddw%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = Integer;
 | 
					            m_formater[key] = FormaterType::Integer;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source == QString("gpu/load")) {
 | 
					    } else if (source == QString("gpu/load")) {
 | 
				
			||||||
        // gpu load
 | 
					        // gpu load
 | 
				
			||||||
        m_map[source] = QString("gpu");
 | 
					        m_map[source] = QString("gpu");
 | 
				
			||||||
        m_formater[QString("gpu")] = Float;
 | 
					        m_formater[QString("gpu")] = FormaterType::Float;
 | 
				
			||||||
    } else if (source == QString("gpu/temperature")) {
 | 
					    } else if (source == QString("gpu/temperature")) {
 | 
				
			||||||
        // gpu temperature
 | 
					        // gpu temperature
 | 
				
			||||||
        m_map[source] = QString("gputemp");
 | 
					        m_map[source] = QString("gputemp");
 | 
				
			||||||
        m_formater[QString("gputemp")] = Temperature;
 | 
					        m_formater[QString("gputemp")] = FormaterType::Temperature;
 | 
				
			||||||
    } else if (source.contains(mountFillRegExp)) {
 | 
					    } else if (source.contains(mountFillRegExp)) {
 | 
				
			||||||
        // fill level
 | 
					        // fill level
 | 
				
			||||||
        QString device = source;
 | 
					        QString device = source;
 | 
				
			||||||
@ -336,10 +333,12 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        if (index > -1) {
 | 
					        if (index > -1) {
 | 
				
			||||||
            QString key = QString("hdd%1").arg(index);
 | 
					            QString key = QString("hdd%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = Float;
 | 
					            m_formater[key] = FormaterType::Float;
 | 
				
			||||||
            // additional keys
 | 
					            // additional keys
 | 
				
			||||||
            m_formater[QString("hddtotmb%1").arg(index)] = IntegerFive;
 | 
					            m_formater[QString("hddtotmb%1").arg(index)]
 | 
				
			||||||
            m_formater[QString("hddtotgb%1").arg(index)] = Float;
 | 
					                = FormaterType::MemMBFormat;
 | 
				
			||||||
 | 
					            m_formater[QString("hddtotgb%1").arg(index)]
 | 
				
			||||||
 | 
					                = FormaterType::MemGBFormat;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.contains(mountFreeRegExp)) {
 | 
					    } else if (source.contains(mountFreeRegExp)) {
 | 
				
			||||||
        // free space
 | 
					        // free space
 | 
				
			||||||
@ -350,11 +349,11 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
            // mb
 | 
					            // mb
 | 
				
			||||||
            QString key = QString("hddfreemb%1").arg(index);
 | 
					            QString key = QString("hddfreemb%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = MemMBFormat;
 | 
					            m_formater[key] = FormaterType::MemMBFormat;
 | 
				
			||||||
            // gb
 | 
					            // gb
 | 
				
			||||||
            key = QString("hddfreegb%1").arg(index);
 | 
					            key = QString("hddfreegb%1").arg(index);
 | 
				
			||||||
            m_map.insertMulti(source, key);
 | 
					            m_map.insertMulti(source, key);
 | 
				
			||||||
            m_formater[key] = MemGBFormat;
 | 
					            m_formater[key] = FormaterType::MemGBFormat;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.contains(mountUsedRegExp)) {
 | 
					    } else if (source.contains(mountUsedRegExp)) {
 | 
				
			||||||
        // used
 | 
					        // used
 | 
				
			||||||
@ -365,11 +364,11 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
            // mb
 | 
					            // mb
 | 
				
			||||||
            QString key = QString("hddmb%1").arg(index);
 | 
					            QString key = QString("hddmb%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = MemMBFormat;
 | 
					            m_formater[key] = FormaterType::MemMBFormat;
 | 
				
			||||||
            // gb
 | 
					            // gb
 | 
				
			||||||
            key = QString("hddgb%1").arg(index);
 | 
					            key = QString("hddgb%1").arg(index);
 | 
				
			||||||
            m_map.insertMulti(source, key);
 | 
					            m_map.insertMulti(source, key);
 | 
				
			||||||
            m_formater[key] = MemGBFormat;
 | 
					            m_formater[key] = FormaterType::MemGBFormat;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.startsWith(QString("hdd/temperature"))) {
 | 
					    } else if (source.startsWith(QString("hdd/temperature"))) {
 | 
				
			||||||
        // hdd temperature
 | 
					        // hdd temperature
 | 
				
			||||||
@ -379,7 +378,7 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        if (index > -1) {
 | 
					        if (index > -1) {
 | 
				
			||||||
            QString key = QString("hddtemp%1").arg(index);
 | 
					            QString key = QString("hddtemp%1").arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = Temperature;
 | 
					            m_formater[key] = FormaterType::Temperature;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.startsWith(QString("cpu/system/loadavg"))) {
 | 
					    } else if (source.startsWith(QString("cpu/system/loadavg"))) {
 | 
				
			||||||
        // load average
 | 
					        // load average
 | 
				
			||||||
@ -387,35 +386,35 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        time.remove(QString("cpu/system/loadavg"));
 | 
					        time.remove(QString("cpu/system/loadavg"));
 | 
				
			||||||
        QString key = QString("la%1").arg(time);
 | 
					        QString key = QString("la%1").arg(time);
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = FloatTwoSymbols;
 | 
					        m_formater[key] = FormaterType::FloatTwoSymbols;
 | 
				
			||||||
    } else if (source == QString("mem/physical/application")) {
 | 
					    } else if (source == QString("mem/physical/application")) {
 | 
				
			||||||
        // app memory
 | 
					        // app memory
 | 
				
			||||||
        // mb
 | 
					        // mb
 | 
				
			||||||
        m_map[source] = QString("memmb");
 | 
					        m_map[source] = QString("memmb");
 | 
				
			||||||
        m_formater[QString("memmb")] = MemMBFormat;
 | 
					        m_formater[QString("memmb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
        // gb
 | 
					        // gb
 | 
				
			||||||
        m_map.insertMulti(source, QString("memgb"));
 | 
					        m_map.insertMulti(source, QString("memgb"));
 | 
				
			||||||
        m_formater[QString("memgb")] = MemGBFormat;
 | 
					        m_formater[QString("memgb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    } else if (source == QString("mem/physical/free")) {
 | 
					    } else if (source == QString("mem/physical/free")) {
 | 
				
			||||||
        // free memory
 | 
					        // free memory
 | 
				
			||||||
        // mb
 | 
					        // mb
 | 
				
			||||||
        m_map[source] = QString("memfreemb");
 | 
					        m_map[source] = QString("memfreemb");
 | 
				
			||||||
        m_formater[QString("memfreemb")] = MemMBFormat;
 | 
					        m_formater[QString("memfreemb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
        // gb
 | 
					        // gb
 | 
				
			||||||
        m_map.insertMulti(source, QString("memfreegb"));
 | 
					        m_map.insertMulti(source, QString("memfreegb"));
 | 
				
			||||||
        m_formater[QString("memfreegb")] = MemGBFormat;
 | 
					        m_formater[QString("memfreegb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    } else if (source == QString("mem/physical/used")) {
 | 
					    } else if (source == QString("mem/physical/used")) {
 | 
				
			||||||
        // used memory
 | 
					        // used memory
 | 
				
			||||||
        // mb
 | 
					        // mb
 | 
				
			||||||
        m_map[source] = QString("memusedmb");
 | 
					        m_map[source] = QString("memusedmb");
 | 
				
			||||||
        m_formater[QString("memusedmb")] = MemMBFormat;
 | 
					        m_formater[QString("memusedmb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
        // gb
 | 
					        // gb
 | 
				
			||||||
        m_map.insertMulti(source, QString("memusedgb"));
 | 
					        m_map.insertMulti(source, QString("memusedgb"));
 | 
				
			||||||
        m_formater[QString("memusedgb")] = MemGBFormat;
 | 
					        m_formater[QString("memusedgb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    } else if (source == QString("network/current/name")) {
 | 
					    } else if (source == QString("network/current/name")) {
 | 
				
			||||||
        // network device
 | 
					        // network device
 | 
				
			||||||
        m_map[source] = QString("netdev");
 | 
					        m_map[source] = QString("netdev");
 | 
				
			||||||
        m_formater[QString("netdev")] = NoFormat;
 | 
					        m_formater[QString("netdev")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source.contains(netRegExp)) {
 | 
					    } else if (source.contains(netRegExp)) {
 | 
				
			||||||
        // network speed
 | 
					        // network speed
 | 
				
			||||||
        QString type = source.contains(QString("receiver")) ? QString("down")
 | 
					        QString type = source.contains(QString("receiver")) ? QString("down")
 | 
				
			||||||
@ -426,62 +425,62 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
            // kb
 | 
					            // kb
 | 
				
			||||||
            QString key = QString("%1kb%2").arg(type).arg(index);
 | 
					            QString key = QString("%1kb%2").arg(type).arg(index);
 | 
				
			||||||
            m_map[source] = key;
 | 
					            m_map[source] = key;
 | 
				
			||||||
            m_formater[key] = Integer;
 | 
					            m_formater[key] = FormaterType::Integer;
 | 
				
			||||||
            // smart
 | 
					            // smart
 | 
				
			||||||
            key = QString("%1%2").arg(type).arg(index);
 | 
					            key = QString("%1%2").arg(type).arg(index);
 | 
				
			||||||
            m_map.insertMulti(source, key);
 | 
					            m_map.insertMulti(source, key);
 | 
				
			||||||
            m_formater[key] = NetSmartFormat;
 | 
					            m_formater[key] = FormaterType::NetSmartFormat;
 | 
				
			||||||
            // units
 | 
					            // units
 | 
				
			||||||
            key = QString("%1units%2").arg(type).arg(index);
 | 
					            key = QString("%1units%2").arg(type).arg(index);
 | 
				
			||||||
            m_map.insertMulti(source, key);
 | 
					            m_map.insertMulti(source, key);
 | 
				
			||||||
            m_formater[key] = NetSmartUnits;
 | 
					            m_formater[key] = FormaterType::NetSmartUnits;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source.startsWith(QString("upgrade"))) {
 | 
					    } else if (source.startsWith(QString("upgrade"))) {
 | 
				
			||||||
        // package manager
 | 
					        // package manager
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("upgrade/"));
 | 
					        key.remove(QString("upgrade/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = IntegerThree;
 | 
					        m_formater[key] = FormaterType::IntegerThree;
 | 
				
			||||||
    } else if (source.startsWith(QString("player"))) {
 | 
					    } else if (source.startsWith(QString("player"))) {
 | 
				
			||||||
        // player
 | 
					        // player
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("player/"));
 | 
					        key.remove(QString("player/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = NoFormat;
 | 
					        m_formater[key] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source == QString("ps/running/count")) {
 | 
					    } else if (source == QString("ps/running/count")) {
 | 
				
			||||||
        // running processes count
 | 
					        // running processes count
 | 
				
			||||||
        m_map[source] = QString("pscount");
 | 
					        m_map[source] = QString("pscount");
 | 
				
			||||||
        m_formater[QString("pscount")] = NoFormat;
 | 
					        m_formater[QString("pscount")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source == QString("ps/running/list")) {
 | 
					    } else if (source == QString("ps/running/list")) {
 | 
				
			||||||
        // list of running processes
 | 
					        // list of running processes
 | 
				
			||||||
        m_map[source] = QString("ps");
 | 
					        m_map[source] = QString("ps");
 | 
				
			||||||
        m_formater[QString("ps")] = List;
 | 
					        m_formater[QString("ps")] = FormaterType::List;
 | 
				
			||||||
    } else if (source == QString("ps/total/count")) {
 | 
					    } else if (source == QString("ps/total/count")) {
 | 
				
			||||||
        // total processes count
 | 
					        // total processes count
 | 
				
			||||||
        m_map[source] = QString("pstotal");
 | 
					        m_map[source] = QString("pstotal");
 | 
				
			||||||
        m_formater[QString("pstotal")] = NoFormat;
 | 
					        m_formater[QString("pstotal")] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source.startsWith(QString("quotes"))) {
 | 
					    } else if (source.startsWith(QString("quotes"))) {
 | 
				
			||||||
        // quotes
 | 
					        // quotes
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("quotes/"));
 | 
					        key.remove(QString("quotes/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = Quotes;
 | 
					        m_formater[key] = FormaterType::Quotes;
 | 
				
			||||||
    } else if (source == QString("mem/swap/free")) {
 | 
					    } else if (source == QString("mem/swap/free")) {
 | 
				
			||||||
        // free swap
 | 
					        // free swap
 | 
				
			||||||
        // mb
 | 
					        // mb
 | 
				
			||||||
        m_map[source] = QString("swapfreemb");
 | 
					        m_map[source] = QString("swapfreemb");
 | 
				
			||||||
        m_formater[QString("swapfreemb")] = MemMBFormat;
 | 
					        m_formater[QString("swapfreemb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
        // gb
 | 
					        // gb
 | 
				
			||||||
        m_map.insertMulti(source, QString("swapfreegb"));
 | 
					        m_map.insertMulti(source, QString("swapfreegb"));
 | 
				
			||||||
        m_formater[QString("swapfreegb")] = MemGBFormat;
 | 
					        m_formater[QString("swapfreegb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    } else if (source == QString("mem/swap/used")) {
 | 
					    } else if (source == QString("mem/swap/used")) {
 | 
				
			||||||
        // used swap
 | 
					        // used swap
 | 
				
			||||||
        // mb
 | 
					        // mb
 | 
				
			||||||
        m_map[source] = QString("swapmb");
 | 
					        m_map[source] = QString("swapmb");
 | 
				
			||||||
        m_formater[QString("swapmb")] = MemMBFormat;
 | 
					        m_formater[QString("swapmb")] = FormaterType::MemMBFormat;
 | 
				
			||||||
        // gb
 | 
					        // gb
 | 
				
			||||||
        m_map.insertMulti(source, QString("swapgb"));
 | 
					        m_map.insertMulti(source, QString("swapgb"));
 | 
				
			||||||
        m_formater[QString("swapgb")] = MemGBFormat;
 | 
					        m_formater[QString("swapgb")] = FormaterType::MemGBFormat;
 | 
				
			||||||
    } else if (source.startsWith(QString("lmsensors/"))) {
 | 
					    } else if (source.startsWith(QString("lmsensors/"))) {
 | 
				
			||||||
        // temperature
 | 
					        // temperature
 | 
				
			||||||
        int index = m_devices[QString("temp")].indexOf(source);
 | 
					        int index = m_devices[QString("temp")].indexOf(source);
 | 
				
			||||||
@ -491,49 +490,50 @@ QStringList AWKeysAggregator::registerSource(const QString &source,
 | 
				
			|||||||
        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;
 | 
				
			||||||
            m_formater[key] = units == QString("°C") ? Temperature : Integer;
 | 
					            m_formater[key] = units == QString("°C") ? FormaterType::Temperature
 | 
				
			||||||
 | 
					                                                     : FormaterType::Integer;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else if (source == QString("Local")) {
 | 
					    } else if (source == QString("Local")) {
 | 
				
			||||||
        // time
 | 
					        // time
 | 
				
			||||||
        m_map[source] = QString("time");
 | 
					        m_map[source] = QString("time");
 | 
				
			||||||
        m_formater[QString("time")] = Time;
 | 
					        m_formater[QString("time")] = FormaterType::Time;
 | 
				
			||||||
        // custom time
 | 
					        // custom time
 | 
				
			||||||
        m_map.insertMulti(source, QString("ctime"));
 | 
					        m_map.insertMulti(source, QString("ctime"));
 | 
				
			||||||
        m_formater[QString("ctime")] = TimeCustom;
 | 
					        m_formater[QString("ctime")] = FormaterType::TimeCustom;
 | 
				
			||||||
        // ISO time
 | 
					        // ISO time
 | 
				
			||||||
        m_map.insertMulti(source, QString("isotime"));
 | 
					        m_map.insertMulti(source, QString("isotime"));
 | 
				
			||||||
        m_formater[QString("isotime")] = TimeISO;
 | 
					        m_formater[QString("isotime")] = FormaterType::TimeISO;
 | 
				
			||||||
        // long time
 | 
					        // long time
 | 
				
			||||||
        m_map.insertMulti(source, QString("longtime"));
 | 
					        m_map.insertMulti(source, QString("longtime"));
 | 
				
			||||||
        m_formater[QString("longtime")] = TimeLong;
 | 
					        m_formater[QString("longtime")] = FormaterType::TimeLong;
 | 
				
			||||||
        // short time
 | 
					        // short time
 | 
				
			||||||
        m_map.insertMulti(source, QString("shorttime"));
 | 
					        m_map.insertMulti(source, QString("shorttime"));
 | 
				
			||||||
        m_formater[QString("shorttime")] = TimeShort;
 | 
					        m_formater[QString("shorttime")] = FormaterType::TimeShort;
 | 
				
			||||||
    } else if (source == QString("system/uptime")) {
 | 
					    } else if (source == QString("system/uptime")) {
 | 
				
			||||||
        // uptime
 | 
					        // uptime
 | 
				
			||||||
        m_map[source] = QString("uptime");
 | 
					        m_map[source] = QString("uptime");
 | 
				
			||||||
        m_formater[QString("uptime")] = Uptime;
 | 
					        m_formater[QString("uptime")] = FormaterType::Uptime;
 | 
				
			||||||
        // custom uptime
 | 
					        // custom uptime
 | 
				
			||||||
        m_map.insertMulti(source, QString("cuptime"));
 | 
					        m_map.insertMulti(source, QString("cuptime"));
 | 
				
			||||||
        m_formater[QString("cuptime")] = UptimeCustom;
 | 
					        m_formater[QString("cuptime")] = FormaterType::UptimeCustom;
 | 
				
			||||||
    } else if (source.startsWith(QString("weather/temperature"))) {
 | 
					    } else if (source.startsWith(QString("weather/temperature"))) {
 | 
				
			||||||
        // temperature
 | 
					        // temperature
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("weather/"));
 | 
					        key.remove(QString("weather/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = Temperature;
 | 
					        m_formater[key] = FormaterType::Temperature;
 | 
				
			||||||
    } else if (source.startsWith(QString("weather/"))) {
 | 
					    } else if (source.startsWith(QString("weather/"))) {
 | 
				
			||||||
        // other weather
 | 
					        // other weather
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("weather/"));
 | 
					        key.remove(QString("weather/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = NoFormat;
 | 
					        m_formater[key] = FormaterType::NoFormat;
 | 
				
			||||||
    } else if (source.startsWith(QString("load/load"))) {
 | 
					    } else if (source.startsWith(QString("load/load"))) {
 | 
				
			||||||
        // load source
 | 
					        // load source
 | 
				
			||||||
        QString key = source;
 | 
					        QString key = source;
 | 
				
			||||||
        key.remove(QString("load/"));
 | 
					        key.remove(QString("load/"));
 | 
				
			||||||
        m_map[source] = key;
 | 
					        m_map[source] = key;
 | 
				
			||||||
        m_formater[key] = Temperature;
 | 
					        m_formater[key] = FormaterType::Temperature;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // drop key from dictionary if no one user requested key required it
 | 
					    // drop key from dictionary if no one user requested key required it
 | 
				
			||||||
 | 
				
			|||||||
@ -36,7 +36,7 @@ class AWKeysAggregator : public QObject
 | 
				
			|||||||
    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);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    enum FormaterType {
 | 
					    enum class FormaterType {
 | 
				
			||||||
        // general formaters
 | 
					        // general formaters
 | 
				
			||||||
        NoFormat = 0,
 | 
					        NoFormat = 0,
 | 
				
			||||||
        Float,
 | 
					        Float,
 | 
				
			||||||
 | 
				
			|||||||
@ -74,14 +74,18 @@ bool AWUpdateHelper::checkVersion()
 | 
				
			|||||||
    // update version
 | 
					    // update version
 | 
				
			||||||
    settings.setValue(QString("Version"), QString(VERSION));
 | 
					    settings.setValue(QString("Version"), QString(VERSION));
 | 
				
			||||||
    settings.sync();
 | 
					    settings.sync();
 | 
				
			||||||
 | 
					    qCInfo(LOG_AW) << "Found version" << version << "actual one is"
 | 
				
			||||||
 | 
					                   << m_foundVersion;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    qCInfo(LOG_AW) << "Found version" << version << "actual one is" << VERSION;
 | 
					    if ((version != m_foundVersion) && (!QString(CHANGELOG).isEmpty())) {
 | 
				
			||||||
    if (version != QVersionNumber::fromString(VERSION)) {
 | 
					 | 
				
			||||||
        genMessageBox(i18n("Changelog of %1", QString(VERSION)),
 | 
					        genMessageBox(i18n("Changelog of %1", QString(VERSION)),
 | 
				
			||||||
                      QString(CHANGELOG).replace(QChar('@'), QChar('\n')),
 | 
					                      QString(CHANGELOG).replace(QChar('@'), QChar('\n')),
 | 
				
			||||||
                      QMessageBox::Ok)
 | 
					                      QMessageBox::Ok)
 | 
				
			||||||
            ->open();
 | 
					            ->open();
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
 | 
					    } else if (version != m_foundVersion) {
 | 
				
			||||||
 | 
					        qCWarning(LOG_AW) << "No changelog information provided";
 | 
				
			||||||
 | 
					        return true;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        qCInfo(LOG_AW) << "No need to update version";
 | 
					        qCInfo(LOG_AW) << "No need to update version";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -6,11 +6,11 @@ X-AW-Value=bat
 | 
				
			|||||||
X-AW-Custom=false
 | 
					X-AW-Custom=false
 | 
				
			||||||
X-AW-Max=100.0
 | 
					X-AW-Max=100.0
 | 
				
			||||||
X-AW-Min=0.0
 | 
					X-AW-Min=0.0
 | 
				
			||||||
X-AW-ActiveColor="0,0,0,255"
 | 
					X-AW-ActiveColor="color://0,0,0,255"
 | 
				
			||||||
X-AW-InactiveColor="255,255,255,255"
 | 
					X-AW-InactiveColor="color://255,255,255,255"
 | 
				
			||||||
X-AW-Type=Horizontal
 | 
					X-AW-Type=Horizontal
 | 
				
			||||||
X-AW-Direction=LeftToRight
 | 
					X-AW-Direction=LeftToRight
 | 
				
			||||||
X-AW-Height=25
 | 
					X-AW-Height=25
 | 
				
			||||||
X-AW-Width=100
 | 
					X-AW-Width=100
 | 
				
			||||||
X-AW-ApiVersion=4
 | 
					X-AW-ApiVersion=5
 | 
				
			||||||
X-AW-Number=3
 | 
					X-AW-Number=3
 | 
				
			||||||
 | 
				
			|||||||
@ -6,11 +6,11 @@ X-AW-Value=cpu
 | 
				
			|||||||
X-AW-Custom=false
 | 
					X-AW-Custom=false
 | 
				
			||||||
X-AW-Max=100.0
 | 
					X-AW-Max=100.0
 | 
				
			||||||
X-AW-Min=0.0
 | 
					X-AW-Min=0.0
 | 
				
			||||||
X-AW-ActiveColor="0,0,0,255"
 | 
					X-AW-ActiveColor="color://0,0,0,255"
 | 
				
			||||||
X-AW-InactiveColor="255,255,255,255"
 | 
					X-AW-InactiveColor="color://255,255,255,255"
 | 
				
			||||||
X-AW-Type=Horizontal
 | 
					X-AW-Type=Horizontal
 | 
				
			||||||
X-AW-Direction=LeftToRight
 | 
					X-AW-Direction=LeftToRight
 | 
				
			||||||
X-AW-Height=25
 | 
					X-AW-Height=25
 | 
				
			||||||
X-AW-Width=100
 | 
					X-AW-Width=100
 | 
				
			||||||
X-AW-ApiVersion=4
 | 
					X-AW-ApiVersion=5
 | 
				
			||||||
X-AW-Number=0
 | 
					X-AW-Number=0
 | 
				
			||||||
 | 
				
			|||||||
@ -6,11 +6,11 @@ X-AW-Value=mem
 | 
				
			|||||||
X-AW-Custom=false
 | 
					X-AW-Custom=false
 | 
				
			||||||
X-AW-Max=100.0
 | 
					X-AW-Max=100.0
 | 
				
			||||||
X-AW-Min=0.0
 | 
					X-AW-Min=0.0
 | 
				
			||||||
X-AW-ActiveColor="0,0,0,255"
 | 
					X-AW-ActiveColor="color://0,0,0,255"
 | 
				
			||||||
X-AW-InactiveColor="255,255,255,255"
 | 
					X-AW-InactiveColor="color://255,255,255,255"
 | 
				
			||||||
X-AW-Type=Horizontal
 | 
					X-AW-Type=Horizontal
 | 
				
			||||||
X-AW-Direction=LeftToRight
 | 
					X-AW-Direction=LeftToRight
 | 
				
			||||||
X-AW-Height=25
 | 
					X-AW-Height=25
 | 
				
			||||||
X-AW-Width=100
 | 
					X-AW-Width=100
 | 
				
			||||||
X-AW-ApiVersion=4
 | 
					X-AW-ApiVersion=5
 | 
				
			||||||
X-AW-Number=1
 | 
					X-AW-Number=1
 | 
				
			||||||
 | 
				
			|||||||
@ -6,11 +6,11 @@ X-AW-Value=swap
 | 
				
			|||||||
X-AW-Custom=false
 | 
					X-AW-Custom=false
 | 
				
			||||||
X-AW-Max=100.0
 | 
					X-AW-Max=100.0
 | 
				
			||||||
X-AW-Min=0.0
 | 
					X-AW-Min=0.0
 | 
				
			||||||
X-AW-ActiveColor="0,0,0,255"
 | 
					X-AW-ActiveColor="color://0,0,0,255"
 | 
				
			||||||
X-AW-InactiveColor="255,255,255,255"
 | 
					X-AW-InactiveColor="color://255,255,255,255"
 | 
				
			||||||
X-AW-Type=Horizontal
 | 
					X-AW-Type=Horizontal
 | 
				
			||||||
X-AW-Direction=LeftToRight
 | 
					X-AW-Direction=LeftToRight
 | 
				
			||||||
X-AW-Height=25
 | 
					X-AW-Height=25
 | 
				
			||||||
X-AW-Width=100
 | 
					X-AW-Width=100
 | 
				
			||||||
X-AW-ApiVersion=4
 | 
					X-AW-ApiVersion=5
 | 
				
			||||||
X-AW-Number=2
 | 
					X-AW-Number=2
 | 
				
			||||||
 | 
				
			|||||||
@ -112,17 +112,16 @@ QString ExtScript::strRedirect() const
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    QString value;
 | 
					    QString value;
 | 
				
			||||||
    switch (m_redirect) {
 | 
					    switch (m_redirect) {
 | 
				
			||||||
    case stdout2stderr:
 | 
					    case Redirect::stdout2stderr:
 | 
				
			||||||
        value = QString("stdout2stderr");
 | 
					        value = QString("stdout2stderr");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case stderr2stdout:
 | 
					    case Redirect::stderr2stdout:
 | 
				
			||||||
        value = QString("stderr2stdout");
 | 
					        value = QString("stderr2stdout");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case swap:
 | 
					    case Redirect::swap:
 | 
				
			||||||
        value = QString("swap");
 | 
					        value = QString("swap");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case nothing:
 | 
					    case Redirect::nothing:
 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        value = QString("nothing");
 | 
					        value = QString("nothing");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -158,7 +157,7 @@ void ExtScript::setPrefix(const QString _prefix)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void ExtScript::setRedirect(const Redirect _redirect)
 | 
					void ExtScript::setRedirect(const Redirect _redirect)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_LIB) << "Redirect" << _redirect;
 | 
					    qCDebug(LOG_LIB) << "Redirect" << static_cast<int>(_redirect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_redirect = _redirect;
 | 
					    m_redirect = _redirect;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -169,13 +168,13 @@ void ExtScript::setStrRedirect(const QString _redirect)
 | 
				
			|||||||
    qCDebug(LOG_LIB) << "Redirect" << _redirect;
 | 
					    qCDebug(LOG_LIB) << "Redirect" << _redirect;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (_redirect == QString("stdout2sdterr"))
 | 
					    if (_redirect == QString("stdout2sdterr"))
 | 
				
			||||||
        m_redirect = stdout2stderr;
 | 
					        m_redirect = Redirect::stdout2stderr;
 | 
				
			||||||
    else if (_redirect == QString("stderr2sdtout"))
 | 
					    else if (_redirect == QString("stderr2sdtout"))
 | 
				
			||||||
        m_redirect = stderr2stdout;
 | 
					        m_redirect = Redirect::stderr2stdout;
 | 
				
			||||||
    else if (_redirect == QString("swap"))
 | 
					    else if (_redirect == QString("swap"))
 | 
				
			||||||
        m_redirect = swap;
 | 
					        m_redirect = Redirect::swap;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        m_redirect = nothing;
 | 
					        m_redirect = Redirect::nothing;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -376,16 +375,15 @@ void ExtScript::updateValue()
 | 
				
			|||||||
    QString strValue;
 | 
					    QString strValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (m_redirect) {
 | 
					    switch (m_redirect) {
 | 
				
			||||||
    case stdout2stderr:
 | 
					    case Redirect::stdout2stderr:
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case stderr2stdout:
 | 
					    case Redirect::stderr2stdout:
 | 
				
			||||||
        strValue = QString("%1\n%2").arg(qdebug).arg(qoutput);
 | 
					        strValue = QString("%1\n%2").arg(qdebug).arg(qoutput);
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case swap:
 | 
					    case Redirect::swap:
 | 
				
			||||||
        strValue = qdebug;
 | 
					        strValue = qdebug;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case nothing:
 | 
					    case Redirect::nothing:
 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        strValue = qoutput;
 | 
					        strValue = qoutput;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,7 @@ class ExtScript : public AbstractExtItem
 | 
				
			|||||||
    Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
 | 
					    Q_PROPERTY(Redirect redirect READ redirect WRITE setRedirect)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    enum Redirect { stdout2stderr = 0, nothing, stderr2stdout, swap };
 | 
					    enum class Redirect { stdout2stderr = 0, nothing, stderr2stdout, swap };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    explicit ExtScript(QWidget *parent = nullptr,
 | 
					    explicit ExtScript(QWidget *parent = nullptr,
 | 
				
			||||||
                       const QString scriptName = QString(),
 | 
					                       const QString scriptName = QString(),
 | 
				
			||||||
@ -56,7 +56,7 @@ public:
 | 
				
			|||||||
    void setExecutable(const QString _executable = QString("/usr/bin/true"));
 | 
					    void setExecutable(const QString _executable = QString("/usr/bin/true"));
 | 
				
			||||||
    void setFilters(const QStringList _filters = QStringList());
 | 
					    void setFilters(const QStringList _filters = QStringList());
 | 
				
			||||||
    void setPrefix(const QString _prefix = QString(""));
 | 
					    void setPrefix(const QString _prefix = QString(""));
 | 
				
			||||||
    void setRedirect(const Redirect _redirect = nothing);
 | 
					    void setRedirect(const Redirect _redirect = Redirect::nothing);
 | 
				
			||||||
    void setStrRedirect(const QString _redirect = QString("nothing"));
 | 
					    void setStrRedirect(const QString _redirect = QString("nothing"));
 | 
				
			||||||
    // filters
 | 
					    // filters
 | 
				
			||||||
    QString applyFilters(QString _value) const;
 | 
					    QString applyFilters(QString _value) const;
 | 
				
			||||||
@ -80,7 +80,7 @@ private:
 | 
				
			|||||||
    QString m_executable = QString("/usr/bin/true");
 | 
					    QString m_executable = QString("/usr/bin/true");
 | 
				
			||||||
    QStringList m_filters = QStringList();
 | 
					    QStringList m_filters = QStringList();
 | 
				
			||||||
    QString m_prefix = QString("");
 | 
					    QString m_prefix = QString("");
 | 
				
			||||||
    Redirect m_redirect = nothing;
 | 
					    Redirect m_redirect = Redirect::nothing;
 | 
				
			||||||
    // internal properties
 | 
					    // internal properties
 | 
				
			||||||
    QVariantMap jsonFilters = QVariantMap();
 | 
					    QVariantMap jsonFilters = QVariantMap();
 | 
				
			||||||
    int times = 0;
 | 
					    int times = 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -50,9 +50,9 @@ GraphicalItem::GraphicalItem(QWidget *parent, const QString desktopName,
 | 
				
			|||||||
            SLOT(changeValue(int)));
 | 
					            SLOT(changeValue(int)));
 | 
				
			||||||
    connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this,
 | 
					    connect(ui->comboBox_type, SIGNAL(currentIndexChanged(int)), this,
 | 
				
			||||||
            SLOT(changeCountState(int)));
 | 
					            SLOT(changeCountState(int)));
 | 
				
			||||||
    connect(ui->pushButton_activeColor, SIGNAL(clicked()), this,
 | 
					    connect(ui->toolButton_activeColor, SIGNAL(clicked()), this,
 | 
				
			||||||
            SLOT(changeColor()));
 | 
					            SLOT(changeColor()));
 | 
				
			||||||
    connect(ui->pushButton_inactiveColor, SIGNAL(clicked()), this,
 | 
					    connect(ui->toolButton_inactiveColor, SIGNAL(clicked()), this,
 | 
				
			||||||
            SLOT(changeColor()));
 | 
					            SLOT(changeColor()));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -102,22 +102,27 @@ QString GraphicalItem::image(const QVariant &value)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // paint
 | 
					    // paint
 | 
				
			||||||
    switch (m_type) {
 | 
					    switch (m_type) {
 | 
				
			||||||
    case Vertical:
 | 
					    case Type::Vertical:
 | 
				
			||||||
        m_helper->paintVertical(converted);
 | 
					        m_helper->paintVertical(converted);
 | 
				
			||||||
        // scale
 | 
					        // scale
 | 
				
			||||||
        scale[1] = -2 * static_cast<int>(m_direction) + 1;
 | 
					        scale[1] = -2 * static_cast<int>(m_direction) + 1;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Circle:
 | 
					    case Type::Circle:
 | 
				
			||||||
        m_helper->paintCircle(converted);
 | 
					        m_helper->paintCircle(converted);
 | 
				
			||||||
        // scale
 | 
					        // scale
 | 
				
			||||||
        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
					        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Graph:
 | 
					    case Type::Graph:
 | 
				
			||||||
        m_helper->paintGraph(converted);
 | 
					        m_helper->paintGraph(converted);
 | 
				
			||||||
        // direction option is not recognized by this GI type
 | 
					        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
				
			||||||
 | 
					        scale[1] = -1;
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Horizontal:
 | 
					    case Type::Bars:
 | 
				
			||||||
    default:
 | 
					        m_helper->paintBars(converted);
 | 
				
			||||||
 | 
					        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
				
			||||||
 | 
					        scale[1] = -1;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case Type::Horizontal:
 | 
				
			||||||
        m_helper->paintHorizontal(converted);
 | 
					        m_helper->paintHorizontal(converted);
 | 
				
			||||||
        // scale
 | 
					        // scale
 | 
				
			||||||
        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
					        scale[0] = -2 * static_cast<int>(m_direction) + 1;
 | 
				
			||||||
@ -189,17 +194,19 @@ QString GraphicalItem::strType() const
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    QString value;
 | 
					    QString value;
 | 
				
			||||||
    switch (m_type) {
 | 
					    switch (m_type) {
 | 
				
			||||||
    case Vertical:
 | 
					    case Type::Vertical:
 | 
				
			||||||
        value = QString("Vertical");
 | 
					        value = QString("Vertical");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Circle:
 | 
					    case Type::Circle:
 | 
				
			||||||
        value = QString("Circle");
 | 
					        value = QString("Circle");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Graph:
 | 
					    case Type::Graph:
 | 
				
			||||||
        value = QString("Graph");
 | 
					        value = QString("Graph");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case Horizontal:
 | 
					    case Type::Bars:
 | 
				
			||||||
    default:
 | 
					        value = QString("Bars");
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					    case Type::Horizontal:
 | 
				
			||||||
        value = QString("Horizontal");
 | 
					        value = QString("Horizontal");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -218,11 +225,10 @@ QString GraphicalItem::strDirection() const
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
    QString value;
 | 
					    QString value;
 | 
				
			||||||
    switch (m_direction) {
 | 
					    switch (m_direction) {
 | 
				
			||||||
    case RightToLeft:
 | 
					    case Direction::RightToLeft:
 | 
				
			||||||
        value = QString("RightToLeft");
 | 
					        value = QString("RightToLeft");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    case LeftToRight:
 | 
					    case Direction::LeftToRight:
 | 
				
			||||||
    default:
 | 
					 | 
				
			||||||
        value = QString("LeftToRight");
 | 
					        value = QString("LeftToRight");
 | 
				
			||||||
        break;
 | 
					        break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -315,7 +321,7 @@ void GraphicalItem::setMinValue(const float _value)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void GraphicalItem::setType(const Type _type)
 | 
					void GraphicalItem::setType(const Type _type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_LIB) << "Type" << _type;
 | 
					    qCDebug(LOG_LIB) << "Type" << static_cast<int>(_type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_type = _type;
 | 
					    m_type = _type;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -326,19 +332,21 @@ void GraphicalItem::setStrType(const QString _type)
 | 
				
			|||||||
    qCDebug(LOG_LIB) << "Type" << _type;
 | 
					    qCDebug(LOG_LIB) << "Type" << _type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (_type == QString("Vertical"))
 | 
					    if (_type == QString("Vertical"))
 | 
				
			||||||
        setType(Vertical);
 | 
					        setType(Type::Vertical);
 | 
				
			||||||
    else if (_type == QString("Circle"))
 | 
					    else if (_type == QString("Circle"))
 | 
				
			||||||
        setType(Circle);
 | 
					        setType(Type::Circle);
 | 
				
			||||||
    else if (_type == QString("Graph"))
 | 
					    else if (_type == QString("Graph"))
 | 
				
			||||||
        setType(Graph);
 | 
					        setType(Type::Graph);
 | 
				
			||||||
 | 
					    else if (_type == QString("Bars"))
 | 
				
			||||||
 | 
					        setType(Type::Bars);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        setType(Horizontal);
 | 
					        setType(Type::Horizontal);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GraphicalItem::setDirection(const Direction _direction)
 | 
					void GraphicalItem::setDirection(const Direction _direction)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_LIB) << "Direction" << _direction;
 | 
					    qCDebug(LOG_LIB) << "Direction" << static_cast<int>(_direction);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m_direction = _direction;
 | 
					    m_direction = _direction;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -349,9 +357,9 @@ void GraphicalItem::setStrDirection(const QString _direction)
 | 
				
			|||||||
    qCDebug(LOG_LIB) << "Direction" << _direction;
 | 
					    qCDebug(LOG_LIB) << "Direction" << _direction;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (_direction == QString("RightToLeft"))
 | 
					    if (_direction == QString("RightToLeft"))
 | 
				
			||||||
        setDirection(RightToLeft);
 | 
					        setDirection(Direction::RightToLeft);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        setDirection(LeftToRight);
 | 
					        setDirection(Direction::LeftToRight);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -370,7 +378,13 @@ void GraphicalItem::setUsedKeys(const QStringList _usedKeys)
 | 
				
			|||||||
    qCDebug(LOG_LIB) << "Used keys" << _usedKeys;
 | 
					    qCDebug(LOG_LIB) << "Used keys" << _usedKeys;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // remove dubs
 | 
					    // remove dubs
 | 
				
			||||||
    m_usedKeys = QSet<QString>::fromList(_usedKeys).toList();
 | 
					    // HACK converting to set may break order
 | 
				
			||||||
 | 
					    m_usedKeys.clear();
 | 
				
			||||||
 | 
					    for (auto key : _usedKeys) {
 | 
				
			||||||
 | 
					        if (m_usedKeys.contains(key))
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        m_usedKeys.append(key);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -415,9 +429,18 @@ void GraphicalItem::readConfiguration()
 | 
				
			|||||||
                .toString());
 | 
					                .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 == 5
 | 
				
			||||||
        if (apiVersion() < 2)
 | 
					        if (apiVersion() < 5) {
 | 
				
			||||||
            setNumber(bar().remove(QString("bar")).toInt());
 | 
					            QString prefix;
 | 
				
			||||||
 | 
					            prefix = m_activeColor.startsWith(QString("/"))
 | 
				
			||||||
 | 
					                         ? QString("file://%1")
 | 
				
			||||||
 | 
					                         : QString("color://%1");
 | 
				
			||||||
 | 
					            m_activeColor = prefix.arg(m_activeColor);
 | 
				
			||||||
 | 
					            prefix = m_inactiveColor.startsWith(QString("/"))
 | 
				
			||||||
 | 
					                         ? QString("file://%1")
 | 
				
			||||||
 | 
					                         : QString("color://%1");
 | 
				
			||||||
 | 
					            m_inactiveColor = prefix.arg(m_inactiveColor);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        settings.endGroup();
 | 
					        settings.endGroup();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -438,6 +461,7 @@ int GraphicalItem::showConfiguration(const QVariant args)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    ui->lineEdit_name->setText(name());
 | 
					    ui->lineEdit_name->setText(name());
 | 
				
			||||||
    ui->lineEdit_comment->setText(comment());
 | 
					    ui->lineEdit_comment->setText(comment());
 | 
				
			||||||
 | 
					    ui->label_numberValue->setText(QString("%1").arg(number()));
 | 
				
			||||||
    ui->checkBox_custom->setChecked(m_custom);
 | 
					    ui->checkBox_custom->setChecked(m_custom);
 | 
				
			||||||
    ui->comboBox_value->addItems(tags);
 | 
					    ui->comboBox_value->addItems(tags);
 | 
				
			||||||
    if (m_custom) {
 | 
					    if (m_custom) {
 | 
				
			||||||
@ -449,12 +473,16 @@ int GraphicalItem::showConfiguration(const QVariant args)
 | 
				
			|||||||
    ui->doubleSpinBox_max->setValue(m_maxValue);
 | 
					    ui->doubleSpinBox_max->setValue(m_maxValue);
 | 
				
			||||||
    ui->doubleSpinBox_min->setValue(m_minValue);
 | 
					    ui->doubleSpinBox_min->setValue(m_minValue);
 | 
				
			||||||
    ui->spinBox_count->setValue(m_count);
 | 
					    ui->spinBox_count->setValue(m_count);
 | 
				
			||||||
    ui->checkBox_activeCheck->setChecked(
 | 
					    if (m_helper->isColor(m_activeColor))
 | 
				
			||||||
        m_activeColor.startsWith(QString("/")));
 | 
					        ui->comboBox_activeImageType->setCurrentIndex(0);
 | 
				
			||||||
    ui->pushButton_activeColor->setText(m_activeColor);
 | 
					    else
 | 
				
			||||||
    ui->checkBox_inactiveCheck->setChecked(
 | 
					        ui->comboBox_activeImageType->setCurrentIndex(1);
 | 
				
			||||||
        m_inactiveColor.startsWith(QString("/")));
 | 
					    ui->lineEdit_activeColor->setText(m_activeColor);
 | 
				
			||||||
    ui->pushButton_inactiveColor->setText(m_inactiveColor);
 | 
					    if (m_helper->isColor(m_inactiveColor))
 | 
				
			||||||
 | 
					        ui->comboBox_inactiveImageType->setCurrentIndex(0);
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        ui->comboBox_inactiveImageType->setCurrentIndex(1);
 | 
				
			||||||
 | 
					    ui->lineEdit_inactiveColor->setText(m_inactiveColor);
 | 
				
			||||||
    ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
 | 
					    ui->comboBox_type->setCurrentIndex(static_cast<int>(m_type));
 | 
				
			||||||
    ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
 | 
					    ui->comboBox_direction->setCurrentIndex(static_cast<int>(m_direction));
 | 
				
			||||||
    ui->spinBox_height->setValue(m_height);
 | 
					    ui->spinBox_height->setValue(m_height);
 | 
				
			||||||
@ -477,8 +505,8 @@ int GraphicalItem::showConfiguration(const QVariant args)
 | 
				
			|||||||
                    : ui->comboBox_value->currentText());
 | 
					                    : ui->comboBox_value->currentText());
 | 
				
			||||||
    setMaxValue(ui->doubleSpinBox_max->value());
 | 
					    setMaxValue(ui->doubleSpinBox_max->value());
 | 
				
			||||||
    setMinValue(ui->doubleSpinBox_min->value());
 | 
					    setMinValue(ui->doubleSpinBox_min->value());
 | 
				
			||||||
    setActiveColor(ui->pushButton_activeColor->text().remove(QChar('&')));
 | 
					    setActiveColor(ui->lineEdit_activeColor->text());
 | 
				
			||||||
    setInactiveColor(ui->pushButton_inactiveColor->text().remove(QChar('&')));
 | 
					    setInactiveColor(ui->lineEdit_inactiveColor->text());
 | 
				
			||||||
    setStrType(ui->comboBox_type->currentText());
 | 
					    setStrType(ui->comboBox_type->currentText());
 | 
				
			||||||
    setStrDirection(ui->comboBox_direction->currentText());
 | 
					    setStrDirection(ui->comboBox_direction->currentText());
 | 
				
			||||||
    setHeight(ui->spinBox_height->value());
 | 
					    setHeight(ui->spinBox_height->value());
 | 
				
			||||||
@ -518,22 +546,20 @@ void GraphicalItem::writeConfiguration() const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void GraphicalItem::changeColor()
 | 
					void GraphicalItem::changeColor()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    QString outputColor;
 | 
					    QLineEdit *lineEdit;
 | 
				
			||||||
    bool imageRequired = sender() == ui->pushButton_activeColor
 | 
					    int state;
 | 
				
			||||||
                             ? ui->checkBox_activeCheck->isChecked()
 | 
					    if (sender() == ui->toolButton_activeColor) {
 | 
				
			||||||
                             : ui->checkBox_inactiveCheck->isChecked();
 | 
					        lineEdit = ui->lineEdit_activeColor;
 | 
				
			||||||
 | 
					        state = ui->comboBox_activeImageType->currentIndex();
 | 
				
			||||||
    if (imageRequired) {
 | 
					 | 
				
			||||||
        QString path = static_cast<QPushButton *>(sender())->text();
 | 
					 | 
				
			||||||
        QString directory = QFileInfo(path).absolutePath();
 | 
					 | 
				
			||||||
        outputColor = QFileDialog::getOpenFileName(
 | 
					 | 
				
			||||||
            this, tr("Select path"), directory,
 | 
					 | 
				
			||||||
            tr("Images (*.png *.bpm *.jpg);;All files (*.*)"));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        qCInfo(LOG_LIB) << "Selected path" << outputColor;
 | 
					 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        QColor color = m_helper->stringToColor(
 | 
					        lineEdit = ui->lineEdit_inactiveColor;
 | 
				
			||||||
            (static_cast<QPushButton *>(sender()))->text());
 | 
					        state = ui->comboBox_inactiveImageType->currentIndex();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    qCInfo(LOG_LIB) << "Using state" << state << "and lineEdit" << lineEdit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString outputColor;
 | 
				
			||||||
 | 
					    if (state == 0) {
 | 
				
			||||||
 | 
					        QColor color = m_helper->stringToColor(lineEdit->text());
 | 
				
			||||||
        QColor newColor = QColorDialog::getColor(
 | 
					        QColor newColor = QColorDialog::getColor(
 | 
				
			||||||
            color, this, tr("Select color"), QColorDialog::ShowAlphaChannel);
 | 
					            color, this, tr("Select color"), QColorDialog::ShowAlphaChannel);
 | 
				
			||||||
        if (!newColor.isValid())
 | 
					        if (!newColor.isValid())
 | 
				
			||||||
@ -546,10 +572,23 @@ 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()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        outputColor = colorText.join(QChar(','));
 | 
					        outputColor = QString("color://%1").arg(colorText.join(QChar(',')));
 | 
				
			||||||
 | 
					    } else if (state == 1) {
 | 
				
			||||||
 | 
					        QString path = lineEdit->text();
 | 
				
			||||||
 | 
					        QString directory = QFileInfo(path).absolutePath();
 | 
				
			||||||
 | 
					        outputColor = QFileDialog::getOpenFileUrl(
 | 
				
			||||||
 | 
					                          this, tr("Select path"), directory,
 | 
				
			||||||
 | 
					                          tr("Images (*.png *.bpm *.jpg);;All files (*.*)"))
 | 
				
			||||||
 | 
					                          .toString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        qCInfo(LOG_LIB) << "Selected path" << outputColor;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return static_cast<QPushButton *>(sender())->setText(outputColor);
 | 
					    if (outputColor.isEmpty()) {
 | 
				
			||||||
 | 
					        qCWarning(LOG_LIB) << "Empty color selected, skipping";
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return lineEdit->setText(outputColor);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -596,18 +635,24 @@ void GraphicalItem::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_count->setText(i18n("Points count"));
 | 
					    ui->label_number->setText(i18n("Tag"));
 | 
				
			||||||
    ui->checkBox_custom->setText(i18n("Use custom formula"));
 | 
					    ui->checkBox_custom->setText(i18n("Use custom formula"));
 | 
				
			||||||
    ui->label_value->setText(i18n("Value"));
 | 
					    ui->label_value->setText(i18n("Value"));
 | 
				
			||||||
    ui->label_customValue->setText(i18n("Value"));
 | 
					    ui->label_customValue->setText(i18n("Value"));
 | 
				
			||||||
    ui->label_max->setText(i18n("Max value"));
 | 
					    ui->label_max->setText(i18n("Max value"));
 | 
				
			||||||
    ui->label_min->setText(i18n("Min value"));
 | 
					    ui->label_min->setText(i18n("Min value"));
 | 
				
			||||||
    ui->checkBox_activeCheck->setText(i18n("Use image for active"));
 | 
					    ui->label_activeImageType->setText(i18n("Active image type"));
 | 
				
			||||||
    ui->label_activeColor->setText(i18n("Active color"));
 | 
					    ui->label_inactiveImageType->setText(i18n("Inctive image type"));
 | 
				
			||||||
    ui->checkBox_inactiveCheck->setText(i18n("Use image for inactive"));
 | 
					 | 
				
			||||||
    ui->label_inactiveColor->setText(i18n("Inactive color"));
 | 
					 | 
				
			||||||
    ui->label_type->setText(i18n("Type"));
 | 
					    ui->label_type->setText(i18n("Type"));
 | 
				
			||||||
 | 
					    ui->label_count->setText(i18n("Points count"));
 | 
				
			||||||
    ui->label_direction->setText(i18n("Direction"));
 | 
					    ui->label_direction->setText(i18n("Direction"));
 | 
				
			||||||
    ui->label_height->setText(i18n("Height"));
 | 
					    ui->label_height->setText(i18n("Height"));
 | 
				
			||||||
    ui->label_width->setText(i18n("Width"));
 | 
					    ui->label_width->setText(i18n("Width"));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ui->comboBox_activeImageType->clear();
 | 
				
			||||||
 | 
					    ui->comboBox_activeImageType->addItem(i18n("color"));
 | 
				
			||||||
 | 
					    ui->comboBox_activeImageType->addItem(i18n("image"));
 | 
				
			||||||
 | 
					    ui->comboBox_inactiveImageType->clear();
 | 
				
			||||||
 | 
					    ui->comboBox_inactiveImageType->addItem(i18n("color"));
 | 
				
			||||||
 | 
					    ui->comboBox_inactiveImageType->addItem(i18n("image"));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -49,8 +49,8 @@ class GraphicalItem : public AbstractExtItem
 | 
				
			|||||||
    Q_PROPERTY(int width READ width WRITE setWidth)
 | 
					    Q_PROPERTY(int width READ width WRITE setWidth)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
    enum Direction { LeftToRight = 0, RightToLeft };
 | 
					    enum class Direction { LeftToRight = 0, RightToLeft = 1 };
 | 
				
			||||||
    enum Type { Horizontal = 0, Vertical, Circle, Graph };
 | 
					    enum class Type { Horizontal = 0, Vertical, Circle, Graph, Bars };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    explicit GraphicalItem(QWidget *parent = nullptr,
 | 
					    explicit GraphicalItem(QWidget *parent = nullptr,
 | 
				
			||||||
                           const QString desktopName = QString(),
 | 
					                           const QString desktopName = QString(),
 | 
				
			||||||
@ -76,15 +76,16 @@ public:
 | 
				
			|||||||
    QString uniq() const;
 | 
					    QString uniq() const;
 | 
				
			||||||
    // set methods
 | 
					    // set methods
 | 
				
			||||||
    void setBar(const QString _bar = QString("cpu"));
 | 
					    void setBar(const QString _bar = QString("cpu"));
 | 
				
			||||||
    void setActiveColor(const QString _color = QString("0,0,0,130"));
 | 
					    void setActiveColor(const QString _color = QString("color://0,0,0,130"));
 | 
				
			||||||
    void setCount(const int _count = 100);
 | 
					    void setCount(const int _count = 100);
 | 
				
			||||||
    void setCustom(const bool _custom = false);
 | 
					    void setCustom(const bool _custom = false);
 | 
				
			||||||
    void setInactiveColor(const QString _color = QString("255,255,255,130"));
 | 
					    void setInactiveColor(const QString _color
 | 
				
			||||||
 | 
					                          = QString("color://255,255,255,130"));
 | 
				
			||||||
    void setMinValue(const float _value = 0.0);
 | 
					    void setMinValue(const float _value = 0.0);
 | 
				
			||||||
    void setMaxValue(const float _value = 100.0);
 | 
					    void setMaxValue(const float _value = 100.0);
 | 
				
			||||||
    void setType(const Type _type = Horizontal);
 | 
					    void setType(const Type _type = Type::Horizontal);
 | 
				
			||||||
    void setStrType(const QString _type = QString("Horizontal"));
 | 
					    void setStrType(const QString _type = QString("Horizontal"));
 | 
				
			||||||
    void setDirection(const Direction _direction = LeftToRight);
 | 
					    void setDirection(const Direction _direction = Direction::LeftToRight);
 | 
				
			||||||
    void setStrDirection(const QString _direction = QString("LeftToRight"));
 | 
					    void setStrDirection(const QString _direction = QString("LeftToRight"));
 | 
				
			||||||
    void setHeight(const int _height = 100);
 | 
					    void setHeight(const int _height = 100);
 | 
				
			||||||
    void setUsedKeys(const QStringList _usedKeys = QStringList());
 | 
					    void setUsedKeys(const QStringList _usedKeys = QStringList());
 | 
				
			||||||
@ -112,12 +113,12 @@ private:
 | 
				
			|||||||
    QString m_bar = QString("cpu");
 | 
					    QString m_bar = QString("cpu");
 | 
				
			||||||
    int m_count = 100;
 | 
					    int m_count = 100;
 | 
				
			||||||
    bool m_custom = false;
 | 
					    bool m_custom = false;
 | 
				
			||||||
    QString m_activeColor;
 | 
					    QString m_activeColor = QString("color://0,0,0,130");
 | 
				
			||||||
    QString m_inactiveColor;
 | 
					    QString m_inactiveColor = QString("color://255,255,255,130");
 | 
				
			||||||
    float m_minValue = 0.0f;
 | 
					    float m_minValue = 0.0f;
 | 
				
			||||||
    float m_maxValue = 100.0f;
 | 
					    float m_maxValue = 100.0f;
 | 
				
			||||||
    Type m_type = Horizontal;
 | 
					    Type m_type = Type::Horizontal;
 | 
				
			||||||
    Direction m_direction = LeftToRight;
 | 
					    Direction m_direction = Direction::LeftToRight;
 | 
				
			||||||
    int m_height = 100;
 | 
					    int m_height = 100;
 | 
				
			||||||
    QStringList m_usedKeys;
 | 
					    QStringList m_usedKeys;
 | 
				
			||||||
    int m_width = 100;
 | 
					    int m_width = 100;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@
 | 
				
			|||||||
    <x>0</x>
 | 
					    <x>0</x>
 | 
				
			||||||
    <y>0</y>
 | 
					    <y>0</y>
 | 
				
			||||||
    <width>416</width>
 | 
					    <width>416</width>
 | 
				
			||||||
    <height>537</height>
 | 
					    <height>569</height>
 | 
				
			||||||
   </rect>
 | 
					   </rect>
 | 
				
			||||||
  </property>
 | 
					  </property>
 | 
				
			||||||
  <property name="windowTitle">
 | 
					  <property name="windowTitle">
 | 
				
			||||||
@ -60,6 +60,27 @@
 | 
				
			|||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <layout class="QHBoxLayout" name="layout_number">
 | 
				
			||||||
 | 
					     <item>
 | 
				
			||||||
 | 
					      <widget class="QLabel" name="label_number">
 | 
				
			||||||
 | 
					       <property name="text">
 | 
				
			||||||
 | 
					        <string>Tag</string>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
 | 
					       <property name="alignment">
 | 
				
			||||||
 | 
					        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
 | 
					      </widget>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
 | 
					     <item>
 | 
				
			||||||
 | 
					      <widget class="QLabel" name="label_numberValue">
 | 
				
			||||||
 | 
					       <property name="text">
 | 
				
			||||||
 | 
					        <string/>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
 | 
					      </widget>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
 | 
					    </layout>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="Line" name="line_2">
 | 
					    <widget class="Line" name="line_2">
 | 
				
			||||||
     <property name="orientation">
 | 
					     <property name="orientation">
 | 
				
			||||||
@ -100,16 +121,7 @@
 | 
				
			|||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QWidget" name="widget_value" native="true">
 | 
					    <widget class="QWidget" name="widget_value" native="true">
 | 
				
			||||||
     <layout class="QHBoxLayout" name="layout_value">
 | 
					     <layout class="QHBoxLayout" name="layout_value">
 | 
				
			||||||
      <property name="leftMargin">
 | 
					      <property name="margin">
 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="topMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="rightMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="bottomMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					       <number>0</number>
 | 
				
			||||||
      </property>
 | 
					      </property>
 | 
				
			||||||
      <item>
 | 
					      <item>
 | 
				
			||||||
@ -135,16 +147,7 @@
 | 
				
			|||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QWidget" name="widget_customValue" native="true">
 | 
					    <widget class="QWidget" name="widget_customValue" native="true">
 | 
				
			||||||
     <layout class="QHBoxLayout" name="layout_customValue">
 | 
					     <layout class="QHBoxLayout" name="layout_customValue">
 | 
				
			||||||
      <property name="leftMargin">
 | 
					      <property name="margin">
 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="topMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="rightMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="bottomMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					       <number>0</number>
 | 
				
			||||||
      </property>
 | 
					      </property>
 | 
				
			||||||
      <item>
 | 
					      <item>
 | 
				
			||||||
@ -219,54 +222,11 @@
 | 
				
			|||||||
    </widget>
 | 
					    </widget>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <layout class="QHBoxLayout" name="layout_activeCheck">
 | 
					    <layout class="QHBoxLayout" name="layout_activeImageType">
 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
      <spacer name="spacer_activeCheck">
 | 
					      <widget class="QLabel" name="label_activeImageType">
 | 
				
			||||||
       <property name="orientation">
 | 
					 | 
				
			||||||
        <enum>Qt::Horizontal</enum>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
       <property name="sizeHint" stdset="0">
 | 
					 | 
				
			||||||
        <size>
 | 
					 | 
				
			||||||
         <width>40</width>
 | 
					 | 
				
			||||||
         <height>20</height>
 | 
					 | 
				
			||||||
        </size>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
      </spacer>
 | 
					 | 
				
			||||||
     </item>
 | 
					 | 
				
			||||||
     <item>
 | 
					 | 
				
			||||||
      <widget class="QCheckBox" name="checkBox_activeCheck">
 | 
					 | 
				
			||||||
       <property name="sizePolicy">
 | 
					 | 
				
			||||||
        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
 | 
					 | 
				
			||||||
         <horstretch>0</horstretch>
 | 
					 | 
				
			||||||
         <verstretch>0</verstretch>
 | 
					 | 
				
			||||||
        </sizepolicy>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
       <property name="text">
 | 
					       <property name="text">
 | 
				
			||||||
        <string>Use image for active</string>
 | 
					        <string>Active image type</string>
 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
      </widget>
 | 
					 | 
				
			||||||
     </item>
 | 
					 | 
				
			||||||
    </layout>
 | 
					 | 
				
			||||||
   </item>
 | 
					 | 
				
			||||||
   <item>
 | 
					 | 
				
			||||||
    <widget class="QWidget" name="widget_activeColor" native="true">
 | 
					 | 
				
			||||||
     <layout class="QHBoxLayout" name="layout_activeColor">
 | 
					 | 
				
			||||||
      <property name="leftMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="topMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="rightMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="bottomMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <item>
 | 
					 | 
				
			||||||
       <widget class="QLabel" name="label_activeColor">
 | 
					 | 
				
			||||||
        <property name="text">
 | 
					 | 
				
			||||||
         <string>Active color</string>
 | 
					 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
       <property name="alignment">
 | 
					       <property name="alignment">
 | 
				
			||||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
					        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
				
			||||||
@ -274,64 +234,34 @@
 | 
				
			|||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
       <widget class="QPushButton" name="pushButton_activeColor">
 | 
					      <widget class="QComboBox" name="comboBox_activeImageType"/>
 | 
				
			||||||
        <property name="text">
 | 
					 | 
				
			||||||
         <string notr="true"/>
 | 
					 | 
				
			||||||
        </property>
 | 
					 | 
				
			||||||
       </widget>
 | 
					 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <layout class="QHBoxLayout" name="layout_activeColorButton">
 | 
				
			||||||
 | 
					     <item>
 | 
				
			||||||
 | 
					      <widget class="QLineEdit" name="lineEdit_activeColor">
 | 
				
			||||||
 | 
					       <property name="readOnly">
 | 
				
			||||||
 | 
					        <bool>true</bool>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
    <layout class="QHBoxLayout" name="layout_inactiveCheck">
 | 
					      <widget class="QToolButton" name="toolButton_activeColor">
 | 
				
			||||||
     <item>
 | 
					 | 
				
			||||||
      <spacer name="spacer_inactiveCheck">
 | 
					 | 
				
			||||||
       <property name="orientation">
 | 
					 | 
				
			||||||
        <enum>Qt::Horizontal</enum>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
       <property name="sizeHint" stdset="0">
 | 
					 | 
				
			||||||
        <size>
 | 
					 | 
				
			||||||
         <width>40</width>
 | 
					 | 
				
			||||||
         <height>20</height>
 | 
					 | 
				
			||||||
        </size>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
      </spacer>
 | 
					 | 
				
			||||||
     </item>
 | 
					 | 
				
			||||||
     <item>
 | 
					 | 
				
			||||||
      <widget class="QCheckBox" name="checkBox_inactiveCheck">
 | 
					 | 
				
			||||||
       <property name="sizePolicy">
 | 
					 | 
				
			||||||
        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
 | 
					 | 
				
			||||||
         <horstretch>0</horstretch>
 | 
					 | 
				
			||||||
         <verstretch>0</verstretch>
 | 
					 | 
				
			||||||
        </sizepolicy>
 | 
					 | 
				
			||||||
       </property>
 | 
					 | 
				
			||||||
       <property name="text">
 | 
					       <property name="text">
 | 
				
			||||||
        <string>Use image for inactive</string>
 | 
					        <string>...</string>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QWidget" name="widget_inactiveColor" native="true">
 | 
					    <layout class="QHBoxLayout" name="layout_inactiveImageType">
 | 
				
			||||||
     <layout class="QHBoxLayout" name="layout_inactiveColor">
 | 
					 | 
				
			||||||
      <property name="leftMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="topMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="rightMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="bottomMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
       <widget class="QLabel" name="label_inactiveColor">
 | 
					      <widget class="QLabel" name="label_inactiveImageType">
 | 
				
			||||||
       <property name="text">
 | 
					       <property name="text">
 | 
				
			||||||
         <string>Inactive color</string>
 | 
					        <string>Inactive image type</string>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
       <property name="alignment">
 | 
					       <property name="alignment">
 | 
				
			||||||
        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
					        <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
 | 
				
			||||||
@ -339,14 +269,27 @@
 | 
				
			|||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
     <item>
 | 
					     <item>
 | 
				
			||||||
       <widget class="QPushButton" name="pushButton_inactiveColor">
 | 
					      <widget class="QComboBox" name="comboBox_inactiveImageType"/>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
 | 
					    </layout>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <layout class="QHBoxLayout" name="layout_inactiveColorButton">
 | 
				
			||||||
 | 
					     <item>
 | 
				
			||||||
 | 
					      <widget class="QLineEdit" name="lineEdit_inactiveColor">
 | 
				
			||||||
 | 
					       <property name="readOnly">
 | 
				
			||||||
 | 
					        <bool>true</bool>
 | 
				
			||||||
 | 
					       </property>
 | 
				
			||||||
 | 
					      </widget>
 | 
				
			||||||
 | 
					     </item>
 | 
				
			||||||
 | 
					     <item>
 | 
				
			||||||
 | 
					      <widget class="QToolButton" name="toolButton_inactiveColor">
 | 
				
			||||||
       <property name="text">
 | 
					       <property name="text">
 | 
				
			||||||
         <string notr="true"/>
 | 
					        <string>...</string>
 | 
				
			||||||
       </property>
 | 
					       </property>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
    </widget>
 | 
					 | 
				
			||||||
   </item>
 | 
					   </item>
 | 
				
			||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <layout class="QHBoxLayout" name="layout_type">
 | 
					    <layout class="QHBoxLayout" name="layout_type">
 | 
				
			||||||
@ -382,6 +325,11 @@
 | 
				
			|||||||
         <string notr="true">Graph</string>
 | 
					         <string notr="true">Graph</string>
 | 
				
			||||||
        </property>
 | 
					        </property>
 | 
				
			||||||
       </item>
 | 
					       </item>
 | 
				
			||||||
 | 
					       <item>
 | 
				
			||||||
 | 
					        <property name="text">
 | 
				
			||||||
 | 
					         <string notr="true">Bars</string>
 | 
				
			||||||
 | 
					        </property>
 | 
				
			||||||
 | 
					       </item>
 | 
				
			||||||
      </widget>
 | 
					      </widget>
 | 
				
			||||||
     </item>
 | 
					     </item>
 | 
				
			||||||
    </layout>
 | 
					    </layout>
 | 
				
			||||||
@ -417,16 +365,7 @@
 | 
				
			|||||||
   <item>
 | 
					   <item>
 | 
				
			||||||
    <widget class="QWidget" name="widget_count" native="true">
 | 
					    <widget class="QWidget" name="widget_count" native="true">
 | 
				
			||||||
     <layout class="QHBoxLayout" name="layout_count">
 | 
					     <layout class="QHBoxLayout" name="layout_count">
 | 
				
			||||||
      <property name="leftMargin">
 | 
					      <property name="margin">
 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="topMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="rightMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					 | 
				
			||||||
      </property>
 | 
					 | 
				
			||||||
      <property name="bottomMargin">
 | 
					 | 
				
			||||||
       <number>0</number>
 | 
					       <number>0</number>
 | 
				
			||||||
      </property>
 | 
					      </property>
 | 
				
			||||||
      <item>
 | 
					      <item>
 | 
				
			||||||
 | 
				
			|||||||
@ -50,29 +50,29 @@ void GraphicalItemHelper::setParameters(const QString active,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    // put images to pens if any otherwise set pen colors
 | 
					    // put images to pens if any otherwise set pen colors
 | 
				
			||||||
    // Images resize to content here as well
 | 
					    // Images resize to content here as well
 | 
				
			||||||
    if (active.startsWith(QString("/"))) {
 | 
					    if (isColor(active)) {
 | 
				
			||||||
 | 
					        m_activePen.setBrush(QBrush(stringToColor(active)));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
        qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << active;
 | 
					        qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << active;
 | 
				
			||||||
        QPixmap pixmap = QPixmap(active);
 | 
					        QPixmap pixmap = QPixmap(active);
 | 
				
			||||||
        if (pixmap.isNull()) {
 | 
					        if (pixmap.isNull()) {
 | 
				
			||||||
            qCInfo(LOG_LIB) << "Invalid pixmap found" << active;
 | 
					            qCInfo(LOG_LIB) << "Invalid pixmap found" << active;
 | 
				
			||||||
            m_activePen.setColor(QColor(0, 0, 0, 130));
 | 
					            m_activePen.setBrush(QBrush(QColor(0, 0, 0, 130)));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            m_activePen.setBrush(QBrush(pixmap.scaled(width, height)));
 | 
					            m_activePen.setBrush(QBrush(pixmap.scaled(width, height)));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        m_activePen.setColor(stringToColor(active));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (inactive.startsWith(QString("/"))) {
 | 
					    if (isColor(inactive)) {
 | 
				
			||||||
 | 
					        m_inactivePen.setBrush(QBrush(stringToColor(inactive)));
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
        qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << inactive;
 | 
					        qCInfo(LOG_LIB) << "Found path, trying to load Pixmap from" << inactive;
 | 
				
			||||||
        QPixmap pixmap = QPixmap(inactive);
 | 
					        QPixmap pixmap = QPixmap(inactive);
 | 
				
			||||||
        if (pixmap.isNull()) {
 | 
					        if (pixmap.isNull()) {
 | 
				
			||||||
            qCInfo(LOG_LIB) << "Invalid pixmap found" << inactive;
 | 
					            qCInfo(LOG_LIB) << "Invalid pixmap found" << inactive;
 | 
				
			||||||
            m_inactivePen.setColor(QColor(255, 255, 255, 130));
 | 
					            m_inactivePen.setBrush(QBrush(QColor(255, 255, 255, 130)));
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            m_inactivePen.setBrush(QBrush(pixmap.scaled(width, height)));
 | 
					            m_inactivePen.setBrush(QBrush(pixmap.scaled(width, height)));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        m_inactivePen.setColor(stringToColor(inactive));
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    m_width = width;
 | 
					    m_width = width;
 | 
				
			||||||
    m_height = height;
 | 
					    m_height = height;
 | 
				
			||||||
@ -80,6 +80,30 @@ void GraphicalItemHelper::setParameters(const QString active,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void GraphicalItemHelper::paintBars(const float &value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    qCDebug(LOG_LIB) << "Paint with value" << value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // refresh background image
 | 
				
			||||||
 | 
					    m_scene->setBackgroundBrush(m_inactivePen.brush());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    storeValue(value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // default norms
 | 
				
			||||||
 | 
					    float normX
 | 
				
			||||||
 | 
					        = static_cast<float>(m_width) / static_cast<float>(m_values.count());
 | 
				
			||||||
 | 
					    float normY = static_cast<float>(m_height - 1);
 | 
				
			||||||
 | 
					    // paint graph
 | 
				
			||||||
 | 
					    for (int i = 0; i < m_values.count(); i++) {
 | 
				
			||||||
 | 
					        float x = i * normX;
 | 
				
			||||||
 | 
					        float y = 0.5f;
 | 
				
			||||||
 | 
					        float width = normX;
 | 
				
			||||||
 | 
					        float height = m_values.at(i) * normY + 0.5f;
 | 
				
			||||||
 | 
					        m_scene->addRect(x, y, width, height, m_activePen, m_activePen.brush());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void GraphicalItemHelper::paintCircle(const float &percent)
 | 
					void GraphicalItemHelper::paintCircle(const float &percent)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_LIB) << "Paint with percent" << percent;
 | 
					    qCDebug(LOG_LIB) << "Paint with percent" << percent;
 | 
				
			||||||
@ -120,9 +144,9 @@ void GraphicalItemHelper::paintGraph(const float &value)
 | 
				
			|||||||
    for (int i = 0; i < m_values.count() - 1; i++) {
 | 
					    for (int i = 0; i < m_values.count() - 1; i++) {
 | 
				
			||||||
        // some magic here
 | 
					        // some magic here
 | 
				
			||||||
        float x1 = i * normX;
 | 
					        float x1 = i * normX;
 | 
				
			||||||
        float y1 = -fabs(m_values.at(i)) * normY + 0.5f;
 | 
					        float y1 = m_values.at(i) * normY + 0.5f;
 | 
				
			||||||
        float x2 = (i + 1) * normX;
 | 
					        float x2 = (i + 1) * normX;
 | 
				
			||||||
        float y2 = -fabs(m_values.at(i + 1)) * normY + 0.5f;
 | 
					        float y2 = m_values.at(i + 1) * normY + 0.5f;
 | 
				
			||||||
        m_scene->addLine(x1, y1, x2, y2, m_activePen);
 | 
					        m_scene->addLine(x1, y1, x2, y2, m_activePen);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -171,14 +195,25 @@ float GraphicalItemHelper::getPercents(const float &value, const float &min,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool GraphicalItemHelper::isColor(const QString &input)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    qCDebug(LOG_LIB) << "Define input type in" << input;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return input.startsWith(QString("color://"));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QColor GraphicalItemHelper::stringToColor(const QString &color)
 | 
					QColor GraphicalItemHelper::stringToColor(const QString &color)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    qCDebug(LOG_LIB) << "Color" << color;
 | 
					    qCDebug(LOG_LIB) << "Color" << color;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    QColor qColor;
 | 
					 | 
				
			||||||
    QStringList listColor = color.split(QChar(','));
 | 
					    QStringList listColor = color.split(QChar(','));
 | 
				
			||||||
    while (listColor.count() < 4)
 | 
					    while (listColor.count() < 4)
 | 
				
			||||||
        listColor.append(QString("0"));
 | 
					        listColor.append(QString("0"));
 | 
				
			||||||
 | 
					    // remove prefix
 | 
				
			||||||
 | 
					    listColor[0].remove(QString("color://"));
 | 
				
			||||||
 | 
					    // init color
 | 
				
			||||||
 | 
					    QColor qColor;
 | 
				
			||||||
    qColor.setRed(listColor.at(0).toInt());
 | 
					    qColor.setRed(listColor.at(0).toInt());
 | 
				
			||||||
    qColor.setGreen(listColor.at(1).toInt());
 | 
					    qColor.setGreen(listColor.at(1).toInt());
 | 
				
			||||||
    qColor.setBlue(listColor.at(2).toInt());
 | 
					    qColor.setBlue(listColor.at(2).toInt());
 | 
				
			||||||
 | 
				
			|||||||
@ -35,12 +35,14 @@ public:
 | 
				
			|||||||
    void setParameters(const QString active, const QString inactive,
 | 
					    void setParameters(const QString active, const QString inactive,
 | 
				
			||||||
                       const int width, const int height, const int count);
 | 
					                       const int width, const int height, const int count);
 | 
				
			||||||
    // paint methods
 | 
					    // paint methods
 | 
				
			||||||
 | 
					    void paintBars(const float &value);
 | 
				
			||||||
    void paintCircle(const float &percent);
 | 
					    void paintCircle(const float &percent);
 | 
				
			||||||
    void paintGraph(const float &value);
 | 
					    void paintGraph(const float &value);
 | 
				
			||||||
    void paintHorizontal(const float &percent);
 | 
					    void paintHorizontal(const float &percent);
 | 
				
			||||||
    void paintVertical(const float &percent);
 | 
					    void paintVertical(const float &percent);
 | 
				
			||||||
    // additional conversion methods
 | 
					    // additional conversion methods
 | 
				
			||||||
    float getPercents(const float &value, const float &min, const float &max);
 | 
					    float getPercents(const float &value, const float &min, const float &max);
 | 
				
			||||||
 | 
					    bool isColor(const QString &input);
 | 
				
			||||||
    QColor stringToColor(const QString &color);
 | 
					    QColor stringToColor(const QString &color);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
 | 
				
			|||||||
@ -24,7 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// configuraion
 | 
					// configuraion
 | 
				
			||||||
// graphical items api version
 | 
					// graphical items api version
 | 
				
			||||||
#define AWGIAPI 4
 | 
					#define AWGIAPI 5
 | 
				
			||||||
// extquotes api version
 | 
					// extquotes api version
 | 
				
			||||||
#define AWEQAPI 3
 | 
					#define AWEQAPI 3
 | 
				
			||||||
// extscript api version
 | 
					// extscript api version
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user