Skip to content

Commit

Permalink
AutomationClipView_making_shortcut_array_static
Browse files Browse the repository at this point in the history
  • Loading branch information
szeli1 committed Nov 2, 2024
1 parent ab46c0b commit 643cada
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion include/AutomationClipView.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected slots:
void dragEnterEvent( QDragEnterEvent * _dee ) override;
void dropEvent( QDropEvent * _de ) override;

std::vector<ModelShortcut> getShortcuts() override;
const std::vector<ModelShortcut>& getShortcuts() override;
void processShortcutPressed(size_t shortcutLocation, QKeyEvent* event) override;
QString getShortcutMessage() override;
bool canAcceptClipboardData(Clipboard::StringPairDataType dataType) override;
Expand All @@ -79,6 +79,7 @@ protected slots:
QPixmap m_paintPixmap;

static QString m_shortcutMessage;
static std::vector<InteractiveModelView::ModelShortcut> s_shortcutArray;

QStaticText m_staticTextName;
void scaleTimemapToFit( float oldMin, float oldMax );
Expand Down
9 changes: 5 additions & 4 deletions src/gui/clips/AutomationClipView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace lmms::gui
{

QString AutomationClipView::m_shortcutMessage = "";
std::vector<InteractiveModelView::ModelShortcut> AutomationClipView::s_shortcutArray = {};

AutomationClipView::AutomationClipView( AutomationClip * _clip,
TrackView * _parent ) :
Expand All @@ -62,6 +63,8 @@ AutomationClipView::AutomationClipView( AutomationClip * _clip,
if (m_shortcutMessage == "")
{
m_shortcutMessage = buildShortcutMessage();
std::vector<InteractiveModelView::ModelShortcut> s_shortcutArray = ClipView::getShortcuts();
s_shortcutArray.emplace_back(Qt::Key_F, Qt::ControlModifier, 0, QString(tr("Open in Automation editor")), false);
}

setToolTip(m_clip->name());
Expand Down Expand Up @@ -211,11 +214,9 @@ void AutomationClipView::constructContextMenu( QMenu * _cm )
}
}

std::vector<InteractiveModelView::ModelShortcut> AutomationClipView::getShortcuts()
const std::vector<InteractiveModelView::ModelShortcut>& AutomationClipView::getShortcuts()
{
std::vector<InteractiveModelView::ModelShortcut> clipShortcuts = ClipView::getShortcuts();
clipShortcuts.emplace_back(Qt::Key_F, Qt::ControlModifier, 0, QString(tr("Open in Automation editor")), false);
return clipShortcuts;
return s_shortcutArray;
}

void AutomationClipView::processShortcutPressed(size_t shortcutLocation, QKeyEvent* event)
Expand Down

0 comments on commit 643cada

Please sign in to comment.