Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Continue mainwindow cleanup

parent b9beda06
......@@ -123,6 +123,27 @@ void MarkerListModel::removeMarker(GenTime pos)
}
}
void MarkerListModel::removeAllMarkers()
{
QWriteLocker locker(&m_lock);
Fun undo = []() { return true; };
Fun redo = []() { return true; };
bool res = false;
QList <GenTime> times;
// Collect marker positions
for (const auto &marker : m_markerList) {
times << marker.first;
}
// delete
for (int i = 0; i < times.count(); i++) {
res = removeMarker(times.at(i), undo, redo);
}
if (res) {
PUSH_UNDO(undo, redo, m_guide ? i18n("Delete all guides") : i18n("Delete all markers"));
}
}
void MarkerListModel::editMarker(GenTime oldPos, GenTime pos, const QString &comment, int type)
{
QWriteLocker locker(&m_lock);
......
......@@ -70,6 +70,7 @@ protected:
public:
/* @brief Removes the marker at the given position. */
void removeMarker(GenTime pos);
void removeAllMarkers();
protected:
/* @brief Same function but accumulates undo/redo */
......
This diff is collapsed.
......@@ -353,7 +353,7 @@ private slots:
void slotRemoveSpace();
void slotRemoveAllSpace();
void slotAddGuide();
void slotEditGuide(int pos = -1, const QString &text = QString());
void slotEditGuide();
void slotDeleteGuide();
void slotDeleteAllGuides();
void slotGuidesUpdated();
......
......@@ -2083,13 +2083,6 @@ void Monitor::slotEditInlineMarker()
}
oldMarker.setComment(newComment);
pCore->projectManager()->current()->addGuides(QList<CommentedTime>() << oldMarker);
/*QString currentComment = m_ruler->markerAt(render->seekPosition());
QString newComment = root->property("markerText").toString();
if (newComment == currentComment) {
// No change
return;
}
emit updateGuide(render->seekFramePosition(), newComment);*/
}
}
}
......
......@@ -361,10 +361,6 @@ signals:
void addEffect(const QDomElement &);
void addMasterEffect(const QString &, const QDomElement &);
void passKeyPress(QKeyEvent *);
/** @brief Update the text of a clip marker. */
void updateClipMarker(const QString &, const QList<CommentedTime> &);
/** @brief Update the text of a timeline guide. */
void updateGuide(int, const QString &);
/** @brief Enable / disable project monitor multitrack view (split view with one track in each quarter). */
void multitrackView(bool);
void requestAudioThumb(const QString &);
......
......@@ -336,6 +336,9 @@ void TimelineController::editMarker(const QString &cid, int frame)
void TimelineController::editGuide(int frame)
{
bool markerFound = false;
if (frame == -1) {
frame = m_position;
}
CommentedTime marker = pCore->projectManager()->current()->getGuideModel().get()->getMarker(GenTime(frame, pCore->getCurrentFps()), &markerFound);
Q_ASSERT(markerFound);
QPointer<MarkerDialog> d = new MarkerDialog(nullptr, marker, pCore->bin()->projectTimecode(), i18n("Edit Marker"), qApp->activeWindow());
......@@ -352,7 +355,7 @@ void TimelineController::editGuide(int frame)
}
}
void TimelineController::switchGuide(int frame)
void TimelineController::switchGuide(int frame, bool deleteOnly)
{
bool markerFound = false;
if (frame == -1) {
......@@ -360,6 +363,10 @@ void TimelineController::switchGuide(int frame)
}
CommentedTime marker = pCore->projectManager()->current()->getGuideModel().get()->getMarker(GenTime(frame, pCore->getCurrentFps()), &markerFound);
if (!markerFound) {
if (deleteOnly) {
pCore->displayMessage(i18n("No guide found at current position"), InformationMessage, 500);
return;
}
marker = CommentedTime(GenTime(frame, pCore->getCurrentFps()), i18n("guide"));
} else {
marker.setMarkerType(-1);
......@@ -499,6 +506,13 @@ void TimelineController::seekToMouse()
setPosition(mousePos);
}
int TimelineController::getMousePos()
{
QVariant returnedValue;
QMetaObject::invokeMethod(m_root, "getMousePos", Q_RETURN_ARG(QVariant, returnedValue));
return returnedValue.toInt();
}
void TimelineController::refreshItem(int id)
{
int in = m_model->getItemPosition(id);
......
......@@ -142,10 +142,10 @@ public:
Q_INVOKABLE void editMarker(const QString &cid, int frame);
/* @brief Ask for edit timeline guide dialog
*/
Q_INVOKABLE void editGuide(int frame);
Q_INVOKABLE void editGuide(int frame = -1);
/* @brief Add a timeline guide
*/
Q_INVOKABLE void switchGuide(int frame = -1);
Q_INVOKABLE void switchGuide(int frame = -1, bool deleteOnly = false);
/* @brief Request monitor refresh
*/
Q_INVOKABLE void requestRefresh();
......@@ -213,6 +213,9 @@ public:
/* @brief Returns a list of all luma files used in the project
*/
QStringList extractCompositionLumas() const;
/* @brief Get the frame where mouse is positionned
*/
int getMousePos();
public slots:
void selectMultitrack();
......
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