@@ -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
229230ModuleWidget::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
338340void 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
345347void ModuleWidget::resetLogButtonColor ()
346348{
347- logButton2_->setStyleSheet (" " );
349+ displayImpl_-> logButton2_ ->setStyleSheet (" " );
348350}
349351
350352void ModuleWidget::resetProgressBar ()
351353{
352- progressBar_->setValue (0 );
353- progressBar_->setTextVisible (false );
354+ displayImpl_-> progressBar_ ->setValue (0 );
355+ displayImpl_-> progressBar_ ->setTextVisible (false );
354356}
355357
356358size_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
373376void ModuleWidget::fillReplaceWithMenu ()
@@ -592,7 +595,7 @@ void ModuleWidget::printPortPositions() const
592595
593596ModuleWidget::~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
631635void ModuleWidget::trackConnections ()
@@ -795,22 +799,22 @@ void ModuleWidget::toggleOptionsDialog()
795799void 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
801805void 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
811815void 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
816820void ModuleWidget::launchDocumentation ()
0 commit comments