Showing the changes to interface/src/ui/HMDToolsDialog.cpp (1 of 2 files). Show all
Unified · Split
| @@ -28,6 +28,8 @@ · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | HMDToolsDialog::HMDToolsDialog(QWidget* parent) : | 29 | HMDToolsDialog::HMDToolsDialog(QWidget* parent) : |
| 30 | QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint) , | 30 | QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint) , |
| 31 | _switchModeButton(NULL), | ||
| 32 | _debugDetails(NULL), | ||
| 31 | _previousScreen(NULL), | 33 | _previousScreen(NULL), |
| 32 | _hmdScreen(NULL), | 34 | _hmdScreen(NULL), |
| 33 | _previousDialogScreen(NULL), | 35 | _previousDialogScreen(NULL), |
| @@ -37,21 +39,17 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : · 3 unmodified lines | |||
| 37 | 39 | ||
| 38 | // Create layouter | 40 | // Create layouter |
| 39 | QFormLayout* form = new QFormLayout(); | 41 | QFormLayout* form = new QFormLayout(); |
| 42 | const int WIDTH = 350; | ||
| 40 | 43 | ||
| 41 | // Add a button to enter | 44 | // Add a button to enter |
| 42 | QPushButton* enterModeButton = new QPushButton("Enter HMD Mode"); | 45 | _switchModeButton = new QPushButton("Enter HMD Mode"); |
| 43 | form->addRow("", enterModeButton); | 46 | _switchModeButton->setFixedWidth(WIDTH); |
| 44 | connect(enterModeButton,SIGNAL(clicked(bool)),this,SLOT(enterModeClicked(bool))); | 47 | form->addRow("", _switchModeButton); |
| 45 | 48 | connect(_switchModeButton,SIGNAL(clicked(bool)),this,SLOT(switchModeClicked(bool))); | |
| 46 | // Add a button to leave | ||
| 47 | QPushButton* leaveModeButton = new QPushButton("Leave HMD Mode"); | ||
| 48 | form->addRow("", leaveModeButton); | ||
| 49 | connect(leaveModeButton,SIGNAL(clicked(bool)),this,SLOT(leaveModeClicked(bool))); | ||
| 50 | 49 | ||
| 51 | // Create a label with debug details... | 50 | // Create a label with debug details... |
| 52 | _debugDetails = new QLabel(); | 51 | _debugDetails = new QLabel(); |
| 53 | _debugDetails->setText(getDebugDetails()); | 52 | _debugDetails->setText(getDebugDetails()); |
| 54 | const int WIDTH = 350; | ||
| 55 | const int HEIGHT = 100; | 53 | const int HEIGHT = 100; |
| 56 | _debugDetails->setFixedSize(WIDTH, HEIGHT); | 54 | _debugDetails->setFixedSize(WIDTH, HEIGHT); |
| 57 | form->addRow("", _debugDetails); | 55 | form->addRow("", _debugDetails); |
| @@ -163,12 +161,17 @@ QString HMDToolsDialog::getDebugDetails() const { · 105 unmodified lines | |||
| 163 | return results; | 161 | return results; |
| 164 | } | 162 | } |
| 165 | 163 | ||
| 166 | void HMDToolsDialog::enterModeClicked(bool checked) { | 164 | void HMDToolsDialog::switchModeClicked(bool checked) { |
| 167 | enterHDMMode(); | 165 | if (!_inHDMMode) { |
| 166 | enterHDMMode(); | ||
| 167 | } else { | ||
| 168 | leaveHDMMode(); | ||
| 169 | } | ||
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | void HMDToolsDialog::enterHDMMode() { | 172 | void HMDToolsDialog::enterHDMMode() { |
| 171 | if (!_inHDMMode) { | 173 | if (!_inHDMMode) { |
| 174 | _switchModeButton->setText("Leave HMD Mode"); | ||
| 172 | _debugDetails->setText(getDebugDetails()); | 175 | _debugDetails->setText(getDebugDetails()); |
| 173 | 176 | ||
| 174 | int hmdScreen = OculusManager::getHMDScreen(); | 177 | int hmdScreen = OculusManager::getHMDScreen(); |
| @@ -212,13 +215,9 @@ void HMDToolsDialog::activateWindowAfterEnterMode() { · 37 unmodified lines | |||
| 212 | centerCursorOnWidget(Application::getInstance()->getWindow()); | 215 | centerCursorOnWidget(Application::getInstance()->getWindow()); |
| 213 | } | 216 | } |
| 214 | 217 | ||
| 215 | void HMDToolsDialog::leaveModeClicked(bool checked) { | ||
| 216 | leaveHDMMode(); | ||
| 217 | } | ||
| 218 | |||
| 219 | |||
| 220 | void HMDToolsDialog::leaveHDMMode() { | 218 | void HMDToolsDialog::leaveHDMMode() { |
| 221 | if (_inHDMMode) { | 219 | if (_inHDMMode) { |
| 220 | _switchModeButton->setText("Enter HMD Mode"); | ||
| 222 | _debugDetails->setText(getDebugDetails()); | 221 | _debugDetails->setText(getDebugDetails()); |
| 223 | 222 | ||
| 224 | Application::getInstance()->setFullscreen(false); | 223 | Application::getInstance()->setFullscreen(false); |