improve some UI elements

This commit is contained in:
DenioD
2020-05-03 11:35:05 +02:00
parent 58bee815a5
commit 7b40755d42
4 changed files with 105 additions and 241 deletions

View File

@@ -39,8 +39,12 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
ui->checkBox->setChecked(true);
// ui->checkBox->setChecked(true);
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
ui->memoTxtChat->setAutoFillBackground(false);
// ui->memoTxtChat->setStyleSheet(QString::fromUtf8("background-color: rgb(224, 224, 224);"));
ui->memoTxtChat->setPlaceholderText("Send Message");
ui->memoTxtChat->setTextColor(Qt::white);
// Status Bar
setupStatusBar();
@@ -994,109 +998,22 @@ void MainWindow::setupchatTab() {
QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () {
QStandardItemModel mymodel;
// for(auto &c : this->chatItems)
//{
//////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid
///
// if (
// (ui->ContactZaddr->text().trimmed() == c.second.getAddress()) &&
// (c.second.getMemo().startsWith("{") == false) &&
// (c.second.getMemo().isEmpty() == false)
// )
// {
// if (c.second.getMemo.find())
//view->addItem(line);
// QStandardItem *item1 = new QStandardItem(c.second.toChatLine());
// item1->setData("Incoming", Qt::UserRole + 1);
// model.appendRow(item1);
QStandardItem *item1 = new QStandardItem("Kacke Hier");
item1->setData("Incoming", Qt::UserRole +1);
mymodel.appendRow(item1);
qDebug()<<item1->text();
QStandardItem *item2 = new QStandardItem("This is item one");
item2->setData("Outgoing", Qt::UserRole +1);
mymodel.appendRow(item2);
qDebug()<<item2->text();
QStandardItem *item3 = new QStandardItem("This is item one");
item3->setData("Outgoing", Qt::UserRole +1);
mymodel.appendRow(item3);
qDebug()<<item3->text();
// QStandardItem *item2 = new QStandardItem("Hallo");
// item1->setData("Outgoing", Qt::UserRole + 1);
// mymodel.appendRow(item2);
// qDebug()<<item2->text();
////////////////////////////////// Todo : Render green checkmark for contacts if cid = cid - We have to search for cid in txid/cid list
// QString cid = c.second.getCid();
// }
// if (
// (ui->MyZaddr->text().trimmed() == c.second.getAddress()) &&
// (c.second.getMemo().startsWith("{") == false) &&
// (c.second.getMemo().isEmpty() == false)
// )
// {
// for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
// {
// if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid()))
// {
//}
// else
// {
// line+= QString("[") + "Warning. Not verified!" + QString("]");
// QStandardItem *item = new QStandardItem(c.second.toChatLine());
//view->addItem(line);
// model.appendRow(item);
// }
// }
//}
// }
ui->listChat->setModel(&mymodel);
ui->listChat->setItemDelegate(new ListViewDelegate());
ui->listChat->show();
//ui->listChat->update();
QModelIndex index = ui->listContactWidget->currentIndex();
QString label_contact = index.data(Qt::DisplayRole).toString();
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
ui->ContactZaddr->setText(p.getPartnerAddress());
ui->MyZaddr->setText(p.getMyAddress());
// ui->ContactZaddr->setText(p.getPartnerAddress());
// ui->MyZaddr->setText(p.getMyAddress());
ui->contactNameMemo->setText(p.getName());
ui->contactCid->setText(p.getCid());
ui->memoTxtChat->clear();
rpc->refresh(true);
updateChat();
// updateChat();
}
});
}
ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {