mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +00:00
commit
83ec82debd
@ -1,3 +1,8 @@
|
||||
Ver.3.0.1:
|
||||
+ add patches for old Qt versions
|
||||
- drop `nullptr` checking
|
||||
* move dialogs to QML part
|
||||
|
||||
Ver.3.0.0:
|
||||
+ add tags upunits, downunits, upkb, downkb
|
||||
+ add tags dalbum, dartist, dtitle, salbum, sartist, stitle
|
||||
|
@ -1,3 +1,8 @@
|
||||
Вер.3.0.1:
|
||||
+ добавлены патчи для старых версий Qt
|
||||
- убрана проверка на nullptr
|
||||
* диалоги перемещены в QML
|
||||
|
||||
Вер.3.0.0:
|
||||
+ добавлены теги upunits, downunits, upkb, downkb
|
||||
+ добавлены теги dalbum, dartist, dtitle, salbum, sartist, stitle
|
||||
|
@ -81,6 +81,8 @@ for more details. To avoid manual labor there is automatic cmake target named
|
||||
* Create one file (source and header) per class.
|
||||
* `else if` construction is allowed and recommended.
|
||||
* 'true ? foo : bar' construction is allowed and recommended for one-line assignment.
|
||||
* any global pointer should be assign to `nullptr` after deletion and before
|
||||
initialization. Exception: if object is deleted into class destructor.
|
||||
|
||||
Comments
|
||||
--------
|
||||
@ -101,7 +103,7 @@ Development
|
||||
|
||||
* Officially the latest libraries versions should be used. In addition it is
|
||||
possible to add workarounds for all versions (usually by using preprocessor
|
||||
directives).
|
||||
directives); in this case patches should be placed to `packages` directory.
|
||||
* Build should not contain any warning.
|
||||
* Try to minimize message in Release build with logging disabled. It is highly
|
||||
recommended to fix KDE/Qt specific warning if possible
|
||||
@ -128,6 +130,8 @@ HIG
|
||||
---
|
||||
|
||||
The recommended HIG is [KDE one](https://techbase.kde.org/Projects/Usability/HIG).
|
||||
Avoid to paint interfaces inside plugin because QML and C++ parts may have different
|
||||
theming.
|
||||
|
||||
Licensing
|
||||
---------
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
pkgname=plasma5-applet-awesome-widgets
|
||||
_pkgname=awesome-widgets
|
||||
pkgver=3.0.0
|
||||
pkgver=3.0.1
|
||||
pkgrel=1
|
||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||
arch=('i686' 'x86_64')
|
||||
@ -17,7 +17,7 @@ optdepends=("catalyst: for GPU monitor"
|
||||
makedepends=('cmake' 'extra-cmake-modules')
|
||||
source=(https://github.com/arcan1s/awesome-widgets/releases/download/V.${pkgver}/${_pkgname}-${pkgver}-src.tar.xz)
|
||||
install=${pkgname}.install
|
||||
md5sums=('4878899f092ee12ad8f935f0551ef6b2')
|
||||
md5sums=('71f5b358d443075540377284ee868a93')
|
||||
backup=('etc/xdg/plasma-dataengine-extsysmon.conf')
|
||||
|
||||
prepare() {
|
||||
@ -28,8 +28,9 @@ prepare() {
|
||||
build () {
|
||||
cd "${srcdir}/build"
|
||||
cmake -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_BUILD_TYPE=Optimization \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DBUILD_FUTURE=ON \
|
||||
"../${_pkgname}"
|
||||
make
|
||||
}
|
||||
|
57
packages/qt5.3-qtconcurrent-and-qlogging-category.patch
Normal file
57
packages/qt5.3-qtconcurrent-and-qlogging-category.patch
Normal file
@ -0,0 +1,57 @@
|
||||
diff --git a/sources/awdebug.cpp b/sources/awdebug.cpp
|
||||
index eee61e1..9da8dad 100644
|
||||
--- a/sources/awdebug.cpp
|
||||
+++ b/sources/awdebug.cpp
|
||||
@@ -20,13 +20,10 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
-Q_LOGGING_CATEGORY(LOG_AW, "org.kde.plasma.awesomewidget",
|
||||
- QtMsgType::QtWarningMsg)
|
||||
-Q_LOGGING_CATEGORY(LOG_DP, "org.kde.plasma.desktoppanel",
|
||||
- QtMsgType::QtWarningMsg)
|
||||
-Q_LOGGING_CATEGORY(LOG_ESM, "org.kde.plasma.extsysmon", QtMsgType::QtWarningMsg)
|
||||
-Q_LOGGING_CATEGORY(LOG_LIB, "org.kde.plasma.awesomewidgets",
|
||||
- QtMsgType::QtWarningMsg)
|
||||
+Q_LOGGING_CATEGORY(LOG_AW, "org.kde.plasma.awesomewidget")
|
||||
+Q_LOGGING_CATEGORY(LOG_DP, "org.kde.plasma.desktoppanel")
|
||||
+Q_LOGGING_CATEGORY(LOG_ESM, "org.kde.plasma.extsysmon")
|
||||
+Q_LOGGING_CATEGORY(LOG_LIB, "org.kde.plasma.awesomewidgets")
|
||||
|
||||
|
||||
const QStringList getBuildData()
|
||||
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
|
||||
index e5b9861..eb73073 100644
|
||||
--- a/sources/awesome-widget/plugin/awkeys.cpp
|
||||
+++ b/sources/awesome-widget/plugin/awkeys.cpp
|
||||
@@ -439,7 +439,7 @@ void AWKeys::dataUpdated(const QString &sourceName,
|
||||
|
||||
#ifdef BUILD_FUTURE
|
||||
// run concurrent data update
|
||||
- QtConcurrent::run(m_threadPool, this, &AWKeys::setDataBySource, sourceName,
|
||||
+ QtConcurrent::run(this, &AWKeys::setDataBySource, sourceName,
|
||||
data);
|
||||
#else /* BUILD_FUTURE */
|
||||
return setDataBySource(sourceName, data);
|
||||
@@ -564,7 +564,7 @@ void AWKeys::reinitKeys()
|
||||
void AWKeys::updateTextData()
|
||||
{
|
||||
#ifdef BUILD_FUTURE
|
||||
- QFuture<QString> text = QtConcurrent::run(m_threadPool, [this]() {
|
||||
+ QFuture<QString> text = QtConcurrent::run([this]() {
|
||||
calculateValues();
|
||||
return parsePattern(m_pattern);
|
||||
});
|
||||
diff --git a/sources/libraries.cmake b/sources/libraries.cmake
|
||||
index 33192f7..46e2b1e 100644
|
||||
--- a/sources/libraries.cmake
|
||||
+++ b/sources/libraries.cmake
|
||||
@@ -2,7 +2,7 @@
|
||||
find_package(Gettext REQUIRED)
|
||||
|
||||
# main qt libraries
|
||||
-find_package(Qt5 5.4.0 REQUIRED COMPONENTS Core DBus Network Qml Widgets)
|
||||
+find_package(Qt5 5.3.0 REQUIRED COMPONENTS Core DBus Network Qml Widgets)
|
||||
add_definitions(
|
||||
${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Network_DEFINITIONS}
|
||||
${Qt5Qml_DEFINITIONS} ${Qt5Widgets_DEFINITIONS}
|
350
packages/qt5.4-replace-qml-dialogs.patch
Normal file
350
packages/qt5.4-replace-qml-dialogs.patch
Normal file
@ -0,0 +1,350 @@
|
||||
diff --git a/sources/awesome-widget/package/contents/ui/advanced.qml b/sources/awesome-widget/package/contents/ui/advanced.qml
|
||||
index 01bcd58..1ec7ba6 100644
|
||||
--- a/sources/awesome-widget/package/contents/ui/advanced.qml
|
||||
+++ b/sources/awesome-widget/package/contents/ui/advanced.qml
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
-import QtQuick.Dialogs 1.2 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
@@ -372,31 +371,7 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Export configuration")
|
||||
- onClicked: saveConfigAs.open()
|
||||
- }
|
||||
-
|
||||
- QtDialogs.FileDialog {
|
||||
- id: saveConfigAs
|
||||
- selectExisting: false
|
||||
- title: i18n("Export")
|
||||
- onAccepted: {
|
||||
- var status = awConfig.exportConfiguration(
|
||||
- plasmoid.configuration,
|
||||
- saveConfigAs.fileUrl.toString().replace("file://", ""))
|
||||
- if (status) {
|
||||
- messageDialog.title = i18n("Success")
|
||||
- messageDialog.text = i18n("Please note that binary files were not copied")
|
||||
- } else {
|
||||
- messageDialog.title = i18n("Ooops...")
|
||||
- messageDialog.text = i18n("Could not save configuration file")
|
||||
- }
|
||||
- messageDialog.open()
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- QtDialogs.MessageDialog {
|
||||
- id: messageDialog
|
||||
- standardButtons: QtDialogs.StandardButton.Ok
|
||||
+ onClicked: awConfig.exportConfiguration(plasmoid.configuration)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -410,41 +385,9 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Import configuration")
|
||||
- onClicked: openConfig.open()
|
||||
- }
|
||||
-
|
||||
- QtDialogs.FileDialog {
|
||||
- id: openConfig
|
||||
- title: i18n("Import")
|
||||
- onAccepted: importSelection.open()
|
||||
- }
|
||||
-
|
||||
- QtDialogs.Dialog {
|
||||
- id: importSelection
|
||||
-
|
||||
- Column {
|
||||
- QtControls.CheckBox {
|
||||
- id: importPlasmoid
|
||||
- text: i18n("Import plasmoid settings")
|
||||
- }
|
||||
-
|
||||
- QtControls.CheckBox {
|
||||
- id: importExtensions
|
||||
- text: i18n("Import extensions")
|
||||
- }
|
||||
-
|
||||
- QtControls.CheckBox {
|
||||
- id: importAdds
|
||||
- text: i18n("Import additional files")
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- onAccepted: {
|
||||
+ onClicked: {
|
||||
if (debug) console.debug()
|
||||
- var importConfig = awConfig.importConfiguration(
|
||||
- openConfig.fileUrl.toString().replace("file://", ""),
|
||||
- importPlasmoid.checked, importExtensions.checked,
|
||||
- importAdds.checked)
|
||||
+ var importConfig = awConfig.importConfiguration()
|
||||
for (var key in importConfig)
|
||||
plasmoid.configuration[key] = importConfig[key]
|
||||
}
|
||||
diff --git a/sources/awesome-widget/package/contents/ui/main.qml b/sources/awesome-widget/package/contents/ui/main.qml
|
||||
index 23e9690..ec83b91 100644
|
||||
--- a/sources/awesome-widget/package/contents/ui/main.qml
|
||||
+++ b/sources/awesome-widget/package/contents/ui/main.qml
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
-import QtQuick.Dialogs 1.2 as QtDialogs
|
||||
import QtQuick.Layouts 1.1
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
@@ -110,27 +109,6 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
- QtDialogs.Dialog {
|
||||
- id: tagSelector
|
||||
- title: i18n("Select tag")
|
||||
-
|
||||
- QtControls.ComboBox {
|
||||
- id: tagSelectorBox
|
||||
- width: parent.width
|
||||
- editable: true
|
||||
- }
|
||||
-
|
||||
- onAccepted: {
|
||||
- var tag = tagSelectorBox.editText
|
||||
- var message = i18n("Tag: %1", tag)
|
||||
- message += "<br>"
|
||||
- message += i18n("Value: %1", awKeys.valueByKey(tag))
|
||||
- message += "<br>"
|
||||
- message += i18n("Info: %1", awKeys.infoByKey(tag))
|
||||
- awActions.sendNotification("tag", message)
|
||||
- }
|
||||
- }
|
||||
-
|
||||
|
||||
Component.onCompleted: {
|
||||
if (debug) console.debug()
|
||||
@@ -216,7 +194,12 @@ Item {
|
||||
function action_requestKey() {
|
||||
if (debug) console.debug()
|
||||
|
||||
- tagSelectorBox.model = awKeys.dictKeys(true)
|
||||
- return tagSelector.open()
|
||||
+ var tag = awKeys.graphicalKey()
|
||||
+ var message = i18n("Tag: %1", tag)
|
||||
+ message += "<br>"
|
||||
+ message += i18n("Value: %1", awKeys.valueByKey(tag))
|
||||
+ message += "<br>"
|
||||
+ message += i18n("Info: %1", awKeys.infoByKey(tag))
|
||||
+ awActions.sendNotification("tag", message)
|
||||
}
|
||||
}
|
||||
diff --git a/sources/awesome-widget/plugin/awconfighelper.cpp b/sources/awesome-widget/plugin/awconfighelper.cpp
|
||||
index 6263b30..5f61d2a 100644
|
||||
--- a/sources/awesome-widget/plugin/awconfighelper.cpp
|
||||
+++ b/sources/awesome-widget/plugin/awconfighelper.cpp
|
||||
@@ -19,10 +19,15 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
+#include <QCheckBox>
|
||||
+#include <QDialogButtonBox>
|
||||
#include <QDir>
|
||||
+#include <QFileDialog>
|
||||
+#include <QMessageBox>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
+#include <QVBoxLayout>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@@ -50,11 +55,13 @@ bool AWConfigHelper::dropCache() const
|
||||
}
|
||||
|
||||
|
||||
-bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
- const QString fileName) const
|
||||
+void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
|
||||
{
|
||||
- qCDebug(LOG_AW) << "Selected filename" << fileName;
|
||||
-
|
||||
+ // get file path and init settings object
|
||||
+ QString fileName = QFileDialog::getSaveFileName(nullptr, i18n("Export"));
|
||||
+ if (fileName.isEmpty())
|
||||
+ return;
|
||||
+ qCInfo(LOG_AW) << "Selected filename" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
// plasmoid configuration
|
||||
@@ -96,22 +103,33 @@ bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
// sync settings
|
||||
settings.sync();
|
||||
// show additional message
|
||||
- return settings.status() == QSettings::NoError;
|
||||
+ switch (settings.status()) {
|
||||
+ case QSettings::NoError:
|
||||
+ QMessageBox::information(
|
||||
+ nullptr, i18n("Success"),
|
||||
+ i18n("Please note that binary files were not copied"));
|
||||
+ break;
|
||||
+ default:
|
||||
+ QMessageBox::critical(nullptr, i18n("Ooops..."),
|
||||
+ i18n("Could not save configuration file"));
|
||||
+ break;
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
-QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
- const bool importPlasmoid,
|
||||
- const bool importExtensions,
|
||||
- const bool importAdds) const
|
||||
+QVariantMap AWConfigHelper::importConfiguration() const
|
||||
{
|
||||
- qCDebug(LOG_AW) << "Selected filename" << fileName;
|
||||
-
|
||||
QVariantMap configuration;
|
||||
+ // get file path and init settings object
|
||||
+ QString fileName = QFileDialog::getOpenFileName(nullptr, i18n("Import"));
|
||||
+ if (fileName.isEmpty())
|
||||
+ return configuration;
|
||||
+ qCInfo(LOG_AW) << "Selected filename" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
+ QHash<QString, bool> selection = selectImport();
|
||||
|
||||
// extensions
|
||||
- if (importExtensions) {
|
||||
+ if (selection[QString("extensions")]) {
|
||||
foreach (QString item, m_dirs) {
|
||||
settings.beginGroup(item);
|
||||
foreach (QString it, settings.childGroups())
|
||||
@@ -121,7 +139,7 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
}
|
||||
|
||||
// additional files
|
||||
- if (importAdds) {
|
||||
+ if (selection[QString("adds")]) {
|
||||
settings.beginGroup(QString("json"));
|
||||
// script filters
|
||||
writeFile(settings, QString("filters"),
|
||||
@@ -135,7 +153,7 @@ QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
}
|
||||
|
||||
// plasmoid configuration
|
||||
- if (importPlasmoid) {
|
||||
+ if (selection[QString("plasmoid")]) {
|
||||
settings.beginGroup(QString("plasmoid"));
|
||||
foreach (QString key, settings.childKeys())
|
||||
configuration[key] = settings.value(key);
|
||||
@@ -261,6 +279,50 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key,
|
||||
}
|
||||
|
||||
|
||||
+QHash<QString, bool> AWConfigHelper::selectImport() const
|
||||
+{
|
||||
+ QDialog *dialog = new QDialog(nullptr);
|
||||
+ QCheckBox *importPlasmoidSettings
|
||||
+ = new QCheckBox(i18n("Import plasmoid settings"), dialog);
|
||||
+ importPlasmoidSettings->setChecked(true);
|
||||
+ QCheckBox *importExtensionsSettings
|
||||
+ = new QCheckBox(i18n("Import extensions"), dialog);
|
||||
+ importExtensionsSettings->setChecked(true);
|
||||
+ QCheckBox *importAddsSettings
|
||||
+ = new QCheckBox(i18n("Import additional files"), dialog);
|
||||
+ importAddsSettings->setChecked(true);
|
||||
+ QDialogButtonBox *dialogButtons
|
||||
+ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
||||
+ Qt::Horizontal, dialog);
|
||||
+ QVBoxLayout *layout = new QVBoxLayout(dialog);
|
||||
+ layout->addWidget(importPlasmoidSettings);
|
||||
+ layout->addWidget(importExtensionsSettings);
|
||||
+ layout->addWidget(importAddsSettings);
|
||||
+ layout->addWidget(dialogButtons);
|
||||
+ connect(dialogButtons, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||
+ connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
+
|
||||
+ // get parameters
|
||||
+ QHash<QString, bool> import;
|
||||
+ import[QString("plasmoid")] = false;
|
||||
+ import[QString("extensions")] = false;
|
||||
+ import[QString("adds")] = false;
|
||||
+ switch (dialog->exec()) {
|
||||
+ case QDialog::Accepted:
|
||||
+ import[QString("plasmoid")] = importPlasmoidSettings->isChecked();
|
||||
+ import[QString("extensions")] = importExtensionsSettings->isChecked();
|
||||
+ import[QString("adds")] = importAddsSettings->isChecked();
|
||||
+ break;
|
||||
+ case QDialog::Rejected:
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+ dialog->deleteLater();
|
||||
+
|
||||
+ return import;
|
||||
+}
|
||||
+
|
||||
+
|
||||
void AWConfigHelper::writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const
|
||||
{
|
||||
diff --git a/sources/awesome-widget/plugin/awconfighelper.h b/sources/awesome-widget/plugin/awconfighelper.h
|
||||
index 912ac3d..dc51dfb 100644
|
||||
--- a/sources/awesome-widget/plugin/awconfighelper.h
|
||||
+++ b/sources/awesome-widget/plugin/awconfighelper.h
|
||||
@@ -33,12 +33,8 @@ public:
|
||||
explicit AWConfigHelper(QObject *parent = nullptr);
|
||||
virtual ~AWConfigHelper();
|
||||
Q_INVOKABLE bool dropCache() const;
|
||||
- Q_INVOKABLE bool exportConfiguration(QObject *nativeConfig,
|
||||
- const QString fileName) const;
|
||||
- Q_INVOKABLE QVariantMap importConfiguration(const QString fileName,
|
||||
- const bool importPlasmoid,
|
||||
- const bool importExtensions,
|
||||
- const bool importAdds) const;
|
||||
+ Q_INVOKABLE void exportConfiguration(QObject *nativeConfig) const;
|
||||
+ Q_INVOKABLE QVariantMap importConfiguration() const;
|
||||
// dataengine
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
|
||||
Q_INVOKABLE void
|
||||
@@ -51,6 +47,7 @@ private:
|
||||
void copySettings(QSettings &from, QSettings &to) const;
|
||||
void readFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
+ QHash<QString, bool> selectImport() const;
|
||||
void writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
// properties
|
||||
diff --git a/sources/awesome-widget/plugin/awkeys.cpp b/sources/awesome-widget/plugin/awkeys.cpp
|
||||
index e5b9861..039d24e 100644
|
||||
--- a/sources/awesome-widget/plugin/awkeys.cpp
|
||||
+++ b/sources/awesome-widget/plugin/awkeys.cpp
|
||||
@@ -324,6 +324,13 @@ QStringList AWKeys::getHddDevices() const
|
||||
}
|
||||
|
||||
|
||||
+QString AWKeys::graphicalKey() const
|
||||
+{
|
||||
+ return QInputDialog::getItem(nullptr, i18n("Select tag"), QString(),
|
||||
+ dictKeys(true), 0, true);
|
||||
+}
|
||||
+
|
||||
+
|
||||
QString AWKeys::infoByKey(QString key) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Requested key" << key;
|
||||
diff --git a/sources/awesome-widget/plugin/awkeys.h b/sources/awesome-widget/plugin/awkeys.h
|
||||
index a8300f1..8edc3bd 100644
|
||||
--- a/sources/awesome-widget/plugin/awkeys.h
|
||||
+++ b/sources/awesome-widget/plugin/awkeys.h
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
Q_INVOKABLE QStringList dictKeys(const bool sorted = false,
|
||||
const QString regexp = QString()) const;
|
||||
Q_INVOKABLE QStringList getHddDevices() const;
|
||||
+ Q_INVOKABLE QString graphicalKey() const;
|
||||
// values
|
||||
Q_INVOKABLE QString infoByKey(QString key) const;
|
||||
Q_INVOKABLE QString valueByKey(QString key) const;
|
29
packages/qt5.5-qstringlist-and-qinfo.patch
Normal file
29
packages/qt5.5-qstringlist-and-qinfo.patch
Normal file
@ -0,0 +1,29 @@
|
||||
diff --git a/sources/awesome-widget/plugin/awkeysaggregator.h b/sources/awesome-widget/plugin/awkeysaggregator.h
|
||||
index f808d03..a056b3f 100644
|
||||
--- a/sources/awesome-widget/plugin/awkeysaggregator.h
|
||||
+++ b/sources/awesome-widget/plugin/awkeysaggregator.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <QHash>
|
||||
#include <QObject>
|
||||
+#include <QStringList>
|
||||
|
||||
#include "version.h"
|
||||
|
||||
diff --git a/sources/awdebug.h b/sources/awdebug.h
|
||||
index 48dc580..530c0d6 100644
|
||||
--- a/sources/awdebug.h
|
||||
+++ b/sources/awdebug.h
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
#ifndef LOG_FORMAT
|
||||
#define LOG_FORMAT \
|
||||
- "[%{time process}][%{if-debug}DD%{endif}%{if-info}II%{endif}%{if-" \
|
||||
- "warning}WW%{endif}%{if-critical}CC%{endif}%{if-fatal}FF%{endif}][%{" \
|
||||
- "category}][%{function}] %{message}"
|
||||
+ "[%{time process}][%{if-debug}DD%{endif}%{if-warning}WW%{endif}%{if-" \
|
||||
+ "critical}CC%{endif}%{if-fatal}FF%{endif}][%{category}][%{function}] " \
|
||||
+ "%{message}"
|
||||
#endif /* LOG_FORMAT */
|
||||
|
||||
// redefine info because it doesn't log properly
|
@ -15,7 +15,7 @@ set(PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set(PROJECT_LICENSE "GPL3")
|
||||
set(PROJECT_VERSION_MAJOR "3")
|
||||
set(PROJECT_VERSION_MINOR "0")
|
||||
set(PROJECT_VERSION_PATCH "0")
|
||||
set(PROJECT_VERSION_PATCH "1")
|
||||
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
|
||||
# append git version if any
|
||||
set(PROJECT_COMMIT_SHA "Commit hash" CACHE INTERNAL "")
|
||||
|
@ -28,15 +28,11 @@
|
||||
"category}][%{function}] %{message}"
|
||||
#endif /* LOG_FORMAT */
|
||||
|
||||
// define info log level
|
||||
// #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
// #ifndef qCInfo
|
||||
// redefine info because it doesn't log properly
|
||||
#ifdef qCInfo
|
||||
#undef qCInfo
|
||||
#endif /* qCInfo */
|
||||
#define qCInfo qCDebug
|
||||
// #endif /* QT_VERSION */
|
||||
|
||||
|
||||
Q_DECLARE_LOGGING_CATEGORY(LOG_AW)
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Controls 1.3 as QtControls
|
||||
import QtQuick.Dialogs 1.2 as QtDialogs
|
||||
|
||||
import org.kde.plasma.private.awesomewidget 1.0
|
||||
|
||||
@ -371,7 +372,31 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Export configuration")
|
||||
onClicked: awConfig.exportConfiguration(plasmoid.configuration)
|
||||
onClicked: saveConfigAs.open()
|
||||
}
|
||||
|
||||
QtDialogs.FileDialog {
|
||||
id: saveConfigAs
|
||||
selectExisting: false
|
||||
title: i18n("Export")
|
||||
onAccepted: {
|
||||
var status = awConfig.exportConfiguration(
|
||||
plasmoid.configuration,
|
||||
saveConfigAs.fileUrl.toString().replace("file://", ""))
|
||||
if (status) {
|
||||
messageDialog.title = i18n("Success")
|
||||
messageDialog.text = i18n("Please note that binary files were not copied")
|
||||
} else {
|
||||
messageDialog.title = i18n("Ooops...")
|
||||
messageDialog.text = i18n("Could not save configuration file")
|
||||
}
|
||||
messageDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
QtDialogs.MessageDialog {
|
||||
id: messageDialog
|
||||
standardButtons: QtDialogs.StandardButton.Ok
|
||||
}
|
||||
}
|
||||
|
||||
@ -385,9 +410,41 @@ Item {
|
||||
QtControls.Button {
|
||||
width: parent.width * 3 / 5
|
||||
text: i18n("Import configuration")
|
||||
onClicked: {
|
||||
onClicked: openConfig.open()
|
||||
}
|
||||
|
||||
QtDialogs.FileDialog {
|
||||
id: openConfig
|
||||
title: i18n("Import")
|
||||
onAccepted: importSelection.open()
|
||||
}
|
||||
|
||||
QtDialogs.Dialog {
|
||||
id: importSelection
|
||||
|
||||
Column {
|
||||
QtControls.CheckBox {
|
||||
id: importPlasmoid
|
||||
text: i18n("Import plasmoid settings")
|
||||
}
|
||||
|
||||
QtControls.CheckBox {
|
||||
id: importExtensions
|
||||
text: i18n("Import extensions")
|
||||
}
|
||||
|
||||
QtControls.CheckBox {
|
||||
id: importAdds
|
||||
text: i18n("Import additional files")
|
||||
}
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
if (debug) console.debug()
|
||||
var importConfig = awConfig.importConfiguration()
|
||||
var importConfig = awConfig.importConfiguration(
|
||||
openConfig.fileUrl.toString().replace("file://", ""),
|
||||
importPlasmoid.checked, importExtensions.checked,
|
||||
importAdds.checked)
|
||||
for (var key in importConfig)
|
||||
plasmoid.configuration[key] = importConfig[key]
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ X-Plasma-RemoteLocation=
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.awesomewidget
|
||||
X-KDE-PluginInfo-Version=3.0.0
|
||||
X-KDE-PluginInfo-Version=3.0.1
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
@ -4,8 +4,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidge
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../${PROJECT_LIBRARY}/
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
|
@ -19,15 +19,10 @@
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QQmlPropertyMap>
|
||||
#include <QSettings>
|
||||
#include <QTextCodec>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -55,13 +50,11 @@ bool AWConfigHelper::dropCache() const
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
|
||||
bool AWConfigHelper::exportConfiguration(QObject *nativeConfig,
|
||||
const QString fileName) const
|
||||
{
|
||||
// get file path and init settings object
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr, i18n("Export"));
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
qCInfo(LOG_AW) << "Selected filename" << fileName;
|
||||
qCDebug(LOG_AW) << "Selected filename" << fileName;
|
||||
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
// plasmoid configuration
|
||||
@ -103,33 +96,22 @@ void AWConfigHelper::exportConfiguration(QObject *nativeConfig) const
|
||||
// sync settings
|
||||
settings.sync();
|
||||
// show additional message
|
||||
switch (settings.status()) {
|
||||
case QSettings::NoError:
|
||||
QMessageBox::information(
|
||||
nullptr, i18n("Success"),
|
||||
i18n("Please note that binary files were not copied"));
|
||||
break;
|
||||
default:
|
||||
QMessageBox::critical(nullptr, i18n("Ooops..."),
|
||||
i18n("Could not save configuration file"));
|
||||
break;
|
||||
}
|
||||
return settings.status() == QSettings::NoError;
|
||||
}
|
||||
|
||||
|
||||
QVariantMap AWConfigHelper::importConfiguration() const
|
||||
QVariantMap AWConfigHelper::importConfiguration(const QString fileName,
|
||||
const bool importPlasmoid,
|
||||
const bool importExtensions,
|
||||
const bool importAdds) const
|
||||
{
|
||||
qCDebug(LOG_AW) << "Selected filename" << fileName;
|
||||
|
||||
QVariantMap configuration;
|
||||
// get file path and init settings object
|
||||
QString fileName = QFileDialog::getOpenFileName(nullptr, i18n("Import"));
|
||||
if (fileName.isEmpty())
|
||||
return configuration;
|
||||
qCInfo(LOG_AW) << "Selected filename" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
QHash<QString, bool> selection = selectImport();
|
||||
|
||||
// extensions
|
||||
if (selection[QString("extensions")]) {
|
||||
if (importExtensions) {
|
||||
foreach (QString item, m_dirs) {
|
||||
settings.beginGroup(item);
|
||||
foreach (QString it, settings.childGroups())
|
||||
@ -139,7 +121,7 @@ QVariantMap AWConfigHelper::importConfiguration() const
|
||||
}
|
||||
|
||||
// additional files
|
||||
if (selection[QString("adds")]) {
|
||||
if (importAdds) {
|
||||
settings.beginGroup(QString("json"));
|
||||
// script filters
|
||||
writeFile(settings, QString("filters"),
|
||||
@ -153,7 +135,7 @@ QVariantMap AWConfigHelper::importConfiguration() const
|
||||
}
|
||||
|
||||
// plasmoid configuration
|
||||
if (selection[QString("plasmoid")]) {
|
||||
if (importPlasmoid) {
|
||||
settings.beginGroup(QString("plasmoid"));
|
||||
foreach (QString key, settings.childKeys())
|
||||
configuration[key] = settings.value(key);
|
||||
@ -279,50 +261,6 @@ void AWConfigHelper::readFile(QSettings &settings, const QString key,
|
||||
}
|
||||
|
||||
|
||||
QHash<QString, bool> AWConfigHelper::selectImport() const
|
||||
{
|
||||
QDialog *dialog = new QDialog(nullptr);
|
||||
QCheckBox *importPlasmoidSettings
|
||||
= new QCheckBox(i18n("Import plasmoid settings"), dialog);
|
||||
importPlasmoidSettings->setChecked(true);
|
||||
QCheckBox *importExtensionsSettings
|
||||
= new QCheckBox(i18n("Import extensions"), dialog);
|
||||
importExtensionsSettings->setChecked(true);
|
||||
QCheckBox *importAddsSettings
|
||||
= new QCheckBox(i18n("Import additional files"), dialog);
|
||||
importAddsSettings->setChecked(true);
|
||||
QDialogButtonBox *dialogButtons
|
||||
= new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
|
||||
Qt::Horizontal, dialog);
|
||||
QVBoxLayout *layout = new QVBoxLayout(dialog);
|
||||
layout->addWidget(importPlasmoidSettings);
|
||||
layout->addWidget(importExtensionsSettings);
|
||||
layout->addWidget(importAddsSettings);
|
||||
layout->addWidget(dialogButtons);
|
||||
connect(dialogButtons, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||
connect(dialogButtons, SIGNAL(rejected()), dialog, SLOT(reject()));
|
||||
|
||||
// get parameters
|
||||
QHash<QString, bool> import;
|
||||
import[QString("plasmoid")] = false;
|
||||
import[QString("extensions")] = false;
|
||||
import[QString("adds")] = false;
|
||||
switch (dialog->exec()) {
|
||||
case QDialog::Accepted:
|
||||
import[QString("plasmoid")] = importPlasmoidSettings->isChecked();
|
||||
import[QString("extensions")] = importExtensionsSettings->isChecked();
|
||||
import[QString("adds")] = importAddsSettings->isChecked();
|
||||
break;
|
||||
case QDialog::Rejected:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dialog->deleteLater();
|
||||
|
||||
return import;
|
||||
}
|
||||
|
||||
|
||||
void AWConfigHelper::writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const
|
||||
{
|
||||
|
@ -33,8 +33,12 @@ public:
|
||||
explicit AWConfigHelper(QObject *parent = nullptr);
|
||||
virtual ~AWConfigHelper();
|
||||
Q_INVOKABLE bool dropCache() const;
|
||||
Q_INVOKABLE void exportConfiguration(QObject *nativeConfig) const;
|
||||
Q_INVOKABLE QVariantMap importConfiguration() const;
|
||||
Q_INVOKABLE bool exportConfiguration(QObject *nativeConfig,
|
||||
const QString fileName) const;
|
||||
Q_INVOKABLE QVariantMap importConfiguration(const QString fileName,
|
||||
const bool importPlasmoid,
|
||||
const bool importExtensions,
|
||||
const bool importAdds) const;
|
||||
// dataengine
|
||||
Q_INVOKABLE QVariantMap readDataEngineConfiguration() const;
|
||||
Q_INVOKABLE void
|
||||
@ -47,7 +51,6 @@ private:
|
||||
void copySettings(QSettings &from, QSettings &to) const;
|
||||
void readFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
QHash<QString, bool> selectImport() const;
|
||||
void writeFile(QSettings &settings, const QString key,
|
||||
const QString fileName) const;
|
||||
// properties
|
||||
|
@ -66,22 +66,15 @@ AWKeys::~AWKeys()
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
// extensions
|
||||
if (graphicalItems != nullptr)
|
||||
delete graphicalItems;
|
||||
if (extQuotes != nullptr)
|
||||
delete extQuotes;
|
||||
if (extScripts != nullptr)
|
||||
delete extScripts;
|
||||
if (extUpgrade != nullptr)
|
||||
delete extUpgrade;
|
||||
if (extWeather != nullptr)
|
||||
delete extWeather;
|
||||
delete graphicalItems;
|
||||
delete extQuotes;
|
||||
delete extScripts;
|
||||
delete extUpgrade;
|
||||
delete extWeather;
|
||||
|
||||
// core
|
||||
if (dataEngineAggregator != nullptr)
|
||||
delete dataEngineAggregator;
|
||||
if (m_threadPool != nullptr)
|
||||
delete m_threadPool;
|
||||
delete dataEngineAggregator;
|
||||
delete m_threadPool;
|
||||
delete aggregator;
|
||||
delete dataAggregator;
|
||||
}
|
||||
@ -471,16 +464,16 @@ void AWKeys::reinitKeys()
|
||||
{
|
||||
// renew extensions
|
||||
// delete them if any
|
||||
if (graphicalItems != nullptr)
|
||||
delete graphicalItems;
|
||||
if (extQuotes != nullptr)
|
||||
delete extQuotes;
|
||||
if (extScripts != nullptr)
|
||||
delete extScripts;
|
||||
if (extUpgrade != nullptr)
|
||||
delete extUpgrade;
|
||||
if (extWeather != nullptr)
|
||||
delete extWeather;
|
||||
delete graphicalItems;
|
||||
graphicalItems = nullptr;
|
||||
delete extQuotes;
|
||||
extQuotes = nullptr;
|
||||
delete extScripts;
|
||||
extScripts = nullptr;
|
||||
delete extUpgrade;
|
||||
extUpgrade = nullptr;
|
||||
delete extWeather;
|
||||
extWeather = nullptr;
|
||||
// create
|
||||
graphicalItems
|
||||
= new ExtItemAggregator<GraphicalItem>(nullptr, QString("desktops"));
|
||||
|
@ -5,8 +5,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidge
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
|
@ -20,7 +20,7 @@ X-Plasma-RemoteLocation=
|
||||
X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis
|
||||
X-KDE-PluginInfo-Email=esalexeev@gmail.com
|
||||
X-KDE-PluginInfo-Name=org.kde.plasma.desktoppanel
|
||||
X-KDE-PluginInfo-Version=3.0.0
|
||||
X-KDE-PluginInfo-Version=3.0.1
|
||||
X-KDE-PluginInfo-Website=http://arcanis.name/projects/awesome-widgets/
|
||||
X-KDE-PluginInfo-Category=System Information
|
||||
X-KDE-PluginInfo-Depends=
|
||||
|
@ -4,8 +4,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.desktoppanel
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
${Kf5_INCLUDE}
|
||||
|
@ -5,8 +5,6 @@ add_definitions(-DTRANSLATION_DOMAIN=\"plasma_applet_org.kde.plasma.awesomewidge
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../${PROJECT_LIBRARY}/
|
||||
${PROJECT_TRDPARTY_DIR}
|
||||
${Qt_INCLUDE}
|
||||
|
Loading…
Reference in New Issue
Block a user