Skip to content

Commit

Permalink
Command Palette: add easing actions
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Aug 20, 2024
1 parent 1cc81da commit 2c49880
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
17 changes: 16 additions & 1 deletion src/app/GUI/extraactions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,5 +505,20 @@ void MainWindow::setupMenuExtras()
cmdAddAction(act);
}
}
//
// Easing
{
const QIcon easeIcon(QIcon::fromTheme("easing"));
const auto presets = AppSupport::getEasingPresets();
for (const auto &preset : presets) {
const auto presetAct = new QAction(easeIcon, preset.second, this);
presetAct->setData(preset.first);
cmdAddAction(presetAct);
connect(presetAct, &QAction::triggered,
this, [this, presetAct]() {
const auto scene = *mDocument.fActiveScene;
if (!scene) { return; }
scene->setEasingAction(presetAct->text());
});
}
}
}
11 changes: 8 additions & 3 deletions src/app/GUI/keysview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,20 @@ void KeysView::dragMoveEvent(QDragMoveEvent *event) {
}
}

void KeysView::setCurrentScene(Canvas * const scene) {
if(mCurrentScene) {
void KeysView::setCurrentScene(Canvas * const scene)
{
if (mCurrentScene) {
disconnect(mCurrentScene.data(), &Canvas::objectSelectionChanged,
this, &KeysView::graphUpdateVisbile);
disconnect(mCurrentScene.data(), &Canvas::requestEasingAction,
this, &KeysView::graphEasingAction);
}
mCurrentScene = scene;
if(mCurrentScene) {
if (mCurrentScene) {
connect(mCurrentScene.data(), &Canvas::objectSelectionChanged,
this, &KeysView::graphUpdateVisbile);
connect(mCurrentScene.data(), &Canvas::requestEasingAction,
this, &KeysView::graphEasingAction);
}
graphUpdateVisbile();
}
Expand Down
6 changes: 6 additions & 0 deletions src/core/canvas.h
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ class CORE_EXPORT Canvas : public CanvasBase
mPathEffectsVisible = bT;
}

void setEasingAction(const QString &easing)
{
emit requestEasingAction(easing);
}

protected:
void setCurrentSmartEndPoint(SmartNodePoint* const point);

Expand All @@ -433,6 +438,7 @@ class CORE_EXPORT Canvas : public CanvasBase
void gradientCreated(SceneBoundGradient*);
void gradientRemoved(SceneBoundGradient*);
void openTextEditor();
void requestEasingAction(const QString &easing);

public:
void makePointCtrlsSymmetric();
Expand Down

0 comments on commit 2c49880

Please sign in to comment.