diff --git a/TODO-zh.md b/TODO-zh.md index c863f46bc..5128c8356 100644 --- a/TODO-zh.md +++ b/TODO-zh.md @@ -30,13 +30,18 @@ 6) editBegin/editEnd、Progress、Timeline 等回调还只是空实现 - 现状:`OlivePluginInstance` 中多处函数是空壳或默认返回。 - 为什么需要:插件在编辑参数、显示进度、根据时间线上下文渲染时依赖这些回调。 -- 可能改动:实现 editBegin/editEnd 通知;progressStart/Update/End 与 UI 进度条连接;timelineGetTime/GotoTime/Bounds 与工程时间轴连接。 +- 已完成: + - editBegin/editEnd:实现编辑会话计数,保证调用合法并可用于后续扩展。 + - progressStart/Update/End:接入 `ProgressDialog`,支持取消并返回给插件停止信号。 + - timeLineGetTime/GotoTime/Bounds:关联当前活跃的时间线/面板播放头,读取与设置时间。 7) 持久消息展示与清理机制需要完善 - 现状:我们已在 Host/Instance 里保存消息并能弹窗,但 UI 面板还需要稳定地展示、更新和清理。 - 为什么需要:插件经常用 persistent message 提示错误或警告,需要可追踪、可清除。 -- 可能改动:统一消息存储(Host/Instance),提供 UI 列表、清除按钮、计数徽标,并保证信号更新。 - +- 已完成: + - Host/Instance 持久消息保存,节点右上角显示数量徽标。 + - 参数面板顶部展示消息列表,并可点击清除按钮移除消息。 + - 清除/新增消息后通过信号更新 UI。 8) Project Extent / Fielding 行为待确认 - 现状:`OlivePluginInstance::getProjectExtent()` 有 “TODO” 注释。 - 为什么需要:OFX 插件会根据项目尺寸、扫描线场信息做渲染决策。 diff --git a/app/pluginSupport/OlivePluginInstance.cpp b/app/pluginSupport/OlivePluginInstance.cpp index f2d3d02c8..9a95419c1 100644 --- a/app/pluginSupport/OlivePluginInstance.cpp +++ b/app/pluginSupport/OlivePluginInstance.cpp @@ -21,11 +21,19 @@ #include "ofxCore.h" #include "ofxMessage.h" #include "common/Current.h" +#include "core.h" +#include "dialog/progress/progress.h" +#include "node/output/viewer/viewer.h" +#include "panel/panelmanager.h" +#include "panel/timebased/timebased.h" +#include "panel/timeline/timeline.h" #include #include +#include #include #include +#include #include #include #include "paraminstance.h" @@ -33,6 +41,72 @@ namespace olive { namespace plugin { +namespace { +class DeferredRedoCommand : public UndoCommand { +public: + explicit DeferredRedoCommand(UndoCommand *inner) + : inner_(inner) + { + } + + ~DeferredRedoCommand() override + { + delete inner_; + } + + Project *GetRelevantProject() const override + { + return inner_ ? inner_->GetRelevantProject() : nullptr; + } + +protected: + void redo() override + { + if (skip_first_redo_) { + skip_first_redo_ = false; + return; + } + if (inner_) { + inner_->redo_now(); + } + } + + void undo() override + { + if (inner_) { + inner_->undo_now(); + } + } + +private: + UndoCommand *inner_ = nullptr; + bool skip_first_redo_ = true; +}; + +ViewerOutput *GetActiveViewerOutput() +{ + PanelManager *manager = PanelManager::instance(); + if (!manager) { + return nullptr; + } + + if (auto *time_panel = manager->MostRecentlyFocused()) { + if (time_panel->GetConnectedViewer()) { + return time_panel->GetConnectedViewer(); + } + } + + QList timelines = manager->GetPanelsOfType(); + for (TimelinePanel *panel : timelines) { + if (panel && panel->GetConnectedViewer()) { + return panel->GetConnectedViewer(); + } + } + + return nullptr; +} +} // namespace + OfxStatus OlivePluginInstance::vmessage(const char *type, const char *id, const char *format, va_list args) { @@ -200,6 +274,150 @@ OlivePluginInstance::newParam(const std::string &name, } OfxStatus OlivePluginInstance::editBegin(const std::string &name) { + edit_depth_++; + if (edit_depth_ == 1) { + edit_command_ = nullptr; + edit_label_.clear(); + edit_first_label_.clear(); + edit_param_count_ = 0; + if (!name.empty()) { + edit_first_label_ = + QCoreApplication::translate( + "OlivePluginInstance", "Change %1") + .arg(QString::fromStdString(name)); + } + } + return kOfxStatOK; +} +OfxStatus OlivePluginInstance::editEnd() +{ + if (edit_depth_ > 0) { + edit_depth_--; + } + if (edit_depth_ == 0 && edit_command_) { + QString label = edit_label_; + if (label.isEmpty()) { + if (edit_param_count_ <= 1 && !edit_first_label_.isEmpty()) { + label = edit_first_label_; + } else if (edit_param_count_ > 1 && + !edit_first_label_.isEmpty()) { + label = QCoreApplication::translate( + "OlivePluginInstance", "%1 (+%2)") + .arg(edit_first_label_) + .arg(edit_param_count_ - 1); + } else { + label = QCoreApplication::translate( + "OlivePluginInstance", "Edit Parameters"); + } + } + Core::instance()->undo_stack()->push(edit_command_, label); + edit_command_ = nullptr; + edit_label_.clear(); + edit_first_label_.clear(); + edit_param_count_ = 0; + } + return kOfxStatOK; +} + +void OlivePluginInstance::SubmitUndoCommand(UndoCommand *command, + const QString &label) +{ + if (!command) { + return; + } + + if (edit_depth_ > 0) { + if (!edit_command_) { + edit_command_ = new MultiUndoCommand(); + } + edit_param_count_++; + if (!label.isEmpty() && edit_first_label_.isEmpty()) { + edit_first_label_ = label; + } + + command->redo_now(); + edit_command_->add_child(new DeferredRedoCommand(command)); + return; + } + + Core::instance()->undo_stack()->push(command, label); +} + +void OlivePluginInstance::progressStart(const std::string &message, + const std::string &messageid) +{ + (void)messageid; + progress_cancelled_ = false; + progress_active_ = true; + + if (progress_dialog_) { + progress_dialog_->close(); + progress_dialog_->deleteLater(); + } + + QString dialog_message = message.empty() + ? QStringLiteral("Processing...") + : QString::fromStdString(message); + + progress_dialog_ = new ProgressDialog( + dialog_message, QStringLiteral("OpenFX"), Core::instance()->main_window()); + progress_dialog_->setAttribute(Qt::WA_DeleteOnClose); + connect(progress_dialog_, &ProgressDialog::Cancelled, this, + [this]() { progress_cancelled_ = true; }); + progress_dialog_->show(); +} + +void OlivePluginInstance::progressEnd() +{ + progress_active_ = false; + progress_cancelled_ = false; + + if (progress_dialog_) { + progress_dialog_->close(); + progress_dialog_->deleteLater(); + } +} + +bool OlivePluginInstance::progressUpdate(double t) +{ + if (!progress_active_) { + return true; + } + + if (progress_dialog_) { + double clamped = qBound(0.0, t, 1.0); + progress_dialog_->SetProgress(clamped); + } + + return !progress_cancelled_; +} + +double OlivePluginInstance::timeLineGetTime() +{ + if (ViewerOutput *viewer = GetActiveViewerOutput()) { + return viewer->GetPlayhead().toDouble(); + } + + return 0.0; +} + +void OlivePluginInstance::timeLineGotoTime(double t) +{ + if (ViewerOutput *viewer = GetActiveViewerOutput()) { + viewer->SetPlayhead(core::rational::fromDouble(t)); + } +} + +void OlivePluginInstance::timeLineGetBounds(double &t1, double &t2) +{ + if (ViewerOutput *viewer = GetActiveViewerOutput()) { + t1 = 0.0; + t2 = viewer->GetLength().toDouble(); + return; + } + + t1 = 0.0; + t2 = 0.0; } OFX::Host::ImageEffect::ClipInstance *OlivePluginInstance::newClipInstance( diff --git a/app/pluginSupport/OlivePluginInstance.h b/app/pluginSupport/OlivePluginInstance.h index bf1ba9e71..f1e12893d 100644 --- a/app/pluginSupport/OlivePluginInstance.h +++ b/app/pluginSupport/OlivePluginInstance.h @@ -23,13 +23,16 @@ #include "ofxhImageEffect.h" #include "node/plugins/Plugin.h" #include "render/videoparams.h" +#include "undo/undocommand.h" #include +#include #include #include namespace olive { namespace plugin{ class PluginNode; +class ProgressDialog; enum class ErrorType{ Error, Warning, @@ -132,21 +135,17 @@ public: /// Client host code needs to implement this OFX::Host::Param::Instance* newParam(const std::string& name, OFX::Host::Param::Descriptor& Descriptor) override; + void SubmitUndoCommand(UndoCommand *command, const QString &label); + /// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditBegin /// /// Client host code needs to implement this - virtual OfxStatus editBegin(const std::string& name) - { - return kOfxStatOK; - }; + virtual OfxStatus editBegin(const std::string& name) override; /// Triggered when the plug-in calls OfxParameterSuiteV1::paramEditEnd /// /// Client host code needs to implement this - virtual OfxStatus editEnd() - { - return kOfxStatOK; - }; + virtual OfxStatus editEnd() override; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -156,16 +155,15 @@ public: // overridden for Progress::ProgressI /// Start doing progress. - virtual void progressStart(const std::string &message, const std::string &messageid) - { - }; + virtual void progressStart(const std::string &message, + const std::string &messageid) override; /// finish yer progress - virtual void progressEnd(){}; + virtual void progressEnd() override; /// set the progress to some level of completion, returns /// false if you should abandon processing, true to continue - virtual bool progressUpdate(double t){return true;}; + virtual bool progressUpdate(double t) override; //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// @@ -189,6 +187,14 @@ private: QList persistentErrors_; VideoParams params_; std::shared_ptr node_ = nullptr; + int edit_depth_ = 0; + MultiUndoCommand *edit_command_ = nullptr; + QString edit_label_; + QString edit_first_label_; + int edit_param_count_ = 0; + QPointer progress_dialog_; + bool progress_cancelled_ = false; + bool progress_active_ = false; }; } } diff --git a/app/pluginSupport/paraminstance.cpp b/app/pluginSupport/paraminstance.cpp index 63b594e04..c57fe46eb 100644 --- a/app/pluginSupport/paraminstance.cpp +++ b/app/pluginSupport/paraminstance.cpp @@ -20,3 +20,30 @@ #include "paraminstance.h" +#include "OlivePluginInstance.h" + +namespace olive +{ +namespace plugin +{ +void SubmitUndoCommand(const std::shared_ptr &node, + UndoCommand *command, const QString &label) +{ + if (!command) { + return; + } + + if (node) { + auto *instance = node->getPluginInstance(); + auto *olive_instance = + dynamic_cast(instance); + if (olive_instance) { + olive_instance->SubmitUndoCommand(command, label); + return; + } + } + + Core::instance()->undo_stack()->push(command, label); +} +} +} diff --git a/app/pluginSupport/paraminstance.h b/app/pluginSupport/paraminstance.h index a7ea59ac6..b51fc39d0 100644 --- a/app/pluginSupport/paraminstance.h +++ b/app/pluginSupport/paraminstance.h @@ -39,6 +39,8 @@ inline QString ParamChangeLabel(const OFX::Host::Param::Descriptor &descriptor) return QStringLiteral("Change %1") .arg(QString::fromStdString(descriptor.getName())); } +void SubmitUndoCommand(const std::shared_ptr &node, + UndoCommand *command, const QString &label); class PushbuttonInstance : public OFX::Host::Param::PushbuttonInstance { protected: @@ -97,8 +99,7 @@ public: auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(_node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(_node, command, ParamChangeLabel(_descriptor)); id=_descriptor.getName().c_str(); return kOfxStatOK; } @@ -108,8 +109,7 @@ public: Node::SetValueAtTime( NodeInput(_node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), data, 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(_node, command, ParamChangeLabel(_descriptor)); id=_descriptor.getName().c_str(); return kOfxStatOK; } @@ -155,8 +155,7 @@ public: NodeValue::kFloat, data); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, double data) @@ -165,8 +164,7 @@ public: Node::SetValueAtTime( NodeInput(node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), data, 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus derive(OfxTime, double&) @@ -219,8 +217,7 @@ public: NodeValue::kBoolean, data); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, bool data) @@ -229,8 +226,7 @@ public: Node::SetValueAtTime( NodeInput(node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), data, 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -275,8 +271,7 @@ public: NodeValue::kCombo, data); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, int data) @@ -285,8 +280,7 @@ public: Node::SetValueAtTime( NodeInput(node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), data, 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -335,8 +329,7 @@ public: QVariant::fromValue(olive::core::Color(r, g, b, a))); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, double r,double g,double b,double a) @@ -351,8 +344,7 @@ public: b, 2, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), a, 3, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -400,8 +392,7 @@ public: QVariant::fromValue(olive::core::Color(r, g, b))); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, double r,double g,double b) @@ -414,8 +405,7 @@ public: g, 1, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), b, 2, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -457,8 +447,7 @@ public: NodeValue::kVec2, QVector2D(x, y)); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time,double x,double y) @@ -469,8 +458,7 @@ public: x, 0, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), y, 1, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -512,8 +500,7 @@ public: NodeValue::kVec2, QVector2D(x, y)); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time,int x,int y) @@ -524,8 +511,7 @@ public: x, 0, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), y, 1, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -570,8 +556,7 @@ public: NodeValue::kVec3, QVector3D(x, y, z)); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time,double x,double y,double z) @@ -584,8 +569,7 @@ public: rational::fromDouble(time), y, 1, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), z, 2, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -630,8 +614,7 @@ public: NodeValue::kVec3, QVector3D(x, y, z)); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time,int x,int y,int z) @@ -644,8 +627,7 @@ public: rational::fromDouble(time), y, 1, command, true); Node::SetValueAtTime(NodeInput(node.get(), name), rational::fromDouble(time), z, 2, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -692,8 +674,7 @@ public: NodeValue::kText, v); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, const char *data) @@ -702,8 +683,7 @@ public: Node::SetValueAtTime( NodeInput(node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), QString::fromUtf8(data), 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; @@ -758,8 +738,7 @@ public: NodeValue::kBinary, v); auto command = new NodeParamSetSplitStandardValueCommand( NodeInput(node.get(), _descriptor.getName().c_str()), split); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } OfxStatus set(OfxTime time, const char *data) @@ -768,8 +747,7 @@ public: Node::SetValueAtTime( NodeInput(node.get(), _descriptor.getName().c_str()), rational::fromDouble(time), QByteArray(data), 0, command, true); - Core::instance()->undo_stack()->push(command, - ParamChangeLabel(_descriptor)); + SubmitUndoCommand(node, command, ParamChangeLabel(_descriptor)); return kOfxStatOK; } }; diff --git a/app/ts/ar_AR.ts b/app/ts/ar_AR.ts index 63c9d6572..dabff8e9b 100644 --- a/app/ts/ar_AR.ts +++ b/app/ts/ar_AR.ts @@ -4782,4 +4782,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/bs_BA.ts b/app/ts/bs_BA.ts index 9f3aa4d97..17ff80653 100644 --- a/app/ts/bs_BA.ts +++ b/app/ts/bs_BA.ts @@ -4788,4 +4788,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/cs_CZ.ts b/app/ts/cs_CZ.ts index bad3aebed..ec3ca560c 100644 --- a/app/ts/cs_CZ.ts +++ b/app/ts/cs_CZ.ts @@ -4702,4 +4702,19 @@ Opravdu chcete tento záznam smazat? Vzorky + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/de_DE.ts b/app/ts/de_DE.ts index a16b5a777..ea5bf10eb 100644 --- a/app/ts/de_DE.ts +++ b/app/ts/de_DE.ts @@ -5734,4 +5734,19 @@ Soll es wirklich gelöscht werden? Samples + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/en_US.ts b/app/ts/en_US.ts index e3a85a427..a9bfa2051 100644 --- a/app/ts/en_US.ts +++ b/app/ts/en_US.ts @@ -69,4 +69,19 @@ + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/es_ES.ts b/app/ts/es_ES.ts index adbc5718c..e398f4407 100644 --- a/app/ts/es_ES.ts +++ b/app/ts/es_ES.ts @@ -4933,4 +4933,19 @@ y salida. Muestras + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/fr_FR.ts b/app/ts/fr_FR.ts index 0e0cb7a21..f54671573 100644 --- a/app/ts/fr_FR.ts +++ b/app/ts/fr_FR.ts @@ -4918,4 +4918,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/hr_HR.ts b/app/ts/hr_HR.ts index 37dbfd902..53f040f7c 100644 --- a/app/ts/hr_HR.ts +++ b/app/ts/hr_HR.ts @@ -4788,4 +4788,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/id_ID.ts b/app/ts/id_ID.ts index 80f7abf52..be348aaa1 100644 --- a/app/ts/id_ID.ts +++ b/app/ts/id_ID.ts @@ -4782,4 +4782,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/it_IT.ts b/app/ts/it_IT.ts index 1a9ac2d1d..7d4b5f27c 100644 --- a/app/ts/it_IT.ts +++ b/app/ts/it_IT.ts @@ -5494,4 +5494,19 @@ Equivale a moltiplicare per una matrice ortografica. Esempi + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/ja_JP.ts b/app/ts/ja_JP.ts index 103276f28..225f1fedb 100644 --- a/app/ts/ja_JP.ts +++ b/app/ts/ja_JP.ts @@ -5480,4 +5480,19 @@ Are you sure you wish to delete this footage? サンプル + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/pt_BR.ts b/app/ts/pt_BR.ts index 4f8a8c645..bab9094e2 100644 --- a/app/ts/pt_BR.ts +++ b/app/ts/pt_BR.ts @@ -4782,4 +4782,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/ru_RU.ts b/app/ts/ru_RU.ts index 3575eb812..0d510576a 100644 --- a/app/ts/ru_RU.ts +++ b/app/ts/ru_RU.ts @@ -6093,4 +6093,19 @@ Duration: %3 Сэмплы + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/sr_RS.ts b/app/ts/sr_RS.ts index 5e60a8087..41dae13b5 100644 --- a/app/ts/sr_RS.ts +++ b/app/ts/sr_RS.ts @@ -4788,4 +4788,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/tr_TR.ts b/app/ts/tr_TR.ts index 0596d3711..ae4bde6ea 100644 --- a/app/ts/tr_TR.ts +++ b/app/ts/tr_TR.ts @@ -4782,4 +4782,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/uk_UK.ts b/app/ts/uk_UK.ts index d55674e4c..e3246e8fa 100644 --- a/app/ts/uk_UK.ts +++ b/app/ts/uk_UK.ts @@ -4782,4 +4782,19 @@ What would you like to do with these clips? + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/zh_CN.ts b/app/ts/zh_CN.ts index 7c3337c39..b42720837 100644 --- a/app/ts/zh_CN.ts +++ b/app/ts/zh_CN.ts @@ -7418,4 +7418,19 @@ Please check your audio preferences and try again. 垂直 + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/ts/zh_TW.ts b/app/ts/zh_TW.ts index 61155f952..f517520a2 100644 --- a/app/ts/zh_TW.ts +++ b/app/ts/zh_TW.ts @@ -4795,4 +4795,19 @@ What would you like to do with these clips? 取樣 + + OlivePluginInstance + + Change %1 + + + + %1 (+%2) + + + + Edit Parameters + + + diff --git a/app/widget/nodeparamview/nodeparamviewitem.cpp b/app/widget/nodeparamview/nodeparamviewitem.cpp index 696d39a1b..c594349d8 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.cpp +++ b/app/widget/nodeparamview/nodeparamviewitem.cpp @@ -51,6 +51,7 @@ NodeParamViewItem::NodeParamViewItem( : super(parent) , body_(nullptr) , message_label_(nullptr) + , message_clear_button_(nullptr) , message_container_(nullptr) , node_(node) , create_checkboxes_(create_checkboxes) @@ -103,6 +104,7 @@ void NodeParamViewItem::RecreateBody() message_container_->deleteLater(); message_container_ = nullptr; message_label_ = nullptr; + message_clear_button_ = nullptr; } body_ = new NodeParamViewItemBody(node_, create_checkboxes_, this); @@ -123,6 +125,16 @@ void NodeParamViewItem::RecreateBody() message_layout->setContentsMargins(0, 0, 0, 0); message_layout->setSpacing(4); + QHBoxLayout *message_header = new QHBoxLayout(); + message_header->setContentsMargins(0, 0, 0, 0); + message_header->addStretch(); + message_clear_button_ = new QPushButton(tr("Clear"), message_container_); + message_clear_button_->setVisible(false); + connect(message_clear_button_, &QPushButton::clicked, this, + &NodeParamViewItem::ClearMessages); + message_header->addWidget(message_clear_button_); + message_layout->addLayout(message_header); + message_label_ = new QLabel(message_container_); message_label_->setWordWrap(true); message_label_->setTextInteractionFlags(Qt::TextSelectableByMouse); @@ -146,6 +158,9 @@ void NodeParamViewItem::UpdateMessagePanel() dynamic_cast(instance); if (!olive_instance || olive_instance->persistentMessageCount() == 0) { message_label_->setVisible(false); + if (message_clear_button_) { + message_clear_button_->setVisible(false); + } return; } @@ -168,6 +183,9 @@ void NodeParamViewItem::UpdateMessagePanel() message_label_->setText(lines.join('\n')); message_label_->setVisible(true); + if (message_clear_button_) { + message_clear_button_->setVisible(true); + } } int NodeParamViewItem::GetElementY(const NodeInput &c) const @@ -185,6 +203,18 @@ void NodeParamViewItem::SetInputChecked(const NodeInput &input, bool e) body_->SetInputChecked(input, e); } +void NodeParamViewItem::ClearMessages() +{ + auto *instance = node_->getPluginInstance(); + auto *olive_instance = + dynamic_cast(instance); + if (!olive_instance) { + return; + } + + olive_instance->clearPersistentMessage(); +} + NodeParamViewItemBody::NodeParamViewItemBody( Node *node, NodeParamViewCheckBoxBehavior create_checkboxes, QWidget *parent) diff --git a/app/widget/nodeparamview/nodeparamviewitem.h b/app/widget/nodeparamview/nodeparamviewitem.h index 9b74b36f9..79530c260 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.h +++ b/app/widget/nodeparamview/nodeparamviewitem.h @@ -233,6 +233,7 @@ protected slots: private: NodeParamViewItemBody *body_; QLabel *message_label_; + QPushButton *message_clear_button_; QWidget *message_container_; Node *node_; @@ -250,6 +251,7 @@ private: private slots: void RecreateBody(); void UpdateMessagePanel(); + void ClearMessages(); }; }