chatgui: preserve active channel selection on reload, members sync, profile settings, member list model
This commit is contained in:
1 parent
ce6de7307a
commit
618cfe9bc5
28 files changed
+1895
-91
No files matched your search
@@ -125,21 +125,6 @@ MessageList::MessageList(DbManager* db, QWidget *parent)
|
||||
QByteArray textData = text.toUtf8();
|
||||
auto ts = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
uint64_t datahash = 0;
|
||||
QByteArray chainHash;
|
||||
bool ok = m_db->insertMessage(m_currentChannelId, m_db->myNodeId(),
|
||||
"text/plain", textData, ts, true,
|
||||
&datahash, &chainHash);
|
||||
if (!ok) {
|
||||
qWarning("MessageList: insertMessage FAILED ch=%s ts=%lld",
|
||||
qPrintable(m_currentChannelId), ts);
|
||||
return;
|
||||
}
|
||||
qDebug("MessageList: msg stored ch=%s ts=%lld dh=0x%016llx",
|
||||
qPrintable(m_currentChannelId), ts, (unsigned long long)datahash);
|
||||
|
||||
loadChannel(m_currentChannelId);
|
||||
|
||||
struct chat_msg_submit* req = (struct chat_msg_submit*)
|
||||
u_malloc(sizeof(struct chat_msg_submit) + textData.size());
|
||||
memset(req, 0, sizeof(*req));
|
||||
@@ -150,7 +135,7 @@ MessageList::MessageList(DbManager* db, QWidget *parent)
|
||||
req->data_len = (uint32_t)textData.size();
|
||||
memcpy(req->data, textData.constData(), textData.size());
|
||||
req->timestamp = (uint64_t)ts;
|
||||
gui_bridge_post_uasync_fn(chat_core_push_trampoline, req);
|
||||
gui_bridge_post_uasync_fn(chat_core_submit_trampoline, req);
|
||||
});
|
||||
|
||||
connect(AnimTimer::instance(), &AnimTimer::ticked, this, [this]() {
|
||||
@@ -192,8 +177,7 @@ void MessageList::loadChannel(const QString& channelId) {
|
||||
|
||||
for (const auto& m : msgs) {
|
||||
AccountRow acc = m_db->getAccount(m.authorNodeId);
|
||||
QString author = acc.displayName.isEmpty()
|
||||
? QString("node_%1").arg(m.authorNodeId) : acc.displayName;
|
||||
QString author = m_db->getDisplayName(m.authorNodeId);
|
||||
QString letter = acc.avatarLetter.isEmpty() ? author.mid(0, 1) : acc.avatarLetter;
|
||||
QColor color(acc.avatarColor);
|
||||
|
||||
@@ -226,8 +210,7 @@ void MessageList::addMessage(const QString& channelId, quint64 authorNodeId,
|
||||
if (channelId != m_currentChannelId) return;
|
||||
|
||||
AccountRow acc = m_db ? m_db->getAccount(authorNodeId) : AccountRow();
|
||||
QString author = acc.displayName.isEmpty()
|
||||
? QString("node_%1").arg(authorNodeId) : acc.displayName;
|
||||
QString author = m_db ? m_db->getDisplayName(authorNodeId) : QString("node_%1").arg(authorNodeId);
|
||||
QString letter = acc.avatarLetter.isEmpty() ? author.mid(0, 1) : acc.avatarLetter;
|
||||
QColor color(acc.avatarColor);
|
||||
auto avatar = makeAvatar(color, letter);
|
||||
|
||||
Reference in new issue
Block a user