Browse Source

add a new button to send contact request, some ui tweaks

pull/130/head
DenioD 4 years ago
parent
commit
310504285b
  1. 4
      application.qrc
  2. 9
      res/message-icon.svg
  3. BIN
      res/rahmen-message.png
  4. BIN
      res/upload.png
  5. 8
      res/upload.svg
  6. 22
      src/chatmodel.cpp
  7. 49
      src/mainwindow.cpp
  8. 6
      src/mainwindow.h
  9. 71
      src/mainwindow.ui

4
application.qrc

@ -32,6 +32,10 @@
<file>res/send-new-white.png</file>
<file>res/add_contact.png</file>
<file>res/notification.png</file>
<file>res/rahmen-message.png</file>
<file>res/upload.png</file>
<file>res/upload.svg</file>
<file>res/message-icon.svg</file>
</qresource>
<qresource prefix="/img">
<file>res/hushdlogo.gif</file>

9
res/message-icon.svg

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<g id="XMLID_1_">
<polygon id="XMLID_3_" points="256,371.5 256,379 512,379 512,27.4 0,27.4 0,379 136.3,379 136.3,484.6 261,377.4 256,371.5
256,379 256,371.5 251,364.9 152.1,449.7 152.1,363.2 15.8,363.2 15.8,43.2 496.2,43.2 496.2,363.2 252.7,363.2 251,364.9 "/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 636 B

BIN
res/rahmen-message.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
res/upload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

8
res/upload.svg

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 218.8 283.5" style="enable-background:new 0 0 218.8 283.5;" xml:space="preserve">
<g>
<path d="M109.4,0L0,109.4h62.5v93.8h93.8v-93.8h62.5L109.4,0z M0,234.4v31.3h218.8v-31.3H0z M0,234.4"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 476 B

22
src/chatmodel.cpp

