Skip to content

Commit

Permalink
Removing Qt4 macros from CQ GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
ruben2020 committed Feb 3, 2024
1 parent d0e05c0 commit 11f1701
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 131 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ jobs:
cxx: "g++"
}
- {
name: "Ubuntu 20.04 GCC Qt4",
os: ubuntu-20.04,
name: "Ubuntu-latest GCC NoGui",
os: ubuntu-latest,
build_type: "Debug",
cc: "gcc",
cxx: "g++"
}
- {
name: "Ubuntu-latest GCC NoGui",
os: ubuntu-latest,
name: "macOS Clang Qt6",
os: macos-latest,
build_type: "Debug",
cc: "gcc",
cxx: "g++"
cc: "clang",
cxx: "clang++"
}
- {
name: "macOS Clang Qt5",
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
sudo apt-get install build-essential g++ git cmake ninja-build sqlite3 libsqlite3-dev cscope exuberant-ctags
sudo apt-get install libglx-dev libgl1-mesa-dev libvulkan-dev libxkbcommon-dev
sudo apt-get install qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools
sudo apt-get install libqt6core5compat6-dev qt6-l10n-tools
sudo apt-get install libqt6core5compat6-dev qt6-l10n-tools qt6-wayland
uname -a
lsb_release -a
gcc -v && g++ -v && cmake --version && ninja --version
Expand Down Expand Up @@ -128,6 +128,15 @@ jobs:
lsb_release -a
gcc -v && g++ -v && cmake --version && ninja --version
- name: Install dependencies on macOS Clang Qt6
if: startsWith(matrix.config.name, 'macOS Clang Qt6')
run: |
brew install cmake ninja qt@6 sqlite cscope ctags
clang -v
cmake --version
ninja --version
brew info qt@6
- name: Install dependencies on macOS Clang Qt5
if: startsWith(matrix.config.name, 'macOS Clang Qt5')
run: |
Expand Down Expand Up @@ -182,30 +191,29 @@ jobs:
ninja package
sudo ninja install
- name: Configure CMake and Build on Ubuntu 20.04 GCC Qt4
- name: Configure CMake and Build on Ubuntu-latest GCC NoGui
shell: bash
if: contains(matrix.config.name, 'Ubuntu 20.04 GCC Qt4')
if: contains(matrix.config.name, 'Ubuntu-latest GCC NoGui')
run: |
mkdir -p build
cd build
export CC=gcc
export CXX=g++
cmake -G Ninja -DBUILD_QT5=OFF ..
cmake -G Ninja -DNO_GUI=ON ..
ninja
ninja package
sudo ninja install
- name: Configure CMake and Build on Ubuntu-latest GCC NoGui
- name: Configure CMake and Build on macOS Clang Qt6
shell: bash
if: contains(matrix.config.name, 'Ubuntu-latest GCC NoGui')
if: contains(matrix.config.name, 'macOS Clang Qt6')
run: |
mkdir -p build
cd build
export CC=gcc
export CXX=g++
cmake -G Ninja -DNO_GUI=ON ..
export CC=clang
export CXX=clang++
cmake -G Ninja -DBUILD_QT6=ON -DCMAKE_PREFIX_PATH=/usr/local/opt/qt@6/lib/cmake ..
ninja
ninja package
sudo ninja install
- name: Configure CMake and Build on macOS Clang Qt5
Expand Down
5 changes: 0 additions & 5 deletions gui/aboutdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
#define ABOUTDIALOG_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif


namespace Ui {
class aboutDialog;
Expand Down
62 changes: 4 additions & 58 deletions gui/fileviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@
#include <QFontMetrics>
#include <QRegExp>

#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include "ILexer.h"
#include "Lexilla.h"
#endif
#include "ScintillaEdit.h"
#include "SciLexer.h"

Expand All @@ -30,12 +28,6 @@
#include "fileviewsettingsdialog.h"
#include "themes.h"

#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#define QREGEXP QRegularExpression
#else
#define QREGEXP QRegExp
#endif

#if defined(_WIN32)
#define EXT_EDITOR_DEFAULT_PATH "notepad %f"
#elif defined(__APPLE__)
Expand Down Expand Up @@ -132,11 +124,7 @@ fileviewer::fileviewer(mainwindow* pmw)
,m_textEditSourceFont("Courier New", 12)
,m_externalEditorPath(EXT_EDITOR_DEFAULT_PATH)
,m_timestampMismatchWarned(false)
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
,m_lexer(NULL)
#else
,m_lexer(SCLEX_NULL)
#endif
,m_fontsize(0)
,m_currentlang(enHighlightCPP)
,m_currentline(1)
Expand Down Expand Up @@ -193,24 +181,13 @@ QString fileviewer::checkFontFamily(QString fontname)
}
else
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))

