Aditya Kulkarni
5 years ago
12 changed files with 620 additions and 67 deletions
@ -0,0 +1,245 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>newRecurringDialog</class> |
|||
<widget class="QDialog" name="newRecurringDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>740</width> |
|||
<height>403</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Edit Schedule</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="5" column="2"> |
|||
<layout class="QHBoxLayout" name="horizontalLayout"> |
|||
<item> |
|||
<widget class="QComboBox" name="cmbSchedule"/> |
|||
</item> |
|||
<item> |
|||
<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> |
|||
</layout> |
|||
</item> |
|||
<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="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"> |
|||
<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="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>newRecurringDialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>newRecurringDialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -0,0 +1,48 @@ |
|||
#include "recurring.h" |
|||
|
|||
#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(); |
|||
} |
@ -0,0 +1,36 @@ |
|||
#ifndef RECURRING_H |
|||
#define RECURRING_H |
|||
|
|||
#include "precompiled.h" |
|||
|
|||
#include "mainwindow.h" |
|||
|
|||
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: |
|||
Recurring(); |
|||
|
|||
static void showEditDialog(QWidget* parent, MainWindow* main, Tx tx); |
|||
}; |
|||
|
|||
#endif // RECURRING_H
|
@ -0,0 +1,92 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>RecurringDialog</class> |
|||
<widget class="QDialog" name="RecurringDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>601</width> |
|||
<height>438</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Dialog</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="0"> |
|||
<widget class="QTableView" name="tableView"/> |
|||
</item> |
|||
<item row="0" column="1"> |
|||
<layout class="QVBoxLayout" name="verticalLayout"> |
|||
<item> |
|||
<widget class="QPushButton" name="pushButton"> |
|||
<property name="text"> |
|||
<string>Add</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QPushButton" name="pushButton_2"> |
|||
<property name="text"> |
|||
<string>Edit</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QPushButton" name="pushButton_3"> |
|||
<property name="text"> |
|||
<string>Delete</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Vertical</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Close</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>RecurringDialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>RecurringDialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
Loading…
Reference in new issue