Aditya Kulkarni
5 years ago
6 changed files with 271 additions and 131 deletions
@ -1,14 +1,48 @@ |
|||||
#include "recurring.h" |
#include "recurring.h" |
||||
#include "ui_recurringdialog.h" |
|
||||
|
#include "mainwindow.h" |
||||
RecurringDialog::RecurringDialog(QWidget *parent) : |
#include "rpc.h" |
||||
QDialog(parent), |
#include "settings.h" |
||||
ui(new Ui::RecurringDialog) |
#include "ui_newrecurring.h" |
||||
{ |
|
||||
ui->setupUi(this); |
void Recurring::showEditDialog(QWidget* parent, MainWindow* main, Tx tx) { |
||||
} |
Ui_newRecurringDialog ui; |
||||
|
QDialog d(parent); |
||||
RecurringDialog::~RecurringDialog() |
ui.setupUi(&d); |
||||
{ |
Settings::saveRestore(&d); |
||||
delete ui; |
|
||||
} |
// 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 |
#ifndef RECURRING_H |
||||
#define RECURRING_H |
#define RECURRING_H |
||||
|
|
||||
#include <QDialog> |
#include "precompiled.h" |
||||
|
|
||||
namespace Ui { |
#include "mainwindow.h" |
||||
class RecurringDialog; |
|
||||
} |
|
||||
|
|
||||
class RecurringDialog : public QDialog |
enum Schedule { |
||||
{ |
DAY = 1, |
||||
Q_OBJECT |
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: |
public: |
||||
explicit RecurringDialog(QWidget *parent = nullptr); |
Recurring(); |
||||
~RecurringDialog(); |
|
||||
|
|
||||
private: |
static void showEditDialog(QWidget* parent, MainWindow* main, Tx tx); |
||||
Ui::RecurringDialog *ui; |
|
||||
}; |
}; |
||||
|
|
||||
#endif // RECURRING_H
|
#endif // RECURRING_H
|
Loading…
Reference in new issue