ui: implemented keyboard controls for inserting/overwriting footage into the

timeline

Allows users to use the keyboard to place footage into the timeline rather than
forcing them to drag.
This commit is contained in:
itsmattkc
2020-03-03 20:03:50 +11:00
parent a9577d72ee
commit 9b73892c41
10 changed files with 300 additions and 176 deletions
+33
View File
@@ -25,6 +25,7 @@
#include "core.h"
#include "panel/footageviewer/footageviewer.h"
#include "panel/timeline/timeline.h"
#include "panel/panelmanager.h"
#include "project/item/sequence/sequence.h"
#include "widget/menu/menushared.h"
@@ -113,6 +114,24 @@ void ProjectPanel::DeselectAll()
explorer_->DeselectAll();
}
void ProjectPanel::Insert()
{
TimelinePanel* timeline = PanelManager::instance()->MostRecentlyFocused<TimelinePanel>();
if (timeline) {
timeline->InsertFootageAtPlayhead(GetSelectedFootage());
}
}
void ProjectPanel::Overwrite()
{
TimelinePanel* timeline = PanelManager::instance()->MostRecentlyFocused<TimelinePanel>();
if (timeline) {
timeline->OverwriteFootageAtPlayhead(GetSelectedFootage());
}
}
void ProjectPanel::Edit(Item* item)
{
explorer_->Edit(item);
@@ -156,3 +175,17 @@ void ProjectPanel::ProjectNameChanged()
SetSubtitle(project()->name());
}
}
QList<Footage *> ProjectPanel::GetSelectedFootage()
{
QList<Item*> items = SelectedItems();
QList<Footage*> footage;
foreach (Item* i, items) {
if (i->type() == Item::kFootage) {
footage.append(static_cast<Footage*>(i));
}
}
return footage;
}