]> Some of my projects - localmylist.git/commitdiff
Cleanup old Qt version checks
authorAPTX <redacted>
Tue, 3 Mar 2026 00:43:11 +0000 (09:43 +0900)
committerAPTX <redacted>
Sat, 7 Mar 2026 03:43:55 +0000 (12:43 +0900)
12 files changed:
localmylist-management/qtsingleapplication/qtlocalpeer.cpp
localmylist-management/tabs/dynamicmodeltab.cpp
localmylist-management/tabs/hosttab.cpp
localmylist-management/tabs/mylisttab.cpp
localmylist-management/tabs/pathmappingtab.cpp
localmylist-management/tabs/searchtab.cpp
localmylist-management/tabs/watcheddirectoriestab.cpp
localmylist/database.cpp
localmylist/database.h
localmylist/messagehandler.cpp
localmylist/sqlasyncquery.h
localmylist/sqlasyncqueryinternal.h

index c81f2c68e8bef30e120393dfbbfb833dfbc66c21..ba7b859890a87cd8828b500122fec4c5a55ea73b 100644 (file)
@@ -120,7 +120,7 @@ bool QtLocalPeer::isClient()
                return true;
 
        bool res = server->listen(socketName);
-#if defined(Q_OS_UNIX) && (QT_VERSION >= QT_VERSION_CHECK(4,5,0))
+#if defined(Q_OS_UNIX)
        // ### Workaround
        if (!res && server->serverError() == QAbstractSocket::AddressInUseError) {
                QFile::remove(QDir::cleanPath(QDir::tempPath())+QLatin1Char('/')+socketName);
index 9ff9512423a03b365b3f418f51ae142ade06d8d4..90e9596e48025d2a5144d15bb86be59487c00f5e 100644 (file)
@@ -28,9 +28,7 @@ DynamicModelTab::DynamicModelTab(QWidget *parent) :
 {
        ui->setupUi(this);
        setLabel(name());
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
        ui->filterInput->setClearButtonEnabled(true);
-#endif
 }
 
 DynamicModelTab::~DynamicModelTab()
@@ -81,11 +79,7 @@ void DynamicModelTab::init()
        ui->myListView->setSelectionBehavior(QAbstractItemView::SelectRows);
        ui->myListView->setSelectionMode(QAbstractItemView::ExtendedSelection);
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        ui->myListView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
-#else
-       ui->myListView->header()->setResizeMode(0, QHeaderView::Stretch);
-#endif
        ui->myListView->header()->setStretchLastSection(false);
        ui->myListView->header()->resizeSection(4, 200);
 
index a1918b0257a89e3462962f83a292b90023079d60..b0ed8350feb8e854a780cc2b1eacae0e02bf326c 100644 (file)
@@ -66,10 +66,8 @@ void HostTab::addEntry()
 
 void HostTab::saveChanges()
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        if(!model->isDirty())
                return;
-#endif
 
        if (model->submitAll())
                return;
index fb29b025836977e50cb7c3337fe8b23fff208cc1..1311ebf0c24450803b5cee69e4bf44dde02769f8 100644 (file)
@@ -23,9 +23,7 @@ MyListTab::MyListTab(QWidget *parent) :
 {
        ui->setupUi(this);
        setLabel(name());
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
        ui->filterInput->setClearButtonEnabled(true);
-#endif
 }
 
 MyListTab::~MyListTab()
@@ -49,11 +47,7 @@ void MyListTab::init()
        myListFilterModel->setSourceModel(myListModel());
        ui->myListView->setModel(myListFilterModel);
        ui->myListView->setItemDelegate(new MyListItemDelegate(ui->myListView));
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        ui->myListView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
-#else
-       ui->myListView->header()->setResizeMode(0, QHeaderView::Stretch);
-#endif
        ui->myListView->header()->setStretchLastSection(false);
        ui->myListView->header()->resizeSection(4, 200);
 
index 243bbc1b3842aa57574907072e3d80a9dc86e606..bea1a12b75dbdfd13f734803c4d093d0011d54c2 100644 (file)
@@ -78,10 +78,8 @@ void PathMappingTab::addEntry()
 
 void PathMappingTab::saveChanges()
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        if(!model->isDirty())
                return;
-#endif
 
        if (model->submitAll())
                return;
index 45d86958f4e2e472f14eb331ae83eb408e08403c..b6a4ce1d0738dbc1ddf837afdaa78605fdac853d 100644 (file)
@@ -14,9 +14,7 @@ SearchTab::SearchTab(QWidget *parent) :
 {
        ui->setupUi(this);
        m_label = name();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
        ui->input->setClearButtonEnabled(true);
-#endif
 }
 
 SearchTab::~SearchTab()
index 72c2721355ebcd1d15ded684796c105e458cd035..c2525d3610cafb1e2881084dc26604fabe1902dc 100644 (file)
@@ -70,10 +70,8 @@ void WatchedDirectoriesTab::addEntry()
 
 void WatchedDirectoriesTab::saveChanges()
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        if(!model->isDirty())
                return;
-#endif
 
        if (model->submitAll())
                return;
index 0f8ce73c1d8697c788003f4adf01a36adb8e3970..1bd819e7e6327ea79f1ad1b897687ea32cf3e075 100644 (file)
@@ -1819,13 +1819,8 @@ bool Database::connect()
                d = new DatabaseInternal();
                d->db = QSqlDatabase::addDatabase("QPSQL", connectionName);
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
                QObject::connect(d->db.driver(), SIGNAL(notification(QString,QSqlDriver::NotificationSource,QVariant)),
                                         this, SLOT(handleNotification(QString,QSqlDriver::NotificationSource,QVariant)));
-#else
-               QObject::connect(d->db.driver(), SIGNAL(notification(QString)),
-                                        this, SLOT(handleNotification(QString)));
-#endif
        }
        else if (d->db.isOpen())
        {
@@ -1852,12 +1847,6 @@ bool Database::connect()
                return success;
        }
 
