Skip to content

Commit 7789bb1

Browse files
committed
Merge pull request #755 from SCIInstitute/releaseCandidate_M
Release candidate m
2 parents 4380963 + e69b998 commit 7789bb1

File tree

16 files changed

+150
-123
lines changed

16 files changed

+150
-123
lines changed

src/Core/Algorithms/Visualization/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ SET(Algorithms_Visualization_HEADERS
3535
RenderFieldState.h
3636
)
3737

38-
ADD_LIBRARY(Core_Algorithms_Visualization
38+
SCIRUN_ADD_LIBRARY(Core_Algorithms_Visualization
3939
${Algorithms_Visualization_HEADERS}
4040
${Algorithms_Visualization_SRCS}
4141
)

src/Interface/Application/Connection.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,14 @@ namespace
437437
void DataInfoDialog::show(PortDataDescriber portDataDescriber, const QString& label, const std::string& id)
438438
{
439439
auto info = eval(portDataDescriber);
440-
QMessageBox::information(SCIRunMainWindow::Instance(), label + " Data info: " + QString::fromStdString(id), info);
440+
441+
QMessageBox* msgBox = new QMessageBox(SCIRunMainWindow::Instance());
442+
msgBox->setAttribute(Qt::WA_DeleteOnClose);
443+
msgBox->setStandardButtons(QMessageBox::Ok);
444+
msgBox->setWindowTitle(label + " Data info: " + QString::fromStdString(id));
445+
msgBox->setText(info);
446+
msgBox->setModal(false);
447+
msgBox->show();
441448
}
442449

443450
void ConnectionLine::keyPressEvent(QKeyEvent* event)

src/Interface/Application/ModuleProxyWidget.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void ModuleProxyWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
179179
{
180180
if (PortWidget* p = qobject_cast<PortWidget*>(pressedSubWidget_))
181181
{
182-
p->doMouseRelease(event->button(), mapToScene(event->pos()));
182+
p->doMouseRelease(event->button(), mapToScene(event->pos()), event->modifiers());
183183
return;
184184
}
185185
if (grabbedByWidget_)

src/Interface/Application/ModuleWidget.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataf
472472
deleting_(false),
473473
defaultBackgroundColor_(SCIRunMainWindow::Instance()->newInterface() ? moduleRGBA(99,99,104) : moduleRGBA(192,192,192)),
474474
fullIndex_(0),
475-
miniIndex_(0)
475+
miniIndex_(0),
476+
isViewScene_(name == "ViewScene")
476477
{
477478
setupModuleActions();
478479
setupLogging();
@@ -539,7 +540,7 @@ void ModuleWidget::setupDisplayWidgets(ModuleWidgetDisplayBase* display, const Q
539540

540541
//TODO: ultra ugly. no other place for this code right now.
541542
//TODO: to be handled in issue #212
542-
if (name == "ViewScene")
543+
if (isViewScene_)
543544
{
544545
display->setupSpecial();
545546
}
@@ -620,6 +621,8 @@ void ModuleWidget::setupModuleActions()
620621
connect(actionsMenu_->getAction("Help"), SIGNAL(triggered()), this, SLOT(launchDocumentation()));
621622
connect(actionsMenu_->getAction("Collapse"), SIGNAL(triggered()), this, SLOT(collapseToMiniMode()));
622623
connect(actionsMenu_->getAction("Duplicate"), SIGNAL(triggered()), this, SLOT(duplicate()));
624+
if (isViewScene_)
625+
actionsMenu_->getAction("Duplicate")->setDisabled(true);
623626

624627
connectNoteEditorToAction(actionsMenu_->getAction("Notes"));
625628
connectUpdateNote(this);
@@ -1015,7 +1018,8 @@ void ModuleWidget::makeOptionsDialog()
10151018
dockable_->setAllowedAreas(allowedDockArea());
10161019
dockable_->setAutoFillBackground(true);
10171020
SCIRunMainWindow::Instance()->addDockWidget(Qt::RightDockWidgetArea, dockable_);
1018-
dockable_->setFloating(!Core::Preferences::Instance().modulesAreDockable);
1021+
if (!isViewScene_)
1022+
dockable_->setFloating(!Core::Preferences::Instance().modulesAreDockable);
10191023
dockable_->hide();
10201024
connect(dockable_, SIGNAL(visibilityChanged(bool)), this, SLOT(colorOptionsButton(bool)));
10211025
}
@@ -1066,8 +1070,7 @@ void ModuleWidget::toggleOptionsDialog()
10661070
dockable_->show();
10671071
dockable_->raise();
10681072
dockable_->activateWindow();
1069-
//TODO--more special viewscene code...
1070-
if (dialog_->windowTitle().startsWith("ViewScene"))
1073+
if (isViewScene_)
10711074
{
10721075
dockable_->setFloating(true);
10731076
}

src/Interface/Application/ModuleWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ private Q_SLOTS:
223223
bool deleting_;
224224
const QString defaultBackgroundColor_;
225225
int fullIndex_, miniIndex_;
226+
bool isViewScene_; //TODO: lots of special logic around this case.
226227

227228
static bool globalMiniMode_;
228229
};

src/Interface/Application/NetworkEditor.cc

Lines changed: 61 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -583,28 +583,32 @@ void NetworkEditor::mouseMoveEvent(QMouseEvent *event)
583583
if (event->button() != Qt::LeftButton)
584584
Q_EMIT networkEditorMouseButtonPressed();
585585

586-
if (ConnectionLine* cL = getSingleConnectionSelected())
587-
if (event->buttons() & Qt::LeftButton)
588-
if (!(event->modifiers() & Qt::ControlModifier))
589-
{
590-
auto selectedPair = cL->getConnectedToModuleIds();
586+
if (ConnectionLine* cL = getSingleConnectionSelected())
587+
{
588+
if (event->buttons() & Qt::LeftButton)
589+
{
590+
if (!(event->modifiers() & Qt::ControlModifier))
591+
{
592+
auto selectedPair = cL->getConnectedToModuleIds();
591593

592-
findById(scene_->items(),selectedPair.first)->setSelected(true);
593-
findById(scene_->items(),selectedPair.second)->setSelected(true);
594-
modulesSelectedByCL_ = true;
595-
}
596-
QGraphicsView::mouseMoveEvent(event);
594+
findById(scene_->items(), selectedPair.first)->setSelected(true);
595+
findById(scene_->items(), selectedPair.second)->setSelected(true);
596+
modulesSelectedByCL_ = true;
597+
}
598+
}
599+
}
600+
QGraphicsView::mouseMoveEvent(event);
597601
}
598602

599603
void NetworkEditor::mouseReleaseEvent(QMouseEvent *event)
600604
{
601-
if(modulesSelectedByCL_)
602-
{
603-
unselectConnectionGroup();
604-
Q_EMIT modified();
605-
}
606-
modulesSelectedByCL_ = false;
607-
QGraphicsView::mouseReleaseEvent(event);
605+
if (modulesSelectedByCL_)
606+
{
607+
unselectConnectionGroup();
608+
Q_EMIT modified();
609+
}
610+
modulesSelectedByCL_ = false;
611+
QGraphicsView::mouseReleaseEvent(event);
608612
}
609613

610614
ConnectionLine* NetworkEditor::getSingleConnectionSelected()
@@ -932,18 +936,23 @@ namespace
932936

933937
void NetworkEditor::wheelEvent(QWheelEvent* event)
934938
{
935-
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
936-
937-
if (event->delta() > 0)
939+
if (event->modifiers() & Qt::ShiftModifier)
938940
{
939-
zoomIn();
941+
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
942+
943+
if (event->delta() > 0)
944+
{
945+
zoomIn();
946+
}
947+
else
948+
{
949+
zoomOut();
950+
}
951+
// Don't call superclass handler here
952+
// as wheel is normally used for moving scrollbars
940953
}
941954
else
942-
{
943-
zoomOut();
944-
}
945-
// Don't call superclass handler here
946-
// as wheel is normally used for moving scrollbars
955+
QGraphicsView::wheelEvent(event);
947956
}
948957

949958
void NetworkEditor::zoomIn()
@@ -979,6 +988,32 @@ int NetworkEditor::currentZoomPercentage() const
979988
return static_cast<int>(currentScale_ * 100);
980989
}
981990

