diff --git a/app/node/factory.cpp b/app/node/factory.cpp index 9fa88710a..f2f5d7d54 100644 --- a/app/node/factory.cpp +++ b/app/node/factory.cpp @@ -35,7 +35,7 @@ #include "generator/polygon/polygon.h" #include "generator/shape/shapenode.h" #include "generator/solid/solid.h" -#include "generator/text/text.h" +#include "generator/text/textlegacy.h" #include "filter/blur/blur.h" #include "filter/mosaic/mosaicfilternode.h" #include "filter/stroke/stroke.h" @@ -215,7 +215,7 @@ Node *NodeFactory::CreateFromFactoryIndex(const NodeFactory::InternalID &id) case kStrokeFilter: return new StrokeFilterNode(); case kTextGenerator: - return new TextGenerator(); + return new TextGeneratorLegacy(); case kCrossDissolveTransition: return new CrossDissolveTransition(); case kDipToColorTransition: diff --git a/app/node/generator/text/CMakeLists.txt b/app/node/generator/text/CMakeLists.txt index 85c7f8711..c98be672e 100644 --- a/app/node/generator/text/CMakeLists.txt +++ b/app/node/generator/text/CMakeLists.txt @@ -16,7 +16,7 @@ set(OLIVE_SOURCES ${OLIVE_SOURCES} - node/generator/text/text.h - node/generator/text/text.cpp + node/generator/text/textlegacy.cpp + node/generator/text/textlegacy.h PARENT_SCOPE ) diff --git a/app/node/generator/text/text.cpp b/app/node/generator/text/textlegacy.cpp similarity index 82% rename from app/node/generator/text/text.cpp rename to app/node/generator/text/textlegacy.cpp index a3035a2e9..edb871a02 100644 --- a/app/node/generator/text/text.cpp +++ b/app/node/generator/text/textlegacy.cpp @@ -18,7 +18,7 @@ ***/ -#include "text.h" +#include "textlegacy.h" #include #include @@ -31,14 +31,14 @@ enum TextVerticalAlign { kVerticalAlignBottom, }; -const QString TextGenerator::kTextInput = QStringLiteral("text_in"); -const QString TextGenerator::kHtmlInput = QStringLiteral("html_in"); -const QString TextGenerator::kColorInput = QStringLiteral("color_in"); -const QString TextGenerator::kVAlignInput = QStringLiteral("valign_in"); -const QString TextGenerator::kFontInput = QStringLiteral("font_in"); -const QString TextGenerator::kFontSizeInput = QStringLiteral("font_size_in"); +const QString TextGeneratorLegacy::kTextInput = QStringLiteral("text_in"); +const QString TextGeneratorLegacy::kHtmlInput = QStringLiteral("html_in"); +const QString TextGeneratorLegacy::kColorInput = QStringLiteral("color_in"); +const QString TextGeneratorLegacy::kVAlignInput = QStringLiteral("valign_in"); +const QString TextGeneratorLegacy::kFontInput = QStringLiteral("font_in"); +const QString TextGeneratorLegacy::kFontSizeInput = QStringLiteral("font_size_in"); -TextGenerator::TextGenerator() +TextGeneratorLegacy::TextGeneratorLegacy() { AddInput(kTextInput, NodeValue::kText, tr("Sample Text")); @@ -53,32 +53,27 @@ TextGenerator::TextGenerator() AddInput(kFontSizeInput, NodeValue::kFloat, 72.0f); } -Node *TextGenerator::copy() const +QString TextGeneratorLegacy::Name() const { - return new TextGenerator(); + return tr("Text (Legacy)"); } -QString TextGenerator::Name() const -{ - return tr("Text"); -} - -QString TextGenerator::id() const +QString TextGeneratorLegacy::id() const { return QStringLiteral("org.olivevideoeditor.Olive.textgenerator"); } -QVector TextGenerator::Category() const +QVector TextGeneratorLegacy::Category() const { return {kCategoryGenerator}; } -QString TextGenerator::Description() const +QString TextGeneratorLegacy::Description() const { return tr("Generate rich text."); } -void TextGenerator::Retranslate() +void TextGeneratorLegacy::Retranslate() { SetInputName(kTextInput, tr("Text")); SetInputName(kHtmlInput, tr("Enable HTML")); @@ -89,7 +84,7 @@ void TextGenerator::Retranslate() SetComboBoxStrings(kVAlignInput, {tr("Top"), tr("Center"), tr("Bottom")}); } -void TextGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const +void TextGeneratorLegacy::Value(const NodeValueRow &value, const NodeGlobals &globals, NodeValueTable *table) const { GenerateJob job; job.InsertValue(value); @@ -100,7 +95,7 @@ void TextGenerator::Value(const NodeValueRow &value, const NodeGlobals &globals, } } -void TextGenerator::GenerateFrame(FramePtr frame, const GenerateJob& job) const +void TextGeneratorLegacy::GenerateFrame(FramePtr frame, const GenerateJob& job) const { // This could probably be more optimized, but for now we use Qt to draw to a QImage. // QImages only support integer pixels and we use float pixels, so what we do here is draw onto diff --git a/app/node/generator/text/text.h b/app/node/generator/text/textlegacy.h similarity index 90% rename from app/node/generator/text/text.h rename to app/node/generator/text/textlegacy.h index d673eb558..a3d85aaca 100644 --- a/app/node/generator/text/text.h +++ b/app/node/generator/text/textlegacy.h @@ -25,15 +25,14 @@ namespace olive { -class TextGenerator : public Node +class TextGeneratorLegacy : public Node { Q_OBJECT public: - TextGenerator(); + TextGeneratorLegacy(); - NODE_DEFAULT_DESTRUCTOR(TextGenerator) - - virtual Node* copy() const override; + NODE_DEFAULT_DESTRUCTOR(TextGeneratorLegacy) + NODE_COPY_FUNCTION(TextGeneratorLegacy) virtual QString Name() const override; virtual QString id() const override; diff --git a/app/widget/timelinewidget/tool/add.cpp b/app/widget/timelinewidget/tool/add.cpp index 07343ccd3..42ba41801 100644 --- a/app/widget/timelinewidget/tool/add.cpp +++ b/app/widget/timelinewidget/tool/add.cpp @@ -24,7 +24,7 @@ #include "node/factory.h" #include "node/generator/shape/shapenode.h" #include "node/generator/solid/solid.h" -#include "node/generator/text/text.h" +#include "node/generator/text/textlegacy.h" #include "widget/timelinewidget/timelinewidget.h" #include "widget/timelinewidget/undo/timelineundopointer.h" @@ -138,7 +138,7 @@ void AddTool::MouseRelease(TimelineViewMouseEvent *event) break; case olive::Tool::kAddableTitle: { - node_to_add = new TextGenerator(); + node_to_add = new TextGeneratorLegacy(); break; } case olive::Tool::kAddableBars: