From 0e2c8503fef816cbf6afd0264bd6d0e429b4ec57 Mon Sep 17 00:00:00 2001
From: DenioD <41270280+DenioD@users.noreply.github.com>
Date: Sun, 3 May 2020 17:22:16 +0200
Subject: [PATCH] add new background images to chatlist
---
application.qrc | 3 +++
src/chatmodel.cpp | 21 +++------------------
src/contactmodel.cpp | 24 +++++++++---------------
src/mainwindow.cpp | 15 ++++++++++++++-
4 files changed, 29 insertions(+), 34 deletions(-)
diff --git a/application.qrc b/application.qrc
index 0507184..e4cd3d2 100644
--- a/application.qrc
+++ b/application.qrc
@@ -8,6 +8,9 @@
res/paymentreq.gif
res/icon.ico
res/mail.png
+ res/darkwing.png
+ res/sdlogo.png
+ res/sdlogo2.png
res/hushdlogo.gif
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index aad9a8d..68b496a 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -123,17 +123,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
Items->setData("Incoming", Qt::UserRole +1);
chat->appendRow(Items);
-
- ui->listChat->setResizeMode(QListView::Adjust);
- ui->listChat->setWordWrap(true);
- ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui->listChat->setModel(chat);
- ui->listChat->setMinimumSize(200,350);
+ ui->listChat->setModel(chat);
ui->listChat->setItemDelegate(new ListViewDelegate());
- // ui->listChat->setStyleSheet("background-image: url(res/hushdark.png)"); /////Todo set an png as Watermark backgroung in listChat
- ui->listChat->show();
+
}
@@ -149,18 +141,11 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
QStandardItem* Items1 = new QStandardItem(c.second.toChatLine());
Items1->setData("Outgoing", Qt::UserRole +1);
chat->appendRow(Items1);
- qDebug()<text();
}
- ui->listChat->setResizeMode(QListView::Adjust);
- ui->listChat->setWordWrap(true);
- ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
- ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->listChat->setModel(chat);
- ui->listChat->setMinimumSize(200,350);
ui->listChat->setItemDelegate(new ListViewDelegate());
- ui->listChat->show();
+
}
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index e4d32e1..a19fe1c 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -3,27 +3,21 @@
#include "mainwindow.h"
void ContactModel::renderContactList(QListView* view)
-{
+{ // QStandardItem(const QIcon & icon, const QString & text)
QStandardItemModel* contact = new QStandardItemModel();
//}
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{
- // view->addItem(c.getName());
-
- QStandardItem* Items = new QStandardItem(c.getName());
- contact->appendRow(Items);
- // view->setItemDelegate({text: contact})
- // width: view->width })
- // height: avatar.implicitHeight,
- // leftPadding: avatar.implicitWidth + 32})
-
- // Image {
- // id: avatar
- // source: "qrc:/" + modelData.replace(" ", "_") + ".png"
- // }
- //}
+ //QStandardItem* Items = new QStandardItem();
+ QStandardItem* Items1 = new QStandardItem(QIcon("res/darkwing.png"),c.getName());
+ // contact->appendRow(Items);
+ contact->appendRow(Items1);
view->setModel(contact);
+ view->setIconSize(QSize(80,100));
+ view->setUniformItemSizes(true);
+ view->setDragDropMode(QAbstractItemView::DropOnly);;
+
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 0d1e984..0104f56 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -905,6 +905,17 @@ void MainWindow::setupTransactionsTab() {
});
// Set up context menu on transactions tab
+ auto theme = Settings::getInstance()->get_theme_name();
+ if (theme == "dark"){
+ 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");}
+ ui->listChat->setResizeMode(QListView::Adjust);
+ ui->listChat->setWordWrap(true);
+ ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
+ ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ ui->listChat->setMinimumSize(200,350);
+ ui->listChat->show();
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
// Table right click
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
@@ -1014,6 +1025,8 @@ void MainWindow::setupchatTab() {
}
});
+
+
}
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {
@@ -1066,7 +1079,7 @@ void MainWindow::updateChat()
void MainWindow::updateContacts()
{
- rpc->refreshContacts(ui->listContactWidget);
+ //rpc->refreshContacts(ui->listContactWidget);
}
void MainWindow::addNewZaddr(bool sapling) {