diff --git a/src/Tools/RegExp/CMakeLists.txt b/src/Tools/RegExp/CMakeLists.txt deleted file mode 100644 index d896a0e954..0000000000 --- a/src/Tools/RegExp/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -project(RegExp) -set(APP_VERSION "1.0") - -cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) - -find_package(Qt5) - -include_directories( - ${QT_INCLUDE_DIR} - ${QT_QTCORE_INCLUDE_DIR} - ${QT_QTGUI_INCLUDE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_BINARY_DIR} -) -link_directories(${QT_LIBRARY_DIR}) - -add_definitions(-D_UNICODE) - -QT5_WRAP_CPP(RegExp_MOC_SRCS - regexpdialog.h -) - -QT5_WRAP_UI(RegExp_UIC_HDRS - regexpdialog.ui -) - -SET(RegExp_SRCS - ${RegExp_UIC_HDRS} - ${RegExp_MOC_SRCS} - main.cpp - regexpdialog.cpp - regexpdialog.h -) - -if (WIN32) -SET(RegExp_LIBS - debug qtmaind.lib - optimized qtmain.lib -) -endif(WIN32) - -SET(RegExp_LIBS - ${RegExp_LIBS} - ${QT_QTCORE_LIBRARY_DEBUG} - ${QT_QTCORE_LIBRARY} - ${QT_QTGUI_LIBRARY_DEBUG} - ${QT_QTGUI_LIBRARY} - ${QT_QTXML_LIBRARY_DEBUG} - ${QT_QTXML_LIBRARY} -) - -add_executable(RegExp WIN32 ${RegExp_SRCS}) - -target_link_libraries(RegExp ${RegExp_LIBS}) - -set_target_properties(RegExp PROPERTIES OUTPUT_NAME "RegExp") -set_target_properties(RegExp PROPERTIES DEBUG_OUTPUT_NAME "RegExpD") -# dirty hack to avoid Debug/Release subdirectory -set_target_properties(RegExp PROPERTIES PREFIX "../") -set_target_properties(RegExp PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) diff --git a/src/Tools/RegExp/RegExp.pro b/src/Tools/RegExp/RegExp.pro deleted file mode 100644 index 601246c3dc..0000000000 --- a/src/Tools/RegExp/RegExp.pro +++ /dev/null @@ -1,14 +0,0 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Di 3. Jul 11:56:12 2012 -###################################################################### - -TEMPLATE = app -TARGET = regexp -DEPENDPATH += . -INCLUDEPATH += . -QT += widgets - -# Input -HEADERS += regexpdialog.h -FORMS += regexpdialog.ui -SOURCES += main.cpp regexpdialog.cpp diff --git a/src/Tools/RegExp/main.cpp b/src/Tools/RegExp/main.cpp deleted file mode 100644 index 3c7a5e81ed..0000000000 --- a/src/Tools/RegExp/main.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2005 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * 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., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "regexpdialog.h" -#include - - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - - RegExpDialog dialog(0); - app.setActiveWindow(&dialog); - dialog.exec(); - - return 0; -} diff --git a/src/Tools/RegExp/regexpdialog.cpp b/src/Tools/RegExp/regexpdialog.cpp deleted file mode 100644 index 23a24db5fd..0000000000 --- a/src/Tools/RegExp/regexpdialog.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2005 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * 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., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#include "regexpdialog.h" -#include "ui_regexpdialog.h" - -#include -#include -#include -#include -#include - -RegExpDialog::RegExpDialog(QWidget* parent) - : QDialog(parent) - , ui(new Ui_RegExpDialog()) -{ - ui->setupUi(this); - rxhilighter = new RegExpSyntaxHighlighter(ui->textEdit1); - - validator = new QRegularExpressionValidator(this); - ui->lineEdit->setValidator(validator); - - connect(ui->lineEditRegExp, &QLineEdit::textChanged, this, &RegExpDialog::performRegExp); - connect(ui->caseInsensitiveOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect(ui->invertedGreedinessOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect(ui->dotMatchesEverythingOption, - &QCheckBox::toggled, - this, - &RegExpDialog::performRegExp); - connect(ui->multilineOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect(ui->extendedPatternSyntaxOption, - &QCheckBox::toggled, - this, - &RegExpDialog::performRegExp); - connect(ui->dontCaptureOption, &QCheckBox::toggled, this, &RegExpDialog::performRegExp); - connect(ui->useUnicodePropertiesOption, - &QCheckBox::toggled, - this, - &RegExpDialog::performRegExp); -} - -RegExpDialog::~RegExpDialog() -{ - delete ui; -} - -void RegExpDialog::performRegExp() -{ - QString txt = ui->lineEditRegExp->text(); - if (txt.isEmpty()) { - rxhilighter->resethighlight(); - return; - } - - QRegularExpression::PatternOptions options = QRegularExpression::NoPatternOption; - if (ui->caseInsensitiveOption->isChecked()) { - options |= QRegularExpression::CaseInsensitiveOption; - } - - if (ui->invertedGreedinessOption->isChecked()) { - options |= QRegularExpression::InvertedGreedinessOption; - } - - if (ui->dotMatchesEverythingOption->isChecked()) { - options |= QRegularExpression::DotMatchesEverythingOption; - } - - if (ui->multilineOption->isChecked()) { - options |= QRegularExpression::MultilineOption; - } - - if (ui->extendedPatternSyntaxOption->isChecked()) { - options |= QRegularExpression::ExtendedPatternSyntaxOption; - } - - if (ui->dontCaptureOption->isChecked()) { - options |= QRegularExpression::DontCaptureOption; - } - - if (ui->useUnicodePropertiesOption->isChecked()) { - options |= QRegularExpression::UseUnicodePropertiesOption; - } - - QRegularExpression rx(txt, options); - - // evaluate regular expression - ui->textLabel4->setText(rx.errorString()); - if (!rx.isValid()) { - rxhilighter->resethighlight(); - return; // invalid expression - } - - rxhilighter->highlightMatchedText(rx); - validator->setRegularExpression(rx); -} - -void RegExpDialog::about() -{ - QString msg = "This is a tool for playing around with regular expressions."; - QMessageBox::information(this, "RegExp Explorer", msg); -} - -// ------------------------------------------------------------- - -RegExpSyntaxHighlighter::RegExpSyntaxHighlighter(QTextEdit* textEdit) - : QSyntaxHighlighter(textEdit) -{} - -RegExpSyntaxHighlighter::~RegExpSyntaxHighlighter() -{} - -void RegExpSyntaxHighlighter::highlightBlock(const QString& text) -{ - QTextCharFormat regFormat; - regFormat.setForeground(Qt::black); - regFormat.setFontWeight(QFont::Normal); - setFormat(0, text.length(), regFormat); - - if (regexp.pattern().isEmpty()) { - return; // empty regular expression - } - - int pos = 0; - int last = -1; - regFormat.setFontWeight(QFont::Bold); - regFormat.setForeground(Qt::blue); - - QRegularExpressionMatch match; - while ((pos = text.indexOf(regexp, pos, &match)) != -1) { - if (last == pos) { - break; - } - QString sub = text.mid(pos, match.capturedLength()); - if (!sub.isEmpty()) { - setFormat(pos, sub.length(), regFormat); - } - - pos += match.capturedLength(); - last = pos; - } -} - -void RegExpSyntaxHighlighter::highlightMatchedText(const QRegularExpression& rx) -{ - regexp = rx; - rehighlight(); -} - -void RegExpSyntaxHighlighter::resethighlight() -{ - regexp.setPattern(""); - rehighlight(); -} diff --git a/src/Tools/RegExp/regexpdialog.h b/src/Tools/RegExp/regexpdialog.h deleted file mode 100644 index b705b92297..0000000000 --- a/src/Tools/RegExp/regexpdialog.h +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * Copyright (c) 2004 Werner Mayer * - * * - * This file is part of the FreeCAD CAx development system. * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License as published by the Free Software Foundation; either * - * version 2 of the License, or (at your option) any later version. * - * * - * 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., 59 Temple Place, * - * Suite 330, Boston, MA 02111-1307, USA * - * * - ***************************************************************************/ - - -#ifndef REG_EXP_DIALOG_H -#define REG_EXP_DIALOG_H - -#include -#include -#include -#include - -class QRegularExpressionValidator; -class RegExpSyntaxHighlighter; -class Ui_RegExpDialog; -class RegExpDialog: public QDialog -{ - Q_OBJECT -public: - RegExpDialog(QWidget* parent = 0); - ~RegExpDialog(); - - void about(); - -protected Q_SLOTS: - void performRegExp(); - -private: - RegExpSyntaxHighlighter* rxhilighter; - QRegularExpressionValidator* validator; - Ui_RegExpDialog* ui; -}; - -// ------------------------------------------------------------- - -class RegExpSyntaxHighlighter: public QSyntaxHighlighter -{ -public: - RegExpSyntaxHighlighter(QTextEdit* textEdit); - ~RegExpSyntaxHighlighter(); - - void highlightBlock(const QString& text); - void highlightMatchedText(const QRegularExpression&); - void resethighlight(); - -private: - QRegularExpression regexp; -}; - -#endif // REG_EXP_DIALOG_H diff --git a/src/Tools/RegExp/regexpdialog.ui b/src/Tools/RegExp/regexpdialog.ui deleted file mode 100644 index 6b9a12248f..0000000000 --- a/src/Tools/RegExp/regexpdialog.ui +++ /dev/null @@ -1,212 +0,0 @@ - - - RegExpDialog - - - - 0 - 0 - 693 - 563 - - - - RegExp Explorer - - - true - - - - - - - - - - - Validator - - - - - - - - - - - - Regular Expression: - - - - - - - Pattern options - - - - - - Case insensitive - - - - - - - Multiline - - - - - - - Inverted greediness - - - - - - - Dot matches everything - - - - - - - Extended pattern syntax - - - - - - - Don't capture - - - - - - - Unicode properties - - - - - - - - - - 6 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Status: - - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 80 - 20 - - - - - - - - - - - &Close - - - true - - - true - - - - - - - - - - - - Text: - - - - - - - - textEdit1 - lineEdit - caseInsensitiveOption - invertedGreedinessOption - dotMatchesEverythingOption - multilineOption - extendedPatternSyntaxOption - dontCaptureOption - useUnicodePropertiesOption - lineEditRegExp - buttonClose - - - - - buttonClose - clicked() - RegExpDialog - accept() - - - 400 - 263 - - - 312 - 283 - - - - -