Skip to content

Commit 6d6134f

Browse files
authored
Merge pull request #2070 from SCIInstitute/move-vs-settings
Move VS settings
2 parents d51439c + c941a7a commit 6d6134f

File tree

14 files changed

+214
-198
lines changed

14 files changed

+214
-198
lines changed

src/Core/Application/Preferences/Preferences.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ Preferences::Preferences() :
5454
highlightPorts("highlightPorts", false),
5555
autoNotes("autoNotes", false),
5656
highDPIAdjustment("highDPIAdjustment", false),
57+
widgetSelectionCorrection("widgetSelectionCorrection", false),
58+
autoRotateViewerOnMouseRelease("autoRotateViewerOnMouseRelease", false),
5759
forceGridBackground("forceGridBackground", false),
5860
modulesAreDockable("modulesAreDockable", true),
5961
networkBackgroundColor("backgroundColor", "#808080"),

src/Core/Application/Preferences/Preferences.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ namespace SCIRun
8686
BooleanVariable highlightPorts;
8787
BooleanVariable autoNotes;
8888
BooleanVariable highDPIAdjustment;
89+
BooleanVariable widgetSelectionCorrection;
90+
BooleanVariable autoRotateViewerOnMouseRelease;
8991
TrackedVariable<BooleanVariable> forceGridBackground;
9092
TrackedVariable<BooleanVariable> modulesAreDockable;
9193
StringVariable networkBackgroundColor;

src/Interface/Application/Preferences.ui

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>738</width>
10-
<height>454</height>
10+
<height>469</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -29,15 +29,15 @@
2929
<item row="0" column="0">
3030
<widget class="QToolBox" name="toolBox">
3131
<property name="currentIndex">
32-
<number>0</number>
32+
<number>2</number>
3333
</property>
3434
<widget class="QWidget" name="page">
3535
<property name="geometry">
3636
<rect>
3737
<x>0</x>
3838
<y>0</y>
3939
<width>714</width>
40-
<height>331</height>
40+
<height>343</height>
4141
</rect>
4242
</property>
4343
<attribute name="label">
@@ -274,8 +274,8 @@
274274
<rect>
275275
<x>0</x>
276276
<y>0</y>
277-
<width>223</width>
278-
<height>97</height>
277+
<width>714</width>
278+
<height>343</height>
279279
</rect>
280280
</property>
281281
<attribute name="label">
@@ -344,8 +344,8 @@
344344
<rect>
345345
<x>0</x>
346346
<y>0</y>
347-
<width>574</width>
348-
<height>108</height>
347+
<width>714</width>
348+
<height>343</height>
349349
</rect>
350350
</property>
351351
<attribute name="label">
@@ -354,10 +354,26 @@
354354
<layout class="QVBoxLayout" name="verticalLayout">
355355
<item>
356356
<layout class="QGridLayout" name="gridLayout_3">
357-
<item row="1" column="0">
358-
<widget class="QCheckBox" name="highDPIAdjustCheckBox_">
357+
<item row="0" column="1">
358+
<widget class="QCheckBox" name="moduleErrorDialogDisableCheckbox_">
359359
<property name="text">
360-
<string>Adjust for high-DPI displays (SCIRun restart required)</string>
360+
<string>Disable Module Error dialogs</string>
361+
</property>
362+
<property name="checked">
363+
<bool>false</bool>
364+
</property>
365+
</widget>
366+
</item>
367+
<item row="3" column="1">
368+
<widget class="QSpinBox" name="maxCoresSpinBox_">
369+
<property name="suffix">
370+
<string/>
371+
</property>
372+
<property name="minimum">
373+
<number>0</number>
374+
</property>
375+
<property name="value">
376+
<number>0</number>
361377
</property>
362378
</widget>
363379
</item>
@@ -368,17 +384,14 @@
368384
</property>
369385
</widget>
370386
</item>
371-
<item row="0" column="1">
372-
<widget class="QCheckBox" name="moduleErrorDialogDisableCheckbox_">
387+
<item row="1" column="0">
388+
<widget class="QCheckBox" name="highDPIAdjustCheckBox_">
373389
<property name="text">
374-
<string>Disable Module Error dialogs</string>
375-
</property>
376-
<property name="checked">
377-
<bool>false</bool>
390+
<string>Adjust for high-DPI displays (SCIRun restart required)</string>
378391
</property>
379392
</widget>
380393
</item>
381-
<item row="2" column="0">
394+
<item row="3" column="0">
382395
<widget class="QLabel" name="label_3">
383396
<property name="maximumSize">
384397
<size>
@@ -391,16 +404,17 @@
391404
</property>
392405
</widget>
393406
</item>
394-
<item row="2" column="1">
395-
<widget class="QSpinBox" name="maxCoresSpinBox_">
396-
<property name="suffix">
397-
<string/>
398-
</property>
399-
<property name="minimum">
400-
<number>0</number>
407+
<item row="2" column="0">
408+
<widget class="QCheckBox" name="viewerWidgetSelectionCorrectionCheckbox_">
409+
<property name="text">
410+
<string>Viewer widget selection correction</string>
401411
</property>
402-
<property name="value">
403-
<number>0</number>
412+
</widget>
413+
</item>
414+
<item row="2" column="1">
415+
<widget class="QCheckBox" name="autoRotateViewerOnMouseReleaseCheckbox_">
416+
<property name="text">
417+
<string>Auto-rotate viewer on mouse release</string>
404418
</property>
405419
</widget>
406420
</item>