991+
//static QGraphicsTextItem* zoomHelp = 0;
992+
993+
void NetworkEditor::keyPressEvent(QKeyEvent *event)
994+
{
995+
if (event->key() == Qt::Key_Shift)
996+
{
997+
//TODO
998+
//if (!zoomHelp)
999+
// zoomHelp = new QGraphicsTextItem("Network zoom enabled on scroll");
1000+
//scene()->addItem(zoomHelp);
1001+
//std::cout << "SHIFT IS ZOOM" << std::endl;
1002+
}
1003+
QGraphicsView::keyPressEvent(event);
1004+
}
1005+
1006+
void NetworkEditor::keyReleaseEvent(QKeyEvent *event)
1007+
{
1008+
if (event->key() == Qt::Key_Shift)
1009+
{
1010+
//TODO
1011+
//scene()->removeItem(zoomHelp);
1012+
//std::cout << "DONEZOOM" << std::endl;
1013+
}
1014+
QGraphicsView::keyPressEvent(event);
1015+
}
1016+
9821017
bool NetworkEditor::containsViewScene() const
9831018
{
9841019
return findFirstByName(scene_->items(), "ViewScene") != nullptr;

src/Interface/Application/NetworkEditor.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ namespace Gui {
162162
virtual void mouseMoveEvent(QMouseEvent *event) override;
163163
virtual void mouseReleaseEvent(QMouseEvent *event) override;
164164
virtual void wheelEvent(QWheelEvent* event) override;
165+
virtual void keyPressEvent(QKeyEvent *event) override;
166+
virtual void keyReleaseEvent(QKeyEvent *event) override;
165167

166168
public Q_SLOTS:
167169
void addModuleWidget(const std::string& name, SCIRun::Dataflow::Networks::ModuleHandle module, const SCIRun::Dataflow::Engine::ModuleCounter& count);

src/Interface/Application/Port.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void PortWidget::doMouseMove(Qt::MouseButtons buttons, const QPointF& pos)
234234

235235
void PortWidget::mouseReleaseEvent(QMouseEvent* event)
236236
{
237-
doMouseRelease(event->button(), event->pos());
237+
doMouseRelease(event->button(), event->pos(), event->modifiers());
238238
}
239239

240240
size_t PortWidget::getIndex() const
@@ -277,9 +277,13 @@ void PortWidget::cancelConnectionsInProgress()
277277
currentConnection_ = 0;
278278
}
279279

280-
void PortWidget::doMouseRelease(Qt::MouseButton button, const QPointF& pos)
280+
void PortWidget::doMouseRelease(Qt::MouseButton button, const QPointF& pos, Qt::KeyboardModifiers modifiers)
281281
{
282-
if (button == Qt::LeftButton)
282+
if (!isInput() && (button == Qt::MiddleButton || modifiers & Qt::ControlModifier))
283+
{
284+
DataInfoDialog::show(getPortDataDescriber(), "Port", moduleId_.id_ + "::" + portId_.toString());
285+
}
286+
else if (button == Qt::LeftButton)
283287
{
284288
toggleLight();
285289
update();
@@ -293,10 +297,6 @@ void PortWidget::doMouseRelease(Qt::MouseButton button, const QPointF& pos)
293297
{
294298
showMenu();
295299
}
296-
else if (button == Qt::MiddleButton && !isInput())
297-
{
298-
DataInfoDialog::show(getPortDataDescriber(), "Port", portId_.toString());
299-
}
300300
}
301301

302302
void PortWidget::makeConnection(const QPointF& pos)

src/Interface/Application/Port.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class PortWidget : public PortWidgetBase, public NeedsScenePositionProvider
119119

120120
void doMousePress(Qt::MouseButton button, const QPointF& pos);
121121
void doMouseMove(Qt::MouseButtons buttons, const QPointF& pos);
122-
void doMouseRelease(Qt::MouseButton button, const QPointF& pos);
122+
void doMouseRelease(Qt::MouseButton button, const QPointF& pos, Qt::KeyboardModifiers modifiers);
123123

124124
SCIRun::Dataflow::Networks::PortDataDescriber getPortDataDescriber() const { return portDataDescriber_; }
125125

src/Interface/Application/Preferences.ui

Lines changed: 45 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -25,86 +25,74 @@
2525
<property name="windowTitle">
2626
<string>Preferences</string>
2727
</property>
28-
<layout class="QVBoxLayout" name="verticalLayout">
29-
<item>
28+
<layout class="QGridLayout" name="gridLayout">
29+
<item row="0" column="0">
3030
<widget class="QToolBox" name="toolBox">
3131
<widget class="QWidget" name="toolBoxPage1">
3232
<property name="geometry">
3333
<rect>
3434
<x>0</x>
3535
<y>0</y>
36-
<width>482</width>
37-
<height>228</height>
36+
<width>476</width>
37+
<height>208</height>
3838
</rect>
3939
</property>
4040
<attribute name="label">
4141
<string>General</string>
4242
</attribute>
43-
<widget class="QCheckBox" name="saveBeforeExecuteCheckBox_">
44-
<property name="geometry">
45-
<rect>
46-
<x>30</x>
47-
<y>70</y>
48-
<width>151</width>
49-
<height>17</height>
50-
</rect>
51-
</property>
52-
<property name="text">
53-
<string>Auto-save before execute</string>
54-
</property>
55-
</widget>
43+
<layout class="QFormLayout" name="formLayout">
44+
<item row="0" column="0">
45+
<widget class="QCheckBox" name="saveBeforeExecuteCheckBox_">
46+
<property name="text">
47+
<string>Auto-save before execute</string>
48+
</property>
49+
</widget>
50+
</item>
51+
</layout>
5652
</widget>
5753
<widget class="QWidget" name="toolBoxPage2">
5854
<property name="geometry">
5955
<rect>
6056
<x>0</x>
6157
<y>0</y>
62-
<width>482</width>
63-
<height>228</height>
58+
<width>476</width>
59+
<height>208</height>
6460
</rect>
6561
</property>
6662
<attribute name="label">
6763
<string>Advanced</string>
6864
</attribute>
69-
<layout class="QFormLayout" name="formLayout_2">
65+
<layout class="QGridLayout" name="gridLayout_2">
7066
<item row="0" column="0">
71-
<layout class="QFormLayout" name="formLayout">
72-
<item row="0" column="0">
73-
<layout class="QHBoxLayout" name="horizontalLayout">
74-
<item>
75-
<widget class="QLabel" name="label">
76-
<property name="text">
77-
<string>Regression test data directory:</string>
78-
</property>
79-
</widget>
80-
</item>
81-
<item>
82-
<widget class="QLineEdit" name="regressionTestDataDirLineEdit_">
83-
<property name="readOnly">
84-
<bool>true</bool>
85-
</property>
86-
</widget>
87-
</item>
88-
<item>
89-
<widget class="QPushButton" name="regressionTestDataButton_">
90-
<property name="text">
91-
<string>Browse...</string>
92-
</property>
93-
</widget>
94-
</item>
95-
</layout>
96-
</item>
97-
<item row="1" column="0">
98-
<widget class="QCheckBox" name="moduleErrorDialogDisableCheckbox_">
99-
<property name="text">
100-
<string>Disable Module Error dialogs</string>
101-
</property>
102-
<property name="checked">
103-
<bool>false</bool>
104-
</property>
105-
</widget>
106-
</item>
107-
</layout>
67+
<widget class="QLabel" name="label">
68+
<property name="text">
69+
<string>Regression test data directory:</string>
70+
</property>
71+
</widget>
72+
</item>
73+
<item row="0" column="1">
74+
<widget class="QLineEdit" name="regressionTestDataDirLineEdit_">
75+
<property name="readOnly">
76+
<bool>true</bool>
77+
</property>
78+
</widget>
79+
</item>
80+
<item row="0" column="2">
81+
<widget class="QPushButton" name="regressionTestDataButton_">
82+
<property name="text">
83+
<string>Browse...</string>
84+
</property>
85+
</widget>
86+
</item>
87+
<item row="1" column="1" colspan="2">
88+
<widget class="QCheckBox" name="moduleErrorDialogDisableCheckbox_">
89+
<property name="text">
90+
<string>Disable Module Error dialogs</string>
91+
</property>
92+
<property name="checked">
93+
<bool>false</bool>
94+
</property>
95+
</widget>
10896
</item>
10997
</layout>
11098
</widget>

0 commit comments

Comments
 (0)