update// added chatmessages to chatwindow

This commit is contained in:
Strider
2020-04-27 21:53:37 +02:00
parent a607a54a00
commit b79334a497
7 changed files with 40 additions and 14 deletions

View File

@@ -51,7 +51,7 @@ void ChatModel::showMessages()
}
}
void ChatModel::renderChatBox(QListView &view)
void ChatModel::renderChatBox(QListWidget &view)
{
/*for(auto &c : this->chatItems)
{
@@ -61,12 +61,25 @@ void ChatModel::renderChatBox(QListView &view)
//todo render items to view
}
void ChatModel::renderChatBox(QListView *view)
void ChatModel::renderChatBox(QListWidget *view)
{
/*for(auto &c : this->chatItems)
qDebug() << "called ChatModel::renderChatBox(QListWidget *view)";
QString line = "";
while(view->count() > 0)
{
//view->getItems().add(QString("[Timestamp] <Contactname|Me>: lorem ipsum ...."));
}*/
qDebug() << "not implemented yet blyat";
//todo render items to view
view->takeItem(0);
}
for(auto &c : this->chatItems)
{
QDateTime myDateTime;
myDateTime.setTime_t(c.second.getTimestamp());
qDebug() << "[" << myDateTime.toString("dd.MM.yyyy hh:mm:ss ") << "] " << "<" << c.second.getAddress() << "> :" << c.second.getMemo();
line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
line += QString("<") + QString(c.second.getAddress()) + QString("> :");
line += QString(c.second.getMemo());
view->addItem(line);
line ="";
}
}