Make Select ALl and Delete shortcuts work in clip marker list.

Related to #660
parent c2d7a770
......@@ -2359,6 +2359,8 @@ void Bin::showClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forc
}
ClipPropertiesController *panel = clip->buildProperties(m_propertiesPanel);
connect(this, &Bin::refreshTimeCode, panel, &ClipPropertiesController::slotRefreshTimeCode);
connect(this, &Bin::deleteMarkers, panel, &ClipPropertiesController::slotDeleteSelectedMarkers);
connect(this, &Bin::selectMarkers, panel, &ClipPropertiesController::slotSelectAllMarkers);
connect(panel, &ClipPropertiesController::updateClipProperties, this, &Bin::slotEditClipCommand);
connect(panel, &ClipPropertiesController::seekToFrame, m_monitor, static_cast<void (Monitor::*)(int)>(&Monitor::slotSeek));
connect(panel, &ClipPropertiesController::editClip, this, &Bin::slotEditClip);
......
......@@ -502,6 +502,10 @@ signals:
void setupTargets(bool hasVideo, QList <int> audioStreams);
/** @brief A drag event ended, inform timeline. */
void processDragEnd();
/** @brief Delete selected markers in clip properties dialog. */
void deleteMarkers();
/** @brief Selected all markers in clip properties dialog. */
void selectMarkers();
};
#endif
......@@ -459,7 +459,7 @@ bool MarkerListModel::removeAllMarkers()
return true;
}
bool MarkerListModel::editMarkerGui(const GenTime &pos, QWidget *parent, bool createIfNotFound, ClipController *clip)
bool MarkerListModel::editMarkerGui(const GenTime &pos, QWidget *parent, bool createIfNotFound, ClipController *clip, bool createOnly)
{
bool exists;
auto marker = getMarker(pos, &exists);
......@@ -476,7 +476,7 @@ bool MarkerListModel::editMarkerGui(const GenTime &pos, QWidget *parent, bool cr
if (dialog->exec() == QDialog::Accepted) {
marker = dialog->newMarker();
if (exists) {
if (exists && !createOnly) {
return editMarker(pos, marker.time(), marker.comment(), marker.markerType());
}
return addMarker(marker.time(), marker.comment(), marker.markerType());
......
......@@ -124,7 +124,7 @@ public:
@param clip: pointer to the clip if we are editing a marker
@return true if dialog was accepted and modification successful
*/
bool editMarkerGui(const GenTime &pos, QWidget *parent, bool createIfNotFound, ClipController *clip = nullptr);
bool editMarkerGui(const GenTime &pos, QWidget *parent, bool createIfNotFound, ClipController *clip = nullptr, bool createOnly = false);
// Mandatory overloads
QVariant data(const QModelIndex &index, int role) const override;
......
......@@ -2432,6 +2432,10 @@ void MainWindow::slotDeleteItem()
m_assetPanel->deleteCurrentEffect();
return;
}
if (widget == pCore->bin()->clipPropertiesDock()) {
pCore->bin()->deleteMarkers();
return;
}
widget = widget->parentWidget();
}
......@@ -2614,12 +2618,17 @@ void MainWindow::slotSelectTrack()
void MainWindow::slotSelectAllTracks()
{
if ((QApplication::focusWidget() != nullptr) && (QApplication::focusWidget()->parentWidget() != nullptr) &&
QApplication::focusWidget()->parentWidget() == pCore->bin()) {
pCore->bin()->selectAll();
} else {
getCurrentTimeline()->controller()->selectAll();
if (QApplication::focusWidget() != nullptr) {
if (QApplication::focusWidget()->parentWidget() != nullptr && QApplication::focusWidget()->parentWidget() == pCore->bin()) {
pCore->bin()->selectAll();
return;
}
if (QApplication::focusWidget()->objectName() == QLatin1String("markers_list")) {
pCore->bin()->selectMarkers();
return;
}
}
getCurrentTimeline()->controller()->selectAll();
}
void MainWindow::slotUnselectAllTracks()
......
......@@ -206,6 +206,7 @@ ClipPropertiesController::ClipPropertiesController(ClipController *controller, Q
m_markerTree->setHeaderHidden(true);
m_markerTree->setSelectionMode(QAbstractItemView::ExtendedSelection);
m_markerTree->setModel(controller->getMarkerModel().get());
m_markerTree->setObjectName("markers_list");
mBox->addWidget(m_markerTree);
auto *bar = new QToolBar;
bar->addAction(QIcon::fromTheme(QStringLiteral("document-new")), i18n("Add marker"), this, SLOT(slotAddMarker()));
......@@ -1121,7 +1122,7 @@ void ClipPropertiesController::slotAddMarker()
{
auto markerModel = m_controller->getMarkerModel();
GenTime pos(m_controller->originalProducer()->position(), m_tc.fps());
markerModel->editMarkerGui(pos, this, true, m_controller);
markerModel->editMarkerGui(pos, this, true, m_controller, true);
}
void ClipPropertiesController::slotSaveMarkers()
......@@ -1376,3 +1377,17 @@ void ClipPropertiesController::slotTextChanged()
emit updateClipProperties(m_id, m_originalProperties, properties);
m_originalProperties = properties;
}
void ClipPropertiesController::slotDeleteSelectedMarkers()
{
if (m_tabWidget->currentIndex() == 2) {
slotDeleteMarker();
}
}
void ClipPropertiesController::slotSelectAllMarkers()
{
if (m_tabWidget->currentIndex() == 2) {
m_markerTree->selectAll();
}
}
......@@ -67,6 +67,8 @@ public slots:
void slotRefreshTimeCode();
void slotFillMeta(QTreeWidget *tree);
void slotFillAnalysisData();
void slotDeleteSelectedMarkers();
void slotSelectAllMarkers();
private slots:
void slotColorModified(const QColor &newcolor);
......
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