src/Interface/Application/PreferencesWindow.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ PreferencesWindow::PreferencesWindow(NetworkEditor* editor, std::function<void()
4646
connect(errorGraphicItemsCheckBox_, SIGNAL(stateChanged(int)), this, SLOT(updateModuleErrorInlineMessagesOption(int)));
4747
connect(highDPIAdjustCheckBox_, SIGNAL(stateChanged(int)), this, SLOT(updateHighDPIAdjust(int)));
4848
connect(forceGridBackgroundCheckBox_, SIGNAL(stateChanged(int)), this, SLOT(updateForceGridBackground(int)));
49+
connect(viewerWidgetSelectionCorrectionCheckbox_, SIGNAL(stateChanged(int)), this, SLOT(updateWidgetSelectionCorrection(int)));
50+
connect(autoRotateViewerOnMouseReleaseCheckbox_, SIGNAL(stateChanged(int)), this, SLOT(updateAutoRotateViewer(int)));
51+
}
52+
53+
void PreferencesWindow::updateWidgetSelectionCorrection(int state)
54+
{
55+
SCIRun::Core::Preferences::Instance().widgetSelectionCorrection.setValue(state != 0);
56+
}
57+
58+
void PreferencesWindow::updateAutoRotateViewer(int state)
59+
{
60+
SCIRun::Core::Preferences::Instance().autoRotateViewerOnMouseRelease.setValue(state != 0);
4961
}
5062

5163
void PreferencesWindow::updateModuleErrorDialogOption(int state)

src/Interface/Application/PreferencesWindow.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public Q_SLOTS:
6363
void updateAutoNotesState(int state);
6464
void updateHighDPIAdjust(int state);
6565
void updateForceGridBackground(int state);
66+
void updateWidgetSelectionCorrection(int state);
67+
void updateAutoRotateViewer(int state);
6668

6769
protected:
6870
void hideEvent(QHideEvent * event) override;

src/Interface/Application/PythonConsoleWidget.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ public Q_SLOTS:
6161
}}
6262

6363
#else
64+
namespace SCIRun
65+
{
66+
namespace Gui
67+
{
6468
class PythonConsoleWidget {};
69+
}
70+
}
6571
#endif
6672

6773
#endif

src/Interface/Application/SCIRunMainWindowSlotsPrivate.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,8 +566,10 @@ void SCIRunMainWindow::launchNewUserWizard()
566566

567567
void SCIRunMainWindow::launchPythonWizard()
568568
{
569+
#ifdef BUILD_WITH_PYTHON
569570
PythonWizard *wiz = new PythonWizard( [this](const QString& code) {pythonConsole_->runWizardCommand(code); }, this);
570571
wiz->show();
572+
#endif
571573
}
572574

573575
void SCIRunMainWindow::adjustModuleDock(int state)

src/Interface/Application/Settings.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,22 @@ void SCIRunMainWindow::readSettings()
256256
prefs.invertMouseZoom.setValue(mode);
257257
}
258258

