Set timeline's maximum height, saner default window size on first start

parent cd763ff0
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtGlobal> #include <QtGlobal>
#include <QScreen>
static const char version[] = KDENLIVE_VERSION; static const char version[] = KDENLIVE_VERSION;
namespace Mlt namespace Mlt
...@@ -373,7 +373,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -373,7 +373,7 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
if (m_recMonitor) { if (m_recMonitor) {
tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock); tabifyDockWidget(m_clipMonitorDock, m_recMonitorDock);
} }
readOptions(); bool firstRun = readOptions();
QAction *action; QAction *action;
// Stop motion actions. Beware of the order, we MUST use the same order in stopmotion/stopmotion.cpp // Stop motion actions. Beware of the order, we MUST use the same order in stopmotion/stopmotion.cpp
...@@ -473,7 +473,17 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -473,7 +473,17 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
previewButtonAction->setDefaultWidget(timelinePreview); previewButtonAction->setDefaultWidget(timelinePreview);
addAction(QStringLiteral("timeline_preview_button"), previewButtonAction); addAction(QStringLiteral("timeline_preview_button"), previewButtonAction);
setupGUI(); setupGUI(QSize(1800,1000));
if (firstRun) {
QScreen *current = QApplication::primaryScreen();
if (current) {
if (current->availableSize().height() < 1000) {
resize(current->availableSize());
} else {
resize(current->availableSize() / 1.5);
}
}
}
timelinePreview->setToolButtonStyle(m_timelineToolBar->toolButtonStyle()); timelinePreview->setToolButtonStyle(m_timelineToolBar->toolButtonStyle());
connect(m_timelineToolBar, &QToolBar::toolButtonStyleChanged, timelinePreview, &ProgressButton::setToolButtonStyle); connect(m_timelineToolBar, &QToolBar::toolButtonStyleChanged, timelinePreview, &ProgressButton::setToolButtonStyle);
...@@ -637,7 +647,6 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString & ...@@ -637,7 +647,6 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
KdenliveSettings::setDecklink_extension(data.section(';', 1, 1)); KdenliveSettings::setDecklink_extension(data.section(';', 1, 1));
} }
} }
statusBar()->show();
emit GUISetupDone(); emit GUISetupDone();
pCore->projectManager()->init(Url, clipsToLoad); pCore->projectManager()->init(Url, clipsToLoad);
QTimer::singleShot(0, pCore->projectManager(), SLOT(slotLoadOnOpen())); QTimer::singleShot(0, pCore->projectManager(), SLOT(slotLoadOnOpen()));
...@@ -1489,7 +1498,7 @@ void MainWindow::saveOptions() ...@@ -1489,7 +1498,7 @@ void MainWindow::saveOptions()
KdenliveSettings::self()->save(); KdenliveSettings::self()->save();
} }
void MainWindow::readOptions() bool MainWindow::readOptions()
{ {
KSharedConfigPtr config = KSharedConfig::openConfig(); KSharedConfigPtr config = KSharedConfig::openConfig();
pCore->projectManager()->recentFilesAction()->loadEntries(KConfigGroup(config, "Recent Files")); pCore->projectManager()->recentFilesAction()->loadEntries(KConfigGroup(config, "Recent Files"));
...@@ -1513,9 +1522,11 @@ void MainWindow::readOptions() ...@@ -1513,9 +1522,11 @@ void MainWindow::readOptions()
if (KdenliveSettings::trackheight() == 0) { if (KdenliveSettings::trackheight() == 0) {
KdenliveSettings::setTrackheight(50); KdenliveSettings::setTrackheight(50);
} }
bool firstRun = false;
KConfigGroup initialGroup(config, "version"); KConfigGroup initialGroup(config, "version");
if (!initialGroup.exists()) { if (!initialGroup.exists()) {
// First run, check if user is on a KDE Desktop // First run, check if user is on a KDE Desktop
firstRun = true;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (env.contains(QStringLiteral("XDG_CURRENT_DESKTOP"))) { if (env.contains(QStringLiteral("XDG_CURRENT_DESKTOP"))) {
if (env.value(QStringLiteral("XDG_CURRENT_DESKTOP")).toLower() != QLatin1String("kde")) { if (env.value(QStringLiteral("XDG_CURRENT_DESKTOP")).toLower() != QLatin1String("kde")) {
...@@ -1537,6 +1548,7 @@ void MainWindow::readOptions() ...@@ -1537,6 +1548,7 @@ void MainWindow::readOptions()
} }
} }
initialGroup.writeEntry("version", version); initialGroup.writeEntry("version", version);
return firstRun;
} }
void MainWindow::slotRunWizard() void MainWindow::slotRunWizard()
...@@ -1733,6 +1745,7 @@ void MainWindow::connectDocument() ...@@ -1733,6 +1745,7 @@ void MainWindow::connectDocument()
Timeline *trackView = pCore->projectManager()->currentTimeline(); Timeline *trackView = pCore->projectManager()->currentTimeline();
connect(project, SIGNAL(startAutoSave()), pCore->projectManager(), SLOT(slotStartAutoSave())); connect(project, SIGNAL(startAutoSave()), pCore->projectManager(), SLOT(slotStartAutoSave()));
connect(project, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects())); connect(project, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(trackView, &Timeline::updateTimelineHeight, this, &MainWindow::updateTimelineHeight);
KdenliveSettings::setProject_fps(project->fps()); KdenliveSettings::setProject_fps(project->fps());
m_clipMonitorDock->raise(); m_clipMonitorDock->raise();
m_effectStack->transitionConfig()->updateProjectFormat(); m_effectStack->transitionConfig()->updateProjectFormat();
...@@ -3658,6 +3671,12 @@ void MainWindow::forceIconSet(bool force) ...@@ -3658,6 +3671,12 @@ void MainWindow::forceIconSet(bool force)
} }
} }
void MainWindow::updateTimelineHeight()
{
if (pCore->projectManager()->currentTimeline())
m_timelineToolBarContainer->setMaximumHeight(m_timelineToolBar->height() + pCore->projectManager()->currentTimeline()->maximumHeight() + 2);
}
#ifdef DEBUG_MAINW #ifdef DEBUG_MAINW
#undef DEBUG_MAINW #undef DEBUG_MAINW
#endif #endif
...@@ -137,6 +137,8 @@ protected: ...@@ -137,6 +137,8 @@ protected:
/** @brief Restores the window and the file when a session is loaded. */ /** @brief Restores the window and the file when a session is loaded. */
virtual void readProperties(const KConfigGroup &config); virtual void readProperties(const KConfigGroup &config);
virtual void saveNewToolbarConfig(); virtual void saveNewToolbarConfig();
/** @brief Set timeline's maximum height (depending of tracks count). */
void updateTimelineHeight();
private: private:
...@@ -221,7 +223,8 @@ private: ...@@ -221,7 +223,8 @@ private:
KToolBar *m_timelineToolBar; KToolBar *m_timelineToolBar;
QWidget *m_timelineToolBarContainer; QWidget *m_timelineToolBarContainer;
void readOptions(); /** @brief initialize startup values, return true if first run. */
bool readOptions();
void saveOptions(); void saveOptions();
virtual bool event(QEvent *e); virtual bool event(QEvent *e);
......
...@@ -934,6 +934,8 @@ void Timeline::adjustTrackHeaders() ...@@ -934,6 +934,8 @@ void Timeline::adjustTrackHeaders()
for (int i = 1; i < m_tracks.count(); i++) { for (int i = 1; i < m_tracks.count(); i++) {
m_tracks.at(i)->trackHeader->adjustSize(height); m_tracks.at(i)->trackHeader->adjustSize(height);
} }
setMaximumHeight(ruler_frame->height() + (m_tracks.count() - 1) * height + m_tracks.count());
emit updateTimelineHeight();
} }
void Timeline::reloadTrack(int ix, int start, int end) void Timeline::reloadTrack(int ix, int start, int end)
......
...@@ -281,6 +281,8 @@ signals: ...@@ -281,6 +281,8 @@ signals:
void loadingBin(int); void loadingBin(int);
/** @brief We are about to reload timeline, reset bin clip usage */ /** @brief We are about to reload timeline, reset bin clip usage */
void resetUsageCount(); void resetUsageCount();
/** @brief Timeline height changed, inform layout */
void updateTimelineHeight();
}; };
......
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