Browse Source

WIP: worked on keva page.

kevaview
Just Wonder 5 years ago
parent
commit
2b406c1ae8
  1. 1
      src/Makefile.qt.include
  2. 1
      src/qt/bitcoin.qrc
  3. 2
      src/qt/bitcoingui.cpp
  4. 154
      src/qt/forms/kevadialog.ui
  5. 22
      src/qt/kevadialog.cpp
  6. BIN
      src/qt/res/icons/about.png
  7. BIN
      src/qt/res/icons/keva.png

1
src/Makefile.qt.include

@ -304,6 +304,7 @@ RES_ICONS = \
qt/res/icons/history.png \ qt/res/icons/history.png \
qt/res/icons/info.png \ qt/res/icons/info.png \
qt/res/icons/key.png \ qt/res/icons/key.png \
qt/res/icons/keva.png \
qt/res/icons/litecoin_splash.png \ qt/res/icons/litecoin_splash.png \
qt/res/icons/lock_closed.png \ qt/res/icons/lock_closed.png \
qt/res/icons/lock_open.png \ qt/res/icons/lock_open.png \

1
src/qt/bitcoin.qrc

@ -39,6 +39,7 @@
<file alias="lock_closed">res/icons/lock_closed.png</file> <file alias="lock_closed">res/icons/lock_closed.png</file>
<file alias="lock_open">res/icons/lock_open.png</file> <file alias="lock_open">res/icons/lock_open.png</file>
<file alias="key">res/icons/key.png</file> <file alias="key">res/icons/key.png</file>
<file alias="keva">res/icons/keva.png</file>
<file alias="filesave">res/icons/filesave.png</file> <file alias="filesave">res/icons/filesave.png</file>
<file alias="debugwindow">res/icons/debugwindow.png</file> <file alias="debugwindow">res/icons/debugwindow.png</file>
<file alias="open">res/icons/open.png</file> <file alias="open">res/icons/open.png</file>

2
src/qt/bitcoingui.cpp

@ -313,7 +313,7 @@ void BitcoinGUI::createActions()
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction); tabGroup->addAction(historyAction);
kevaAction = new QAction(platformStyle->SingleColorIcon(":/icons/key"), tr("&Keva"), this); kevaAction = new QAction(platformStyle->SingleColorIcon(":/icons/keva"), tr("&Keva"), this);
kevaAction->setStatusTip(tr("Keva related operations")); kevaAction->setStatusTip(tr("Keva related operations"));
kevaAction->setToolTip(kevaAction->statusTip()); kevaAction->setToolTip(kevaAction->statusTip());
kevaAction->setCheckable(true); kevaAction->setCheckable(true);

154
src/qt/forms/kevadialog.ui

@ -28,38 +28,6 @@
<layout class="QVBoxLayout" name="verticalLayout_3"> <layout class="QVBoxLayout" name="verticalLayout_3">
<item> <item>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="toolTip">
<string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string>
</property>
<property name="text">
<string>&amp;Amount:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>reqAmount</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="toolTip">
<string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Kevacoin network.</string>
</property>
<property name="text">
<string>&amp;Message:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>reqMessage</cstring>
</property>
</widget>
</item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QLineEdit" name="reqLabel"> <widget class="QLineEdit" name="reqLabel">
<property name="toolTip"> <property name="toolTip">
@ -70,17 +38,17 @@
<item row="2" column="2"> <item row="2" column="2">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Use this form to request payments. All fields are &lt;b&gt;optional&lt;/b&gt;.</string> <string>Use this form to perform Keva database operations.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="toolTip"> <property name="toolTip">
<string>An optional label to associate with the new receiving address.</string> <string>The namespace ID, which has a prefix "N".</string>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Label:</string> <string>&amp;Namespace:</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -90,32 +58,8 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="2">
<widget class="QLineEdit" name="reqMessage">
<property name="toolTip">
<string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Kevacoin network.</string>
</property>
</widget>
</item>
<item row="7" column="2"> <item row="7" column="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="receiveButton">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&amp;Request payment</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="clearButton"> <widget class="QPushButton" name="clearButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -125,14 +69,14 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Clear all fields of the form.</string> <string>Show content of the namespace.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Clear</string> <string>Show content</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../bitcoin.qrc"> <iconset resource="../bitcoin.qrc">
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> <normaloff>:/icons/eye</normaloff>:/icons/eye</iconset>
</property> </property>
<property name="autoDefault"> <property name="autoDefault">
<bool>false</bool> <bool>false</bool>
@ -140,94 +84,44 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <widget class="QPushButton" name="receiveButton">
<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="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="BitcoinAmountField" name="reqAmount">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>150</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>100</height>
</size>
</property>
<property name="toolTip">
<string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="useBech32">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>Native segwit addresses (aka Bech32 or BIP-173) reduce your transaction fees later on and offer better protection against typos, but old wallets don't support them. When unchecked, an address compatible with older wallets will be created instead.</string>
</property>
<property name="text"> <property name="text">
<string>Generate native segwit (Bech32) address</string> <string>&amp;Previously used namespaces</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>0</width> <width>40</width>
<height>0</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -270,7 +164,7 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>Requested payments history</string> <string>Content of namespace</string>
</property> </property>
</widget> </widget>
</item> </item>

