#161 Allow configuration for prices/check updates
This commit is contained in:
@@ -168,6 +168,10 @@ void ConnectionLoader::createZcashConf() {
|
|||||||
if (d.exec() == QDialog::Accepted) {
|
if (d.exec() == QDialog::Accepted) {
|
||||||
datadir = ui.lblDirName->text();
|
datadir = ui.lblDirName->text();
|
||||||
useTor = ui.chkUseTor->isChecked();
|
useTor = ui.chkUseTor->isChecked();
|
||||||
|
if (!ui.chkAllowInternet->isChecked()) {
|
||||||
|
Settings::getInstance()->setAllowFetchPrices(false);
|
||||||
|
Settings::getInstance()->setCheckForUpdates(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main->logger->write("Creating file " + confLocation);
|
main->logger->write("Creating file " + confLocation);
|
||||||
|
|||||||
@@ -99,6 +99,20 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<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">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="chkCustomDatadir">
|
<widget class="QCheckBox" name="chkCustomDatadir">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -106,13 +120,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="2" column="0">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
@@ -144,24 +151,41 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="8" column="0">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<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">
|
<widget class="QCheckBox" name="chkUseTor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Connect over Tor</string>
|
<string>Connect over Tor</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Please note that you'll need to already have a Tor service configured on port 9050</string>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -480,6 +480,12 @@ void MainWindow::setupSettingsModal() {
|
|||||||
// Auto shielding
|
// Auto shielding
|
||||||
settings.chkAutoShield->setChecked(Settings::getInstance()->getAutoShield());
|
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
|
// Use Tor
|
||||||
bool isUsingTor = false;
|
bool isUsingTor = false;
|
||||||
if (rpc->getConnection() != nullptr) {
|
if (rpc->getConnection() != nullptr) {
|
||||||
@@ -545,6 +551,12 @@ void MainWindow::setupSettingsModal() {
|
|||||||
// Auto shield
|
// Auto shield
|
||||||
Settings::getInstance()->setAutoShield(settings.chkAutoShield->isChecked());
|
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 (!isUsingTor && settings.chkTor->isChecked()) {
|
||||||
// If "use tor" was previously unchecked and now checked
|
// If "use tor" was previously unchecked and now checked
|
||||||
Settings::addToZcashConf(zcashConfLocation, "proxy=127.0.0.1:9050");
|
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
|
// Set up timer to refresh Price
|
||||||
priceTimer = new QTimer(main);
|
priceTimer = new QTimer(main);
|
||||||
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
QObject::connect(priceTimer, &QTimer::timeout, [=]() {
|
||||||
refreshZECPrice();
|
if (Settings::getInstance()->getAllowFetchPrices())
|
||||||
|
refreshZECPrice();
|
||||||
});
|
});
|
||||||
priceTimer->start(Settings::priceRefreshSpeed); // Every hour
|
priceTimer->start(Settings::priceRefreshSpeed); // Every hour
|
||||||
|
|
||||||
@@ -96,9 +97,13 @@ void RPC::setConnection(Connection* c) {
|
|||||||
Settings::removeFromZcashConf(zcashConfLocation, "rescan");
|
Settings::removeFromZcashConf(zcashConfLocation, "rescan");
|
||||||
Settings::removeFromZcashConf(zcashConfLocation, "reindex");
|
Settings::removeFromZcashConf(zcashConfLocation, "reindex");
|
||||||
|
|
||||||
// Refresh the UI
|
// If we're allowed to get the Zec Price, get the prices
|
||||||
refreshZECPrice();
|
if (Settings::getInstance()->getAllowFetchPrices())
|
||||||
checkForUpdate();
|
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
|
// Force update, because this might be coming from a settings update
|
||||||
// where we need to immediately refresh
|
// where we need to immediately refresh
|
||||||
|
|||||||
@@ -124,6 +124,22 @@ void Settings::setAutoShield(bool allow) {
|
|||||||
QSettings().setValue("options/autoshield", 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() {
|
bool Settings::getAllowCustomFees() {
|
||||||
// Load from the QT Settings.
|
// Load from the QT Settings.
|
||||||
return QSettings().value("options/customfees", false).toBool();
|
return QSettings().value("options/customfees", false).toBool();
|
||||||
|
|||||||
@@ -60,6 +60,12 @@ public:
|
|||||||
|
|
||||||
bool getAllowCustomFees();
|
bool getAllowCustomFees();
|
||||||
void setAllowCustomFees(bool allow);
|
void setAllowCustomFees(bool allow);
|
||||||
|
|
||||||
|
bool getAllowFetchPrices();
|
||||||
|
void setAllowFetchPrices(bool allow);
|
||||||
|
|
||||||
|
bool getCheckForUpdates();
|
||||||
|
void setCheckForUpdates(bool allow);
|
||||||
|
|
||||||
bool isSaplingActive();
|
bool isSaplingActive();
|
||||||
|
|
||||||
|
|||||||
166
src/settings.ui
166
src/settings.ui
@@ -26,7 +26,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -145,10 +145,74 @@
|
|||||||
<string>Options</string>
|
<string>Options</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="10" column="0" colspan="2">
|
<item row="14" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="lblTor">
|
<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">
|
<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>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@@ -172,26 +236,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="chkCustomFees">
|
<widget class="QCheckBox" name="chkCustomFees">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -199,71 +243,41 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="0" colspan="2">
|
<item row="5" 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">
|
|
||||||
<widget class="QCheckBox" name="chkAutoShield">
|
<widget class="QCheckBox" name="chkAutoShield">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Shield change from t-Addresses to your sapling address</string>
|
<string>Shield change from t-Addresses to your sapling address</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Connect to github on startup to check for updates</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="0">
|
<item row="12" column="0" colspan="2">
|
||||||
<widget class="QCheckBox" name="chkTor">
|
|
||||||
<property name="text">
|
|
||||||
<string>Connect via Tor</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
<widget class="QLabel" name="label_10">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user