@ -155,7 +155,7 @@ void ChatModel::renderContactRequest(){
requestContact.setupUi(&dialog);
Settings::saveRestore(&dialog);
{
/* {
QStandardItemModel* contactRequest = new QStandardItemModel();
@ -183,8 +183,7 @@ void ChatModel::renderContactRequest(){
}
// }
QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () {
@ -228,7 +227,7 @@ void ChatModel::renderContactRequest(){
qDebug()<<"Beginn kopiert" <<cid << addr << newLabel << myAddr;
AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
});
*/
dialog.exec();
}
@ -476,7 +475,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
if (available < total) {
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 3 confirmations before they can be spent")
.arg(available.toDecimalhushString(), total.toDecimalhushString());
}
@ -601,6 +600,18 @@ Tx MainWindow::createTxForSafeContactRequest() {
void MainWindow::ContactRequest() {
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
// auto addr = "";
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
QMessageBox::Ok, this);
msg.exec();
return;
}
Tx tx = createTxForSafeContactRequest();
QString error = doSendRequestTxValidations(tx);
@ -659,6 +670,7 @@ void MainWindow::ContactRequest() {
// Force a UI update so we get the unconfirmed Tx
// rpc->refresh(true);
ui->memoTxtChat->clear();
rpc->refresh(true);
},
// Errored out

49
src/mainwindow.cpp

@ -1,4 +1,4 @@
// Copyright 2019-2020 The Hush developers
// Copyright 2019-2020 The Hush developers
// GPLv3
#include "mainwindow.h"
#include "addressbook.h"
@ -44,7 +44,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
ui->request->setChecked(false);
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
ui->memoTxtChat->setAutoFillBackground(false);
ui->memoTxtChat->setPlaceholderText("Send Message");
@ -1005,22 +1005,10 @@ void MainWindow::setupTransactionsTab() {
}
void MainWindow::setupchatTab() {
// Send button
// Is request Contact checked?
// if (ui->request->isChecked()) {
// QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::ContactRequest);
// qDebug() <<ui->request->isChecked()->text();
// }else{
/////////////Setting Icons for Chattab and different themes
auto theme = Settings::getInstance()->get_theme_name();
/////////////Setting Icons for Chattab and different themes
auto theme = Settings::getInstance()->get_theme_name();
if (theme == "dark" || theme == "midnight") {
QPixmap send(":/icons/res/send-new-white.png");
QIcon sendIcon(send);
@ -1032,8 +1020,15 @@ void MainWindow::setupchatTab() {
QPixmap addContact(":/icons/res/add_contact.png");
QIcon addContactIcon(addContact);
ui->safeContactRequest->setIcon(addContact);
ui->safeContactRequest->setIcon(addContactIcon);
/*QPixmap rahmen(":/icons/res/rahmen-message.png");
QIcon addRahmenIcon(rahmen);
ui->lcdNumber->setIcon(addRahmenIcon);*/
QPixmap sendContact(":/icons/res/upload.png");
QIcon addSendContactIcon(sendContact);
ui->sendContact->setIcon(addSendContactIcon);
}else{
QPixmap pixmap(":/icons/res/send-new.svg");
QIcon sendIcon(pixmap);
@ -1046,11 +1041,21 @@ void MainWindow::setupchatTab() {
QPixmap addContact(":/icons/res/add_contact.svg");
QIcon addContactIcon(addContact);
ui->safeContactRequest->setIcon(addContact);
/*QPixmap rahmen(":/icons/res/message-icon.svg");
QIcon addRahmenIcon(rahmen);
ui->lcdNumber->setIcon(addRahmenIcon);*/
QPixmap sendContact(":/icons/res/upload.svg");
QIcon addSendContactIcon(sendContact);
ui->sendContact->setIcon(addSendContactIcon);
}
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
// }
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
QObject::connect(ui->sendContact, &QPushButton::clicked, this, &MainWindow::ContactRequest);
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
///////// Set selected Zaddr for Chat with Klick
@ -1549,4 +1554,4 @@ MainWindow::~MainWindow()
delete wsserver;
delete wormhole;
}
}

6
src/mainwindow.h

@ -92,10 +92,14 @@ public slots:
void slot_change_currency(const QString& currencyName);
private:
private slots:
private:
void closeEvent(QCloseEvent* event);
void setupSendTab();
void setupTransactionsTab();
void setupReceiveTab();

71
src/mainwindow.ui

@ -1360,7 +1360,7 @@
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Hushchat Contactlist&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Contactlist&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QTextEdit" name="memoTxtChat">
@ -1438,7 +1438,7 @@
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Contact Name:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<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;Contact Name :&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QListView" name="listChat">
@ -1475,19 +1475,6 @@
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="request">
<property name="geometry">
<rect>
<x>340</x>
<y>650</y>
<width>261</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Is this message a contact request?</string>
</property>
</widget>
<widget class="QPushButton" name="safeContactRequest">
<property name="geometry">
<rect>
@ -1578,6 +1565,39 @@
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QPushButton" name="sendContact">
<property name="geometry">
<rect>
<x>270</x>
<y>510</y>
<width>51</width>
<height>51</height>
</rect>
</property>
<property name="baseSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="Dark">
<normalon>:/icons/res/add_contact.png</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>43</width>
<height>49</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
<zorder>lcdNumber</zorder>
<zorder>listContactWidget</zorder>
<zorder>label_39</zorder>
@ -1586,9 +1606,9 @@
<zorder>sendChatButton</zorder>
<zorder>contactNameMemo_3</zorder>
<zorder>listChat</zorder>
<zorder>request</zorder>
<zorder>safeContactRequest</zorder>
<zorder>pushContact</zorder>
<zorder>sendContact</zorder>
</widget>
</widget>
</item>
@ -1799,22 +1819,5 @@
<resources>
<include location="../application.qrc"/>
</resources>
<connections>
<connection>
<sender>request</sender>
<signal>stateChanged(int)</signal>
<receiver>MainWindow</receiver>
<slot>update()</slot>
<hints>
<hint type="sourcelabel">
<x>481</x>
<y>721</y>
</hint>
<hint type="destinationlabel">
<x>636</x>
<y>389</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

Loading…
Cancel
Save