Send page checkbox
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
||||
~MainWindow();
|
||||
|
||||
void updateLabelsAutoComplete();
|
||||
RPC* getRPC() { return rpc; }
|
||||
|
||||
void setDefaultPayFrom();
|
||||
|
||||
@@ -76,6 +77,8 @@ private:
|
||||
void addAddressSection();
|
||||
void maxAmountChecked(int checked);
|
||||
|
||||
void editSchedule();
|
||||
|
||||
void addressChanged(int number, const QString& text);
|
||||
void amountChanged (int number, const QString& text);
|
||||
|
||||
|
||||
@@ -346,8 +346,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>928</width>
|
||||
<height>380</height>
|
||||
<width>920</width>
|
||||
<height>301</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="sendToLayout">
|
||||
@@ -530,6 +530,50 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||
<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>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
@@ -552,6 +596,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMinerFeeUSD">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@@ -565,34 +623,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMinerFeeUSD">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>This transaction does not recur</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Setup Recurring Payment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_17">
|
||||
<property name="text">
|
||||
<string notr="true"> </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="sendTransactionButton">
|
||||
<property name="baseSize">
|
||||
@@ -1013,7 +1043,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>968</width>
|
||||
<height>19</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
||||
@@ -1,131 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog">
|
||||
<class>newRecurringDialog</class>
|
||||
<widget class="QDialog" name="newRecurringDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>740</width>
|
||||
<height>403</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>Edit Schedule</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="3" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_4"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_3"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboBox"/>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="lineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Schedule</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Number of payments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Next Payment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Payment Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="lineEdit_5"/>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Every</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_2"/>
|
||||
<widget class="QComboBox" name="cmbSchedule"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
@@ -142,18 +34,119 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item row="10" column="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Schedule</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Payment Description</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QLabel" name="lblNextPayment">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEdit_3"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Forever</string>
|
||||
<widget class="QLineEdit" name="txtAmt">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cmbCurrency"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLineEdit" name="txtDesc"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>From</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Number of payments</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<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="1" column="2">
|
||||
<widget class="AddressCombo" name="cmbFromAddress"/>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txtNumPayments"/>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@@ -169,21 +162,57 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="1" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Next Payment</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLineEdit" name="txtToAddr"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>To</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPlainTextEdit" name="txtMemo"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Memo</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>AddressCombo</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>addresscombo.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>txtDesc</tabstop>
|
||||
<tabstop>cmbFromAddress</tabstop>
|
||||
<tabstop>txtToAddr</tabstop>
|
||||
<tabstop>txtAmt</tabstop>
|
||||
<tabstop>cmbCurrency</tabstop>
|
||||
<tabstop>cmbSchedule</tabstop>
|
||||
<tabstop>txtNumPayments</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>newRecurringDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
@@ -199,7 +228,7 @@
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<receiver>newRecurringDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
|
||||
@@ -1,14 +1,48 @@
|
||||
#include "recurring.h"
|
||||
#include "ui_recurringdialog.h"
|
||||
|
||||
RecurringDialog::RecurringDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::RecurringDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
#include "mainwindow.h"
|
||||
#include "rpc.h"
|
||||
#include "settings.h"
|
||||
#include "ui_newrecurring.h"
|
||||
|
||||
RecurringDialog::~RecurringDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
void Recurring::showEditDialog(QWidget* parent, MainWindow* main, Tx tx) {
|
||||
Ui_newRecurringDialog ui;
|
||||
QDialog d(parent);
|
||||
ui.setupUi(&d);
|
||||
Settings::saveRestore(&d);
|
||||
|
||||
// Add all the from addresses
|
||||
auto allBalances = main->getRPC()->getAllBalances();
|
||||
for (QString addr : allBalances->keys()) {
|
||||
ui.cmbFromAddress->addItem(addr, allBalances->value(addr));
|
||||
}
|
||||
|
||||
if (!tx.fromAddr.isEmpty()) {
|
||||
ui.cmbFromAddress->setCurrentText(tx.fromAddr);
|
||||
ui.cmbFromAddress->setEnabled(false);
|
||||
}
|
||||
|
||||
ui.cmbCurrency->addItem(Settings::getTokenName());
|
||||
ui.cmbCurrency->addItem("USD");
|
||||
|
||||
if (tx.toAddrs.length() > 0) {
|
||||
ui.txtToAddr->setText(tx.toAddrs[0].addr);
|
||||
ui.txtToAddr->setEnabled(false);
|
||||
|
||||
ui.txtAmt->setText(Settings::getDecimalString(tx.toAddrs[0].amount));
|
||||
ui.txtAmt->setEnabled(false);
|
||||
|
||||
ui.txtMemo->setPlainText(tx.toAddrs[0].txtMemo);
|
||||
ui.txtMemo->setEnabled(false);
|
||||
}
|
||||
|
||||
ui.cmbSchedule->addItem("Every Day", QVariant(Schedule::DAY));
|
||||
ui.cmbSchedule->addItem("Every Week", QVariant(Schedule::WEEK));
|
||||
ui.cmbSchedule->addItem("Every Month", QVariant(Schedule::MONTH));
|
||||
ui.cmbSchedule->addItem("Every Year", QVariant(Schedule::YEAR));
|
||||
|
||||
ui.txtNumPayments->setText("10");
|
||||
|
||||
ui.txtDesc->setFocus();
|
||||
d.exec();
|
||||
}
|
||||
@@ -1,22 +1,36 @@
|
||||
#ifndef RECURRING_H
|
||||
#define RECURRING_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "precompiled.h"
|
||||
|
||||
namespace Ui {
|
||||
class RecurringDialog;
|
||||
}
|
||||
#include "mainwindow.h"
|
||||
|
||||
class RecurringDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RecurringDialog(QWidget *parent = nullptr);
|
||||
~RecurringDialog();
|
||||
|
||||
private:
|
||||
Ui::RecurringDialog *ui;
|
||||
enum Schedule {
|
||||
DAY = 1,
|
||||
WEEK,
|
||||
MONTH,
|
||||
YEAR
|
||||
};
|
||||
|
||||
#endif // RECURRING_H
|
||||
struct RecurringPaymentInfo {
|
||||
QString desc;
|
||||
QString fromAddr;
|
||||
QString toAddr;
|
||||
double amt;
|
||||
QString currency;
|
||||
Schedule schedule;
|
||||
int numPayments;
|
||||
|
||||
long startBlock;
|
||||
int completedPayments;
|
||||
};
|
||||
|
||||
class Recurring
|
||||
{
|
||||
public:
|
||||
Recurring();
|
||||
|
||||
static void showEditDialog(QWidget* parent, MainWindow* main, Tx tx);
|
||||
};
|
||||
|
||||
#endif // RECURRING_H
|
||||
@@ -3,8 +3,10 @@
|
||||
#include "addressbook.h"
|
||||
#include "ui_confirm.h"
|
||||
#include "ui_memodialog.h"
|
||||
#include "ui_newrecurring.h"
|
||||
#include "settings.h"
|
||||
#include "rpc.h"
|
||||
#include "recurring.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -80,6 +82,29 @@ void MainWindow::setupSendTab() {
|
||||
QFont f = ui->Address1->font();
|
||||
f.setPointSize(f.pointSize() - 1);
|
||||
ui->MemoTxt1->setFont(f);
|
||||
|
||||
// Recurring button
|
||||
QObject::connect(ui->chkRecurring, &QCheckBox::stateChanged, [=] (int checked) {
|
||||
if (checked) {
|
||||
ui->btnRecurSchedule->setEnabled(true);
|
||||
} else {
|
||||
ui->btnRecurSchedule->setEnabled(false);
|
||||
ui->lblRecurDesc->setText("");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Recurring schedule button
|
||||
QObject::connect(ui->btnRecurSchedule, &QPushButton::clicked, this, &MainWindow::editSchedule);
|
||||
|
||||
// Set the default state for the whole page
|
||||
removeExtraAddresses();
|
||||
}
|
||||
|
||||
void MainWindow::editSchedule() {
|
||||
// Open the edit schedule dialog
|
||||
Recurring::showEditDialog(this, this, createTxFromSendPage());
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::updateLabelsAutoComplete() {
|
||||
@@ -354,6 +379,11 @@ void MainWindow::removeExtraAddresses() {
|
||||
|
||||
delete addressGroupBox;
|
||||
}
|
||||
|
||||
// Reset the recurring button
|
||||
ui->chkRecurring->setCheckState(Qt::Unchecked);
|
||||
ui->btnRecurSchedule->setEnabled(false);
|
||||
ui->lblRecurDesc->setText("");
|
||||
}
|
||||
|
||||
void MainWindow::maxAmountChecked(int checked) {
|
||||
|
||||
Reference in New Issue
Block a user