Skip to content

Commit c70fbf2

Browse files
committed
Adjust dialog title when module selected in editor
1 parent 04e4b94 commit c70fbf2

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

src/Interface/Application/ModuleWidget.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,11 +635,13 @@ void ModuleWidget::updateBackgroundColor(const QString& color)
635635
void ModuleWidget::setColorSelected()
636636
{
637637
updateBackgroundColor(moduleRGBA(0,255,255));
638+
Q_EMIT moduleSelected(true);
638639
}
639640

640641
void ModuleWidget::setColorUnselected()
641642
{
642643
updateBackgroundColor(defaultBackgroundColor_);
644+
Q_EMIT moduleSelected(false);
643645
}
644646

645647
boost::shared_ptr<ModuleDialogFactory> ModuleWidget::dialogFactory_;
@@ -658,9 +660,11 @@ void ModuleWidget::makeOptionsDialog()
658660
addWidgetToExecutionDisableList(dialog_->getExecuteAction());
659661
connect(dialog_, SIGNAL(executeActionTriggered()), this, SLOT(executeButtonPushed()));
660662
connect(this, SIGNAL(moduleExecuted()), dialog_, SLOT(moduleExecuted()));
663+
connect(this, SIGNAL(moduleSelected(bool)), dialog_, SLOT(moduleSelected(bool)));
661664
dockable_ = new QDockWidget(QString::fromStdString(moduleId_), 0);
662665
dockable_->setObjectName(dialog_->windowTitle());
663666
dockable_->setWidget(dialog_);
667+
dialog_->setDockable(dockable_);
664668
dockable_->setMinimumSize(dialog_->minimumSize());
665669
dockable_->setAllowedAreas(Qt::RightDockWidgetArea);
666670
dockable_->setAutoFillBackground(true);

src/Interface/Application/ModuleWidget.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ class OutputPortWidget;
5555
class PositionProvider;
5656
class NetworkEditor;
5757
class PortWidgetManager;
58-
class DialogErrorControl;
58+
class DialogErrorControl;
5959

60-
class ModuleWidget : public QFrame,
60+
class ModuleWidget : public QFrame,
6161
public SCIRun::Dataflow::Networks::ExecutableObject, public Ui::Module, public HasNotes
6262
{
6363
Q_OBJECT
64-
64+
6565
public:
6666
ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataflow::Networks::ModuleHandle theModule, boost::shared_ptr<DialogErrorControl> dialogErrorControl,
6767
QWidget* parent = 0);
@@ -82,7 +82,7 @@ class ModuleWidget : public QFrame,
8282
//TODO: initialize in a new class
8383
static boost::shared_ptr<class ConnectionFactory> connectionFactory_;
8484
static boost::shared_ptr<class ClosestPortFinder> closestPortFinder_;
85-
85+
8686
void setColorSelected();
8787
void setColorUnselected();
8888

@@ -131,6 +131,7 @@ public Q_SLOTS:
131131
void dynamicPortChanged();
132132
void noteChanged();
133133
void moduleStateUpdated(int state);
134+
void moduleSelected(bool selected);
134135
private Q_SLOTS:
135136
void updateBackgroundColorForModuleState(int moduleState);
136137
void updateBackgroundColor(const QString& color);
@@ -157,7 +158,7 @@ private Q_SLOTS:
157158
boost::scoped_ptr<class ModuleActionsMenu> actionsMenu_;
158159

159160
static boost::shared_ptr<class ModuleDialogFactory> dialogFactory_;
160-
boost::shared_ptr<DialogErrorControl> dialogErrorControl_;
161+
boost::shared_ptr<DialogErrorControl> dialogErrorControl_;
161162

162163
void addPortLayouts();
163164
void addInputPortsToLayout();

src/Interface/Modules/Base/ModuleDialogGeneric.cc

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ using namespace SCIRun::Core::Algorithms;
3838
ModuleDialogGeneric::ModuleDialogGeneric(SCIRun::Dataflow::Networks::ModuleStateHandle state, QWidget* parent) : QDialog(parent),
3939
state_(state),
4040
pulling_(false),
41-
executeAction_(0)
41+
executeAction_(0),
42+
dock_(0)
4243
{
4344
setModal(false);
4445

@@ -56,6 +57,13 @@ ModuleDialogGeneric::~ModuleDialogGeneric()
5657
{
5758
}
5859

60+
void ModuleDialogGeneric::updateWindowTitle(const QString& title)
61+
{
62+
setWindowTitle(title);
63+
if (dock_)
64+
dock_->setWindowTitle(title);
65+
}
66+
5967
void ModuleDialogGeneric::fixSize()
6068
{
6169
if (minimumWidth() > 0 && minimumHeight() > 0)
@@ -74,7 +82,7 @@ void ModuleDialogGeneric::createExecuteAction()
7482
connect(executeAction_, SIGNAL(triggered()), this, SIGNAL(executeActionTriggered()));
7583
}
7684

77-
void ModuleDialogGeneric::contextMenuEvent(QContextMenuEvent* e)
85+
void ModuleDialogGeneric::contextMenuEvent(QContextMenuEvent* e)
7886
{
7987
QMenu menu(this);
8088
menu.addAction(executeAction_);
@@ -95,6 +103,21 @@ void ModuleDialogGeneric::pull_newVersionToReplaceOld()
95103
wsm->pull();
96104
}
97105

106+
void ModuleDialogGeneric::moduleSelected(bool selected)
107+
{
108+
if (selected)
109+
{
110+
windowTitle_ = windowTitle();
111+
updateWindowTitle("* " + windowTitle_ + " *");
112+
//setWindowOpacity(0.5);
113+
}
114+
else
115+
{
116+
updateWindowTitle(windowTitle_);
117+
//setWindowOpacity(1);
118+
}
119+
}
120+
98121
class ComboBoxSlotManager : public WidgetSlotManager
99122
{
100123
public:

src/Interface/Modules/Base/ModuleDialogGeneric.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ namespace Gui {
5050
virtual ~ModuleDialogGeneric();
5151
bool isPulling() const { return pulling_; } //yuck
5252
QAction* getExecuteAction() { return executeAction_; }
53+
void setDockable(QDockWidget* dock) { dock_ = dock; } // to enable title changes
54+
void updateWindowTitle(const QString& title);
5355

5456
//TODO: input state hookup?
5557
//yeah: eventually replace int with generic dialog state object, but needs to be two-way (set/get)
@@ -60,6 +62,7 @@ namespace Gui {
6062
//need a better name: read/updateUI
6163
virtual void pull() = 0;
6264
void pull_newVersionToReplaceOld();
65+
void moduleSelected(bool selected);
6366
Q_SIGNALS:
6467
void pullSignal();
6568
void executionTimeChanged(int time);
@@ -95,6 +98,8 @@ namespace Gui {
9598
std::vector<WidgetSlotManagerPtr> slotManagers_;
9699
boost::signals2::connection stateConnection_;
97100
QAction* executeAction_;
101+
QString windowTitle_;
102+
QDockWidget* dock_;
98103
};
99104

100105
}

0 commit comments

Comments
 (0)