History

Added a basic version of the chat window.

Dimitar Dobrev committed 12 years ago

Commit 437cadf1 parent 1c2e7528 files · +612 −1Browse files

Showing the changes to interface/src/Menu.cpp (1 of 8 files). Show all

Unified · Split

interface/src/Menu.cpp+19−1
@@ -161,7 +161,7 @@ Menu::Menu() : · 160 unmodified lines
161161 QMenu* toolsMenu = addMenu("Tools");
162162 addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));
163163 addActionToQMenuAndActionHash(toolsMenu, MenuOption::FstUploader, 0, Application::getInstance(), SLOT(uploadFST()));
164−
164+ addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, 0, this, SLOT(showChat()));
165165
166166 QMenu* viewMenu = addMenu("View");
167167
@@ -1021,6 +1021,24 @@ void Menu::showMetavoxelEditor() { · 853 unmodified lines
10211021 _MetavoxelEditor->raise();
10221022 }
10231023
1024+void Menu::showChat() {
1025+ if (!_chatWindow) {
1026+ _chatWindow = new ChatWindow();
1027+ QMainWindow* mainWindow = Application::getInstance()->getWindow();
1028+
1029+ // the height of the title bar is given by frameGeometry().height() - geometry().height()
1030+ // however, frameGeometry() is initialised after showing (Qt queries the OS windowing system)
1031+ // on the other hand, moving a window after showing it flickers; so just use some reasonable value
1032+ int titleBarHeight = 16;
1033+ _chatWindow->setGeometry(mainWindow->width() - _chatWindow->width(),
1034+ mainWindow->geometry().y() + titleBarHeight,
1035+ _chatWindow->width(),
1036+ mainWindow->height() - titleBarHeight);
1037+ _chatWindow->show();
1038+ }
1039+ _chatWindow->raise();
1040+}
1041+
10241042 void Menu::audioMuteToggled() {
10251043 QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
10261044 muteAction->setChecked(Application::getInstance()->getAudio()->getMuted());