Skip to content

Commit f3b8d0e

Browse files
committed
Closes #1124
Good enough to make module UIs usable
1 parent 67fc292 commit f3b8d0e

File tree

6 files changed

+37
-22
lines changed

6 files changed

+37
-22
lines changed

src/Dataflow/Engine/Controller/NetworkEditorController.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace
120120

121121
ModulePositions positions;
122122
int i = 0;
123-
const double moduleVerticalSpacing = 80;
123+
const double moduleVerticalSpacing = 110;
124124
const double moduleHorizontalSpacing = 264;
125125
const double moduleSpacingOffset = 10;
126126
static int numSnips = 0;

src/Interface/Application/ModuleWidget.cc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,8 @@ void ModuleWidget::setColorUnselected()
10351035

10361036
boost::shared_ptr<ModuleDialogFactory> ModuleWidget::dialogFactory_;
10371037

1038+
double ModuleWidget::highResolutionExpandFactor_ = 1;
1039+
10381040
void ModuleWidget::makeOptionsDialog()
10391041
{
10401042
if (theModule_->has_ui())
@@ -1074,14 +1076,13 @@ void ModuleWidget::makeOptionsDialog()
10741076
dockable_->setFloating(true);
10751077
}
10761078

1077-
auto expand = Core::Application::Instance().parameters()->developerParameters()->guiExpandFactor().get_value_or(-1);
1078-
if (expand > 1)
1079+
if (highResolutionExpandFactor_ > 1)
10791080
{
1080-
qDebug() << "expand factor for dialogs:" << expand;
1081-
qDebug() << dialog_->size();
1082-
dialog_->setFixedHeight(dialog_->size().height() * expand);
1083-
dialog_->setFixedWidth(dialog_->size().width() * (((expand - 1) * 0.5) + 1));
1084-
qDebug() << dialog_->size();
1081+
//qDebug() << "expand factor for dialogs:" << highResolutionExpandFactor_;
1082+
//qDebug() << dialog_->size();
1083+
dialog_->setFixedHeight(dialog_->size().height() * highResolutionExpandFactor_);
1084+
dialog_->setFixedWidth(dialog_->size().width() * (((highResolutionExpandFactor_ - 1) * 0.5) + 1));
1085+
//qDebug() << dialog_->size();
10851086
}
10861087

10871088
dialog_->pull();

src/Interface/Application/ModuleWidget.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ class ModuleWidget : public QStackedWidget,
104104
Q_OBJECT
105105

106106
public:
107-
ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataflow::Networks::ModuleHandle theModule, boost::shared_ptr<DialogErrorControl> dialogErrorControl,
107+
ModuleWidget(NetworkEditor* ed, const QString& name, SCIRun::Dataflow::Networks::ModuleHandle theModule,
108+
boost::shared_ptr<DialogErrorControl> dialogErrorControl,
108109
QWidget* parent = nullptr);
109110
~ModuleWidget();
110111

@@ -162,6 +163,8 @@ class ModuleWidget : public QStackedWidget,
162163
QString metadataToString() const;
163164
QDialog* dialog();
164165

166+
static double highResolutionExpandFactor_;
167+
165168
public Q_SLOTS:
166169
virtual bool executeWithSignals() override;
167170
void toggleOptionsDialog();