newfont = QFontDatabase::systemFont(QFontDatabase::FixedFont).family();
#else
if (m_fontlist.contains(tryfont1)) newfont = tryfont1;
else if (m_fontlist.contains(tryfont2)) newfont = tryfont2;
else newfont = m_fontlist[0];
#endif
}
return newfont;
}

void fileviewer::init(void)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#else
Scintilla_LinkLexers();
#endif
m_pushButtonPaste->setEnabled(false);
m_pushButtonPrev->setEnabled(false);
m_pushButtonNext->setEnabled(false);
Expand Down Expand Up @@ -701,15 +678,15 @@ void fileviewer::OpenInEditor_ButtonClick(bool checked)
if (pos != -1)
{
program = rx.cap(1);
arguments = (rx.cap(2)).split(QREGEXP("[ ]+"));
arguments = (rx.cap(2)).split(QRegularExpression("[ ]+"));
}
else
{
arguments = m_externalEditorPath.split(QREGEXP("[ ]+"));
arguments = m_externalEditorPath.split(QRegularExpression("[ ]+"));
program = arguments.takeFirst();
}
arguments.replaceInStrings(QREGEXP("%f"), m_iter->filename);
arguments.replaceInStrings(QREGEXP("%n"), m_iter->linenum);
arguments.replaceInStrings(QRegularExpression("%f"), m_iter->filename);
arguments.replaceInStrings(QRegularExpression("%n"), m_iter->linenum);

