#161 Allow configuration for prices/check updates
This commit is contained in:
@@ -168,6 +168,10 @@ void ConnectionLoader::createZcashConf() {
|
||||
if (d.exec() == QDialog::Accepted) {
|
||||
datadir = ui.lblDirName->text();
|
||||
useTor = ui.chkUseTor->isChecked();
|
||||
if (!ui.chkAllowInternet->isChecked()) {
|
||||
Settings::getInstance()->setAllowFetchPrices(false);
|
||||
Settings::getInstance()->setCheckForUpdates(false);
|
||||
}
|
||||
}
|
||||
|
||||
main->logger->write("Creating file " + confLocation);
|
||||
|
||||
@@ -99,6 +99,20 @@
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Allow connections to the internet to check for updates, get ZEC/USD prices etc...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="chkCustomDatadir">
|
||||
<property name="text">
|
||||
@@ -106,13 +120,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Please choose a directory to store your wallet.dat and blockchain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
@@ -144,24 +151,41 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
<string>Please note that you'll need to already have a Tor service configured on port 9050</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="chkAllowInternet">
|
||||
<property name="text">
|
||||
<string>Connect to the internet for updates and price feeds</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Please choose a directory to store your wallet.dat and blockchain</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="chkUseTor">
|
||||
<property name="text">
|
||||
<string>Connect over Tor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Please note that you'll need to already have a Tor service configured on port 9050</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -480,6 +480,12 @@ void MainWindow::setupSettingsModal() {
|
||||
// Auto shielding
|
||||
settings.chkAutoShield->setChecked(Settings::getInstance()->getAutoShield());
|
||||
|
||||
// Check for updates
|
||||
settings.chkCheckUpdates->setChecked(Settings::getInstance()->getCheckForUpdates());
|
||||
|
||||
// Fetch prices
|
||||
settings.chkFetchPrices->setChecked(Settings::getInstance()->getAllowFetchPrices());
|
||||
|
||||
// Use Tor
|
||||
bool isUsingTor = false;
|
||||
if (rpc->getConnection() != nullptr) {
|
||||
@@ -545,6 +551,12 @@ void MainWindow::setupSettingsModal() {
|
||||
// Auto shield
|
||||
Settings::getInstance()->setAutoShield(settings.chkAutoShield->isChecked());
|
||||
|
||||
// Check for updates
|
||||
Settings::getInstance()->setCheckForUpdates(settings.chkCheckUpdates->isChecked());
|
||||
|
||||
// Allow fetching prices
|
||||
Settings::getInstance()->setAllowFetchPrices(settings.chkFetchPrices->isChecked());
|
||||
|
||||
if (!isUsingTor && settings.chkTor->isChecked()) {
|
||||
// If "use tor" was previously unchecked and now checked
|
||||
Settings::addToZcashConf(zcashConfLocation, "proxy=127.0.0.1:9050");
|
||||
|
||||
13
src/rpc.cpp
13
src/rpc.cpp
@@ -32,7 +32,8 @@ RPC::RPC(MainWindow* main) {
|
||||
// Set up timer to refresh Price
|
||||
priceTimer = new QTimer(main);
|
||||
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
||||
refreshZECPrice();
|
||||
if (Settings::getInstance()->getAllowFetchPrices())
|
||||
refreshZECPrice();
|
||||
});
|
||||
priceTimer->start(Settings::priceRefreshSpeed); // Every hour
|
||||
|
||||
@@ -96,9 +97,13 @@ void RPC::setConnection(Connection* c) {
|
||||
Settings::removeFromZcashConf(zcashConfLocation, "rescan");
|
||||
Settings::removeFromZcashConf(zcashConfLocation, "reindex");
|
||||
|
||||
// Refresh the UI
|
||||
refreshZECPrice();
|
||||
checkForUpdate();
|
||||
// If we're allowed to get the Zec Price, get the prices
|
||||
if (Settings::getInstance()->getAllowFetchPrices())
|
||||
refreshZECPrice();
|
||||
|
||||
// If we're allowed to check for updates, check for a new release
|
||||
if (Settings::getInstance()->getCheckForUpdates())
|
||||
checkForUpdate();
|
||||
|
||||
// Force update, because this might be coming from a settings update
|
||||
// where we need to immediately refresh
|
||||
|
||||
@@ -124,6 +124,22 @@ void Settings::setAutoShield(bool allow) {
|
||||
QSettings().setValue("options/autoshield", allow);
|
||||
}
|
||||
|
||||
bool Settings::getCheckForUpdates() {
|
||||
return QSettings().value("options/allowcheckupdates", true).toBool();
|
||||
}
|
||||
|
||||
void Settings::setCheckForUpdates(bool allow) {
|
||||
QSettings().setValue("options/allowcheckupdates", allow);
|
||||
}
|
||||
|
||||
bool Settings::getAllowFetchPrices() {
|
||||
return QSettings().value("options/allowfetchprices", true).toBool();
|
||||
}
|
||||
|
||||
void Settings::setAllowFetchPrices(bool allow) {
|
||||
QSettings().setValue("options/allowfetchprices", allow);
|
||||
}
|
||||
|
||||
bool Settings::getAllowCustomFees() {
|
||||
// Load from the QT Settings.
|
||||
return QSettings().value("options/customfees", false).toBool();
|
||||
|
||||
@@ -60,6 +60,12 @@ public:
|
||||
|
||||
bool getAllowCustomFees();
|
||||
void setAllowCustomFees(bool allow);
|
||||
|
||||
bool getAllowFetchPrices();
|
||||
void setAllowFetchPrices(bool allow);
|
||||
|
||||
bool getCheckForUpdates();
|
||||
void setCheckForUpdates(bool allow);
|
||||
|
||||
bool isSaplingActive();
|
||||
|
||||
|
||||
166
src/settings.ui
166
src/settings.ui
@@ -26,7 +26,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -145,10 +145,74 @@
|
||||
<string>Options</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblTor">
|
||||
<item row="14" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="chkTor">
|
||||
<property name="text">
|
||||
<string>Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally.</string>
|
||||
<string>Connect via Tor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkCheckUpdates">
|
||||
<property name="text">
|
||||
<string>Check github for updates at startup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkSaveTxs">
|
||||
<property name="text">
|
||||
<string>Remember shielded transactions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. </string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
@@ -172,26 +236,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkSaveTxs">
|
||||
<property name="text">
|
||||
<string>Remember shielded transactions</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="chkCustomFees">
|
||||
<property name="text">
|
||||
@@ -199,71 +243,41 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Normally, change from t-Addresses goes to another t-Address. Checking this option will send the change to your shielded sapling address instead. Check this option to increase your privacy.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0" colspan="2">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Allow overriding the default fees when sending transactions. Enabling this option may compromise your privacy since fees are transparent. </string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkAutoShield">
|
||||
<property name="text">
|
||||
<string>Shield change from t-Addresses to your sapling address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="lblTor">
|
||||
<property name="text">
|
||||
<string>Connect to the Tor network via SOCKS proxy running on 127.0.0.1:9050. Please note that you'll have to install and run the Tor service externally.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Connect to github on startup to check for updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QCheckBox" name="chkTor">
|
||||
<property name="text">
|
||||
<string>Connect via Tor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="12" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
<string>Connect to the internet to fetch ZEC prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="chkFetchPrices">
|
||||
<property name="text">
|
||||
<string>Fetch ZEC / USD prices</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user