summaryrefslogtreecommitdiff
path: root/addon/doxywizard
diff options
context:
space:
mode:
Diffstat (limited to 'addon/doxywizard')
-rw-r--r--addon/doxywizard/CMakeLists.txt71
-rw-r--r--addon/doxywizard/adapter.h86
-rw-r--r--addon/doxywizard/config.h9
-rw-r--r--addon/doxywizard/config_doxyw.l42
-rwxr-xr-xaddon/doxywizard/doxywizard.cpp57
-rw-r--r--addon/doxywizard/expert.cpp18
-rw-r--r--addon/doxywizard/expert.h10
-rw-r--r--addon/doxywizard/helplabel.h16
-rw-r--r--addon/doxywizard/input.h9
-rw-r--r--addon/doxywizard/inputbool.cpp7
-rw-r--r--addon/doxywizard/inputbool.h2
-rw-r--r--addon/doxywizard/inputint.cpp2
-rw-r--r--addon/doxywizard/inputint.h2
-rw-r--r--addon/doxywizard/inputobsolete.h4
-rw-r--r--addon/doxywizard/inputstring.cpp5
-rw-r--r--addon/doxywizard/inputstring.h16
-rw-r--r--addon/doxywizard/inputstrlist.cpp9
-rw-r--r--addon/doxywizard/inputstrlist.h13
-rwxr-xr-xaddon/doxywizard/wizard.cpp38
19 files changed, 269 insertions, 147 deletions
diff --git a/addon/doxywizard/CMakeLists.txt b/addon/doxywizard/CMakeLists.txt
index 63ac8e3..bb0e0eb 100644
--- a/addon/doxywizard/CMakeLists.txt
+++ b/addon/doxywizard/CMakeLists.txt
@@ -1,31 +1,47 @@
-# search for Qt5
-if (NOT force_qt4)
+if (force_qt STREQUAL "Qt5" OR NOT force_qt)
find_package(Qt5Core QUIET CONFIG)
if (Qt5Core_FOUND)
message(STATUS "Using Qt5")
find_package(Qt5 COMPONENTS Widgets Gui Xml)
macro(qt_wrap_cpp)
- qt5_wrap_cpp(${ARGN})
+ qt5_wrap_cpp(${ARGN})
endmacro()
macro(qt_add_resources)
- qt5_add_resources(${ARGN})
+ qt5_add_resources(${ARGN})
endmacro()
+ else()
+ if (NOT force_qt)
+ find_package(Qt6Core QUIET CONFIG)
+ if (Qt6Core_FOUND)
+ message(STATUS "Using Qt6")
+ find_package(Qt6 COMPONENTS Widgets Gui Xml)
+ macro(qt_wrap_cpp)
+ qt6_wrap_cpp(${ARGN})
+ endmacro()
+ macro(qt_add_resources)
+ qt6_add_resources(${ARGN})
+ endmacro()
+ else()
+ message(FATAL_ERROR "Qt5 nor Qt6 found")
+ endif()
+ else()
+ message(FATAL_ERROR "Qt5 not found")
+ endif()
endif()
-endif()
-# fallback to Qt4
-if (NOT Qt5Core_FOUND)
- if (NOT force_qt4)
- message(STATUS "Qt5 not found, searching for Qt4 instead...")
+else()
+ find_package(Qt6Core QUIET CONFIG)
+ if (Qt6Core_FOUND)
+ message(STATUS "Using Qt6")
+ find_package(Qt6 COMPONENTS Widgets Gui Xml)
+ macro(qt_wrap_cpp)
+ qt6_wrap_cpp(${ARGN})
+ endmacro()
+ macro(qt_add_resources)
+ qt6_add_resources(${ARGN})
+ endmacro()
else()
- message(STATUS "Using Qt4")
+ message(FATAL_ERROR "Qt6 not found")
endif()
- find_package(Qt4 REQUIRED COMPONENTS QtCore QtXml QtGui)
- macro(qt_wrap_cpp)
- qt4_wrap_cpp(${ARGN})
- endmacro()
- macro(qt_add_resources)
- qt4_add_resources(${ARGN})
- endmacro()
endif()
include_directories(
@@ -38,7 +54,7 @@ set(GENERATED_SRC_WIZARD ${GENERATED_SRC}/doxywizard)
file(MAKE_DIRECTORY ${GENERATED_SRC_WIZARD})
add_definitions(-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DUNICODE)
-if (NOT Qt5Core_FOUND)
+if (NOT Qt6Core_FOUND AND NOT Qt5Core_FOUND)
include(${QT_USE_FILE})
endif()
@@ -55,14 +71,6 @@ CONTENT "#ifndef SETTINGS_H
#endif" )
set_source_files_properties(${GENERATED_SRC_WIZARD}/settings.h PROPERTIES GENERATED 1)
-# generate version.cpp
-add_custom_command(
- COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp
- DEPENDS ${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_SOURCE_DIR}/src/version.py
- OUTPUT ${GENERATED_SRC_WIZARD}/version.cpp
-)
-set_source_files_properties(${GENERATED_SRC_WIZARD}/version.cpp PROPERTIES GENERATED 1)
-
# generate configdoc.cpp
add_custom_command(
COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -wiz ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp
@@ -116,10 +124,21 @@ doxywizard.rc
set_property(TARGET doxywizard PROPERTY WIN32_EXECUTABLE true)
+include(ApplyEditbin)
+if (enable_console)
+apply_editbin(doxywizard console)
+else()
+apply_editbin(doxywizard windows)
+endif()
+
if(Qt5Core_FOUND)
target_link_libraries(doxywizard Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Xml doxygen_version)
else()
+if(Qt6Core_FOUND)
+ target_link_libraries(doxywizard Qt6::Core Qt6::Gui Qt6::Widgets Qt6::Xml doxygen_version)
+else()
target_link_libraries(doxywizard ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} doxygen_version)
endif()
+endif()
install(TARGETS doxywizard DESTINATION bin)
diff --git a/addon/doxywizard/adapter.h b/addon/doxywizard/adapter.h
new file mode 100644
index 0000000..5eaee22
--- /dev/null
+++ b/addon/doxywizard/adapter.h
@@ -0,0 +1,86 @@
+/******************************************************************************
+ *
+ * Copyright (C) 1997-2022 by Dimitri van Heesch.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef ADAPTER_H
+#define ADAPTER_H
+
+#include <memory>
+#include <QtGlobal>
+#include <QString>
+#include <QTextStream>
+#include <QPointF>
+#include <QMouseEvent>
+
+/** @file
+ * @brief compatibility adapters for Qt5/Qt6 support.
+ */
+
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+#include <QTextCodec>
+class TextCodecAdapter
+{
+ public:
+ TextCodecAdapter(const QByteArray &name)
+ {
+ m_codec = QTextCodec::codecForName(name);
+ if (m_codec==0) // fallback: use UTF-8
+ {
+ m_codec = QTextCodec::codecForName("UTF-8");
+ }
+ }
+ QByteArray encode(const QString &input) { return m_codec ? m_codec->fromUnicode(input) : input.toLatin1(); }
+ QString decode(const QByteArray &input) { return m_codec ? m_codec->toUnicode(input) : QString::fromLatin1(input); }
+ void applyToStream(QTextStream &t) { t.setCodec(m_codec); }
+ bool isValid() const { return m_codec!=0; }
+ private:
+ QTextCodec *m_codec = 0; // object is owned by Qt
+};
+#else // Qt6+
+#include <QStringEncoder>
+#include <QStringDecoder>
+#include <QStringConverter>
+class TextCodecAdapter
+{
+ public:
+ TextCodecAdapter(const QByteArray &name)
+ {
+ auto encodingOpt = QStringConverter::encodingForName(name);
+ if (encodingOpt)
+ {
+ m_encoding = *encodingOpt;
+ }
+ m_encoder = std::make_unique<QStringEncoder>(m_encoding);
+ m_decoder = std::make_unique<QStringDecoder>(m_encoding);
+ }
+ QByteArray encode(const QString &input) { return m_encoder ? m_encoder->encode(input) : input.toLatin1(); }
+ QString decode(const QByteArray &input) { return m_decoder ? m_decoder->decode(input) : QString::fromLatin1(input); }
+ void applyToStream(QTextStream &t) { t.setEncoding(m_encoding); }
+ bool isValid() const { return m_decoder!=0; }
+ private:
+ std::unique_ptr<QStringEncoder> m_encoder;
+ std::unique_ptr<QStringDecoder> m_decoder;
+ QStringConverter::Encoding m_encoding = QStringConverter::Utf8;
+
+};
+#endif
+
+inline qreal getMouseYPositionFromEvent(QMouseEvent *m)
+{
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ return m->y();
+#else
+ return m->position().y();
+#endif
+}
+
+
+#endif
diff --git a/addon/doxywizard/config.h b/addon/doxywizard/config.h
index 378ed13..13c9973 100644
--- a/addon/doxywizard/config.h
+++ b/addon/doxywizard/config.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -16,16 +16,17 @@
#include <QHash>
#include <QString>
+#include "adapter.h"
+
class Input;
class QTextStream;
-class QTextCodec;
bool parseConfig(
const QString &fileName,
const QHash<QString,Input *> &options
);
-void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s);
+void writeStringValue(QTextStream &t,TextCodecAdapter *codec,const QString &s);
// directly copied from ../../src/config.h to be consistent
enum
diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l
index 733ebc1..95f33e7 100644
--- a/addon/doxywizard/config_doxyw.l
+++ b/addon/doxywizard/config_doxyw.l
@@ -31,11 +31,10 @@
#include <QString>
#include <QVariant>
#include <QStack>
-#include <QTextCodec>
#include <QByteArray>
#include <QFileInfo>
#include <QStringList>
-#include <QRegExp>
+#include <QRegularExpression>
#include <QTextStream>
#include <QMessageBox>
@@ -68,7 +67,7 @@ static int g_includeDepth;
static QVariant *g_arg;
static Input *g_curOption=0;
static QByteArray g_str;
-static QTextCodec *g_codec = QTextCodec::codecForName("UTF-8");
+static std::unique_ptr<TextCodecAdapter> g_codec = std::make_unique<TextCodecAdapter>("UTF-8");
static QString g_codecName = QString::fromLatin1("UTF-8");
static QString g_cmd;
static bool g_isEnum;
@@ -101,10 +100,10 @@ static void checkEncoding()
Input *option = g_options->value(QString::fromLatin1("DOXYFILE_ENCODING"));
if (option && option->value().toString()!=g_codecName)
{
- QTextCodec *newCodec = QTextCodec::codecForName(option->value().toString().toLatin1());
- if (newCodec)
+ auto newCodec = std::make_unique<TextCodecAdapter>(option->value().toString().toLatin1());
+ if (newCodec->isValid())
{
- g_codec = newCodec;
+ g_codec.swap(newCodec);
g_codecName = option->value().toString();
}
}
@@ -191,11 +190,11 @@ static void processString()
if (g_isEnum)
{
InputString *cur = dynamic_cast<InputString *>(g_curOption);
- *g_arg = cur->checkEnumVal(g_codec->toUnicode(result));
+ *g_arg = cur->checkEnumVal(g_codec->decode(result));
}
else
{
- *g_arg = QVariant(g_codec->toUnicode(result));
+ *g_arg = QVariant(g_codec->decode(result));
}
// update encoding
@@ -219,7 +218,7 @@ static void processList()
if (!elemStr.isEmpty())
{
//printf("Processed list element '%s'\n",e.data());
- *g_arg = QVariant(g_arg->toStringList() << g_codec->toUnicode(elemStr));
+ *g_arg = QVariant(g_arg->toStringList() << g_codec->decode(elemStr));
elemStr="";
}
};
@@ -398,7 +397,8 @@ static void readIncludeFile(const QString &incName)
/*-------------- TAG start ---------------*/
-<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { g_cmd = g_codec->toUnicode(yytext);
+<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" {
+ g_cmd = g_codec->decode(yytext);
g_cmd=g_cmd.left(g_cmd.length()-1).trimmed();
g_curOption = g_options->value(g_cmd);
if (g_curOption==0) // oops not known
@@ -456,7 +456,8 @@ static void readIncludeFile(const QString &incName)
}
}
}
-<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { g_cmd=g_codec->toUnicode(yytext);
+<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" {
+ g_cmd=g_codec->decode(yytext);
g_cmd=g_cmd.left(g_cmd.length()-2).trimmed();
g_curOption = g_options->value(g_cmd);
if (g_curOption==0) // oops not known
@@ -510,7 +511,7 @@ static void readIncludeFile(const QString &incName)
/* include a config file */
<Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);}
<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") {
- readIncludeFile(g_codec->toUnicode(yytext));
+ readIncludeFile(g_codec->decode(yytext));
BEGIN(Start);
}
<<EOF>> {
@@ -597,16 +598,18 @@ static void readIncludeFile(const QString &incName)
static void substEnvVarsInString(QString &s)
{
- static QRegExp re(QString::fromLatin1("\\$\\([a-z_A-Z0-9]+\\)"));
+ static QRegularExpression re(QString::fromLatin1("\\$\\([a-z_A-Z0-9]+\\)"));
if (s.isEmpty()) return;
int p=0;
int i,l;
//printf("substEnvVarInString(%s) start\n",qPrintable(s));
- while ((i=re.indexIn(s,p))!=-1)
+
+ QRegularExpressionMatch match;
+ while ((i=s.indexOf(re,p,&match))!=-1)
{
- l = re.matchedLength();
+ l = match.capturedLength();
//printf("Found environment var s.mid(%d,%d)='%s'\n",i+2,l-3,qPrintable(s.mid(i+2,l-3)));
- QString env=g_codec->toUnicode(getenv(s.mid(i+2,l-3).toLatin1()));
+ QString env=g_codec->decode(getenv(s.mid(i+2,l-3).toLatin1()));
substEnvVarsInString(env); // recursively expand variables if needed.
s = s.left(i)+env+s.right(s.length()-i-l);
p=i+env.length(); // next time start at the end of the expanded string
@@ -642,7 +645,7 @@ static void substEnvVarsInStrList(QStringList &sl)
// search for a "word"
for (i=0;i<l;i++)
{
- QChar c=0;
+ QChar c;
// skip until start of new word
while (i<l && ((c=result.at(i))==QChar::fromLatin1(' ') || c==QChar::fromLatin1('\t'))) i++;
p=i; // p marks the start index of the word
@@ -778,14 +781,13 @@ bool parseConfig(
return true;
}
-void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s)
+void writeStringValue(QTextStream &t,TextCodecAdapter *codec,const QString &s)
{
QChar c;
bool needsEscaping=false;
bool needsHashEscaping=false;
// convert the string back to it original encoding
- //QByteArray se = codec->fromUnicode(s);
- t.setCodec(codec);
+ codec->applyToStream(t);
const QChar *p=s.data();
if (!s.isEmpty() && !p->isNull())
{
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp
index 5031221..1011e2b 100755
--- a/addon/doxywizard/doxywizard.cpp
+++ b/addon/doxywizard/doxywizard.cpp
@@ -34,9 +34,11 @@
#include <QDesktopServices>
#include <QUrl>
#include <QTextStream>
+#include <QRegularExpression>
#include <QDebug>
+#include <QDate>
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#endif
@@ -62,14 +64,14 @@ MainWindow::MainWindow()
{
QMenu *file = menuBar()->addMenu(tr("File"));
file->addAction(tr("Open..."),
- this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
+ this, SLOT(openConfig()), Qt::CTRL|Qt::Key_O);
m_recentMenu = file->addMenu(tr("Open recent"));
file->addAction(tr("Save"),
- this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
+ this, SLOT(saveConfig()), Qt::CTRL|Qt::Key_S);
file->addAction(tr("Save as..."),
- this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
+ this, SLOT(saveConfigAs()), Qt::SHIFT|Qt::CTRL|Qt::Key_S);
file->addAction(tr("Quit"),
- this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
+ this, SLOT(quit()), Qt::CTRL|Qt::Key_Q);
QMenu *settings = menuBar()->addMenu(tr("Settings"));
m_resetDefault = settings->addAction(tr("Reset to factory defaults"),
@@ -275,8 +277,9 @@ void MainWindow::about()
QString::fromLatin1(qVersion());
}
t << QString::fromLatin1(")</center><p><br>"
- "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-2021</center><p>"
- "</qt>");
+ "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-");
+ t << QDate::currentDate().year();
+ t << QString::fromLatin1("</center><p></qt>");
QMessageBox::about(this,tr("Doxygen GUI"),msg);
}
@@ -328,11 +331,12 @@ void MainWindow::saveConfig(const QString &fileName)
{
QMessageBox::warning(this,
tr("Error saving"),
- tr("Error: cannot open the file ")+fileName+tr(" for writing!\n")+
- tr("Reason given: ")+f.error());
+ QString(tr("Error: cannot open the file "))+fileName+tr(" for writing!\n")+
+ tr("Reason given: ")+QString::number(f.error()));
return;
}
QTextStream t(&f);
+ t.device()->setTextModeEnabled(false);
m_expert->writeConfig(t,false,false);
updateConfigFileName(fileName);
m_modified = false;
@@ -417,19 +421,19 @@ void MainWindow::resetToDefaults()
void MainWindow::loadSettings()
{
- QVariant geometry = m_settings.value(QString::fromLatin1("main/geometry"), QVariant::Invalid);
- QVariant state = m_settings.value(QString::fromLatin1("main/state"), QVariant::Invalid);
- QVariant wizState = m_settings.value(QString::fromLatin1("wizard/state"), QVariant::Invalid);
- QVariant loadSettings = m_settings.value(QString::fromLatin1("wizard/loadsettings"), QVariant::Invalid);
- QVariant workingDir = m_settings.value(QString::fromLatin1("wizard/workingdir"), QVariant::Invalid);
+ QVariant geometry = m_settings.value(QString::fromLatin1("main/geometry"));
+ QVariant state = m_settings.value(QString::fromLatin1("main/state"));
+ QVariant wizState = m_settings.value(QString::fromLatin1("wizard/state"));
+ QVariant loadSettings = m_settings.value(QString::fromLatin1("wizard/loadsettings"));
+ QVariant workingDir = m_settings.value(QString::fromLatin1("wizard/workingdir"));
- if (geometry !=QVariant::Invalid) restoreGeometry(geometry.toByteArray());
- if (state !=QVariant::Invalid) restoreState (state.toByteArray());
- if (wizState !=QVariant::Invalid) m_wizard->restoreState(wizState.toByteArray());
- if (loadSettings!=QVariant::Invalid && loadSettings.toBool())
+ if (!geometry.isNull()) restoreGeometry(geometry.toByteArray());
+ if (!state.isNull()) restoreState (state.toByteArray());
+ if (!wizState.isNull()) m_wizard->restoreState(wizState.toByteArray());
+ if (!loadSettings.isNull() && loadSettings.toBool())
{
m_expert->loadSettings(&m_settings);
- if (workingDir!=QVariant::Invalid && QDir(workingDir.toString()).exists())
+ if (!workingDir.isNull() && QDir(workingDir.toString()).exists())
{
setWorkingDir(workingDir.toString());
}
@@ -548,15 +552,15 @@ void MainWindow::runDoxygen()
m_runProcess->setWorkingDirectory(m_workingDir->text());
QStringList env=QProcess::systemEnvironment();
// set PWD environment variable to m_workingDir
- env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive),
+ env.replaceInStrings(QRegularExpression(QString::fromLatin1("^PWD=(.*)"),QRegularExpression::CaseInsensitiveOption),
QString::fromLatin1("PWD=")+m_workingDir->text());
m_runProcess->setEnvironment(env);
QStringList args;
-#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
- QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),Qt::SkipEmptyParts);
-#else
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),QString::SkipEmptyParts);
+#else
+ QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),Qt::SkipEmptyParts);
#endif
args << runOptions;
@@ -574,6 +578,7 @@ void MainWindow::runDoxygen()
}
QTextStream t(m_runProcess);
m_expert->writeConfig(t,false,false);
+ t.flush();
m_runProcess->closeWriteChannel();
if (m_runProcess->state() == QProcess::NotRunning)
@@ -610,11 +615,7 @@ void MainWindow::readStdout()
{
text1 += text;
m_outputLog->clear();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
m_outputLog->append(APPQT(text1.toHtmlEscaped().trimmed()));
-#else
- m_outputLog->append(APPQT(Qt::escape(text1).trimmed()));
-#endif
}
}
}
@@ -651,7 +652,7 @@ void MainWindow::showHtmlOutput()
QString indexFile = m_expert->getHtmlOutputIndex(m_workingDir->text());
QFileInfo fi(indexFile);
// TODO: the following doesn't seem to work with IE
-#ifdef WIN32
+#ifdef _WIN32
//QString indexUrl(QString::fromLatin1("file:///"));
ShellExecute(NULL, L"open", (LPCWSTR)fi.absoluteFilePath().utf16(), NULL, NULL, SW_SHOWNORMAL);
#else
diff --git a/addon/doxywizard/expert.cpp b/addon/doxywizard/expert.cpp
index 2a1685b..7ee2d9a 100644
--- a/addon/doxywizard/expert.cpp
+++ b/addon/doxywizard/expert.cpp
@@ -33,8 +33,8 @@
#include <QMessageBox>
#include <QSettings>
#include <QTextStream>
-#include <QTextCodec>
#include <QFileInfo>
+#include <QRegularExpression>
#define SA(x) QString::fromLatin1(x)
@@ -404,7 +404,7 @@ static QString getDocsForNode(const QDomElement &child)
// Remove / replace doxygen markup strings
// the regular expressions are hard to read so the intention will be given
// Note: see also configgen.py in the src directory for other doxygen parts
- QRegExp regexp;
+ QRegularExpression regexp;
// remove \n at end and replace by a space
regexp.setPattern(SA("\\n$"));
docs.replace(regexp,SA(" "));
@@ -785,7 +785,7 @@ void Expert::loadConfig(const QString &fileName)
parseConfig(fileName,m_options);
}
-void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,
+void Expert::saveTopic(QTextStream &t,QDomElement &elem,TextCodecAdapter *codec,
bool brief,bool condensed)
{
if (!brief)
@@ -847,22 +847,14 @@ bool Expert::writeConfig(QTextStream &t,bool brief, bool condensed)
t << convertToComment(m_header);
}
- QTextCodec *codec = 0;
Input *option = m_options[QString::fromLatin1("DOXYFILE_ENCODING")];
- if (option)
- {
- codec = QTextCodec::codecForName(option->value().toString().toLatin1());
- if (codec==0) // fallback: use UTF-8
- {
- codec = QTextCodec::codecForName("UTF-8");
- }
- }
+ TextCodecAdapter codec(option->value().toString().toLatin1());
QDomElement childElem = m_rootElement.firstChildElement();
while (!childElem.isNull())
{
if (childElem.tagName()==SA("group"))
{
- saveTopic(t,childElem,codec,brief,condensed);
+ saveTopic(t,childElem,&codec,brief,condensed);
}
childElem = childElem.nextSiblingElement();
}
diff --git a/addon/doxywizard/expert.h b/addon/doxywizard/expert.h
index 7011eb4..8f0b367 100644
--- a/addon/doxywizard/expert.h
+++ b/addon/doxywizard/expert.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -18,13 +18,13 @@
#include <QHash>
#include "docintf.h"
+#include "adapter.h"
class QTreeWidget;
class QTreeWidgetItem;
class QStackedWidget;
class QSettings;
class QTextBrowser;
-class QTextCodec;
class QPushButton;
class Input;
@@ -50,7 +50,7 @@ class Expert : public QSplitter, public DocIntf
// DocIntf methods
void setHeader(const char *name);
void add(const char *name,const char *doc);
-
+
public slots:
void activateTopic(QTreeWidgetItem *,QTreeWidgetItem *);
QWidget *createTopicWidget(QDomElement &elem);
@@ -67,7 +67,7 @@ class Expert : public QSplitter, public DocIntf
private:
void createTopics(const QDomElement &);
- void saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,bool brief,bool dondensed);
+ void saveTopic(QTextStream &t,QDomElement &elem,TextCodecAdapter *codec,bool brief,bool dondensed);
QSplitter *m_splitter;
QTextBrowser *m_helper;
diff --git a/addon/doxywizard/helplabel.h b/addon/doxywizard/helplabel.h
index 362ebcd..6fff643 100644
--- a/addon/doxywizard/helplabel.h
+++ b/addon/doxywizard/helplabel.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -20,8 +20,8 @@ class HelpLabel : public QLabel
{
Q_OBJECT
public:
- HelpLabel(const QString &text) : QLabel(text)
- { setContextMenuPolicy(Qt::CustomContextMenu);
+ HelpLabel(const QString &text) : QLabel(text)
+ { setContextMenuPolicy(Qt::CustomContextMenu);
connect(this,SIGNAL(customContextMenuRequested(const QPoint&)),
this,SLOT(showMenu(const QPoint&)));
}
@@ -39,7 +39,13 @@ class HelpLabel : public QLabel
}
}
protected:
- void enterEvent( QEvent * event ) { enter(); QLabel::enterEvent(event); }
+ void enterEvent(
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ QEvent * event
+#else
+ QEnterEvent * event
+#endif
+ ) { enter(); QLabel::enterEvent(event); }
};
#endif
diff --git a/addon/doxywizard/input.h b/addon/doxywizard/input.h
index c1815d0..52d10ed 100644
--- a/addon/doxywizard/input.h
+++ b/addon/doxywizard/input.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -14,9 +14,10 @@
#define INPUT_H
#include <QVariant>
+#include "adapter.h"
class QTextStream;
-class QTextCodec;
+class QTextStream;
class Input
{
@@ -41,7 +42,7 @@ class Input
virtual void updateDependencies() = 0;
virtual void reset() = 0;
virtual bool isDefault() = 0;
- virtual void writeValue(QTextStream &t,QTextCodec *codec) = 0;
+ virtual void writeValue(QTextStream &t,TextCodecAdapter *codec) = 0;
virtual void setTemplateDocs(const QString &docs) = 0;
virtual bool isEmpty() { return false; };
};
diff --git a/addon/doxywizard/inputbool.cpp b/addon/doxywizard/inputbool.cpp
index bbe17ca..ad6894b 100644
--- a/addon/doxywizard/inputbool.cpp
+++ b/addon/doxywizard/inputbool.cpp
@@ -16,7 +16,6 @@
#include <QCheckBox>
#include <QTextStream>
-#include <QTextCodec>
#include <QGridLayout>
InputBool::InputBool( QGridLayout *layout, int &row,
@@ -135,12 +134,12 @@ void InputBool::reset()
setValue(m_default);
}
-void InputBool::writeValue(QTextStream &t,QTextCodec *codec)
+void InputBool::writeValue(QTextStream &t,TextCodecAdapter *codec)
{
if (m_state)
- t << codec->fromUnicode(QString::fromLatin1("YES"));
+ t << codec->encode(QString::fromLatin1("YES"));
else
- t << codec->fromUnicode(QString::fromLatin1("NO"));
+ t << codec->encode(QString::fromLatin1("NO"));
}
bool InputBool::isDefault()
diff --git a/addon/doxywizard/inputbool.h b/addon/doxywizard/inputbool.h
index e203df3..a17f672 100644
--- a/addon/doxywizard/inputbool.h
+++ b/addon/doxywizard/inputbool.h
@@ -39,7 +39,7 @@ class InputBool : public QObject, public Input
void setEnabled(bool);
void updateDependencies();
bool isDefault();
- void writeValue(QTextStream &t,QTextCodec *codec);
+ void writeValue(QTextStream &t,TextCodecAdapter *codec);
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
static bool convertToBool(const QVariant &v,bool &isValid);
diff --git a/addon/doxywizard/inputint.cpp b/addon/doxywizard/inputint.cpp
index ce3fa02..2b3b2d6 100644
--- a/addon/doxywizard/inputint.cpp
+++ b/addon/doxywizard/inputint.cpp
@@ -123,7 +123,7 @@ void InputInt::reset()
setValue(m_default);
}
-void InputInt::writeValue(QTextStream &t,QTextCodec *)
+void InputInt::writeValue(QTextStream &t,TextCodecAdapter *)
{
t << m_val;
}
diff --git a/addon/doxywizard/inputint.h b/addon/doxywizard/inputint.h
index 1f6b79c..7dc0ae7 100644
--- a/addon/doxywizard/inputint.h
+++ b/addon/doxywizard/inputint.h
@@ -42,7 +42,7 @@ class InputInt : public QObject, public Input
void setEnabled(bool);
void updateDependencies() {}
bool isDefault();
- void writeValue(QTextStream &t,QTextCodec *codec);
+ void writeValue(QTextStream &t,TextCodecAdapter *codec);
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
public slots:
diff --git a/addon/doxywizard/inputobsolete.h b/addon/doxywizard/inputobsolete.h
index b8e33e5..d1d90a5 100644
--- a/addon/doxywizard/inputobsolete.h
+++ b/addon/doxywizard/inputobsolete.h
@@ -13,6 +13,8 @@
#ifndef INPUTOBSOLETE_H
#define INPUTOBSOLETE_H
+#include "input.h"
+
class InputObsolete : public Input
{
public:
@@ -28,7 +30,7 @@ class InputObsolete : public Input
void updateDependencies() {}
void reset() {}
bool isDefault() { return false; }
- void writeValue(QTextStream &,QTextCodec *) {}
+ void writeValue(QTextStream &,TextCodecAdapter *) {}
void setTemplateDocs(const QString &) {}
bool isEmpty() { return false; };
Kind orgKind() const { return m_orgKind; }
diff --git a/addon/doxywizard/inputstring.cpp b/addon/doxywizard/inputstring.cpp
index 8f09174..24a2878 100644
--- a/addon/doxywizard/inputstring.cpp
+++ b/addon/doxywizard/inputstring.cpp
@@ -23,7 +23,6 @@
#include <QToolBar>
#include <QFileInfo>
#include <QFileDialog>
-#include <QTextCodec>
class NoWheelComboBox : public QComboBox
{
@@ -101,7 +100,7 @@ InputString::InputString( QGridLayout *layout,int &row,
if (m_le) connect( m_le, SIGNAL(textChanged(const QString&)),
this, SLOT(setValue(const QString&)) );
- if (m_com) connect( m_com, SIGNAL(activated(const QString &)),
+ if (m_com) connect( m_com, SIGNAL(textActivated(const QString &)),
this, SLOT(setValue(const QString &)) );
m_str = s+QChar::fromLatin1('!'); // force update
setValue(s);
@@ -254,7 +253,7 @@ void InputString::reset()
setDefault();
}
-void InputString::writeValue(QTextStream &t,QTextCodec *codec)
+void InputString::writeValue(QTextStream &t,TextCodecAdapter *codec)
{
writeStringValue(t,codec,m_str);
}
diff --git a/addon/doxywizard/inputstring.h b/addon/doxywizard/inputstring.h
index 4a873e0..11a3fcd 100644
--- a/addon/doxywizard/inputstring.h
+++ b/addon/doxywizard/inputstring.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -31,16 +31,16 @@ class InputString : public QObject, public Input
Q_OBJECT
public:
- enum StringMode { StringFree=0,
- StringFile=1,
- StringDir=2,
+ enum StringMode { StringFree=0,
+ StringFile=1,
+ StringDir=2,
StringFixed=3,
StringImage=4,
StringFileDir=5
};
InputString( QGridLayout *layout,int &row,
- const QString &id, const QString &s,
+ const QString &id, const QString &s,
StringMode m,
const QString &docs,
const QString &absPath = QString() );
@@ -60,7 +60,7 @@ class InputString : public QObject, public Input
void setEnabled(bool);
void updateDependencies() {}
bool isDefault();
- void writeValue(QTextStream &t,QTextCodec *codec);
+ void writeValue(QTextStream &t,TextCodecAdapter *codec);
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
bool isEmpty() { return m_str.isEmpty(); }
QString checkEnumVal(const QString &value);
@@ -92,7 +92,7 @@ class InputString : public QObject, public Input
QString m_default;
StringMode m_sm;
QStringList m_values;
- int m_index;
+ int m_index;
QVariant m_value;
QString m_docs;
QString m_id;
diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp
index 2f4c7f7..2b7e69c 100644
--- a/addon/doxywizard/inputstrlist.cpp
+++ b/addon/doxywizard/inputstrlist.cpp
@@ -22,7 +22,6 @@
#include <QFileInfo>
#include <QFileDialog>
#include <QTextStream>
-#include <QTextCodec>
InputStrList::InputStrList( QGridLayout *layout,int &row,
const QString & id,
@@ -152,7 +151,7 @@ void InputStrList::setEnabled(bool state)
void InputStrList::browseFiles()
{
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
- QStringList fileNames = QFileDialog::getOpenFileNames();
+ QStringList fileNames = QFileDialog::getOpenFileNames();
if (!fileNames.isEmpty())
{
@@ -180,9 +179,9 @@ void InputStrList::browseFiles()
}
void InputStrList::browseDir()
-{
+{
QString path = QFileInfo(MainWindow::instance().configFileName()).path();
- QString dirName = QFileDialog::getExistingDirectory();
+ QString dirName = QFileDialog::getExistingDirectory();
if (!dirName.isNull())
{
@@ -243,7 +242,7 @@ void InputStrList::reset()
setValue(m_default);
}
-void InputStrList::writeValue(QTextStream &t,QTextCodec *codec)
+void InputStrList::writeValue(QTextStream &t,TextCodecAdapter *codec)
{
bool first=true;
foreach (QString s, m_strList)
diff --git a/addon/doxywizard/inputstrlist.h b/addon/doxywizard/inputstrlist.h
index 19b4ac3..6d34061 100644
--- a/addon/doxywizard/inputstrlist.h
+++ b/addon/doxywizard/inputstrlist.h
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -22,7 +22,6 @@ class QLabel;
class QLineEdit;
class QPushButton;
class QListWidget;
-class QStringList;
class QGridLayout;
class QAction;
@@ -52,7 +51,7 @@ class InputStrList : public QObject, public Input
void setEnabled(bool);
void updateDependencies() {}
bool isDefault();
- void writeValue(QTextStream &t,QTextCodec *codec);
+ void writeValue(QTextStream &t,TextCodecAdapter *codec);
void setTemplateDocs(const QString &docs) { m_tdocs = docs; }
bool isEmpty();
@@ -64,9 +63,9 @@ class InputStrList : public QObject, public Input
void showHelp(Input *);
private slots:
- void addString();
- void delString();
- void updateString();
+ void addString();
+ void delString();
+ void updateString();
void selectText(const QString &s);
void browseFiles();
void browseDir();
diff --git a/addon/doxywizard/wizard.cpp b/addon/doxywizard/wizard.cpp
index a3bc524..84a70f6 100755
--- a/addon/doxywizard/wizard.cpp
+++ b/addon/doxywizard/wizard.cpp
@@ -35,6 +35,7 @@
#include <QStackedWidget>
#include <qdrawutil.h>
+
// options configurable via the wizard
#define STR_PROJECT_NAME QString::fromLatin1("PROJECT_NAME")
#define STR_PROJECT_LOGO QString::fromLatin1("PROJECT_LOGO")
@@ -386,16 +387,16 @@ void ColorPicker::paintEvent(QPaintEvent*)
void ColorPicker::mouseMoveEvent(QMouseEvent *m)
{
- if (m_mode==Hue) setHue(y2hue(m->y()));
- else if (m_mode==Saturation) setSat(y2sat(m->y()));
- else setGam(y2gam(m->y()));
+ if (m_mode==Hue) setHue(y2hue(getMouseYPositionFromEvent(m)));
+ else if (m_mode==Saturation) setSat(y2sat(getMouseYPositionFromEvent(m)));
+ else setGam(y2gam(getMouseYPositionFromEvent(m)));
}
void ColorPicker::mousePressEvent(QMouseEvent *m)
{
- if (m_mode==Hue) setHue(y2hue(m->y()));
- else if (m_mode==Saturation) setSat(y2sat(m->y()));
- else setGam(y2gam(m->y()));
+ if (m_mode==Hue) setHue(y2hue(getMouseYPositionFromEvent(m)));
+ else if (m_mode==Saturation) setSat(y2sat(getMouseYPositionFromEvent(m)));
+ else setGam(y2gam(getMouseYPositionFromEvent(m)));
}
void ColorPicker::setHue(int h)
@@ -478,7 +479,7 @@ int ColorPicker::gam2y(int g)
Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData)
{
QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setMargin(4);
+ layout->setContentsMargins(4,4,4,4);
layout->setSpacing(8);
QLabel *l = new QLabel(this);
l->setText(tr("Provide some information "
@@ -863,10 +864,17 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
connect(m_crossRef,SIGNAL(stateChanged(int)),
SLOT(changeCrossRefState(int)));
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(m_optimizeLangGroup,SIGNAL(buttonClicked(int)),
SLOT(optimizeFor(int)));
connect(m_extractModeGroup,SIGNAL(buttonClicked(int)),
SLOT(extractMode(int)));
+#else
+ connect(m_optimizeLangGroup,SIGNAL(idClicked(int)),
+ SLOT(optimizeFor(int)));
+ connect(m_extractModeGroup,SIGNAL(idClicked(int)),
+ SLOT(extractMode(int)));
+#endif
}
@@ -993,10 +1001,13 @@ Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData)
connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int)));
connect(m_docbookEnabled,SIGNAL(stateChanged(int)),SLOT(setDocbookEnabled(int)));
connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int)));
- connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)),
- SLOT(setHtmlOptions(int)));
- connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)),
- SLOT(setLatexOptions(int)));
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
+ connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)),SLOT(setHtmlOptions(int)));
+ connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)),SLOT(setLatexOptions(int)));
+#else
+ connect(m_htmlOptionsGroup,SIGNAL(idClicked(int)),SLOT(setHtmlOptions(int)));
+ connect(m_texOptionsGroup,SIGNAL(idClicked(int)),SLOT(setLatexOptions(int)));
+#endif
connect(m_tuneColor,SIGNAL(clicked()),SLOT(tuneColorDialog()));
}
@@ -1185,8 +1196,13 @@ Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData)
m_dotCollaboration->setChecked(true);
gbox->setRowStretch(6,1);
+#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(m_diagramModeGroup,SIGNAL(buttonClicked(int)),
this,SLOT(diagramModeChanged(int)));
+#else
+ connect(m_diagramModeGroup,SIGNAL(idClicked(int)),
+ this,SLOT(diagramModeChanged(int)));
+#endif
connect(m_dotClass,SIGNAL(stateChanged(int)),
this,SLOT(setClassGraphEnabled(int)));
connect(m_dotCollaboration,SIGNAL(stateChanged(int)),