blob: b10af2b2cb23fb91bc24eec17b656df24ce7b934 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include "User.hpp"
#include <gtkmm/label.h>
#include <gtkmm/togglebutton.h>
#include <gtkmm/grid.h>
#include <gtkmm/entry.h>
#include <gtkmm/paned.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/stack.h>
#include <gtkmm/textview.h>
#include <odhtdb/Hash.hpp>
#include <odhtdb/Signature.hpp>
namespace dchat
{
class ChatMessage;
class ChatWindow : public Gtk::Grid
{
public:
ChatWindow();
void addChannel(const odhtdb::Hash &nodeHash);
void addLocalMessage(const odhtdb::Hash &channelId, const odhtdb::Signature::PublicKey &userPublicKey, uint32_t timestampSeconds, Glib::ustring msg);
void addUser(const odhtdb::Signature::PublicKey &userPublicKey);
void setUserNickname(const odhtdb::Signature::PublicKey &userPublicKey, const Glib::ustring &name);
// Returns nullptr if user with @publicKey is not found
User* getUserByPublicKey(const odhtdb::Signature::PublicKey &publicKey) const;
private:
void setupTopBar();
void setupLeftPanel(Gtk::Paned *sidePanels);
void setupMessageArea(Gtk::Grid *rightPanel);
void setupChatInput(Gtk::Grid *rightPanel);
private:
Gtk::Grid topbar;
Gtk::Entry topbarSearchBar;
Gtk::Grid leftPanelChannels;
Gtk::Grid leftPanelUsers;
Gtk::Label currentChannelTitle;
Gtk::ScrolledWindow chatArea;
Gtk::Grid chatAreaLayout;
Gtk::TextView chatInput;
struct ChannelData
{
Gtk::ToggleButton *button;
int messageCount;
};
odhtdb::MapHash<ChannelData> channelDataById;
int channelCount;
std::vector<User*> users;
ChatMessage *lastMessage;
};
}
|