Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Remove the rich text editor tab from the svg text editor.
Wolthera van Hövell tot Westerflierb699ab02f414
diff --git a/plugins/tools/svgtexttool/CMakeLists.txt b/plugins/tools/svgtexttool/CMakeLists.txtindex 2fa738a69a..6e127f8bc4 100644--- a/plugins/tools/svgtexttool/CMakeLists.txt+++ b/plugins/tools/svgtexttool/CMakeLists.txt@@ -21,7 +21,6 @@ set (SvgTextTool_SRCSSvgTextCursor.cppSvgTextTool.cppSvgTextToolFactory.cpp- FontSizeAction.cppSvgTextShapeManagerBlocker.cppSvgConvertTextTypeCommand.cppSvgTextShortCuts.cppdiff --git a/plugins/tools/svgtexttool/FontSizeAction.cpp b/plugins/tools/svgtexttool/FontSizeAction.cppdeleted file mode 100644index f459d0dc4a..0000000000--- a/plugins/tools/svgtexttool/FontSizeAction.cpp+++ /dev/null@@ -1,146 +0,0 @@-/* This file is part of the KDE libraries- SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <[email protected]>- SPDX-FileCopyrightText: 1999 Simon Hausmann <[email protected]>- SPDX-FileCopyrightText: 2000 Nicolas Hadacek <[email protected]>- SPDX-FileCopyrightText: 2000 Kurt Granroth <[email protected]>- SPDX-FileCopyrightText: 2000 Michael Koch <[email protected]>- SPDX-FileCopyrightText: 2001 Holger Freyther <[email protected]>- SPDX-FileCopyrightText: 2002 Ellis Whitehead <[email protected]>- SPDX-FileCopyrightText: 2002 Joseph Wenninger <[email protected]>- SPDX-FileCopyrightText: 2003 Andras Mantia <[email protected]>- SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <[email protected]>-- SPDX-License-Identifier: LGPL-2.0-only-*/--#include <QFontDatabase>-#include <QToolBar>-#include <QRegularExpression>-#include <QDebug>-#include <klocalizedstring.h>-#include <QIcon>--#include "FontSizeAction.h"--QString format(qreal v)-{- static const QString f("%1");- static const QString e;- static const QRegularExpression r("\\.?0+$");- return f.arg(v, 0, 'f').replace(r, e);-}--class FontSizeAction::Private-{-public:- Private(FontSizeAction *parent)- : q(parent)- {- }-- void init();-- FontSizeAction *q;-};--// BEGIN FontSizeAction-FontSizeAction::FontSizeAction(QObject *parent)- : KSelectAction(parent)- , d(new Private(this))-{- d->init();-}--FontSizeAction::FontSizeAction(const QString &text, QObject *parent)- : KSelectAction(text, parent)- , d(new Private(this))-{- d->init();-}--FontSizeAction::FontSizeAction(const QIcon &icon, const QString &text, QObject *parent)- : KSelectAction(icon, text, parent)- , d(new Private(this))-{- d->init();-}--FontSizeAction::~FontSizeAction()-{- delete d;-}--void FontSizeAction::Private::init()-{- q->setEditable(true);- QFontDatabase fontDB;- const QList<int> sizes = fontDB.standardSizes();- QStringList lst;- for (QList<int>::ConstIterator it = sizes.begin(); it != sizes.end(); ++it) {- lst.append(format(*it));- }- q->setItems(lst);-}--void FontSizeAction::setFontSize(qreal size)-{- if (size == fontSize()) {- const QString test = format(size);- Q_FOREACH (QAction *action, actions()) {- if (action->text() == test) {- setCurrentAction(action);- return;- }- }- }-- if (size < 1) {- qWarning() << "FontSizeAction: Size " << size << " is out of range";- return;- }-- QAction *a = action(format(size));- if (!a) {- // Insert at the correct position in the list (to keep sorting)- QList<qreal> lst;- // Convert to list of qreals- QStringListIterator itemsIt(items());- QStringList debug_lst = items();-- while (itemsIt.hasNext()) {- lst.append(itemsIt.next().toDouble());- }- //add the new size- lst.append(size);-- //remove actions- clear();-- // Sort the list- std::sort(lst.begin(), lst.end());- Q_FOREACH (qreal it, lst) {- QAction *const action = addAction(format(it));- if (it == size) {- setCurrentAction(action);- }- }-- } else {- setCurrentAction(a);- }-}--qreal FontSizeAction::fontSize() const-{- return currentText().toDouble();-}--#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))-void FontSizeAction::actionTriggered(QAction *action)-#else-void FontSizeAction::slotActionTriggered(QAction *action)-#endif-{- Q_EMIT fontSizeChanged(action->text().toDouble());- KSelectAction::actionTriggered(action);-}diff --git a/plugins/tools/svgtexttool/FontSizeAction.h b/plugins/tools/svgtexttool/FontSizeAction.hdeleted file mode 100644index 36ac28002e..0000000000--- a/plugins/tools/svgtexttool/FontSizeAction.h+++ /dev/null@@ -1,63 +0,0 @@-/* This file is part of the KDE project- SPDX-FileCopyrightText: 1999 Reginald Stadlbauer <[email protected]>- SPDX-FileCopyrightText: 1999 Simon Hausmann <[email protected]>- SPDX-FileCopyrightText: 2000 Nicolas Hadacek <[email protected]>- SPDX-FileCopyrightText: 2000 Kurt Granroth <[email protected]>- SPDX-FileCopyrightText: 2000 Michael Koch <[email protected]>- SPDX-FileCopyrightText: 2001 Holger Freyther <[email protected]>- SPDX-FileCopyrightText: 2002 Ellis Whitehead <[email protected]>- SPDX-FileCopyrightText: 2003 Andras Mantia <[email protected]>- SPDX-FileCopyrightText: 2005-2006 Hamish Rodda <[email protected]>- *- * SPDX-License-Identifier: LGPL-2.0-or-later- */--#ifndef FONTSIZEACTION_H-#define FONTSIZEACTION_H--#include <kselectaction.h>--class QIcon;--/**- * An action to allow changing of the font size.- * This action will be shown as a combobox on a toolbar with a proper set of font sizes.- *- * NOTE: We do not use KFontSizeAction because it does not support font size- * values of type qreal.- */-class FontSizeAction : public KSelectAction-{- Q_OBJECT- Q_PROPERTY(qreal fontSize READ fontSize WRITE setFontSize)--public:- explicit FontSizeAction(QObject *parent);- FontSizeAction(const QString &text, QObject *parent);- FontSizeAction(const QIcon &icon, const QString &text, QObject *parent);-- ~FontSizeAction() override;-- qreal fontSize() const;-- void setFontSize(qreal size);--Q_SIGNALS:- void fontSizeChanged(qreal);--protected Q_SLOTS:- /**- * This function is called whenever an action from the selections is triggered.- */-#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))- void actionTriggered(QAction *action) override;-#else- void slotActionTriggered(QAction *action) override;-#endif--private:- class Private;- Private *const d;-};--#endifdiff --git a/plugins/tools/svgtexttool/SvgTextEditor.cpp b/plugins/tools/svgtexttool/SvgTextEditor.cppindex 37576067b4..e34019c21e 100644--- a/plugins/tools/svgtexttool/SvgTextEditor.cpp+++ b/plugins/tools/svgtexttool/SvgTextEditor.cpp@@ -33,7 +33,6 @@#include <QScreen>#include <QScreen>-#include <kcharselect.h>#include <klocalizedstring.h>#include <ksharedconfig.h>#include <kconfiggroup.h>@@ -60,199 +59,29 @@#include <kis_file_name_requester.h>#include <kis_action_registry.h>-#include "kis_font_family_combo_box.h"-#include "FontSizeAction.h"#include "kis_signals_blocker.h"-using WrappingMode = KoSvgTextShapeMarkupConverter::WrappingMode;--class SvgTextEditor::Private{public:Private(){- // some platform plugins may have set a pixelsize which could create a- // conflicting property in QTextCharFormat- font.setPointSize(fontSize);- }-- QActionGroup *textWrappingActionGroup {};-- // collection of last-used properties- QColor fontColor {Qt::black};- //QColor backgroundColor {Qt::transparent};- qreal fontSize {10.0};- QFont font;- bool kerning {true};-- qreal letterSpacing {0.0};-- bool bold {false};- bool italic {false};- bool underline {false};-- bool strikeThrough {false};- bool superscript {false};- bool subscript {false};-- // unsupported properties:- // backgroundColor - because there is no button for that- // horizontal alignment - it seems to work without saving- // line height - it seems to work without saving-- void saveFromWidgets(KisKActionCollection* actions)- {-- FontSizeAction *fontSizeAction = qobject_cast<FontSizeAction*>(actions->action("svg_font_size"));- fontSize = fontSizeAction->fontSize();-- KisFontComboBoxes* fontComboBox2 = qobject_cast<KisFontComboBoxes*>(qobject_cast<QWidgetAction*>(actions->action("svg_font"))->defaultWidget());- font = fontComboBox2->currentFont(fontSize);-- KoColorPopupAction *fontColorAction = qobject_cast<KoColorPopupAction*>(actions->action("svg_format_textcolor"));- fontColor = fontColorAction->currentColor();-- QWidgetAction *letterSpacingAction = qobject_cast<QWidgetAction*>(actions->action("svg_letter_spacing"));- letterSpacing = qobject_cast<QDoubleSpinBox*>(letterSpacingAction->defaultWidget())->value();-- saveBoolActionFromWidget(actions, "svg_weight_bold", bold);- saveBoolActionFromWidget(actions, "svg_format_italic", italic);- saveBoolActionFromWidget(actions, "svg_format_underline", underline);-- saveBoolActionFromWidget(actions, "svg_format_strike_through", strikeThrough);- saveBoolActionFromWidget(actions, "svg_format_superscript", superscript);- saveBoolActionFromWidget(actions, "svg_format_subscript", subscript);-- saveBoolActionFromWidget(actions, "svg_font_kerning", kerning);- }-- void setSavedToWidgets(KisKActionCollection* actions)- {-- FontSizeAction *fontSizeAction = qobject_cast<FontSizeAction*>(actions->action("svg_font_size"));- fontSizeAction->setFontSize(fontSize);-- KisFontComboBoxes* fontComboBox2 = qobject_cast<KisFontComboBoxes*>(qobject_cast<QWidgetAction*>(actions->action("svg_font"))->defaultWidget());- fontComboBox2->setCurrentFont(font);-- KoColorPopupAction *fontColorAction = qobject_cast<KoColorPopupAction*>(actions->action("svg_format_textcolor"));- fontColorAction->setCurrentColor(fontColor);-- QWidgetAction *letterSpacingAction = qobject_cast<QWidgetAction*>(actions->action("svg_letter_spacing"));- qobject_cast<QDoubleSpinBox*>(letterSpacingAction->defaultWidget())->setValue(letterSpacing);-- setBoolActionToWidget(actions, "svg_weight_bold", bold);- setBoolActionToWidget(actions, "svg_format_italic", italic);-- setSavedLineDecorationToWidgets(actions);-- setBoolActionToWidget(actions, "svg_format_superscript", superscript);- setBoolActionToWidget(actions, "svg_format_subscript", subscript);-- setBoolActionToWidget(actions, "svg_font_kerning", kerning);- }-- void setSavedToFormat(QTextCharFormat &format)- {-- format.setFont(font);- format.setFontPointSize(fontSize);- format.setForeground(fontColor);-- format.setFontLetterSpacingType(QFont::AbsoluteSpacing);- format.setFontLetterSpacing(letterSpacing);-- format.setFontUnderline(underline);- format.setFontStrikeOut(strikeThrough);- format.setFontOverline(false);-- if (subscript) {- format.setVerticalAlignment(QTextCharFormat::AlignSubScript);- } else if (superscript) {- format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);- } else {- format.setVerticalAlignment(QTextCharFormat::AlignMiddle);- }-- if (bold) {- format.setFontWeight(QFont::Bold);- }-- format.setFontItalic(italic);- format.setFontKerning(kerning);- }-- void saveFontLineDecoration(KoSvgText::TextDecoration decoration)- {- // Krita for now cannot handle both at the same time; and there is no way to set overline- // FIXME: Krita should support all three at the same time- // (It does support it in SVG)- switch (decoration) {- case KoSvgText::DecorationUnderline:- underline = true;- strikeThrough = false;- break;- case KoSvgText::DecorationLineThrough:- underline = false;- strikeThrough = true;- break;- case KoSvgText::DecorationOverline:- Q_FALLTHROUGH();- case KoSvgText::DecorationNone:- Q_FALLTHROUGH();- default:- underline = false;- strikeThrough = false;- break;- }- }--- void setSavedLineDecorationToWidgets(KisKActionCollection* actions)- {- setBoolActionToWidget(actions, "svg_format_underline", underline);- setBoolActionToWidget(actions, "svg_format_strike_through", strikeThrough);}private:- void saveBoolActionFromWidget(KisKActionCollection* actions, QString actionName, bool &variable)- {- QAction *boolAction = actions->action(actionName);- KIS_ASSERT_RECOVER_RETURN(boolAction);- variable = boolAction->isChecked();- }-- void setBoolActionToWidget(KisKActionCollection* actions, QString actionName, bool variable)- {- QAction *boolAction = actions->action(actionName);- KIS_ASSERT_RECOVER_RETURN(boolAction);- boolAction->setChecked(variable);- }-};SvgTextEditor::SvgTextEditor(QWidget *parent, Qt::WindowFlags flags): KXmlGuiWindow(parent, flags), m_page(new QWidget(this))-#ifndef Q_OS_WIN- , m_charSelectDialog(new KoDialog(this))-#endif, d(new Private()){m_textEditorWidget.setupUi(m_page);setCentralWidget(m_page);-#ifndef Q_OS_WIN- KCharSelect *charSelector = new KCharSelect(m_charSelectDialog, 0, KCharSelect::AllGuiElements);- m_charSelectDialog->setMainWidget(charSelector);- connect(charSelector, SIGNAL(currentCharChanged(QChar)), SLOT(insertCharacter(QChar)));- m_charSelectDialog->hide();- m_charSelectDialog->setButtons(KoDialog::Close);-#endifKGuiItem::assign(m_textEditorWidget.buttons->button(QDialogButtonBox::Save), KStandardGuiItem::save());KGuiItem::assign(m_textEditorWidget.buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());connect(m_textEditorWidget.buttons, SIGNAL(accepted()), this, SLOT(save()));@@ -324,30 +153,7 @@ SvgTextEditor::SvgTextEditor(QWidget *parent, Qt::WindowFlags flags)}}- {- // Make the text color and text wrapping actions a simple drop-down- // button and not the split button/drop-down combo.- QAction *const color = actionCollection()->action("svg_format_textcolor");- Q_FOREACH(KisToolBar *const toolBar, toolBars()) {- if (QToolButton *const btn = qobject_cast<QToolButton *>(toolBar->widgetForAction(color))) {- btn->setPopupMode(QToolButton::InstantPopup);- }- Q_FOREACH(QAction *const action, toolBar->actions()) {- if (action->objectName() == QLatin1String("svg_text_wrapping")) {- if (QToolButton *const btn = qobject_cast<QToolButton *>(toolBar->widgetForAction(action))) {- btn->setPopupMode(QToolButton::InstantPopup);- }- }- }- }- }-plugActionList("toolbarlist", toolbarList);- connect(m_textEditorWidget.textTab, SIGNAL(currentChanged(int)), this, SLOT(switchTextEditorTab()));- switchTextEditorTab();-- m_textEditorWidget.richTextEdit->document()->setDefaultStyleSheet("p {margin:0px;}");- m_textEditorWidget.richTextEdit->installEventFilter(this);applySettings();@@ -371,238 +177,23 @@ void SvgTextEditor::setInitialShape(KoSvgTextShape *shape)QString svg;QString styles;- QTextDocument *doc = m_textEditorWidget.richTextEdit->document();if (converter.convertToSvg(&svg, &styles)) {m_textEditorWidget.svgTextEdit->setPlainText(svg);m_textEditorWidget.svgStylesEdit->setPlainText(styles);m_textEditorWidget.svgTextEdit->document()->setModified(false);-- /// Todo: remove this bool when removing rich text editor.- bool richtextPreferred = false;- if (richtextPreferred &&- converter.convertSvgToDocument(svg, doc)) {-- m_textEditorWidget.richTextEdit->setDocument(doc);- KisSignalsBlocker b(m_textEditorWidget.textTab);- m_textEditorWidget.textTab->setCurrentIndex(Editor::Richtext);- doc->clearUndoRedoStacks();- switchTextEditorTab(false);- } else {- KisSignalsBlocker b(m_textEditorWidget.textTab);- m_textEditorWidget.textTab->setCurrentIndex(Editor::SVGsource);- switchTextEditorTab(false);- }}else {QMessageBox::warning(this, i18n("Conversion failed"), "Could not get svg text from the shape:\n" + converter.errors().join('\n') + "\n" + converter.warnings().join('\n'));}}- KisFontComboBoxes* fontComboBox = qobject_cast<KisFontComboBoxes*>(qobject_cast<QWidgetAction*>(actionCollection()->action("svg_font"))->defaultWidget());- fontComboBox->setInitialized();-- KConfigGroup cfg(KSharedConfig::openConfig(), "SvgTextTool");-- d->saveFromWidgets(actionCollection());-- QTextCursor cursor = m_textEditorWidget.richTextEdit->textCursor();- QTextCharFormat format = cursor.blockCharFormat();-- d->setSavedToFormat(format);-- KisSignalsBlocker b(m_textEditorWidget.richTextEdit);- cursor.setBlockCharFormat(format);-- m_textEditorWidget.richTextEdit->document()->setModified(false);- checkDocumentFormat();}void SvgTextEditor::save(){if (m_shape) {- if (isRichTextEditorTabActive()) {- QString svg;- QString styles = m_textEditorWidget.svgStylesEdit->document()->toPlainText();- KoSvgTextShapeMarkupConverter converter(m_shape);-- if (!converter.convertDocumentToSvg(m_textEditorWidget.richTextEdit->document(), &svg)) {- qWarning()<<"new converter doesn't work!";- }- m_textEditorWidget.richTextEdit->document()->setModified(false);- Q_EMIT textUpdated(m_shape, svg, styles);- } else if (isSvgSourceEditorTabActive()) {- Q_EMIT textUpdated(m_shape, m_textEditorWidget.svgTextEdit->document()->toPlainText(), m_textEditorWidget.svgStylesEdit->document()->toPlainText());- m_textEditorWidget.svgTextEdit->document()->setModified(false);- }- }--}--void SvgTextEditor::switchTextEditorTab(bool convertData)-{- KoSvgTextShape shape;- KoSvgTextShapeMarkupConverter converter(&shape);-- bool wasModified = false;- if (m_currentEditor) {- disconnect(m_currentEditor->document(), SIGNAL(modificationChanged(bool)), this, SLOT(setModified(bool)));- wasModified = m_currentEditor->document()->isModified();- }-- // do not switch to the same tab again, otherwise we're losing current changes- if (m_currentEditor != m_textEditorWidget.richTextEdit && isRichTextEditorTabActive()) {- //first, make buttons checkable- enableRichTextActions(true);- enableSvgTextActions(false);-- //then connect the cursor change to the checkformat();- connect(m_textEditorWidget.richTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(checkFormat()));- connect(m_textEditorWidget.richTextEdit, SIGNAL(textChanged()), this, SLOT(slotFixUpEmptyTextBlock()));- connect(m_textEditorWidget.richTextEdit, SIGNAL(textChanged()), this, SLOT(checkDocumentFormat()));- checkFormat();-- if (m_shape && convertData) {- QTextDocument *doc = m_textEditorWidget.richTextEdit->document();- if (!converter.convertSvgToDocument(m_textEditorWidget.svgTextEdit->document()->toPlainText(), doc)) {- qWarning()<<"new converter svgToDoc doesn't work!";- }- m_textEditorWidget.richTextEdit->setDocument(doc);- doc->clearUndoRedoStacks();- }- m_currentEditor = m_textEditorWidget.richTextEdit;- } else if (m_currentEditor != m_textEditorWidget.svgTextEdit && isSvgSourceEditorTabActive()) {- //first, make buttons uncheckable- enableRichTextActions(false);- enableSvgTextActions(true);- disconnect(m_textEditorWidget.richTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(checkFormat()));-- // Convert the rich text to svg and styles strings- if (m_shape && convertData) {- QString svg;- if (!converter.convertDocumentToSvg(m_textEditorWidget.richTextEdit->document(), &svg)) {- qWarning()<<"new converter docToSVG doesn't work!";- }- m_textEditorWidget.svgTextEdit->setPlainText(svg);- }- m_currentEditor = m_textEditorWidget.svgTextEdit;- }-- m_currentEditor->document()->setModified(wasModified);- connect(m_currentEditor->document(), SIGNAL(modificationChanged(bool)), SLOT(setModified(bool)));-}--void SvgTextEditor::checkFormat()-{- QTextCharFormat format = m_textEditorWidget.richTextEdit->textCursor().charFormat();- QTextBlockFormat blockFormat = m_textEditorWidget.richTextEdit->textCursor().blockFormat();-- // checkboxes do not Q_EMIT signals on manual switching, so we- // can avoid blocking them-- if (format.fontWeight() > QFont::Normal) {- actionCollection()->action("svg_weight_bold")->setChecked(true);- } else {- actionCollection()->action("svg_weight_bold")->setChecked(false);- }- actionCollection()->action("svg_format_italic")->setChecked(format.fontItalic());- actionCollection()->action("svg_format_underline")->setChecked(format.fontUnderline());- actionCollection()->action("svg_format_strike_through")->setChecked(format.fontStrikeOut());- actionCollection()->action("svg_font_kerning")->setChecked(format.fontKerning());-- {- FontSizeAction *fontSizeAction = qobject_cast<FontSizeAction*>(actionCollection()->action("svg_font_size"));- KisSignalsBlocker b(fontSizeAction);- qreal pointSize = format.fontPointSize();- if (pointSize <= 0.0) {- pointSize = format.font().pointSizeF();- }- fontSizeAction->setFontSize(pointSize);- }--- {- KoColor fg(format.foreground().color(), KoColorSpaceRegistry::instance()->rgb8());- KoColorPopupAction *fgColorPopup = qobject_cast<KoColorPopupAction*>(actionCollection()->action("svg_format_textcolor"));- KisSignalsBlocker b(fgColorPopup);- fgColorPopup->setCurrentColor(fg);- }-- {- KoColor bg(format.foreground().color(), KoColorSpaceRegistry::instance()->rgb8());- KoColorPopupAction *bgColorPopup = qobject_cast<KoColorPopupAction*>(actionCollection()->action("svg_background_color"));- KisSignalsBlocker b(bgColorPopup);- bgColorPopup->setCurrentColor(bg);- }-- {- KisFontComboBoxes* fontComboBox = qobject_cast<KisFontComboBoxes*>(qobject_cast<QWidgetAction*>(actionCollection()->action("svg_font"))->defaultWidget());- KisSignalsBlocker b(fontComboBox);- fontComboBox->setCurrentFont(format.font());- }-- {- QDoubleSpinBox *spnLineHeight = qobject_cast<QWidgetAction*>(actionCollection()->action("svg_line_height"))->defaultWidget()->findChild<QDoubleSpinBox *>();- KisSignalsBlocker b(spnLineHeight);-- if (blockFormat.lineHeightType() == QTextBlockFormat::SingleHeight) {- spnLineHeight->setValue(-1.0);- spnLineHeight->setSingleStep(101.0);- } else if(blockFormat.lineHeightType() == QTextBlockFormat::ProportionalHeight) {- spnLineHeight->setValue(double(blockFormat.lineHeight()));- spnLineHeight->setSingleStep(10.0);- }- }-- {- QDoubleSpinBox* spnLetterSpacing = qobject_cast<QDoubleSpinBox*>(qobject_cast<QWidgetAction*>(actionCollection()->action("svg_letter_spacing"))->defaultWidget());- KisSignalsBlocker b(spnLetterSpacing);- spnLetterSpacing->setValue(format.fontLetterSpacing());- }-}--void SvgTextEditor::checkDocumentFormat()-{- QTextFrameFormat f = m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat();- WrappingMode wrappingMode = KoSvgTextShapeMarkupConverter::getWrappingMode(f);- switch (wrappingMode) {- case WrappingMode::QtLegacy:- default:- if (wrappingMode != WrappingMode::QtLegacy) {- // For sanity- KoSvgTextShapeMarkupConverter::setWrappingMode(&f, WrappingMode::QtLegacy);- m_textEditorWidget.richTextEdit->document()->rootFrame()->setFrameFormat(f);- }- m_textEditorWidget.richTextEdit->setLineWrapMode(QTextEdit::WidgetWidth);- actionCollection()->action("svg_text_wrapping_legacy")->setChecked(true);- break;- case WrappingMode::WhiteSpacePre:- m_textEditorWidget.richTextEdit->setLineWrapMode(QTextEdit::WidgetWidth);- actionCollection()->action("svg_text_wrapping_css_pre")->setChecked(true);- break;- case WrappingMode::WhiteSpacePreWrap:- const double inlineSize = KoSvgTextShapeMarkupConverter::getInlineSize(f).value_or(100.0);- const int wrapWidth = inlineSize * (96.0 / 72.0) + f.leftMargin() + f.rightMargin();- m_textEditorWidget.richTextEdit->setLineWrapColumnOrWidth(wrapWidth);- m_textEditorWidget.richTextEdit->setLineWrapMode(QTextEdit::FixedPixelWidth);- m_textEditorWidget.richTextEdit->setWordWrapMode(QTextOption::WordWrap);- actionCollection()->action("svg_text_wrapping_css_pre_wrap")->setChecked(true);- break;- }-}--void SvgTextEditor::slotFixUpEmptyTextBlock()-{- if (m_textEditorWidget.richTextEdit->document()->isEmpty()) {- QTextCursor cursor = m_textEditorWidget.richTextEdit->textCursor();- QTextCharFormat format = cursor.blockCharFormat();--- KisSignalsBlocker b(m_textEditorWidget.richTextEdit);-- d->setSavedToFormat(format);- d->setSavedToWidgets(actionCollection());-- cursor.setBlockCharFormat(format);+ Q_EMIT textUpdated(m_shape, m_textEditorWidget.svgTextEdit->document()->toPlainText(), m_textEditorWidget.svgStylesEdit->document()->toPlainText());+ m_textEditorWidget.svgTextEdit->document()->setModified(false);}}@@ -728,339 +319,6 @@ void SvgTextEditor::zoomIn()m_currentEditor->zoomIn();}-#ifndef Q_OS_WIN-void SvgTextEditor::showInsertSpecialCharacterDialog()-{- m_charSelectDialog->setVisible(!m_charSelectDialog->isVisible());-}--void SvgTextEditor::insertCharacter(const QChar &c)-{- m_currentEditor->textCursor().insertText(QString(c));-}-#endif--void SvgTextEditor::setTextBold(QFont::Weight weight)-{- if (isRichTextEditorTabActive()) {- QTextCharFormat format;- QTextCursor oldCursor = setTextSelection();- if (m_textEditorWidget.richTextEdit->textCursor().charFormat().fontWeight() > QFont::Normal && weight==QFont::Bold) {- format.setFontWeight(QFont::Normal);- } else {- format.setFontWeight(weight);- }- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- } else if (isSvgSourceEditorTabActive()) {- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"font-weight:700;\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- d->bold = weight == QFont::Bold;-- checkFormat();-}--void SvgTextEditor::setTextWeightLight()-{- if (m_textEditorWidget.richTextEdit->textCursor().charFormat().fontWeight() < QFont::Normal) {- setTextBold(QFont::Normal);- } else {- setTextBold(QFont::Light);- }-}--void SvgTextEditor::setTextWeightNormal()-{- setTextBold(QFont::Normal);-}--void SvgTextEditor::setTextWeightDemi()-{- if (m_textEditorWidget.richTextEdit->textCursor().charFormat().fontWeight() != QFont::Normal) {- setTextBold(QFont::Normal);- } else {- setTextBold(QFont::DemiBold);- }-}--void SvgTextEditor::setTextWeightBlack()-{- if (m_textEditorWidget.richTextEdit->textCursor().charFormat().fontWeight()>QFont::Normal) {- setTextBold(QFont::Normal);- } else {- setTextBold(QFont::Black);- }-}--void SvgTextEditor::setTextItalic(QFont::Style style)-{- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- QString fontStyle = "inherit";-- if (style == QFont::StyleItalic) {- fontStyle = "italic";- d->italic = true;- } else if (style == QFont::StyleOblique) {- fontStyle = "oblique";- d->italic = true;- } else {- d->italic = false;- }--- if (isRichTextEditorTabActive()) {- QTextCharFormat format;- QTextCursor origCursor = setTextSelection();- format.setFontItalic(!m_textEditorWidget.richTextEdit->textCursor().charFormat().fontItalic());- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(origCursor);- } else if (isSvgSourceEditorTabActive()) {- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"font-style:"+fontStyle+";\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }-- checkFormat();-}--void SvgTextEditor::setTextDecoration(KoSvgText::TextDecoration decor)-{- QTextCursor cursor = setTextSelection();- QTextCharFormat currentFormat = m_textEditorWidget.richTextEdit->textCursor().charFormat();- QTextCharFormat format;- QString textDecoration = "inherit";-- if (decor == KoSvgText::DecorationUnderline) {- textDecoration = "underline";- if (currentFormat.fontUnderline()) {- format.setFontUnderline(false);- }- else {- format.setFontUnderline(true);- }- format.setFontOverline(false);- format.setFontStrikeOut(false);- }- else if (decor == KoSvgText::DecorationLineThrough) {- textDecoration = "line-through";- format.setFontUnderline(false);- format.setFontOverline(false);- if (currentFormat.fontStrikeOut()) {- format.setFontStrikeOut(false);- }- else {- format.setFontStrikeOut(true);- }- }- else if (decor == KoSvgText::DecorationOverline) {- textDecoration = "overline";- format.setFontUnderline(false);- if (currentFormat.fontOverline()) {- format.setFontOverline(false);- }- else {- format.setFontOverline(true);- }- format.setFontStrikeOut(false);- }-- if (isRichTextEditorTabActive()) {- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- } else if (isSvgSourceEditorTabActive()) {- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"text-decoration:" + textDecoration + ";\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- m_textEditorWidget.richTextEdit->setTextCursor(cursor);-- d->saveFontLineDecoration(decor);- d->setSavedLineDecorationToWidgets(actionCollection());-}--void SvgTextEditor::setTextUnderline()-{- setTextDecoration(KoSvgText::DecorationUnderline);-}--void SvgTextEditor::setTextOverline()-{- setTextDecoration(KoSvgText::DecorationOverline);-}--void SvgTextEditor::setTextStrikethrough()-{- setTextDecoration(KoSvgText::DecorationLineThrough);-}--void SvgTextEditor::setTextSubscript()-{- QTextCharFormat format = m_textEditorWidget.richTextEdit->textCursor().charFormat();- if (format.verticalAlignment()==QTextCharFormat::AlignSubScript) {- format.setVerticalAlignment(QTextCharFormat::AlignNormal);- d->subscript = false;- } else {- format.setVerticalAlignment(QTextCharFormat::AlignSubScript);- d->subscript = true;- d->superscript = false;- }- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);-}--void SvgTextEditor::setTextSuperScript()-{- QTextCharFormat format = m_textEditorWidget.richTextEdit->textCursor().charFormat();- if (format.verticalAlignment()==QTextCharFormat::AlignSuperScript) {- format.setVerticalAlignment(QTextCharFormat::AlignNormal);- d->superscript = false;- } else {- format.setVerticalAlignment(QTextCharFormat::AlignSuperScript);- d->superscript = true;- d->subscript = false;- }- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);-}--void SvgTextEditor::increaseTextSize()-{- QTextCursor oldCursor = setTextSelection();- QTextCharFormat format;- qreal pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().fontPointSize();- if (pointSize <= 0.0) {- pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().font().pointSizeF();- }- if (pointSize <= 0.0) {- pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().font().pixelSize();- }- format.setFontPointSize(pointSize+1.0);- d->fontSize = format.fontPointSize();- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);-}--void SvgTextEditor::decreaseTextSize()-{- QTextCursor oldCursor = setTextSelection();- QTextCharFormat format;- qreal pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().fontPointSize();- if (pointSize <= 0.0) {- pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().font().pointSizeF();- }- if (pointSize <= 0.0) {- pointSize = m_textEditorWidget.richTextEdit->textCursor().charFormat().font().pixelSize();- }- if (pointSize <= 1.0) {- return;- }- format.setFontPointSize(qMax(pointSize-1.0, 1.0));- d->fontSize = format.fontPointSize();- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);-}--void SvgTextEditor::setLineHeight(double lineHeightPercentage)-{- QDoubleSpinBox *spnLineHeight = qobject_cast<QWidgetAction*>(actionCollection()->action("svg_line_height"))->defaultWidget()->findChild<QDoubleSpinBox *>();- QTextCursor oldCursor = setTextSelection();- QTextBlockFormat format = m_textEditorWidget.richTextEdit->textCursor().blockFormat();- if (lineHeightPercentage < 0.0) {- format.setLineHeight(1.0, QTextBlockFormat::SingleHeight);- spnLineHeight->setSingleStep(101.0);- } else {- format.setLineHeight(lineHeightPercentage, QTextBlockFormat::ProportionalHeight);- spnLineHeight->setSingleStep(10.0);- }- m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);-}--void SvgTextEditor::setLetterSpacing(double letterSpacing)-{- QTextCursor cursor = setTextSelection();- if (isRichTextEditorTabActive()) {- QTextCharFormat format;- format.setFontLetterSpacingType(QFont::AbsoluteSpacing);- format.setFontLetterSpacing(letterSpacing);- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(cursor);- } else if (isSvgSourceEditorTabActive()) {- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"letter-spacing:" + QString::number(letterSpacing) + "\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- d->letterSpacing = letterSpacing;-}--void SvgTextEditor::alignLeft()-{- QTextBlockFormat format;- format.setAlignment(Qt::AlignLeft);- if (KoSvgTextShapeMarkupConverter::getWrappingMode(- m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat())- == WrappingMode::WhiteSpacePreWrap) {- QTextCursor cursor(m_textEditorWidget.richTextEdit->document());- cursor.select(QTextCursor::Document);- cursor.mergeBlockFormat(format);- } else {- QTextCursor oldCursor = setTextSelection();- m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- }-}--void SvgTextEditor::alignRight()-{- QTextBlockFormat format;- format.setAlignment(Qt::AlignRight);- if (KoSvgTextShapeMarkupConverter::getWrappingMode(- m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat())- == WrappingMode::WhiteSpacePreWrap) {- QTextCursor cursor(m_textEditorWidget.richTextEdit->document());- cursor.select(QTextCursor::Document);- cursor.mergeBlockFormat(format);- } else {- QTextCursor oldCursor = setTextSelection();- m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- }-}--void SvgTextEditor::alignCenter()-{- QTextBlockFormat format;- format.setAlignment(Qt::AlignCenter);- if (KoSvgTextShapeMarkupConverter::getWrappingMode(- m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat())- == WrappingMode::WhiteSpacePreWrap) {- QTextCursor cursor(m_textEditorWidget.richTextEdit->document());- cursor.select(QTextCursor::Document);- cursor.mergeBlockFormat(format);- } else {- QTextCursor oldCursor = setTextSelection();- m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- }-}--void SvgTextEditor::alignJustified()-{- QTextCursor oldCursor = setTextSelection();- QTextBlockFormat format = m_textEditorWidget.richTextEdit->textCursor().blockFormat();- format.setAlignment(Qt::AlignJustify);- m_textEditorWidget.richTextEdit->textCursor().mergeBlockFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);-}-void SvgTextEditor::setSettings(){KoDialog settingsDialog(this);@@ -1072,20 +330,6 @@ void SvgTextEditor::setSettings()// get the settings and initialize the dialogKConfigGroup cfg(KSharedConfig::openConfig(), "SvgTextTool");- QStringList selectedWritingSystems = cfg.readEntry("selectedWritingSystems", "").split(",");-- QList<QFontDatabase::WritingSystem> scripts = QFontDatabase().writingSystems();- QStandardItemModel *writingSystemsModel = new QStandardItemModel(&settingsDialog);- for (int s = 0; s < scripts.size(); s ++) {- QString writingSystem = QFontDatabase().writingSystemName(scripts.at(s));- QStandardItem *script = new QStandardItem(writingSystem);- script->setCheckable(true);- script->setCheckState(selectedWritingSystems.contains(QString::number(scripts.at(s))) ? Qt::Checked : Qt::Unchecked);- script->setData((int)scripts.at(s));- writingSystemsModel->appendRow(script);- }- textSettings.lwScripts->setModel(writingSystemsModel);-QColor background = cfg.readEntry("colorEditorBackground", qApp->palette().window().color());textSettings.colorEditorBackground->setColor(background);textSettings.colorEditorForeground->setColor(cfg.readEntry("colorEditorForeground", qApp->palette().text().color()));@@ -1112,15 +356,6 @@ void SvgTextEditor::setSettings()settingsDialog.setButtons(KoDialog::Ok | KoDialog::Cancel);if (settingsDialog.exec() == QDialog::Accepted) {- // save and set the settings- QStringList writingSystems;- for (int i = 0; i < writingSystemsModel->rowCount(); i++) {- QStandardItem *item = writingSystemsModel->item(i);- if (item->checkState() == Qt::Checked) {- writingSystems.append(QString::number(item->data().toInt()));- }- }- cfg.writeEntry("selectedWritingSystems", writingSystems.join(','));cfg.writeEntry("colorEditorBackground", textSettings.colorEditorBackground->color());cfg.writeEntry("colorEditorForeground", textSettings.colorEditorForeground->color());@@ -1149,41 +384,6 @@ void SvgTextEditor::setSettings()}}-void SvgTextEditor::slotToolbarToggled(bool)-{-}--void SvgTextEditor::setFontColor(const KoColor &c)-{- QColor color = c.toQColor();- if (isRichTextEditorTabActive()) {- QTextCursor oldCursor = setTextSelection();- QTextCharFormat format;- format.setForeground(QBrush(color));- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- } else if (isSvgSourceEditorTabActive()) {- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan fill=\""+color.name()+"\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- // save last used color to be used when the editor is cleared- d->fontColor = color;-}--void SvgTextEditor::setBackgroundColor(const KoColor &c)-{- QColor color = c.toQColor();- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan stroke=\""+color.name()+"\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }-}void SvgTextEditor::setModified(bool modified){@@ -1208,150 +408,8 @@ void SvgTextEditor::dialogButtonClicked(QAbstractButton *button)}}-void SvgTextEditor::setFont(const QString &fontName)-{- QFont font;- font.fromString(fontName);- QTextCharFormat curFormat = m_textEditorWidget.richTextEdit->textCursor().charFormat();- qreal pointSize = curFormat.fontPointSize();- if (pointSize <= 0.0) {- pointSize = curFormat.font().pointSizeF();- }- font.setPointSize(pointSize);-- QFontDatabase fontDatabase;- const bool italic = fontDatabase.italic(font.family(), font.styleName());- const int fontWeight = fontDatabase.weight(font.family(), font.styleName());- if (isRichTextEditorTabActive()) {- QTextCharFormat format;- format.setFont(font);-- QTextCursor oldCursor = setTextSelection();- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- } else if (isSvgSourceEditorTabActive()) {- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"font-family:" + font.family() + ";" +- "font-weight:" + QString::number(fontWeight) + ";"- "font-style:" + (italic ? "italic" : "normal") + ";\">" +- cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- // save last used font to be used when the editor is cleared- d->font = font;-- checkFormat();-}--void SvgTextEditor::setFontSize(qreal fontSize)-{- if (isRichTextEditorTabActive()) {- QTextCursor oldCursor = setTextSelection();- QTextCharFormat format;- format.setFontPointSize(fontSize);- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(oldCursor);- } else if (isSvgSourceEditorTabActive()) {- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"font-size:" + QString::number(fontSize) + ";\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }- // set last used font size to be used when the editor is cleared- d->fontSize = fontSize;-}--void SvgTextEditor::setBaseline(KoSvgText::BaselineShiftMode)-{-- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();- if (cursor.hasSelection()) {- QString selectionModified = "<tspan style=\"font-size:50%;baseline-shift:super;\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }-}--void SvgTextEditor::setKerning(bool enable)-{- d->kerning = enable;-- if (isRichTextEditorTabActive()) {- QTextCharFormat format;- QTextCursor origCursor = setTextSelection();- format.setFontKerning(enable);- m_textEditorWidget.richTextEdit->mergeCurrentCharFormat(format);- m_textEditorWidget.richTextEdit->setTextCursor(origCursor);- } else if (isSvgSourceEditorTabActive()) {- QTextCursor cursor = m_textEditorWidget.svgTextEdit->textCursor();-- if (cursor.hasSelection()) {- QString value;- if (enable) {- value = "auto";- } else {- value = "0";- }-- QString selectionModified = "<tspan style=\"kerning:"+value+";\">" + cursor.selectedText() + "</tspan>";- cursor.removeSelectedText();- cursor.insertText(selectionModified);- }- }-}--void SvgTextEditor::setWrappingLegacy()-{- QTextFrameFormat f = m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat();- KoSvgTextShapeMarkupConverter::setWrappingMode(&f, WrappingMode::QtLegacy);- m_textEditorWidget.richTextEdit->document()->rootFrame()->setFrameFormat(f);- checkDocumentFormat();-}--void SvgTextEditor::setWrappingPre()-{- QTextFrameFormat f = m_textEditorWidget.richTextEdit->document()->rootFrame()->frameFormat();- KoSvgTextShapeMarkupConverter::setWrappingMode(&f, WrappingMode::WhiteSpacePre);- m_textEditorWidget.richTextEdit->document()->rootFrame()->setFrameFormat(f);- checkDocumentFormat();-}--void SvgTextEditor::setWrappingPreWrap()-{- KisSignalsBlocker b(m_textEditorWidget.richTextEdit);-- QTextDocument *doc = m_textEditorWidget.richTextEdit->document();-- // `inline-size` can only support one block alignment for the whole text- // element, therefore we should make all text blocks use the same alignment.- {- const Qt::Alignment firstBlockAlignment = doc->firstBlock().blockFormat().alignment();- QTextBlockFormat blockFmt;- blockFmt.setAlignment(firstBlockAlignment);- QTextCursor cursor(doc);- cursor.select(QTextCursor::Document);- cursor.mergeBlockFormat(blockFmt);- }-- QTextFrameFormat f = doc->rootFrame()->frameFormat();- const double inlineSize = KoSvgTextShapeMarkupConverter::getInlineSize(f).value_or(100.0);- KoSvgTextShapeMarkupConverter::setWrappingMode(&f, WrappingMode::WhiteSpacePreWrap);- KoSvgTextShapeMarkupConverter::setInlineSize(&f, inlineSize);- doc->rootFrame()->setFrameFormat(f);- checkDocumentFormat();-}-void SvgTextEditor::wheelEvent(QWheelEvent *event){- if (!isSvgSourceEditorTabActive()) {- return;- }-if (event->modifiers() & Qt::ControlModifier) {int numDegrees = event->angleDelta().y() / 8;int numSteps = numDegrees / 7;@@ -1360,27 +418,11 @@ void SvgTextEditor::wheelEvent(QWheelEvent *event)}}-QTextCursor SvgTextEditor::setTextSelection()-{- QTextCursor orignalCursor(m_textEditorWidget.richTextEdit->textCursor());- if (!orignalCursor.hasSelection()){- m_textEditorWidget.richTextEdit->selectAll();- }- return orignalCursor;-}-void SvgTextEditor::applySettings(){KConfigGroup cfg(KSharedConfig::openConfig(), "SvgTextTool");- QWidget *richTab = m_textEditorWidget.richTab;- QWidget *svgTab = m_textEditorWidget.svgTab;-m_page->setUpdatesEnabled(false);- m_textEditorWidget.textTab->clear();-- m_textEditorWidget.textTab->addTab(richTab, i18n("Rich text"));- m_textEditorWidget.textTab->addTab(svgTab, i18n("SVG Source"));m_syntaxHighlighter->setFormats();@@ -1388,29 +430,12 @@ void SvgTextEditor::applySettings()QColor background = cfg.readEntry("colorEditorBackground", qApp->palette().window().color());palette.setBrush(QPalette::Active, QPalette::Window, QBrush(background));- m_textEditorWidget.richTextEdit->setStyleSheet(QString("background-color:%1").arg(background.name()));m_textEditorWidget.svgStylesEdit->setStyleSheet(QString("background-color:%1").arg(background.name()));m_textEditorWidget.svgTextEdit->setStyleSheet(QString("background-color:%1").arg(background.name()));QColor foreground = cfg.readEntry("colorEditorForeground", qApp->palette().text().color());palette.setBrush(QPalette::Active, QPalette::Text, QBrush(foreground));- QStringList selectedWritingSystems = cfg.readEntry("selectedWritingSystems", "").split(",");-- QVector<QFontDatabase::WritingSystem> writingSystems;- for (int i=0; i<selectedWritingSystems.size(); i++) {- writingSystems.append((QFontDatabase::WritingSystem)QString(selectedWritingSystems.at(i)).toInt());- }-- {- FontSizeAction *fontSizeAction = qobject_cast<FontSizeAction*>(actionCollection()->action("svg_font_size"));- KisFontComboBoxes* fontComboBox = qobject_cast<KisFontComboBoxes*>(qobject_cast<QWidgetAction*>(actionCollection()->action("svg_font"))->defaultWidget());-- const QFont oldFont = fontComboBox->currentFont(fontSizeAction->fontSize());- fontComboBox->refillComboBox(writingSystems);- fontComboBox->setCurrentFont(oldFont);- }-m_page->setUpdatesEnabled(true);}@@ -1428,9 +453,6 @@ QAction *SvgTextEditor::createAction(const QString &name, const char *member)void SvgTextEditor::createActions(){- KisActionRegistry *actionRegistry = KisActionRegistry::instance();--// File: new, open, save, save as, closeKStandardAction::save(this, SLOT(save()), actionCollection());KStandardAction::close(this, SLOT(slotCloseEditor()), actionCollection());@@ -1452,72 +474,10 @@ void SvgTextEditor::createActions()// WISH: we cannot zoom-in/out in rech-text modem_svgTextActions << KStandardAction::zoomOut(this, SLOT(zoomOut()), actionCollection());m_svgTextActions << KStandardAction::zoomIn(this, SLOT(zoomIn()), actionCollection());-#ifndef Q_OS_WIN- // Insert:- QAction * insertAction = createAction("svg_insert_special_character",- SLOT(showInsertSpecialCharacterDialog()));- insertAction->setCheckable(true);- insertAction->setChecked(false);-#endif- // Format:- m_richTextActions << createAction("svg_weight_bold",- SLOT(setTextBold()));-- m_richTextActions << createAction("svg_format_italic",- SLOT(setTextItalic()));-- m_richTextActions << createAction("svg_format_underline",- SLOT(setTextUnderline()));-- m_richTextActions << createAction("svg_format_strike_through",- SLOT(setTextStrikethrough()));-- m_richTextActions << createAction("svg_format_superscript",- SLOT(setTextSuperScript()));-- m_richTextActions << createAction("svg_format_subscript",- SLOT(setTextSubscript()));-- m_richTextActions << createAction("svg_weight_light",- SLOT(setTextWeightLight()));-- m_richTextActions << createAction("svg_weight_normal",- SLOT(setTextWeightNormal()));-- m_richTextActions << createAction("svg_weight_demi",- SLOT(setTextWeightDemi()));-- m_richTextActions << createAction("svg_weight_black",- SLOT(setTextWeightBlack()));-- m_richTextActions << createAction("svg_increase_font_size",- SLOT(increaseTextSize()));-- m_richTextActions << createAction("svg_decrease_font_size",- SLOT(decreaseTextSize()));-- m_richTextActions << createAction("svg_align_left",- SLOT(alignLeft()));-- m_richTextActions << createAction("svg_align_right",- SLOT(alignRight()));-- m_richTextActions << createAction("svg_align_center",- SLOT(alignCenter()));-// m_richTextActions << createAction("svg_align_justified",-// SLOT(alignJustified()));-- m_richTextActions << createAction("svg_font_kerning",- SLOT(setKerning(bool)));-- d->textWrappingActionGroup = new QActionGroup(this);- m_richTextActions << d->textWrappingActionGroup->addAction(- createAction("svg_text_wrapping_legacy", SLOT(setWrappingLegacy())));- m_richTextActions << d->textWrappingActionGroup->addAction(- createAction("svg_text_wrapping_css_pre", SLOT(setWrappingPre())));- m_richTextActions << d->textWrappingActionGroup->addAction(- createAction("svg_text_wrapping_css_pre_wrap", SLOT(setWrappingPreWrap())));+ Q_FOREACH(QAction *action, m_svgTextActions) {+ action->setEnabled(true);+ }// Settings// do not add settings action to m_richTextActions list,@@ -1525,117 +485,7 @@ void SvgTextEditor::createActions()// otherwise we can lock the user out of being able to change// editor mode, if user changes to SVG only mode.createAction("svg_settings", SLOT(setSettings()));-- QWidgetAction *fontComboAction = new QWidgetAction(this);- fontComboAction->setToolTip(i18n("Font"));- KisFontComboBoxes *fontCombo = new KisFontComboBoxes();- connect(fontCombo, SIGNAL(fontChanged(QString)), SLOT(setFont(QString)));- fontComboAction->setDefaultWidget(fontCombo);- actionCollection()->addAction("svg_font", fontComboAction);- m_richTextActions << fontComboAction;- actionRegistry->propertizeAction("svg_font", fontComboAction);-- QWidgetAction *fontSizeAction = new FontSizeAction(this);- fontSizeAction->setToolTip(i18n("Size"));- connect(fontSizeAction, SIGNAL(fontSizeChanged(qreal)), this, SLOT(setFontSize(qreal)));- actionCollection()->addAction("svg_font_size", fontSizeAction);- m_richTextActions << fontSizeAction;- actionRegistry->propertizeAction("svg_font_size", fontSizeAction);-- KoColorPopupAction *fgColor = new KoColorPopupAction(this);- fgColor->setCurrentColor(QColor(Qt::black));- fgColor->setToolTip(i18n("Text Color"));- connect(fgColor, SIGNAL(colorChanged(KoColor)), SLOT(setFontColor(KoColor)));- actionCollection()->addAction("svg_format_textcolor", fgColor);- m_richTextActions << fgColor;- actionRegistry->propertizeAction("svg_format_textcolor", fgColor);-- KoColorPopupAction *bgColor = new KoColorPopupAction(this);- bgColor->setCurrentColor(QColor(Qt::white));- bgColor->setToolTip(i18n("Background Color"));- connect(bgColor, SIGNAL(colorChanged(KoColor)), SLOT(setBackgroundColor(KoColor)));- actionCollection()->addAction("svg_background_color", bgColor);- actionRegistry->propertizeAction("svg_background_color", bgColor);- m_richTextActions << bgColor;-- QWidgetAction *colorSamplerAction = new QWidgetAction(this);- colorSamplerAction->setToolTip(i18n("Sample a Color"));- KisScreenColorSampler *colorSampler = new KisScreenColorSampler(false);- connect(colorSampler, SIGNAL(sigNewColorSampled(KoColor)), fgColor, SLOT(setCurrentColor(KoColor)));- connect(colorSampler, SIGNAL(sigNewColorSampled(KoColor)), SLOT(setFontColor(KoColor)));- colorSamplerAction->setDefaultWidget(colorSampler);- actionCollection()->addAction("svg_sample_color", colorSamplerAction);- m_richTextActions << colorSamplerAction;- actionRegistry->propertizeAction("svg_sample_color", colorSamplerAction);-- QWidgetAction *lineHeight = new QWidgetAction(this);- QWidget *lineHeightWdg = new QWidget();- QHBoxLayout *lineHeightLayout = new QHBoxLayout(lineHeightWdg);- lineHeightLayout->setSpacing(0);- QDoubleSpinBox *spnLineHeight = new QDoubleSpinBox();- spnLineHeight->setToolTip(i18n("Line height"));- spnLineHeight->setRange(-1.0, 1000.0);- spnLineHeight->setSingleStep(10.0);- KisSpinBoxI18nHelper::setText(spnLineHeight, i18nc("{n} is the number value, % is the percent sign", "{n}%"));- spnLineHeight->setSpecialValueText(i18nc("Default line height for text", "Normal"));- connect(spnLineHeight, SIGNAL(valueChanged(double)), SLOT(setLineHeight(double)));- lineHeightLayout->addWidget(spnLineHeight);- {- QToolButton *btn = new QToolButton();- btn->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);- btn->setArrowType(Qt::DownArrow);- btn->setPopupMode(QToolButton::InstantPopup);- QMenu *lineHeightMenu = new QMenu(this);- QAction *actionNormal = lineHeightMenu->addAction(i18nc("Default line height for text", "Normal"));- connect(actionNormal, &QAction::triggered, spnLineHeight, [spnLineHeight]() {- spnLineHeight->setValue(-1.0);- });- QAction *action100 = lineHeightMenu->addAction(i18nc("line height for text", "100%"));- connect(action100, &QAction::triggered, spnLineHeight, [spnLineHeight]() {- spnLineHeight->setValue(100.0);- });- btn->setMenu(lineHeightMenu);- lineHeightLayout->addWidget(btn);- }- lineHeight->setDefaultWidget(lineHeightWdg);- actionCollection()->addAction("svg_line_height", lineHeight);- m_richTextActions << lineHeight;- actionRegistry->propertizeAction("svg_line_height", lineHeight);-- QWidgetAction *letterSpacing = new QWidgetAction(this);- QDoubleSpinBox *spnletterSpacing = new QDoubleSpinBox();- spnletterSpacing->setToolTip(i18n("Letter Spacing"));- spnletterSpacing->setRange(-20.0, 20.0);- spnletterSpacing->setSingleStep(0.5);- connect(spnletterSpacing, SIGNAL(valueChanged(double)), SLOT(setLetterSpacing(double)));- letterSpacing->setDefaultWidget(spnletterSpacing);- actionCollection()->addAction("svg_letter_spacing", letterSpacing);- m_richTextActions << letterSpacing;- actionRegistry->propertizeAction("svg_letter_spacing", letterSpacing);-}--void SvgTextEditor::enableRichTextActions(bool enable)-{- Q_FOREACH(QAction *action, m_richTextActions) {- action->setEnabled(enable);- }}--void SvgTextEditor::enableSvgTextActions(bool enable)-{- Q_FOREACH(QAction *action, m_svgTextActions) {- action->setEnabled(enable);- }-}--bool SvgTextEditor::isRichTextEditorTabActive() {- return m_textEditorWidget.textTab->currentIndex() == Editor::Richtext;-}--bool SvgTextEditor::isSvgSourceEditorTabActive() {- return m_textEditorWidget.textTab->currentIndex() == Editor::SVGsource;-}-void SvgTextEditor::slotCloseEditor(){close();@@ -1644,16 +494,14 @@ void SvgTextEditor::slotCloseEditor()bool SvgTextEditor::eventFilter(QObject *const watched, QEvent *const event){- if (watched == m_textEditorWidget.richTextEdit) {- if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {- QKeyEvent *const keyEvent = static_cast<QKeyEvent *>(event);- if ((keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)+ if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) {+ QKeyEvent *const keyEvent = static_cast<QKeyEvent *>(event);+ if ((keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)&& (keyEvent->modifiers() & Qt::ShiftModifier)) {- // Disable soft line breaks- return true;- }+ // Disable soft line breaks+ return true;}- return false;}+ return false;return KXmlGuiWindow::eventFilter(watched, event);}diff --git a/plugins/tools/svgtexttool/SvgTextEditor.h b/plugins/tools/svgtexttool/SvgTextEditor.hindex 13c98d0094..19f843353b 100644--- a/plugins/tools/svgtexttool/SvgTextEditor.h+++ b/plugins/tools/svgtexttool/SvgTextEditor.h@@ -30,30 +30,12 @@ public:SvgTextEditor(QWidget *parent = 0, Qt::WindowFlags f = Qt::WindowFlags());~SvgTextEditor();- //tiny enum to keep track of the tab on which editor something happens while keeping the code readable.- enum Editor {- Richtext, // 0- SVGsource // 1- };-void setInitialShape(KoSvgTextShape *shape);private Q_SLOTS:- /**- * switch the text editor tab.- */- void switchTextEditorTab(bool convertData = true);void slotCloseEditor();- /**- * in rich text, check the current format, and toggle the given buttons.- */- void checkFormat();- void checkDocumentFormat();-- void slotFixUpEmptyTextBlock();-void save();void undo();@@ -73,47 +55,8 @@ private Q_SLOTS:void zoomOut();void zoomIn();-#ifndef Q_OS_WIN- void showInsertSpecialCharacterDialog();- void insertCharacter(const QChar &c);-#endif- void setTextBold(QFont::Weight weight = QFont::Bold);- void setTextWeightLight();- void setTextWeightNormal();- void setTextWeightDemi();- void setTextWeightBlack();-- void setTextItalic(QFont::Style style = QFont::StyleOblique);- void setTextDecoration(KoSvgText::TextDecoration decor);- void setTextUnderline();- void setTextOverline();- void setTextStrikethrough();- void setTextSubscript();- void setTextSuperScript();- void increaseTextSize();- void decreaseTextSize();-- void setLineHeight(double lineHeightPercentage);- void setLetterSpacing(double letterSpacing);- void alignLeft();- void alignRight();- void alignCenter();- void alignJustified();-- void setFont(const QString &fontName);- void setFontSize(qreal size);- void setBaseline(KoSvgText::BaselineShiftMode baseline);- void setKerning(bool enable);-- void setWrappingLegacy();- void setWrappingPre();- void setWrappingPreWrap();void setSettings();- void slotToolbarToggled(bool);-- void setFontColor(const KoColor &c);- void setBackgroundColor(const KoColor &c);void setModified(bool modified);void dialogButtonClicked(QAbstractButton *button);@@ -125,11 +68,6 @@ Q_SIGNALS:protected:void wheelEvent(QWheelEvent *event) override;bool eventFilter(QObject *watched, QEvent *event) override;- /**- * Selects all if there is no selection- * @returns a copy of the previous cursor.- */- QTextCursor setTextSelection();private:void applySettings();@@ -137,21 +75,13 @@ private:QAction *createAction(const QString &name,const char *member);void createActions();- void enableRichTextActions(bool enable);- void enableSvgTextActions(bool enable);- bool isRichTextEditorTabActive();- bool isSvgSourceEditorTabActive();Ui_WdgSvgTextEditor m_textEditorWidget;QTextEdit *m_currentEditor {0};QWidget *m_page {0};- QList<QAction*> m_richTextActions;QList<QAction*> m_svgTextActions;KoSvgTextShape *m_shape {0};-#ifndef Q_OS_WIN- KoDialog *m_charSelectDialog {0};-#endifBasicXMLSyntaxHighlighter *m_syntaxHighlighter;QString m_searchKey;diff --git a/plugins/tools/svgtexttool/SvgTextTool.action b/plugins/tools/svgtexttool/SvgTextTool.actionindex a8158cdb1a..ab273612aa 100644--- a/plugins/tools/svgtexttool/SvgTextTool.action+++ b/plugins/tools/svgtexttool/SvgTextTool.action@@ -12,46 +12,6 @@<isCheckable>false</isCheckable><statusTip/></Action>- <Action name="svg_format_textcolor">- <iconText>Text Color</iconText>- <shortcut/>- <toolTip>Text Color...</toolTip>- <icon>format-text-color</icon>- <whatsThis/>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Text Color</text>- </Action>- <Action name="svg_background_color">- <iconText>Background</iconText>- <shortcut/>- <toolTip>Background Color...</toolTip>- <icon>format-fill-color</icon>- <whatsThis/>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Background</text>- </Action>- <Action name="svg_font_size">- <iconText>Font Size</iconText>- <shortcut/>- <toolTip>Font Size</toolTip>- <icon/>- <whatsThis/>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Font Size</text>- </Action>- <Action name="svg_font">- <iconText>Font...</iconText>- <shortcut>Ctrl+Alt+F</shortcut>- <toolTip>Change character size, font, boldface, italics etc.</toolTip>- <icon/>- <whatsThis>Change the attributes of the currently selected characters.</whatsThis>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Font...</text>- </Action><Action name="svg_insert_special_character"><iconText>Special Character...</iconText><shortcut>Alt+Shift+C</shortcut>@@ -222,16 +182,6 @@<isCheckable>true</isCheckable><text>Light</text></Action>- <Action name="svg_line_height">- <iconText>Line Height</iconText>- <shortcut>Ctrl+H</shortcut>- <toolTip>Line Height in em</toolTip>- <icon></icon>- <whatsThis/>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Line Height</text>- </Action><Action name="svg_settings"><iconText>Settings</iconText><shortcut></shortcut>@@ -242,16 +192,6 @@<isCheckable>false</isCheckable><text context="Text Editor Settings label">Settings...</text></Action>- <Action name="svg_sample_color">- <iconText>Color Sampler</iconText>- <shortcut></shortcut>- <toolTip>Sample a color from the screen</toolTip>- <icon></icon>- <whatsThis/>- <statusTip/>- <isCheckable>false</isCheckable>- <text>Color Sampler</text>- </Action><Action name="svg_font_kerning"><iconText>Kerning</iconText><shortcut></shortcut>@@ -262,35 +202,5 @@<isCheckable>true</isCheckable><text>Kerning</text></Action>- <Action name="svg_text_wrapping_legacy">- <iconText>Legacy Hard Wrap</iconText>- <shortcut></shortcut>- <toolTip>Use legacy hard-wrapping mode (same as Krita 5.1 and earlier). Each lines are explicitly positioned, but the line height may be slightly inaccurate.</toolTip>- <icon></icon>- <whatsThis/>- <statusTip/>- <isCheckable>true</isCheckable>- <text>Legacy Hard Wrap</text>- </Action>- <Action name="svg_text_wrapping_css_pre">- <iconText>SVG Hard Wrap</iconText>- <shortcut></shortcut>- <toolTip>Use SVG's CSS `white-space: pre` hard-wrapping mode.</toolTip>- <icon></icon>- <whatsThis/>- <statusTip/>- <isCheckable>true</isCheckable>- <text>SVG Hard Wrap</text>- </Action>- <Action name="svg_text_wrapping_css_pre_wrap">- <iconText>SVG Auto Wrap with Fixed Width</iconText>- <shortcut></shortcut>- <toolTip>Use SVG's CSS `white-space: pre-wrap` wrapping mode, with `inline-size` defining the text width.</toolTip>- <icon></icon>- <whatsThis/>- <statusTip/>- <isCheckable>true</isCheckable>- <text>SVG Auto Wrap with Fixed Width</text>- </Action></Actions></ActionCollection>diff --git a/plugins/tools/svgtexttool/SvgTextTool.cpp b/plugins/tools/svgtexttool/SvgTextTool.cppindex 7af77373d4..7473bf3dd2 100644--- a/plugins/tools/svgtexttool/SvgTextTool.cpp+++ b/plugins/tools/svgtexttool/SvgTextTool.cpp@@ -277,8 +277,7 @@ QWidget *SvgTextTool::createOptionWidget()connect(optionUi.defPointSize, SIGNAL(currentIndexChanged(int)), this, SLOT(storeDefaults()));connect(optionUi.defLetterSpacing, SIGNAL(valueChanged(double)), SLOT(storeDefaults()));- connect(optionUi.btnEdit, SIGNAL(clicked(bool)), SLOT(showEditor()));- connect(optionUi.btnEditSvg, SIGNAL(clicked(bool)), SLOT(showEditorSvgSource()));+ connect(optionUi.btnEditSvg, SIGNAL(clicked(bool)), SLOT(showEditor()));connect(optionUi.btnGlyphPalette, SIGNAL(clicked(bool)), SLOT(showGlyphPalette()));m_convertType = new QButtonGroup();@@ -340,15 +339,6 @@ void SvgTextTool::showEditor()}}-void SvgTextTool::showEditorSvgSource()-{- KoSvgTextShape *shape = selectedShape();- if (!shape) {- return;- }- showEditor();-}-void SvgTextTool::textUpdated(KoSvgTextShape *shape, const QString &svg, const QString &defs){SvgTextChangeCommand *cmd = new SvgTextChangeCommand(shape, svg, defs);diff --git a/plugins/tools/svgtexttool/SvgTextTool.h b/plugins/tools/svgtexttool/SvgTextTool.hindex 55b874acc4..7f41b4aceb 100644--- a/plugins/tools/svgtexttool/SvgTextTool.h+++ b/plugins/tools/svgtexttool/SvgTextTool.h@@ -106,7 +106,6 @@ private:private Q_SLOTS:void showEditor();- void showEditorSvgSource();void slotTextEditorClosed();void textUpdated(KoSvgTextShape *shape, const QString &svg, const QString &defs);diff --git a/plugins/tools/svgtexttool/WdgSvgTextEditor.ui b/plugins/tools/svgtexttool/WdgSvgTextEditor.uiindex 228a4474cb..de60061399 100644--- a/plugins/tools/svgtexttool/WdgSvgTextEditor.ui+++ b/plugins/tools/svgtexttool/WdgSvgTextEditor.ui@@ -1,4 +1,4 @@-<?xml version="1.0" encoding="utf-8"?>+<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"><author>SPDX-FileCopyrightText: none@@ -16,58 +16,31 @@</property><layout class="QVBoxLayout" name="verticalLayout"><item>- <widget class="QTabWidget" name="textTab">+ <widget class="QTabWidget" name="tabWidget"><property name="currentIndex"><number>0</number></property>- <property name="tabBarAutoHide">- <bool>true</bool>- </property>- <widget class="QWidget" name="richTab">+ <widget class="QWidget" name="tabSvgTextEdit"><attribute name="title">- <string>Rich text</string>+ <string>SVG</string></attribute>- <layout class="QVBoxLayout" name="verticalLayout_5">- <item>- <widget class="SvgRichTextCtrl" name="richTextEdit"/>+ <layout class="QGridLayout" name="gridLayout">+ <item row="0" column="0">+ <widget class="QTextEdit" name="svgTextEdit">+ <property name="acceptRichText">+ <bool>false</bool>+ </property>+ </widget></item></layout></widget>- <widget class="QWidget" name="svgTab">+ <widget class="QWidget" name="tabSvgStylesEdit"><attribute name="title">- <string>SVG source</string>+ <string>Styles</string></attribute>- <layout class="QHBoxLayout" name="horizontalLayout_6">- <item>- <widget class="QTabWidget" name="tabWidget">- <property name="currentIndex">- <number>0</number>- </property>- <widget class="QWidget" name="tabSvgTextEdit">- <attribute name="title">- <string>SVG</string>- </attribute>- <layout class="QGridLayout" name="gridLayout">- <item column="0" row="0">- <widget class="QTextEdit" name="svgTextEdit">- <property name="acceptRichText">- <bool>false</bool>- </property>- </widget>- </item>- </layout>- </widget>- <widget class="QWidget" name="tabSvgStylesEdit">- <attribute name="title">- <string>Styles</string>- </attribute>- <layout class="QGridLayout" name="gridLayout_2">- <item column="0" row="0">- <widget class="QTextEdit" name="svgStylesEdit"/>- </item>- </layout>- </widget>- </widget>+ <layout class="QGridLayout" name="gridLayout_2">+ <item row="0" column="0">+ <widget class="QTextEdit" name="svgStylesEdit"/></item></layout></widget>@@ -82,13 +55,6 @@</item></layout></widget>- <customwidgets>- <customwidget>- <class>SvgRichTextCtrl</class>- <extends>QTextEdit</extends>- <header>SvgRichTextCtrl.h</header>- </customwidget>- </customwidgets><resources/><connections/></ui>diff --git a/plugins/tools/svgtexttool/WdgSvgTextOptionWidget.ui b/plugins/tools/svgtexttool/WdgSvgTextOptionWidget.uiindex c84e5989a3..8cf935b5c9 100644--- a/plugins/tools/svgtexttool/WdgSvgTextOptionWidget.ui+++ b/plugins/tools/svgtexttool/WdgSvgTextOptionWidget.ui@@ -15,7 +15,7 @@</rect></property><layout class="QGridLayout" name="gridLayout">- <item row="6" column="0">+ <item row="5" column="0"><spacer name="verticalSpacer"><property name="orientation"><enum>Qt::Vertical</enum>@@ -28,50 +28,65 @@</property></spacer></item>- <item row="3" column="0">- <widget class="QPushButton" name="btnGlyphPalette">- <property name="text">- <string>Glyph Palette</string>- </property>- </widget>- </item>- <item row="2" column="0">+ <item row="1" column="0"><widget class="QPushButton" name="btnEditSvg"><property name="text"><string>Edit SVG Source</string></property></widget></item>- <item row="5" column="0">- <widget class="QGroupBox" name="groupBoxDebug">+ <item row="3" column="0">+ <widget class="QGroupBox" name="groupBoxConvert"><property name="title">- <string notr="true">Debug Tools</string>+ <string>Text Type</string></property>- <layout class="QVBoxLayout" name="verticalLayout_2">+ <layout class="QVBoxLayout" name="verticalLayout_3"><item>- <widget class="QCheckBox" name="chkDbgCharBbox">+ <widget class="QPushButton" name="convertPreFormatBtn">+ <property name="toolTip">+ <string><html><head/><body><p>The text will not wrap and preserves spaces and new lines. A line break is inserted so the lines from wrapping or positioning remain separated.</p></body></html></string>+ </property><property name="text">- <string notr="true">Show char bounding boxes</string>+ <string>Preformatted</string></property>- <property name="checked">+ <property name="checkable"><bool>true</bool></property></widget></item><item>- <widget class="QCheckBox" name="chkDbgLineBox">+ <widget class="QPushButton" name="convertInlineBtn">+ <property name="toolTip">+ <string><html><head/><body><p>Text wraps inside a fixed length, spaces and new lines are preserved. New lines are not removed.</p></body></html></string>+ </property><property name="text">- <string notr="true">Show line boxes</string>+ <string>Inline Wrapped</string>+ </property>+ <property name="checkable">+ <bool>true</bool>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QPushButton" name="convertToSvg1_1">+ <property name="toolTip">+ <string><html><head/><body><p>Text uses SVG 1.1 character transforms to position each line. Spaces and new lines are collapsed. This is for backward compatibility with SVG 1.1.</p></body></html></string>+ </property>+ <property name="text">+ <string>Prepositioned</string>+ </property>+ <property name="checkable">+ <bool>true</bool></property></widget></item></layout></widget></item>- <item row="1" column="0">- <widget class="QPushButton" name="btnEdit">+ <item row="2" column="0">+ <widget class="QPushButton" name="btnGlyphPalette"><property name="text">- <string>Edit Text</string>+ <string>Glyph Palette</string></property></widget></item>@@ -334,47 +349,25 @@</widget></item><item row="4" column="0">- <widget class="QGroupBox" name="groupBoxConvert">+ <widget class="QGroupBox" name="groupBoxDebug"><property name="title">- <string>Text Type</string>+ <string notr="true">Debug Tools</string></property>- <layout class="QVBoxLayout" name="verticalLayout_3">- <item>- <widget class="QPushButton" name="convertPreFormatBtn">- <property name="toolTip">- <string><html><head/><body><p>The text will not wrap and preserves spaces and new lines. A line break is inserted so the lines from wrapping or positioning remain separated.</p></body></html></string>- </property>- <property name="text">- <string>Preformatted</string>- </property>- <property name="checkable">- <bool>true</bool>- </property>- </widget>- </item>+ <layout class="QVBoxLayout" name="verticalLayout_2"><item>- <widget class="QPushButton" name="convertInlineBtn">- <property name="toolTip">- <string><html><head/><body><p>Text wraps inside a fixed length, spaces and new lines are preserved. New lines are not removed.</p></body></html></string>- </property>+ <widget class="QCheckBox" name="chkDbgCharBbox"><property name="text">- <string>Inline Wrapped</string>+ <string notr="true">Show char bounding boxes</string></property>- <property name="checkable">+ <property name="checked"><bool>true</bool></property></widget></item><item>- <widget class="QPushButton" name="convertToSvg1_1">- <property name="toolTip">- <string><html><head/><body><p>Text uses SVG 1.1 character transforms to position each line. Spaces and new lines are collapsed. This is for backward compatibility with SVG 1.1.</p></body></html></string>- </property>+ <widget class="QCheckBox" name="chkDbgLineBox"><property name="text">- <string>Prepositioned</string>- </property>- <property name="checkable">- <bool>true</bool>+ <string notr="true">Show line boxes</string></property></widget></item>diff --git a/plugins/tools/svgtexttool/WdgSvgTextSettings.ui b/plugins/tools/svgtexttool/WdgSvgTextSettings.uiindex 1a6298cf53..022291c89a 100644--- a/plugins/tools/svgtexttool/WdgSvgTextSettings.ui+++ b/plugins/tools/svgtexttool/WdgSvgTextSettings.ui@@ -1,4 +1,4 @@-<?xml version="1.0" encoding="utf-8"?>+<?xml version="1.0" encoding="UTF-8"?><ui version="4.0"><author>SPDX-FileCopyrightText: none@@ -14,217 +14,183 @@<height>331</height></rect></property>- <layout class="QGridLayout" name="gridLayout_2">- <item column="0" row="0">- <widget class="QTabWidget" name="tabWidget">- <property name="currentIndex">- <number>0</number>- </property>- <widget class="QWidget" name="tab_2">- <attribute name="title">- <string>Colors</string>- </attribute>- <layout class="QVBoxLayout" name="verticalLayout">- <item>- <layout class="QHBoxLayout" name="horizontalLayout">- <item>- <widget class="QLabel" name="label_2">- <property name="text">- <string>Keyword</string>- </property>- </widget>- </item>- <item>- <widget class="KColorButton" name="colorKeyword"/>- </item>- <item>- <widget class="QCheckBox" name="chkBoldKeyword">- <property name="text">- <string>Bold</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="chkItalicKeyword">- <property name="text">- <string>Italic</string>- </property>- </widget>- </item>- </layout>- </item>- <item>- <layout class="QHBoxLayout" name="horizontalLayout_2">- <item>- <widget class="QLabel" name="label_3">- <property name="text">- <string>Element</string>- </property>- </widget>- </item>- <item>- <widget class="KColorButton" name="colorElement"/>- </item>- <item>- <widget class="QCheckBox" name="chkBoldElement">- <property name="text">- <string>Bold</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="chkItalicElement">- <property name="text">- <string>Italic</string>- </property>- </widget>- </item>- </layout>- </item>- <item>- <layout class="QHBoxLayout" name="horizontalLayout_3">- <item>- <widget class="QLabel" name="label_4">- <property name="text">- <string>Attribute</string>- </property>- </widget>- </item>- <item>- <widget class="KColorButton" name="colorAttribute"/>- </item>- <item>- <widget class="QCheckBox" name="chkBoldAttribute">- <property name="text">- <string>Bold</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="chkItalicAttribute">- <property name="text">- <string>Italic</string>- </property>- </widget>- </item>- </layout>- </item>- <item>- <layout class="QHBoxLayout" name="horizontalLayout_4">- <item>- <widget class="QLabel" name="label_5">- <property name="text">- <string comment="The Value label used by SVG Text Tool">Value</string>- </property>- </widget>- </item>- <item>- <widget class="KColorButton" name="colorValue"/>- </item>- <item>- <widget class="QCheckBox" name="chkBoldValue">- <property name="text">- <string>Bold</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="chkItalicValue">- <property name="text">- <string>Italic</string>- </property>- </widget>- </item>- </layout>- </item>- <item>- <layout class="QHBoxLayout" name="horizontalLayout_5">- <item>- <widget class="QLabel" name="colorComment_2">- <property name="text">- <string>Comment</string>- </property>- </widget>- </item>- <item>- <widget class="KColorButton" name="colorComment"/>- </item>- <item>- <widget class="QCheckBox" name="chkBoldComment">- <property name="text">- <string>Bold</string>- </property>- </widget>- </item>- <item>- <widget class="QCheckBox" name="chkItalicComment">- <property name="text">- <string>Italic</string>- </property>- </widget>- </item>- </layout>- </item>- <item>- <layout class="QFormLayout" name="formLayout_2">- <item column="0" row="0">- <widget class="QLabel" name="label_6">- <property name="text">- <string>Editor text color</string>- </property>- </widget>- </item>- <item column="1" row="0">- <widget class="KColorButton" name="colorEditorForeground"/>- </item>- <item column="0" row="1">- <widget class="QLabel" name="label_7">- <property name="text">- <string>Editor background:</string>- </property>- </widget>- </item>- <item column="1" row="1">- <widget class="KColorButton" name="colorEditorBackground"/>- </item>- <item column="1" row="2">- <spacer name="verticalSpacer_2">- <property name="orientation">- <enum>Qt::Vertical</enum>- </property>- <property name="sizeHint" stdset="0">- <size>- <width>20</width>- <height>40</height>- </size>- </property>- </spacer>- </item>- </layout>- </item>- </layout>- </widget>- <widget class="QWidget" name="tab_3">- <attribute name="title">- <string>Fonts</string>- </attribute>- <layout class="QVBoxLayout" name="verticalLayout_2">- <item>- <widget class="QLabel" name="label_8">- <property name="text">- <string><html><head/><body><p>Which writing system should the fonts chooser show the fonts of? No writing system selected will have all fonts shown.</p></body></html></string>- </property>- <property name="wordWrap">- <bool>true</bool>- </property>- </widget>- </item>- <item>- <widget class="QListView" name="lwScripts"/>- </item>- </layout>- </widget>- </widget>+ <layout class="QVBoxLayout" name="verticalLayout_3">+ <item>+ <layout class="QHBoxLayout" name="horizontalLayout">+ <item>+ <widget class="QLabel" name="label_2">+ <property name="text">+ <string>Keyword</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="KColorButton" name="colorKeyword"/>+ </item>+ <item>+ <widget class="QCheckBox" name="chkBoldKeyword">+ <property name="text">+ <string>Bold</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="chkItalicKeyword">+ <property name="text">+ <string>Italic</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <layout class="QHBoxLayout" name="horizontalLayout_2">+ <item>+ <widget class="QLabel" name="label_3">+ <property name="text">+ <string>Element</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="KColorButton" name="colorElement"/>+ </item>+ <item>+ <widget class="QCheckBox" name="chkBoldElement">+ <property name="text">+ <string>Bold</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="chkItalicElement">+ <property name="text">+ <string>Italic</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <layout class="QHBoxLayout" name="horizontalLayout_3">+ <item>+ <widget class="QLabel" name="label_4">+ <property name="text">+ <string>Attribute</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="KColorButton" name="colorAttribute"/>+ </item>+ <item>+ <widget class="QCheckBox" name="chkBoldAttribute">+ <property name="text">+ <string>Bold</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="chkItalicAttribute">+ <property name="text">+ <string>Italic</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <layout class="QHBoxLayout" name="horizontalLayout_4">+ <item>+ <widget class="QLabel" name="label_5">+ <property name="text">+ <string comment="The Value label used by SVG Text Tool">Value</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="KColorButton" name="colorValue"/>+ </item>+ <item>+ <widget class="QCheckBox" name="chkBoldValue">+ <property name="text">+ <string>Bold</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="chkItalicValue">+ <property name="text">+ <string>Italic</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <layout class="QHBoxLayout" name="horizontalLayout_5">+ <item>+ <widget class="QLabel" name="colorComment_2">+ <property name="text">+ <string>Comment</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="KColorButton" name="colorComment"/>+ </item>+ <item>+ <widget class="QCheckBox" name="chkBoldComment">+ <property name="text">+ <string>Bold</string>+ </property>+ </widget>+ </item>+ <item>+ <widget class="QCheckBox" name="chkItalicComment">+ <property name="text">+ <string>Italic</string>+ </property>+ </widget>+ </item>+ </layout>+ </item>+ <item>+ <layout class="QFormLayout" name="formLayout_2">+ <item row="0" column="0">+ <widget class="QLabel" name="label_6">+ <property name="text">+ <string>Editor text color</string>+ </property>+ </widget>+ </item>+ <item row="0" column="1">+ <widget class="KColorButton" name="colorEditorForeground"/>+ </item>+ <item row="1" column="0">+ <widget class="QLabel" name="label_7">+ <property name="text">+ <string>Editor background:</string>+ </property>+ </widget>+ </item>+ <item row="1" column="1">+ <widget class="KColorButton" name="colorEditorBackground"/>+ </item>+ <item row="2" column="1">+ <spacer name="verticalSpacer_2">+ <property name="orientation">+ <enum>Qt::Vertical</enum>+ </property>+ <property name="sizeHint" stdset="0">+ <size>+ <width>20</width>+ <height>40</height>+ </size>+ </property>+ </spacer>+ </item>+ </layout></item></layout></widget>@@ -237,4 +203,4 @@</customwidgets><resources/><connections/>-</ui>\ No newline at end of file+</ui>diff --git a/plugins/tools/svgtexttool/svgtexttool.xmlgui b/plugins/tools/svgtexttool/svgtexttool.xmlguiindex bf1850b0f5..d4bfc0bd00 100644--- a/plugins/tools/svgtexttool/svgtexttool.xmlgui+++ b/plugins/tools/svgtexttool/svgtexttool.xmlgui@@ -29,43 +29,6 @@<Action name="view_zoom_out"/><Action name="view_zoom_in"/></Menu>- <Menu name="insert">- <text>&Insert</text>- <Action name="svg_insert_special_character"/>- </Menu>- <Menu name="format">- <text>&Format</text>- <Action name="svg_weight_bold"/>- <Action name="svg_format_italic"/>- <Action name="svg_format_underline"/>- <Action name="svg_format_strike_through"/>- <Action name="svg_format_superscript"/>- <Action name="svg_format_subscript"/>- <Menu name="weight">- <text>&Weight</text>- <Action name="svg_weight_light"/>- <Action name="svg_weight_normal"/>- <Action name="svg_weight_bold"/>- <Action name="svg_weight_demi_bold"/>- <Action name="svg_weight_black"/>- </Menu>- <Separator/>- <Action name="svg_increase_text_size"/>- <Action name="svg_decrease_text_size"/>- <Separator/>- <Action name="svg_align_left"/>- <Action name="svg_align_center"/>- <Action name="svg_align_right"/>- <!--Action name="svg_align_justified"/-->- <Separator/>- <Action name="svg_font_kerning"/>- <Menu name="svg_text_wrapping">- <text>Text W&rapping</text>- <Action name="svg_text_wrapping_legacy"/>- <Action name="svg_text_wrapping_css_pre"/>- <Action name="svg_text_wrapping_css_pre_wrap"/>- </Menu>- </Menu><Menu name="settings"><text>Setti&ngs</text><Action name="svg_settings"/>@@ -82,34 +45,4 @@<Action name="edit_copy"/><Action name="edit_paste"/></ToolBar>-- <ToolBar name="fontSettings" newline="true" >- <Text>Font Settings</Text>- <Action name="svg_font"/>- <Action name="svg_font_size"/>- <Action name="svg_font_color"/>- <Action name="svg_format_textcolor"/>- <Action name="svg_sample_color"/>- </ToolBar>-- <ToolBar name="formatting" newline="true" >- <Text>Formatting</Text>- <Action name="svg_weight_bold"/>- <Action name="svg_format_italic"/>- <Action name="svg_format_underline"/>- <Action name="svg_align_left"/>- <Action name="svg_align_center"/>- <Action name="svg_align_right"/>- <Action name="svg_line_height"/>- <Action name="svg_letter_spacing"/>- <Action name="svg_font_kerning"/>- <Menu name="svg_text_wrapping">- <text>Text W&rapping</text>- <Action name="svg_text_wrapping_legacy"/>- <Action name="svg_text_wrapping_css_pre"/>- <Action name="svg_text_wrapping_css_pre_wrap"/>- </Menu>- </ToolBar>--</kpartgui>