diff --git a/CMakeLists.txt b/CMakeLists.txt index 386c078..70732c9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,60 +1,60 @@ project(kregexpeditor) ############### search packages used by KDE ############### cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) find_package(ECM 5.20 REQUIRED NO_MODULE) set(QT5_REQUIRED_VERSION "5.5.0") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(ECMGenerateHeaders) include(ECMInstallIcons) include(ECMAddAppIcon) include(ECMMarkNonGuiExecutable) include(ECMOptionalAddSubdirectory) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) -find_package(Qt5 ${QT5_REQUIRED_VERSION} CONFIG REQUIRED Core Widgets) +find_package(Qt5 ${QT5_REQUIRED_VERSION} CONFIG REQUIRED Core Widgets Xml) find_package(KF5 REQUIRED - ConfigWidgets DocTools IconThemes TextWidgets WidgetsAddons Crash + CoreAddons ) find_package(BISON REQUIRED) find_package(FLEX REQUIRED) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ) ############### Find the stuff we need ############### add_definitions( -DQT_NO_CAST_ASCII ) add_definitions( -DQT_DISABLE_DEPRECATED_BEFORE=0x060000 ) # not for now, the code is not fully ready for it #add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII ) add_definitions( -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT ) add_subdirectory(src) add_subdirectory( doc ) option(BUILD_TEST "Build test widget" OFF) if (BUILD_TEST) find_package(KF5 REQUIRED KIO ) add_subdirectory(tests) endif() feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f1e72e8..e6e6cc6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,135 +1,136 @@ BISON_TARGET(qregexpparser qregexpparser.y ${CMAKE_CURRENT_BINARY_DIR}/gen_qregexpparser.cc COMPILE_FLAGS "-d -p qregexp") FLEX_TARGET(qregexplexer qregexpparser.l ${CMAKE_CURRENT_BINARY_DIR}/gen_qregexplexer.cpp COMPILE_FLAGS "-Pqregexp") ADD_FLEX_BISON_DEPENDENCY( qregexplexer qregexpparser ) set_property(SOURCE ${BISON_qregexpparser_OUTPUTS} PROPERTY SKIP_AUTOMOC ON) set_property(SOURCE ${FLEX_qregexplexer_OUTPUTS} PROPERTY SKIP_AUTOMOC ON) add_subdirectory( predefined ) add_subdirectory( pics ) include_directories( KWidgetStreamer/ KMultiFormListBox/ ) ########### next target ############### set(kregexpeditorcommon_SRCS ${BISON_qregexpparser_OUTPUTS} ${FLEX_qregexplexer_OUTPUTS} altnregexp.cpp altnwidget.cpp auxbuttons.cpp characterswidget.cpp charselector.cpp compoundregexp.cpp compoundwidget.cpp concregexp.cpp concwidget.cpp dcbutton.cpp dotregexp.cpp dragaccepter.cpp regexpeditorwindow.cpp emacsregexpconverter.cpp errormap.cpp infopage.cpp KMultiFormListBox/ccp.cpp KMultiFormListBox/kmultiformlistboxentry.cpp KMultiFormListBox/kmultiformlistbox.cpp KMultiFormListBox/kmultiformlistbox-multivisible.cpp KMultiFormListBox/kmultiformlistboxfactory.cpp KMultiFormListBox/indexWindow.cpp KMultiFormListBox/kmultiformlistbox-windowed.cpp KMultiFormListBox/widgetwindow.cpp KMultiFormListBox/windowlistboxitem.cpp kregexpeditorgui.cpp kregexpeditorguidialog.cpp kregexpeditorprivate.cpp KWidgetStreamer/kwidgetstreamer.cpp limitedcharlineedit.cpp lookaheadregexp.cpp lookaheadwidget.cpp multicontainerwidget.cpp myfontmetrics.cpp positionregexp.cpp qtregexpconverter.cpp qtregexphighlighter.cpp regexpbuttons.cpp regexpconverter.cpp regexp.cpp regexphighlighter.cpp regexpwidget.cpp repeatregexp.cpp repeatwidget.cpp scrollededitorwindow.cpp selectablelineedit.cpp singlecontainerwidget.cpp textrangeregexp.cpp textregexp.cpp textwidget.cpp userdefinedregexps.cpp verifier.cpp verifybuttons.cpp widgetfactory.cpp zerowidgets.cpp ) add_library(kregexpeditorcommon SHARED ${kregexpeditorcommon_SRCS}) target_link_libraries(kregexpeditorcommon - KF5::ConfigWidgets KF5::TextWidgets + KF5::CoreAddons KF5::WidgetsAddons Qt5::Widgets + Qt5::Xml ) set_target_properties(kregexpeditorcommon PROPERTIES VERSION 1.0.0 SOVERSION 1) install(TARGETS kregexpeditorcommon ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########### next target ############### set(kregexpeditorgui_PART_SRCS kregexpeditorfactory.cpp ) add_library(kregexpeditorgui MODULE ${kregexpeditorgui_PART_SRCS}) target_link_libraries(kregexpeditorgui kregexpeditorcommon) install(TARGETS kregexpeditorgui DESTINATION ${KDE_INSTALL_PLUGINDIR}) ########### next target ############### set(kregexpeditor_SRCS main.cpp) file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/*-apps-kregexpeditor.png") ecm_add_app_icon(kregexpeditor_SRCS ICONS ${ICONS_SRCS}) add_executable(kregexpeditor ${kregexpeditor_SRCS}) target_link_libraries(kregexpeditor Qt5::Widgets kregexpeditorcommon KF5::Crash) install(TARGETS kregexpeditor ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) ########### install files ############### install(FILES org.kde.kregexpeditor.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(FILES kregexpeditorgui.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) install(FILES KMultiFormListBox/kmultiformlistboxentry.h KMultiFormListBox/kmultiformlistbox.h KMultiFormListBox/kmultiformlistboxfactory.h DESTINATION ${KDE_INSTALL_INCLUDEDIR} ) install(FILES KWidgetStreamer/kwidgetstreamer.h DESTINATION ${KDE_INSTALL_INCLUDEDIR}) ecm_install_icons(ICONS 128-apps-kregexpeditor.png 16-apps-kregexpeditor.png 22-apps-kregexpeditor.png 32-apps-kregexpeditor.png 48-apps-kregexpeditor.png 64-apps-kregexpeditor.png DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor ) diff --git a/src/infopage.cpp b/src/infopage.cpp index 501d625..fa208c1 100644 --- a/src/infopage.cpp +++ b/src/infopage.cpp @@ -1,67 +1,60 @@ /* * Copyright (c) 2002-2003 Jesper K. Pedersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #include "infopage.h" #include -#include #include InfoPage::InfoPage(QWidget *parent) : QTextBrowser(parent) { QString txt = QStringLiteral("") +i18nc("Translators, feel free to add yourself in the text below, asking for a postcard ;-), " "also feel free to add a section saying

