mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-22 09:38:48 +02:00
Added option that hides notifications
Added option that hides status notifications.
This commit is contained in:
@@ -115,6 +115,12 @@ void Settings::setupPrivacyTab() {
|
||||
m_ctx->updateBalance();
|
||||
});
|
||||
|
||||
// [Hide notifications]
|
||||
ui->checkBox_hideNotifications->setChecked(config()->get(Config::hideNotifications).toBool());
|
||||
connect(ui->checkBox_hideNotifications, &QCheckBox::toggled, [this](bool toggled){
|
||||
config()->set(Config::hideNotifications, toggled);
|
||||
});
|
||||
|
||||
// [Disable websocket]
|
||||
ui->checkBox_enableWebsocket->setChecked(!config()->get(Config::disableWebsocket).toBool());
|
||||
connect(ui->checkBox_enableWebsocket, &QCheckBox::toggled, [this](bool checked){
|
||||
@@ -273,4 +279,4 @@ void Settings::closeEvent(QCloseEvent *event) {
|
||||
event->accept();
|
||||
}
|
||||
|
||||
Settings::~Settings() = default;
|
||||
Settings::~Settings() = default;
|
||||
|
||||
@@ -346,6 +346,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_hideNotifications">
|
||||
<property name="text">
|
||||
<string>Hide notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox_offlineMode">
|
||||
<property name="text">
|
||||
|
||||
+24
-21
@@ -480,26 +480,29 @@ void externalLinkWarning(QWidget *parent, const QString &url){
|
||||
}
|
||||
|
||||
void desktopNotify(const QString &title, const QString &message, int duration) {
|
||||
QStringList notify_send = QStringList() << title << message << "-t" << QString::number(duration);
|
||||
QStringList kdialog = QStringList() << title << message;
|
||||
QStringList macos = QStringList() << "-e" << QString(R"(display notification "%1" with title "%2")").arg(message).arg(title);
|
||||
#if defined(Q_OS_LINUX)
|
||||
QProcess process;
|
||||
if (fileExists("/usr/bin/kdialog"))
|
||||
process.start("/usr/bin/kdialog", kdialog);
|
||||
else if (fileExists("/usr/bin/notify-send"))
|
||||
process.start("/usr/bin/notify-send", notify_send);
|
||||
process.waitForFinished(-1);
|
||||
QString stdout = process.readAllStandardOutput();
|
||||
QString stderr = process.readAllStandardError();
|
||||
#elif defined(Q_OS_MACOS)
|
||||
QProcess process;
|
||||
// @TODO: need to escape special chars with "\"
|
||||
process.start("osascript", macos);
|
||||
process.waitForFinished(-1);
|
||||
QString stdout = process.readAllStandardOutput();
|
||||
QString stderr = process.readAllStandardError();
|
||||
#endif
|
||||
if (!Config::hideNotifications)
|
||||
{
|
||||
QStringList notify_send = QStringList() << title << message << "-t" << QString::number(duration);
|
||||
QStringList kdialog = QStringList() << title << message;
|
||||
QStringList macos = QStringList() << "-e" << QString(R"(display notification "%1" with title "%2")").arg(message).arg(title);
|
||||
#if defined(Q_OS_LINUX)
|
||||
QProcess process;
|
||||
if (fileExists("/usr/bin/kdialog"))
|
||||
process.start("/usr/bin/kdialog", kdialog);
|
||||
else if (fileExists("/usr/bin/notify-send"))
|
||||
process.start("/usr/bin/notify-send", notify_send);
|
||||
process.waitForFinished(-1);
|
||||
QString stdout = process.readAllStandardOutput();
|
||||
QString stderr = process.readAllStandardError();
|
||||
#elif defined(Q_OS_MACOS)
|
||||
QProcess process;
|
||||
// @TODO: need to escape special chars with "\"
|
||||
process.start("osascript", macos);
|
||||
process.waitForFinished(-1);
|
||||
QString stdout = process.readAllStandardOutput();
|
||||
QString stderr = process.readAllStandardError();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
QTextCharFormat addressTextFormat(const SubaddressIndex &index, quint64 amount) {
|
||||
@@ -566,4 +569,4 @@ QFont relativeFont(int delta) {
|
||||
font.setPointSize(font.pointSize() + delta);
|
||||
return font;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
||||
{Config::multiBroadcast, {QS("multiBroadcast"), true}},
|
||||
{Config::warnOnExternalLink,{QS("warnOnExternalLink"), true}},
|
||||
{Config::hideBalance, {QS("hideBalance"), false}},
|
||||
{Config::hideNotifications, {QS("hideNotifications"), false}},
|
||||
{Config::disableLogging, {QS("disableLogging"), false}},
|
||||
|
||||
{Config::blockExplorer,{QS("blockExplorer"), "exploremonero.com"}},
|
||||
@@ -224,4 +225,4 @@ Config* Config::instance()
|
||||
}
|
||||
|
||||
return m_instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public:
|
||||
warnOnExternalLink,
|
||||
hideBalance,
|
||||
disableLogging,
|
||||
hideNotifications,
|
||||
|
||||
blockExplorer,
|
||||
redditFrontend,
|
||||
|
||||
Reference in New Issue
Block a user