mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-05-04 12:23:49 +00:00
Compare commits
2 Commits
ce93664f5b
...
f1a01fbb32
Author | SHA1 | Date | |
---|---|---|---|
f1a01fbb32 | |||
960640f5bc |
@ -9,6 +9,9 @@ endif ()
|
||||
if (POLICY CMP0071)
|
||||
cmake_policy(SET CMP0071 NEW)
|
||||
endif ()
|
||||
if (POLICY CMP0160)
|
||||
cmake_policy(SET CMP0160 OLD)
|
||||
endif ()
|
||||
|
||||
project(awesomewidgets)
|
||||
set(PROJECT_AUTHOR "Evgeniy Alekseev")
|
||||
|
@ -88,20 +88,6 @@ void AWActions::showReadme()
|
||||
}
|
||||
|
||||
|
||||
void AWActions::showLegacyInfo()
|
||||
{
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Not supported"));
|
||||
msgBox->setText(i18n("You are using mammoth's Qt version, try to update it first"));
|
||||
msgBox->setStandardButtons(QMessageBox::Ok);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
|
||||
msgBox->open();
|
||||
}
|
||||
|
||||
|
||||
// HACK: this method uses variables from version.h
|
||||
QString AWActions::getAboutText(const QString &_type)
|
||||
{
|
||||
@ -135,7 +121,6 @@ void AWActions::sendNotification(const QString &_eventId, const QString &_messag
|
||||
{
|
||||
qCDebug(LOG_AW) << "Event" << _eventId << "with message" << _message;
|
||||
|
||||
KNotification *notification
|
||||
= KNotification::event(_eventId, QString("Awesome Widget ::: %1").arg(_eventId), _message);
|
||||
notification->setComponentName("plasma-applet-org.kde.plasma.awesome-widget");
|
||||
auto *event = KNotification::event(_eventId, QString("Awesome Widget ::: %1").arg(_eventId), _message);
|
||||
event->setComponentName("plasma-applet-org.kde.plasma.awesome-widget");
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
Q_INVOKABLE void checkUpdates(bool _showAnyway = false);
|
||||
Q_INVOKABLE static QString getFileContent(const QString &_path);
|
||||
Q_INVOKABLE static bool runCmd(const QString &_cmd, const QStringList &_args);
|
||||
Q_INVOKABLE static void showLegacyInfo();
|
||||
Q_INVOKABLE static void showReadme();
|
||||
// configuration slots
|
||||
Q_INVOKABLE static QString getAboutText(const QString &_type);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "awbugreporter.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QJsonDocument>
|
||||
@ -114,6 +115,12 @@ void AWBugReporter::issueReplyReceived(QNetworkReply *_reply)
|
||||
}
|
||||
|
||||
|
||||
void AWBugReporter::openBugReport()
|
||||
{
|
||||
QDesktopServices::openUrl(m_lastBugUrl);
|
||||
}
|
||||
|
||||
|
||||
void AWBugReporter::showInformation(const int _number, const QString &_url)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Created issue with number" << _number << "and url" << _url;
|
||||
@ -121,29 +128,9 @@ void AWBugReporter::showInformation(const int _number, const QString &_url)
|
||||
// cache url first
|
||||
m_lastBugUrl = _url;
|
||||
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(i18n("Issue created"));
|
||||
msgBox->setText(i18n("Issue %1 has been created", _number));
|
||||
msgBox->setStandardButtons(QMessageBox::Open | QMessageBox::Close);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
auto event = KNotification::event("system", i18n("Issue created"), i18n("Issue %1 has been created", _number));
|
||||
event->setComponentName("plasma-applet-org.kde.plasma.awesome-widget");
|
||||
|
||||
msgBox->open(this, SLOT(userReplyOnBugReport(QAbstractButton *)));
|
||||
}
|
||||
|
||||
|
||||
void AWBugReporter::userReplyOnBugReport(QAbstractButton *_button)
|
||||
{
|
||||
auto ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
qCInfo(LOG_AW) << "User select" << ret;
|
||||
|
||||
switch (ret) {
|
||||
case QMessageBox::AcceptRole:
|
||||
QDesktopServices::openUrl(m_lastBugUrl);
|
||||
break;
|
||||
case QMessageBox::RejectRole:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto action = event->addAction(i18n("Details"));
|
||||
connect(action, &KNotificationAction::activated, this, &AWBugReporter::openBugReport);
|
||||
}
|
||||
|
@ -40,8 +40,8 @@ signals:
|
||||
|
||||
private slots:
|
||||
void issueReplyReceived(QNetworkReply *_reply);
|
||||
void openBugReport();
|
||||
void showInformation(int _number, const QString &_url);
|
||||
void userReplyOnBugReport(QAbstractButton *_button);
|
||||
|
||||
private:
|
||||
QString m_lastBugUrl;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QDBusError>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QtConcurrent>
|
||||
|
||||
#include "awdataaggregator.h"
|
||||
#include "awdataengineaggregator.h"
|
||||
@ -189,7 +189,8 @@ void AWKeys::dataUpdated(const QHash<QString, KSysGuard::SensorInfo> &_sensors,
|
||||
if (!_sensors.contains(data.sensorProperty))
|
||||
continue;
|
||||
auto sensor = _sensors[data.sensorProperty];
|
||||
std::ignore = QtConcurrent::run(m_threadPool, &AWKeys::setDataBySource, this, data.sensorProperty, sensor, data.payload);
|
||||
std::ignore = QtConcurrent::run(m_threadPool, &AWKeys::setDataBySource, this, data.sensorProperty, sensor,
|
||||
data.payload);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "awupdatehelper.h"
|
||||
|
||||
#include <KI18n/KLocalizedString>
|
||||
#include <KNotifications/KNotification>
|
||||
|
||||
#include <QDesktopServices>
|
||||
#include <QJsonDocument>
|
||||
@ -70,8 +71,7 @@ bool AWUpdateHelper::checkVersion()
|
||||
qCInfo(LOG_AW) << "Found version" << version << "actual one is" << m_foundVersion;
|
||||
|
||||
if ((version != m_foundVersion) && (!QString(CHANGELOG).isEmpty())) {
|
||||
genMessageBox(i18nc("Changelog of %1", VERSION), QString(CHANGELOG).replace('@', '\n'), QMessageBox::Ok)
|
||||
->open();
|
||||
sendNotification(i18nc("Changelog of %1", VERSION), QString(CHANGELOG).replace('@', '\n'));
|
||||
return true;
|
||||
} else if (version != m_foundVersion) {
|
||||
qCWarning(LOG_AW) << "No changelog information provided";
|
||||
@ -84,6 +84,12 @@ bool AWUpdateHelper::checkVersion()
|
||||
}
|
||||
|
||||
|
||||
void AWUpdateHelper::openReleasesPage()
|
||||
{
|
||||
QDesktopServices::openUrl(QString(RELEASES) + m_foundVersion.toString());
|
||||
}
|
||||
|
||||
|
||||
void AWUpdateHelper::showInfo(const QVersionNumber &_version)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Version" << _version;
|
||||
@ -91,7 +97,7 @@ void AWUpdateHelper::showInfo(const QVersionNumber &_version)
|
||||
auto text = i18n("You are using the actual version %1", _version.toString());
|
||||
if (!QString(COMMIT_SHA).isEmpty())
|
||||
text += QString(" (%1)").arg(QString(COMMIT_SHA));
|
||||
return genMessageBox(i18n("No new version found"), text, QMessageBox::Ok)->open();
|
||||
sendNotification(i18n("No new version found"), text);
|
||||
}
|
||||
|
||||
|
||||
@ -105,24 +111,9 @@ void AWUpdateHelper::showUpdates(const QVersionNumber &_version)
|
||||
text += i18n("New version : %1", _version.toString()) + "\n\n";
|
||||
text += i18n("Click \"Ok\" to download");
|
||||
|
||||
genMessageBox(i18n("There are updates"), text, QMessageBox::Ok | QMessageBox::Cancel)
|
||||
->open(this, SLOT(userReplyOnUpdates(QAbstractButton *)));
|
||||
}
|
||||
|
||||
|
||||
void AWUpdateHelper::userReplyOnUpdates(QAbstractButton *_button)
|
||||
{
|
||||
auto ret = dynamic_cast<QMessageBox *>(sender())->buttonRole(_button);
|
||||
qCInfo(LOG_AW) << "User select" << ret;
|
||||
|
||||
switch (ret) {
|
||||
case QMessageBox::AcceptRole:
|
||||
QDesktopServices::openUrl(QString(RELEASES) + m_foundVersion.toString());
|
||||
break;
|
||||
case QMessageBox::RejectRole:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto event = sendNotification(i18n("There are updates"), text);
|
||||
auto action = event->addAction(i18n("Details"));
|
||||
connect(action, &KNotificationAction::activated, this, &AWUpdateHelper::openReleasesPage);
|
||||
}
|
||||
|
||||
|
||||
@ -158,18 +149,12 @@ void AWUpdateHelper::versionReplyReceived(QNetworkReply *_reply, const bool _sho
|
||||
|
||||
|
||||
// additional method which is used to show message box which does not block UI
|
||||
QMessageBox *AWUpdateHelper::genMessageBox(const QString &_title, const QString &_body,
|
||||
const QMessageBox::StandardButtons _buttons)
|
||||
KNotification *AWUpdateHelper::sendNotification(const QString &_title, const QString &_body)
|
||||
{
|
||||
qCDebug(LOG_AW) << "Construct message box with title" << _title << "and body" << _body;
|
||||
|
||||
auto msgBox = new QMessageBox(nullptr);
|
||||
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||
msgBox->setModal(false);
|
||||
msgBox->setWindowTitle(_title);
|
||||
msgBox->setText(_body);
|
||||
msgBox->setStandardButtons(_buttons);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
auto event = KNotification::event("system", _title, _body);
|
||||
event->setComponentName("plasma-applet-org.kde.plasma.awesome-widget");
|
||||
|
||||
return msgBox;
|
||||
return event;
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QObject>
|
||||
#include <QVersionNumber>
|
||||
|
||||
|
||||
class KNotification;
|
||||
class QNetworkReply;
|
||||
|
||||
class AWUpdateHelper : public QObject
|
||||
@ -35,14 +35,13 @@ public:
|
||||
bool checkVersion();
|
||||
|
||||
private slots:
|
||||
void openReleasesPage();
|
||||
static void showInfo(const QVersionNumber &_version);
|
||||
void showUpdates(const QVersionNumber &_version);
|
||||
void userReplyOnUpdates(QAbstractButton *_button);
|
||||
void versionReplyReceived(QNetworkReply *_reply, bool _showAnyway);
|
||||
|
||||
private:
|
||||
static QMessageBox *genMessageBox(const QString &_title, const QString &_body,
|
||||
QMessageBox::StandardButtons _buttons);
|
||||
static KNotification *sendNotification(const QString &_title, const QString &_body);
|
||||
QVersionNumber m_foundVersion;
|
||||
QString m_genericConfig;
|
||||
};
|
||||
|
@ -8,7 +8,7 @@ add_definitions(
|
||||
${Qt6Qml_DEFINITIONS} ${Qt6Widgets_DEFINITIONS}
|
||||
)
|
||||
set(Qt_INCLUDE
|
||||
${Qt6Core_INCLUDE_DIRS} ${Qt6DBus_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}
|
||||
${Qt6Core_INCLUDE_DIRS} ${Qt6Concurrent_INCLUDE_DIRS} ${Qt6DBus_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}
|
||||
${Qt6Qml_INCLUDE_DIRS} ${Qt6Widgets_INCLUDE_DIRS}
|
||||
)
|
||||
set(Qt_LIBRARIES
|
||||
|
Loading…
x
Reference in New Issue
Block a user