CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscene, QWidget *parent) :
QGraphicsView(projectscene, parent),
- m_tracksHeight(KdenliveSettings::trackheight()),
+ m_tracksHeight(KdenliveSettings::defaulttrackheight()),
m_projectDuration(0),
m_cursorPos(0),
m_document(doc),
else m_commandStack = NULL;
setMouseTracking(true);
setAcceptDrops(true);
+ KdenliveSettings::setTrackheight(m_tracksHeight);
m_animationTimer = new QTimeLine(800);
m_animationTimer->setFrameRange(0, 5);
m_animationTimer->setUpdateInterval(100);
return m_scene->m_tracksList;
}*/
-void CustomTrackView::checkTrackHeight()
+void CustomTrackView::checkTrackHeight(bool resetTrackHeight)
{
+ if (resetTrackHeight) {
+ KdenliveSettings::setTrackheight(KdenliveSettings::defaulttrackheight());
+ }
if (m_tracksHeight == KdenliveSettings::trackheight()) return;
m_tracksHeight = KdenliveSettings::trackheight();
- emit trackHeightChanged();
+ emit trackHeightChanged(resetTrackHeight);
QList<QGraphicsItem *> itemList = items();
ClipItem *item;
Transition *transitionitem;
setSceneRect(0, 0, sceneRect().width(), m_tracksHeight * m_document->tracksCount());
// verticalScrollBar()->setMaximum(m_tracksHeight * m_document->tracksCount());
KdenliveSettings::setSnaptopoints(snap);
- update();
+ viewport()->update();
}
/** Zoom or move viewport on mousewheel
// virtual
void CustomTrackView::mousePressEvent(QMouseEvent * event)
{
- kDebug() << "mousePressEvent STARTED";
+ //kDebug() << "mousePressEvent STARTED";
setFocus(Qt::MouseFocusReason);
m_menuPosition = QPoint();
}
m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
setSceneRect(0, 0, sceneRect().width(), maxHeight);
- QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
+ QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
viewport()->update();
//setFixedHeight(50 * m_tracksCount);
}
}
m_cursorLine->setLine(m_cursorLine->line().x1(), 0, m_cursorLine->line().x1(), maxHeight);
setSceneRect(0, 0, sceneRect().width(), maxHeight);
- QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
+ QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
viewport()->update();
}
int tracknumber = m_document->tracksCount() - ix;
m_document->setTrackType(tracknumber - 1, type);
m_document->renderer()->mltChangeTrackState(tracknumber, m_document->trackInfoAt(tracknumber - 1).isMute, m_document->trackInfoAt(tracknumber - 1).isBlind);
- QTimer::singleShot(300, this, SIGNAL(trackHeightChanged()));
+ QTimer::singleShot(300, this, SIGNAL(trackHeightChanged(false)));
viewport()->update();
}
resetSelectionGroup(false);
m_operationMode = NONE;
} else if (m_operationMode == RUBBERSELECTION) {
- kDebug() << "// END RUBBER SELECT";
+ //kDebug() << "// END RUBBER SELECT";
resetSelectionGroup();
groupSelectedItems();
m_operationMode = NONE;
m_document->setModified(true);
}
}
-
+ m_document->renderer()->doRefresh();
} else if (m_operationMode == RESIZESTART && m_dragItem->startPos() != m_dragItemInfo.startPos) {
// resize start
if (m_dragItem->type() == AVWIDGET) {
// undo last move and emit error message
emit displayMessage(i18n("Cannot move clip to position %1", m_document->timecode().getTimecodeFromFrames(end.startPos.frames(m_document->fps()))), ErrorMessage);
}
- kDebug() << " // MOVED CLIP TO: " << end.startPos.frames(25) << ", ITEM START: " << item->startPos().frames(25);
+ m_document->renderer()->doRefresh();
+ //kDebug() << " // MOVED CLIP TO: " << end.startPos.frames(25) << ", ITEM START: " << item->startPos().frames(25);
}
void CustomTrackView::moveGroup(QList <ItemInfo> startClip, QList <ItemInfo> startTransition, const GenTime offset, const int trackOffset, bool reverseMove)
}
}
KdenliveSettings::setSnaptopoints(snap);
+ m_document->renderer()->doRefresh();
} else kDebug() << "///////// WARNING; NO GROUP TO MOVE";
}
}
emit transitionItemSelected(item, getPreviousVideoTrack(item->track()), p);
}
+ m_document->renderer()->doRefresh();
}
void CustomTrackView::resizeClip(const ItemInfo start, const ItemInfo end)
}
}
-void CustomTrackView::drawBackground(QPainter * painter, const QRectF & rect)
+void CustomTrackView::drawBackground(QPainter * painter, const QRectF &rect)
{
QRectF r = rect;
r.setWidth(r.width() + 1);
void deleteSelectedClips();
void cutSelectedClips();
void setContextMenu(QMenu *timeline, QMenu *clip, QMenu *transition, QActionGroup *clipTypeGroup);
- void checkTrackHeight();
+ void checkTrackHeight(bool resetTrackHeight = false);
//QList <TrackInfo> tracksList() const;
void setTool(PROJECTTOOL tool);
void cutClip(ItemInfo info, GenTime cutTime, bool cut);
void clipItemSelected(ClipItem*, int ix = -1);
void transitionItemSelected(Transition*, int track = 0, QPoint p = QPoint(), bool update = false);
void activateDocumentMonitor();
- void trackHeightChanged();
+ void trackHeightChanged(bool zoom);
void displayMessage(const QString, MessageType);
void showClipFrame(DocClipBase *, const int);
void doTrackLock(int, bool);
setFixedHeight(KdenliveSettings::trackheight());
m_view.setupUi(this);
m_view.track_number->setText(QString::number(m_index));
+
m_view.buttonVideo->setChecked(!info.isBlind);
m_view.buttonVideo->setToolTip(i18n("Hide track"));
m_view.buttonAudio->setChecked(!info.isMute);
connect(m_view.buttonAudio, SIGNAL(clicked()), this, SLOT(switchAudio()));
connect(m_view.buttonLock, SIGNAL(clicked()), this, SLOT(switchLock()));
+ // Don't show track buttons if size is too small
+ if (KdenliveSettings::trackheight() < 40) {
+ m_view.buttonVideo->setHidden(true);
+ m_view.buttonAudio->setHidden(true);
+ m_view.buttonLock->setHidden(true);
+ //m_view.horizontalSpacer;
+ }
+
setContextMenuPolicy(Qt::ActionsContextMenu);
QAction *insertAction = new QAction(i18n("Insert Track"), this);
addAction(insertAction);
<default>true</default>
</entry>
- <entry name="trackheight" type="Int">
+ <entry name="defaulttrackheight" type="Int">
<label>Tracks height in pixel.</label>
<default>50</default>
</entry>
<group name="unmanaged">
+ <entry name="trackheight" type="Int">
+ <label>Tracks height in pixel.</label>
+ <default>50</default>
+ </entry>
+
<entry name="project_display_ratio" type="Double">
<label>Current project display ratio.</label>
<default>1.7777778</default>
if (m_activeTimeline) {
m_activeTimeline->refresh();
m_activeTimeline->projectView()->checkAutoScroll();
- m_activeTimeline->projectView()->checkTrackHeight();
+ m_activeTimeline->projectView()->checkTrackHeight(true);
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
QWidget(parent),
m_scale(1.0),
m_projectTracks(0),
- m_doc(doc)
+ m_doc(doc),
+ m_verticalZoom(1)
{
m_view.setupUi(this);
m_view.ruler_frame->setLayout(layout);
layout->addWidget(m_ruler);
+
+ QHBoxLayout *sizeLayout = new QHBoxLayout;
+ sizeLayout->setContentsMargins(0, 0, 0, 0);
+ sizeLayout->setSpacing(0);
+ m_view.size_frame->setLayout(sizeLayout);
+
+ QString style1 = "QToolButton {border-style: none;margin: 0px 3px;padding: 0px;} QToolButton:pressed:hover { background-color: rgba(224, 224, 0, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;} QToolButton:hover { background-color: rgba(255, 255, 255, 100); border-style: inset; border:1px solid #cc6666;border-radius: 3px;}";
+
+ QToolButton *butSmall = new QToolButton(this);
+ butSmall->setIcon(KIcon("kdenlive-zoom-small"));
+ connect(butSmall, SIGNAL(clicked()), this, SLOT(slotVerticalZoomDown()));
+ sizeLayout->addWidget(butSmall);
+
+ QToolButton *butLarge = new QToolButton(this);
+ butLarge->setIcon(KIcon("kdenlive-zoom-large"));
+ connect(butLarge, SIGNAL(clicked()), this, SLOT(slotVerticalZoomUp()));
+ sizeLayout->addWidget(butLarge);
+ m_view.size_frame->setStyleSheet(style1);
+
+
QHBoxLayout *tracksLayout = new QHBoxLayout;
tracksLayout->setContentsMargins(0, 0, 0, 0);
tracksLayout->setSpacing(0);
tracksLayout->addWidget(m_trackview);
connect(m_trackview->verticalScrollBar(), SIGNAL(valueChanged(int)), m_view.headers_area->verticalScrollBar(), SLOT(setValue(int)));
- connect(m_trackview, SIGNAL(trackHeightChanged()), this, SLOT(slotRebuildTrackHeaders()));
+ connect(m_trackview, SIGNAL(trackHeightChanged(bool)), this, SLOT(slotRebuildTrackHeaders(bool)));
parseDocument(m_doc->toXml());
m_doc->setSceneList();
slotSetZone(m_doc->zone());
}
+TrackView::~TrackView()
+{
+ delete m_ruler;
+ delete m_trackview;
+}
int TrackView::duration() const
{
m_trackview->loadGroups(groups);
m_trackview->setDuration(duration);
kDebug() << "/////////// TOTAL PROJECT DURATION: " << duration;
-
+
// Remove Kdenlive extra info from xml doc before sending it to MLT
QDomElement mlt = doc.firstChildElement("mlt");
QDomElement infoXml = mlt.firstChildElement("kdenlivedoc");
mlt.removeChild(infoXml);
-
+
slotRebuildTrackHeaders();
if (!m_documentErrors.isNull()) KMessageBox::sorry(this, m_documentErrors);
//m_trackview->setCursorPos(cursorPos);
m_trackview->viewport()->update();
}
-void TrackView::slotRebuildTrackHeaders()
+void TrackView::slotRebuildTrackHeaders(bool resetZoom)
{
+ // If the slot was triggered by a change in default track size, reset vertical zoom
+ if (resetZoom) m_verticalZoom = 1;
QList <TrackInfo> list = m_doc->tracksList();
QLayoutItem *child;
while ((child = m_headersLayout->takeAt(0)) != 0) {
connect(header, SIGNAL(changeTrack(int)), this, SIGNAL(changeTrack(int)));
m_headersLayout->addWidget(header);
}
- m_view.headers_container->adjustSize();
+ //m_view.headers_container->adjustSize();
}
widgets.at(ix)->setLock(lock);
}
+void TrackView::slotVerticalZoomDown()
+{
+ if (m_verticalZoom == 0) return;
+ m_verticalZoom--;
+ KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() / 2);
+ m_trackview->checkTrackHeight(false);
+}
+
+void TrackView::slotVerticalZoomUp()
+{
+ if (m_verticalZoom == 2) return;
+ m_verticalZoom++;
+ KdenliveSettings::setTrackheight(KdenliveSettings::trackheight() * 2);
+ m_trackview->checkTrackHeight(false);
+}
#include "trackview.moc"
public:
explicit TrackView(KdenliveDoc *doc, QWidget *parent = 0);
-
+ virtual ~ TrackView();
void setEditMode(const QString & editMode);
const QString & editMode() const;
QGraphicsScene *projectScene();
CustomTrackScene *m_scene;
KdenliveDoc *m_doc;
+ int m_verticalZoom;
QVBoxLayout *m_headersLayout;
QString m_documentErrors;
void parseDocument(QDomDocument doc);
private slots:
void setCursorPos(int pos);
void moveCursorPos(int pos);
- void slotRebuildTrackHeaders();
+ void slotRebuildTrackHeaders(bool resetZoom = false);
void slotChangeTrackLock(int ix, bool lock);
+ void slotVerticalZoomDown();
+ void slotVerticalZoomUp();
signals:
void mousePosition(int);