Skip to content

Commit 0d9fec8

Browse files
committed
Fix how Configuration Menu Closes #768
1 parent 081334f commit 0d9fec8

File tree

3 files changed

+225
-87
lines changed

3 files changed

+225
-87
lines changed

src/Interface/Modules/Render/ViewScene.cc

Lines changed: 7 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -365,36 +365,22 @@ void ViewSceneDialog::lookDownAxisZ(int upIndex, glm::vec3& up)
365365
//------------------------------------------------------------------------------
366366
void ViewSceneDialog::configurationButtonClicked()
367367
{
368-
showConfiguration_ = !mConfigurationDock->isVisible();
369-
mConfigurationDock->setEnabled(showConfiguration_);
370-
mConfigurationDock->setVisible(showConfiguration_);
368+
showConfiguration_ = !mConfigurationDock->isVisible();
369+
mConfigurationDock->setEnabled(showConfiguration_);
370+
mConfigurationDock->setVisible(showConfiguration_);
371371
}
372372

373373
//------------------------------------------------------------------------------
374374
void ViewSceneDialog::addToolBar()
375375
{
376376
mToolBar = new QToolBar(this);
377377

378-
//addMouseMenu();
379378
addAutoViewButton();
380379
addObjectToggleMenu();
381380

382381
glLayout->addWidget(mToolBar);
383382
}
384383

