Better timeline layout on first startup

parent 1a7046d2
......@@ -3298,3 +3298,8 @@ void Bin::invalidateClip(const QString &binId)
}
}
}
QSize Bin::sizeHint() const
{
return QSize(350, 800);
}
......@@ -373,6 +373,7 @@ protected:
void selectClip(const std::shared_ptr<ProjectClip> &clip);
void contextMenuEvent(QContextMenuEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event) override;
QSize sizeHint() const override;
private:
std::shared_ptr<ProjectItemModel> m_itemModel;
......
......@@ -221,7 +221,7 @@ void MainWindow::init()
setDockOptions(dockOptions() | QMainWindow::GroupedDragging);
setTabPosition(Qt::AllDockWidgetAreas, (QTabWidget::TabPosition)KdenliveSettings::tabposition());
m_timelineToolBar = toolBar(QStringLiteral("timelineToolBar"));
m_timelineToolBarContainer = new QWidget(this);
m_timelineToolBarContainer = new TimelineContainer(this);
auto *ctnLay = new QVBoxLayout;
ctnLay->setSpacing(0);
ctnLay->setContentsMargins(0, 0, 0, 0);
......@@ -236,7 +236,6 @@ void MainWindow::init()
fr->setMaximumHeight(1);
fr->setLineWidth(1);
ctnLay->addWidget(fr);
setCentralWidget(m_timelineToolBarContainer);
setupActions();
QDockWidget *libraryDock = addDock(i18n("Library"), QStringLiteral("library"), pCore->library());
......@@ -291,6 +290,7 @@ void MainWindow::init()
m_timelineTabs = new TimelineTabs(this);
ctnLay->addWidget(m_timelineTabs);
setCentralWidget(m_timelineToolBarContainer);
// Screen grab widget
QWidget *grabWidget = new QWidget(this);
......
......@@ -57,6 +57,7 @@ class Render;
class RenderWidget;
class TimelineTabs;
class TimelineWidget;
class TimelineContainer;
class Transition;
class MltErrorEvent : public QEvent
......@@ -224,7 +225,7 @@ private:
QString m_theme;
KIconLoader *m_iconLoader;
KToolBar *m_timelineToolBar;
QWidget *m_timelineToolBarContainer;
TimelineContainer *m_timelineToolBarContainer;
QLabel *m_trimLabel;
/** @brief initialize startup values, return true if first run. */
......
......@@ -6,13 +6,11 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import Kdenlive.Controls 1.0
import QtQuick.Window 2.2
import 'Timeline.js' as Logic
Rectangle {
id: root
objectName: "timelineview"
SystemPalette { id: activePalette }
color: activePalette.window
property bool validMenu: false
......
......@@ -29,6 +29,16 @@
#include "timelinecontroller.h"
#include "timelinewidget.h"
TimelineContainer::TimelineContainer(QWidget *parent)
:QWidget(parent)
{
}
QSize TimelineContainer::sizeHint() const
{
return QSize(800, 200);
}
TimelineTabs::TimelineTabs(QWidget *parent)
: QTabWidget(parent)
, m_mainTimeline(new TimelineWidget(this))
......@@ -90,3 +100,8 @@ void TimelineTabs::disconnectTimeline(TimelineWidget *timeline)
disconnect(timeline->controller(), &TimelineController::showItemEffectStack, this, &TimelineTabs::showItemEffectStack);
delete timeline;
}
QSize TimelineTabs::sizeHint() const
{
return QSize(800, 300);
}
......@@ -31,6 +31,17 @@
class TimelineWidget;
class AssetParameterModel;
class EffectStackModel;
class TimelineContainer : public QWidget
{
public:
TimelineContainer(QWidget *parent);
protected:
QSize sizeHint() const override;
};
class TimelineTabs : public QTabWidget
{
Q_OBJECT
......@@ -49,6 +60,7 @@ 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
......
......@@ -56,8 +56,12 @@ TimelineWidget::TimelineWidget(QWidget *parent)
{
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine());
#if KDECLARATIVE_VERSION >= QT_VERSION_CHECK(5, 45, 0)
kdeclarative.setupEngine(engine());
kdeclarative.setupContext();
#else
kdeclarative.setupBindings();
#endif
setClearColor(palette().window().color());
registerTimelineItems();
// Build transition model for context menu
......@@ -228,3 +232,8 @@ void TimelineWidget::focusTimeline()
rootObject()->setFocus(true);
}
}
QSize TimelineWidget::sizeHint() const
{
return QSize(800, 300);
}
......@@ -56,6 +56,7 @@ 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