Skip to content

Commit

Permalink
[ui] Improve inspector ui, show more port names and make sure port li…
Browse files Browse the repository at this point in the history
…st is always visibles
  • Loading branch information
jcelerier committed Oct 27, 2024
1 parent 7e242c8 commit b3a3096
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class InspectorWidget : public QWidget
: QWidget{parent}
, m_proc{&const_cast<Process::ProcessModel&>(process)}
{
setObjectName("Process::InspectorWidget");
auto lay = new Inspector::VBoxLayout{this};

auto label = new TextLabel{
Expand Down Expand Up @@ -228,22 +229,25 @@ class InspectorWidget : public QWidget
m_buttons->addWidget(controlsToggle);
}

// Custom widget
// FIXME to be removed, eventually
if(w)
{
lay->addWidget(w);
lay->addStretch(100);
}
else
{
auto scroll = new QScrollArea{};
scroll->setFrameShape(QFrame::NoFrame);
scroll->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scroll->setWidgetResizable(true);
scroll->setWidget(new PortListWidget{process, doc, this});
lay->addWidget(scroll);
}

// List of ports
auto scroll = new QScrollArea{};
scroll->setObjectName("PortListWidgetScrollArea");
scroll->setFrameShape(QFrame::NoFrame);
QSizePolicy sz;
sz.setHorizontalPolicy(QSizePolicy::MinimumExpanding);
sz.setVerticalPolicy(QSizePolicy::MinimumExpanding);
sz.setVerticalStretch(255);
scroll->setSizePolicy(sz);
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scroll->setWidgetResizable(true);
scroll->setWidget(new PortListWidget{process, doc, this});
lay->addWidget(scroll);
}

~InspectorWidget()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@ inline void setupNewPort(Process::Port* obj)
#if !defined(__APPLE__)
constexpr auto name = avnd::get_name<T>();
obj->setName(fromStringView(name));

if constexpr(constexpr auto desc = avnd::get_description<T>(); !desc.empty())
obj->setDescription(fromStringView(desc));
if constexpr(avnd::has_description<T>)
obj->setDescription(fromStringView(avnd::get_description<T>()));
#else
auto name = avnd::get_name<T>();
obj->setName(fromStringView(name));
if(auto desc = avnd::get_description<T>(); !desc.empty())
obj->setDescription(fromStringView(desc));
if constexpr(avnd::has_description<T>)
obj->setDescription(fromStringView(avnd::get_description<T>()));
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ void AudioInletFactory::setupInletInspector(
const auto& node = d->getNode(root);

auto edit = Process::makeAddressCombo(root, node, port, ctx, parent);
lay.addRow(edit);
lay.addRow(port.name(), edit);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ void AudioOutletFactory::setupOutletInspector(
const auto& node = d->getNode(root);

auto edit = Process::makeAddressCombo(root, node, port, ctx, parent);
lay.addRow(edit);
lay.addRow(port.name(), edit);

auto cb = new QCheckBox{QObject::tr("Propagate"), parent};
cb->setChecked(outlet.propagate());
lay.addRow(cb);
lay.addRow("", cb);
QObject::connect(cb, &QCheckBox::toggled, &outlet, [&ctx, &out = outlet](auto ok) {
if(ok != out.propagate())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void MidiInletFactory::setupInletInspector(
}
});

lay.addRow(Process::makeDeviceCombo(midiDevices, port, ctx, parent));
lay.addRow(port.name(), Process::makeDeviceCombo(midiDevices, port, ctx, parent));
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void MidiOutletFactory::setupOutletInspector(
}
});

lay.addRow(Process::makeDeviceCombo(midiDevices, port, ctx, parent));
lay.addRow(port.name(), Process::makeDeviceCombo(midiDevices, port, ctx, parent));
#endif
}
}

0 comments on commit b3a3096

Please sign in to comment.