Browse Source

add new background images to chatlist

pull/130/head
DenioD 4 years ago
parent
commit
0e2c8503fe
  1. 3
      application.qrc
  2. 21
      src/chatmodel.cpp
  3. 24
      src/contactmodel.cpp
  4. 15
      src/mainwindow.cpp

3
application.qrc

@ -8,6 +8,9 @@
<file>res/paymentreq.gif</file> <file>res/paymentreq.gif</file>
<file>res/icon.ico</file> <file>res/icon.ico</file>
<file>res/mail.png</file> <file>res/mail.png</file>
<file>res/darkwing.png</file>
<file>res/sdlogo.png</file>
<file>res/sdlogo2.png</file>
</qresource> </qresource>
<qresource prefix="/img"> <qresource prefix="/img">
<file>res/hushdlogo.gif</file> <file>res/hushdlogo.gif</file>

21
src/chatmodel.cpp

@ -123,17 +123,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
Items->setData("Incoming", Qt::UserRole +1); Items->setData("Incoming", Qt::UserRole +1);
chat->appendRow(Items); chat->appendRow(Items);
ui->listChat->setModel(chat);
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->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()); QStandardItem* Items1 = new QStandardItem(c.second.toChatLine());
Items1->setData("Outgoing", Qt::UserRole +1); Items1->setData("Outgoing", Qt::UserRole +1);
chat->appendRow(Items1); chat->appendRow(Items1);
qDebug()<<Items1->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->setModel(chat);
ui->listChat->setMinimumSize(200,350);
ui->listChat->setItemDelegate(new ListViewDelegate()); ui->listChat->setItemDelegate(new ListViewDelegate());
ui->listChat->show();
} }

24
src/contactmodel.cpp

@ -3,27 +3,21 @@
#include "mainwindow.h" #include "mainwindow.h"
void ContactModel::renderContactList(QListView* view) void ContactModel::renderContactList(QListView* view)
{ { // QStandardItem(const QIcon & icon, const QString & text)
QStandardItemModel* contact = new QStandardItemModel(); QStandardItemModel* contact = new QStandardItemModel();
//} //}
for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{ {
// view->addItem(c.getName());
QStandardItem* Items = new QStandardItem(c.getName()); //QStandardItem* Items = new QStandardItem();
contact->appendRow(Items); QStandardItem* Items1 = new QStandardItem(QIcon("res/darkwing.png"),c.getName());
// view->setItemDelegate({text: contact}) // contact->appendRow(Items);
// width: view->width }) contact->appendRow(Items1);
// height: avatar.implicitHeight,
// leftPadding: avatar.implicitWidth + 32})
// Image {
// id: avatar
// source: "qrc:/" + modelData.replace(" ", "_") + ".png"
// }
//}
view->setModel(contact); view->setModel(contact);
view->setIconSize(QSize(80,100));
view->setUniformItemSizes(true);
view->setDragDropMode(QAbstractItemView::DropOnly);;
} }

15
src/mainwindow.cpp

@ -905,6 +905,17 @@ void MainWindow::setupTransactionsTab() {
}); });
// Set up context menu on transactions tab // 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); ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
// Table right click // Table right click
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) { QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
@ -1014,6 +1025,8 @@ void MainWindow::setupchatTab() {
} }
}); });
} }
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {
@ -1066,7 +1079,7 @@ void MainWindow::updateChat()
void MainWindow::updateContacts() void MainWindow::updateContacts()
{ {
rpc->refreshContacts(ui->listContactWidget); //rpc->refreshContacts(ui->listContactWidget);
} }
void MainWindow::addNewZaddr(bool sapling) { void MainWindow::addNewZaddr(bool sapling) {

Loading…
Cancel
Save