History

switch to single button for mode switching

ZappoMan committed 11 years ago

Commit 184acae1 parent fe9fab62 files · +17 −18Browse files

Showing the changes to interface/src/ui/HMDToolsDialog.cpp (1 of 2 files). Show all

Unified · Split

interface/src/ui/HMDToolsDialog.cpp+15−16
@@ -28,6 +28,8 @@ · 27 unmodified lines
2828
2929 HMDToolsDialog::HMDToolsDialog(QWidget* parent) :
3030 QDialog(parent, Qt::Window | Qt::WindowCloseButtonHint | Qt::WindowStaysOnTopHint) ,
31+ _switchModeButton(NULL),
32+ _debugDetails(NULL),
3133 _previousScreen(NULL),
3234 _hmdScreen(NULL),
3335 _previousDialogScreen(NULL),
@@ -37,21 +39,17 @@ HMDToolsDialog::HMDToolsDialog(QWidget* parent) : · 3 unmodified lines
3739
3840 // Create layouter
3941 QFormLayout* form = new QFormLayout();
42+ const int WIDTH = 350;
4043
4144 // 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)));
5049
5150 // Create a label with debug details...
5251 _debugDetails = new QLabel();
5352 _debugDetails->setText(getDebugDetails());
54− const int WIDTH = 350;
5553 const int HEIGHT = 100;
5654 _debugDetails->setFixedSize(WIDTH, HEIGHT);
5755 form->addRow("", _debugDetails);
@@ -163,12 +161,17 @@ QString HMDToolsDialog::getDebugDetails() const { · 105 unmodified lines
163161 return results;
164162 }
165163
166−void HMDToolsDialog::enterModeClicked(bool checked) {
167− enterHDMMode();
164+void HMDToolsDialog::switchModeClicked(bool checked) {
165+ if (!_inHDMMode) {
166+ enterHDMMode();
167+ } else {
168+ leaveHDMMode();
169+ }
168170 }
169171
170172 void HMDToolsDialog::enterHDMMode() {
171173 if (!_inHDMMode) {
174+ _switchModeButton->setText("Leave HMD Mode");
172175 _debugDetails->setText(getDebugDetails());
173176
174177 int hmdScreen = OculusManager::getHMDScreen();
@@ -212,13 +215,9 @@ void HMDToolsDialog::activateWindowAfterEnterMode() { · 37 unmodified lines
212215 centerCursorOnWidget(Application::getInstance()->getWindow());
213216 }
214217
215−void HMDToolsDialog::leaveModeClicked(bool checked) {
216− leaveHDMMode();
217−}
218−
219−
220218 void HMDToolsDialog::leaveHDMMode() {
221219 if (_inHDMMode) {
220+ _switchModeButton->setText("Enter HMD Mode");
222221 _debugDetails->setText(getDebugDetails());
223222
224223 Application::getInstance()->setFullscreen(false);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t