22
src/qt/kevadialog.cpp

@ -37,8 +37,8 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
ui->showRequestButton->setIcon(QIcon()); ui->showRequestButton->setIcon(QIcon());
ui->removeRequestButton->setIcon(QIcon()); ui->removeRequestButton->setIcon(QIcon());
} else { } else {
ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove")); ui->clearButton->setIcon(_platformStyle->SingleColorIcon(":/icons/eye"));
ui->receiveButton->setIcon(_platformStyle->SingleColorIcon(":/icons/receiving_addresses")); ui->receiveButton->setIcon(_platformStyle->SingleColorIcon(":/icons/address-book"));
ui->showRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/edit")); ui->showRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/edit"));
ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove")); ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
} }
@ -93,12 +93,6 @@ void KevaDialog::setModel(WalletModel *_model)
SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection))); SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this); columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
if (model->getDefaultAddressType() == OUTPUT_TYPE_BECH32) {
ui->useBech32->setCheckState(Qt::Checked);
} else {
ui->useBech32->setCheckState(Qt::Unchecked);
}
} }
} }
@ -109,9 +103,7 @@ KevaDialog::~KevaDialog()
void KevaDialog::clear() void KevaDialog::clear()
{ {
ui->reqAmount->clear();
ui->reqLabel->setText(""); ui->reqLabel->setText("");
ui->reqMessage->setText("");
updateDisplayUnit(); updateDisplayUnit();
} }
@ -129,7 +121,6 @@ void KevaDialog::updateDisplayUnit()
{ {
if(model && model->getOptionsModel()) if(model && model->getOptionsModel())
{ {
ui->reqAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());
} }
} }
@ -142,17 +133,14 @@ void KevaDialog::on_receiveButton_clicked()
QString label = ui->reqLabel->text(); QString label = ui->reqLabel->text();
/* Generate new receiving address */ /* Generate new receiving address */
OutputType address_type; OutputType address_type;
if (ui->useBech32->isChecked()) {
address_type = OUTPUT_TYPE_BECH32;
} else {
address_type = model->getDefaultAddressType(); address_type = model->getDefaultAddressType();
if (address_type == OUTPUT_TYPE_BECH32) { if (address_type == OUTPUT_TYPE_BECH32) {
address_type = OUTPUT_TYPE_P2SH_SEGWIT; address_type = OUTPUT_TYPE_P2SH_SEGWIT;
} }
}
address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type); address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, "", address_type);
SendCoinsRecipient info(address, label, SendCoinsRecipient info(address, label,
ui->reqAmount->value(), ui->reqMessage->text()); NULL, NULL);
ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this); ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setModel(model->getOptionsModel()); dialog->setModel(model->getOptionsModel());
@ -218,7 +206,7 @@ void KevaDialog::keyPressEvent(QKeyEvent *event)
if (event->key() == Qt::Key_Return) if (event->key() == Qt::Key_Return)
{ {
// press return -> submit form // press return -> submit form
if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() || ui->reqMessage->hasFocus()) if (ui->reqLabel->hasFocus())
{ {
event->ignore(); event->ignore();
on_receiveButton_clicked(); on_receiveButton_clicked();

BIN
src/qt/res/icons/about.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
src/qt/res/icons/keva.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Loading…
Cancel
Save