aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-11-09 09:46:43 +0100
committerdec05eba <dec05eba@protonmail.com>2018-11-09 09:46:47 +0100
commit5fab9a3a2cf048330f687dda48c76c95a3a67d98 (patch)
tree1be0385ef62f5fbf0794d98a697e0ff11fe7a510 /include
parent118277121c8b1767a78f76d19c44aea496121b34 (diff)
Add room joining
Diffstat (limited to 'include')
-rw-r--r--include/ChatWindow.hpp25
-rw-r--r--include/InputDialog.hpp6
-rw-r--r--include/RoomNotificationsWindow.hpp36
-rw-r--r--include/RoomSettingsWindow.hpp30
-rw-r--r--include/Topbar.hpp22
5 files changed, 109 insertions, 10 deletions
diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp
index d457b7d..48bbff5 100644
--- a/include/ChatWindow.hpp
+++ b/include/ChatWindow.hpp
@@ -1,6 +1,8 @@
#pragma once
#include "ImageButton.hpp"
+#include "RoomSettingsWindow.hpp"
+#include "RoomNotificationsWindow.hpp"
#include <dchat/Room.hpp>
#include <gtkmm/label.h>
#include <gtkmm/togglebutton.h>
@@ -17,6 +19,7 @@ namespace dchat
{
class ChatMessage;
class Window;
+ class Topbar;
class ChatWindow : public Gtk::Grid
{
@@ -25,24 +28,31 @@ namespace dchat
~ChatWindow();
void addRoom(std::shared_ptr<Room> room);
void addMessage(const RoomAddMessageRequest &request);
- void addUser(std::shared_ptr<Room> room, std::shared_ptr<User> user);
+ void addUser(const RoomAddUserRequest &request);
void setUserNickname(const UserChangeNicknameRequest &request);
void changeRoomName(const RoomChangeNameRequest &request);
+ void addInviteRequest(const InviteUserRequest &request);
void scrollToBottom();
+
+ Topbar *topbar;
+ Gtk::Stack stack;
+ Gtk::Grid chatPage;
+ RoomSettingsWindow roomSettingsWindow;
+ RoomNotificationsWindow roomNotificationsWindow;
+ Window *window;
private:
- void setupTopBar();
+ void setupTopbar();
void setupLeftPanel(Gtk::Paned *sidePanels);
void setupMessageArea(Gtk::Grid *rightPanel);
void setupChatInput(Gtk::Grid *rightPanel);
void setCurrentRoom(std::shared_ptr<Room> room);
private:
- Gtk::Grid topbar;
- Gtk::Entry topbarSearchBar;
Gtk::Grid leftPanelChannels;
Gtk::Stack leftPanelUsersStack;
- ImageButton addRoomButton;
- Gtk::Label currentChannelTitle;
+ ImageButton createRoomButton;
+ ImageButton joinRoomButton;
+ ImageButton userSettingsButton;
Gtk::ScrolledWindow messageArea;
Gtk::Stack messageAreaStack;
Gtk::TextView chatInput;
@@ -60,6 +70,7 @@ namespace dchat
int roomCount;
RoomData *currentRoomData;
std::shared_ptr<Room> currentRoom;
- Window *window;
+ bool chatInputShowPlaceholder;
+ bool chatInputChangeByPlaceholder;
};
} \ No newline at end of file
diff --git a/include/InputDialog.hpp b/include/InputDialog.hpp
index 4b2b02a..ae06de2 100644
--- a/include/InputDialog.hpp
+++ b/include/InputDialog.hpp
@@ -2,15 +2,15 @@
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
+#include <vector>
namespace dchat
{
class InputDialog : public Gtk::Dialog
{
public:
- InputDialog(const char *title, const char *text, const char *acceptText = "Create", const char *cancelText = "Cancel");
- Glib::ustring getInput() const;
+ InputDialog(const char *title, const std::vector<const char*> &texts, const char *acceptText = "Create", const char *cancelText = "Cancel");
- Gtk::Entry entry;
+ std::vector<Gtk::Entry*> entries;
};
} \ No newline at end of file
diff --git a/include/RoomNotificationsWindow.hpp b/include/RoomNotificationsWindow.hpp
new file mode 100644
index 0000000..e4e29f5
--- /dev/null
+++ b/include/RoomNotificationsWindow.hpp
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <dchat/Room.hpp>
+#include <gtkmm/stack.h>
+#include <gtkmm/scrolledwindow.h>
+#include <gtkmm/liststore.h>
+#include <unordered_map>
+
+namespace dchat
+{
+ class ChatWindow;
+
+ class RoomNotificationsWindow : public Gtk::Stack
+ {
+ public:
+ RoomNotificationsWindow(ChatWindow *chatWindow);
+
+ void addInviteRequest(const InviteUserRequest &request);
+ private:
+ class RoomNotifications : public Gtk::ScrolledWindow
+ {
+ public:
+ Glib::RefPtr<Gtk::ListStore> listStore;
+ Gtk::TreeModelColumn<Glib::ustring> userPublicKeyColumn;
+ Gtk::TreeModelColumn<Glib::ustring> messageColumn;
+ Gtk::TreeModel::ColumnRecord columns;
+ std::unordered_map<std::string, InviteUserRequest> inviteRequests;
+ };
+
+ RoomNotifications* createRoomNotifications();
+
+ std::unordered_map<Room*, RoomNotifications*> roomNotificationsMap;
+
+ ChatWindow *chatWindow;
+ };
+} \ No newline at end of file
diff --git a/include/RoomSettingsWindow.hpp b/include/RoomSettingsWindow.hpp
new file mode 100644
index 0000000..9ffd808
--- /dev/null
+++ b/include/RoomSettingsWindow.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <gtkmm/grid.h>
+#include <gtkmm/entry.h>
+#include <gtkmm/label.h>
+#include <dchat/Room.hpp>
+
+namespace Gtk
+{
+ class Paned;
+}
+
+namespace dchat
+{
+ class ChatWindow;
+
+ class RoomSettingsWindow : public Gtk::Grid
+ {
+ public:
+ RoomSettingsWindow(ChatWindow *chatWindow);
+ void selectRoom(std::shared_ptr<Room> room);
+
+ void setupLeftPanel(Gtk::Paned *sidePanels);
+ void setupRightPanel(Gtk::Paned *sidePanels);
+ private:
+ ChatWindow *chatWindow;
+ Gtk::Entry roomNameEntry;
+ Gtk::Label inviteKey;
+ };
+} \ No newline at end of file
diff --git a/include/Topbar.hpp b/include/Topbar.hpp
new file mode 100644
index 0000000..ebb7729
--- /dev/null
+++ b/include/Topbar.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "ImageButton.hpp"
+#include <gtkmm/grid.h>
+#include <gtkmm/searchentry.h>
+#include <gtkmm/label.h>
+
+namespace dchat
+{
+ class Topbar : public Gtk::Grid
+ {
+ public:
+ Topbar();
+ void setTitle(const Glib::ustring &title);
+
+ ImageButton roomSettingsButton;
+ ImageButton roomNotificationsButton;
+ private:
+ Gtk::SearchEntry topbarSearchBar;
+ Gtk::Label currentRoomTitle;
+ };
+} \ No newline at end of file