if (QProcess::startDetached(program, arguments) == false)
{
Expand Down Expand Up @@ -817,8 +794,6 @@ void fileviewer::replaceLexer(int sclang, int lang)
{
QColor markerlinebgcolor;
QColor linenumfgcolor;

#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
switch (lang)
{
case enHighlightCPP:
Expand Down Expand Up @@ -846,35 +821,6 @@ void fileviewer::replaceLexer(int sclang, int lang)
break;
}
m_textEditSource->setILexer((sptr_t)m_lexer);
#else
switch (lang)
{
case enHighlightCPP:
m_lexer = SCLEX_CPP;
break;

case enHighlightPython:
m_lexer = SCLEX_PYTHON;
break;

case enHighlightJava:
m_lexer = SCLEX_CPP;
break;

case enHighlightRuby:
m_lexer = SCLEX_RUBY;
break;

case enHighlightJavascript:
m_lexer = SCLEX_CPP;
break;

default:
m_lexer = SCLEX_CPP;
break;
}
m_textEditSource->setLexer(m_lexer);
#endif
m_textEditSource->clearDocumentStyle();
m_textEditSource->setZoom(m_fontsize);
m_themelast = "1234";
Expand Down
9 changes: 0 additions & 9 deletions gui/fileviewer.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
#define FILEVIEWER_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif

#include "sqlquery.h"
Q_DECLARE_METATYPE(sqlqueryresultlist*)

Expand Down Expand Up @@ -75,11 +70,7 @@ QListWidget *m_listWidgetFunc;
QComboBox *m_comboBoxFuncListSort;
QString m_externalEditorPath;
QFont m_textEditSourceFont;
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
void *m_lexer;
#else
int m_lexer;
#endif
int m_fontsize;
QString m_theme;

Expand Down
5 changes: 0 additions & 5 deletions gui/fileviewsettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
#define FILEVIEWSETTINGSDIALOG_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif


namespace Ui {
class fileViewSettingsDialog;
Expand Down
5 changes: 0 additions & 5 deletions gui/graphdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
#define GRAPHDIALOG_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif


namespace Ui {
class DialogGraph;
Expand Down
4 changes: 0 additions & 4 deletions gui/listhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
#define LISTHANDLER_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif

#include "sqlquery.h"

Expand Down
5 changes: 0 additions & 5 deletions gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,9 @@ void mainwindow::readSettings()
//m_fileviewer->m_textEditSourceFont.setPixelSize(settings.value("FileViewerFontSize", 12).toInt());
m_fileviewer->m_fontsize = settings.value("FileViewerFontSize", 0).toInt();
m_fileviewer->m_textEditSource->setZoom(m_fileviewer->m_fontsize);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
m_fileviewer->m_textEditSourceFont.setFamily(m_fileviewer->checkFontFamily(
settings.value("FileViewerFontType",
QFontDatabase::systemFont(QFontDatabase::FixedFont).family()).toString()));
#else
m_fileviewer->m_textEditSourceFont.setFamily(m_fileviewer->checkFontFamily(
settings.value("FileViewerFontType", "Consolas").toString()));
#endif
m_fileviewer->m_textEditSource->setFont(m_fileviewer->m_textEditSourceFont);
m_fileviewer->m_textEditSource->setTabWidth(settings.value("FileViewerTabWidth", 4).toInt());
m_fileviewer->m_theme = (settings.value("FileViewerTheme", "Eclipse Default").toString());
Expand Down
5 changes: 0 additions & 5 deletions gui/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@
#define MAINWINDOW_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif


namespace Ui {
class MainWindow;
Expand Down
3 changes: 0 additions & 3 deletions gui/searchhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
#include <QPair>
#include "graphdialog.h"
#include "searchhandler.h"

#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtConcurrent/QtConcurrent>
#endif

sqlquery* searchhandler::sq = NULL;
bool searchhandler::m_grepExactMatch = false;
Expand Down
4 changes: 0 additions & 4 deletions gui/searchhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
#define SEARCHHANDLER_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#include <QRegExp>
#else
#include <QtGui>
#endif

#include "sqlquery.h"

Expand Down
10 changes: 2 additions & 8 deletions gui/themes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
#include "fileviewer.h"
#include "themes.h"

#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#define QT45_TOASCII(x) toLatin1(x)
#else
#define QT45_TOASCII(x) toAscii(x)
#endif

typedef struct
{
const char *themename;
Expand Down Expand Up @@ -252,7 +246,7 @@ void themes::setTheme(const QString& theme, int lang, ScintillaEdit* lexer, cons
deffgcolor = QC2SC(QColor(QString("#").append(QString(lngstyle[i].defaultfgcolor))));
lexer->styleSetBack( STYLE_DEFAULT, defbgcolor);
lexer->styleSetFore( STYLE_DEFAULT, deffgcolor);
lexer->styleSetFont( STYLE_DEFAULT, font1.family().QT45_TOASCII().data());
lexer->styleSetFont( STYLE_DEFAULT, font1.family().toLatin1().data());
lexer->styleSetBold( STYLE_DEFAULT, false);
lexer->styleSetItalic(STYLE_DEFAULT, false);
lexer->styleClearAll();
Expand All @@ -279,7 +273,7 @@ void themes::setThemeStyle(ScintillaEdit* lexer, lexstyle *lxstyle, int lxstyles
continue;
lexer->styleSetBack(lxstyle[i].styleid, QC2SC(QColor(QString("#").append(QString(lxstyle[i].bgcolor)))));
lexer->styleSetFore(lxstyle[i].styleid, QC2SC(QColor(QString("#").append(QString(lxstyle[i].fgcolor)))));
lexer->styleSetFont(lxstyle[i].styleid, font1.family().QT45_TOASCII().data());
lexer->styleSetFont(lxstyle[i].styleid, font1.family().toLatin1().data());
switch(lxstyle[i].fontstyle)
{
case 1:
Expand Down
4 changes: 0 additions & 4 deletions gui/themes.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@
#define THEMES_H_CQ

#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 9, 0))
#include <QtWidgets>
#else
#include <QtGui>
#endif

class ScintillaEdit;

Expand Down

0 comments on commit 11f1701

Please sign in to comment.