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
161 QMenu* toolsMenu = addMenu("Tools");161 QMenu* toolsMenu = addMenu("Tools");
162 addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));162 addActionToQMenuAndActionHash(toolsMenu, MenuOption::MetavoxelEditor, 0, this, SLOT(showMetavoxelEditor()));
163 addActionToQMenuAndActionHash(toolsMenu, MenuOption::FstUploader, 0, Application::getInstance(), SLOT(uploadFST()));163 addActionToQMenuAndActionHash(toolsMenu, MenuOption::FstUploader, 0, Application::getInstance(), SLOT(uploadFST()));
164 164 addActionToQMenuAndActionHash(toolsMenu, MenuOption::Chat, 0, this, SLOT(showChat()));
165 165
166 QMenu* viewMenu = addMenu("View");166 QMenu* viewMenu = addMenu("View");
167 167
@@ -1021,6 +1021,24 @@ void Menu::showMetavoxelEditor() { · 853 unmodified lines
1021 _MetavoxelEditor->raise();1021 _MetavoxelEditor->raise();
1022}1022}
1023 1023
1024void 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
1024void Menu::audioMuteToggled() {1042void Menu::audioMuteToggled() {
1025 QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);1043 QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
1026 muteAction->setChecked(Application::getInstance()->getAudio()->getMuted());1044 muteAction->setChecked(Application::getInstance()->getAudio()->getMuted());