Improve mixer position on first start

parent f583cbae
......@@ -31,6 +31,8 @@
#include <QHBoxLayout>
#include <QModelIndex>
#include <QScrollArea>
#include <QApplication>
#include <QScreen>
#include <QTimer>
const double log_factor = 1.0 / log10(1.0 / 127);
......@@ -48,6 +50,7 @@ MixerManager::MixerManager(QWidget *parent)
, m_masterMixer(nullptr)
, m_connectedWidgets(false)
, m_expandedWidth(-1)
, m_recommandedWidth(300)
{
m_masterBox = new QHBoxLayout;
m_channelsBox = new QScrollArea(this);
......@@ -117,6 +120,7 @@ void MixerManager::registerTrack(int tid, std::shared_ptr<Mlt::Tractor> service,
});
m_mixers[tid] = mixer;
m_channelsLayout->insertWidget(0, mixer.get());
m_recommandedWidth = mixer->minimumWidth() * (m_mixers.size() + 1);
}
void MixerManager::deregisterTrack(int tid)
......@@ -208,6 +212,13 @@ void MixerManager::collapseMixers()
}
}
/*QSize MixerManager::sizeHint() const
{
QSize sz = QApplication::primaryScreen()->availableSize();
return QSize(m_masterMixer ? m_masterMixer->width() * (m_mixers.size() + 1) : sz.width() / 5, sz.height() / 3);
}*/
void MixerManager::resetSizePolicy()
{
setMaximumWidth(QWIDGETSIZE_MAX);
......
......@@ -68,6 +68,7 @@ signals:
protected:
std::unordered_map<int, std::shared_ptr<MixerWidget>> m_mixers;
std::shared_ptr<MixerWidget> m_masterMixer;
//QSize sizeHint() const override;
private:
std::shared_ptr<Mlt::Tractor> m_masterService;
......@@ -81,6 +82,7 @@ private:
bool m_connectedWidgets;
int m_expandedWidth;
QVector <int> m_soloMuted;
int m_recommandedWidth;
};
......
......@@ -238,21 +238,6 @@ void MainWindow::init()
setupActions();
QDockWidget *libraryDock = addDock(i18n("Library"), QStringLiteral("library"), pCore->library());
QDockWidget *mixerDock = addDock(i18n("Audio Mixer"), QStringLiteral("mixer"), pCore->mixer());
QAction *showMixer = new QAction(QIcon::fromTheme(QStringLiteral("adjustlevels")), i18n("Audio Mixer"), this);
showMixer->setCheckable(true);
addAction(QStringLiteral("audiomixer_button"), showMixer);
connect(mixerDock, &QDockWidget::visibilityChanged, [&, showMixer](bool visible) {
pCore->mixer()->connectMixer(visible);
showMixer->setChecked(visible);
});
connect(showMixer, &QAction::triggered, [&, mixerDock]() {
if (mixerDock->isVisible()) {
mixerDock->close();
} else {
mixerDock->show();
}
});
m_clipMonitor = new Monitor(Kdenlive::ClipMonitor, pCore->monitorManager(), this);
pCore->bin()->setMonitor(m_clipMonitor);
......@@ -400,16 +385,31 @@ void MainWindow::init()
addAction(QStringLiteral("force_icon_theme"), iconAction);
connect(iconAction, &QAction::triggered, this, &MainWindow::forceIconSet);
QDockWidget *mixerDock = addDock(i18n("Audio Mixer"), QStringLiteral("mixer"), pCore->mixer());
QAction *showMixer = new QAction(QIcon::fromTheme(QStringLiteral("adjustlevels")), i18n("Audio Mixer"), this);
showMixer->setCheckable(true);
addAction(QStringLiteral("audiomixer_button"), showMixer);
connect(mixerDock, &QDockWidget::visibilityChanged, [&, showMixer](bool visible) {
pCore->mixer()->connectMixer(visible);
showMixer->setChecked(visible);
});
connect(showMixer, &QAction::triggered, [&, mixerDock]() {
if (mixerDock->isVisible()) {
mixerDock->close();
} else {
mixerDock->show();
}
});
// Close non-general docks for the initial layout
// only show important ones
m_undoViewDock->close();
/// Tabify Widgets
tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
tabifyDockWidget(mixerDock, m_transitionListDock);
tabifyDockWidget(m_transitionListDock, m_effectListDock);
tabifyDockWidget(m_effectStackDock, pCore->bin()->clipPropertiesDock());
// tabifyDockWidget(m_effectListDock, m_effectStackDock);
tabifyDockWidget(m_clipMonitorDock, m_projectMonitorDock);
bool firstRun = readOptions();
// Build effects menu
......
......@@ -297,7 +297,7 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
}
m_audioButton->setIcon(icon);*/
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
setLayout(layout);
setMinimumHeight(200);
......@@ -552,7 +552,7 @@ void Monitor::slotForceSize(QAction *a)
m_videoWidget->setMinimumSize(profileWidth, profileHeight);
m_videoWidget->setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
setMinimumSize(QSize(profileWidth, profileHeight + m_toolbar->height() + m_glMonitor->getControllerProxy()->rulerHeight()));
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
break;
}
m_forceSizeFactor = resizeType;
......
......@@ -100,8 +100,3 @@ void TimelineTabs::disconnectTimeline(TimelineWidget *timeline)
disconnect(timeline->controller(), &TimelineController::showItemEffectStack, this, &TimelineTabs::showItemEffectStack);
delete timeline;
}
QSize TimelineTabs::sizeHint() const
{
return QSize(800, 300);
}
......@@ -60,7 +60,6 @@ public:
protected:
/** @brief Helper function to connect a timeline's signals/slots*/
void connectTimeline(TimelineWidget *timeline);
QSize sizeHint() const override;
signals:
/** @brief Request repaint of audio thumbs
......
......@@ -233,7 +233,3 @@ void TimelineWidget::focusTimeline()
}
}
QSize TimelineWidget::sizeHint() const
{
return QSize(800, 300);
}
......@@ -56,7 +56,6 @@ public:
protected:
void mousePressEvent(QMouseEvent *event) override;
QSize sizeHint() const override;
public slots:
void slotChangeZoom(int value, bool zoomOnMouse);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment