Drop support for Qt4

Version 2.4.0 was the last one with Qt4 support
This commit is contained in:
Christian Hohnstädt 2021-04-26 18:23:39 +02:00 committed by Christian Hohnstaedt
parent 957bdbaa72
commit d5fa97c3bb
13 changed files with 16 additions and 82 deletions

View File

@ -149,12 +149,13 @@ if test -n "${_QTDIR}" && test -d "${_QTDIR}"; then
fi
AC_ARG_WITH([qt-version],
AS_HELP_STRING([--with-qt-version], [Select the Qt version]),
AS_HELP_STRING([--with-qt-version],
[Select the Qt version: 5 or 6 if both are installed]),
[WANT_QT_VERSION="$withval"],
[WANT_QT_VERSION=detect])
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
PKG_CHECK_MODULES(Qt5, [Qt5Core >= 5.0 Qt5Widgets >= 5.0 Qt5Sql >= 5.0 Qt5Help >= 5.0], [
PKG_CHECK_MODULES(Qt5, [Qt5Core Qt5Widgets Qt5Sql Qt5Help], [
_QT_HOST_BINS="`pkg-config --variable=host_bins Qt5Core`"
QT_MOC="${_QT_HOST_BINS}/moc"
QT_UIC="${_QT_HOST_BINS}/uic"
@ -170,8 +171,8 @@ if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 5; then
],[ : ])
fi
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 4; then
PKG_CHECK_MODULES(Qt4, [QtCore >= 4.7 QtCore < 5.0 QtGui >= 4.7 QtGui < 5.0 QtSql >= 4.7 QtSql < 5.0 QtHelp < 5.0], [
if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 6; then
PKG_CHECK_MODULES(Qt6, [Qt6Core Qt6Gui Qt6Sql Qt6Help], [
QT_MOC="`pkg-config --variable=moc_location QtCore`"
QT_UIC="`pkg-config --variable=uic_location QtCore`"
if test -n "${QT_MOC}"; then
@ -179,13 +180,13 @@ if test "${WANT_QT_VERSION}" = detect -o "${WANT_QT_VERSION}" = 4; then
fi
if test "$HOST" = "DARWIN"; then
FRAMEDIR=`pkg-config --variable=libdir QtCore`
Qt4_CFLAGS="$Qt4_CFLAGS -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
Qt4_LDFLAGS=" -Xlinker -rpath -Xlinker ${FRAMEDIR}"
Qt6_CFLAGS="$Qt4_CFLAGS -F${FRAMEDIR} -I${FRAMEDIR}/QtCore.framework/Headers -I${FRAMEDIR}/QtGui.framework/Headers -I${FRAMEDIR}/QtSql.framework/Headers"
Qt6_LDFLAGS=" -Xlinker -rpath -Xlinker ${FRAMEDIR}"
fi
WANT_QT_VERSION=4
QT_VERSION=4
QT_CFLAGS="${Qt4_CFLAGS}"
QT_LIBS="${Qt4_LIBS}${Qt4_LDFLAGS}"
WANT_QT_VERSION=6
QT_VERSION=6
QT_CFLAGS="${Qt6_CFLAGS}"
QT_LIBS="${Qt6_LIBS}${Qt6_LDFLAGS}"
],[ : ])
fi

View File

@ -31,11 +31,7 @@
#define C_FILE ((strrchr(__FILE__, '/') ? : __FILE__- 1) + 1)
#define TRACE qDebug("File: %s Func: %s Line: %d", C_FILE, __func__, __LINE__);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define nativeSeparator(s) QDir::toNativeSeparators(s)
#else
#define nativeSeparator(s) QDir::convertSeparators(s)
#endif
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
#define MIN(a,b) ((a)<(b)) ? (a) : (b)

View File

@ -22,11 +22,7 @@
#if defined(Q_OS_MAC)
#include <IOKit/IOKitLib.h>
#if QT_VERSION < 0x050000
#include <QDesktopServices>
#else
#include <QStandardPaths>
#endif
#endif
#include <QDir>
#include <QFile>
@ -318,16 +314,10 @@ const QString getUserSettingsDir()
rv = portable_app() ? getPrefix() + "/settings" :
specialFolder(CSIDL_APPDATA) + "/xca";
#elif defined(Q_OS_MAC)
#if QT_VERSION < 0x050000
rv = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
rv.insert(rv.count() - QCoreApplication::applicationName().count(),
QCoreApplication::organizationName());
#else
rv = QStandardPaths::writableLocation(
QStandardPaths::GenericDataLocation) + "/data/" +
QCoreApplication::organizationName() + "/" +
QCoreApplication::applicationName();
#endif
#else
rv = QDir::homePath() + "/.xca";
#endif

View File

@ -85,15 +85,6 @@ void *d2i_bytearray(void *(*d2i)(void*, unsigned char**, long),
#define I2D_VOID(a) ((int (*)(const void *, unsigned char **))(a))
#define D2I_VOID(a) ((void *(*)(void *, unsigned char **, long))(a))
static inline QString htmlEscape(const QString &html)
{
#if QT_VERSION < 0x050000
return Qt::escape(html);
#else
return html.toHtmlEscaped();
#endif
}
QString appendXcaComment(QString current, QString msg);
/* from version.cpp */

View File

@ -55,7 +55,8 @@ static void segv_handler_gui(int)
}
#endif
void myMsgOutput(QtMsgType type, const char *msg)
void myMessageOutput(QtMsgType type, const QMessageLogContext &,
const QString &msg)
{
static QElapsedTimer *t;
static int abort_on_warning = -1;
@ -83,27 +84,19 @@ void myMsgOutput(QtMsgType type, const char *msg)
case QtWarningMsg: warn_msg = "WARNING"; severity = COL_LRED "Warning"; break;
case QtCriticalMsg: warn_msg = "CRITICAL"; severity = COL_RED "Critical"; break;
case QtFatalMsg: warn_msg = "FATAL"; severity = COL_RED "Fatal"; break;
#if QT_VERSION >= 0x050000
case QtInfoMsg: severity = COL_CYAN "Info"; break;
#endif
default: severity = COL_CYAN "Default"; break;
}
console_write(stderr, QString(COL_YELL "%1%2 %3:" COL_RESET " %4\n")
.arg(el/1000, 4)
.arg((el%1000)/100, 2, 10, QChar('0'))
.arg(severity).arg(QString::fromUtf8(msg)).toUtf8());
.arg(severity).arg(msg).toUtf8());
if (abort_on_warning == 1 && warn_msg) {
qFatal("Abort on %s", warn_msg);
}
}
#if QT_VERSION >= 0x050000
void myMessageOutput(QtMsgType t, const QMessageLogContext &, const QString &m)
{
myMsgOutput(t, m.toUtf8().constData());
}
#endif
static void cmd_version(FILE *fp)
{
@ -305,11 +298,7 @@ int main(int argc, char *argv[])
puts(CCHAR(arguments::doc(xca_special)));
return 0;
}
#if QT_VERSION < 0x050000
qInstallMsgHandler(myMsgOutput);
#else
qInstallMessageHandler(myMessageOutput);
#endif
#if defined(Q_OS_WIN32)
AttachConsole(-1);

View File

@ -171,11 +171,7 @@ QSqlError XSqlQuery::lastError()
return QSqlError(QString("%1 - %2").arg(e.driverText())
.arg(query_details()),
e.databaseText(), e.type(),
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
e.nativeErrorCode()
#else
e.number()
#endif
);
}

View File

@ -30,15 +30,7 @@ Help::~Help()
void Help::display(const QUrl &url)
{
#if QT_VERSION < 0x050000
QString path = url.path();
int pos = path.lastIndexOf("/");
if (pos != -1)
path = path.mid(pos+1);
textbox->setSource(QUrl(path));
#else
textbox->setSource(QUrl(url.fileName()));
#endif
textbox->scrollToAnchor(url.fragment());
show();
raise();

View File

@ -101,8 +101,8 @@ void MainWindow::about()
QString lang(QLocale::languageToString(QLocale(sl[0]).language()));
QStringList row {
QString("<b>%1</b>").arg(lang),
htmlEscape(sl[2]),
htmlEscape(email),
sl[2].toHtmlEscaped(),
email.toHtmlEscaped(),
};
rows << tag[0] + row.join(tag[0] + tag[1]) + tag[1];
}

View File

@ -98,13 +98,8 @@ void XcaApplication::setupLanguage(QLocale l)
#endif
<< getI18nDir()
#ifndef WIN32
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
<< "/usr/local/share/qt5/translations/"
<< "/usr/share/qt5/translations/"
#else
<< "/usr/local/share/qt4/translations/"
<< "/usr/share/qt4/translations/"
#endif
<< "/usr/share/qt/translations/"
#endif
;

View File

@ -13,11 +13,7 @@
XcaHeaderView::XcaHeaderView()
:QHeaderView(Qt::Horizontal)
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
setSectionsMovable(true);
#else
setMovable(true);
#endif
}
void XcaHeaderView::contextMenuEvent(QContextMenuEvent *e)

View File

@ -41,11 +41,7 @@ XcaTreeView::XcaTreeView(QWidget *parent)
this, SLOT(resizeColumnToContents(int)));
connect(this, SIGNAL(doubleClicked(const QModelIndex &)),
this, SLOT(doubleClick(const QModelIndex &)));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
header()->setSectionsClickable(true);
#else
header()->setClickable(true);
#endif
throttle.setSingleShot(true);
connect(&throttle, SIGNAL(timeout()), this, SLOT(columnsResize()));
connect(&throttle, SIGNAL(timeout()), proxy, SLOT(invalidate()));

View File

@ -73,12 +73,8 @@ CopyLabel::CopyLabel(QWidget *parent)
{
setFrameStyle(QFrame::StyledPanel);
setTextFormat(Qt::PlainText);
#if QT_VERSION >= 0x040200
setTextInteractionFlags(
Qt::TextSelectableByMouse |
Qt::TextSelectableByKeyboard
);
#endif
}

View File

@ -168,11 +168,7 @@ kvView::kvView(QWidget *parent)
setAlternatingRowColors(true);
horizontalHeader()->setDefaultSectionSize(200);
horizontalHeader()->setStretchLastSection(true);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
verticalHeader()->setSectionsMovable(true);
#else
verticalHeader()->setMovable(true);
#endif
verticalHeader()->setDefaultSectionSize(24);
setEditTriggers(QAbstractItemView::AllEditTriggers);