Add make all tracks in/active (Shift+Alt+a)

parent 01c81aff
......@@ -346,10 +346,10 @@ QDomDocument KdenliveDoc::createEmptyDocument(int videotracks, int audiotracks)
videoTrack.duration = 0;
tracks.append(videoTrack);
}
return createEmptyDocument(tracks, audiotracks);
return createEmptyDocument(tracks);
}
QDomDocument KdenliveDoc::createEmptyDocument(const QList<TrackInfo> &tracks, int audiotracks)
QDomDocument KdenliveDoc::createEmptyDocument(const QList<TrackInfo> &tracks)
{
// Creating new document
QDomDocument doc;
......
......@@ -192,7 +192,7 @@ private:
/** @brief Creates a new project. */
QDomDocument createEmptyDocument(int videotracks, int audiotracks);
QDomDocument createEmptyDocument(const QList<TrackInfo> &tracks, int audiotracks);
QDomDocument createEmptyDocument(const QList<TrackInfo> &tracks);
/** @brief Updates the project folder location entry in the kdenlive file dialogs to point to the current project folder. */
void updateProjectFolderPlacesEntry();
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="178" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="179" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
......@@ -146,6 +146,7 @@
<Action name="switch_track_target" />
<Action name="switch_active_target" />
<Action name="switch_all_targets" />
<Action name="activate_all_targets" />
</Menu>
<Separator />
<Menu name="video_effects_menu" ><text>Add Effect</text>
......
......@@ -1692,7 +1692,9 @@ void MainWindow::setupActions()
addAction(QStringLiteral("switch_active_target"), i18n("Toggle Track Active"), pCore->projectManager(), SLOT(slotSwitchTrackActive()), QIcon(),
Qt::Key_A);
addAction(QStringLiteral("switch_all_targets"), i18n("Toggle All Tracks Active"), pCore->projectManager(), SLOT(slotSwitchAllTrackActive()), QIcon(),
Qt::SHIFT + Qt::Key_A);
Qt::SHIFT + Qt::Key_A);
addAction(QStringLiteral("activate_all_targets"), i18n("Switch All Tracks Active"), pCore->projectManager(), SLOT(slotMakeAllTrackActive()), QIcon(),
Qt::SHIFT + Qt::ALT + Qt::Key_A);
addAction(QStringLiteral("add_project_note"), i18n("Add Project Note"), pCore->projectManager(), SLOT(slotAddProjectNote()),
QIcon::fromTheme(QStringLiteral("bookmark")));
......
......@@ -758,6 +758,11 @@ void ProjectManager::slotSwitchAllTrackActive()
pCore->window()->getMainTimeline()->controller()->switchAllTrackActive();
}
void ProjectManager::slotMakeAllTrackActive()
{
pCore->window()->getMainTimeline()->controller()->makeAllTrackActive();
}
void ProjectManager::slotSwitchAllTrackLock()
{
pCore->window()->getMainTimeline()->controller()->switchTrackLock(true);
......
......@@ -139,7 +139,10 @@ public slots:
/** @brief Make current timeline track active/inactive*/
void slotSwitchTrackActive();
/** @brief Toogle the active/inactive state of all tracks*/
void slotSwitchAllTrackActive();
/** @brief Make all tracks active or inactive */
void slotMakeAllTrackActive();
/** @brief Un/Set current track as target */
void slotSwitchTrackTarget();
......
......@@ -2099,6 +2099,27 @@ void TimelineController::switchAllTrackActive()
}
}
void TimelineController::makeAllTrackActive()
{
// Check current status
auto it = m_model->m_allTracks.cbegin();
bool makeActive = false;
while (it != m_model->m_allTracks.cend()) {
if (!(*it)->isTimelineActive()) {
// There is an inactive track, activate all
makeActive = true;
break;
}
++it;
}
it = m_model->m_allTracks.cbegin();
while (it != m_model->m_allTracks.cend()) {
int target_track = (*it)->getId();
m_model->setTrackProperty(target_track, QStringLiteral("kdenlive:timeline_active"), makeActive ? QStringLiteral("1") : QStringLiteral("0"));
++it;
}
}
void TimelineController::switchTrackLock(bool applyToAll)
{
if (!applyToAll) {
......
......@@ -387,8 +387,12 @@ public:
Q_INVOKABLE void removeEffectKeyframe(int cid, int frame);
Q_INVOKABLE void updateEffectKeyframe(int cid, int oldFrame, int newFrame, const QVariant &normalizedValue = QVariant());
/** @brief Make current timeline track active/inactive*/
Q_INVOKABLE void switchTrackActive(int trackId = -1);
/** @brief Toogle the active/inactive state of all tracks*/
void switchAllTrackActive();
/** @brief Make all tracks active or inactive */
void makeAllTrackActive();
void switchTrackLock(bool applyToAll = false);
void switchTargetTrack();
......
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