Skip to content

Commit 405c50c

Browse files
committed
Working on module size tweaking
1 parent 413efaf commit 405c50c

File tree

9 files changed

+208
-109
lines changed

9 files changed

+208
-109
lines changed

src/Interface/Application/DeveloperConsole.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ DeveloperConsole::DeveloperConsole(QWidget* parent /* = 0 */) : QDockWidget(pare
3939
connect(parallelExecutionRadioButton_, SIGNAL(clicked()), this, SLOT(executorButtonClicked()));
4040
connect(improvedParallelExecutionRadioButton_, SIGNAL(clicked()), this, SLOT(executorButtonClicked()));
4141
connect(globalPortCacheButton_, SIGNAL(stateChanged(int)), this, SLOT(globalPortCacheButtonClicked()));
42+
connect(moduleWidgetHeightSpinBox_, SIGNAL(valueChanged(int)), this, SIGNAL(moduleHeightAdjusted(int)));
43+
connect(moduleWidgetWidthSpinBox_, SIGNAL(valueChanged(int)), this, SIGNAL(moduleWidthAdjusted(int)));
4244
}
4345

4446
void DeveloperConsole::executorButtonClicked()

src/Interface/Application/DeveloperConsole.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public Q_SLOTS:
4848
Q_SIGNALS:
4949
void executorChosen(int type);
5050
void globalPortCachingChanged(bool enable);
51+
void moduleHeightAdjusted(int delta);
52+
void moduleWidthAdjusted(int delta);
5153
};
5254

5355
}

src/Interface/Application/DeveloperConsole.ui

