mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2026-01-31 05:19:47 +00:00
Compare commits
1 Commits
master
...
b157b0f898
| Author | SHA1 | Date | |
|---|---|---|---|
| b157b0f898 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -48,6 +48,3 @@ pkg
|
||||
# clion settings
|
||||
.idea
|
||||
cmake-build*
|
||||
|
||||
# clang
|
||||
.cache
|
||||
|
||||
1
AUTHORS
1
AUTHORS
@@ -13,4 +13,3 @@ Steve Lemuel (Chinese)
|
||||
Mariusz Kocoń (Polish)
|
||||
Ibnu Daru Aji (Indonesian)
|
||||
Antonio Vivace (Italian)
|
||||
@daveedmee (German)
|
||||
|
||||
14
CHANGELOG
14
CHANGELOG
@@ -1,19 +1,5 @@
|
||||
Ver.4.0.3:
|
||||
- drop qml definition to avoid compile errors
|
||||
|
||||
Ver.4.0.2:
|
||||
+ German translation (#172, thanks to daveedmee)
|
||||
|
||||
Ver.4.0.1:
|
||||
- temporary disable tooltip painting in main widget
|
||||
|
||||
Ver.4.0.0:
|
||||
* migration to plasma 6
|
||||
* dialog windows have been replaced by notifications
|
||||
+ $gpuN keys have been added
|
||||
+ new key $ssid
|
||||
- $cuptime key has been removed in favour of $uptime
|
||||
- $gputemp key has been replaced by $gpuN
|
||||
|
||||
Ver.3.5.0:
|
||||
+ wayland support
|
||||
|
||||
@@ -75,5 +75,5 @@ Links
|
||||
* [Scripts and bars](https://arcanis.me/en/2014/12/19/aw-v21-bells-and-whistles/)
|
||||
* Plasmoid on [kde-look](http://kde-look.org/content/show.php/Awesome+Widgets?content=157124)
|
||||
* DataEngine on [kde-look](http://kde-look.org/content/show.php/Extended+Systemmonitor+DataEngine?content=158773)
|
||||
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma6-applets-awesome-widgets) package
|
||||
* Archlinux [AUR](https://aur.archlinux.org/packages/plasma5-applet-awesome-widgets/) package
|
||||
* [OpenSuse](http://software.opensuse.org/search?q=awesome-widgets) packages, [KF5 OpenSuse](http://software.opensuse.org/package/plasma5-awesome-widgets) package
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
pkgname=plasma6-applet-awesome-widgets
|
||||
_pkgname=awesome-widgets
|
||||
pkgver=4.0.5
|
||||
pkgver=4.0.0alpha2
|
||||
pkgrel=1
|
||||
pkgdesc="Collection of minimalistic Plasmoids which look like Awesome WM widgets (ex-PyTextMonitor)"
|
||||
arch=('x86_64')
|
||||
@@ -27,3 +27,5 @@ build () {
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
}
|
||||
|
||||
sha256sums=('b2a7b07a1df6f710f4e0d6e5898933f4ddb131818b922dc4b8e48afe3e98a664')
|
||||
|
||||
@@ -19,7 +19,7 @@ set(PROJECT_CONTACT "esalexeev@gmail.com")
|
||||
set(PROJECT_LICENSE "GPL3")
|
||||
set(PROJECT_VERSION_MAJOR "4")
|
||||
set(PROJECT_VERSION_MINOR "0")
|
||||
set(PROJECT_VERSION_PATCH "5")
|
||||
set(PROJECT_VERSION_PATCH "0")
|
||||
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 "")
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG
|
||||
#endif /* NDEBUG */
|
||||
#include <KI18n/KLocalizedString>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@@ -130,7 +130,7 @@ PlasmoidItem {
|
||||
Plasmoid.userConfiguringChanged(false)
|
||||
// connect data
|
||||
awKeys.needTextToBeUpdated.connect(needTextUpdate)
|
||||
//awKeys.needToolTipToBeUpdated.connect(needToolTipUpdate)
|
||||
awKeys.needToolTipToBeUpdated.connect(needToolTipUpdate)
|
||||
// check updates if required
|
||||
if (plasmoid.configuration.checkUpdates) return awActions.checkUpdates(false)
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"Id": "org.kde.plasma.awesomewidget",
|
||||
"License": "GPLv3",
|
||||
"Name": "Awesome Widget",
|
||||
"Version": "4.0.5",
|
||||
"Version": "4.0.0",
|
||||
"Website": "https://arcanis.me/projects/awesome-widgets/"
|
||||
},
|
||||
"X-Plasma-API-Minimum-Version": "6.0"
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
[[nodiscard]] QStringList sources() const;
|
||||
[[nodiscard]] QStringList refinedSources() const;
|
||||
// configuration related
|
||||
void editPairs() override {};
|
||||
void editPairs() override{};
|
||||
QStringList leftKeys() override;
|
||||
QStringList rightKeys() override;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
|
||||
@@ -95,55 +95,14 @@ void AWDataEngineAggregator::loadSources()
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::registerClient(QObject *_client)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Register client" << _client;
|
||||
|
||||
// register new client
|
||||
m_clients.insert(_client);
|
||||
// (re)connect sources for new client
|
||||
connectSources();
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::unregisterClient(QObject *_client)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Unregister client" << _client;
|
||||
|
||||
m_clients.remove(_client);
|
||||
for (auto [source, clients] : m_droppedBy.asKeyValueRange()) {
|
||||
if (clients.remove(_client)) {
|
||||
if (isSubscriptionUnused(source))
|
||||
dropSource(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::dropSource(const QString &_source)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Disconnect sensor" << _source;
|
||||
|
||||
if (m_subscribed.remove(_source))
|
||||
if (m_subscribed.contains(_source)) {
|
||||
m_interface->unsubscribe({_source}).waitForFinished();
|
||||
}
|
||||
|
||||
|
||||
void AWDataEngineAggregator::dropSourceForClient(QObject *_client, const QString &_source)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Client" << _client << "dropping source" << _source;
|
||||
|
||||
m_droppedBy[_source].insert(_client);
|
||||
|
||||
// only unsubscribe if ALL clients have dropped this source
|
||||
if (isSubscriptionUnused(_source))
|
||||
dropSource(_source);
|
||||
}
|
||||
|
||||
|
||||
bool AWDataEngineAggregator::isSubscriptionUnused(const QString &_source) const
|
||||
{
|
||||
return m_droppedBy.value(_source).size() >= m_clients.size() && !m_clients.isEmpty();
|
||||
m_subscribed.remove(_source);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace KSysGuard::SystemStats
|
||||
{
|
||||
@@ -35,26 +34,12 @@ class AWDataEngineAggregator : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||
~AWDataEngineAggregator() override;
|
||||
|
||||
AWDataEngineAggregator(AWDataEngineAggregator &) = delete;
|
||||
void operator=(const AWDataEngineAggregator &) = delete;
|
||||
|
||||
[[nodiscard]] static AWDataEngineAggregator *instance(QObject *_client)
|
||||
{
|
||||
static auto instance = loadInstance();
|
||||
instance->registerClient(_client);
|
||||
return instance.get();
|
||||
};
|
||||
|
||||
void connectSources();
|
||||
void disconnectSources();
|
||||
void dropSourceForClient(QObject *_client, const QString &_source);
|
||||
[[nodiscard]] inline bool isSubscriptionUnused(const QString &_source) const;
|
||||
[[nodiscard]] static bool isValidSensor(const KSysGuard::SensorInfo &_sensor);
|
||||
void loadSources();
|
||||
void registerClient(QObject *_client);
|
||||
void unregisterClient(QObject *_client);
|
||||
|
||||
signals:
|
||||
void dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors, const KSysGuard::SensorDataList &_data);
|
||||
@@ -67,18 +52,7 @@ public slots:
|
||||
void updateData(const KSysGuard::SensorDataList &_data);
|
||||
void updateSensors(const QHash<QString, KSysGuard::SensorInfo> &_sensors);
|
||||
|
||||
protected:
|
||||
explicit AWDataEngineAggregator(QObject *_parent = nullptr);
|
||||
|
||||
[[nodiscard]] static std::unique_ptr<AWDataEngineAggregator> loadInstance()
|
||||
{
|
||||
auto instance = new AWDataEngineAggregator();
|
||||
return std::unique_ptr<AWDataEngineAggregator>(instance);
|
||||
};
|
||||
|
||||
private:
|
||||
QSet<QObject *> m_clients;
|
||||
QHash<QString, QSet<QObject *>> m_droppedBy;
|
||||
KSysGuard::SystemStats::DBusInterface *m_interface = nullptr;
|
||||
QHash<QString, KSysGuard::SensorInfo> m_sensors;
|
||||
QSet<QString> m_subscribed;
|
||||
|
||||
@@ -65,7 +65,7 @@ QStringList AWDataEngineMapper::keysFromSource(const QString &_source) const
|
||||
// HACK units required to define should the value be calculated as temperature
|
||||
// or fan data
|
||||
QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSysGuard::Unit _units,
|
||||
const QStringList &_keys, const bool _disconnectUnused)
|
||||
const QStringList &_keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
|
||||
|
||||
@@ -91,7 +91,7 @@ QStringList AWDataEngineMapper::registerSource(const QString &_source, const KSy
|
||||
|
||||
// check if keys were actually requested
|
||||
qCInfo(LOG_AW) << "Looking for keys" << keys << "in" << _keys;
|
||||
auto required = !_disconnectUnused
|
||||
auto required = _keys.isEmpty()
|
||||
|| std::any_of(keys.cbegin(), keys.cend(), [&_keys](auto &key) { return _keys.contains(key); });
|
||||
if (!required)
|
||||
return {};
|
||||
|
||||
@@ -39,8 +39,7 @@ public:
|
||||
[[nodiscard]] AWPluginFormaterInterface *formatter(const QString &_key) const;
|
||||
[[nodiscard]] QStringList keysFromSource(const QString &_source) const;
|
||||
// set methods
|
||||
QStringList registerSource(const QString &_source, KSysGuard::Unit _units, const QStringList &_keys,
|
||||
const bool _disconnectUnused);
|
||||
QStringList registerSource(const QString &_source, KSysGuard::Unit _units, const QStringList &_keys);
|
||||
void setDevices(const AWPluginMatcherSettings &_settings);
|
||||
|
||||
private:
|
||||
|
||||
@@ -43,7 +43,7 @@ AWKeys::AWKeys(QObject *_parent)
|
||||
|
||||
m_aggregator = new AWKeysAggregator(this);
|
||||
m_dataAggregator = new AWDataAggregator(this);
|
||||
m_dataEngineAggregator = AWDataEngineAggregator::instance(this);
|
||||
m_dataEngineAggregator = new AWDataEngineAggregator(this);
|
||||
m_keyOperator = new AWKeyOperations(this);
|
||||
|
||||
m_timer = new QTimer(this);
|
||||
@@ -59,8 +59,7 @@ AWKeys::AWKeys(QObject *_parent)
|
||||
connect(m_dataAggregator, &AWDataAggregator::toolTipPainted,
|
||||
[this](const QString &_tooltip) { emit(needToolTipToBeUpdated(_tooltip)); });
|
||||
|
||||
connect(this, &AWKeys::dropSourceFromDataengine, this,
|
||||
[this](const QString &_source) { m_dataEngineAggregator->dropSourceForClient(this, _source); });
|
||||
connect(this, &AWKeys::dropSourceFromDataengine, m_dataEngineAggregator, &AWDataEngineAggregator::dropSource);
|
||||
connect(m_dataEngineAggregator, &AWDataEngineAggregator::dataUpdated, this, &AWKeys::dataUpdated);
|
||||
// transfer signal from dataengine to update source list
|
||||
connect(m_dataEngineAggregator, &AWDataEngineAggregator::deviceAdded, m_keyOperator, &AWKeyOperations::addDevice);
|
||||
@@ -71,8 +70,6 @@ AWKeys::~AWKeys()
|
||||
{
|
||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||
|
||||
m_dataEngineAggregator->unregisterClient(this);
|
||||
|
||||
m_timer->stop();
|
||||
// delete dbus session
|
||||
auto id = reinterpret_cast<qlonglong>(this);
|
||||
@@ -209,8 +206,9 @@ void AWKeys::reinitKeys(const QStringList &_currentKeys)
|
||||
barKeys.append(item->usedKeys());
|
||||
}
|
||||
// get required keys
|
||||
m_requiredKeys = AWKeyCache::getRequiredKeys(m_foundKeys, barKeys, m_tooltipParams,
|
||||
m_keyOperator->requiredUserKeys(), _currentKeys);
|
||||
m_requiredKeys = m_optimize ? AWKeyCache::getRequiredKeys(m_foundKeys, barKeys, m_tooltipParams,
|
||||
m_keyOperator->requiredUserKeys(), _currentKeys)
|
||||
: QStringList();
|
||||
|
||||
// set key data to m_aggregator
|
||||
m_aggregator->setDevices(m_keyOperator->devices());
|
||||
@@ -297,8 +295,8 @@ QString AWKeys::parsePattern(QString _pattern) const
|
||||
// bars
|
||||
for (auto &bar : m_foundBars) {
|
||||
auto item = m_keyOperator->giByKey(bar);
|
||||
auto image = item->isCustom() ? item->image(AWPatternFunctions::expandLambdas(item->bar(), m_aggregator,
|
||||
m_values, item->usedKeys()))
|
||||
auto image = item->isCustom() ? item->image(
|
||||
AWPatternFunctions::expandLambdas(item->bar(), m_aggregator, m_values, item->usedKeys()))
|
||||
: item->image(m_values[item->bar()]);
|
||||
_pattern.replace(QString("$%1").arg(bar), image);
|
||||
}
|
||||
@@ -319,7 +317,7 @@ void AWKeys::setDataBySource(const QString &_source, const KSysGuard::SensorInfo
|
||||
// first list init
|
||||
auto tags = m_aggregator->keysFromSource(_source);
|
||||
if (tags.isEmpty())
|
||||
tags = m_aggregator->registerSource(_source, _sensor.unit, m_requiredKeys, m_optimize);
|
||||
tags = m_aggregator->registerSource(_source, _sensor.unit, m_requiredKeys);
|
||||
|
||||
// update data or drop source if there are no matches and exit
|
||||
if (tags.isEmpty()) {
|
||||
|
||||
@@ -151,9 +151,9 @@ void AWKeysAggregator::setTranslate(const bool _translate)
|
||||
|
||||
|
||||
QStringList AWKeysAggregator::registerSource(const QString &_source, const KSysGuard::Unit _units,
|
||||
const QStringList &_keys, const bool _disconnectUnused)
|
||||
const QStringList &_keys)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Source" << _source << "with units" << _units;
|
||||
|
||||
return m_mapper->registerSource(_source, _units, _keys, _disconnectUnused);
|
||||
return m_mapper->registerSource(_source, _units, _keys);
|
||||
}
|
||||
|
||||
@@ -61,8 +61,7 @@ public:
|
||||
void setTranslate(bool _translate);
|
||||
|
||||
public slots:
|
||||
QStringList registerSource(const QString &_source, KSysGuard::Unit _units, const QStringList &_keys,
|
||||
const bool _disconnectUnused);
|
||||
QStringList registerSource(const QString &_source, KSysGuard::Unit _units, const QStringList &_keys);
|
||||
|
||||
private:
|
||||
AWPluginFormatSettings m_settings;
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
|
||||
#include "awupdatehelper.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG
|
||||
#endif /* NDEBUG */
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
[[nodiscard]] virtual QString format(const QVariant &_value, const QString &_key,
|
||||
const AWPluginFormatSettings &_settings) const
|
||||
= 0;
|
||||
virtual void load() {};
|
||||
virtual void load(){};
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -436,7 +436,7 @@ int GraphicalItem::showConfiguration(QWidget *_parent, const QVariant &_args)
|
||||
auto ui = new Ui::GraphicalItem();
|
||||
ui->setupUi(dialog);
|
||||
|
||||
connect(ui->checkBox_custom, &QCheckBox::checkStateChanged, [ui](const int state) { changeValue(ui, state); });
|
||||
connect(ui->checkBox_custom, &QCheckBox::stateChanged, [ui](const int state) { changeValue(ui, state); });
|
||||
connect(ui->comboBox_type, &QComboBox::currentIndexChanged, [ui](const int state) { changeCountState(ui, state); });
|
||||
connect(ui->toolButton_activeColor, &QToolButton::clicked, [this, ui]() { changeColor(ui); });
|
||||
connect(ui->toolButton_inactiveColor, &QToolButton::clicked, [this, ui]() { changeColor(ui); });
|
||||
@@ -472,7 +472,7 @@ int GraphicalItem::showConfiguration(QWidget *_parent, const QVariant &_args)
|
||||
|
||||
// update UI
|
||||
emit(ui->comboBox_type->currentIndexChanged(ui->comboBox_type->currentIndex()));
|
||||
emit(ui->checkBox_custom->checkStateChanged(ui->checkBox_custom->checkState()));
|
||||
emit(ui->checkBox_custom->stateChanged(ui->checkBox_custom->checkState()));
|
||||
|
||||
int ret = dialog->exec();
|
||||
if (ret == 1) {
|
||||
|
||||
@@ -21,4 +21,4 @@
|
||||
|
||||
#ifndef ui_i18n
|
||||
#define ui_i18n(text, parent) i18n(text)
|
||||
#endif /* ui_i18n */
|
||||
#endif
|
||||
@@ -19,7 +19,7 @@
|
||||
"Id": "org.kde.plasma.desktoppanel",
|
||||
"License": "GPLv3",
|
||||
"Name": "Desktop Panel",
|
||||
"Version": "4.0.5",
|
||||
"Version": "4.0.0",
|
||||
"Website": "https://arcanis.me/projects/awesome-widgets/"
|
||||
},
|
||||
"X-Plasma-API-Minimum-Version": "6.0"
|
||||
|
||||
@@ -128,8 +128,8 @@ QVariant SystemInfoSource::sendDBusRequest(const QString &_destination, const QS
|
||||
|
||||
auto response = bus.call(request, QDBus::BlockWithGui, REQUEST_TIMEOUT);
|
||||
|
||||
if (response.type() != QDBusMessage::ReplyMessage || response.arguments().isEmpty()) {
|
||||
qCWarning(LOG_ESS) << "Error" << response.errorName() << "with message" << response.errorMessage();
|
||||
if ((response.type() != QDBusMessage::ReplyMessage) || (response.arguments().isEmpty())) {
|
||||
qCWarning(LOG_ESS) << "Error message" << response.errorMessage();
|
||||
return {};
|
||||
} else {
|
||||
return response.arguments().first();
|
||||
|
||||
@@ -5,7 +5,7 @@ find_package(Gettext REQUIRED)
|
||||
find_package(Qt6 6.6.0 REQUIRED COMPONENTS Core Concurrent DBus Network Qml Test Widgets)
|
||||
add_definitions(
|
||||
${Qt6Core_DEFINITIONS} ${Qt6DBus_DEFINITIONS} ${Qt6Network_DEFINITIONS}
|
||||
${Qt6Widgets_DEFINITIONS}
|
||||
${Qt6Qml_DEFINITIONS} ${Qt6Widgets_DEFINITIONS}
|
||||
)
|
||||
set(Qt_INCLUDE
|
||||
${Qt6Core_INCLUDE_DIRS} ${Qt6Concurrent_INCLUDE_DIRS} ${Qt6DBus_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}
|
||||
|
||||
@@ -38,7 +38,6 @@ Item {
|
||||
|
||||
Dialog {
|
||||
id: importSelection
|
||||
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||
|
||||
Column {
|
||||
CheckBox {
|
||||
|
||||
@@ -45,7 +45,7 @@ void TestAWBugReporter::test_generateText()
|
||||
|
||||
void TestAWBugReporter::test_sendBugReport()
|
||||
{
|
||||
QSignalSpy spy(plugin, SIGNAL(replyReceived(int, const QString &)));
|
||||
QSignalSpy spy(plugin, SIGNAL(replyReceived(int, QString &)));
|
||||
plugin->sendBugReport(AWTestLibrary::randomString(),
|
||||
plugin->generateText(data.at(0), data.at(1), data.at(2), data.at(3)));
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user