SlicerT UI update (#7453)
* Update SlicerT UI * Style review Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> * Style fixes --------- Co-authored-by: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com>
This commit is contained in:
@@ -216,14 +216,16 @@ void EffectRackView::update()
|
||||
}
|
||||
else
|
||||
{
|
||||
(*it)->resize(width() - 35, EffectView::DEFAULT_HEIGHT);
|
||||
( *it )->move( EffectViewMargin, m_lastY );
|
||||
(*it)->update();
|
||||
m_lastY += ( *it )->height();
|
||||
++nView;
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
w->setFixedSize( EffectView::DEFAULT_WIDTH + 2*EffectViewMargin, m_lastY);
|
||||
w->resize(width() - 35 + 2 * EffectViewMargin, m_lastY);
|
||||
|
||||
QWidget::update();
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
|
||||
m_controlView(nullptr),
|
||||
m_dragging(false)
|
||||
{
|
||||
setFixedSize(EffectView::DEFAULT_WIDTH, EffectView::DEFAULT_HEIGHT);
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // TODO: Actual effect resizing
|
||||
|
||||
// Disable effects that are of type "DummyEffect"
|
||||
bool isEnabled = !dynamic_cast<DummyEffect *>( effect() );
|
||||
|
||||
@@ -85,9 +85,11 @@ EnvelopeAndLfoView::EnvelopeAndLfoView(QWidget * parent) :
|
||||
envelopeLayout->addLayout(graphAndAmountLayout);
|
||||
|
||||
m_envelopeGraph = new EnvelopeGraph(this);
|
||||
m_envelopeGraph->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
graphAndAmountLayout->addWidget(m_envelopeGraph);
|
||||
|
||||
m_amountKnob = buildKnob(tr("AMT"), tr("Modulation amount:"));
|
||||
m_amountKnob->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
graphAndAmountLayout->addWidget(m_amountKnob, 0, Qt::AlignCenter);
|
||||
|
||||
QHBoxLayout* envKnobsLayout = new QHBoxLayout();
|
||||
|
||||
@@ -211,8 +211,8 @@ void EnvelopeGraph::paintEvent(QPaintEvent*)
|
||||
const QColor lineColor{ColorHelper::interpolateInRgb(noAmountColor, fullAmountColor, absAmount)};
|
||||
|
||||
// Determine the line width so that it scales with the widget
|
||||
// Use the minimum value of the current width and height to compute it.
|
||||
const qreal lineWidth = std::min(width(), height()) / 20.;
|
||||
// Use the diagonal of the box to compute it
|
||||
const qreal lineWidth = sqrt(width()*width() + height()*height()) / 80.;
|
||||
const QPen linePen{lineColor, lineWidth};
|
||||
p.setPen(linePen);
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
connect( m_nameLineEdit, SIGNAL( textChanged( const QString& ) ),
|
||||
this, SLOT( textChanged( const QString& ) ) );
|
||||
|
||||
m_nameLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred));
|
||||
m_nameLineEdit->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
|
||||
nameAndChangeTrackLayout->addWidget(m_nameLineEdit, 1);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
// m_leftRightNav->setShortcuts();
|
||||
nameAndChangeTrackLayout->addWidget(m_leftRightNav);
|
||||
|
||||
|
||||
nameAndChangeTrackWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
generalSettingsLayout->addWidget( nameAndChangeTrackWidget );
|
||||
|
||||
auto basicControlsLayout = new QGridLayout;
|
||||
@@ -238,8 +238,8 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
m_ssView = new InstrumentSoundShapingView( m_tabWidget );
|
||||
|
||||
// FUNC tab
|
||||
auto instrumentFunctions = new QWidget(m_tabWidget);
|
||||
auto instrumentFunctionsLayout = new QVBoxLayout(instrumentFunctions);
|
||||
m_instrumentFunctionsView = new QWidget(m_tabWidget);
|
||||
auto instrumentFunctionsLayout = new QVBoxLayout(m_instrumentFunctionsView);
|
||||
instrumentFunctionsLayout->setContentsMargins(5, 5, 5, 5);
|
||||
m_noteStackingView = new InstrumentFunctionNoteStackingView( &m_track->m_noteStacking );
|
||||
m_arpeggioView = new InstrumentFunctionArpeggioView( &m_track->m_arpeggio );
|
||||
@@ -259,21 +259,21 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
|
||||
|
||||
m_tabWidget->addTab(m_ssView, tr("Envelope, filter & LFO"), "env_lfo_tab", 1);
|
||||
m_tabWidget->addTab(instrumentFunctions, tr("Chord stacking & arpeggio"), "func_tab", 2);
|
||||
m_tabWidget->addTab(m_instrumentFunctionsView, tr("Chord stacking & arpeggio"), "func_tab", 2);
|
||||
m_tabWidget->addTab(m_effectView, tr("Effects"), "fx_tab", 3);
|
||||
m_tabWidget->addTab(m_midiView, tr("MIDI"), "midi_tab", 4);
|
||||
m_tabWidget->addTab(m_tuningView, tr("Tuning and transposition"), "tuning_tab", 5);
|
||||
adjustTabSize(m_ssView);
|
||||
adjustTabSize(instrumentFunctions);
|
||||
// EffectRackView has sizeHint to be QSize(EffectRackView::DEFAULT_WIDTH, INSTRUMENT_HEIGHT - 4 - 1)
|
||||
adjustTabSize(m_midiView);
|
||||
adjustTabSize(m_tuningView);
|
||||
|
||||
// setup piano-widget
|
||||
m_pianoView = new PianoView( this );
|
||||
m_pianoView->setMinimumHeight( PIANO_HEIGHT );
|
||||
m_pianoView->setMaximumHeight( PIANO_HEIGHT );
|
||||
|
||||
// setup sizes and policies
|
||||
generalSettingsWidget->setMaximumHeight(90);
|
||||
generalSettingsWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
m_tabWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
vlayout->addWidget( generalSettingsWidget );
|
||||
// Use QWidgetItem explicitly to make the size hint change on instrument changes
|
||||
// QLayout::addWidget() uses QWidgetItemV2 with size hint caching
|
||||
@@ -281,13 +281,20 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
vlayout->addWidget( m_pianoView );
|
||||
setModel( _itv->model() );
|
||||
|
||||
updateInstrumentView();
|
||||
|
||||
QMdiSubWindow* subWin = getGUI()->mainWindow()->addWindowedWidget( this );
|
||||
Qt::WindowFlags flags = subWin->windowFlags();
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
if (!m_instrumentView->isResizable()) {
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
// any better way than this?
|
||||
} else {
|
||||
subWin->setMaximumSize(m_instrumentView->maximumHeight() + 12, m_instrumentView->maximumWidth() + 208);
|
||||
subWin->setMinimumSize( m_instrumentView->minimumWidth() + 12, m_instrumentView->minimumHeight() + 208);
|
||||
}
|
||||
flags &= ~Qt::WindowMaximizeButtonHint;
|
||||
subWin->setWindowFlags( flags );
|
||||
|
||||
updateInstrumentView();
|
||||
|
||||
// Hide the Size and Maximize options from the system menu
|
||||
// since the dialog size is fixed.
|
||||
@@ -296,10 +303,18 @@ InstrumentTrackWindow::InstrumentTrackWindow( InstrumentTrackView * _itv ) :
|
||||
systemMenu->actions().at( 4 )->setVisible( false ); // Maximize
|
||||
|
||||
subWin->setWindowIcon( embed::getIconPixmap( "instrument_track" ) );
|
||||
subWin->setMinimumSize( subWin->size() );
|
||||
subWin->hide();
|
||||
}
|
||||
|
||||
void InstrumentTrackWindow::resizeEvent(QResizeEvent * event) {
|
||||
/* m_instrumentView->resize(QSize(size().width()-1, maxHeight)); */
|
||||
adjustTabSize(m_instrumentView);
|
||||
adjustTabSize(m_instrumentFunctionsView);
|
||||
adjustTabSize(m_ssView);
|
||||
adjustTabSize(m_effectView);
|
||||
adjustTabSize(m_midiView);
|
||||
adjustTabSize(m_tuningView);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -668,6 +683,13 @@ void InstrumentTrackWindow::viewInstrumentInDirection(int d)
|
||||
}
|
||||
Q_ASSERT(bringToFront);
|
||||
bringToFront->getInstrumentTrackWindow()->setFocus();
|
||||
Qt::WindowFlags flags = windowFlags();
|
||||
if (!m_instrumentView->isResizable()) {
|
||||
flags |= Qt::MSWindowsFixedSizeDialogHint;
|
||||
} else {
|
||||
flags &= ~Qt::MSWindowsFixedSizeDialogHint;
|
||||
}
|
||||
setWindowFlags( flags );
|
||||
}
|
||||
|
||||
void InstrumentTrackWindow::viewNextInstrument()
|
||||
@@ -684,7 +706,8 @@ void InstrumentTrackWindow::adjustTabSize(QWidget *w)
|
||||
// "-1" :
|
||||
// in "TabWidget::addTab", under "Position tab's window", the widget is
|
||||
// moved up by 1 pixel
|
||||
w->setMinimumSize(INSTRUMENT_WIDTH - 4, INSTRUMENT_HEIGHT - 4 - 1);
|
||||
w->resize(width() - 4, height() - 180);
|
||||
w->update();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace lmms::gui
|
||||
InstrumentView::InstrumentView( Instrument * _Instrument, QWidget * _parent ) :
|
||||
PluginView( _Instrument, _parent )
|
||||
{
|
||||
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
setModel( _Instrument );
|
||||
setAttribute( Qt::WA_DeleteOnClose, true );
|
||||
}
|
||||
@@ -44,6 +45,7 @@ InstrumentView::InstrumentView( Instrument * _Instrument, QWidget * _parent ) :
|
||||
|
||||
InstrumentView::~InstrumentView()
|
||||
{
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
|
||||
if( instrumentTrackWindow() )
|
||||
{
|
||||
instrumentTrackWindow()->m_instrumentView = nullptr;
|
||||
@@ -76,4 +78,4 @@ InstrumentTrackWindow * InstrumentView::instrumentTrackWindow()
|
||||
|
||||
|
||||
|
||||
} // namespace lmms::gui
|
||||
} // namespace lmms::gui
|
||||
|
||||
Reference in New Issue
Block a user