Make context menu "Extract" clearer (rename and add icon), and disable if no track is active

parent 5489327a
Pipeline #9137 passed with stage
in 16 minutes and 46 seconds
......@@ -11,6 +11,7 @@ Menu {
property bool grouped
property bool canBeAudio
property bool canBeVideo
property bool hasActiveTrack
property bool canBeGrouped: timeline.isInSelection(clipId)
onAboutToHide: {
......@@ -18,6 +19,7 @@ Menu {
}
onAboutToShow: {
canBeGrouped = timeline.isInSelection(clipId)
hasActiveTrack = timeline.hasActiveTracks()
}
MenuItem {
......@@ -105,8 +107,10 @@ Menu {
onTriggered: timeline.triggerAction('delete_timeline_clip')
}
MenuItem {
enabled: hasActiveTrack
visible: true
text: i18n("Extract")
text: i18n("Extract Clip")
iconName: 'timeline-extract'
onTriggered: timeline.extract(clipId)
}
MenuSeparator {
......
......@@ -2622,3 +2622,16 @@ void TimelineController::updateAudioTarget()
m_audioTargetActive = false;
}
}
bool TimelineController::hasActiveTracks() const
{
auto it = m_model->m_allTracks.cbegin();
while (it != m_model->m_allTracks.cend()) {
int target_track = (*it)->getId();
if (m_model->getTrackById_const(target_track)->shouldReceiveTimelineOp()) {
return true;
}
++it;
}
return false;
}
......@@ -130,6 +130,10 @@ public:
*/
Q_INVOKABLE void showConfig(int page, int tab);
/* @brief Returns true if we have at least one active track
*/
Q_INVOKABLE bool hasActiveTracks() const;
/* @brief returns current timeline's zoom factor
*/
Q_INVOKABLE double scaleFactor() const;
......
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