Skip to content

Commit 6189c21

Browse files
committed
DockManager class
1 parent 5f7af86 commit 6189c21

File tree

7 files changed

+24
-0
lines changed

7 files changed

+24
-0
lines changed

src/Interface/Application/MainWindowCollaborators.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <Core/Logging/Log.h>
3535
#include <Core/Utils/Singleton.h>
3636
#include <set>
37+
#include <queue>
3738
#include <Interface/Application/NetworkEditor.h> //TODO
3839
#include <Interface/Application/NetworkExecutionProgressBar.h>
3940
#endif
@@ -54,6 +55,7 @@ namespace SCIRun {
5455
namespace Gui {
5556

5657
class SCIRunMainWindow;
58+
class ModuleDialogGeneric;
5759

5860
class TextEditAppender : public Core::Logging::LegacyLoggerInterface, public Core::Logging::LogAppenderStrategy
5961
{
@@ -235,6 +237,17 @@ namespace Gui {
235237
SCIRunMainWindow* mainWindow_;
236238
};
237239

240+
class DockManager : public QObject
241+
{
242+
Q_OBJECT
243+
public:
244+
explicit DockManager(int& availableSize, QObject* parent);
245+
void requestShow(ModuleDialogGeneric* dialog);
246+
private:
247+
int& availableSize_;
248+
std::set<ModuleDialogGeneric*>& currentDialogs_;
249+
std::queue<ModuleDialogGeneric*> collapseQueue_;
250+
};
238251
}
239252
}
240253
#endif

src/Interface/Application/ModuleWidget.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,6 +1344,7 @@ void ModuleWidget::showUI()
13441344
if (dockable_)
13451345
{
13461346
dockable_->show();
1347+
dialog_->expand();
13471348
qDebug() << dockable_->size().height();
13481349
}
13491350
}

src/Interface/Application/NetworkEditor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ namespace Gui {
177177
TagColorFunc tagColor;
178178
TagNameFunc tagName;
179179
double highResolutionExpandFactor;
180+
class DockManager* dockManager_;
180181
};
181182

182183
namespace NetworkBoundaries

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ SCIRunMainWindow::SCIRunMainWindow()
166166
scrollArea_->viewport()->setAutoFillBackground(true);
167167
scrollArea_->setStyleSheet(styleSheet());
168168

169+
setDockOptions(AnimatedDocks | AllowTabbedDocks | VerticalTabs);
170+
169171
connect(actionSave_As_, SIGNAL(triggered()), this, SLOT(saveNetworkAs()));
170172
connect(actionSave_, SIGNAL(triggered()), this, SLOT(saveNetwork()));
171173
connect(actionLoad_, SIGNAL(triggered()), this, SLOT(loadNetwork()));
@@ -318,6 +320,7 @@ SCIRunMainWindow::SCIRunMainWindow()
318320
void SCIRunMainWindow::resizeEvent(QResizeEvent* event)
319321
{
320322
qDebug() << "available height:" << size().height();
323+
dockSpace_ = size().height();
321324
QMainWindow::resizeEvent(event);
322325
}
323326

src/Interface/Application/SCIRunMainWindow.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ public Q_SLOTS:
185185
bool skipSaveCheck_ = false;
186186
bool startup_;
187187
boost::shared_ptr<NetworkEditorBuilder> builder_;
188+
int dockSpace_{0};
188189

189190
Q_SIGNALS:
190191
void moduleItemDoubleClicked();

src/Interface/Modules/Base/ModuleDialogGeneric.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using namespace SCIRun::Core::Logging;
4141

4242
ExecutionDisablingServiceFunction ModuleDialogGeneric::disablerAdd_;
4343
ExecutionDisablingServiceFunction ModuleDialogGeneric::disablerRemove_;
44+
std::set<ModuleDialogGeneric*> ModuleDialogGeneric::instances_;
4445

4546
ModuleDialogGeneric::ModuleDialogGeneric(ModuleStateHandle state, QWidget* parent) : QDialog(parent),
4647
state_(state),
@@ -65,10 +66,12 @@ ModuleDialogGeneric::ModuleDialogGeneric(ModuleStateHandle state, QWidget* paren
6566
createExecuteDownstreamAction();
6667
createShrinkAction();
6768
connectStateChangeToExecute(); //TODO: make this a module state variable if a module wants it saved
69+
instances_.insert(this);
6870
}
6971

7072
ModuleDialogGeneric::~ModuleDialogGeneric()
7173
{
74+
instances_.erase(this);
7275
if (disablerAdd_ && disablerRemove_)
7376
{
7477
std::for_each(needToRemoveFromDisabler_.begin(), needToRemoveFromDisabler_.end(), disablerRemove_);

src/Interface/Modules/Base/ModuleDialogGeneric.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ namespace Gui {
9393
void moduleSelected(bool selected);
9494
void toggleCollapse();
9595
void collapse() { if (!collapsed_) toggleCollapse(); }
96+
void expand() { if (collapsed_) toggleCollapse(); }
9697
virtual void updateFromPortChange(int numPorts, const std::string& portName, DynamicPortChange type) {}
9798
Q_SIGNALS:
9899
void pullSignal();
@@ -188,6 +189,7 @@ namespace Gui {
188189
std::vector<QWidget*> needToRemoveFromDisabler_;
189190
static ExecutionDisablingServiceFunction disablerAdd_;
190191
static ExecutionDisablingServiceFunction disablerRemove_;
192+
static std::set<ModuleDialogGeneric*> instances_;
191193
};
192194

193195
class SCISHARE ScopedWidgetSignalBlocker

0 commit comments

Comments
 (0)