Translators

. " "Kind regards, and thanks for your work - Jesper.", "

Regular Expression Editor

" "

What you are currently looking at is an editor for Regular Expressions.

" "

The upper part in the middle is the editing area, the lower part is a verification window where you can " "try your regular expressions right away. The row of buttons is the editing actions. " "This is actually very similar to common drawing programs. Select an editing tool to start " "editing your regular expression, and press the mouse button in the editing area where you want " "this item inserted.

" - "

For a more detailed description of this editor see the info pages

" + "

For a more detailed description of this editor see the info pages

" "

What is a regular expression?

" "If you do not know what a regular expression is, then it might be a good idea " - "to read the introduction to regular expressions.
"); + "to read the introduction to regular expressions.
"); txt += i18n("

Send the author an electronic postcard

" "I don't get any money for working on KRegExpEditor, " "I therefore appreciate it very much when users tell me what they think about my work. " "I would therefore be very happy if you " "sent me a short mail, telling me that you use my regular expression editor." "

Author

" "Jesper K. Pedersen <blackie@kde.org>") + QStringLiteral("
"); setText(txt); } void InfoPage::setSource(const QUrl &name) { - QString nm = name.toString(); - - if (nm.startsWith(QStringLiteral("doc://"))) { - KHelpClient::invokeHelp(nm.mid(6, nm.length() - 7), QStringLiteral("kregexpeditor")); - } else { - QDesktopServices::openUrl(name); // handle mailto and other links - } + QDesktopServices::openUrl(name); } diff --git a/src/kregexpeditorgui.cpp b/src/kregexpeditorgui.cpp index acce5a6..6eccf0b 100644 --- a/src/kregexpeditorgui.cpp +++ b/src/kregexpeditorgui.cpp @@ -1,100 +1,99 @@ /* * Copyright (c) 2002-2003 Jesper K. Pedersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #include "kregexpeditorgui.h" #include #include #include #include #include #include -#include #include "kregexpeditorprivate.h" const QString KRegExpEditorGUI::version = QStringLiteral("1.0"); KRegExpEditorGUI::KRegExpEditorGUI(QWidget *parent, const QVariantList &) : QWidget(parent) , _editor(new KRegExpEditorPrivate(this)) { QVBoxLayout *layout = new QVBoxLayout(this); layout->setMargin(0); layout->addWidget(_editor); connect(_editor, &KRegExpEditorPrivate::canUndo, this, &KRegExpEditorGUI::canUndo); connect(_editor, &KRegExpEditorPrivate::canRedo, this, &KRegExpEditorGUI::canRedo); connect(_editor, &KRegExpEditorPrivate::changes, this, &KRegExpEditorGUI::changes); QSettings settings; restoreGeometry(settings.value(QStringLiteral("geometry")).toByteArray()); } KRegExpEditorGUI::~KRegExpEditorGUI() { delete _editor; } QString KRegExpEditorGUI::regExp() const { return _editor->regexp(); } void KRegExpEditorGUI::closeEvent(QCloseEvent *event) { QSettings settings; settings.setValue(QStringLiteral("geometry"), saveGeometry()); QWidget::closeEvent(event); } void KRegExpEditorGUI::redo() { _editor->slotRedo(); } void KRegExpEditorGUI::undo() { _editor->slotUndo(); } void KRegExpEditorGUI::setRegExp(const QString ®exp) { _editor->slotSetRegexp(regexp); } void KRegExpEditorGUI::doSomething(const QString &method, void *arguments) { if (method == QLatin1String("setCaseSensitive")) { _editor->setCaseSensitive((bool)arguments); } else if (method == QLatin1String("setMinimal")) { _editor->setMinimal((bool)arguments); } else if (method == QLatin1String("setSyntax")) { _editor->setSyntax(*((QString *)arguments)); } else if (method == QLatin1String("setAllowNonQtSyntax")) { _editor->setAllowNonQtSyntax((bool)arguments); } else { qFatal("%s", qPrintable(tr("Method '%1' is not valid!").arg(method))); } } void KRegExpEditorGUI::setMatchText(const QString &txt) { _editor->setMatchText(txt); } diff --git a/src/kregexpeditorguidialog.cpp b/src/kregexpeditorguidialog.cpp index 16cc29a..f31e2ab 100644 --- a/src/kregexpeditorguidialog.cpp +++ b/src/kregexpeditorguidialog.cpp @@ -1,95 +1,96 @@ /* * Copyright (c) 2002-2003 Jesper K. Pedersen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License version 2 as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. **/ #include "kregexpeditorguidialog.h" #include #include #include -#include #include #include #include +#include +#include #include "kregexpeditorprivate.h" KRegExpEditorGUIDialog::KRegExpEditorGUIDialog(QWidget *parent, const QVariantList &) : QDialog(parent) { //qDebug() << "KRegExpEditorGUIDialog::KRegExpEditorGUIDialog(QWidget *parent, const QVariantList &) "<addWidget(_editor); connect(_editor, &KRegExpEditorGUI::canUndo, this, &KRegExpEditorGUIDialog::canUndo); connect(_editor, &KRegExpEditorGUI::canRedo, this, &KRegExpEditorGUIDialog::canRedo); connect(_editor, &KRegExpEditorGUI::changes, this, &KRegExpEditorGUIDialog::changes); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::Help); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); layout->addWidget(buttonBox); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); connect(buttonBox, &QDialogButtonBox::helpRequested, this, &KRegExpEditorGUIDialog::showHelp); resize(640, 400); } KRegExpEditorGUIDialog::~KRegExpEditorGUIDialog() { //qDebug() << "KRegExpEditorGUIDialog::~KRegExpEditorGUIDialog(QWidget *parent, const QVariantList &) "<regExp(); } void KRegExpEditorGUIDialog::setRegExp(const QString ®exp) { _editor->setRegExp(regexp); } void KRegExpEditorGUIDialog::redo() { _editor->redo(); } void KRegExpEditorGUIDialog::undo() { _editor->undo(); } void KRegExpEditorGUIDialog::doSomething(const QString &method, void *arguments) { _editor->doSomething(method, arguments); } void KRegExpEditorGUIDialog::setMatchText(const QString &txt) { _editor->setMatchText(txt); } void KRegExpEditorGUIDialog::showHelp() { - KHelpClient::invokeHelp(QString(), QStringLiteral("kregexpeditor")); + QDesktopServices::openUrl(QUrl("help:/kregexpeditor/index.html")); }