diff --git a/CMakeLists.txt b/CMakeLists.txt index efc857d..14fc9c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ if(Qt5_FOUND AND NOT TARGET Qt::Core) endforeach() endif() -find_package(KF${QT_VERSION_MAJOR}SyntaxHighlighting REQUIRED) +find_package(KF${QT_VERSION_MAJOR}SyntaxHighlighting 5.56 REQUIRED) set_package_properties(KF${QT_VERSION_MAJOR}SyntaxHighlighting PROPERTIES URL "https://community.kde.org/Frameworks" DESCRIPTION "Syntax Highlighting framework for Qt${QT_VERSION_MAJOR}" diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 4114b46..9af2420 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -16,7 +16,6 @@ add_library(syntaxtextedit "") target_sources(syntaxtextedit PRIVATE - kf_version.h syntaxhighlighter.h syntaxhighlighter.cpp syntaxtextedit.h diff --git a/lib/kf_version.h b/lib/kf_version.h deleted file mode 100644 index 2047f4b..0000000 --- a/lib/kf_version.h +++ /dev/null @@ -1,35 +0,0 @@ -/* This file is part of QTextPad. - * - * QTextPad is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * QTextPad 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with QTextPad. If not, see . - */ - -#ifndef QTEXTPAD_KF_VERSION_H -#define QTEXTPAD_KF_VERSION_H - -#include - -#if defined(KSYNTAXHIGHLIGHTING_VERSION) -# if KSYNTAXHIGHLIGHTING_VERSION >= ((5<<16)|(56<<8)|(0)) -# define SUPPORT_DEFINITION_DOWNLOADER 1 -# endif -#elif defined(SyntaxHighlighting_VERSION) -# if SyntaxHighlighting_VERSION >= ((5<<16)|(56<<8)|(0)) -# define SUPPORT_DEFINITION_DOWNLOADER 1 -# endif -# define KSYNTAXHIGHLIGHTING_VERSION_STRING SyntaxHighlighting_VERSION_STRING -#else -# error Unsupported ksyntaxhighlighting_version.h header format -#endif - -#endif // QTEXTPAD_KF_VERSION_H diff --git a/src/aboutdialog.cpp b/src/aboutdialog.cpp index 126c12d..2a28d8b 100644 --- a/src/aboutdialog.cpp +++ b/src/aboutdialog.cpp @@ -22,10 +22,10 @@ #include #include #include +#include #include "appversion.h" #include "charsets.h" -#include "kf_version.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) @@ -78,7 +78,13 @@ AboutDialog::AboutDialog(QWidget *parent) "
  • Oxygen Icons
  • " "") .arg(QString::fromLatin1(qVersion()), +#if defined(KSYNTAXHIGHLIGHTING_VERSION) QStringLiteral(KSYNTAXHIGHLIGHTING_VERSION_STRING), +#elif defined(SyntaxHighlighting_VERSION) + QStringLiteral(SyntaxHighlighting_VERSION), +#else +# error Unsupported header format +#endif TextCodec::icuVersion()) ); libVersions->setMargin(10); diff --git a/src/definitiondownload.cpp b/src/definitiondownload.cpp index 63a143c..94128c9 100644 --- a/src/definitiondownload.cpp +++ b/src/definitiondownload.cpp @@ -16,8 +16,6 @@ #include "definitiondownload.h" -#ifdef SUPPORT_DEFINITION_DOWNLOADER - #include #include #include @@ -105,5 +103,3 @@ void DefinitionDownloadDialog::closeEvent(QCloseEvent *e) if (!m_buttonBox->button(QDialogButtonBox::Close)->isEnabled()) e->ignore(); } - -#endif // SUPPORT_DEFINITION_DOWNLOADER diff --git a/src/definitiondownload.h b/src/definitiondownload.h index 0bbb875..97e0e72 100644 --- a/src/definitiondownload.h +++ b/src/definitiondownload.h @@ -17,10 +17,6 @@ #ifndef QTEXTPAD_DEFINITIONDOWNLOAD_H #define QTEXTPAD_DEFINITIONDOWNLOAD_H -#include "kf_version.h" - -#ifdef SUPPORT_DEFINITION_DOWNLOADER - #include #include @@ -53,6 +49,4 @@ public Q_SLOTS: QElapsedTimer m_timer; }; -#endif // SUPPORT_DEFINITION_DOWNLOADER - #endif // QTEXTPAD_DEFINITIONDOWNLOAD_H diff --git a/src/main.cpp b/src/main.cpp index f811319..6f9bbf3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,12 +25,9 @@ #include #endif -#include "kf_version.h" #include #include -#ifdef SUPPORT_DEFINITION_DOWNLOADER #include -#endif #include "qtextpadwindow.h" #include "syntaxtextedit.h" @@ -133,15 +130,12 @@ int main(int argc, char *argv[]) parser.addOption(encodingOption); parser.addOption(syntaxOption); -#ifdef SUPPORT_DEFINITION_DOWNLOADER const QCommandLineOption updateOption(QStringList{QStringLiteral("update-definitions")}, QCoreApplication::translate("main", "Download updated syntax definitions from the internet and exit.")); parser.addOption(updateOption); -#endif parser.process(app); -#ifdef SUPPORT_DEFINITION_DOWNLOADER if (parser.isSet(updateOption)) { // Handle this before any GUI objects are created KSyntaxHighlighting::Repository syntaxRepo; @@ -155,7 +149,6 @@ int main(int argc, char *argv[]) downloader.start(); return QApplication::exec(); } -#endif setDefaultIconTheme(); diff --git a/src/qtextpadwindow.cpp b/src/qtextpadwindow.cpp index ac98c81..438fc3c 100644 --- a/src/qtextpadwindow.cpp +++ b/src/qtextpadwindow.cpp @@ -1640,7 +1640,6 @@ void QTextPadWindow::populateSyntaxMenu() connect(item, &QAction::triggered, this, [this, def] { setSyntax(def); }); } -#ifdef SUPPORT_DEFINITION_DOWNLOADER (void) m_syntaxMenu->addSeparator(); auto updateAction = m_syntaxMenu->addAction(tr("Update Definitions")); connect(updateAction, &QAction::triggered, this, [this] { @@ -1650,7 +1649,6 @@ void QTextPadWindow::populateSyntaxMenu() downloadDialog->raise(); downloadDialog->activateWindow(); }); -#endif } void QTextPadWindow::populateThemeMenu()