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);
{
ui->setupUi(this);
setLabel(name());
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->filterInput->setClearButtonEnabled(true);
-#endif
}
DynamicModelTab::~DynamicModelTab()
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);
void HostTab::saveChanges()
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
if(!model->isDirty())
return;
-#endif
if (model->submitAll())
return;
{
ui->setupUi(this);
setLabel(name());
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->filterInput->setClearButtonEnabled(true);
-#endif
}
MyListTab::~MyListTab()
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);
void PathMappingTab::saveChanges()
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
if(!model->isDirty())
return;
-#endif
if (model->submitAll())
return;
{
ui->setupUi(this);
m_label = name();
-#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
ui->input->setClearButtonEnabled(true);
-#endif
}
SearchTab::~SearchTab()
void WatchedDirectoriesTab::saveChanges()
{
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
if(!model->isDirty())
return;
-#endif
if (model->submitAll())
return;
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())
{
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();
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();
{
emit configChanged();
}
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
else if (name == "anime_update")
{
int id = payload.toInt();
if (id && id == LocalMyList::instance()->hostId())
emit watchedDirectoriesChanged();
}
-#endif
}
void Database::startPingTimer()
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();
* 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
{
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
#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"
#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 {