Aditya Kulkarni
5 years ago
6 changed files with 271 additions and 131 deletions
@ -1,14 +1,48 @@ |
|||
#include "recurring.h" |
|||
#include "ui_recurringdialog.h" |
|||
|
|||
RecurringDialog::RecurringDialog(QWidget *parent) : |
|||
QDialog(parent), |
|||
ui(new Ui::RecurringDialog) |
|||
{ |
|||
ui->setupUi(this); |
|||
} |
|||
|
|||
RecurringDialog::~RecurringDialog() |
|||
{ |
|||
delete ui; |
|||
} |
|||
|
|||
#include "mainwindow.h" |
|||
#include "rpc.h" |
|||
#include "settings.h" |
|||
#include "ui_newrecurring.h" |
|||
|
|||
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 |
|||
enum Schedule { |
|||
DAY = 1, |
|||
WEEK, |
|||
MONTH, |
|||
YEAR |
|||
}; |
|||
|
|||
struct RecurringPaymentInfo { |
|||
QString desc; |
|||
QString fromAddr; |
|||
QString toAddr; |
|||
double amt; |
|||
QString currency; |
|||
Schedule schedule; |
|||
int numPayments; |
|||
|
|||
long startBlock; |
|||
int completedPayments; |
|||
}; |
|||
|
|||
class Recurring |
|||
{ |
|||
public: |
|||
explicit RecurringDialog(QWidget *parent = nullptr); |
|||
~RecurringDialog(); |
|||
Recurring(); |
|||
|
|||
private: |
|||
Ui::RecurringDialog *ui; |
|||
static void showEditDialog(QWidget* parent, MainWindow* main, Tx tx); |
|||
}; |
|||
|
|||
#endif // RECURRING_H
|
|||
#endif // RECURRING_H
|
Loading…
Reference in new issue