259+
const QString widgetSelectionCorrection = "widgetSelectionCorrection";
260+
if (settings.contains(widgetSelectionCorrection))
261+
{
262+
bool mode = settings.value(widgetSelectionCorrection).toBool();
263+
guiLogDebug("Setting read: widgetSelectionCorrection = {}", mode);
264+
prefs.widgetSelectionCorrection.setValue(mode);
265+
}
266+
267+
const QString autoRotateViewerOnMouseRelease = "autoRotateViewerOnMouseRelease";
268+
if (settings.contains(autoRotateViewerOnMouseRelease))
269+
{
270+
bool mode = settings.value(autoRotateViewerOnMouseRelease).toBool();
271+
guiLogDebug("Setting read: autoRotateViewerOnMouseRelease = {}", mode);
272+
prefs.autoRotateViewerOnMouseRelease.setValue(mode);
273+
}
274+
259275
const QString forceGridBackground = "forceGridBackground";
260276
if (settings.contains(forceGridBackground))
261277
{
@@ -391,6 +407,8 @@ void SCIRunMainWindow::writeSettings()
391407
settings.setValue(qname(prefs.highlightPorts), prefs.highlightPorts.val());
392408
settings.setValue(qname(prefs.showModuleErrorInlineMessages), prefs.showModuleErrorInlineMessages.val());
393409
settings.setValue(qname(prefs.highDPIAdjustment), prefs.highDPIAdjustment.val());
410+
settings.setValue(qname(prefs.widgetSelectionCorrection), prefs.widgetSelectionCorrection.val());
411+
settings.setValue(qname(prefs.autoRotateViewerOnMouseRelease), prefs.autoRotateViewerOnMouseRelease.val());
394412
settings.setValue("defaultNotePositionIndex", prefsWindow_->defaultNotePositionComboBox_->currentIndex());
395413
settings.setValue("connectionPipeType", networkEditor_->connectionPipelineType());
396414
settings.setValue("disableModuleErrorDialogs", prefsWindow_->disableModuleErrorDialogs());

src/Interface/Modules/Render/ES/SRInterface.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040

4141
#include <Interface/Modules/Render/ES/SRInterface.h>
4242
#include <Interface/Modules/Render/ES/SRCamera.h>
43+
#include <Core/Application/Preferences/Preferences.h>
4344

4445
#include <Core/Logging/Log.h>
4546
#include <Core/Application/Application.h>
@@ -70,6 +71,7 @@
7071
#include "comp/LightingUniforms.h"
7172
#include "comp/ClippingPlaneUniforms.h"
7273
using namespace SCIRun;
74+
using namespace SCIRun::Core;
7375
using namespace SCIRun::Core::Datatypes;
7476
using namespace SCIRun::Graphics::Datatypes;
7577
using namespace SCIRun::Core::Geometry;
@@ -217,7 +219,7 @@ namespace SCIRun {
217219
{
218220
widgetSelected_ = false;
219221
widgetBall_.reset();
220-
tryAutoRotate = doAutoRotateOnDrag;
222+
tryAutoRotate = Preferences::Instance().autoRotateViewerOnMouseRelease;
221223
}
222224

223225
//----------------------------------------------------------------------------------------------
@@ -354,7 +356,6 @@ namespace SCIRun {
354356
void SRInterface::setCameraRotation(const glm::quat roation) {mCamera->setRotation(roation);}
355357
glm::quat SRInterface::getCameraRotation() const {return mCamera->getRotation();}
356358
void SRInterface::setAutoRotateSpeed(double speed) { autoRotateSpeed = speed; }
357-
void SRInterface::setAutoRotateOnDrag(bool value) { doAutoRotateOnDrag = value; }
358359
void SRInterface::setZoomInverted(bool value) {mCamera->setZoomInverted(value);}
359360
void SRInterface::setLockZoom(bool lock) {mCamera->setLockZoom(lock);}
360361
void SRInterface::setLockPanning(bool lock) {mCamera->setLockPanning(lock);}
@@ -555,7 +556,7 @@ namespace SCIRun {
555556
mCore.addComponent(entityID, commonUniforms);
556557

557558
applyUniform(entityID, SpireSubPass::Uniform("uColor", selCol));
558-
applyUniform(entityID, SpireSubPass::Uniform("hack", mSelectionHack));
559+
applyUniform(entityID, SpireSubPass::Uniform("hack", Preferences::Instance().widgetSelectionCorrection));
559560

560561
// Add components associated with entity. We just need a base class which
561562
// we can pass in an entity ID, then a derived class which bundles

src/Interface/Modules/Render/ES/SRInterface.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,13 @@ namespace SCIRun {
146146
void setLockRotation(bool lock);
147147
void setAutoRotateVector(glm::vec2 axis);
148148
void setAutoRotateSpeed(double speed);
149-
void setAutoRotateOnDrag(bool value);
150149
const glm::mat4& getWorldToProjection() const;
151150
const glm::mat4& getWorldToView() const;
152151
const glm::mat4& getViewToWorld() const;
153152
const glm::mat4& getViewToProjection() const;
154153

155154
//---------------- Widgets -------------------------------------------------------------------
156155
// todo Selecting objects...
157-
void toggleSelectionHack(bool b) {mSelectionHack = b;}
158156
typedef std::vector<Graphics::Datatypes::WidgetHandle> WidgetList;
159157
void select(const glm::ivec2& pos, WidgetList& objList, int port);
160158
std::string &getSelection() {return mSelected;}
@@ -339,7 +337,6 @@ namespace SCIRun {
339337
MouseMode mMouseMode {MOUSE_OLDSCIRUN}; // Current mouse mode.
340338

341339
std::string mSelected {}; // Current selection
342-
bool mSelectionHack {false};
343340
glm::vec3 mOriginWorld {};
344341
glm::vec3 mFlipAxisWorld {};
345342
glm::vec3 mOriginToSpos {};

0 commit comments

Comments
 (0)