Lines changed: 122 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@
77
<x>0</x>
88
<y>0</y>
99
<width>400</width>
10-
<height>658</height>
10+
<height>308</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
1414
<size>
1515
<width>400</width>
16-
<height>200</height>
16+
<height>308</height>
17+
</size>
18+
</property>
19+
<property name="maximumSize">
20+
<size>
21+
<width>400</width>
22+
<height>320</height>
1723
</size>
1824
</property>
1925
<property name="floating">
@@ -26,88 +32,121 @@
2632
<string>Developer Console</string>
2733
</property>
2834
<widget class="QWidget" name="dockWidgetContents">
29-
<widget class="QWidget" name="layoutWidget">
30-
<property name="geometry">
31-
<rect>
32-
<x>30</x>
33-
<y>10</y>
34-
<width>321</width>
35-
<height>163</height>
36-
</rect>
37-
</property>
38-
<layout class="QVBoxLayout" name="verticalLayout_2">
39-
<item>
40-
<widget class="QLabel" name="label">
41-
<property name="font">
42-
<font>
43-
<pointsize>11</pointsize>
44-
<weight>75</weight>
45-
<bold>true</bold>
46-
</font>
47-
</property>
48-
<property name="text">
49-
<string>EXPERIMENTAL FEATURES LIVE HERE.
35+
<layout class="QVBoxLayout" name="verticalLayout_2">
36+
<item>
37+
<widget class="QLabel" name="label">
38+
<property name="font">
39+
<font>
40+
<pointsize>11</pointsize>
41+
<weight>75</weight>
42+
<bold>true</bold>
43+
</font>
44+
</property>
45+
<property name="text">
46+
<string>EXPERIMENTAL FEATURES LIVE HERE.
5047
USE AT YOUR OWN RISK!</string>
51-
</property>
52-
<property name="alignment">
53-
<set>Qt::AlignCenter</set>
54-
</property>
55-
</widget>
56-
</item>
57-
<item>
58-
<widget class="QCheckBox" name="globalPortCacheButton_">
59-
<property name="enabled">
60-
<bool>false</bool>
61-
</property>
62-
<property name="text">
63-
<string>Port caching (turning off will clear all cached ports)</string>
64-
</property>
65-
<property name="checked">
66-
<bool>true</bool>
67-
</property>
68-
</widget>
69-
</item>
70-
<item>
71-
<widget class="QGroupBox" name="schedulerBox_">
72-
<property name="title">
73-
<string>Scheduler/Executor</string>
74-
</property>
75-
<layout class="QVBoxLayout" name="verticalLayout">
76-
<item>
77-
<widget class="QRadioButton" name="serialExecutionRadioButton_">
78-
<property name="text">
79-
<string>Serial</string>
80-
</property>
81-
<property name="checked">
82-
<bool>false</bool>
83-
</property>
84-
</widget>
85-
</item>
86-
<item>
87-
<widget class="QRadioButton" name="parallelExecutionRadioButton_">
88-
<property name="text">
89-
<string>Parallel</string>
90-
</property>
91-
<property name="checked">
92-
<bool>false</bool>
93-
</property>
94-
</widget>
95-
</item>
96-
<item>
97-
<widget class="QRadioButton" name="improvedParallelExecutionRadioButton_">
98-
<property name="text">
99-
<string>Improved parallel</string>
100-
</property>
101-
<property name="checked">
102-
<bool>true</bool>
103-
</property>
104-
</widget>
105-
</item>
106-
</layout>
107-
</widget>
108-
</item>
109-
</layout>
110-
</widget>
48+
</property>
49+
<property name="alignment">
50+
<set>Qt::AlignCenter</set>
51+
</property>
52+
</widget>
53+
</item>
54+
<item>
55+
<widget class="QCheckBox" name="globalPortCacheButton_">
56+
<property name="enabled">
57+
<bool>false</bool>
58+
</property>
59+
<property name="text">
60+
<string>Port caching (turning off will clear all cached ports)</string>
61+
</property>
62+
<property name="checked">
63+
<bool>true</bool>
64+
</property>
65+
</widget>
66+
</item>
67+
<item>
68+
<widget class="QGroupBox" name="schedulerBox_">
69+
<property name="title">
70+
<string>Scheduler/Executor</string>
71+
</property>
72+
<layout class="QVBoxLayout" name="verticalLayout">
73+
<item>
74+
<widget class="QRadioButton" name="serialExecutionRadioButton_">
75+
<property name="text">
76+
<string>Serial</string>
77+
</property>
78+
<property name="checked">
79+
<bool>false</bool>
80+
</property>
81+
</widget>
82+
</item>
83+
<item>
84+
<widget class="QRadioButton" name="parallelExecutionRadioButton_">
85+
<property name="text">
86+
<string>Parallel</string>
87+
</property>
88+
<property name="checked">
89+
<bool>false</bool>
90+
</property>
91+
</widget>
92+
</item>
93+
<item>
94+
<widget class="QRadioButton" name="improvedParallelExecutionRadioButton_">
95+
<property name="text">
96+
<string>Improved parallel</string>
97+
</property>
98+
<property name="checked">
99+
<bool>true</bool>
100+
</property>
101+
</widget>
102+
</item>
103+
</layout>
104+
</widget>
105+
</item>
106+
<item>
107+
<widget class="QGroupBox" name="groupBox">
108+
<property name="title">
109+
<string>Adjust Module Widget Size</string>
110+
</property>
111+
<layout class="QGridLayout" name="gridLayout">
112+
<item row="1" column="2">
113+
<widget class="QSpinBox" name="moduleWidgetWidthSpinBox_">
114+
<property name="minimum">
115+
<number>-500</number>
116+
</property>
117+
<property name="maximum">
118+
<number>500</number>
119+
</property>
120+
</widget>
121+
</item>
122+
<item row="0" column="2">
123+
<widget class="QSpinBox" name="moduleWidgetHeightSpinBox_">
124+
<property name="minimum">
125+
<number>-500</number>
126+
</property>
127+
<property name="maximum">
128+
<number>500</number>
129+
</property>
130+
</widget>
131+
</item>
132+
<item row="1" column="0">
133+
<widget class="QLabel" name="label_3">
134+
<property name="text">
135+
<string>Width Delta</string>
136+
</property>
137+
</widget>
138+
</item>
139+
<item row="0" column="0">
140+
<widget class="QLabel" name="label_2">
141+
<property name="text">
142+
<string>Height Delta</string>
143+
</property>
144+
</widget>
145+
</item>
146+
</layout>
147+
</widget>
148+
</item>
149+
</layout>
111150
</widget>
112151
</widget>
113152
<resources/>

