Options tab with savesent checkbox
This commit is contained in:
@@ -121,12 +121,33 @@ void MainWindow::setupStatusBar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setupSettingsModal() {
|
void MainWindow::setupSettingsModal() {
|
||||||
|
|
||||||
// Set up File -> Settings action
|
// Set up File -> Settings action
|
||||||
QObject::connect(ui->actionSettings, &QAction::triggered, [=]() {
|
QObject::connect(ui->actionSettings, &QAction::triggered, [=]() {
|
||||||
QDialog settingsDialog(this);
|
QDialog settingsDialog(this);
|
||||||
Ui_Settings settings;
|
Ui_Settings settings;
|
||||||
settings.setupUi(&settingsDialog);
|
settings.setupUi(&settingsDialog);
|
||||||
|
|
||||||
|
// Setup save sent check box
|
||||||
|
QObject::connect(settings.chkSaveTxs, &QCheckBox::stateChanged, [=](auto checked) {
|
||||||
|
Settings::getInstance()->setSaveSent(checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Setup clear button
|
||||||
|
QObject::connect(settings.btnClearSaved, &QCheckBox::clicked, [=]() {
|
||||||
|
if (QMessageBox::warning(this, "Clear saved history?",
|
||||||
|
"Shielded z-Address sent transactions are stored locally in your wallet. You may delete this saved information safely any time for your privacy.\nDo you want to delete this now ?",
|
||||||
|
QMessageBox::Yes, QMessageBox::Cancel)) {
|
||||||
|
SentTxStore::deleteHistory();
|
||||||
|
// Reload after the clear button so existing txs disappear
|
||||||
|
rpc->refresh();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Save sent transactions
|
||||||
|
settings.chkSaveTxs->setChecked(Settings::getInstance()->getSaveSent());
|
||||||
|
|
||||||
|
// Connection Settings
|
||||||
QIntValidator validator(0, 65535);
|
QIntValidator validator(0, 65535);
|
||||||
settings.port->setValidator(&validator);
|
settings.port->setValidator(&validator);
|
||||||
|
|
||||||
@@ -153,6 +174,9 @@ void MainWindow::setupSettingsModal() {
|
|||||||
settings.rpcpassword->setEnabled(true);
|
settings.rpcpassword->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Connection tab by default
|
||||||
|
settings.tabWidget->setCurrentIndex(0);
|
||||||
|
|
||||||
if (settingsDialog.exec() == QDialog::Accepted) {
|
if (settingsDialog.exec() == QDialog::Accepted) {
|
||||||
if (zcashConfLocation.isEmpty()) {
|
if (zcashConfLocation.isEmpty()) {
|
||||||
// Save settings
|
// Save settings
|
||||||
@@ -168,6 +192,7 @@ void MainWindow::setupSettingsModal() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::donate() {
|
void MainWindow::donate() {
|
||||||
|
|||||||
@@ -316,8 +316,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>841</width>
|
<width>849</width>
|
||||||
<height>321</height>
|
<height>369</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="sendToLayout">
|
<layout class="QVBoxLayout" name="sendToLayout">
|
||||||
@@ -712,7 +712,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>889</width>
|
<width>889</width>
|
||||||
<height>22</height>
|
<height>19</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuBalance">
|
<widget class="QMenu" name="menuBalance">
|
||||||
@@ -720,7 +720,6 @@
|
|||||||
<string>File</string>
|
<string>File</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionImport_Private_Keys"/>
|
<addaction name="actionImport_Private_Keys"/>
|
||||||
<addaction name="actionDelete_Sent_History"/>
|
|
||||||
<addaction name="actionSettings"/>
|
<addaction name="actionSettings"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionExit"/>
|
<addaction name="actionExit"/>
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ QList<TransactionItem> SentTxStore::readSentTxFile() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SentTxStore::addToSentTx(Tx tx, QString txid) {
|
void SentTxStore::addToSentTx(Tx tx, QString txid) {
|
||||||
|
// Save transactions only if the settings are allowed
|
||||||
|
if (!Settings::getInstance()->getSaveSent())
|
||||||
|
return;
|
||||||
|
|
||||||
QFile data(writeableFile());
|
QFile data(writeableFile());
|
||||||
QJsonDocument jsonDoc;
|
QJsonDocument jsonDoc;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,19 @@ Settings::~Settings() {
|
|||||||
delete uisettings;
|
delete uisettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::getSaveSent() {
|
||||||
|
// Load from the QT Settings.
|
||||||
|
QSettings s;
|
||||||
|
|
||||||
|
return s.value("options/savesenttx", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setSaveSent(bool savesent) {
|
||||||
|
QSettings s;
|
||||||
|
|
||||||
|
s.setValue("options/savesenttx", savesent);
|
||||||
|
}
|
||||||
|
|
||||||
Settings* Settings::init() {
|
Settings* Settings::init() {
|
||||||
if (instance == nullptr)
|
if (instance == nullptr)
|
||||||
instance = new Settings();
|
instance = new Settings();
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public:
|
|||||||
int getBlockNumber();
|
int getBlockNumber();
|
||||||
void setBlockNumber(int number);
|
void setBlockNumber(int number);
|
||||||
|
|
||||||
|
bool getSaveSent();
|
||||||
|
void setSaveSent(bool savesent);
|
||||||
|
|
||||||
bool isSaplingActive();
|
bool isSaplingActive();
|
||||||
|
|
||||||
const QString& getZcashdConfLocation() { return confLocation; }
|
const QString& getZcashdConfLocation() { return confLocation; }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -134,6 +134,63 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Options</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<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="1" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Outgoing shielded transactions can be saved locally in the UI for convinence. These are not saved with zcashd.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QPushButton" name="btnClearSaved">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear Saved</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="chkSaveTxs">
|
||||||
|
<property name="text">
|
||||||
|
<string>Save sent shielded transactions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" 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>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ public:
|
|||||||
sendToScrollArea->setWidgetResizable(true);
|
sendToScrollArea->setWidgetResizable(true);
|
||||||
sendToWidgets = new QWidget();
|
sendToWidgets = new QWidget();
|
||||||
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
sendToWidgets->setObjectName(QStringLiteral("sendToWidgets"));
|
||||||
sendToWidgets->setGeometry(QRect(0, 0, 841, 321));
|
sendToWidgets->setGeometry(QRect(0, 0, 849, 369));
|
||||||
sendToLayout = new QVBoxLayout(sendToWidgets);
|
sendToLayout = new QVBoxLayout(sendToWidgets);
|
||||||
sendToLayout->setSpacing(6);
|
sendToLayout->setSpacing(6);
|
||||||
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
sendToLayout->setContentsMargins(11, 11, 11, 11);
|
||||||
@@ -640,7 +640,7 @@ public:
|
|||||||
MainWindow->setCentralWidget(centralWidget);
|
MainWindow->setCentralWidget(centralWidget);
|
||||||
menuBar = new QMenuBar(MainWindow);
|
menuBar = new QMenuBar(MainWindow);
|
||||||
menuBar->setObjectName(QStringLiteral("menuBar"));
|
menuBar->setObjectName(QStringLiteral("menuBar"));
|
||||||
menuBar->setGeometry(QRect(0, 0, 889, 22));
|
menuBar->setGeometry(QRect(0, 0, 889, 19));
|
||||||
menuBalance = new QMenu(menuBar);
|
menuBalance = new QMenu(menuBar);
|
||||||
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
menuBalance->setObjectName(QStringLiteral("menuBalance"));
|
||||||
menuHelp = new QMenu(menuBar);
|
menuHelp = new QMenu(menuBar);
|
||||||
@@ -669,7 +669,6 @@ public:
|
|||||||
menuBar->addAction(menuBalance->menuAction());
|
menuBar->addAction(menuBalance->menuAction());
|
||||||
menuBar->addAction(menuHelp->menuAction());
|
menuBar->addAction(menuHelp->menuAction());
|
||||||
menuBalance->addAction(actionImport_Private_Keys);
|
menuBalance->addAction(actionImport_Private_Keys);
|
||||||
menuBalance->addAction(actionDelete_Sent_History);
|
|
||||||
menuBalance->addAction(actionSettings);
|
menuBalance->addAction(actionSettings);
|
||||||
menuBalance->addSeparator();
|
menuBalance->addSeparator();
|
||||||
menuBalance->addAction(actionExit);
|
menuBalance->addAction(actionExit);
|
||||||
|
|||||||
@@ -11,11 +11,14 @@
|
|||||||
|
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QCheckBox>
|
||||||
#include <QtWidgets/QDialog>
|
#include <QtWidgets/QDialog>
|
||||||
#include <QtWidgets/QDialogButtonBox>
|
#include <QtWidgets/QDialogButtonBox>
|
||||||
#include <QtWidgets/QFrame>
|
#include <QtWidgets/QFrame>
|
||||||
|
#include <QtWidgets/QGridLayout>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QLineEdit>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
#include <QtWidgets/QSpacerItem>
|
#include <QtWidgets/QSpacerItem>
|
||||||
#include <QtWidgets/QTabWidget>
|
#include <QtWidgets/QTabWidget>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
@@ -42,6 +45,13 @@ public:
|
|||||||
QLineEdit *rpcpassword;
|
QLineEdit *rpcpassword;
|
||||||
QVBoxLayout *verticalLayout_2;
|
QVBoxLayout *verticalLayout_2;
|
||||||
QSpacerItem *verticalSpacer;
|
QSpacerItem *verticalSpacer;
|
||||||
|
QWidget *tab_2;
|
||||||
|
QGridLayout *gridLayout;
|
||||||
|
QSpacerItem *horizontalSpacer;
|
||||||
|
QLabel *label_5;
|
||||||
|
QPushButton *btnClearSaved;
|
||||||
|
QCheckBox *chkSaveTxs;
|
||||||
|
QSpacerItem *verticalSpacer_2;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
|
|
||||||
void setupUi(QDialog *Settings)
|
void setupUi(QDialog *Settings)
|
||||||
@@ -125,6 +135,35 @@ public:
|
|||||||
verticalLayout_3->addItem(verticalSpacer);
|
verticalLayout_3->addItem(verticalSpacer);
|
||||||
|
|
||||||
tabWidget->addTab(tab, QString());
|
tabWidget->addTab(tab, QString());
|
||||||
|
tab_2 = new QWidget();
|
||||||
|
tab_2->setObjectName(QStringLiteral("tab_2"));
|
||||||
|
gridLayout = new QGridLayout(tab_2);
|
||||||
|
gridLayout->setObjectName(QStringLiteral("gridLayout"));
|
||||||
|
horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
|
|
||||||
|
gridLayout->addItem(horizontalSpacer, 2, 0, 1, 1);
|
||||||
|
|
||||||
|
label_5 = new QLabel(tab_2);
|
||||||
|
label_5->setObjectName(QStringLiteral("label_5"));
|
||||||
|
label_5->setWordWrap(true);
|
||||||
|
|
||||||
|
gridLayout->addWidget(label_5, 1, 0, 1, 2);
|
||||||
|
|
||||||
|
btnClearSaved = new QPushButton(tab_2);
|
||||||
|
btnClearSaved->setObjectName(QStringLiteral("btnClearSaved"));
|
||||||
|
|
||||||
|
gridLayout->addWidget(btnClearSaved, 2, 1, 1, 1);
|
||||||
|
|
||||||
|
chkSaveTxs = new QCheckBox(tab_2);
|
||||||
|
chkSaveTxs->setObjectName(QStringLiteral("chkSaveTxs"));
|
||||||
|
|
||||||
|
gridLayout->addWidget(chkSaveTxs, 0, 0, 1, 2);
|
||||||
|
|
||||||
|
verticalSpacer_2 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||||
|
|
||||||
|
gridLayout->addItem(verticalSpacer_2, 3, 0, 1, 2);
|
||||||
|
|
||||||
|
tabWidget->addTab(tab_2, QString());
|
||||||
|
|
||||||
verticalLayout->addWidget(tabWidget);
|
verticalLayout->addWidget(tabWidget);
|
||||||
|
|
||||||
@@ -140,7 +179,7 @@ public:
|
|||||||
QObject::connect(buttonBox, SIGNAL(accepted()), Settings, SLOT(accept()));
|
QObject::connect(buttonBox, SIGNAL(accepted()), Settings, SLOT(accept()));
|
||||||
QObject::connect(buttonBox, SIGNAL(rejected()), Settings, SLOT(reject()));
|
QObject::connect(buttonBox, SIGNAL(rejected()), Settings, SLOT(reject()));
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(0);
|
tabWidget->setCurrentIndex(1);
|
||||||
|
|
||||||
|
|
||||||
QMetaObject::connectSlotsByName(Settings);
|
QMetaObject::connectSlotsByName(Settings);
|
||||||
@@ -157,6 +196,10 @@ public:
|
|||||||
label_3->setText(QApplication::translate("Settings", "RPC Username", nullptr));
|
label_3->setText(QApplication::translate("Settings", "RPC Username", nullptr));
|
||||||
label_4->setText(QApplication::translate("Settings", "RPC Password", nullptr));
|
label_4->setText(QApplication::translate("Settings", "RPC Password", nullptr));
|
||||||
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("Settings", "zcashd connection", nullptr));
|
tabWidget->setTabText(tabWidget->indexOf(tab), QApplication::translate("Settings", "zcashd connection", nullptr));
|
||||||
|
label_5->setText(QApplication::translate("Settings", "Outgoing shielded transactions can be saved locally in the UI for convinence. These are not saved with zcashd.", nullptr));
|
||||||
|
btnClearSaved->setText(QApplication::translate("Settings", "Clear Saved", nullptr));
|
||||||
|
chkSaveTxs->setText(QApplication::translate("Settings", "Save sent shielded transactions", nullptr));
|
||||||
|
tabWidget->setTabText(tabWidget->indexOf(tab_2), QApplication::translate("Settings", "Options", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user