From 9600242e7055542713c0441419037f96e91b338e Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 21:24:51 +0200 Subject: [PATCH 1/5] fix icon and background problem on mac/win --- silentdragon-lite.pro | 2 +- src/addressbook.cpp | 2 +- src/chatmodel.cpp | 2 +- src/contactmodel.cpp | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro index a3364d2..5e32f1e 100644 --- a/silentdragon-lite.pro +++ b/silentdragon-lite.pro @@ -12,7 +12,7 @@ PRECOMPILED_HEADER = src/precompiled.h QT += widgets QT += websockets -QT += qml quick + TARGET = SilentDragonLite diff --git a/src/addressbook.cpp b/src/addressbook.cpp index a16d7c8..298b057 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -173,7 +173,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) QString cid = ab.cid->text(); - QString avatar = QString("res/") + ab.comboBoxAvatar->currentText() + QString(".png"); + QString avatar = QString(":/icons/res/") + ab.comboBoxAvatar->currentText() + QString(".png"); qDebug()<<"AVATAR NAME : " << avatar; if (addr.isEmpty() || newLabel.isEmpty()) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 6c426be..c8ab957 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -510,7 +510,7 @@ void::MainWindow::addContact() { QString newLabel = request.labelRequest->text().trimmed(); auto myAddr = request.myzaddr->text().trimmed(); - QString avatar = QString("res/") + request.comboBoxAvatar->currentText() + QString(".png"); + QString avatar = QString(":/icons/res/") + request.comboBoxAvatar->currentText() + QString(".png"); if (addr.isEmpty() || newLabel.isEmpty()) { diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index adeeb45..41b7758 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -17,7 +17,8 @@ void ContactModel::renderContactList(QListView* view) QString avatar = c.getAvatar(); - QStandardItem* Items1 = new QStandardItem(QIcon(avatar) ,c.getName()); + QStandardItem* Items1 = new QStandardItem(c.getName()); + Items1->setData(QIcon(avatar),Qt::DecorationRole); contact->appendRow(Items1); view->setModel(contact); view->setIconSize(QSize(60,70)); From 8183b245c6c53ac9480194e4547ed373bd362b9f Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 21:57:47 +0200 Subject: [PATCH 2/5] add a first Button for a new HushChat Address on chattab --- src/addressbook.cpp | 7 ++++--- src/chatmodel.cpp | 10 ++++++---- src/mainwindow.cpp | 13 ++++++++++++- src/mainwindow.h | 2 ++ src/mainwindow.ui | 27 +++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 298b057..ce706d0 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -212,10 +212,11 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) ////// We need a better popup here. AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid,avatar); - QMessageBox::critical( + + QMessageBox::information( parent, - QObject::tr("Add Successfully"), - QObject::tr("juhu").arg(newLabel), + QObject::tr("Added Contact"), + QObject::tr("successfully added your new contact").arg(newLabel), QMessageBox::Ok ); return; diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c8ab957..34be5c0 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -535,12 +535,14 @@ void::MainWindow::addContact() { return; } - ////// We need a better popup here. + ///////Todo: Test if label allready exist! + + ////// Success, so show it AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar); - QMessageBox::critical( + QMessageBox::information( this, - QObject::tr("Add Successfully"), - QObject::tr("juhu").arg(newLabel), + QObject::tr("Added Contact"), + QObject::tr("successfully added your new contact").arg(newLabel), QMessageBox::Ok ); return; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a691a56..ed4bb95 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1554,4 +1554,15 @@ MainWindow::~MainWindow() delete wsserver; delete wormhole; -} \ No newline at end of file +} +void MainWindow::on_givemeZaddr_clicked() +{ + + bool sapling = true; + rpc->createNewZaddr(sapling, [=] (json reply) { + QString hushchataddr = QString::fromStdString(reply.get()[0]); + QMessageBox::information(this, "Your new Hushchataddress",hushchataddr); + // ui->listReceiveAddresses->insertItem(0, hushchataddr); + // ui->listReceiveAddresses->setCurrentIndex(0); + }); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 54f9dc8..9e91245 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -95,6 +95,8 @@ public slots: private slots: + void on_givemeZaddr_clicked(); + private: void closeEvent(QCloseEvent* event); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 6be3969..2c1adc6 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1598,6 +1598,32 @@ true + + + + 80 + 10 + 211 + 41 + + + + New HushChat Address + + + + :/icons/res/message-icon.svg:/icons/res/message-icon.svg + + + + 33 + 29 + + + + true + + lcdNumber listContactWidget label_39 @@ -1609,6 +1635,7 @@ safeContactRequest pushContact sendContact + givemeZaddr From 4305980b278f77c9d00608b2f6a7b5615e948f85 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 22:03:25 +0200 Subject: [PATCH 3/5] add information box for contact request --- src/chatmodel.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 34be5c0..c3503b9 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(); @@ -222,12 +222,17 @@ void ChatModel::renderContactRequest(){ QString newLabel = requestContact.requestLabel->text().trimmed(); auto myAddr = requestContact.requestMyAddr->text().trimmed(); - QString avatar = QString("res/") + requestContact.comboBoxAvatar->currentText() + QString(".png"); + QString avatar = QString(":/icons/res/") + requestContact.comboBoxAvatar->currentText() + QString(".png"); qDebug()<<"Beginn kopiert" <addAddressLabel(newLabel, addr, myAddr, cid, avatar); + + QMessageBox::information(main, "Added Contact","successfully added your new contact. You can now Chat with this contact"); + + + }); - */ + dialog.exec(); } From 4011c3950985355b220f7f17acd2e9534a0a84c9 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 22:17:20 +0200 Subject: [PATCH 4/5] fix --- src/chatmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c3503b9..65d5c3e 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -160,7 +160,7 @@ void ChatModel::renderContactRequest(){ for (auto &c : this->chatItems) - for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { + { if ((c.second.getType() == "cont") && (c.second.isOutgoing() == false) && (c.second.getMemo().startsWith("{"))) { From b3d41bbb43783777e683aa98c9c994f369ae3d8b Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 7 May 2020 22:38:19 +0200 Subject: [PATCH 5/5] some ui tweaks --- src/chatmodel.cpp | 6 +- src/mainwindow.cpp | 12 +- src/mainwindow.ui | 283 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 248 insertions(+), 53 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 65d5c3e..98bb0f8 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -105,9 +105,9 @@ 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"); + // 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()) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ed4bb95..694178f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1022,9 +1022,9 @@ void MainWindow::setupchatTab() { QIcon addContactIcon(addContact); ui->safeContactRequest->setIcon(addContactIcon); - /*QPixmap rahmen(":/icons/res/rahmen-message.png"); - QIcon addRahmenIcon(rahmen); - ui->lcdNumber->setIcon(addRahmenIcon);*/ + QPixmap newAddr(":/icons/res/add_contact.png"); + QIcon addnewAddrIcon(newAddr); + ui->givemeZaddr->setIcon(addnewAddrIcon); QPixmap sendContact(":/icons/res/upload.png"); QIcon addSendContactIcon(sendContact); @@ -1042,9 +1042,9 @@ void MainWindow::setupchatTab() { QIcon addContactIcon(addContact); ui->safeContactRequest->setIcon(addContact); - /*QPixmap rahmen(":/icons/res/message-icon.svg"); - QIcon addRahmenIcon(rahmen); - ui->lcdNumber->setIcon(addRahmenIcon);*/ + QPixmap newAddr(":/icons/res/add_contact.svg"); + QIcon addnewAddrIcon(newAddr); + ui->givemeZaddr->setIcon(addnewAddrIcon); QPixmap sendContact(":/icons/res/upload.svg"); QIcon addSendContactIcon(sendContact); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 2c1adc6..08e1d4d 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1332,9 +1332,9 @@ 0 - 90 + 120 341 - 551 + 521 @@ -1354,7 +1354,7 @@ 0 - 60 + 100 341 20 @@ -1379,12 +1379,18 @@ - 450 + 460 20 161 20 + + + 75 + true + + <html><head/><body><p align="center"><br/></p></body></html> @@ -1543,28 +1549,6 @@ true - - - - 30 - 20 - 31 - 21 - - - - QFrame::NoFrame - - - 1 - - - QLCDNumber::Flat - - - 0.000000000000000 - - @@ -1601,41 +1585,252 @@ - 80 - 10 - 211 + 60 + 30 + 111 41 - New HushChat Address + New Addr - :/icons/res/message-icon.svg:/icons/res/message-icon.svg + :/icons/res/add_contact.png:/icons/res/add_contact.png 33 - 29 + 35 true - lcdNumber - listContactWidget - label_39 - memoTxtChat - contactNameMemo - sendChatButton - contactNameMemo_3 - listChat - safeContactRequest - pushContact - sendContact - givemeZaddr + + + + 40 + 20 + 21 + 16 + + + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 239 + 41 + 41 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 239 + 41 + 41 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + + + 190 + 190 + 190 + + + + + + + 190 + 190 + 190 + + + + + + + 239 + 41 + 41 + + + + + + + 190 + 190 + 190 + + + + + + + 204 + 0 + 0 + + + + + + + 204 + 0 + 0 + + + + + + + 0 + 0 + 0 + + + + + + + + + 12 + + + + Qt::LeftToRight + + + 1 + + + Qt::AutoText + +