src/Interface/Application/NetworkEditor.cc

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ NetworkEditor::NetworkEditor(boost::shared_ptr<CurrentModuleSelection> moduleSel
6464
PreexecuteFunc preexecuteFunc,
6565
TagColorFunc tagColor,
6666
TagNameFunc tagName,
67+
double highResolutionExpandFactor,
6768
QWidget* parent)
6869
: QGraphicsView(parent),
6970
modulesSelectedByCL_(false),
@@ -80,11 +81,13 @@ NetworkEditor::NetworkEditor(boost::shared_ptr<CurrentModuleSelection> moduleSel
8081
moduleEventProxy_(new ModuleEventProxy),
8182
zLevelManager_(new ZLevelManager(scene_)),
8283
fileLoading_(false),
83-
preexecute_(preexecuteFunc)
84+
preexecute_(preexecuteFunc),
85+
highResolutionExpandFactor_(highResolutionExpandFactor)
8486
{
8587
scene_->setBackgroundBrush(Qt::darkGray);
8688
ModuleWidget::connectionFactory_.reset(new ConnectionFactory(scene_));
8789
ModuleWidget::closestPortFinder_.reset(new ClosestPortFinder(scene_));
90+
ModuleWidget::highResolutionExpandFactor_ = highResolutionExpandFactor_;
8891

8992
setScene(scene_);
9093
setDragMode(RubberBandDrag);
@@ -378,15 +381,15 @@ void NetworkEditor::setupModuleWidget(ModuleWidget* module)
378381
proxy->createPortPositionProviders();
379382
proxy->highlightPorts(Preferences::Instance().highlightPorts ? 1 : 0);
380383

381-
auto expand = Core::Application::Instance().parameters()->developerParameters()->guiExpandFactor().get_value_or(-1);
382-
383-
if (expand > 0)
384+
if (highResolutionExpandFactor_ > 1)
384385
{
385-
qDebug() << "expand factor:" << expand;
386-
qDebug() << proxy->size();
387-
module->setFixedHeight(proxy->size().height() * expand);
388-
proxy->setMaximumHeight(proxy->size().height() * expand);
389-
qDebug() << proxy->size();
386+
//qDebug() << "module widget expand factor:" << highResolutionExpandFactor_;
387+
//qDebug() << proxy->size();
388+
module->setFixedHeight(proxy->size().height() * highResolutionExpandFactor_);
389+
proxy->setMaximumHeight(proxy->size().height() * highResolutionExpandFactor_);
390+
module->setFixedWidth(proxy->size().width() * std::max(highResolutionExpandFactor_*0.9, 1.0));
391+
proxy->setMaximumWidth(proxy->size().width() * std::max(highResolutionExpandFactor_*0.9, 1.0));
392+
//qDebug() << proxy->size();
390393
}
391394

392395
scene_->addItem(proxy);

src/Interface/Application/NetworkEditor.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,13 @@ namespace Gui {
174174
Q_OBJECT
175175

176176
public:
177-
explicit NetworkEditor(boost::shared_ptr<CurrentModuleSelection> moduleSelectionGetter, boost::shared_ptr<DefaultNotePositionGetter> dnpg,
177+
explicit NetworkEditor(boost::shared_ptr<CurrentModuleSelection> moduleSelectionGetter,
178+
boost::shared_ptr<DefaultNotePositionGetter> dnpg,
178179
boost::shared_ptr<DialogErrorControl> dialogErrorControl,
179180
PreexecuteFunc preexecuteFunc,
180181
TagColorFunc tagColor,
181182
TagNameFunc tagName,
183+
double highResolutionExpandFactor,
182184
QWidget* parent = nullptr);
183185
~NetworkEditor();
184186
void setNetworkEditorController(boost::shared_ptr<NetworkEditorControllerGuiProxy> controller);
@@ -353,6 +355,7 @@ namespace Gui {
353355
bool insertingNewModuleAlongConnection_ { false };
354356
PreexecuteFunc preexecute_;
355357
bool showTagGroupsOnFileLoad_ { false };
358+
double highResolutionExpandFactor_{ 1 };
356359
};
357360
}
358361
}

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ SCIRunMainWindow::SCIRunMainWindow() : shortcuts_(nullptr), returnCode_(0), quit
375375

376376
setupVersionButton();
377377

378-
WidgetStyleMixin::tabStyle(optionsTabWidget_);
378+
WidgetStyleMixin::tabStyle(optionsTabWidget_);
379379
}
380380

381381
void SCIRunMainWindow::initialize()
@@ -505,10 +505,15 @@ void SCIRunMainWindow::setupNetworkEditor()
505505
auto tagColorFunc = [this](int tag) { return tagManagerWindow_->tagColor(tag); };
506506
auto tagNameFunc = [this](int tag) { return tagManagerWindow_->tagName(tag); };
507507
auto preexecuteFunc = [this]() { preexecute(); };
508+
auto highResolutionExpandFactor = Core::Application::Instance().parameters()->developerParameters()->guiExpandFactor().get_value_or(1.0);
509+
{
510+
auto screen = QApplication::desktop()->screenGeometry();
511+
if (screen.height() * screen.width() > 5000000)
512+
highResolutionExpandFactor *= 1.5;
513+
}
508514
networkEditor_ = new NetworkEditor(getter, defaultNotePositionGetter_, dialogErrorControl_, preexecuteFunc,
509-
tagColorFunc, tagNameFunc, scrollAreaWidgetContents_);
515+
tagColorFunc, tagNameFunc, highResolutionExpandFactor, scrollAreaWidgetContents_);
510516
networkEditor_->setObjectName(QString::fromUtf8("networkEditor_"));
511-
//networkEditor_->setContextMenuPolicy(Qt::ActionsContextMenu);
512517
networkEditor_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
513518
networkEditor_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
514519
networkEditor_->verticalScrollBar()->setValue(0);

0 commit comments

Comments
 (0)