add send Hush to a friend

This commit is contained in:
DenioD
2020-06-20 22:38:28 +02:00
parent 28260c36cd
commit 791a54157f
3 changed files with 237 additions and 65 deletions

View File

@@ -129,6 +129,7 @@ FORMS += \
src/newwallet.ui \
src/recurringpayments.ui \
src/restoreseed.ui \
src/sendHushTransactionChat.ui \
src/settings.ui \
src/about.ui \
src/confirm.ui \

View File

@@ -17,6 +17,7 @@
#include "settings.h"
#include "version.h"
#include "connection.h"
#include "ui_sendHushTransactionChat.h"
#include "ui_contactrequest.h"
#include "ui_deposithush.h"
#include "ui_requestContactDialog.h"
@@ -1465,8 +1466,7 @@ void MainWindow::setupchatTab() {
contextMenu = new QMenu(ui->listContactWidget);
requestAction = new QAction("Send a contact request - coming soon",contextMenu);
editAction = new QAction("Delete this contact",contextMenu);
HushAction = new QAction("Send a friend some Hush - coming soon",contextMenu);
requestHushAction = new QAction("Request some Hush - coming soon",contextMenu);
HushAction = new QAction("Send or Request some Hush - coming soon",contextMenu);
subatomicAction = new QAction("Make a subatomic swap with a friend- coming soon",contextMenu);
@@ -1478,23 +1478,54 @@ void MainWindow::setupchatTab() {
ui->listContactWidget->addAction(requestAction);
ui->listContactWidget->addAction(editAction);
ui->listContactWidget->addAction(HushAction);
ui->listContactWidget->addAction(requestHushAction);
ui->listContactWidget->addAction(subatomicAction);
ui->memoTxtChat->setEnabled(true);
/*QObject::connect(requestHushAction, &QAction::triggered, [=]() {
QModelIndex index = ui->listContactWidget->currentIndex();
QString label_contact = index.data(Qt::DisplayRole).toString();
QString label_contact = index.data(Qt::DisplayRole).toString();
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
ui->contactNameMemo->setText(p.getName());
rpc->refresh(true);
}
});
QObject::connect(HushAction, &QAction::triggered, [=]() {
QModelIndex index = ui->listContactWidget->currentIndex();
QString label_contact = index.data(Qt::DisplayRole).toString();
QDialog transactionDialog(this);
Ui_transactionHush transaction;
transaction.setupUi(&transactionDialog);
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
// Settings::saveRestore(&transactionDialog);
QStandardItemModel* contact = new QStandardItemModel();
QString avatar = p.getAvatar();
QStandardItem* Items1 = new QStandardItem(p.getName());
Items1->setData(QIcon(avatar),Qt::DecorationRole);
contact->appendRow(Items1);
transaction.contactName->setModel(contact);
transaction.contactName->setIconSize(QSize(60,70));
transaction.contactName->setUniformItemSizes(true);
transaction.contactName->setDragDropMode(QAbstractItemView::DropOnly);
transaction.contactName->show();
QString amt = transaction.amountChat->text();
qDebug()<<"AMT : " << amt;
}
MainWindow::showRequesthush();
}); */
transactionDialog.exec();
});
QObject::connect(editAction, &QAction::triggered, [=]() {
QModelIndex index = ui->listContactWidget->currentIndex();
@@ -1517,16 +1548,7 @@ void MainWindow::setupchatTab() {
}
});
QModelIndex index = ui->listContactWidget->currentIndex();
QString label_contact = index.data(Qt::DisplayRole).toString();
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
ui->contactNameMemo->setText(p.getName());
rpc->refresh(true);
}
});
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);

View File

@@ -1,67 +1,217 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>transactionHush</class>
<widget class="QDialog" name="transactionHush">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>530</width>
<height>377</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="geometry" >
<rect>
<x>30</x>
<y>240</y>
<width>341</width>
<height>32</height>
</rect>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Send or Request some Hush&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>To :</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>65</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QListView" name="contactName">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>70</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>79</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>Amount: </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="amountChat">
<property name="baseSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="placeholderText">
<string>Amount</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>64</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="sizeConstraint">
<enum>QLayout::SetFixedSize</enum>
</property>
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="sendHush">
<property name="text">
<string>Request Hush</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>25</height>
</size>
</property>
<property name="text">
<string>Send Hush</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Hush</string>
</property>
</widget>
</item>
</layout>
</widget>
<pixmapfunction></pixmapfunction>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</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>Dialog</receiver>
<receiver>transactionHush</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
@@ -69,4 +219,3 @@
</connection>
</connections>
</ui>