From b5659bf9ade976353d771d9fcd1a3f1f3c3fb663 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 24 Nov 2018 19:17:47 +0100 Subject: Add change user nickname/avatar menu --- include/ChatWindow.hpp | 5 ++++- include/UserSettingsWindow.hpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 include/UserSettingsWindow.hpp (limited to 'include') diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp index b0f4001..764ca32 100644 --- a/include/ChatWindow.hpp +++ b/include/ChatWindow.hpp @@ -3,6 +3,7 @@ #include "ImageButton.hpp" #include "RoomSettingsWindow.hpp" #include "RoomNotificationsWindow.hpp" +#include "UserSettingsWindow.hpp" #include #include #include @@ -30,6 +31,7 @@ namespace dchat void addMessage(const RoomAddMessageRequest &request); void addUser(const RoomAddUserRequest &request); void setUserNickname(const UserChangeNicknameRequest &request); + void setUserAvatar(const UserChangeAvatarRequest &request); void changeRoomName(const RoomChangeNameRequest &request); void addInviteRequest(const InviteUserRequest &request); void scrollToBottom(); @@ -39,7 +41,9 @@ namespace dchat Gtk::Grid chatPage; RoomSettingsWindow roomSettingsWindow; RoomNotificationsWindow roomNotificationsWindow; + UserSettingsWindow userSettingsWindow; Window *window; + std::shared_ptr currentRoom; private: void setupTopbar(); void setupLeftPanel(Gtk::ResponsivePaned *sidePanels); @@ -69,7 +73,6 @@ namespace dchat int chatPrevNumLines; int roomCount; RoomData *currentRoomData; - std::shared_ptr currentRoom; bool chatInputShowPlaceholder; bool chatInputChangeByPlaceholder; }; diff --git a/include/UserSettingsWindow.hpp b/include/UserSettingsWindow.hpp new file mode 100644 index 0000000..e7062e1 --- /dev/null +++ b/include/UserSettingsWindow.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include +#include + +namespace Gtk +{ + class Paned; +} + +namespace dchat +{ + class ChatWindow; + + class UserSettingsWindow : public Gtk::Grid + { + public: + UserSettingsWindow(ChatWindow *chatWindow); + void setAvatarUrl(const std::string &url); + void setNickname(const std::string &nickname); + + void setupLeftPanel(Gtk::Paned *sidePanels); + void setupRightPanel(Gtk::Paned *sidePanels); + private: + ChatWindow *chatWindow; + Gtk::Entry nicknameEntry; + Gtk::Entry avatarUrlEntry; + Glib::ustring prevNickname; + Glib::ustring prevAvatarUrl; + }; +} \ No newline at end of file -- cgit v1.2.3