From 87e32e61673fd659ebd31e2cb472523e280233c0 Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Sat, 20 May 2023 16:27:23 -0500 Subject: [PATCH] Add support for Qt5. --- src/CMakeLists.txt.qt5 | 220 ++++++++++++++++++++++++++ src/QZoomChart.cpp | 1 + src/QZoomChart.h | 6 +- src/QZoomChartView.h | 4 + src/SeerArrayVisualizerWidget.cpp | 1 + src/SeerAsmWidget.cpp | 6 +- src/SeerEditorWidgetAssemblyAreas.cpp | 4 + src/SeerEditorWidgetSourceAreas.cpp | 5 +- src/SeerMemoryVisualizerWidget.cpp | 2 - src/SeerUtl.cpp | 9 +- 10 files changed, 250 insertions(+), 8 deletions(-) create mode 100644 src/CMakeLists.txt.qt5 diff --git a/src/CMakeLists.txt.qt5 b/src/CMakeLists.txt.qt5 new file mode 100644 index 0000000..749af5c --- /dev/null +++ b/src/CMakeLists.txt.qt5 @@ -0,0 +1,220 @@ +cmake_minimum_required(VERSION 3.1.0) + +project(seergdb VERSION 2.0.0 LANGUAGES CXX) + +set(PROJECT_NAME seergdb) + +# Find includes in the build directories +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_PREFIX_PATH ${QTDIR}) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTORCC ON) + +find_package(Qt5 COMPONENTS REQUIRED Core) +find_package(Qt5 COMPONENTS REQUIRED Gui) +find_package(Qt5 COMPONENTS REQUIRED Widgets) +find_package(Qt5 COMPONENTS REQUIRED PrintSupport) +find_package(Qt5 COMPONENTS REQUIRED Charts) + +set(HEADER_FILES + GdbMonitor.h + SeerArgumentsDialog.h + SeerBreakpointCreateDialog.h + SeerBreakpointsBrowserWidget.h + SeerCatchpointCreateDialog.h + SeerCatchpointsBrowserWidget.h + SeerPrintpointCreateDialog.h + SeerPrintpointsBrowserWidget.h + SeerSeerLogWidget.h + SeerConsoleWidget.h + SeerConfigDialog.h + SeerGdbConfigPage.h + SeerEditorConfigPage.h + SeerSourceConfigPage.h + SeerAssemblyConfigPage.h + SeerSeerConfigPage.h + SeerKeysConfigPage.h + SeerCloseSourceDialog.h + SeerDebugDialog.h + SeerDirectoryFilterProxyModel.h + SeerEditorManagerEntry.h + SeerEditorManagerWidget.h + SeerEditorWidgetSource.h + SeerEditorWidgetAssembly.h + SeerExecutableFilterProxyModel.h + SeerGdbWidget.h + SeerHexWidget.h + SeerAsmWidget.h + SeerArrayWidget.h + SeerLogWidget.h + SeerMainWindow.h + SeerArrayVisualizerWidget.h + SeerMemoryVisualizerWidget.h + SeerStructVisualizerWidget.h + SeerVarVisualizerWidget.h + SeerImageVisualizerWidget.h + SeerRegisterValuesBrowserWidget.h + SeerRegisterEditValueDialog.h + SeerRunStatusIndicator.h + SeerLibraryBrowserWidget.h + SeerSourceBrowserWidget.h + SeerFunctionBrowserWidget.h + SeerTypeBrowserWidget.h + SeerStaticBrowserWidget.h + SeerSourceSymbolLibraryManagerWidget.h + SeerStackArgumentsBrowserWidget.h + SeerStackFramesBrowserWidget.h + SeerStackLocalsBrowserWidget.h + SeerStackManagerWidget.h + SeerThreadFramesBrowserWidget.h + SeerThreadIdsBrowserWidget.h + SeerThreadGroupsBrowserWidget.h + SeerAdaTasksBrowserWidget.h + SeerAdaExceptionsBrowserWidget.h + SeerThreadManagerWidget.h + SeerGdbLogWidget.h + SeerTildeLogWidget.h + SeerUtl.h + SeerVariableLoggerBrowserWidget.h + SeerVariableManagerWidget.h + SeerVariableTrackerBrowserWidget.h + SeerWatchpointCreateDialog.h + SeerWatchpointsBrowserWidget.h + SeerCppSourceHighlighter.h + SeerAboutDialog.h + SeerSlashProcDialog.h + SeerHighlighterSettings.h + SeerKeySettings.h + SeerPlainTextEdit.h + SeerHelpPageDialog.h + SeerProgressIndicator.h + QProcessInfo.h + QProcessInfoWidget.h + QProgressIndicator.h + QColorButton.h + QDetachTabWidget.h + QZoomChartView.h + QZoomChart.h + QClearLineEdit.h + QIndexTreeWidget.h + QStringPair.h + QHistoryLineEdit.h + QEditDelegate.h + QHContainerWidget.h + QImageViewer.h + ) + +set(SOURCE_FILES + seergdb.cpp + GdbMonitor.cpp + SeerArgumentsDialog.cpp + SeerBreakpointCreateDialog.cpp + SeerBreakpointsBrowserWidget.cpp + SeerCatchpointCreateDialog.cpp + SeerCatchpointsBrowserWidget.cpp + SeerPrintpointCreateDialog.cpp + SeerPrintpointsBrowserWidget.cpp + SeerSeerLogWidget.cpp + SeerConsoleWidget.cpp + SeerConfigDialog.cpp + SeerGdbConfigPage.cpp + SeerEditorConfigPage.cpp + SeerSourceConfigPage.cpp + SeerAssemblyConfigPage.cpp + SeerSeerConfigPage.cpp + SeerKeysConfigPage.cpp + SeerCloseSourceDialog.cpp + SeerDebugDialog.cpp + SeerEditorManagerWidget.cpp + SeerEditorWidgetSource.cpp + SeerEditorWidgetSourceAreas.cpp + SeerEditorWidgetAssembly.cpp + SeerEditorWidgetAssemblyAreas.cpp + SeerGdbWidget.cpp + SeerHexWidget.cpp + SeerAsmWidget.cpp + SeerArrayWidget.cpp + SeerLogWidget.cpp + SeerMainWindow.cpp + SeerArrayVisualizerWidget.cpp + SeerMemoryVisualizerWidget.cpp + SeerStructVisualizerWidget.cpp + SeerVarVisualizerWidget.cpp + SeerImageVisualizerWidget.cpp + SeerRegisterValuesBrowserWidget.cpp + SeerRegisterEditValueDialog.cpp + SeerRunStatusIndicator.cpp + SeerLibraryBrowserWidget.cpp + SeerSourceBrowserWidget.cpp + SeerFunctionBrowserWidget.cpp + SeerTypeBrowserWidget.cpp + SeerStaticBrowserWidget.cpp + SeerSourceSymbolLibraryManagerWidget.cpp + SeerStackArgumentsBrowserWidget.cpp + SeerStackFramesBrowserWidget.cpp + SeerStackLocalsBrowserWidget.cpp + SeerStackManagerWidget.cpp + SeerThreadFramesBrowserWidget.cpp + SeerThreadIdsBrowserWidget.cpp + SeerThreadGroupsBrowserWidget.cpp + SeerAdaTasksBrowserWidget.cpp + SeerAdaExceptionsBrowserWidget.cpp + SeerThreadManagerWidget.cpp + SeerGdbLogWidget.cpp + SeerTildeLogWidget.cpp + SeerUtl.cpp + SeerVariableLoggerBrowserWidget.cpp + SeerVariableManagerWidget.cpp + SeerVariableTrackerBrowserWidget.cpp + SeerWatchpointCreateDialog.cpp + SeerWatchpointsBrowserWidget.cpp + SeerCppSourceHighlighter.cpp + SeerAboutDialog.cpp + SeerSlashProcDialog.cpp + SeerHighlighterSettings.cpp + SeerKeySettings.cpp + SeerPlainTextEdit.cpp + SeerHelpPageDialog.cpp + SeerProgressIndicator.cpp + QProcessInfo.cpp + QProcessInfoWidget.cpp + QProgressIndicator.cpp + QColorButton.cpp + QDetachTabWidget.cpp + QZoomChartView.cpp + QZoomChart.cpp + QClearLineEdit.cpp + QIndexTreeWidget.cpp + QHistoryLineEdit.cpp + QEditDelegate.cpp + QHContainerWidget.cpp + QImageViewer.cpp + ) + +qt5_add_resources(SOURCE_FILES resource.qrc) + +# Set non-Debug build as GUI application. +# Debug build remains consle application. +if(NOT CMAKE_BUILD_TYPE MATCHES Debug) #Release, RelWithDebInfo and MinSizeRel + if(WIN32) # Check if we are on Windows + set(SYSTEM_TYPE WIN32) + endif() + message("System type is " ${SYSTEM_TYPE}) +endif() + +# for Linux, BSD, Solaris, Minix +if(UNIX AND NOT APPLE) + add_compile_options(-Wall -Wextra -Wunused-result -pedantic) # -Werror -Wdeprecated-copy +endif() + +add_definitions(-DQT_DEPRECATED_WARNINGS) + +add_executable(${PROJECT_NAME} ${SYSTEM_TYPE} ${SOURCE_FILES}) + +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) + +target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::PrintSupport Qt5::Charts) + diff --git a/src/QZoomChart.cpp b/src/QZoomChart.cpp index e5469d7..136466c 100644 --- a/src/QZoomChart.cpp +++ b/src/QZoomChart.cpp @@ -1,4 +1,5 @@ #include "QZoomChart.h" +#include #include #include #include diff --git a/src/QZoomChart.h b/src/QZoomChart.h index 6595fd4..2bda2dc 100644 --- a/src/QZoomChart.h +++ b/src/QZoomChart.h @@ -2,12 +2,16 @@ #include +#if QT_VERSION < 0x060000 +using namespace QtCharts; +#endif + class QGestureEvent; class QZoomChart : public QChart { public: - explicit QZoomChart(QGraphicsItem* parent = nullptr, Qt::WindowFlags wFlags = {}); + QZoomChart(QGraphicsItem* parent = nullptr, Qt::WindowFlags wFlags = {}); ~QZoomChart(); protected: diff --git a/src/QZoomChartView.h b/src/QZoomChartView.h index aa2ec0b..ab74312 100644 --- a/src/QZoomChartView.h +++ b/src/QZoomChartView.h @@ -5,6 +5,10 @@ #include #include +#if QT_VERSION < 0x060000 +using namespace QtCharts; +#endif + class QZoomChartView : public QChartView { public: diff --git a/src/SeerArrayVisualizerWidget.cpp b/src/SeerArrayVisualizerWidget.cpp index c74c91d..e9fd249 100644 --- a/src/SeerArrayVisualizerWidget.cpp +++ b/src/SeerArrayVisualizerWidget.cpp @@ -1,6 +1,7 @@ #include "SeerArrayVisualizerWidget.h" #include "SeerHelpPageDialog.h" #include "SeerUtl.h" +#include #include #include #include diff --git a/src/SeerAsmWidget.cpp b/src/SeerAsmWidget.cpp index 8f20d11..61cdbe0 100644 --- a/src/SeerAsmWidget.cpp +++ b/src/SeerAsmWidget.cpp @@ -73,9 +73,9 @@ void SeerAsmWidget::setData (const QString& data) { QString opcodes_text = Seer::parseFirst(asm_text, "opcodes=", '"', '"', false); QString inst_text = Seer::parseFirst(asm_text, "inst=", '"', '"', false); - address_width = std::max((qsizetype)address_width, address_text.length()); - opcode_width = std::max((qsizetype)opcode_width, opcodes_text.length()); - inst_width = std::max((qsizetype)inst_width, inst_text.length()); + address_width = std::max((qsizetype)address_width, (qsizetype)address_text.length()); + opcode_width = std::max((qsizetype)opcode_width, (qsizetype)opcodes_text.length()); + inst_width = std::max((qsizetype)inst_width, (qsizetype)inst_text.length()); } // Write header. diff --git a/src/SeerEditorWidgetAssemblyAreas.cpp b/src/SeerEditorWidgetAssemblyAreas.cpp index 5aebf14..b9334cc 100644 --- a/src/SeerEditorWidgetAssemblyAreas.cpp +++ b/src/SeerEditorWidgetAssemblyAreas.cpp @@ -1223,7 +1223,11 @@ bool SeerEditorWidgetAssemblyArea::breakpointAddressEnabled (const QString& addr void SeerEditorWidgetAssemblyArea::showContextMenu (QMouseEvent* event) { +#if QT_VERSION >= 0x060000 showContextMenu(event->pos(), event->globalPosition()); +#else + showContextMenu(event->pos(), event->globalPos()); +#endif } void SeerEditorWidgetAssemblyArea::showContextMenu (QContextMenuEvent* event) { diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 94da990..f47c06f 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -495,7 +495,6 @@ bool SeerEditorWidgetSourceArea::event(QEvent* event) { // If the text isn't empty, display a took tip. if (cursor.selectedText().isEmpty() == false && cursor.selectedText() == _selectedExpressionCursor.selectedText()) { - //QToolTip::showText(helpEvent->globalPos(), QString("%1 = %2").arg(_selectedExpressionName).arg(_selectedExpressionValue) ); QToolTip::showText(helpEvent->globalPos(), _selectedExpressionValue); // Otherwise, hide any old one. @@ -942,7 +941,11 @@ bool SeerEditorWidgetSourceArea::breakpointLineEnabled (int lineno) const { void SeerEditorWidgetSourceArea::showContextMenu (QMouseEvent* event) { +#if QT_VERSION >= 0x060000 showContextMenu(event->pos(), event->globalPosition()); +#else + showContextMenu(event->pos(), event->globalPos()); +#endif } void SeerEditorWidgetSourceArea::showContextMenu (QContextMenuEvent* event) { diff --git a/src/SeerMemoryVisualizerWidget.cpp b/src/SeerMemoryVisualizerWidget.cpp index 909d37c..9d4f9b3 100644 --- a/src/SeerMemoryVisualizerWidget.cpp +++ b/src/SeerMemoryVisualizerWidget.cpp @@ -160,8 +160,6 @@ void SeerMemoryVisualizerWidget::handleText (const QString& text) { QString value_text = Seer::parseFirst(text, "value=", '"', '"', false); QString address = ""; - qDebug() << value_text; - // Look for an address in the value. if (address == "") { QRegularExpression re("0[xX][0-9a-fA-F]+"); diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index c60a1eb..43235be 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -483,7 +483,14 @@ namespace Seer { foreach (const auto& pattern, patterns) { - QRegularExpression re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive, QRegularExpression::UnanchoredWildcardConversion); + + QRegularExpression re; + +#if QT_VERSION >= 0x060000 + re = QRegularExpression::fromWildcard(pattern, Qt::CaseInsensitive, QRegularExpression::UnanchoredWildcardConversion); +#else + re = QRegularExpression(QRegularExpression::wildcardToRegularExpression(pattern), QRegularExpression::CaseInsensitiveOption); +#endif if (re.match(string).hasMatch()) { return true;