Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/FileBrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private slots:
void activateListItem(QTreeWidgetItem* item, int column);
void openInNewInstrumentTrack(FileItem* item, bool songEditor);
bool openInNewSampleTrack(FileItem* item);
void openInSlicerT(FileItem* item);
void openInSlicerT(FileItem* item, bool songEditor);
void sendToActiveInstrumentTrack(FileItem* item);
void updateDirectory(QTreeWidgetItem* item);
} ;
Expand Down
11 changes: 7 additions & 4 deletions src/gui/FileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -696,11 +696,14 @@ void FileBrowserTreeWidget::contextMenuEvent(QContextMenuEvent* e)
if (!contextMenu.isEmpty()) { contextMenu.exec(e->globalPos()); }
}

void FileBrowserTreeWidget::openInSlicerT(FileItem* item)
void FileBrowserTreeWidget::openInSlicerT(FileItem* item, bool songEditor)
{
TrackContainer* tc = Engine::getSong();
// Get the right TrackContainer. Ternary doesn't compile due to a type mismatch
// (similar to FileBrowserTreeWidget::openInNewInstrumentTrack)
TrackContainer* tc = Engine::getSong();
if (!songEditor) { tc = Engine::patternStore(); }

auto* track = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, tc));
auto* track = dynamic_cast<InstrumentTrack*>(Track::create(Track::Type::Instrument, tc));

track->loadInstrument("slicert");
track->instrument()->loadFile(item->fullName());
Expand Down Expand Up @@ -733,7 +736,7 @@ QList<QAction*> FileBrowserTreeWidget::getContextActions(FileItem* file, bool so
{
auto openInSlicer = new QAction(tr("Send to new SlicerT instance"));
connect(openInSlicer, &QAction::triggered,
[=, this]{ openInSlicerT(file); });
[=, this]{ openInSlicerT(file, songEditor); });
result.append(openInSlicer);
}

Expand Down
Loading