385-
void ViewSceneDialog::addMouseMenu(QWidget* widget)
386-
{
387-
auto menu = new QComboBox(this);
388-
menu->setToolTip("Change Mouse Controls");
389-
menu->addItem("Legacy Mouse Control");
390-
menu->addItem("New Mouse Control");
391-
connect(menu, SIGNAL(currentIndexChanged(int)), this, SLOT(menuMouseControlChanged(int)));
392-
menu->setCurrentIndex(SCIRun::Core::Preferences::Instance().useNewViewSceneMouseControls ? 1 : 0);
393-
menu->setParent(widget);
394-
//mToolBar->addWidget(menu);
395-
//mToolBar->addSeparator();
396-
}
397-
398384
void ViewSceneDialog::addAutoViewButton()
399385
{
400386
QPushButton* autoViewBtn = new QPushButton(this);
@@ -500,78 +486,16 @@ void ViewSceneDialog::addConfigurationButton()
500486

501487
void ViewSceneDialog::addConfigurationDock(const QString& viewName)
502488
{
503-
showConfiguration_ = false;
504-
mConfigurationDock = new QDockWidget(this);
489+
QString name = viewName + " Configuration";
490+
mConfigurationDock = new ViewSceneControlsDock(name, this);
505491
mConfigurationDock->close();
506-
QString name = viewName + " Configuration";
507-
mConfigurationDock->setWindowTitle(name);
508-
mConfigurationDock->setAllowedAreas(Qt::BottomDockWidgetArea);
509-
mConfigurationDock->setFloating(true);
510-
mConfigurationDock->setMinimumWidth(300);
511-
mConfigurationDock->setMinimumHeight(150);
512-
mConfigurationDock->setVisible(false);
513-
mConfigurationDock->setEnabled(false);
514-
515-
QTabWidget* tabs = new QTabWidget(mConfigurationDock);
516-
tabs->setFixedSize(300, 150);
517-
518-
// View Tab
519-
QWidget* viewTab = new QWidget();
520-
addShowOrientationCheckbox(viewTab);
521-
QPushButton* upButton = new QPushButton(viewTab);
522-
upButton->setToolTip("Rotate up");
523-
//upButton->setText("Up");
524-
upButton->setText("/\\");
525-
upButton->setAutoDefault(false);
526-
upButton->setDefault(false);
527-
upButton->setGeometry(15, 25, 35, 25);
528-
//connect(upButton, SIGNAL(clicked(bool)), this, SLOT(viewBarButtonClicked()));
529-
QPushButton* downButton = new QPushButton(viewTab);
530-
downButton->setToolTip("Rotate down");
531-
//downButton->setText("Down");
532-
downButton->setText("\\/");
533-
downButton->setAutoDefault(false);
534-
downButton->setDefault(false);
535-
downButton->setGeometry(15, 75, 35, 25);
536-
537-
QPushButton* leftButton = new QPushButton(viewTab);
538-
leftButton->setToolTip("Rotate left");
539-
//leftButton->setText("Left");
540-
leftButton->setText("<");
541-
leftButton->setAutoDefault(false);
542-
leftButton->setDefault(false);
543-
leftButton->setGeometry(0, 50, 35, 25);
544-
545-
QPushButton* rightButton = new QPushButton(viewTab);
546-
rightButton->setToolTip("Rotate right");
547-
//rightButton->setText("Right");
548-
rightButton->setText(">");
549-
rightButton->setAutoDefault(false);
550-
rightButton->setDefault(false);
551-
rightButton->setGeometry(35, 50, 35, 25);
552-
553-
tabs->addTab(viewTab, "View");
554-
555-
// Control Tab
556-
QWidget* controlTab = new QWidget();
557-
addMouseMenu(controlTab);
558-
tabs->addTab(controlTab, "Controls");
559-
560-
561-
}
562-
563-
void ViewSceneDialog::addShowOrientationCheckbox(QWidget* widget)
564-
{
565-
QCheckBox* showOrientationCheckBox = new QCheckBox(widget);
566-
showOrientationCheckBox->setText("Orientation");
567-
showOrientationCheckBox->setToolTip("Toggle Orientation Axes");
568-
showOrientationCheckBox->setChecked(true);
569492

570-
connect(showOrientationCheckBox, SIGNAL(clicked(bool)), this, SLOT(showOrientationChecked(bool)));
493+
showConfiguration_ = false;
571494
}
572495

573496
void ViewSceneDialog::closeConfigurationDock()
574497
{
498+
showConfiguration_ = mConfigurationDock->isVisible();
575499
if (showConfiguration_)
576500
{
577501
configurationButtonClicked();

src/Interface/Modules/Render/ViewScene.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ DEALINGS IN THE SOFTWARE.
3939
#include <Modules/Basic/SendScalarModuleState.h>
4040
#include <Interface/Modules/Base/ModuleDialogGeneric.h>
4141

42+
#include <Interface/Modules/Render/ViewSceneControlsDock.h>
4243
#include <Interface/Modules/Render/namespaces.h>
4344
#include <Interface/Modules/Render/share.h>
4445

@@ -56,6 +57,7 @@ namespace SCIRun {
5657
namespace Gui {
5758

5859
class GLWidget;
60+
class ViewSceneControlsDock;
5961

6062
class SCISHARE ViewSceneDialog : public ModuleDialogGeneric,
6163
public Ui::ViewScene
@@ -89,15 +91,13 @@ namespace SCIRun {
8991
virtual void contextMenuEvent(QContextMenuEvent* evt) override {}
9092
private:
9193
void addToolBar();
92-
void addMouseMenu(QWidget* widget);
9394
void addAutoViewButton();
9495
void addObjectToggleMenu();
9596
void addViewBarButton();
9697
void addViewBar();
9798
void addViewOptions();
9899
void addConfigurationButton();
99100
void addConfigurationDock(const QString& viewName);
100-
void addShowOrientationCheckbox(QWidget* widget);
101101
void closeConfigurationDock();
102102

103103
void lookDownAxisX(int upIndex, glm::vec3& up);
@@ -110,13 +110,14 @@ namespace SCIRun {
110110
QToolBar* mViewBar; ///< Tool bar for view options.
111111
QComboBox* mDownViewBox; ///< Combo box for Down axis options.
112112
QComboBox* mUpVectorBox; ///< Combo box for Up Vector options.
113-
QDockWidget* mConfigurationDock; ///< Dock holding configuration functions
114-
113+
ViewSceneControlsDock* mConfigurationDock; ///< Dock holding configuration functions mConfigurationDialog; ///< Menu holding configuration functions
114+
115115
bool shown_;
116116
bool hideViewBar_;
117117
bool showConfiguration_;
118118
std::shared_ptr<class ViewSceneItemManager> itemManager_;
119119

120+
friend class ViewSceneControlsDock;
120121
};
121122

122123
class ViewSceneItemManager : public QObject
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>ViewSceneControlsDialog</class>
4+
<widget class="QDialog" name="ViewSceneControlsDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>300</width>
10+
<height>350</height>
11+
</rect>
12+
</property>
13+
<property name="minimumSize">
14+
<size>
15+
<width>300</width>
16+
<height>350</height>
17+
</size>
18+
</property>
19+
<property name="windowTitle">
20+
<string>ViewScene Configuration</string>
21+
</property>
22+
<layout class="QGridLayout" name="gridLayout_2">
23+
<item row="0" column="0">
24+
<widget class="QTabWidget" name="tabWidget">
25+
<property name="currentIndex">
26+
<number>1</number>
27+
</property>
28+
<widget class="QWidget" name="viewTab_">
29+
<attribute name="title">
30+
<string>View</string>
31+
</attribute>
32+
<widget class="QGroupBox" name="groupBox">
33+
<property name="enabled">
34+
<bool>false</bool>
35+
</property>
36+
<property name="geometry">
37+
<rect>
38+
<x>8</x>
39+
<y>8</y>
40+
<width>260</width>
41+
<height>140</height>
42+
</rect>
43+
</property>
44+
<property name="font">
45+
<font>
46+
<weight>75</weight>
47+
<bold>true</bold>
48+
</font>
49+
</property>
50+
<property name="title">
51+
<string>Auto Rotate Settings</string>
52+
</property>
53+
<widget class="QPushButton" name="rotateUpButton_">
54+
<property name="geometry">
55+
<rect>
56+
<x>88</x>
57+
<y>20</y>
58+
<width>75</width>
59+
<height>23</height>
60+
</rect>
61+
</property>
62+
<property name="toolTip">
63+
<string>Rotate Object Up</string>
64+
</property>
65+
<property name="text">
66+
<string>Up</string>
67+
</property>
68+
</widget>
69+
<widget class="QPushButton" name="rotateLeftButton_">
70+
<property name="geometry">
71+
<rect>
72+
<x>40</x>
73+
<y>50</y>
74+
<width>75</width>
75+
<height>23</height>
76+
</rect>
77+
</property>
78+
<property name="toolTip">
79+
<string>Rotate Object Left</string>
80+
</property>
81+
<property name="text">
82+
<string>Left</string>
83+
</property>
84+
</widget>
85+
<widget class="QPushButton" name="rotateRightButton_">
86+
<property name="geometry">
87+
<rect>
88+
<x>130</x>
89+
<y>50</y>
90+
<width>75</width>
91+
<height>23</height>
92+
</rect>
93+
</property>
94+
<property name="toolTip">
95+
<string>Rotate Object Right</string>
96+
</property>
97+
<property name="text">
98+
<string>Right</string>
99+
</property>
100+
</widget>
101+
<widget class="QPushButton" name="rotateDownButton_">
102+
<property name="geometry">
103+
<rect>
104+
<x>88</x>
105+
<y>80</y>
106+
<width>75</width>
107+
<height>23</height>
108+
</rect>
109+
</property>
110+
<property name="toolTip">
111+
<string>Rotate Object Down</string>
112+
</property>
113+
<property name="text">
114+
<string>Down</string>
115+
</property>
116+
</widget>
117+
<widget class="QCheckBox" name="autoRotateCheckBox_">
118+
<property name="geometry">
119+
<rect>
120+
<x>50</x>
121+
<y>110</y>
122+
<width>101</width>
123+
<height>17</height>
124+
</rect>
125+
</property>
126+
<property name="font">
127+
<font>
128+
<weight>75</weight>
129+
<bold>true</bold>
130+
</font>
131+
</property>
132+
<property name="toolTip">
133+
<string>Toggle Auto Rotate</string>
134+
</property>
135+
<property name="text">
136+
<string>Auto Rotate</string>
137+
</property>
138+
</widget>
139+
</widget>
140+
<widget class="QGroupBox" name="groupBox_2">
141+
<property name="geometry">
142+
<rect>
143+
<x>8</x>
144+
<y>170</y>
145+
<width>261</width>
146+
<height>80</height>
147+
</rect>
148+
</property>
149+
<property name="font">
150+
<font>
151+
<weight>75</weight>
152+
<bold>true</bold>
153+
</font>
154+
</property>
155+
<property name="title">
156+
<string>View Options</string>
157+
</property>
158+
<widget class="QCheckBox" name="orientationCheckBox_">
159+
<property name="geometry">
160+
<rect>
161+
<x>10</x>
162+
<y>20</y>
163+
<width>101</width>
164+
<height>17</height>
165+
</rect>
166+
</property>
167+
<property name="toolTip">
168+
<string>Toggle Orientation Axis</string>
169+
</property>
170+
<property name="text">
171+
<string>Orientation</string>
172+
</property>
173+
<property name="checked">
174+
<bool>true</bool>
175+
</property>
176+
</widget>
177+
</widget>
178+
</widget>
179+
<widget class="QWidget" name="controlsTab_">
180+
<attribute name="title">
181+
<string>Controls</string>
182+
</attribute>
183+
<widget class="QComboBox" name="mouseControlComboBox_">
184+
<property name="geometry">
185+
<rect>
186+
<x>10</x>
187+
<y>10</y>
188+
<width>141</width>
189+
<height>22</height>
190+
</rect>
191+
</property>
192+
<property name="currentIndex">
193+
<number>1</number>
194+
</property>
195+
<item>
196+
<property name="text">
197+
<string>Legacy Mouse Control</string>
198+
</property>
199+
</item>
200+
<item>
201+
<property name="text">
202+
<string>New Mouse Control</string>
203+
</property>
204+
</item>
205+
</widget>
206+
</widget>
207+
</widget>
208+
</item>
209+
</layout>
210+
</widget>
211+
<resources/>
212+
<connections/>
213+
</ui>

0 commit comments

Comments
 (0)