update// moved render function to chat.cpp
This commit is contained in:
@@ -78,7 +78,8 @@ SOURCES += \
|
||||
src/Model/ChatItem.cpp \
|
||||
src/Model/ContactRequestChatItem.cpp \
|
||||
src/Model/ContactItem.cpp \
|
||||
src/Chat/Helper/ChatIDGenerator.cpp
|
||||
src/Chat/Helper/ChatIDGenerator.cpp \
|
||||
src/Chat/Chat.cpp
|
||||
|
||||
HEADERS += \
|
||||
src/firsttimewizard.h \
|
||||
|
||||
@@ -1,28 +1,36 @@
|
||||
#ifndef CHAT_H
|
||||
#define CHAT_H
|
||||
|
||||
#include <QString>
|
||||
#include <QStandardItemModel>
|
||||
#include <QAbstractItemDelegate>
|
||||
#include <QPainter>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <QListView>
|
||||
#include "precompiled.h"
|
||||
#include "mainwindow.h"
|
||||
#include "controller.h"
|
||||
#include "settings.h"
|
||||
#include "camount.h"
|
||||
|
||||
#include "../Model/ChatItem.h"
|
||||
|
||||
|
||||
class Chat // Chat Controller
|
||||
{
|
||||
private:
|
||||
std::map<QString, ChatItem> chatItems;
|
||||
QTableView* parent;
|
||||
Ui::MainWindow* ui;
|
||||
MainWindow* main;
|
||||
std::map<QString, QString> cidMap;
|
||||
std::map<QString, QString> requestZaddrMap;
|
||||
public:
|
||||
ChatModel() {};
|
||||
ChatModel(std::map<QString, ChatItem> chatItems);
|
||||
ChatModel(std::vector<ChatItem> chatItems);
|
||||
QString generateChatItemID(ChatItem item); // helper
|
||||
std::map<QString, ChatItem> getItems();
|
||||
void setItems(std::map<QString, ChatItem> items);
|
||||
QString zaddr();
|
||||
void setItems(std::vector<ChatItem> items);
|
||||
void renderChatBox(Ui::MainWindow* ui, QListView &view); // action
|
||||
Chat();
|
||||
//QString zaddr();
|
||||
void renderChatBox(Ui::MainWindow* ui, QListView *view); // action
|
||||
// void renderContactRequest();
|
||||
void triggerRequest();
|
||||
/*void triggerRequest();
|
||||
void showMessages();
|
||||
void clear();
|
||||
//void renderContactRequest(Ui::MainWindow* ui, QListView *view);
|
||||
@@ -33,7 +41,7 @@ class Chat // Chat Controller
|
||||
QString getCidByTx(QString tx);
|
||||
QString getrequestZaddrByTx(QString tx);
|
||||
void killCidCache();
|
||||
void killrequestZaddrCache();
|
||||
void killrequestZaddrCache();*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ DataStore<QString>* DataStore<QString>::instance = nullptr;
|
||||
template<>
|
||||
bool DataStore<QString>::instanced = false;*/
|
||||
ChatModel *chatModel = new ChatModel();
|
||||
Chat *chat = new Chat();
|
||||
ContactModel *contactModel = new ContactModel();
|
||||
|
||||
using json = nlohmann::json;
|
||||
@@ -1022,7 +1023,7 @@ void Controller::refreshTransactions() {
|
||||
|
||||
// Update model data, which updates the table view
|
||||
transactionsTableModel->replaceData(txdata);
|
||||
chatModel->renderChatBox(ui, ui->listChat);
|
||||
chat->renderChatBox(ui, ui->listChat);
|
||||
refreshContacts(
|
||||
ui->listContactWidget
|
||||
|
||||
@@ -1032,7 +1033,7 @@ void Controller::refreshTransactions() {
|
||||
|
||||
void Controller::refreshChat(QListView *listWidget)
|
||||
{
|
||||
chatModel->renderChatBox(ui, listWidget);
|
||||
chat->renderChatBox(ui, listWidget);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "liteinterface.h"
|
||||
#include "connection.h"
|
||||
#include "chatmodel.h"
|
||||
#include "Chat/Chat.h"
|
||||
#include "Model/ContactRequestChatItem.h"
|
||||
#include "Model/ContactItem.h"
|
||||
#include "contactmodel.h"
|
||||
|
||||
Reference in New Issue
Block a user