Skip to content

Commit fecada8

Browse files
committed
Merge branch 'master' into issues_M
2 parents 8e32b91 + 442734b commit fecada8

File tree

4 files changed

+199
-35
lines changed

4 files changed

+199
-35
lines changed

src/Interface/Application/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ SET(Interface_Application_HEADERS
9393
SET(Interface_Application_FORMS
9494
DeveloperConsole.ui
9595
Module.ui
96+
ModuleMini.ui
9697
ModuleLogWindow.ui
9798
NoteEditor.ui
9899
Preferences.ui
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>ModuleMini</class>
4+
<widget class="QFrame" name="ModuleMini">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>159</width>
10+
<height>33</height>
11+
</rect>
12+
</property>
13+
<property name="sizePolicy">
14+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
15+
<horstretch>0</horstretch>
16+
<verstretch>0</verstretch>
17+
</sizepolicy>
18+
</property>
19+
<property name="minimumSize">
20+
<size>
21+
<width>150</width>
22+
<height>30</height>
23+
</size>
24+
</property>
25+
<property name="windowTitle">
26+
<string>Frame</string>
27+
</property>
28+
<property name="autoFillBackground">
29+
<bool>false</bool>
30+
</property>
31+
<property name="frameShape">
32+
<enum>QFrame::NoFrame</enum>
33+
</property>
34+
<property name="frameShadow">
35+
<enum>QFrame::Raised</enum>
36+
</property>
37+
<property name="lineWidth">
38+
<number>2</number>
39+
</property>
40+
<property name="midLineWidth">
41+
<number>0</number>
42+
</property>
43+
<layout class="QVBoxLayout" name="verticalLayout">
44+
<property name="margin">
45+
<number>1</number>
46+
</property>
47+
<item>
48+
<layout class="QGridLayout" name="gridLayout">
49+
<item row="0" column="0">
50+
<widget class="QPushButton" name="optionsButton_">
51+
<property name="sizePolicy">
52+
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
53+
<horstretch>0</horstretch>
54+
<verstretch>0</verstretch>
55+
</sizepolicy>
56+
</property>
57+
<property name="minimumSize">
58+
<size>
59+
<width>50</width>
60+
<height>23</height>
61+
</size>
62+
</property>
63+
<property name="maximumSize">
64+
<size>
65+
<width>200</width>
66+
<height>23</height>
67+
</size>
68+
</property>
69+
<property name="toolTip">
70+
<string>Module-specific options</string>
71+
</property>
72+
<property name="whatsThis">
73+
<string>Click this button to open the module's options dialog.</string>
74+
</property>
75+
<property name="text">
76+
<string>ModuleTitle</string>
77+
</property>
78+
</widget>
79+
</item>
80+
<item row="0" column="1">
81+
<widget class="QProgressBar" name="progressBar_">
82+
<property name="sizePolicy">
83+
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
84+
<horstretch>0</horstretch>
85+
<verstretch>0</verstretch>
86+
</sizepolicy>
87+
</property>
88+
<property name="minimumSize">
89+
<size>
90+
<width>30</width>
91+
<height>20</height>
92+
</size>
93+
</property>
94+
<property name="maximumSize">
95+
<size>
96+
<width>75</width>
97+
<height>20</height>
98+
</size>
99+
</property>
100+
<property name="whatsThis">
101+
<string>Module execution progress bar.</string>
102+
</property>
103+
<property name="value">
104+
<number>24</number>
105+
</property>
106+
<property name="alignment">
107+
<set>Qt::AlignCenter</set>
108+
</property>
109+
<property name="orientation">
110+
<enum>Qt::Horizontal</enum>
111+
</property>
112+
<property name="textDirection">
113+
<enum>QProgressBar::TopToBottom</enum>
114+
</property>
115+
</widget>
116+
</item>
117+
<item row="0" column="2">
118+
<widget class="QToolButton" name="expandToolButton_">
119+
<property name="minimumSize">
120+
<size>
121+
<width>15</width>
122+
<height>15</height>
123+
</size>
124+
</property>
125+
<property name="maximumSize">
126+
<size>
127+
<width>15</width>
128+
<height>15</height>
129+
</size>
130+
</property>
131+
<property name="text">
132+
<string>+</string>
133+
</property>
134+
</widget>
135+
</item>
136+
</layout>
137+
</item>
138+
</layout>
139+
</widget>
140+
<resources>
141+
<include location="scirun5.qrc"/>
142+
</resources>
143+
<connections/>
144+
</ui>

src/Interface/Application/ModuleWidget.cc

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace Gui {
8686
<< new QAction("Edit Notes...", parent)
8787
<< new QAction("Duplicate", parent)
8888
<< disabled(new QAction("Replace With", parent))
89+
<< disabled(new QAction("Collapse", parent))
8990
<< new QAction("Show Log", parent)
9091
<< disabled(new QAction("Make Sub-Network", parent))
9192
<< separatorAction(parent)
@@ -229,6 +230,7 @@ namespace
229230
ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataflow::Networks::ModuleHandle theModule, boost::shared_ptr<SCIRun::Gui::DialogErrorControl> dialogErrorControl,
230231
QWidget* parent /* = 0 */)
231232
: QFrame(parent), HasNotes(theModule->get_id(), true),
233+
displayImpl_(new ModuleWidgetDisplay),
232234
ports_(new PortWidgetManager),
233235
deletedFromGui_(true),
234236
colorLocked_(false),
@@ -243,35 +245,35 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataf
243245
deleting_(false),
244246
defaultBackgroundColor_(SCIRunMainWindow::Instance()->newInterface() ? moduleRGBA(99,99,104) : moduleRGBA(192,192,192))
245247
{
246-
setupUi(this);
248+
displayImpl_->setupUi(this);
247249

248-
titleLabel_->setFont(QFont("Helvetica", titleFontSize, QFont::Bold));
249-
titleLabel_->setText(name);
250+
displayImpl_->titleLabel_->setFont(QFont("Helvetica", titleFontSize, QFont::Bold));
251+
displayImpl_->titleLabel_->setText(name);
250252

251253
//TODO: ultra ugly. no other place for this code right now.
252254
//TODO: to be handled in issue #212
253255
if (name == "ViewScene")
254256
{
255-
optionsButton_->setText("VIEW");
256-
optionsButton_->setToolTip("View renderer output");
257-
optionsButton_->resize(100, optionsButton_->height());
258-
executePushButton_->hide();
259-
progressBar_->setVisible(false);
257+
displayImpl_->optionsButton_->setText("VIEW");
258+
displayImpl_->optionsButton_->setToolTip("View renderer output");
259+
displayImpl_->optionsButton_->resize(100, displayImpl_->optionsButton_->height());
260+
displayImpl_->executePushButton_->hide();
261+
displayImpl_->progressBar_->setVisible(false);
260262
}
261-
progressBar_->setMaximum(100);
262-
progressBar_->setMinimum(0);
263-
progressBar_->setValue(0);
263+
displayImpl_->progressBar_->setMaximum(100);
264+
displayImpl_->progressBar_->setMinimum(0);
265+
displayImpl_->progressBar_->setValue(0);
264266

265267
makeOptionsDialog();
266268
addPortLayouts();
267269
addPorts(*theModule_);
268-
optionsButton_->setVisible(theModule_->has_ui());
270+
displayImpl_->optionsButton_->setVisible(theModule_->has_ui());
269271

270-
executePushButton_->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));
271-
connect(executePushButton_, SIGNAL(clicked()), this, SLOT(executeButtonPushed()));
272-
addWidgetToExecutionDisableList(executePushButton_);
272+
displayImpl_->executePushButton_->setIcon(QApplication::style()->standardIcon(QStyle::SP_MediaPlay));
273+
connect(displayImpl_->executePushButton_, SIGNAL(clicked()), this, SLOT(executeButtonPushed()));
274+
addWidgetToExecutionDisableList(displayImpl_->executePushButton_);
273275

274-
int pixelWidth = titleLabel_->fontMetrics().boundingRect(titleLabel_->text()).width();
276+
int pixelWidth = displayImpl_->titleLabel_->fontMetrics().boundingRect(displayImpl_->titleLabel_->text()).width();
275277
//std::cout << titleLabel_->text().toStdString() << std::endl;
276278
//std::cout << "\tPixelwidth = " << pixelWidth << std::endl;
277279
int extraWidth = pixelWidth - moduleWidthThreshold;
@@ -291,26 +293,26 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataf
291293

292294
//TODO: centralize platform-dependent code
293295
#ifdef WIN32
294-
layout()->removeItem(verticalSpacer_Mac);
295-
layout()->removeItem(horizontalSpacer_Mac1);
296-
layout()->removeItem(horizontalSpacer_Mac2);
296+
layout()->removeItem(displayImpl_->verticalSpacer_Mac);
297+
layout()->removeItem(displayImpl_->horizontalSpacer_Mac1);
298+
layout()->removeItem(displayImpl_->horizontalSpacer_Mac2);
297299
#endif
298300
resize(width(), height() + widgetHeightAdjust);
299301

300-
connect(optionsButton_, SIGNAL(clicked()), this, SLOT(toggleOptionsDialog()));
302+
connect(displayImpl_->optionsButton_, SIGNAL(clicked()), this, SLOT(toggleOptionsDialog()));
301303

302-
connect(helpButton_, SIGNAL(clicked()), this, SLOT(launchDocumentation()));
304+
connect(displayImpl_->helpButton_, SIGNAL(clicked()), this, SLOT(launchDocumentation()));
303305
connect(this, SIGNAL(backgroundColorUpdated(const QString&)), this, SLOT(updateBackgroundColor(const QString&)));
304306
theModule_->connectExecutionStateChanged(boost::bind(&ModuleWidget::moduleStateUpdated, this, _1));
305307
connect(this, SIGNAL(moduleStateUpdated(int)), this, SLOT(updateBackgroundColorForModuleState(int)));
306308

307309
setupModuleActions();
308310

309-
progressBar_->setTextVisible(false);
311+
displayImpl_->progressBar_->setTextVisible(false);
310312

311313
logWindow_ = new ModuleLogWindow(QString::fromStdString(moduleId_), dialogErrorControl_, SCIRunMainWindow::Instance());
312-
connect(logButton2_, SIGNAL(clicked()), logWindow_, SLOT(show()));
313-
connect(logButton2_, SIGNAL(clicked()), logWindow_, SLOT(raise()));
314+
connect(displayImpl_->logButton2_, SIGNAL(clicked()), logWindow_, SLOT(show()));
315+
connect(displayImpl_->logButton2_, SIGNAL(clicked()), logWindow_, SLOT(raise()));
314316
connect(actionsMenu_->getAction("Show Log"), SIGNAL(triggered()), logWindow_, SLOT(show()));
315317
connect(actionsMenu_->getAction("Show Log"), SIGNAL(triggered()), logWindow_, SLOT(raise()));
316318
connect(actionsMenu_->getAction("Execute"), SIGNAL(triggered()), this, SLOT(executeButtonPushed()));
@@ -337,20 +339,20 @@ ModuleWidget::ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataf
337339

338340
void ModuleWidget::setLogButtonColor(const QColor& color)
339341
{
340-
logButton2_->setStyleSheet(
342+
displayImpl_->logButton2_->setStyleSheet(
341343
QString("* { background-color: %1 }")
342344
.arg(moduleRGBA(color.red(), color.green(), color.blue())));
343345
}
344346

345347
void ModuleWidget::resetLogButtonColor()
346348
{
347-
logButton2_->setStyleSheet("");
349+
displayImpl_->logButton2_->setStyleSheet("");
348350
}
349351

350352
void ModuleWidget::resetProgressBar()
351353
{
352-
progressBar_->setValue(0);
353-
progressBar_->setTextVisible(false);
354+
displayImpl_->progressBar_->setValue(0);
355+
displayImpl_->progressBar_->setTextVisible(false);
354356
}
355357

356358
size_t ModuleWidget::numInputPorts() const { return ports().numInputPorts(); }
@@ -360,14 +362,15 @@ void ModuleWidget::setupModuleActions()
360362
{
361363
actionsMenu_.reset(new ModuleActionsMenu(this, moduleId_));
362364
addWidgetToExecutionDisableList(actionsMenu_->getAction("Execute"));
363-
moduleActionButton_->setMenu(actionsMenu_->getMenu());
365+
displayImpl_->moduleActionButton_->setMenu(actionsMenu_->getMenu());
364366

365367
auto replaceWith = actionsMenu_->getAction("Replace With");
366368
auto menu = new QMenu(this);
367369
replaceWith->setMenu(menu);
368370
fillReplaceWithMenu();
369371
connect(this, SIGNAL(connectionAdded(const SCIRun::Dataflow::Networks::ConnectionDescription&)), this, SLOT(fillReplaceWithMenu()));
370372
connect(this, SIGNAL(connectionDeleted(const SCIRun::Dataflow::Networks::ConnectionId&)), this, SLOT(fillReplaceWithMenu()));
373+
displayImpl_->moduleActionButton_->setMenu(actionsMenu_->getMenu());
371374
}
372375

373376
void ModuleWidget::fillReplaceWithMenu()
@@ -592,7 +595,7 @@ void ModuleWidget::printPortPositions() const
592595

593596
ModuleWidget::~ModuleWidget()
594597
{
595-
removeWidgetFromExecutionDisableList(executePushButton_);
598+
removeWidgetFromExecutionDisableList(displayImpl_->executePushButton_);
596599
removeWidgetFromExecutionDisableList(actionsMenu_->getAction("Execute"));
597600
if (dialog_)
598601
removeWidgetFromExecutionDisableList(dialog_->getExecuteAction());
@@ -626,6 +629,7 @@ ModuleWidget::~ModuleWidget()
626629

627630
Q_EMIT removeModule(ModuleId(moduleId_));
628631
}
632+
delete displayImpl_;
629633
}
630634

631635
void ModuleWidget::trackConnections()
@@ -795,22 +799,22 @@ void ModuleWidget::toggleOptionsDialog()
795799
void ModuleWidget::colorOptionsButton(bool visible)
796800
{
797801
QString styleSheet = visible ? "background-color: rgb(0,0,220); color: white;" : "";
798-
optionsButton_->setStyleSheet(styleSheet);
802+
displayImpl_->optionsButton_->setStyleSheet(styleSheet);
799803
}
800804

801805
void ModuleWidget::updateProgressBar(double percent)
802806
{
803-
progressBar_->setValue(percent * progressBar_->maximum());
807+
displayImpl_->progressBar_->setValue(percent * displayImpl_->progressBar_->maximum());
804808

805809
//TODO: make this configurable
806810
//progressBar_->setTextVisible(true);
807811
updateModuleTime();
808-
progressBar_->setToolTip(progressBar_->text());
812+
displayImpl_->progressBar_->setToolTip(displayImpl_->progressBar_->text());
809813
}
810814

811815
void ModuleWidget::updateModuleTime()
812816
{
813-
progressBar_->setFormat(QString("%1 s : %p%").arg(timer_.elapsed()));
817+
displayImpl_->progressBar_->setFormat(QString("%1 s : %p%").arg(timer_.elapsed()));
814818
}
815819

816820
void ModuleWidget::launchDocumentation()

src/Interface/Application/ModuleWidget.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define INTERFACE_APPLICATION_MODULEWIDGET_H
3131

3232
#include "ui_Module.h"
33+
#include "ui_ModuleMini.h"
3334
#include <boost/shared_ptr.hpp>
3435
#include <boost/scoped_ptr.hpp>
3536
#include <boost/timer.hpp>
@@ -57,8 +58,20 @@ class NetworkEditor;
5758
class PortWidgetManager;
5859
class DialogErrorControl;
5960

61+
62+
class ModuleWidgetDisplayBase
63+
{
64+
//TODO: abstract buttons, etc
65+
};
66+
67+
class ModuleWidgetDisplay : public Ui::Module, public ModuleWidgetDisplayBase
68+
{};
69+
70+
class ModuleWidgetDisplayMini : public Ui::ModuleMini, public ModuleWidgetDisplayBase
71+
{};
72+
6073
class ModuleWidget : public QFrame,
61-
public SCIRun::Dataflow::Networks::ExecutableObject, public Ui::Module, public HasNotes
74+
public SCIRun::Dataflow::Networks::ExecutableObject, /*public Ui::Module,*/ public HasNotes
6275
{
6376
Q_OBJECT
6477

@@ -142,6 +155,8 @@ private Q_SLOTS:
142155
void replaceModuleWith();
143156
void updateDialogWithPortCount();
144157
private:
158+
//TODO: change to ModuleWidgetDisplayBase*
159+
ModuleWidgetDisplay* displayImpl_;
145160
boost::shared_ptr<PortWidgetManager> ports_;
146161
boost::timer timer_;
147162
bool deletedFromGui_, colorLocked_;

0 commit comments

Comments
 (0)