diff --git a/res/darkwing.png b/res/darkwing.png new file mode 100644 index 0000000..6fbe046 Binary files /dev/null and b/res/darkwing.png differ diff --git a/res/hushdark.png b/res/hushdark.png new file mode 100644 index 0000000..9aef6a2 Binary files /dev/null and b/res/hushdark.png differ diff --git a/res/sdlogo.png b/res/sdlogo.png new file mode 100644 index 0000000..5dde4f0 Binary files /dev/null and b/res/sdlogo.png differ diff --git a/res/sdlogo2.png b/res/sdlogo2.png new file mode 100644 index 0000000..fee4fab Binary files /dev/null and b/res/sdlogo2.png differ diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 68b496a..4f5a7e6 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -1,3 +1,5 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 #include "chatmodel.h" #include "settings.h" #include "ui_confirm.h" @@ -395,15 +397,17 @@ Tx MainWindow::createTxForSafeContactRequest() { // QString cid = c.getCid(); // This has to be a new cid for the contact // QString myAddr = c.getMyAddress(); // this should be a new HushChat zaddr // QString addr = c.getPartnerAddress(); // this address will be insert by the user - QString cid = ""; - QString myAddr = ""; - QString addr = ""; - QString type = "Request"; + QString cid = c.getCid(); + QString myAddr = c.getMyAddress(); + QString addr = c.getPartnerAddress(); + QString type = "cont"; + + QString hmemo= createHeaderMemo(type,cid,myAddr); - // tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ; + tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ; qDebug() << "pushback chattx"; } @@ -439,7 +443,7 @@ void MainWindow::safeContactRequest() { // return; // } - /* Tx tx = createTxForSafeContactRequest(); + Tx tx = createTxForSafeContactRequest(); QString error = doSendRequestTxValidations(tx); @@ -455,15 +459,26 @@ void MainWindow::safeContactRequest() { qDebug() << "Tx aborted"; } + // Create a new Dialog to show that we are computing/sending the Tx // Create a new Dialog to show that we are computing/sending the Tx auto d = new QDialog(this); auto connD = new Ui_ConnectionDialog(); connD->setupUi(d); - QPixmap logo(":/img/res/logobig.gif"); - connD->topIcon->setBasePixmap(logo.scaled(256, 256, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + QMovie *movie1 = new QMovie(":/img/res/silentdragonlite-animated.gif");; + QMovie *movie2 = new QMovie(":/img/res/silentdragonlite-animated-dark.gif");; + auto theme = Settings::getInstance()->get_theme_name(); + if (theme == "dark" || theme == "midnight") { + movie2->setScaledSize(QSize(512,512)); + connD->topIcon->setMovie(movie2); + movie2->start(); + } else { + movie1->setScaledSize(QSize(512,512)); + connD->topIcon->setMovie(movie1); + movie1->start(); + } connD->status->setText(tr("Please wait...")); - connD->statusDetail->setText(tr("Your Safe Contact Request will be send")); + connD->statusDetail->setText(tr("Your Contact Request will be send")); d->show(); @@ -501,14 +516,14 @@ void MainWindow::safeContactRequest() { QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok); } - );*/ + ); } QString MainWindow::doSendRequestTxValidations(Tx tx) { // Check to see if we have enough verified funds to send the Tx. - /* CAmount total; + CAmount total; for (auto toAddr : tx.toAddrs) { if (!Settings::isValidAddress(toAddr.addr)) { QString addr = (toAddr.addr.length() > 100 ? toAddr.addr.left(100) + "..." : toAddr.addr); @@ -532,5 +547,5 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) { .arg(available.toDecimalhushString(), total.toDecimalhushString()); } - return "";*/ + return ""; } diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index a19fe1c..1a677e1 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -10,14 +10,26 @@ void ContactModel::renderContactList(QListView* view) { //QStandardItem* Items = new QStandardItem(); - QStandardItem* Items1 = new QStandardItem(QIcon("res/darkwing.png"),c.getName()); - // contact->appendRow(Items); + auto theme = Settings::getInstance()->get_theme_name(); + if ((theme == "dark" || theme == "midnight")) { + QStandardItem* Items1 = new QStandardItem(QIcon("res/sdlogo.png"),c.getName()); + contact->appendRow(Items1); + view->setModel(contact); + view->setIconSize(QSize(80,100)); + view->setUniformItemSizes(true); + view->setDragDropMode(QAbstractItemView::DropOnly);; + } + if (theme == "default" || theme == "blue"){ + + QStandardItem* Items1 = new QStandardItem(QIcon("res/sdlogo2.png"),c.getName()); contact->appendRow(Items1); view->setModel(contact); view->setIconSize(QSize(80,100)); view->setUniformItemSizes(true); view->setDragDropMode(QAbstractItemView::DropOnly);; + } + } diff --git a/src/controller.cpp b/src/controller.cpp index 577d438..81676e6 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -954,22 +954,43 @@ void Controller::refreshTransactions() { }; txdata.push_back(tx); - - QString cid = ""; + + QString type; + QString cid; if (memo.startsWith("{")) { + + type = memo.mid(75,4); cid = memo.mid(14,36); + + qDebug()<addCid(txid, cid); - }else{ - if(chatModel->getCidByTx(txid) != QString("0xdeadbeef")) + + } + if (type == "cont") + + { + + qDebug()<< "Als Request erkannt"; + + + } + + + if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){ + cid = chatModel->getCidByTx(txid); - else - cid = ""; } - + + + else{ + + cid = ""; + } + QString contact; for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - // for (auto &p : this->chatItems) { if (address == c.getMyAddress()){ @@ -977,7 +998,7 @@ void Controller::refreshTransactions() { qDebug()<< "Addressbuch Addresse: " << c.getMyAddress(); qDebug()<< "Addresse: " << address; - }else{ contact = "ELSE";} + }else{ contact = "";} ChatItem item = ChatItem( datetime, @@ -988,9 +1009,6 @@ void Controller::refreshTransactions() { txid, false ); - // qDebug()<< "KontaktName: " << contact; - - // qDebug()<< "Addressbuch Addresse: " << c.getMyAddress(); chatModel->addMessage(item); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0104f56..a45f5b5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -906,9 +906,11 @@ void MainWindow::setupTransactionsTab() { // Set up context menu on transactions tab auto theme = Settings::getInstance()->get_theme_name(); - if (theme == "dark"){ + if (theme == "dark" || theme == "midnight") { ui->listChat->setStyleSheet("background-image: url(res/sdlogo.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover"); - }else{ui->listChat->setStyleSheet("background-image: url(res/sdlogo2.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover");} + } + if (theme == "default") {ui->listChat->setStyleSheet("background-image: url(res/sdlogo2.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover");} + ui->listChat->setResizeMode(QListView::Adjust); ui->listChat->setWordWrap(true); ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); @@ -997,6 +999,7 @@ void MainWindow::setupTransactionsTab() { menu.exec(ui->transactionsTable->viewport()->mapToGlobal(pos)); }); + } void MainWindow::setupchatTab() {