diff --git a/application.qrc b/application.qrc index c93d249..29a1765 100644 --- a/application.qrc +++ b/application.qrc @@ -32,6 +32,10 @@ res/send-new-white.png res/add_contact.png res/notification.png + res/rahmen-message.png + res/upload.png + res/upload.svg + res/message-icon.svg res/hushdlogo.gif diff --git a/res/message-icon.svg b/res/message-icon.svg new file mode 100644 index 0000000..fe61e44 --- /dev/null +++ b/res/message-icon.svg @@ -0,0 +1,9 @@ + + + + + + + diff --git a/res/rahmen-message.png b/res/rahmen-message.png new file mode 100644 index 0000000..3b486a4 Binary files /dev/null and b/res/rahmen-message.png differ diff --git a/res/upload.png b/res/upload.png new file mode 100644 index 0000000..b6f3c1f Binary files /dev/null and b/res/upload.png differ diff --git a/res/upload.svg b/res/upload.svg new file mode 100644 index 0000000..9f31b60 --- /dev/null +++ b/res/upload.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index d800f95..6c426be 100644 --- a/src/chatmodel.cpp +++ b/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" <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 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 884a6a7..a691a56 100644 --- a/src/mainwindow.cpp +++ b/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() <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; -} +} \ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h index b077593..54f9dc8 100644 --- a/src/mainwindow.h +++ b/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(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 85cefa3..6be3969 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1360,7 +1360,7 @@ - <html><head/><body><p align="center">Hushchat Contactlist</p></body></html> + <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html> @@ -1438,7 +1438,7 @@ - <html><head/><body><p align="center">Contact Name:</p></body></html> + <html><head/><body><p align="center"><span style=" font-weight:600;">Contact Name :</span></p></body></html> @@ -1475,19 +1475,6 @@ true - - - - 340 - 650 - 261 - 23 - - - - Is this message a contact request? - - @@ -1578,6 +1565,39 @@ 0.000000000000000 + + + + 270 + 510 + 51 + 51 + + + + + 100 + 0 + + + + + + + + :/icons/res/add_contact.png + + + + + 43 + 49 + + + + true + + lcdNumber listContactWidget label_39 @@ -1586,9 +1606,9 @@ sendChatButton contactNameMemo_3 listChat - request safeContactRequest pushContact + sendContact @@ -1799,22 +1819,5 @@ - - - request - stateChanged(int) - MainWindow - update() - - - 481 - 721 - - - 636 - 389 - - - - +