mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-01-30 00:14:20 +00:00
silent mode added
This commit is contained in:
parent
89078226d0
commit
ffdaf1e4b4
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ Makefile
|
||||
qrc_bitcoin.cpp
|
||||
gostcoin-qt
|
||||
gostcoind
|
||||
*.pro.user
|
@ -99,9 +99,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent) :
|
||||
// Create the toolbars
|
||||
createToolBars();
|
||||
|
||||
// Create system tray icon and notification
|
||||
createTrayIcon();
|
||||
|
||||
// Create status bar
|
||||
statusBar();
|
||||
|
||||
@ -310,6 +307,9 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
|
||||
this->clientModel = clientModel;
|
||||
if(clientModel)
|
||||
{
|
||||
// Create system tray icon and notification
|
||||
createTrayIcon();
|
||||
|
||||
// Replace some strings and icons, when using the testnet
|
||||
if(clientModel->isTestNet())
|
||||
{
|
||||
@ -416,7 +416,7 @@ void BitcoinGUI::createTrayIcon()
|
||||
trayIcon->show();
|
||||
#endif
|
||||
|
||||
notificator = new Notificator(QApplication::applicationName(), trayIcon);
|
||||
notificator = new Notificator(clientModel->getOptionsModel(), QApplication::applicationName(), trayIcon);
|
||||
}
|
||||
|
||||
void BitcoinGUI::createTrayIconMenu()
|
||||
|
@ -24,7 +24,7 @@
|
||||
// https://wiki.ubuntu.com/NotificationDevelopmentGuidelines recommends at least 128
|
||||
const int FREEDESKTOP_NOTIFICATION_ICON_SIZE = 128;
|
||||
|
||||
Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent):
|
||||
Notificator::Notificator(OptionsModel* optionsModel, const QString &programName, QSystemTrayIcon *trayicon, QWidget *parent):
|
||||
QObject(parent),
|
||||
parent(parent),
|
||||
programName(programName),
|
||||
@ -33,6 +33,7 @@ Notificator::Notificator(const QString &programName, QSystemTrayIcon *trayicon,
|
||||
#ifdef USE_DBUS
|
||||
,interface(0)
|
||||
#endif
|
||||
,fOptions(optionsModel)
|
||||
{
|
||||
if(trayicon && trayicon->supportsMessages())
|
||||
{
|
||||
@ -287,6 +288,9 @@ void Notificator::notifyMacUserNotificationCenter(Class cls, const QString &titl
|
||||
|
||||
void Notificator::notify(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout)
|
||||
{
|
||||
//skip non-crit notifications in silent mode
|
||||
if(cls != Critical) if(fOptions->isSilentMode()) return;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
#ifdef USE_DBUS
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <QObject>
|
||||
#include <QIcon>
|
||||
|
||||
#include "optionsmodel.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QSystemTrayIcon;
|
||||
#ifdef USE_DBUS
|
||||
@ -20,7 +22,7 @@ public:
|
||||
/** Create a new notificator.
|
||||
@note Ownership of trayIcon is not transferred to this object.
|
||||
*/
|
||||
Notificator(const QString &programName=QString(), QSystemTrayIcon *trayIcon=0, QWidget *parent=0);
|
||||
Notificator(OptionsModel* options, const QString &programName=QString(), QSystemTrayIcon *trayIcon=0, QWidget *parent=0);
|
||||
~Notificator();
|
||||
|
||||
// Message class
|
||||
@ -66,6 +68,7 @@ private:
|
||||
void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
||||
void notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon);
|
||||
#endif
|
||||
OptionsModel* fOptions;
|
||||
};
|
||||
|
||||
#endif // NOTIFICATOR_H
|
||||
|
@ -156,6 +156,7 @@ void OptionsDialog::setMapper()
|
||||
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
|
||||
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
|
||||
#endif
|
||||
mapper->addMapping(ui->silentMode, OptionsModel::SilentMode);
|
||||
|
||||
/* Display */
|
||||
mapper->addMapping(ui->lang, OptionsModel::Language);
|
||||
|
@ -111,6 +111,7 @@ void OptionsModel::Init()
|
||||
nDisplayUnit = settings.value("nDisplayUnit", BitcoinUnits::BTC).toInt();
|
||||
bDisplayAddresses = settings.value("bDisplayAddresses", false).toBool();
|
||||
fMinimizeToTray = settings.value("fMinimizeToTray", false).toBool();
|
||||
fSilentMode = settings.value("fSilentMode", false).toBool();
|
||||
fMinimizeOnClose = settings.value("fMinimizeOnClose", false).toBool();
|
||||
nTransactionFee = settings.value("nTransactionFee").toLongLong();
|
||||
language = settings.value("language", "").toString();
|
||||
@ -223,7 +224,7 @@ bool OptionsModel::Upgrade()
|
||||
}
|
||||
}
|
||||
QList<QString> boolOptions;
|
||||
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
|
||||
boolOptions << "bDisplayAddresses" << "fMinimizeToTray" << "fSilentMode" << "fMinimizeOnClose" << "fUseProxy" << "fUseUPnP";
|
||||
foreach(QString key, boolOptions)
|
||||
{
|
||||
bool value = false;
|
||||
@ -275,6 +276,8 @@ QVariant OptionsModel::data(const QModelIndex & index, int role) const
|
||||
return QVariant(GUIUtil::GetStartOnSystemStartup());
|
||||
case MinimizeToTray:
|
||||
return QVariant(fMinimizeToTray);
|
||||
case SilentMode:
|
||||
return QVariant(fSilentMode);
|
||||
case MapPortUPnP:
|
||||
#ifdef USE_UPNP
|
||||
return settings.value("fUseUPnP", GetBoolArg("-upnp", true));
|
||||
@ -393,6 +396,10 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
|
||||
fMinimizeToTray = value.toBool();
|
||||
settings.setValue("fMinimizeToTray", fMinimizeToTray);
|
||||
break;
|
||||
case SilentMode:
|
||||
fSilentMode = value.toBool();
|
||||
settings.setValue("fSilentMode", fSilentMode);
|
||||
break;
|
||||
case MapPortUPnP:
|
||||
settings.setValue("fUseUPnP", value.toBool());
|
||||
MapPort(value.toBool());
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
I2POutboundAllowZeroHop, // bool
|
||||
I2POutboundIPRestriction, // int
|
||||
I2POutboundPriority, // int
|
||||
SilentMode, // bool
|
||||
OptionIDRowCount,
|
||||
};
|
||||
|
||||
@ -65,6 +66,7 @@ public:
|
||||
/* Explicit getters */
|
||||
qint64 getTransactionFee();
|
||||
bool getMinimizeToTray() { return fMinimizeToTray; }
|
||||
bool isSilentMode() { return fSilentMode; }
|
||||
bool getMinimizeOnClose() { return fMinimizeOnClose; }
|
||||
int getDisplayUnit() { return nDisplayUnit; }
|
||||
bool getDisplayAddresses() { return bDisplayAddresses; }
|
||||
@ -75,6 +77,7 @@ private:
|
||||
int nDisplayUnit;
|
||||
bool bDisplayAddresses;
|
||||
bool fMinimizeToTray;
|
||||
bool fSilentMode;
|
||||
bool fMinimizeOnClose;
|
||||
QString language;
|
||||
bool fCoinControlFeatures;
|
||||
|
Loading…
x
Reference in New Issue
Block a user