-
-// Workaround for https://bugreports.qt-project.org/browse/QTBUG-30076
-#if QT_VERSION <= QT_VERSION_CHECK(4, 8, 4) || (QT_VERSION > QT_VERSION_CHECK(5, 0, 0) && QT_VERSION <= QT_VERSION_CHECK(5, 0, 2))
-       exec("SET standard_conforming_strings = 'off'");
-#endif
-
        // If the previous connection was terminated in an unusual way, the DB
        // driver will not delete its subscriptions and refuse to subscribe again.
        unsubscribeFromNotifications();
@@ -2291,18 +2280,10 @@ bool Database::notifyRenameDataChanged()
        return notify("rename_data_changed");
 }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 void Database::handleNotification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload)
-#else
-void Database::handleNotification(const QString &name)
-#endif
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        Q_UNUSED(source);
        qDebug() << QString("[%1] Received notification %2, %3").arg(connectionName).arg(name).arg(payload.toString());
-#else
-       qDebug() << QString("[%1] Received notification %2").arg(connectionName).arg(name);
-#endif
        if (name == "new_pending_request")
        {
                emit newPendingRequest();
@@ -2319,7 +2300,6 @@ void Database::handleNotification(const QString &name)
        {
                emit configChanged();
        }
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        else if (name == "anime_update")
        {
                int id = payload.toInt();
@@ -2485,7 +2465,6 @@ void Database::handleNotification(const QString &name)
                if (id && id == LocalMyList::instance()->hostId())
                        emit watchedDirectoriesChanged();
        }
-#endif
 }
 
 void Database::startPingTimer()
index 5ee7dbd1c027915d5b7a7c3affb2e2248952f134..677c3095c86b9f0ba8011bdb0cbcfeb60bda91ac 100644 (file)
@@ -226,13 +226,7 @@ signals:
        void fileLocationDelete(int locationId, int fid);
 
 private slots:
-// moc doesn't expand macros
-// QT_VERSION_CHECK(5, 0, 0) == 0x050000
-#if QT_VERSION >= 0x050000
        void handleNotification(const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload);
-#else
-       void handleNotification(const QString &name);
-#endif
 
        void startPingTimer();
        void stopPingTimer();
index 78d344077f510807cd2872b8ecba4531da663725..78b9a9d1287dd2561583080a151742bed6bf343e 100644 (file)
@@ -39,7 +39,6 @@ const char *messageType2Str(QtMsgType type)
  * but for some reason it can't print a timestamp so a custom handler
  * is still required.
  */
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
 static const QtMessageHandler qtMessageHandler =
                []() -> QtMessageHandler
                {
@@ -69,34 +68,10 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
 
        MyList::signalDebugMessage(message);
 }
-#else
-void messageHandler(QtMsgType type, const char *msg)
-{
-       const char *typeStr = messageType2Str(type);
-       const QString message = QString("[%3]%2 %1").arg(
-                               msg, typeStr,
-                               QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss.zzz"));
-
-       QByteArray buf = message.toLocal8Bit();
-
-       qInstallMsgHandler(0);
-       // qt_message_output is the default message handler in Qt4.
-       // If you set your own handler it will just call that instead of
-       // actually printing the message.
-       qt_message_output(type, buf.constData());
-       qInstallMsgHandler(messageHandler);
-
-       MyList::signalDebugMessage(message);
-}
-#endif
 
 void installMessageHandler()
 {
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
        qInstallMessageHandler(messageHandler);
-#else
-       qInstallMsgHandler(messageHandler);
-#endif
 }
 
 } // namespace LocalMyList
index 2ee63638a4883c8572683cfe2f62f86b450faa0a..f222ff3f69128b925519f0912fce530bf731a54d 100644 (file)
@@ -3,11 +3,7 @@
 
 #include "localmylist_global.h"
 #include <QObject>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-#      include <QSql>
-#else
-#      include <QtSql>
-#endif
+#include <QSql>
 #include <functional>
 
 #include "sqlresultiteratorinterface.h"
index 92b67e0ef6cae3e9e741678b371c592cb2aa42a3..f095d070ee897fe19212c10c013eb5f604c0ece7 100644 (file)
@@ -2,13 +2,9 @@
 #define SQLASYNCQUERYINTERNAL_H
 
 #include "sqlasyncquery.h"
+#include <QSql>
 #include <QStringList>
 #include <QVariant>
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-#      include <QSql>
-#else
-#      include <QtSql>
-#endif
 
 namespace LocalMyList {