Files
SilentDragonXLite/src/settings.h
earthorbit e7b08612fa Themeability (#186)
* add css (qss)

* Include css

* Merge pull request #6 from Fair-Exchange/css

Css

* fix

* beta blue

* fix

* YellowFevers UI work

* Merge pull request #7 from Fair-Exchange/css

Css - YellowFevers UI work

* Update mainwindow.cpp

* Update mainwindow.ui

* Merge pull request #6 from OleksandrBlack/css

move Tx list to balance tab

* Ease of use

General usability improvements

* Delete main.css

* style for tab

* Merge pull request #7 from YellowFeveRs/UI-work

General UI improvements

* updated tab styling

* Merge pull request #8 from Fair-Exchange/css

Css

* fix

* fix for Windows

* fix for Windows

* fix

* Merge pull request #10 from Fair-Exchange/master

Merge pull request #4 from OleksandrBlack/master

* Merge pull request #10 from Fair-Exchange/master

Merge pull request #4 from OleksandrBlack/master

* Merge pull request #11 from OleksandrBlack/css

Css

* Merge pull request #12 from OleksandrBlack/style

blue prepare

* revert

* Update zec_qt_wallet_zh.ts

* Update zec_qt_wallet_es.ts

* Update zec_qt_wallet_fr.ts

* Update zec_qt_wallet_it.ts

* Update zec_qt_wallet_pt.ts

* Update json.hpp

* Update json.hpp

* Update about.ui

* Update mainwindow.ui

* Update connection.ui

* Update connection.cpp

* Update connection.cpp

* Update application.qrc

* Update mainwindow.cpp

* Update settings.ui
2019-09-27 10:27:15 -07:00

149 lines
3.9 KiB
C++

#ifndef SETTINGS_H
#define SETTINGS_H
#include "precompiled.h"
struct Config {
QString host;
QString port;
QString rpcuser;
QString rpcpassword;
};
struct ToFields;
struct Tx;
struct PaymentURI {
QString addr;
QString amt;
QString memo;
// Any errors are stored here
QString error;
};
class Settings
{
public:
static Settings* init();
static Settings* getInstance();
Config getSettings();
void saveSettings(const QString& host, const QString& port, const QString& username, const QString& password);
bool isTestnet();
void setTestnet(bool isTestnet);
bool isSaplingAddress(QString addr);
bool isSproutAddress(QString addr);
bool isValidSaplingPrivateKey(QString pk);
bool isSyncing();
void setSyncing(bool syncing);
int getZcashdVersion();
void setZcashdVersion(int version);
void setUseEmbedded(bool r) { _useEmbedded = r; }
bool useEmbedded() { return _useEmbedded; }
void setHeadless(bool h) { _headless = h; }
bool isHeadless() { return _headless; }
int getBlockNumber();
void setBlockNumber(int number);
bool getSaveZtxs();
void setSaveZtxs(bool save);
bool getAutoShield();
void setAutoShield(bool allow);
bool getAllowCustomFees();
void setAllowCustomFees(bool allow);
bool getAllowFetchPrices();
void setAllowFetchPrices(bool allow);
bool getCheckForUpdates();
void setCheckForUpdates(bool allow);
QString get_theme_name();
void set_theme_name(QString theme_name);
bool isSaplingActive();
void setUsingZcashConf(QString confLocation);
const QString& getZcashdConfLocation() { return _confLocation; }
void setZECPrice(double p) { zecPrice = p; }
double getZECPrice();
void setPeers(int peers);
int getPeers();
// Static stuff
static const QString txidStatusMessage;
static void saveRestore(QDialog* d);
static void saveRestoreTableHeader(QTableView* table, QDialog* d, QString tablename) ;
static void openAddressInExplorer(QString address);
static void openTxInExplorer(QString txid);
static PaymentURI parseURI(QString paymentURI);
static QString paymentURIPretty(PaymentURI);
static bool isZAddress(QString addr);
static bool isTAddress(QString addr);
static QString getDecimalString(double amt);
static QString getUSDFormat(double usdAmt);
static QString getUSDFromZecAmount(double bal);
static QString getZECDisplayFormat(double bal);
static QString getZECUSDDisplayFormat(double bal);
static QString getTokenName();
static QString getDonationAddr();
static double getMinerFee();
static double getZboardAmount();
static QString getZboardAddr();
static int getMaxMobileAppTxns() { return 30; }
static bool isValidAddress(QString addr);
static bool addToZcashConf(QString confLocation, QString line);
static bool removeFromZcashConf(QString confLocation, QString option);
static const QString labelRegExp;
static const int updateSpeed = 20 * 1000; // 20 sec
static const int quickUpdateSpeed = 5 * 1000; // 5 sec
static const int priceRefreshSpeed = 60 * 60 * 1000; // 1 hr
private:
// This class can only be accessed through Settings::getInstance()
Settings() = default;
~Settings() = default;
static Settings* instance;
QString _confLocation;
QString _executable;
bool _isTestnet = false;
bool _isSyncing = false;
int _blockNumber = 0;
int _zcashdVersion = 0;
bool _useEmbedded = false;
bool _headless = false;
int _peerConnections = 0;
double zecPrice = 0.0;
};
#endif // SETTINGS_H