Browse Source

remove recurring from ui Issue #77

pull/130/head
DenioD 4 years ago
parent
commit
f46068681c
  1. 31
      src/mainwindow.ui
  2. 66
      src/sendtab.cpp

31
src/mainwindow.ui

@ -59,7 +59,7 @@
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>5</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
@ -426,7 +426,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1226</width> <width>1226</width>
<height>488</height> <height>493</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="sendToLayout"> <layout class="QVBoxLayout" name="sendToLayout">
@ -611,33 +611,6 @@
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="layoutSendRecurring"> <layout class="QHBoxLayout" name="layoutSendRecurring">
<item>
<widget class="QCheckBox" name="chkRecurring">
<property name="text">
<string>Recurring payment</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblRecurDesc">
<property name="text">
<string>Every month, starting 12-May-2012, for 6 payments</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnRecurSchedule">
<property name="text">
<string>Edit Schedule</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_7"> <spacer name="horizontalSpacer_7">
<property name="orientation"> <property name="orientation">

66
src/sendtab.cpp

@ -138,7 +138,7 @@ void MainWindow::setupSendTab() {
ui->MemoTxt1->setFont(f); ui->MemoTxt1->setFont(f);
// Recurring button // Recurring button
QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) { /*QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) {
if (checked) { if (checked) {
ui->btnRecurSchedule->setEnabled(true); ui->btnRecurSchedule->setEnabled(true);
@ -150,23 +150,23 @@ void MainWindow::setupSendTab() {
ui->btnRecurSchedule->setEnabled(false); ui->btnRecurSchedule->setEnabled(false);
ui->lblRecurDesc->setText(""); ui->lblRecurDesc->setText("");
} }
}); });*/
// Recurring schedule button // Recurring schedule button
QObject::connect(ui->btnRecurSchedule, &QPushButton::clicked, this, &MainWindow::editSchedule); // QObject::connect(ui->btnRecurSchedule, &QPushButton::clicked, this, &MainWindow::editSchedule);
// Set the default state for the whole page // Set the default state for the whole page
clearSendForm(); clearSendForm();
} }
void MainWindow::disableRecurring() { void MainWindow::disableRecurring() {
if (!Settings::getInstance()->isTestnet()) { /* if (!Settings::getInstance()->isTestnet()) {
ui->chkRecurring->setVisible(false); ui->chkRecurring->setVisible(false);
ui->chkRecurring->setEnabled(false); ui->chkRecurring->setEnabled(false);
ui->btnRecurSchedule->setVisible(false); ui->btnRecurSchedule->setVisible(false);
ui->btnRecurSchedule->setEnabled(false); ui->btnRecurSchedule->setEnabled(false);
ui->action_Recurring_Payments->setVisible(false); ui->action_Recurring_Payments->setVisible(false);*/
} // }
} }
void MainWindow::editSchedule() { void MainWindow::editSchedule() {
@ -185,21 +185,21 @@ void MainWindow::editSchedule() {
} }
// Open the edit schedule dialog // Open the edit schedule dialog
auto recurringInfo = Recurring::getInstance()->getNewRecurringFromTx(this, this, // auto recurringInfo = Recurring::getInstance()->getNewRecurringFromTx(this, this,
createTxFromSendPage(), this->sendTxRecurringInfo); // createTxFromSendPage(), this->sendTxRecurringInfo);
if (recurringInfo == nullptr) { // if (recurringInfo == nullptr) {
// User pressed cancel. // User pressed cancel.
// If there is no existing recurring info, uncheck the recurring box // If there is no existing recurring info, uncheck the recurring box
if (sendTxRecurringInfo == nullptr) { // if (sendTxRecurringInfo == nullptr) {
ui->chkRecurring->setCheckState(Qt::Unchecked); // ui->chkRecurring->setCheckState(Qt::Unchecked);
} // }
} // }
else { // else {
delete this->sendTxRecurringInfo; // delete this->sendTxRecurringInfo;
this->sendTxRecurringInfo = recurringInfo; // this->sendTxRecurringInfo = recurringInfo;
ui->lblRecurDesc->setText(recurringInfo->getScheduleDescription()); // ui->lblRecurDesc->setText(recurringInfo->getScheduleDescription());
} //}
} }
void MainWindow::updateLabelsAutoComplete() { void MainWindow::updateLabelsAutoComplete() {
@ -311,11 +311,11 @@ void MainWindow::addAddressSection() {
// Disable recurring payments if a address section is added, since recurring payments // Disable recurring payments if a address section is added, since recurring payments
// aren't supported for more than 1 address // aren't supported for more than 1 address
delete sendTxRecurringInfo; // delete sendTxRecurringInfo;
sendTxRecurringInfo = nullptr; // sendTxRecurringInfo = nullptr;
ui->lblRecurDesc->setText(""); // ui->lblRecurDesc->setText("");
ui->chkRecurring->setChecked(false); // ui->chkRecurring->setChecked(false);
ui->chkRecurring->setEnabled(false); // ui->chkRecurring->setEnabled(false);
// Set focus into the address // Set focus into the address
Address1->setFocus(); Address1->setFocus();
@ -358,10 +358,10 @@ void MainWindow::amountChanged(int item, const QString& text) {
} }
// If there is a recurring payment, update the info there as well // If there is a recurring payment, update the info there as well
if (sendTxRecurringInfo != nullptr) { //if (sendTxRecurringInfo != nullptr) {
Recurring::getInstance()->updateInfoWithTx(sendTxRecurringInfo, createTxFromSendPage()); // Recurring::getInstance()->updateInfoWithTx(sendTxRecurringInfo, createTxFromSendPage());
ui->lblRecurDesc->setText(sendTxRecurringInfo->getScheduleDescription()); // ui->lblRecurDesc->setText(sendTxRecurringInfo->getScheduleDescription());
} // }
} }
void MainWindow::setMemoEnabled(int number, bool enabled) { void MainWindow::setMemoEnabled(int number, bool enabled) {
@ -457,14 +457,14 @@ void MainWindow::clearSendForm() {
// Reset the recurring button // Reset the recurring button
if (Settings::getInstance()->isTestnet()) { if (Settings::getInstance()->isTestnet()) {
ui->chkRecurring->setEnabled(true); // ui->chkRecurring->setEnabled(true);
} }
ui->chkRecurring->setCheckState(Qt::Unchecked); // ui->chkRecurring->setCheckState(Qt::Unchecked);
ui->btnRecurSchedule->setEnabled(false); // ui->btnRecurSchedule->setEnabled(false);
ui->lblRecurDesc->setText(""); // ui->lblRecurDesc->setText("");
delete sendTxRecurringInfo; // delete sendTxRecurringInfo;
sendTxRecurringInfo = nullptr; // sendTxRecurringInfo = nullptr;
} }
void MainWindow::maxAmountChecked(int checked) { void MainWindow::maxAmountChecked(int checked) {

Loading…
Cancel
Save