diff --git a/CMakeLists.txt b/CMakeLists.txt index 150e7524..d1b95a44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.12 FATAL_ERROR) +cmake_minimum_required(VERSION 3.24 FATAL_ERROR) project(MoleQueue) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -# Request C++11 standard, using new CMake variables. -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_EXTENSIONS False) # Set symbol visibility defaults for all targets. diff --git a/molequeue/app/CMakeLists.txt b/molequeue/app/CMakeLists.txt index 4d092096..6c486875 100644 --- a/molequeue/app/CMakeLists.txt +++ b/molequeue/app/CMakeLists.txt @@ -1,11 +1,11 @@ -set(_qt_packages Core Widgets Network) +set(_qt_packages Core Core5Compat Widgets Network) if(ENABLE_TESTING) list(APPEND _qt_packages Test) endif() if(MoleQueue_USE_EZHPC_UIT) list(APPEND _qt_packages XmlPatterns) endif() -find_package(Qt5 REQUIRED COMPONENTS ${_qt_packages}) +find_package(Qt6 REQUIRED COMPONENTS ${_qt_packages}) # Provide some simple API to find the plugins, scripts, etc. if(APPLE) @@ -15,7 +15,7 @@ else() set(MoleQueue_LIB_DIR "${INSTALL_LIBRARY_DIR}") endif() -find_package(Python QUIET COMPONENTS Interpreter) +find_package(Python3 QUIET COMPONENTS Interpreter) include(GenerateExportHeader) @@ -166,16 +166,16 @@ if(WIN32) list(APPEND mq_srcs puttycommand.cpp) endif() -qt5_wrap_ui(ui_srcs ${ui_files}) +qt6_wrap_ui(ui_srcs ${ui_files}) -qt5_add_resources(rcc_srcs queuetray.qrc) +qt6_add_resources(rcc_srcs queuetray.qrc) add_library(molequeue_static STATIC ${mq_srcs} ${ui_srcs}) set_target_properties(molequeue_static PROPERTIES AUTOMOC TRUE) -target_link_libraries(molequeue_static MoleQueueServerCore Qt5::Core Qt5::Widgets Qt5::Network) +target_link_libraries(molequeue_static MoleQueueServerCore Qt6::Core Qt6::Core5Compat Qt6::Widgets Qt6::Network) if(MoleQueue_USE_EZHPC_UIT) - target_link_libraries(molequeue_static KDSoap::kdsoap Qt5::XmlPatterns) + target_link_libraries(molequeue_static KDSoap::kdsoap Qt6::XmlPatterns) endif() if(MoleQueue_BUILD_CLIENT) @@ -195,9 +195,9 @@ elseif(WIN32) endif() add_executable(molequeue WIN32 MACOSX_BUNDLE ${sources} ${rcc_srcs}) -target_link_libraries(molequeue molequeue_static Qt5::Core Qt5::Widgets Qt5::Network) +target_link_libraries(molequeue molequeue_static Qt6::Core Qt6::Widgets Qt6::Network) if(WIN32) - target_link_libraries(molequeue Qt5::WinMain) + target_link_libraries(molequeue Qt6::EntryPointPrivate) endif() if(APPLE) set_target_properties(molequeue PROPERTIES diff --git a/molequeue/app/addqueuedialog.cpp b/molequeue/app/addqueuedialog.cpp index 08e1be9b..643ed73e 100644 --- a/molequeue/app/addqueuedialog.cpp +++ b/molequeue/app/addqueuedialog.cpp @@ -21,7 +21,7 @@ #include "queuemanager.h" #include -#include +#include namespace MoleQueue { @@ -38,8 +38,8 @@ AddQueueDialog::AddQueueDialog(QueueManager *queueManager, // Restrict queue names to alphanumeric strings with internal whitespace // (the input is trimmed() in accept()). - ui->nameLineEdit->setValidator(new QRegExpValidator( - QRegExp(VALID_NAME_REG_EXP))); + ui->nameLineEdit->setValidator(new QRegularExpressionValidator( + QRegularExpression(VALID_NAME_REG_EXP))); } AddQueueDialog::~AddQueueDialog() diff --git a/molequeue/app/filebrowsewidget.cpp b/molequeue/app/filebrowsewidget.cpp index afbe79af..c7a30ea4 100644 --- a/molequeue/app/filebrowsewidget.cpp +++ b/molequeue/app/filebrowsewidget.cpp @@ -18,14 +18,14 @@ #include #include -#include +#include #include #include #include #include #include -#include +#include namespace MoleQueue { @@ -173,15 +173,14 @@ QString FileBrowseWidget::searchSystemPathForFile(const QString &exec) if (!env.contains("PATH")) return result; - static QRegExp pathSplitter = QRegExp( + static const QChar pathSplitter = #ifdef Q_OS_WIN32 - ";" + QLatin1Char(';'); #else // WIN32 - ":" + QLatin1Char(':'); #endif// WIN32 - ); QStringList paths = - env.value("PATH").split(pathSplitter, QString::SkipEmptyParts); + env.value("PATH").split(pathSplitter, Qt::SkipEmptyParts); foreach (const QString &path, paths) { QFileInfo info(path + "/" + exec); diff --git a/molequeue/app/importqueuedialog.cpp b/molequeue/app/importqueuedialog.cpp index 6c1d68ac..1d72254f 100644 --- a/molequeue/app/importqueuedialog.cpp +++ b/molequeue/app/importqueuedialog.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include @@ -43,8 +43,8 @@ ImportQueueDialog::ImportQueueDialog(QueueManager *queueManager, QWidget *parent // Restrict queue names to alphanumeric strings with internal whitespace // (the input is trimmed() in accept()). - ui->nameEdit->setValidator(new QRegExpValidator( - QRegExp(VALID_NAME_REG_EXP))); + ui->nameEdit->setValidator(new QRegularExpressionValidator( + QRegularExpression(VALID_NAME_REG_EXP))); } ImportQueueDialog::~ImportQueueDialog() diff --git a/molequeue/app/jobactionfactories/killjobactionfactory.cpp b/molequeue/app/jobactionfactories/killjobactionfactory.cpp index 989cdc7a..26a3695f 100644 --- a/molequeue/app/jobactionfactories/killjobactionfactory.cpp +++ b/molequeue/app/jobactionfactories/killjobactionfactory.cpp @@ -21,7 +21,7 @@ #include "../queuemanager.h" #include "../server.h" -#include +#include #include Q_DECLARE_METATYPE(QList) diff --git a/molequeue/app/jobactionfactories/opendirectoryactionfactory.cpp b/molequeue/app/jobactionfactories/opendirectoryactionfactory.cpp index 8b66884e..ecdbb243 100644 --- a/molequeue/app/jobactionfactories/opendirectoryactionfactory.cpp +++ b/molequeue/app/jobactionfactories/opendirectoryactionfactory.cpp @@ -18,7 +18,7 @@ #include "../job.h" -#include +#include #include #include diff --git a/molequeue/app/jobactionfactories/openwithactionfactory.cpp b/molequeue/app/jobactionfactories/openwithactionfactory.cpp index bda7f513..77c12234 100644 --- a/molequeue/app/jobactionfactories/openwithactionfactory.cpp +++ b/molequeue/app/jobactionfactories/openwithactionfactory.cpp @@ -25,7 +25,7 @@ #include "../queuemanager.h" #include "../server.h" -#include +#include #include #include #include @@ -269,7 +269,7 @@ void OpenWithActionFactory::readSettings(QSettings &settings) int numPatterns = settings.beginReadArray("patterns"); for (int i = 0; i < numPatterns; ++i) { settings.setArrayIndex(i); - m_filePatterns << settings.value("regexp").toRegExp(); + m_filePatterns << settings.value("regexp").value(); } settings.endArray(); } diff --git a/molequeue/app/jobactionfactories/openwithactionfactory.h b/molequeue/app/jobactionfactories/openwithactionfactory.h index 46ab99e0..17cb900c 100644 --- a/molequeue/app/jobactionfactories/openwithactionfactory.h +++ b/molequeue/app/jobactionfactories/openwithactionfactory.h @@ -21,6 +21,8 @@ #include "molequeueglobal.h" +#include + class QDir; namespace MoleQueue diff --git a/molequeue/app/jobactionfactories/removejobactionfactory.cpp b/molequeue/app/jobactionfactories/removejobactionfactory.cpp index 434763bc..59e8500c 100644 --- a/molequeue/app/jobactionfactories/removejobactionfactory.cpp +++ b/molequeue/app/jobactionfactories/removejobactionfactory.cpp @@ -20,7 +20,7 @@ #include "../jobmanager.h" #include "../server.h" -#include +#include #include Q_DECLARE_METATYPE(QList) diff --git a/molequeue/app/jobactionfactories/viewjoblogactionfactory.cpp b/molequeue/app/jobactionfactories/viewjoblogactionfactory.cpp index d4d3ced1..19d8d5e7 100644 --- a/molequeue/app/jobactionfactories/viewjoblogactionfactory.cpp +++ b/molequeue/app/jobactionfactories/viewjoblogactionfactory.cpp @@ -19,7 +19,7 @@ #include "logwindow.h" #include "job.h" -#include +#include Q_DECLARE_METATYPE(QList) diff --git a/molequeue/app/jobtableproxymodel.cpp b/molequeue/app/jobtableproxymodel.cpp index e0aceac7..d8406eb8 100644 --- a/molequeue/app/jobtableproxymodel.cpp +++ b/molequeue/app/jobtableproxymodel.cpp @@ -202,23 +202,23 @@ bool JobTableProxyModel::filterAcceptsRow(int sourceRow, } if (!m_filterString.isEmpty()) { - QStringList filterTerms = m_filterString.split(QRegExp("\\s+"), - QString::SkipEmptyParts); + QStringList filterTerms = m_filterString.split(QRegularExpression("\\s+"), + Qt::SkipEmptyParts); foreach (QString fullTerm, filterTerms) { bool termMatch = false; bool isNegated = false; - QStringRef term(&fullTerm); + QStringView term(fullTerm); // terms starting with '-' should not be present if (term.startsWith('-')) { isNegated = true; - term = fullTerm.midRef(1); + term = QStringView(fullTerm).mid(1); } for (int i = 0; i < static_cast(sourceModel()->columnCount()); ++i) { const QVariant disp = sourceModel()->data( sourceModel()->index(sourceRow, i), Qt::DisplayRole); - if (disp.canConvert(QVariant::String)) { + if (disp.canConvert()) { if (disp.toString().contains(term, Qt::CaseInsensitive)) { termMatch = true; break; diff --git a/molequeue/app/jobview.cpp b/molequeue/app/jobview.cpp index 71b185b8..a4686187 100644 --- a/molequeue/app/jobview.cpp +++ b/molequeue/app/jobview.cpp @@ -45,11 +45,11 @@ JobView::~JobView() void JobView::contextMenuEvent(QContextMenuEvent *e) { // list of action factories. Map to sort by usefulness - QMap factoryMap; + QMultiMap factoryMap; ActionFactoryManager *manager = ActionFactoryManager::instance(); foreach (JobActionFactory *factory, manager->factories(JobActionFactory::ContextItem)) { - factoryMap.insertMulti(factory->usefulness(), factory); + factoryMap.insert(factory->usefulness(), factory); } // Get job under cursor diff --git a/molequeue/app/logger.h b/molequeue/app/logger.h index f5a3aaf1..cf20e324 100644 --- a/molequeue/app/logger.h +++ b/molequeue/app/logger.h @@ -21,7 +21,7 @@ #include "logentry.h" -#include +#include class QFile; diff --git a/molequeue/app/logwindow.cpp b/molequeue/app/logwindow.cpp index c38b724b..d054838a 100644 --- a/molequeue/app/logwindow.cpp +++ b/molequeue/app/logwindow.cpp @@ -20,6 +20,7 @@ #include "logger.h" #include "idtypeutils.h" +#include #include #include @@ -176,7 +177,7 @@ void LogWindow::addLogEntry(const LogEntry &entry) } cur.insertText(" "); // Modify newlines to align with the hanging indent. - cur.insertText(entry.message().replace(QRegExp("\\n+"), "\n "), + cur.insertText(entry.message().replace(QRegularExpression("\\n+"), "\n "), *m_messageFormat); cur.endEditBlock(); } diff --git a/molequeue/app/mainwindow.cpp b/molequeue/app/mainwindow.cpp index cb2e948f..1b221ec4 100644 --- a/molequeue/app/mainwindow.cpp +++ b/molequeue/app/mainwindow.cpp @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include namespace MoleQueue { @@ -318,7 +318,7 @@ void MainWindow::updateJobCounts(int totalJobs, int shownJobs) m_statusHiddenJobs->setText(tr("%n job(s) are hidden by filters", "", hiddenJobs)); QPalette pal; - pal.setColor(QPalette::Foreground, Qt::darkRed); + pal.setColor(QPalette::WindowText, Qt::darkRed); m_statusHiddenJobs->setPalette(pal); m_statusHiddenJobs->show(); } diff --git a/molequeue/app/openwithmanagerdialog.cpp b/molequeue/app/openwithmanagerdialog.cpp index 9ce254da..3a3dbb04 100644 --- a/molequeue/app/openwithmanagerdialog.cpp +++ b/molequeue/app/openwithmanagerdialog.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -608,15 +608,14 @@ QString OpenWithManagerDialog::searchSystemPathForFile(const QString &exec) if (!env.contains("PATH")) return result; - static QRegExp pathSplitter = QRegExp( + static const QChar pathSplitter = #ifdef Q_OS_WIN32 - ";" + QLatin1Char(';'); #else // WIN32 - ":" + QLatin1Char(':'); #endif// WIN32 - ); QStringList paths = - env.value("PATH").split(pathSplitter, QString::SkipEmptyParts); + env.value("PATH").split(pathSplitter, Qt::SkipEmptyParts); foreach (const QString &path, paths) { QFileInfo info(QUrl::fromLocalFile(path + "/" + exec).toLocalFile()); diff --git a/molequeue/app/openwithmanagerdialog.h b/molequeue/app/openwithmanagerdialog.h index 6b3379b4..19dcfdd8 100644 --- a/molequeue/app/openwithmanagerdialog.h +++ b/molequeue/app/openwithmanagerdialog.h @@ -20,6 +20,7 @@ #include #include +#include class QAbstractButton; class QDataWidgetMapper; diff --git a/molequeue/app/openwithpatternmodel.cpp b/molequeue/app/openwithpatternmodel.cpp index 85e3024c..7b23b6f1 100644 --- a/molequeue/app/openwithpatternmodel.cpp +++ b/molequeue/app/openwithpatternmodel.cpp @@ -16,7 +16,7 @@ #include "openwithpatternmodel.h" -#include +#include namespace MoleQueue { @@ -120,7 +120,7 @@ bool OpenWithPatternModel::setData(const QModelIndex &ind, QRegExp ®exp = (*m_regexps)[ind.row()]; if (role == Qt::CheckStateRole) { - if (value.canConvert(QVariant::Int)) { + if (value.canConvert()) { Qt::CheckState state = static_cast(value.toInt()); if (ind.column() == CaseSensitivityCol) { regexp.setCaseSensitivity(state == Qt::Checked ? Qt::CaseSensitive @@ -129,7 +129,7 @@ bool OpenWithPatternModel::setData(const QModelIndex &ind, return true; } } - if (value.canConvert(QVariant::Bool)) { + if (value.canConvert()) { if (ind.column() == CaseSensitivityCol) { regexp.setCaseSensitivity(value.toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive); @@ -144,7 +144,7 @@ bool OpenWithPatternModel::setData(const QModelIndex &ind, switch (static_cast(ind.column())) { case PatternCol: - if (value.canConvert(QVariant::String)) { + if (value.canConvert()) { regexp.setPattern(value.toString()); emit dataChanged(ind, ind); return true; @@ -154,7 +154,7 @@ bool OpenWithPatternModel::setData(const QModelIndex &ind, } case PatternTypeCol: - if (value.type() == QVariant::String) { + if (value.typeId() == QMetaType::QString) { QString str = value.toString().simplified(); if (!str.isEmpty()) { QChar firstChar = str.at(0).toLower(); @@ -187,7 +187,7 @@ bool OpenWithPatternModel::setData(const QModelIndex &ind, return false; case CaseSensitivityCol: - if (value.canConvert(QVariant::Bool)) { + if (value.canConvert()) { regexp.setCaseSensitivity(value.toBool() ? Qt::CaseSensitive : Qt::CaseInsensitive); emit dataChanged(ind, ind); diff --git a/molequeue/app/openwithpatternmodel.h b/molequeue/app/openwithpatternmodel.h index 34443d88..323bc40c 100644 --- a/molequeue/app/openwithpatternmodel.h +++ b/molequeue/app/openwithpatternmodel.h @@ -18,7 +18,7 @@ #define MOLEQUEUE_OPENWITHPATTERNMODEL_H #include -#include +#include #include namespace MoleQueue { diff --git a/molequeue/app/programconfiguredialog.cpp b/molequeue/app/programconfiguredialog.cpp index 1df0e8e0..b9df1416 100644 --- a/molequeue/app/programconfiguredialog.cpp +++ b/molequeue/app/programconfiguredialog.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include @@ -86,8 +86,8 @@ ProgramConfigureDialog::ProgramConfigureDialog(Program *program, launchSyntaxChanged(ui->combo_syntax->currentIndex()); - ui->edit_name->setValidator(new QRegExpValidator( - QRegExp(VALID_NAME_REG_EXP))); + ui->edit_name->setValidator(new QRegularExpressionValidator( + QRegularExpression(VALID_NAME_REG_EXP))); setDirty(false); } diff --git a/molequeue/app/queue.cpp b/molequeue/app/queue.cpp index 5639cf16..0177856a 100644 --- a/molequeue/app/queue.cpp +++ b/molequeue/app/queue.cpp @@ -32,6 +32,7 @@ #include #include +#include namespace MoleQueue { diff --git a/molequeue/app/queuemanagerdialog.cpp b/molequeue/app/queuemanagerdialog.cpp index 694d1073..3c626d9b 100644 --- a/molequeue/app/queuemanagerdialog.cpp +++ b/molequeue/app/queuemanagerdialog.cpp @@ -24,6 +24,8 @@ #include #include +#include + #include "queue.h" #include "logger.h" #include "mainwindow.h" @@ -206,7 +208,7 @@ QList QueueManagerDialog::getSelectedRows() rows << ind.row(); } - qSort(rows); + std::sort(rows.begin(), rows.end()); return rows; } diff --git a/molequeue/app/queues/local.cpp b/molequeue/app/queues/local.cpp index 082d94b5..5ec55aa7 100644 --- a/molequeue/app/queues/local.cpp +++ b/molequeue/app/queues/local.cpp @@ -195,12 +195,7 @@ void QueueLocal::processStarted() if (moleQueueId == 0) return; - IdType queueId; -#ifdef _WIN32 - queueId = static_cast(process->pid()->dwProcessId); -#else // WIN32 - queueId = static_cast(process->pid()); -#endif // WIN32 + IdType queueId = static_cast(process->processId()); // Get pointer to jobmanager to lookup job if (!m_server) { diff --git a/molequeue/app/queues/oar.cpp b/molequeue/app/queues/oar.cpp index ca109d87..44b2f69d 100644 --- a/molequeue/app/queues/oar.cpp +++ b/molequeue/app/queues/oar.cpp @@ -20,6 +20,7 @@ #include #include +#include namespace MoleQueue { diff --git a/molequeue/app/queues/pbs.cpp b/molequeue/app/queues/pbs.cpp index a091a02c..e0d230bc 100644 --- a/molequeue/app/queues/pbs.cpp +++ b/molequeue/app/queues/pbs.cpp @@ -19,6 +19,7 @@ #include "logger.h" #include +#include namespace MoleQueue { diff --git a/molequeue/app/queues/remote.cpp b/molequeue/app/queues/remote.cpp index 610dd3a3..be7bf87c 100644 --- a/molequeue/app/queues/remote.cpp +++ b/molequeue/app/queues/remote.cpp @@ -29,6 +29,8 @@ #include #include +#include +#include #include @@ -122,7 +124,7 @@ void QueueRemote::replaceKeywords(QString &launchScript, } // Otherwise, erase all lines containing the keyword else { - QRegExp expr("\\n[^\\n]*\\${3,3}maxWallTime\\${3,3}[^\\n]*\\n"); + QRegularExpression expr("\\n[^\\n]*\\${3,3}maxWallTime\\${3,3}[^\\n]*\\n"); launchScript.replace(expr, "\n"); } diff --git a/molequeue/app/queues/remotessh.cpp b/molequeue/app/queues/remotessh.cpp index 7f10d30b..80e29c67 100644 --- a/molequeue/app/queues/remotessh.cpp +++ b/molequeue/app/queues/remotessh.cpp @@ -353,7 +353,7 @@ void QueueRemoteSsh::handleQueueUpdate() return; } - QStringList output = conn->output().split("\n", QString::SkipEmptyParts); + QStringList output = conn->output().split("\n", Qt::SkipEmptyParts); // Get list of submitted queue ids so that we detect when jobs have left // the queue. diff --git a/molequeue/app/queues/sge.cpp b/molequeue/app/queues/sge.cpp index 52d7a54f..5eb2330b 100644 --- a/molequeue/app/queues/sge.cpp +++ b/molequeue/app/queues/sge.cpp @@ -19,6 +19,7 @@ #include "logger.h" #include +#include namespace MoleQueue { diff --git a/molequeue/app/queues/slurm.cpp b/molequeue/app/queues/slurm.cpp index 64aef88b..f7d84447 100644 --- a/molequeue/app/queues/slurm.cpp +++ b/molequeue/app/queues/slurm.cpp @@ -20,6 +20,7 @@ #include #include +#include namespace MoleQueue { diff --git a/molequeue/app/queuesettingsdialog.cpp b/molequeue/app/queuesettingsdialog.cpp index 8b213adc..6658406c 100644 --- a/molequeue/app/queuesettingsdialog.cpp +++ b/molequeue/app/queuesettingsdialog.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include @@ -86,8 +86,8 @@ QueueSettingsDialog::QueueSettingsDialog(Queue *queue, QWidget *parentObject) connect(ui->nameLineEdit, SIGNAL(textChanged(QString)), SLOT(setDirty())); connect(ui->tabWidget, SIGNAL(currentChanged(int)), SLOT(tabChanged(int))); - ui->nameLineEdit->setValidator(new QRegExpValidator( - QRegExp(VALID_NAME_REG_EXP))); + ui->nameLineEdit->setValidator(new QRegularExpressionValidator( + QRegularExpression(VALID_NAME_REG_EXP))); setDirty(false); } @@ -218,7 +218,7 @@ QList QueueSettingsDialog::getSelectedRows() rows << ind.row(); } - qSort(rows); + std::sort(rows.begin(), rows.end()); return rows; } diff --git a/molequeue/app/server.cpp b/molequeue/app/server.cpp index c8e38c31..f6b00204 100644 --- a/molequeue/app/server.cpp +++ b/molequeue/app/server.cpp @@ -37,6 +37,7 @@ #include #include #include +#include namespace MoleQueue { @@ -678,8 +679,8 @@ void Server::handleRegisterOpenWithRequest(const Message &message) Message error = message.generateErrorResponse(); error.setErrorCode(1); error.setErrorMessage( - QLatin1Literal("Name conflict: An open-with handler named '") % name - % QLatin1Literal("' already exists.")); + QLatin1String("Name conflict: An open-with handler named '") % name + % QLatin1String("' already exists.")); error.send(); return; } diff --git a/molequeue/app/templatekeyworddialog.cpp b/molequeue/app/templatekeyworddialog.cpp index e8cae258..06598fff 100644 --- a/molequeue/app/templatekeyworddialog.cpp +++ b/molequeue/app/templatekeyworddialog.cpp @@ -21,6 +21,8 @@ #include #include +#include + namespace MoleQueue { TemplateKeywordDialog::TemplateKeywordDialog(QWidget *parent_) : @@ -197,7 +199,7 @@ void TemplateKeywordDialog::highlightKeywords() QTextCursor cur(doc); cur.movePosition(QTextCursor::Start); - QRegExp expr("[^\\$]?\\${2,2}[^\\$\\s]+\\${2,2}[^\\$]?"); + QRegularExpression expr("[^\\$]?\\${2,2}[^\\$\\s]+\\${2,2}[^\\$]?"); cur = doc->find(expr, cur); while (!cur.isNull()) { diff --git a/molequeue/app/terminalprocess.cpp b/molequeue/app/terminalprocess.cpp index d1c25607..2bd63649 100644 --- a/molequeue/app/terminalprocess.cpp +++ b/molequeue/app/terminalprocess.cpp @@ -25,20 +25,16 @@ namespace MoleQueue { TerminalProcess::TerminalProcess(QObject *parentObject) : QProcess(parentObject) { -} - -TerminalProcess::~TerminalProcess() -{ -} - -void TerminalProcess::setupChildProcess() -{ #ifdef Q_OS_UNIX // Become the session leader on Unix (no-op on Windows). This makes things // like SSH use GUIs to prompt for passwords (SSH_ASKPASS) as there is no // tty associated with the process. - setsid(); + setChildProcessModifier([] { setsid(); }); #endif } +TerminalProcess::~TerminalProcess() +{ +} + } // End namespace diff --git a/molequeue/app/terminalprocess.h b/molequeue/app/terminalprocess.h index 7aa23db9..7e6a95da 100644 --- a/molequeue/app/terminalprocess.h +++ b/molequeue/app/terminalprocess.h @@ -34,9 +34,6 @@ class TerminalProcess : public QProcess public: explicit TerminalProcess(QObject *parentObject = 0); ~TerminalProcess(); - -protected: - virtual void setupChildProcess(); }; } // End namespace diff --git a/molequeue/app/testing/CMakeLists.txt b/molequeue/app/testing/CMakeLists.txt index d6f67151..0426c4c5 100644 --- a/molequeue/app/testing/CMakeLists.txt +++ b/molequeue/app/testing/CMakeLists.txt @@ -8,8 +8,8 @@ set(MoleQueue_TESTDATA_DIR set(MoleQueue_TESTSCRIPT_DIR "${MoleQueue_SOURCE_DIR}/molequeue/app/testing/scripts/") set(MoleQueue_TESTEXEC_DIR "${MoleQueue_BINARY_DIR}/bin/") -if(Python_EXECUTABLE) - set(MoleQueue_PYTHON_EXECUTABLE "${Python_EXECUTABLE}") +if(Python3_EXECUTABLE) + set(MoleQueue_PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") endif() configure_file(molequeuetestconfig.h.in molequeuetestconfig.h) @@ -31,7 +31,7 @@ set(testutils_SRCS add_library(testutils STATIC ${testutils_SRCS}) set_target_properties(testutils PROPERTIES AUTOMOC TRUE) -target_link_libraries(testutils molequeue_static Qt5::Test) +target_link_libraries(testutils molequeue_static Qt6::Test) set(MyTests filespecification @@ -72,7 +72,7 @@ endif() foreach(test ${MyTests}) add_executable(${test}test MACOSX_BUNDLE ${test}test.cpp) set_target_properties(${test}test PROPERTIES AUTOMOC TRUE) - target_link_libraries(${test}test testutils Qt5::Test) + target_link_libraries(${test}test testutils Qt6::Test) add_test(NAME molequeue-${test} COMMAND ${test}test) endforeach() diff --git a/molequeue/app/testing/clienttestsrc/CMakeLists.txt b/molequeue/app/testing/clienttestsrc/CMakeLists.txt index 7377e3c9..a271befe 100644 --- a/molequeue/app/testing/clienttestsrc/CMakeLists.txt +++ b/molequeue/app/testing/clienttestsrc/CMakeLists.txt @@ -9,5 +9,5 @@ set(srcs sendRpcKill) foreach(source ${srcs}) add_executable(${source} ${source}.cpp) set_target_properties(${source} PROPERTIES AUTOMOC TRUE) - target_link_libraries(${source} MoleQueueClient Qt5::Core) + target_link_libraries(${source} MoleQueueClient Qt6::Core) endforeach() diff --git a/molequeue/app/testing/dummyqueueremote.cpp b/molequeue/app/testing/dummyqueueremote.cpp index c030ef10..57662252 100644 --- a/molequeue/app/testing/dummyqueueremote.cpp +++ b/molequeue/app/testing/dummyqueueremote.cpp @@ -16,6 +16,8 @@ #include "dummyqueueremote.h" +#include + using namespace MoleQueue; DummyQueueRemote::DummyQueueRemote(const QString &queueName, @@ -45,7 +47,7 @@ bool DummyQueueRemote::parseQueueLine(const QString &queueListOutput, IdType *queueId, JobState *state) { // Output is "[queueId] [stateAsString]" - QStringList split = queueListOutput.split(QRegExp("\\s+")); + QStringList split = queueListOutput.split(QRegularExpression("\\s+")); if (split.size() < 2) return false; diff --git a/molequeue/app/testing/dummyserver.h b/molequeue/app/testing/dummyserver.h index 47430062..6daf6e1d 100644 --- a/molequeue/app/testing/dummyserver.h +++ b/molequeue/app/testing/dummyserver.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -47,8 +48,8 @@ class DummyServer : public MoleQueue::Server QDateTime::currentDateTime().toMSecsSinceEpoch()); unsigned int seed = static_cast( (threadPtr ^ procId) ^ ((msecs << 16) ^ msecs)); - qsrand(seed); - int randVal = qrand(); + QRandomGenerator gen(seed); + int randVal = gen.bounded(std::numeric_limits::max()); return QString("MoleQueue-testing-%1").arg(QString::number(randVal)); } diff --git a/molequeue/app/testing/queuemanagertest.cpp b/molequeue/app/testing/queuemanagertest.cpp index 85040d28..cdce83c3 100644 --- a/molequeue/app/testing/queuemanagertest.cpp +++ b/molequeue/app/testing/queuemanagertest.cpp @@ -103,7 +103,7 @@ void QueueManagerTest::testToQueueList() { MoleQueue::QueueListType list = m_queueManager.toQueueList(); QStringList queueNames = list.keys(); - qSort(queueNames); + std::sort(queueNames.begin(), queueNames.end()); QCOMPARE(queueNames.size(), 2); QCOMPARE(queueNames[0], QString("First Queue")); QCOMPARE(queueNames[1], QString("Second Queue")); diff --git a/molequeue/app/testing/queueremotetest.cpp b/molequeue/app/testing/queueremotetest.cpp index 332e47e7..0936e640 100644 --- a/molequeue/app/testing/queueremotetest.cpp +++ b/molequeue/app/testing/queueremotetest.cpp @@ -27,6 +27,7 @@ #include #include +#include using namespace MoleQueue; diff --git a/molequeue/app/testing/queuetest.cpp b/molequeue/app/testing/queuetest.cpp index c9f73dd3..1ce95f1b 100644 --- a/molequeue/app/testing/queuetest.cpp +++ b/molequeue/app/testing/queuetest.cpp @@ -114,7 +114,7 @@ void QueueTest::testNumPrograms() void QueueTest::testProgramNames() { QStringList programNames = m_queue.programNames(); - qSort(programNames); + std::sort(programNames.begin(), programNames.end()); QCOMPARE(programNames.size(), 2); QCOMPARE(programNames[0], QString("First Program")); QCOMPARE(programNames[1], QString("Second Program")); diff --git a/molequeue/app/testing/testserver.h b/molequeue/app/testing/testserver.h index 30acac8e..eaeb868a 100644 --- a/molequeue/app/testing/testserver.h +++ b/molequeue/app/testing/testserver.h @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -88,8 +89,8 @@ class TestServer : public QObject unsigned int seed = static_cast( (threadPtr ^ procId) ^ ((msecs << 16) ^ msecs)); qDebug() << "Seed:" << seed; - qsrand(seed); - int randVal = qrand(); + QRandomGenerator gen(seed); + int randVal = gen.bounded(std::numeric_limits::max()); return QString("MoleQueue-testing-%1").arg(QString::number(randVal)); } diff --git a/molequeue/app/testing/xmlutils.cpp b/molequeue/app/testing/xmlutils.cpp index b4c113ad..5d4e5bef 100644 --- a/molequeue/app/testing/xmlutils.cpp +++ b/molequeue/app/testing/xmlutils.cpp @@ -16,12 +16,12 @@ #include "xmlutils.h" -#include +#include QString & XmlUtils::stripWhitespace(QString &xml) { - QRegExp whiteSpace(">\\s*<"); + QRegularExpression whiteSpace(">\\s*<"); return xml.replace(whiteSpace, "><"); } diff --git a/molequeue/client/CMakeLists.txt b/molequeue/client/CMakeLists.txt index c614aea7..e7706e0d 100644 --- a/molequeue/client/CMakeLists.txt +++ b/molequeue/client/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Qt5 COMPONENTS Network REQUIRED) +find_package(Qt6 COMPONENTS Core5Compat Network REQUIRED) set(sources client.cpp @@ -15,7 +15,7 @@ set(headers include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_library(MoleQueueClient ${sources}) -target_link_libraries(MoleQueueClient Qt5::Network) +target_link_libraries(MoleQueueClient Qt6::Core5Compat Qt6::Network) set_target_properties(MoleQueueClient PROPERTIES AUTOMOC TRUE) include(GenerateExportHeader) generate_export_header(MoleQueueClient EXPORT_FILE_NAME molequeueclientexport.h) diff --git a/molequeue/client/client.cpp b/molequeue/client/client.cpp index c1c3b291..7d54a703 100644 --- a/molequeue/client/client.cpp +++ b/molequeue/client/client.cpp @@ -20,6 +20,7 @@ #include "jobobject.h" #include +#include namespace MoleQueue { diff --git a/molequeue/client/client.h b/molequeue/client/client.h index 109e9c96..79f4d7ec 100644 --- a/molequeue/client/client.h +++ b/molequeue/client/client.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace MoleQueue diff --git a/molequeue/lastinstall/CMakeLists.txt b/molequeue/lastinstall/CMakeLists.txt index 1c632bef..c9f3779f 100644 --- a/molequeue/lastinstall/CMakeLists.txt +++ b/molequeue/lastinstall/CMakeLists.txt @@ -1,4 +1,7 @@ -if((APPLE OR WIN32) AND NOT ${CMAKE_VERSION} VERSION_LESS 2.8.8) +option(MoleQueue_USE_BUNDLE_DEPLOY + "Bundle Qt and plugins into the install tree (Qt5-only, pre-1.0)" OFF) + +if(MoleQueue_USE_BUNDLE_DEPLOY AND (APPLE OR WIN32)) find_package(Qt5 COMPONENTS Core REQUIRED) set(pfx "") if(NOT APPLE) diff --git a/molequeue/plugins/CMakeLists.txt b/molequeue/plugins/CMakeLists.txt index f3f3e80d..8c5e35b6 100644 --- a/molequeue/plugins/CMakeLists.txt +++ b/molequeue/plugins/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Qt5 COMPONENTS Network REQUIRED) +find_package(Qt6 COMPONENTS Network REQUIRED) if (MSVC) # Do not generate manifests for the plugins - caused issues loading plugins diff --git a/molequeue/plugins/localsocketserver/CMakeLists.txt b/molequeue/plugins/localsocketserver/CMakeLists.txt index 80018c36..82c59cad 100644 --- a/molequeue/plugins/localsocketserver/CMakeLists.txt +++ b/molequeue/plugins/localsocketserver/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY add_library(LocalSocketServer MODULE localsocketconnectionlistenerfactory.cpp) set_target_properties(LocalSocketServer PROPERTIES AUTOMOC TRUE PREFIX "") -target_link_libraries(LocalSocketServer MoleQueueServerCore Qt5::Network) +target_link_libraries(LocalSocketServer MoleQueueServerCore Qt6::Network) set_property(GLOBAL APPEND PROPERTY MoleQueue_PLUGINS LocalSocketServer) diff --git a/molequeue/servercore/CMakeLists.txt b/molequeue/servercore/CMakeLists.txt index eee1bfd6..978967e2 100644 --- a/molequeue/servercore/CMakeLists.txt +++ b/molequeue/servercore/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Qt5 COMPONENTS Network REQUIRED) +find_package(Qt6 COMPONENTS Network REQUIRED) include(GenerateExportHeader) @@ -12,7 +12,7 @@ add_library(MoleQueueServerCore messageidmanager_p.cpp ) -target_link_libraries(MoleQueueServerCore Qt5::Network) +target_link_libraries(MoleQueueServerCore Qt6::Network) set_target_properties(MoleQueueServerCore PROPERTIES AUTOMOC TRUE) #target_link_libraries(MoleQueueServerCore)