79 , m_page(new QWidget(this))
85 KGuiItem::assign(
m_textEditorWidget.buttons->button(QDialogButtonBox::Save), KStandardGuiItem::save());
86 KGuiItem::assign(
m_textEditorWidget.buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
91 KConfigGroup cg(KSharedConfig::openConfig(),
"SvgTextTool");
96 if (cg.hasKey(
"WindowState")) {
97 QByteArray state = cg.readEntry(
"State", QByteArray());
99 restoreState(QByteArray::fromBase64(state));
101 if (cg.hasKey(
"Geometry")) {
102 QByteArray ba = cg.readEntry(
"Geometry", QByteArray());
103 restoreGeometry(QByteArray::fromBase64(ba));
107 QRect desk = QGuiApplication::screens().at(scnum)->availableGeometry();
109 quint32 x = desk.x();
110 quint32 y = desk.y();
113 const int deskWidth = desk.width();
114 w = (deskWidth / 3) * 2;
115 h = (desk.height() / 3) * 2;
116 x += (desk.width() - w) / 2;
117 y += (desk.height() - h) / 2;
120 setGeometry(geometry().x(), geometry().y(), w, h);
124 setAcceptDrops(
true);
126 setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
129 m_textEditorWidget.svgTextEdit->setFont(QFontDatabase().systemFont(QFontDatabase::FixedFont));
220 findDialog.setWindowTitle(i18n(
"Find Text"));
221 QFormLayout *layout =
new QFormLayout(&findDialog);
222 QLineEdit *lnSearchKey =
new QLineEdit();
223 layout->addRow(i18n(
"Find:"), lnSearchKey);
224 QDialogButtonBox *
buttons =
new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
227 KGuiItem::assign(
buttons->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
228 KGuiItem::assign(
buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
230 connect(
buttons, SIGNAL(accepted()), &findDialog, SLOT(accept()));
231 connect(
buttons, SIGNAL(rejected()), &findDialog, SLOT(reject()));
233 if (findDialog.exec() == QDialog::Accepted) {
262 findDialog.setWindowTitle(i18n(
"Find and Replace all"));
263 QFormLayout *layout =
new QFormLayout(&findDialog);
264 QLineEdit *lnSearchKey =
new QLineEdit();
265 QLineEdit *lnReplaceKey =
new QLineEdit();
266 layout->addRow(i18n(
"Find:"), lnSearchKey);
267 QDialogButtonBox *
buttons =
new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
268 layout->addRow(i18n(
"Replace:"), lnReplaceKey);
271 KGuiItem::assign(
buttons->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
272 KGuiItem::assign(
buttons->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
274 connect(
buttons, SIGNAL(accepted()), &findDialog, SLOT(accept()));
275 connect(
buttons, SIGNAL(rejected()), &findDialog, SLOT(reject()));
277 if (findDialog.exec() == QDialog::Accepted) {
278 QString search = lnSearchKey->text();
279 QString
replace = lnReplaceKey->text();
281 cursor.movePosition(QTextCursor::Start);
305 Ui_WdgSvgTextSettings textSettings;
306 QWidget *settingsPage =
new QWidget(&settingsDialog);
308 textSettings.setupUi(settingsPage);
311 KConfigGroup cfg(KSharedConfig::openConfig(),
"SvgTextTool");
313 QColor background = cfg.readEntry(
"colorEditorBackground", qApp->palette().window().color());
314 textSettings.colorEditorBackground->setColor(background);
315 textSettings.colorEditorForeground->setColor(cfg.readEntry(
"colorEditorForeground", qApp->palette().text().color()));
317 textSettings.colorKeyword->setColor(cfg.readEntry(
"colorKeyword", QColor(background.value() < 100 ? Qt::cyan : Qt::blue)));
318 textSettings.chkBoldKeyword->setChecked(cfg.readEntry(
"BoldKeyword",
true));
319 textSettings.chkItalicKeyword->setChecked(cfg.readEntry(
"ItalicKeyword",
false));
321 textSettings.colorElement->setColor(cfg.readEntry(
"colorElement", QColor(background.value() < 100 ? Qt::magenta : Qt::darkMagenta)));
322 textSettings.chkBoldElement->setChecked(cfg.readEntry(
"BoldElement",
true));
323 textSettings.chkItalicElement->setChecked(cfg.readEntry(
"ItalicElement",
false));
325 textSettings.colorAttribute->setColor(cfg.readEntry(
"colorAttribute", QColor(background.value() < 100 ? Qt::green : Qt::darkGreen)));
326 textSettings.chkBoldAttribute->setChecked(cfg.readEntry(
"BoldAttribute",
true));
327 textSettings.chkItalicAttribute->setChecked(cfg.readEntry(
"ItalicAttribute",
true));
329 textSettings.colorValue->setColor(cfg.readEntry(
"colorValue", QColor(background.value() < 100 ? Qt::red: Qt::darkRed)));
330 textSettings.chkBoldValue->setChecked(cfg.readEntry(
"BoldValue",
true));
331 textSettings.chkItalicValue->setChecked(cfg.readEntry(
"ItalicValue",
false));
333 textSettings.colorComment->setColor(cfg.readEntry(
"colorComment", QColor(background.value() < 100 ? Qt::lightGray : Qt::gray)));
334 textSettings.chkBoldComment->setChecked(cfg.readEntry(
"BoldComment",
false));
335 textSettings.chkItalicComment->setChecked(cfg.readEntry(
"ItalicComment",
false));
338 if (settingsDialog.exec() == QDialog::Accepted) {
340 cfg.writeEntry(
"colorEditorBackground", textSettings.colorEditorBackground->color());
341 cfg.writeEntry(
"colorEditorForeground", textSettings.colorEditorForeground->color());
343 cfg.writeEntry(
"colorKeyword", textSettings.colorKeyword->color());
344 cfg.writeEntry(
"BoldKeyword", textSettings.chkBoldKeyword->isChecked());
345 cfg.writeEntry(
"ItalicKeyWord", textSettings.chkItalicKeyword->isChecked());
347 cfg.writeEntry(
"colorElement", textSettings.colorElement->color());
348 cfg.writeEntry(
"BoldElement", textSettings.chkBoldElement->isChecked());
349 cfg.writeEntry(
"ItalicElement", textSettings.chkItalicElement->isChecked());
351 cfg.writeEntry(
"colorAttribute", textSettings.colorAttribute->color());
352 cfg.writeEntry(
"BoldAttribute", textSettings.chkBoldAttribute->isChecked());
353 cfg.writeEntry(
"ItalicAttribute", textSettings.chkItalicAttribute->isChecked());
355 cfg.writeEntry(
"colorValue", textSettings.colorValue->color());
356 cfg.writeEntry(
"BoldValue", textSettings.chkBoldValue->isChecked());
357 cfg.writeEntry(
"ItalicValue", textSettings.chkItalicValue->isChecked());
359 cfg.writeEntry(
"colorComment", textSettings.colorComment->color());
360 cfg.writeEntry(
"BoldComment", textSettings.chkBoldComment->isChecked());
361 cfg.writeEntry(
"ItalicComment", textSettings.chkItalicComment->isChecked());
403 KConfigGroup cfg(KSharedConfig::openConfig(),
"SvgTextTool");
405 m_page->setUpdatesEnabled(
false);
411 QColor background = cfg.readEntry(
"colorEditorBackground", qApp->palette().window().color());
412 palette.setBrush(QPalette::Active, QPalette::Window, QBrush(background));
413 m_textEditorWidget.svgStylesEdit->setStyleSheet(QString(
"background-color:%1").arg(background.name()));
414 m_textEditorWidget.svgTextEdit->setStyleSheet(QString(
"background-color:%1").arg(background.name()));
416 QColor foreground = cfg.readEntry(
"colorEditorForeground", qApp->palette().text().color());
417 palette.setBrush(QPalette::Active, QPalette::Text, QBrush(foreground));
419 m_page->setUpdatesEnabled(
true);
bool convertToSvg(QString *svgText, QString *stylesText)
void setModified(bool modified)
QAction * createAction(const QString &name, const char *member)
SvgTextEditor(QWidget *parent=0, Qt::WindowFlags f=Qt::WindowFlags())
bool eventFilter(QObject *watched, QEvent *event) override
BasicXMLSyntaxHighlighter * m_syntaxHighlighter
void dialogButtonClicked(QAbstractButton *button)
QList< QAction * > m_svgTextActions
void textUpdated(KoSvgTextShape *shape, const QString &svg, const QString &defs)
void setInitialShape(KoSvgTextShape *shape)
void wheelEvent(QWheelEvent *event) override
Ui_WdgSvgTextEditor m_textEditorWidget