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 b9133b8..6c426be 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -105,8 +105,10 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) }); QStandardItemModel* chat = new QStandardItemModel(); - - + ui->lcdNumber->setStyleSheet("background-color: red"); + ui->lcdNumber->setPalette(Qt::red); + ui->lcdNumber->display("1"); + for (auto &c : this->chatItems) for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { @@ -153,27 +155,35 @@ void ChatModel::renderContactRequest(){ requestContact.setupUi(&dialog); Settings::saveRestore(&dialog); - { + /* { QStandardItemModel* contactRequest = new QStandardItemModel(); - for (auto &c : this->chatItems) { + for (auto &c : this->chatItems) + for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { + if ((c.second.getType() == "cont") && (c.second.isOutgoing() == false) && (c.second.getMemo().startsWith("{"))) { - + + + + QStandardItem* Items = new QStandardItem(c.second.getAddress()); contactRequest->appendRow(Items); requestContact.requestContact->setModel(contactRequest); - // requestContact.requestContact->show(); + requestContact.requestContact->show(); - + } + + } + + } - } - // } - + + QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () { @@ -187,10 +197,11 @@ void ChatModel::renderContactRequest(){ if(c.second.getMemo().startsWith("{")){ }else{ - QStandardItem* Items = new QStandardItem(c.second.getMemo()); + QStandardItem* Items = new QStandardItem(c.second.getMemo()); contactMemo->appendRow(Items); requestContact.requestMemo->setModel(contactMemo); requestContact.requestMemo->show(); + requestContact.requestZaddr->setText(c.second.getRequestZaddr()); requestContact.requestCID->setText(c.second.getCid()); @@ -216,7 +227,7 @@ void ChatModel::renderContactRequest(){ qDebug()<<"Beginn kopiert" <addAddressLabel(newLabel, addr, myAddr, cid, avatar); }); - + */ dialog.exec(); } @@ -464,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()); } @@ -589,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); @@ -647,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 8385b7a..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,23 +1005,57 @@ void MainWindow::setupTransactionsTab() { } void MainWindow::setupchatTab() { + + /////////////Setting Icons for Chattab and different themes -// Send button + auto theme = Settings::getInstance()->get_theme_name(); + if (theme == "dark" || theme == "midnight") { + QPixmap send(":/icons/res/send-new-white.png"); + QIcon sendIcon(send); + ui->sendChatButton->setIcon(sendIcon); - // Is request Contact checked? + QPixmap notification(":/icons/res/notification.png"); + QIcon notificationIcon(notification); + ui->pushContact->setIcon(notificationIcon); - // if (ui->request->isChecked()) { + QPixmap addContact(":/icons/res/add_contact.png"); + QIcon addContactIcon(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); + ui->sendChatButton->setIcon(sendIcon); + + QPixmap notification(":/icons/res/notification.svg"); + QIcon notificationIcon(notification); + ui->pushContact->setIcon(notificationIcon); + + 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::ContactRequest); - - // qDebug() <request->isChecked()->text(); - // }else{ - - 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 @@ -1520,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 045d7e0..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> @@ -1417,8 +1417,8 @@ - 61 - 62 + 41 + 49 @@ -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,26 +1475,13 @@ true - - - - 340 - 640 - 261 - 23 - - - - Is this message a contact request? - - - 90 - 0 - 71 - 61 + 270 + 580 + 51 + 51 @@ -1507,8 +1494,9 @@ - - :/icons/res/add_contact.png:/icons/res/add_contact.png + + :/icons/res/add_contact.png + @@ -1523,10 +1511,10 @@ - 170 - 0 - 71 - 61 + 10 + 30 + 41 + 41 @@ -1545,6 +1533,61 @@ :/icons/res/notification.png:/icons/res/notification.png + + + 33 + 35 + + + + true + + + + + + 30 + 20 + 31 + 21 + + + + QFrame::NoFrame + + + 1 + + + QLCDNumber::Flat + + + 0.000000000000000 + + + + + + 270 + 510 + 51 + 51 + + + + + 100 + 0 + + + + + + + + :/icons/res/add_contact.png + + 43 @@ -1555,6 +1598,17 @@ true + lcdNumber + listContactWidget + label_39 + memoTxtChat + contactNameMemo + sendChatButton + contactNameMemo_3 + listChat + safeContactRequest + pushContact + sendContact @@ -1765,22 +1819,5 @@ - - - request - stateChanged(int) - MainWindow - update() - - - 481 - 721 - - - 636 - 389 - - - - +