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