update// updated contactmodel and added new generatorclass
This commit is contained in:
@@ -27,7 +27,7 @@ ChatModel::ChatModel(std::vector<ChatItem> chatItems)
|
||||
this->setItems(chatItems);
|
||||
}
|
||||
|
||||
QString ChatModel::generateChatItemID(ChatItem item)
|
||||
/*QString ChatModel::generateChatItemID(ChatItem item)
|
||||
{
|
||||
QString key = QString::number(item.getTimestamp()) + QString("-");
|
||||
key += QString(QCryptographicHash::hash(
|
||||
@@ -39,7 +39,7 @@ QString ChatModel::generateChatItemID(ChatItem item)
|
||||
).toUtf8()
|
||||
,QCryptographicHash::Md5).toHex());
|
||||
return key;
|
||||
}
|
||||
}*/
|
||||
|
||||
std::map<QString, ChatItem> ChatModel::getItems()
|
||||
{
|
||||
@@ -55,8 +55,7 @@ void ChatModel::setItems(std::vector<ChatItem> items)
|
||||
{
|
||||
for(ChatItem c : items)
|
||||
{
|
||||
this->chatItems[this->generateChatItemID(c)] = c;
|
||||
|
||||
this->chatItems[ChatIDGenerator::getInstance()->generateID(c)] = c; //this->generateChatItemID(c)] = c;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,14 +66,14 @@ void ChatModel::clear()
|
||||
|
||||
void ChatModel::addMessage(ChatItem item)
|
||||
{
|
||||
QString key = this->generateChatItemID(item);
|
||||
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
|
||||
// qDebug() << "inserting chatitem with id: " << key;
|
||||
this->chatItems[key] = item;
|
||||
}
|
||||
|
||||
void ChatModel::addMessage(QString timestamp, ChatItem item)
|
||||
{
|
||||
QString key = this->generateChatItemID(item);
|
||||
QString key = ChatIDGenerator::getInstance()->generateID(item);//this->generateChatItemID(item);
|
||||
timestamp = "0";
|
||||
this->chatItems[key] = item;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ChatModel
|
||||
ChatModel() {};
|
||||
ChatModel(std::map<QString, ChatItem> chatItems);
|
||||
ChatModel(std::vector<ChatItem> chatItems);
|
||||
QString generateChatItemID(ChatItem item);
|
||||
//QString generateChatItemID(ChatItem item);
|
||||
std::map<QString, ChatItem> getItems();
|
||||
void setItems(std::map<QString, ChatItem> items);
|
||||
QString zaddr();
|
||||
|
||||
@@ -12,8 +12,6 @@ void ContactModel::renderContactList(QListView* view)
|
||||
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
|
||||
{
|
||||
|
||||
auto theme = Settings::getInstance()->get_theme_name();
|
||||
if ((theme == "dark" || theme == "midnight")) {
|
||||
|
||||
QString avatar = c.getAvatar();
|
||||
|
||||
@@ -25,8 +23,7 @@ void ContactModel::renderContactList(QListView* view)
|
||||
view->setUniformItemSizes(true);
|
||||
view->setDragDropMode(QAbstractItemView::DropOnly);
|
||||
view->show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -826,7 +826,7 @@ void Controller::refreshBalances()
|
||||
});
|
||||
}
|
||||
|
||||
void Controller::refreshTransactions() {
|
||||
void Controller::refreshTransactions() {
|
||||
if (!zrpc->haveConnection())
|
||||
return noConnection();
|
||||
|
||||
@@ -847,7 +847,7 @@ void Controller::refreshTransactions() {
|
||||
|
||||
auto txid = QString::fromStdString(it["txid"]);
|
||||
auto datetime = it["datetime"].get<json::number_integer_t>();
|
||||
|
||||
|
||||
// First, check if there's outgoing metadata
|
||||
if (!it["outgoing_metadata"].is_null()) {
|
||||
|
||||
@@ -889,7 +889,8 @@ void Controller::refreshTransactions() {
|
||||
txid,
|
||||
true
|
||||
);
|
||||
DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
|
||||
//DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
|
||||
}
|
||||
|
||||
@@ -996,8 +997,8 @@ void Controller::refreshTransactions() {
|
||||
txid,
|
||||
false
|
||||
);
|
||||
DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
|
||||
|
||||
//DataStore::getChatDataStore()->setData(chatModel->generateChatItemID(item), item);
|
||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||
qDebug() << "Position der Message : " << position;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user