src/Interface/Application/ModuleProxyWidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace SCIRun
6666
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
6767
void hoverEnterEvent(QGraphicsSceneHoverEvent* event) override;
6868
void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) override;
69-
QVariant itemChange(GraphicsItemChange change, const QVariant& value);
69+
QVariant itemChange(GraphicsItemChange change, const QVariant& value) override;
7070
virtual void setNoteGraphicsContext() override;
7171
private Q_SLOTS:
7272
void updateNote(const Note& note);

src/Interface/Application/ModuleWidget.cc

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <Interface/Application/Connection.h>
4040
#include <Interface/Application/Port.h>
4141
#include <Interface/Application/PositionProvider.h>
42-
#include <Interface/Application/GuiLogger.h>
4342
#include <Interface/Application/ModuleLogWindow.h>
4443
#include <Interface/Application/ClosestPortFinder.h>
4544
#include <Interface/Application/Utility.h>
@@ -210,24 +209,21 @@ namespace
210209
}
211210
}
212211

213-
namespace
214-
{
215212
#ifdef WIN32
216-
const int moduleWidthThreshold = 110;
217-
const int extraModuleWidth = 5;
218-
const int extraWidthThreshold = 5;
219-
const int smushFactor = 15;
220-
const int titleFontSize = 8;
221-
const int widgetHeightAdjust = -20;
213+
const int ModuleWidgetDisplayBase::moduleWidthThreshold = 110;
214+
const int ModuleWidgetDisplayBase::extraModuleWidth = 5;
215+
const int ModuleWidgetDisplayBase::extraWidthThreshold = 5;
216+
const int ModuleWidgetDisplayBase::smushFactor = 15;
217+
const int ModuleWidgetDisplayBase::titleFontSize = 8;
218+
const int ModuleWidgetDisplayBase::widgetHeightAdjust = -20;
222219
#else
223-
const int moduleWidthThreshold = 80;
224-
const int extraModuleWidth = 5;
225-
const int extraWidthThreshold = 5;
226-
const int smushFactor = 15;
227-
const int titleFontSize = 12;
228-
const int widgetHeightAdjust = 1;
220+
const int ModuleWidgetDisplayBase::moduleWidthThreshold = 80;
221+
const int ModuleWidgetDisplayBase::extraModuleWidth = 5;
222+
const int ModuleWidgetDisplayBase::extraWidthThreshold = 5;
223+
const int ModuleWidgetDisplayBase::smushFactor = 15;
224+
const int ModuleWidgetDisplayBase::titleFontSize = 12;
225+
const int ModuleWidgetDisplayBase::widgetHeightAdjust = 1;
229226
#endif
230-
}
231227

232228
class ModuleWidgetDisplay : public Ui::Module, public ModuleWidgetDisplayBase
233229
{
@@ -514,6 +510,7 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, ModuleHandle
514510
connectExecuteEnds(boost::bind(&ModuleWidget::executeEnds, this));
515511
connect(this, SIGNAL(executeEnds()), this, SLOT(changeExecuteButtonToPlay()));
516512
connect(this, SIGNAL(signalExecuteButtonIconChangeToStop()), this, SLOT(changeExecuteButtonToStop()));
513+
qDebug() << width() << height();
517514
}
518515

