diff options
Diffstat (limited to 'include/ChatWindow.hpp')
-rw-r--r-- | include/ChatWindow.hpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp index b13046e..b10af2b 100644 --- a/include/ChatWindow.hpp +++ b/include/ChatWindow.hpp @@ -1,7 +1,8 @@ #pragma once +#include "User.hpp" #include <gtkmm/label.h> -#include <gtkmm/button.h> +#include <gtkmm/togglebutton.h> #include <gtkmm/grid.h> #include <gtkmm/entry.h> #include <gtkmm/paned.h> @@ -9,15 +10,23 @@ #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, Glib::ustring msg); + 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); @@ -27,6 +36,7 @@ namespace dchat Gtk::Grid topbar; Gtk::Entry topbarSearchBar; Gtk::Grid leftPanelChannels; + Gtk::Grid leftPanelUsers; Gtk::Label currentChannelTitle; Gtk::ScrolledWindow chatArea; Gtk::Grid chatAreaLayout; @@ -34,11 +44,14 @@ namespace dchat struct ChannelData { - Gtk::Button *button; + Gtk::ToggleButton *button; int messageCount; }; odhtdb::MapHash<ChannelData> channelDataById; int channelCount; + std::vector<User*> users; + + ChatMessage *lastMessage; }; }
\ No newline at end of file |