添加商店内弹出窗消息

使用SpkUiMessage::SendStoreNotification激活,必须在SpkStore构造函数加载完全局SpkPopup类之后才可
使用。
This commit is contained in:
RigoLigoRLC
2021-07-20 15:15:37 +08:00
parent e3c43198b9
commit 99083d2bcb
12 changed files with 126 additions and 5 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
#include <QFileInfo>
#include "spklogging.h"
#include "spkmsgbox.h"
#include "spkuimsg.h"
SpkLogger *SpkLogger::Instance = nullptr;
@@ -124,6 +125,6 @@ void SpkLogger::Critical(QString message)
void SpkLogger::Notify(QString message)
{
Q_UNUSED(message);
SpkUiMessage::SendStoreNotification(message);
}
+3
View File
@@ -4,8 +4,10 @@
#include <QDir>
#include <QApplication>
#include <QtNetwork/QNetworkProxy>
#include "dtk/spkdtkplugin.h"
#include "gitver.h"
#include "spkpopup.h"
#include "spkstore.h"
#include "spkutils.h"
@@ -50,6 +52,7 @@ SpkStore::SpkStore(bool aCli, QString &aLogPath)
// UI Initialization
SpkUi::Initialize();
mMainWindow = new SpkMainWindow;
SpkUi::Popup = new SpkUi::SpkPopup(mMainWindow);
mMainWindow->show();
}
+2 -1
View File
@@ -1,5 +1,6 @@
#include "spkuimsg.h"
#include "spkpopup.h"
NotifyNotification *SpkUiMessage::_notify = nullptr; // Initialize statics
int SpkUiMessage::mTimeoutDesktop = 5000;
@@ -25,7 +26,7 @@ void SpkUiMessage::SendDesktopNotification(QString s, const char * const icon)
void SpkUiMessage::SendStoreNotification(QString s) // TODO: IMPLEMENT IN-APP NOTIFICATION
{
Q_UNUSED(s);
SpkUi::Popup->Show(s);
}
void SpkUiMessage::SetDesktopNotifyTimeout(int ms)
+3 -1
View File
@@ -1,4 +1,5 @@
#include <arpa/inet.h>
#include <QDebug>
#include "spkutils.h"
@@ -14,7 +15,8 @@ void SpkUtils::VerifySingleRequest(QPointer<QNetworkReply> aReply)
QString SpkUtils::GetDistroName()
{
QSettings osRelease("/etc/os-release", QSettings::IniFormat);
return osRelease.value("PRETTY_NAME", "Unknown Distro").toString();
return osRelease.value("PRETTY_NAME", "Unknown Distro").toString() + "-" +
osRelease.value("BUILD_ID", "Unknown Build").toString();
}
bool SpkUtils::VerifyReplyJson(QNetworkReply *aReply, QJsonValue &aRetDoc)