mirror of
				https://github.com/arcan1s/awesome-widgets.git
				synced 2025-10-30 21:03:41 +00:00 
			
		
		
		
	more correct fix for #57
This commit is contained in:
		| @ -24,12 +24,19 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: aboutPage | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|     AWActions { | ||||
|         id: awActions; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|  | ||||
|  | ||||
|     Column { | ||||
| @ -45,26 +52,26 @@ Item { | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         text: AWActions.getAboutText("header") | ||||
|                         text: awActions.getAboutText("header") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         text: AWActions.getAboutText("version") | ||||
|                         text: awActions.getAboutText("version") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         text: AWActions.getAboutText("description") | ||||
|                         text: awActions.getAboutText("description") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignLeft | ||||
|                         textFormat: Text.RichText | ||||
|                         text: AWActions.getAboutText("links") | ||||
|                         text: awActions.getAboutText("links") | ||||
|                         onLinkActivated: Qt.openUrlExternally(link); | ||||
|                     } | ||||
|  | ||||
| @ -75,7 +82,7 @@ Item { | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         verticalAlignment: Text.AlignBottom | ||||
|                         textFormat: Text.RichText | ||||
|                         text: AWActions.getAboutText("copy") | ||||
|                         text: awActions.getAboutText("copy") | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -88,7 +95,7 @@ Item { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         wrapMode: Text.WordWrap | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         text: AWActions.getAboutText("translators") | ||||
|                         text: awActions.getAboutText("translators") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
| @ -97,7 +104,7 @@ Item { | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         verticalAlignment: Text.AlignTop | ||||
|                         textFormat: Text.RichText | ||||
|                         text: AWActions.getAboutText("3rdparty") | ||||
|                         text: awActions.getAboutText("3rdparty") | ||||
|                         onLinkActivated: Qt.openUrlExternally(link); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
| @ -23,12 +23,17 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: advancedPage | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|  | ||||
|     property alias cfg_height: widgetHeight.value | ||||
|     property alias cfg_width: widgetWidth.value | ||||
|  | ||||
| @ -25,12 +25,17 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: appearancePage | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|     property variant weight: { | ||||
|         25: 0, | ||||
|         50: 1, | ||||
|  | ||||
| @ -26,12 +26,20 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: dataenginePage | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|     AWActions { | ||||
|         id: awActions; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|     property variant tooltipSettings: { | ||||
|         "tooltipNumber": plasmoid.configuration.tooltipNumber, | ||||
|         "useTooltipBackground": plasmoid.configuration.useTooltipBackground, | ||||
| @ -53,7 +61,7 @@ Item { | ||||
|         "batInTooltipColor": plasmoid.configuration.batInTooltipColor | ||||
|     } | ||||
|  | ||||
|     property variant cfg_dataengine: AWActions.readDataEngineConfiguration() | ||||
|     property variant cfg_dataengine: awActions.readDataEngineConfiguration() | ||||
|  | ||||
|     Column { | ||||
|         id: pageColumn | ||||
| @ -87,7 +95,7 @@ Item { | ||||
|             QtControls.Button { | ||||
|                 width: parent.width * 3 / 5 | ||||
|                 text: i18n("Edit scripts") | ||||
|                 onClicked: AWKeys.editItem("extscript") | ||||
|                 onClicked: awKeys.editItem("extscript") | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -128,7 +136,7 @@ Item { | ||||
|             QtControls.ComboBox { | ||||
|                 id: hdd | ||||
|                 width: parent.width * 3 / 5 | ||||
|                 model: AWKeys.getHddDevices(true) | ||||
|                 model: awKeys.getHddDevices(true) | ||||
|                 Component.onCompleted: { | ||||
|                     for (var i=0; i<model.length; i++) { | ||||
|                         if (model[i] == cfg_dataengine["HDDDEV"]) { | ||||
| @ -247,7 +255,7 @@ Item { | ||||
|             QtControls.Button { | ||||
|                 width: parent.width * 3 / 5 | ||||
|                 text: i18n("Edit tickers") | ||||
|                 onClicked: AWKeys.editItem("extquotes") | ||||
|                 onClicked: awKeys.editItem("extquotes") | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -264,7 +272,7 @@ Item { | ||||
|             QtControls.Button { | ||||
|                 width: parent.width * 3 / 5 | ||||
|                 text: i18n("Edit command") | ||||
|                 onClicked: AWKeys.editItem("extupgrade") | ||||
|                 onClicked: awKeys.editItem("extupgrade") | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| @ -273,7 +281,7 @@ Item { | ||||
|         if (debug) console.log("[dataengine::onCompleted]") | ||||
|  | ||||
|         // init submodule | ||||
|         AWKeys.initKeys(plasmoid.configuration.text) | ||||
|         awKeys.initKeys(plasmoid.configuration.text) | ||||
|     } | ||||
|  | ||||
|     Component.onDestruction: { | ||||
| @ -283,6 +291,6 @@ Item { | ||||
|         cfg_dataengine["HDDDEV"] = hdd.currentText | ||||
|         cfg_dataengine["PLAYER"] = player.currentText | ||||
|         cfg_dataengine["MPRIS"] = mpris.currentText | ||||
|         AWActions.writeDataEngineConfiguration(cfg_dataengine) | ||||
|         awActions.writeDataEngineConfiguration(cfg_dataengine) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -28,8 +28,15 @@ import "." | ||||
|  | ||||
| Item { | ||||
|     id: main | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|     AWActions { | ||||
|         id: awActions; | ||||
|     } | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|     property variant settings: { | ||||
|         "customTime": plasmoid.configuration.customTime, | ||||
|         "customUptime": plasmoid.configuration.customUptime, | ||||
| @ -86,13 +93,13 @@ Item { | ||||
|             // FIXME: ugly workaround to make some sources working | ||||
|             systemmonitorDE.interval = plasmoid.configuration.interval | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|  | ||||
|         onSourceAdded: { | ||||
|             if (debug) console.log("[main::onSourceAdded] : Source " + source) | ||||
|  | ||||
|             AWKeys.addDevice(source) | ||||
|             awKeys.addDevice(source) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -107,7 +114,7 @@ Item { | ||||
|             // FIXME: ugly workaround to make some sources working | ||||
|             extsysmonDE.interval = plasmoid.configuration.interval | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -120,7 +127,7 @@ Item { | ||||
|         onNewData: { | ||||
|             if (debug) console.log("[main::onNewData] : Update source " + sourceName) | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -167,8 +174,8 @@ Item { | ||||
|         // init submodule | ||||
|         Plasmoid.userConfiguringChanged(false) | ||||
|         // connect data | ||||
|         AWKeys.dropSourceFromDataengine.connect(dropSource) | ||||
|         AWKeys.needToBeUpdated.connect(needUpdate) | ||||
|         awKeys.dropSourceFromDataengine.connect(dropSource) | ||||
|         awKeys.needToBeUpdated.connect(needUpdate) | ||||
|     } | ||||
|  | ||||
|     onDropSource: { | ||||
| @ -181,8 +188,8 @@ Item { | ||||
|     onNeedUpdate: { | ||||
|         if (debug) console.log("[main::onNeedUpdate]") | ||||
|  | ||||
|         text.text = AWKeys.parsePattern(plasmoid.configuration.text) | ||||
|         tooltip.text = AWKeys.toolTipImage() | ||||
|         text.text = awKeys.parsePattern() | ||||
|         tooltip.text = awKeys.toolTipImage() | ||||
|  | ||||
|         sizeUpdate() | ||||
|     } | ||||
| @ -211,10 +218,10 @@ Item { | ||||
|         if (debug) console.log("[main::onUserConfiguringChanged]") | ||||
|  | ||||
|         // init submodule | ||||
|         AWKeys.initKeys() | ||||
|         AWKeys.initTooltip(tooltipSettings) | ||||
|         AWKeys.setPopupEnabled(plasmoid.configuration.notify) | ||||
|         AWKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines) | ||||
|         awKeys.initKeys(plasmoid.configuration.text) | ||||
|         awKeys.initTooltip(tooltipSettings) | ||||
|         awKeys.setPopupEnabled(plasmoid.configuration.notify) | ||||
|         awKeys.setWrapNewLines(plasmoid.configuration.wrapNewLines) | ||||
|  | ||||
|         needUpdate() | ||||
|     } | ||||
| @ -222,24 +229,24 @@ Item { | ||||
|     function action_checkUpdates() { | ||||
|         if (debug) console.log("[main::action_checkUpdates]") | ||||
|  | ||||
|         AWActions.checkUpdates() | ||||
|         awActions.checkUpdates() | ||||
|     } | ||||
|  | ||||
|     function action_showReadme() { | ||||
|         if (debug) console.log("[main::action_showReadme]") | ||||
|  | ||||
|         AWActions.showReadme() | ||||
|         awActions.showReadme() | ||||
|     } | ||||
|  | ||||
|     function action_report() { | ||||
|         if (debug) console.log("[main::action_report]") | ||||
|  | ||||
|         AWActions.sendEmail() | ||||
|         awActions.sendEmail() | ||||
|     } | ||||
|  | ||||
|     function action_requestKey() { | ||||
|         if (debug) console.log("[main::action_requestKey]") | ||||
|  | ||||
|         AWKeys.graphicalValueByKey() | ||||
|         awKeys.graphicalValueByKey() | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -25,12 +25,17 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: tooltipPage | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|  | ||||
|     property alias cfg_tooltipNumber: tooltipNumber.value | ||||
|     property alias cfg_useTooltipBackground: useTooltipBackground.checked | ||||
|  | ||||
| @ -24,12 +24,20 @@ import org.kde.plasma.private.awesomewidget 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: widgetPage | ||||
|     // backend | ||||
|     AWKeys { | ||||
|         id: awKeys; | ||||
|     } | ||||
|     AWActions { | ||||
|         id: awActions; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: awKeys.isDebugEnabled() | ||||
|     property variant settings: { | ||||
|         "customTime": plasmoid.configuration.customTime, | ||||
|         "customUptime": plasmoid.configuration.customUptime, | ||||
| @ -89,7 +97,7 @@ Item { | ||||
|                         "family": plasmoid.configuration.fontFamily, | ||||
|                         "size": plasmoid.configuration.fontSize | ||||
|                     } | ||||
|                     var font = AWActions.getFont(defaultFont) | ||||
|                     var font = awActions.getFont(defaultFont) | ||||
|                     var pos = textPattern.cursorPosition | ||||
|                     var selected = textPattern.selectedText | ||||
|                     textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) | ||||
| @ -249,10 +257,10 @@ Item { | ||||
|  | ||||
|                     var message = i18n("Tag: %1", tags.currentText) | ||||
|                     message += "<br>" | ||||
|                     message += i18n("Value: %1", AWKeys.valueByKey(tags.currentText)) | ||||
|                     message += i18n("Value: %1", awKeys.valueByKey(tags.currentText)) | ||||
|                     message += "<br>" | ||||
|                     message += i18n("Info: %1", AWKeys.infoByKey(tags.currentText)) | ||||
|                     AWActions.sendNotification("tag", message) | ||||
|                     message += i18n("Info: %1", awKeys.infoByKey(tags.currentText)) | ||||
|                     awActions.sendNotification("tag", message) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| @ -263,7 +271,7 @@ Item { | ||||
|             QtControls.Button { | ||||
|                 width: parent.width | ||||
|                 text: i18n("Edit bars") | ||||
|                 onClicked: AWKeys.editItem("graphicalitem") | ||||
|                 onClicked: awKeys.editItem("graphicalitem") | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -287,7 +295,7 @@ Item { | ||||
|         onNewData: { | ||||
|             if (debug) console.log("[widget::onNewData] : Update source " + sourceName) | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -300,7 +308,7 @@ Item { | ||||
|         onNewData: { | ||||
|             if (debug) console.log("[widget::onNewData] : Update source " + sourceName) | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -313,7 +321,7 @@ Item { | ||||
|         onNewData: { | ||||
|             if (debug) console.log("[widget::onNewData] : Update source " + sourceName) | ||||
|  | ||||
|             AWKeys.setDataBySource(sourceName, data, settings) | ||||
|             awKeys.setDataBySource(sourceName, data, settings) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -321,7 +329,7 @@ Item { | ||||
|         if (debug) console.log("[widget::onCompleted]") | ||||
|  | ||||
|         // init submodule | ||||
|         AWKeys.initKeys(plasmoid.configuration.text) | ||||
|         tags.model = AWKeys.dictKeys(true) | ||||
|         awKeys.initKeys(plasmoid.configuration.text) | ||||
|         tags.model = awKeys.dictKeys(true) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -23,28 +23,10 @@ | ||||
| #include "awkeys.h" | ||||
|  | ||||
|  | ||||
| static QObject *awactions_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) | ||||
| { | ||||
|     Q_UNUSED(engine); | ||||
|     Q_UNUSED(scriptEngine); | ||||
|  | ||||
|     return new AWActions(); | ||||
| } | ||||
|  | ||||
|  | ||||
| static QObject *awkeys_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) | ||||
| { | ||||
|     Q_UNUSED(engine); | ||||
|     Q_UNUSED(scriptEngine); | ||||
|  | ||||
|     return new AWKeys(); | ||||
| } | ||||
|  | ||||
|  | ||||
| void AWPlugin::registerTypes(const char *uri) | ||||
| { | ||||
|     Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.awesomewidget")); | ||||
|  | ||||
|     qmlRegisterSingletonType<AWActions>(uri, 1, 0, "AWActions", awactions_singletontype_provider); | ||||
|     qmlRegisterSingletonType<AWKeys>(uri, 1, 0, "AWKeys", awkeys_singletontype_provider); | ||||
|     qmlRegisterType<AWActions>(uri, 1, 0, "AWActions"); | ||||
|     qmlRegisterType<AWKeys>(uri, 1, 0, "AWKeys"); | ||||
| } | ||||
|  | ||||
| @ -86,7 +86,7 @@ AWKeys::~AWKeys() | ||||
| } | ||||
|  | ||||
|  | ||||
| void AWKeys::initKeys() | ||||
| void AWKeys::initKeys(const QString currentPattern) | ||||
| { | ||||
|     if (debug) qDebug() << PDEBUG; | ||||
|  | ||||
| @ -100,6 +100,7 @@ void AWKeys::initKeys() | ||||
|     foundKeys.clear(); | ||||
|  | ||||
|     // init | ||||
|     pattern = currentPattern; | ||||
|     extQuotes = getExtQuotes(); | ||||
|     extScripts = getExtScripts(); | ||||
|     extUpgrade = getExtUpgrade(); | ||||
| @ -145,18 +146,12 @@ bool AWKeys::isDebugEnabled() | ||||
| } | ||||
|  | ||||
|  | ||||
| QString AWKeys::parsePattern(const QString currentPattern) | ||||
| QString AWKeys::parsePattern() | ||||
| { | ||||
|     if (debug) qDebug() << PDEBUG; | ||||
|     if (keys.isEmpty()) return currentPattern; | ||||
|     if (keys.isEmpty()) return pattern; | ||||
|  | ||||
|     // get key data | ||||
|     if ((foundBars.isEmpty()) && (foundKeys.isEmpty())) { | ||||
|         foundBars = findGraphicalItems(currentPattern); | ||||
|         foundKeys = findKeys(currentPattern); | ||||
|     } | ||||
|  | ||||
|     QString parsed = currentPattern; | ||||
|     QString parsed = pattern; | ||||
|     parsed.replace(QString("$$"), QString("$\\$\\")); | ||||
|     for (int i=0; i<foundKeys.count(); i++) | ||||
|         parsed.replace(QString("$%1").arg(foundKeys[i]), htmlValue(foundKeys[i])); | ||||
| @ -854,6 +849,8 @@ void AWKeys::reinitKeys() | ||||
|     if (debug) qDebug() << PDEBUG; | ||||
|  | ||||
|     keys = dictKeys(); | ||||
|     foundBars = findGraphicalItems(); | ||||
|     foundKeys = findKeys(); | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -1328,7 +1325,7 @@ float AWKeys::temperature(const float temp, const QString units) | ||||
| } | ||||
|  | ||||
|  | ||||
| QStringList AWKeys::findGraphicalItems(const QString pattern) | ||||
| QStringList AWKeys::findGraphicalItems() | ||||
| { | ||||
|     if (debug) qDebug() << PDEBUG; | ||||
|  | ||||
| @ -1348,7 +1345,7 @@ QStringList AWKeys::findGraphicalItems(const QString pattern) | ||||
| } | ||||
|  | ||||
|  | ||||
| QStringList AWKeys::findKeys(const QString pattern) | ||||
| QStringList AWKeys::findKeys() | ||||
| { | ||||
|     QStringList selectedKeys; | ||||
|     for (int i=0; i<keys.count(); i++) { | ||||
|  | ||||
| @ -51,12 +51,12 @@ public: | ||||
|     AWKeys(QObject *parent = nullptr); | ||||
|     ~AWKeys(); | ||||
|  | ||||
|     Q_INVOKABLE void initKeys(); | ||||
|     Q_INVOKABLE void initKeys(const QString currentPattern); | ||||
|     Q_INVOKABLE void initTooltip(const QVariantMap tooltipParams); | ||||
|     Q_INVOKABLE void setPopupEnabled(const bool popup = false); | ||||
|     Q_INVOKABLE void setWrapNewLines(const bool wrap = false); | ||||
|     Q_INVOKABLE bool isDebugEnabled(); | ||||
|     Q_INVOKABLE QString parsePattern(const QString currentPattern); | ||||
|     Q_INVOKABLE QString parsePattern(); | ||||
|     Q_INVOKABLE QString toolTipImage(); | ||||
|     Q_INVOKABLE QSize toolTipSize(); | ||||
|     // keys | ||||
| @ -94,8 +94,8 @@ private: | ||||
|     int numberCpus(); | ||||
|     float temperature(const float temp, const QString units); | ||||
|     // find methods | ||||
|     QStringList findGraphicalItems(const QString pattern); | ||||
|     QStringList findKeys(const QString pattern); | ||||
|     QStringList findGraphicalItems(); | ||||
|     QStringList findKeys(); | ||||
|      // get methods | ||||
|     // get methods | ||||
|     QList<ExtQuotes *> getExtQuotes(); | ||||
| @ -121,6 +121,7 @@ private: | ||||
|     QList<ExtQuotes *> extQuotes; | ||||
|     QList<ExtScript *> extScripts; | ||||
|     QList<ExtUpgrade *> extUpgrade; | ||||
|     QString pattern; | ||||
|     QStringList foundBars, foundKeys, keys; | ||||
|     QMap<QString, QString> values; | ||||
|     QStringList diskDevices, hddDevices, mountDevices, networkDevices, tempDevices; | ||||
|  | ||||
| @ -24,12 +24,17 @@ import org.kde.plasma.private.desktoppanel 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: aboutPage | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: DPAdds.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|  | ||||
|  | ||||
|     Column { | ||||
| @ -45,26 +50,26 @@ Item { | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         text: DPAdds.getAboutText("header") | ||||
|                         text: dpAdds.getAboutText("header") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         text: DPAdds.getAboutText("version") | ||||
|                         text: dpAdds.getAboutText("version") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         text: DPAdds.getAboutText("description") | ||||
|                         text: dpAdds.getAboutText("description") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         horizontalAlignment: Text.AlignLeft | ||||
|                         textFormat: Text.RichText | ||||
|                         text: DPAdds.getAboutText("links") | ||||
|                         text: dpAdds.getAboutText("links") | ||||
|                         onLinkActivated: Qt.openUrlExternally(link); | ||||
|                     } | ||||
|  | ||||
| @ -75,7 +80,7 @@ Item { | ||||
|                         horizontalAlignment: Text.AlignHCenter | ||||
|                         verticalAlignment: Text.AlignBottom | ||||
|                         textFormat: Text.RichText | ||||
|                         text: DPAdds.getAboutText("copy") | ||||
|                         text: dpAdds.getAboutText("copy") | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| @ -88,7 +93,7 @@ Item { | ||||
|                         QtLayouts.Layout.fillWidth: true | ||||
|                         wrapMode: Text.WordWrap | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         text: DPAdds.getAboutText("translators") | ||||
|                         text: dpAdds.getAboutText("translators") | ||||
|                     } | ||||
|  | ||||
|                     QtControls.Label { | ||||
| @ -97,7 +102,7 @@ Item { | ||||
|                         horizontalAlignment: Text.AlignJustify | ||||
|                         verticalAlignment: Text.AlignTop | ||||
|                         textFormat: Text.RichText | ||||
|                         text: DPAdds.getAboutText("3rdparty") | ||||
|                         text: dpAdds.getAboutText("3rdparty") | ||||
|                         onLinkActivated: Qt.openUrlExternally(link); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
| @ -25,12 +25,17 @@ import org.kde.plasma.private.desktoppanel 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: activeAppearancePage | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: DPAdds.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|     property variant weight: { | ||||
|         25: 0, | ||||
|         50: 1, | ||||
|  | ||||
| @ -25,12 +25,17 @@ import org.kde.plasma.private.desktoppanel 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: advancedPage | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|      | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: DPAdds.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|  | ||||
|     property alias cfg_height: widgetHeight.value | ||||
|     property alias cfg_width: widgetWidth.value | ||||
| @ -237,7 +242,7 @@ Item { | ||||
| //             QtControls.Button { | ||||
| //                 width: parent.width * 3 / 5 | ||||
| //                 text: i18n("Edit panels") | ||||
| //                 onClicked: cfg_panels = DPAdds.editPanelsToContol(plasmoid.configuration.panels) | ||||
| //                 onClicked: cfg_panels = dpAdds.editPanelsToContol(plasmoid.configuration.panels) | ||||
| //             } | ||||
| //         } | ||||
|     } | ||||
|  | ||||
| @ -25,12 +25,17 @@ import org.kde.plasma.private.desktoppanel 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: inactiveAppearancePage | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: AWKeys.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|     property variant weight: { | ||||
|         25: 0, | ||||
|         50: 1, | ||||
|  | ||||
| @ -28,8 +28,12 @@ import "." | ||||
|  | ||||
| Item { | ||||
|     id: main | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|  | ||||
|     property bool debug: DPAdds.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|     property variant tooltipSettings: { | ||||
|         "tooltipColor": plasmoid.configuration.tooltipColor, | ||||
|         "tooltipType": plasmoid.configuration.tooltipType, | ||||
| @ -54,14 +58,14 @@ Item { | ||||
|     // ui | ||||
|     GridLayout { | ||||
|         anchors.fill: parent | ||||
|         columns: plasmoid.configuration.verticalLayout ? 1 : DPAdds.numberOfDesktops() | ||||
|         rows: plasmoid.configuration.verticalLayout ? DPAdds.numberOfDesktops() : 1 | ||||
|         columns: plasmoid.configuration.verticalLayout ? 1 : dpAdds.numberOfDesktops() | ||||
|         rows: plasmoid.configuration.verticalLayout ? dpAdds.numberOfDesktops() : 1 | ||||
|  | ||||
|         Repeater { | ||||
|             id: repeater | ||||
|             Layout.columnSpan: 0 | ||||
|             Layout.rowSpan: 0 | ||||
|             model: DPAdds.numberOfDesktops() | ||||
|             model: dpAdds.numberOfDesktops() | ||||
|  | ||||
|             Text { | ||||
|                 id: text | ||||
| @ -73,13 +77,13 @@ Item { | ||||
|  | ||||
|                 verticalAlignment: Text.AlignVCenter | ||||
|  | ||||
|                 text: DPAdds.parsePattern(plasmoid.configuration.text, index + 1) | ||||
|                 text: dpAdds.parsePattern(plasmoid.configuration.text, index + 1) | ||||
|                 property alias tooltip: tooltip | ||||
|  | ||||
|                 MouseArea { | ||||
|                     hoverEnabled: true | ||||
|                     anchors.fill: parent | ||||
|                     onClicked: DPAdds.setCurrentDesktop(index + 1); | ||||
|                     onClicked: dpAdds.setCurrentDesktop(index + 1); | ||||
|                     onEntered: needTooltipUpdate() | ||||
|                 } | ||||
|  | ||||
| @ -112,8 +116,8 @@ Item { | ||||
|                 timer.start() | ||||
|                 return | ||||
|             } | ||||
|             repeater.itemAt(i).text = DPAdds.parsePattern(plasmoid.configuration.text, i + 1) | ||||
|             if (DPAdds.currentDesktop() == i + 1) { | ||||
|             repeater.itemAt(i).text = dpAdds.parsePattern(plasmoid.configuration.text, i + 1) | ||||
|             if (dpAdds.currentDesktop() == i + 1) { | ||||
|                 repeater.itemAt(i).color = plasmoid.configuration.currentFontColor | ||||
|                 repeater.itemAt(i).font.family = plasmoid.configuration.currentFontFamily | ||||
|                 repeater.itemAt(i).font.italic = plasmoid.configuration.currentFontStyle == "italic" ? true : false | ||||
| @ -137,7 +141,7 @@ Item { | ||||
|         if (debug) console.log("[main::onNeedTooltipUpdate]") | ||||
|  | ||||
|         for (var i=0; i<repeater.count; i++) { | ||||
|             repeater.itemAt(i).tooltip.text = DPAdds.toolTipImage(i + 1) | ||||
|             repeater.itemAt(i).tooltip.text = dpAdds.toolTipImage(i + 1) | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @ -169,16 +173,16 @@ Item { | ||||
|     Plasmoid.onActivated: { | ||||
|         if (debug) console.log("[main::onActivated]") | ||||
|  | ||||
| //         DPAdds.changePanelsState() | ||||
| //         dpAdds.changePanelsState() | ||||
|     } | ||||
|  | ||||
|     Plasmoid.onUserConfiguringChanged: { | ||||
|         if (plasmoid.userConfiguring) return | ||||
|         if (debug) console.log("[main::onUserConfiguringChanged]") | ||||
|  | ||||
|         DPAdds.setMark(plasmoid.configuration.mark) | ||||
|         DPAdds.setPanelsToControl(plasmoid.configuration.panels) | ||||
|         DPAdds.setToolTipData(tooltipSettings) | ||||
|         dpAdds.setMark(plasmoid.configuration.mark) | ||||
|         dpAdds.setPanelsToControl(plasmoid.configuration.panels) | ||||
|         dpAdds.setToolTipData(tooltipSettings) | ||||
|  | ||||
|         needUpdate() | ||||
|     } | ||||
| @ -188,7 +192,7 @@ Item { | ||||
|  | ||||
|         // init submodule | ||||
|         Plasmoid.userConfiguringChanged(false) | ||||
|         DPAdds.desktopChanged.connect(needUpdate) | ||||
|         DPAdds.windowListChanged.connect(needTooltipUpdate) | ||||
|         dpAdds.desktopChanged.connect(needUpdate) | ||||
|         dpAdds.windowListChanged.connect(needTooltipUpdate) | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -23,12 +23,17 @@ import org.kde.plasma.private.desktoppanel 1.0 | ||||
|  | ||||
| Item { | ||||
|     id: widgetPage | ||||
|     // backend | ||||
|     DPAdds { | ||||
|         id: dpAdds; | ||||
|     } | ||||
|  | ||||
|     width: childrenRect.width | ||||
|     height: childrenRect.height | ||||
|     implicitWidth: pageColumn.implicitWidth | ||||
|     implicitHeight: pageColumn.implicitHeight | ||||
|  | ||||
|     property bool debug: DPAdds.isDebugEnabled() | ||||
|     property bool debug: dpAdds.isDebugEnabled() | ||||
|  | ||||
|     property alias cfg_text: textPattern.text | ||||
|  | ||||
| @ -61,7 +66,7 @@ Item { | ||||
|                         "family": plasmoid.configuration.fontFamily, | ||||
|                         "size": plasmoid.configuration.fontSize | ||||
|                     } | ||||
|                     var font = DPAdds.getFont(defaultFont) | ||||
|                     var font = dpAdds.getFont(defaultFont) | ||||
|                     var pos = textPattern.cursorPosition | ||||
|                     var selected = textPattern.selectedText | ||||
|                     textPattern.remove(textPattern.selectionStart, textPattern.selectionEnd) | ||||
| @ -198,7 +203,7 @@ Item { | ||||
|             QtControls.ComboBox { | ||||
|                 id: tags | ||||
|                 width: parent.width - addTagButton.width - showValueButton.width | ||||
|                 model: DPAdds.dictKeys() | ||||
|                 model: dpAdds.dictKeys() | ||||
|             } | ||||
|             QtControls.Button { | ||||
|                 id: addTagButton | ||||
| @ -222,8 +227,8 @@ Item { | ||||
|  | ||||
|                     var message = i18n("Tag: %1", tags.currentText) | ||||
|                     message += "<br>" | ||||
|                     message += i18n("Value: %1", DPAdds.valueByKey(tags.currentText)) | ||||
|                     DPAdds.sendNotification("tag", message) | ||||
|                     message += i18n("Value: %1", dpAdds.valueByKey(tags.currentText)) | ||||
|                     dpAdds.sendNotification("tag", message) | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
| @ -22,18 +22,9 @@ | ||||
| #include "dpadds.h" | ||||
|  | ||||
|  | ||||
| static QObject *dpadds_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) | ||||
| { | ||||
|     Q_UNUSED(engine); | ||||
|     Q_UNUSED(scriptEngine); | ||||
|  | ||||
|     return new DPAdds(); | ||||
| } | ||||
|  | ||||
|  | ||||
| void DPPlugin::registerTypes(const char *uri) | ||||
| { | ||||
|     Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.desktoppanel")); | ||||
|  | ||||
|     qmlRegisterSingletonType<DPAdds>(uri, 1, 0, "DPAdds", dpadds_singletontype_provider); | ||||
|     qmlRegisterType<DPAdds>(uri, 1, 0, "DPAdds"); | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user