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