From 5fab9a3a2cf048330f687dda48c76c95a3a67d98 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 9 Nov 2018 09:46:43 +0100 Subject: Add room joining --- src/Window.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/Window.cpp') diff --git a/src/Window.cpp b/src/Window.cpp index 22e5501..adad21e 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -20,6 +20,7 @@ namespace dchat overlay.add(stack); add(overlay); + stack.set_homogeneous(false); stack.set_transition_type(Gtk::StackTransitionType::STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT); stack.set_transition_duration(250); stack.add(loginWindow, "login"); @@ -27,6 +28,7 @@ namespace dchat overlay.show(); windowNotification->show_all(); + stack.set_visible_child("login"); stack.show(); //chatWindow.show_all(); //loginWindow.show(); @@ -45,7 +47,7 @@ namespace dchat rooms->loginUser(username.raw(), password.raw()); //windowNotification->show(Glib::ustring("Successfully logged in as ") + username); drawBackgroundConnection.disconnect(); - chatWindow.show_all(); + chatWindow.show(); stack.set_visible_child(chatWindow); chatWindow.scrollToBottom(); } @@ -71,7 +73,7 @@ namespace dchat rooms->registerUser(username.raw(), password.raw()); windowNotification->show(Glib::ustring("Successfully registered user ") + username); drawBackgroundConnection.disconnect(); - chatWindow.show_all(); + chatWindow.show(); stack.set_visible_child(chatWindow); } catch(std::exception &e) @@ -109,11 +111,11 @@ namespace dchat }; roomCallbackFuncs.createRoomCallbackFunc = [this](std::shared_ptr room) { - chatWindow.addRoom(room); + chatWindow.addRoom(room); }; - roomCallbackFuncs.addUserCallbackFunc = [this](std::shared_ptr room, std::shared_ptr user) + roomCallbackFuncs.addUserCallbackFunc = [this](const RoomAddUserRequest &request) { - chatWindow.addUser(room, user); + chatWindow.addUser(request); }; roomCallbackFuncs.addMessageCallbackFunc = [this](const RoomAddMessageRequest &request) { @@ -127,6 +129,10 @@ namespace dchat { chatWindow.changeRoomName(request); }; + roomCallbackFuncs.receiveInviteUserCallbackFunc = [this](const InviteUserRequest &request) + { + chatWindow.addInviteRequest(request); + }; windowNotification->show("Connecting to 83.252.53.188:27130"); Rooms::connect("83.252.53.188", 27130, roomCallbackFuncs); -- cgit v1.2.3