519516
int ModuleWidget::buildDisplay(ModuleWidgetDisplayBase* display, const QString& name)
@@ -569,22 +566,37 @@ void ModuleWidget::resizeBasedOnModuleName(ModuleWidgetDisplayBase* display, int
569566
int pixelWidth = display->getTitleWidth();
570567
//std::cout << titleLabel_->text().toStdString() << std::endl;
571568
//std::cout << "\tPixelwidth = " << pixelWidth << std::endl;
572-
int extraWidth = pixelWidth - moduleWidthThreshold;
569+
int extraWidth = pixelWidth - ModuleWidgetDisplayBase::moduleWidthThreshold;
573570
//std::cout << "\textraWidth = " << extraWidth << std::endl;
574-
if (extraWidth > extraWidthThreshold)
571+
if (extraWidth > ModuleWidgetDisplayBase::extraWidthThreshold)
575572
{
576573
//std::cout << "\tGROWING MODULE Current width: " << width() << std::endl;
577-
frame->resize(frame->width() + extraWidth + extraModuleWidth, frame->height());
574+
frame->resize(frame->width() + extraWidth + ModuleWidgetDisplayBase::extraModuleWidth, frame->height());
578575
//std::cout << "\tNew width: " << width() << std::endl;
579576
}
580577
else
581578
{
582579
//std::cout << "\tSHRINKING MODULE Current width: " << width() << std::endl;
583-
frame->resize(frame->width() - smushFactor, frame->height());
580+
frame->resize(frame->width() - ModuleWidgetDisplayBase::smushFactor, frame->height());
584581
//std::cout << "\tNew width: " << width() << std::endl;
585582
}
586583
display->adjustLayout(frame->layout());
587-
frame->resize(frame->width(), frame->height() + widgetHeightAdjust);
584+
frame->resize(frame->width(), frame->height() + ModuleWidgetDisplayBase::widgetHeightAdjust);
585+
originalSize_ = size();
586+
}
587+
588+
void ModuleWidget::adjustHeight(int delta)
589+
{
590+
auto frame = widget(fullIndex_);
591+
frame->setFixedHeight(originalSize_.height() + delta);
592+
resize(currentWidget()->size());
593+
}
594+
595+
void ModuleWidget::adjustWidth(int delta)
596+
{
597+
auto frame = widget(fullIndex_);
598+
frame->setFixedWidth(originalSize_.width() + delta);
599+
resize(currentWidget()->size());
588600
}
589601

590602
void ModuleWidget::setupDisplayConnections(ModuleWidgetDisplayBase* display)

src/Interface/Application/ModuleWidget.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ class ModuleWidgetDisplayBase
8080
virtual int getTitleWidth() const = 0;
8181

8282
virtual void adjustLayout(QLayout* layout) = 0;
83+
84+
//The following have platform-specific values
85+
static const int moduleWidthThreshold;
86+
static const int extraModuleWidth;
87+
static const int extraWidthThreshold;
88+
static const int smushFactor;
89+
static const int titleFontSize;
90+
static const int widgetHeightAdjust;
8391
};
8492

8593
typedef boost::shared_ptr<ModuleWidgetDisplayBase> ModuleWidgetDisplayPtr;
@@ -133,9 +141,9 @@ class ModuleWidget : public QStackedWidget,
133141
int portSpacing() const;
134142
void setPortSpacing(bool highlighted);
135143

136-
virtual boost::signals2::connection connectExecuteBegins(const SCIRun::Dataflow::Networks::ExecuteBeginsSignalType::slot_type& subscriber) override;
137-
virtual boost::signals2::connection connectExecuteEnds(const SCIRun::Dataflow::Networks::ExecuteEndsSignalType::slot_type& subscriber) override;
138-
virtual boost::signals2::connection connectErrorListener(const SCIRun::Dataflow::Networks::ErrorSignalType::slot_type& subscriber) override;
144+
virtual boost::signals2::connection connectExecuteBegins(const SCIRun::Dataflow::Networks::ExecuteBeginsSignalType::slot_type& subscriber) override final;
145+
virtual boost::signals2::connection connectExecuteEnds(const SCIRun::Dataflow::Networks::ExecuteEndsSignalType::slot_type& subscriber) override final;
146+
virtual boost::signals2::connection connectErrorListener(const SCIRun::Dataflow::Networks::ErrorSignalType::slot_type& subscriber) override final;
139147

140148
void updateNoteFromFile(const Note& note);
141149

@@ -169,6 +177,8 @@ public Q_SLOTS:
169177
void updateMetadata(bool active);
170178
void updatePortSpacing(bool highlighted);
171179
void replaceMe();
180+
void adjustHeight(int delta);
181+
void adjustWidth(int delta);
172182
static void setGlobalMiniMode(bool mini);
173183
Q_SIGNALS:
174184
void removeModule(const SCIRun::Dataflow::Networks::ModuleId& moduleId);
@@ -223,7 +233,7 @@ private Q_SLOTS:
223233

224234
SCIRun::Dataflow::Networks::ModuleHandle theModule_;
225235
std::atomic<int> previousModuleState_;
226-
236+
QSize originalSize_;
227237
void addPorts(int index);
228238
void createPorts(const SCIRun::Dataflow::Networks::ModuleInfoProvider& moduleInfoProvider);
229239
void createInputPorts(const SCIRun::Dataflow::Networks::ModuleInfoProvider& moduleInfoProvider);

0 commit comments

Comments
 (0)