From 691c2542bf6b865528f0ea8d492c9ac68d1f2b7d Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Tue, 30 Aug 2016 18:05:44 +0200 Subject: [PATCH 01/77] monitor: Add scheduler name attribute --- src/monitor.cc | 10 ++++++++++ src/monitor.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/monitor.cc b/src/monitor.cc index 697883c5..9fa340e8 100644 --- a/src/monitor.cc +++ b/src/monitor.cc @@ -39,6 +39,16 @@ void Monitor::setCurrentNetname(const QByteArray &netname) m_currentNetname = netname; } +QByteArray Monitor::currentSchedname() const +{ + return m_currentSchedname; +} + +void Monitor::setCurrentSchedname(const QByteArray &schedname) +{ + m_currentSchedname = schedname; +} + Monitor::SchedulerState Monitor::schedulerState() const { return m_schedulerState; diff --git a/src/monitor.h b/src/monitor.h index 32f7562f..4ef7c791 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -51,6 +51,9 @@ public QByteArray currentNetname() const; void setCurrentNetname(const QByteArray &); + QByteArray currentSchedname() const; + void setCurrentSchedname(const QByteArray &); + SchedulerState schedulerState() const; virtual QList jobHistory() const; @@ -70,6 +73,7 @@ public private: HostInfoManager *m_hostInfoManager; QByteArray m_currentNetname; + QByteArray m_currentSchedname; SchedulerState m_schedulerState; }; From 1d7158e65527fadf78b75566e9558134407c06ec Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Tue, 30 Aug 2016 18:06:42 +0200 Subject: [PATCH 02/77] mainwindow: Add current scheduler name setter --- src/mainwindow.cc | 9 +++++++-- src/mainwindow.h | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 6b57a8e2..3da206c4 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -354,9 +354,14 @@ void MainWindow::updateJobStats() m_jobStatsWidget->setVisible(true); } -void MainWindow::setCurrentNet(const QByteArray &netName) +void MainWindow::setCurrentNet(const QByteArray &netname) { - m_monitor->setCurrentNetname(netName); + m_monitor->setCurrentNetname(netname); +} + +void MainWindow::setCurrentSched(const QByteArray &schedname) +{ + m_monitor->setCurrentSchedname(schedname); } void MainWindow::handleViewModeActionTriggered(QAction *action) diff --git a/src/mainwindow.h b/src/mainwindow.h index 0843657d..da882e6a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -46,6 +46,7 @@ class MainWindow virtual ~MainWindow(); void setCurrentNet(const QByteArray &netname); + void setCurrentSched(const QByteArray &schedname); Monitor *monitor() const; StatusView *view() const; From 5d85993e229743cf18ba49160dc2774d97b2dfd7 Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Tue, 30 Aug 2016 18:13:06 +0200 Subject: [PATCH 03/77] icecreammonitor: Set hostname on SchedDisc construction --- src/icecreammonitor.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 6a303872..90a26e56 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -110,6 +110,7 @@ void IcecreamMonitor::slotCheckScheduler() return; } + const string hostname = currentSchedname().isEmpty() ? "" : currentSchedname().data(); list names; if (!currentNetname().isEmpty()) { @@ -127,7 +128,7 @@ void IcecreamMonitor::slotCheckScheduler() if (!m_discover || m_discover->timed_out()) { delete m_discover; - m_discover = new DiscoverSched(QBA_toStdString(currentNetname())); + m_discover = new DiscoverSched(QBA_toStdString(currentNetname()), 2, hostname); } m_scheduler = m_discover->try_get_scheduler(); From b5d0da39c3e9de0824d5b0070329c5d872a139d2 Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Tue, 30 Aug 2016 18:14:01 +0200 Subject: [PATCH 04/77] Add scheduler hostname option --- src/main.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cc b/src/main.cc index f0f5d4b9..db8b8039 100644 --- a/src/main.cc +++ b/src/main.cc @@ -43,6 +43,10 @@ int main(int argc, char **argv) QCoreApplication::translate("main", "Icecream network name."), QCoreApplication::translate("main", "name", "network name")); parser.addOption(netnameOption); + QCommandLineOption schednameOption(QStringList() << QStringLiteral("s") << QStringLiteral("scheduler"), + QCoreApplication::translate("main", "Icecream scheduler hostname"), + QCoreApplication::translate("main", "hostname", "scheduler hostname")); + parser.addOption(schednameOption); QCommandLineOption testmodeOption(QStringLiteral("testmode"), QCoreApplication::translate("main", "Testing mode.")); parser.addOption(testmodeOption); @@ -50,11 +54,15 @@ int main(int argc, char **argv) parser.process(app); const QByteArray netName = parser.value(netnameOption).toLatin1(); + const QByteArray schedName = parser.value(schednameOption).toLatin1(); MainWindow mainWindow; if (!netName.isEmpty()) { mainWindow.setCurrentNet(netName); } + if (!schedName.isEmpty()) { + mainWindow.setCurrentSched(schedName); + } if (parser.isSet(testmodeOption)) { mainWindow.setTestModeEnabled(true); } @@ -62,4 +70,3 @@ int main(int argc, char **argv) return app.exec(); } - From 252d6fe155f5e930a7957815235dd789b0576b50 Mon Sep 17 00:00:00 2001 From: Dimitri Bouron Date: Tue, 30 Aug 2016 18:14:40 +0200 Subject: [PATCH 05/77] doc: Update manual page with scheduler option --- doc/man-icemon.1.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/man-icemon.1.xml b/doc/man-icemon.1.xml index 547bf929..66cb6d81 100644 --- a/doc/man-icemon.1.xml +++ b/doc/man-icemon.1.xml @@ -59,6 +59,14 @@ network and monitor its traffic. + + +, +host-name +The hostname of the Icecream scheduler &icemon; should connect to. + + + From 13500f1d1a23ea04e63920277b4f3dddc3e61fcb Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 20 Dec 2016 01:22:11 +0100 Subject: [PATCH 06/77] Prefer 'using' over 'typedef' --- src/models/joblistmodel.h | 2 +- src/types.h | 2 +- src/views/ganttstatusview.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/joblistmodel.h b/src/models/joblistmodel.h index 3bb9eea3..079af4d3 100644 --- a/src/models/joblistmodel.h +++ b/src/models/joblistmodel.h @@ -128,7 +128,7 @@ private Q_SLOTS: uint time; uint jobId; }; - typedef QVector FinishedJobs; + using FinishedJobs = QVector; /// List with job ids that are expired FinishedJobs m_finishedJobs; diff --git a/src/types.h b/src/types.h index e323f502..2a2059e7 100644 --- a/src/types.h +++ b/src/types.h @@ -23,6 +23,6 @@ #include -typedef unsigned int HostId; +using HostId = unsigned int; #endif diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index 62e1aa9e..32199b36 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -161,7 +161,7 @@ private slots: GanttTimeScaleWidget *mTimeScale; - typedef QList SlotList; + using SlotList = QList; typedef QMap NodeMap; NodeMap mNodeMap; typedef QMap AgeMap; From c1b52b30118716a8d2727b1ef99ea8d3c325f37e Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 3 Apr 2017 09:57:23 +0200 Subject: [PATCH 07/77] Build with more strict Qt defines --- CMakeLists.txt | 4 +++- src/views/starview.cc | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66d6a9bb..24d7f187 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,11 +83,13 @@ endif() add_definitions( -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050400 + -DQT_NO_CAST_FROM_ASCII + -DQT_NO_CAST_FROM_BYTEARRAY + -DQT_NO_CAST_TO_ASCII -DQT_NO_URL_CAST_FROM_STRING -DQT_STRICT_ITERATORS -DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS - #-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_BYTEARRAY ) include_directories( diff --git a/src/views/starview.cc b/src/views/starview.cc index 241e3f30..548fa4ca 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -582,14 +582,18 @@ bool StarViewGraphicsView::event(QEvent *e) if (hostInfo) { QToolTip::showText(gp + QPoint(10, 10), hostInfo->toolTip(), this, itemRect); } else { - QToolTip::showText(gp + QPoint(10, 10), - "

" + tr("Scheduler") + "

" - "" + - "" + - "" + - "
" + tr("Host: %1").arg(m_starView->hostInfoManager()->schedulerName()) + "
" + tr("Network name: %1").arg(m_starView->hostInfoManager()->networkName()) + "
" - "

", - this, itemRect); + QToolTip::showText(gp + QPoint(10, 10), QStringLiteral( + "

%1

" + "" + "" + "" + "
%2
%3
" + "

") + .arg(tr("Scheduler"), + tr("Host: %1").arg(m_starView->hostInfoManager()->schedulerName()), + tr("Network name: %1").arg(m_starView->hostInfoManager()->networkName()) + ), + this, itemRect); } } else { QToolTip::hideText(); From 161b35f508a8024ea39564d1a4206ea20f8c0a45 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 6 Apr 2017 23:12:31 +0200 Subject: [PATCH 08/77] Compile with -pedantic --- CMakeLists.txt | 2 +- src/statusview.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24d7f187..5afcadca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,7 +71,7 @@ endif() if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") check_cxx_compiler_flag(-Wunused-but-set-variable HAVE_GCC_UNUSED_BUT_SET) check_cxx_compiler_flag(-Wlogical-op HAVE_GCC_LOGICAL_OP) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-noreturn -Werror=return-type") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-noreturn -Werror=return-type -pedantic") if(HAVE_GCC_UNUSED_BUT_SET) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-but-set-variable") endif() diff --git a/src/statusview.h b/src/statusview.h index 5b005ebf..4ca08ed4 100644 --- a/src/statusview.h +++ b/src/statusview.h @@ -46,7 +46,7 @@ class StatusView NoOptions = 0, ///< No option RememberJobsOption = 1 ///< Show old jobs in case this view gets reactivated }; - Q_DECLARE_FLAGS(Options, Option); + Q_DECLARE_FLAGS(Options, Option) StatusView(QObject *parent = nullptr); virtual ~StatusView(); From bd5a3bd7d92d99bc47be4c23fd4a9180953c58b2 Mon Sep 17 00:00:00 2001 From: Philippe Jung Date: Thu, 28 May 2015 01:10:25 +0200 Subject: [PATCH 09/77] Various fixes and improvement of SummaryView Fix: Summary view stateWidget color not updated correctly, Improved: added display of average build time for finished jobs. --- src/job.h | 1 + src/views/summaryview.cc | 24 ++++++++++++++++++++---- src/views/summaryview.h | 5 ++++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/job.h b/src/job.h index a092d1f6..2050b6a3 100644 --- a/src/job.h +++ b/src/job.h @@ -48,6 +48,7 @@ class Job State state() const { return m_state; } QString stateAsString() const; time_t stime() const { return m_stime; } + unsigned int getRealTime() const { return real_msec; } bool isDone() const { return m_state == Finished || m_state == Failed; } bool isActive() const { return m_state == LocalOnly || m_state == Compiling; } diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 747eb68e..652eec82 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -61,6 +61,8 @@ class SummaryViewScrollArea SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryView *view, QGridLayout *layout) : m_jobCount(0) + , m_totalJobsLength(0.0f) + , m_finishedJobCount(0) , m_view(view) { const int row = layout->rowCount(); @@ -94,7 +96,7 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi m_jobHandlers[i].stateWidget->setLineWidth(2); m_jobHandlers[i].stateWidget->setFixedHeight(15); QPalette palette = m_jobHandlers[i].stateWidget->palette(); - palette.setColor(m_jobHandlers[i].stateWidget->backgroundRole(), Qt::black); + palette.setColor(m_jobHandlers[i].stateWidget->foregroundRole(), Qt::black); m_jobHandlers[i].stateWidget->setPalette(palette); m_jobHandlers[i].stateWidget->show(); labelLayout->addWidget(m_jobHandlers[i].stateWidget); @@ -133,13 +135,21 @@ SummaryViewItem::~SummaryViewItem() m_widgets.clear(); } +void SummaryViewItem::updateLabel() +{ + double avgDuration = 0; + if (m_finishedJobCount>0) + avgDuration = m_totalJobsLength / m_finishedJobCount; + m_jobsLabel->setText(QString::number(m_jobCount) + " Average duration: " + QString::number(avgDuration, 'f', 2)); +} + void SummaryViewItem::update(const Job &job) { switch (job.state()) { case Job::Compiling: { m_jobCount++; - m_jobsLabel->setText(QString::number(m_jobCount)); + updateLabel(); QVector::Iterator it = m_jobHandlers.begin(); while (it != m_jobHandlers.end() && !(*it).currentFile.isNull()) @@ -148,7 +158,7 @@ void SummaryViewItem::update(const Job &job) if (it != m_jobHandlers.end()) { const QColor nodeColor = m_view->hostInfoManager()->hostColor(job.client()); QPalette palette = (*it).stateWidget->palette(); - palette.setColor((*it).stateWidget->backgroundRole(), nodeColor); + palette.setColor((*it).stateWidget->foregroundRole(), nodeColor); (*it).stateWidget->setPalette(palette); const QString fileName = job.fileName().section(QLatin1Char('/'), -1); const QString hostName = m_view->nameForHost(job.client()); @@ -167,11 +177,17 @@ void SummaryViewItem::update(const Job &job) if (it != m_jobHandlers.end()) { QPalette palette = (*it).stateWidget->palette(); - palette.setColor((*it).stateWidget->backgroundRole(), Qt::black); + palette.setColor((*it).stateWidget->foregroundRole(), Qt::black); (*it).stateWidget->setPalette(palette); + (*it).stateWidget->repaint(); (*it).sourceLabel->clear(); (*it).stateLabel->setText(job.stateAsString()); (*it).currentFile = QString(); + if (job.state() == Job::Finished) { + m_totalJobsLength += job.getRealTime(); + m_finishedJobCount++; + updateLabel(); + } } break; } diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 161d74c8..6c18c6b6 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -43,7 +43,8 @@ class SummaryViewItem QLabel *addLine(const QString &caption, QWidget *parent, QGridLayout *grid, Qt::Alignment flags = Qt::AlignTop, const QString &status = QString()); - + void updateLabel(); + struct JobHandler { JobHandler() @@ -60,6 +61,8 @@ class SummaryViewItem QLabel *m_jobsLabel; int m_jobCount; + double m_totalJobsLength; + int m_finishedJobCount; SummaryView *m_view; QVector m_jobHandlers; From ce9bb730d774f837247a1f4c42b4fb75aa8eda5b Mon Sep 17 00:00:00 2001 From: Philippe Jung Date: Thu, 28 May 2015 10:28:03 +0200 Subject: [PATCH 10/77] Summary: Multiple improvements Fixes: * With 5 hosts capable of handling up to 16 jobs, scrollview is not sized correctly. Improvement: Displays average time for each submitted jobs. Target goal is to be able to compare build times for large scale project with more or less parallelism in order to choose the best number of simultaneous builds / building machines. Closes #23 --- src/fakemonitor.cc | 1 + src/views/summaryview.cc | 50 ++++++++++++++++++++++++++++++++++------ src/views/summaryview.h | 8 ++++++- 3 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index eb108a46..9e823ba7 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -101,6 +101,7 @@ void FakeMonitor::update() job.in_uncompressed = qrand() % MAX_JOB_SIZE; job.in_compressed = qrand() % MAX_JOB_SIZE ; job.in_uncompressed = qrand() % MAX_JOB_SIZE * 0.75; // random factor + job.real_msec = 200; const int serverId = ((JOB_ID + 1) % MAX_HOST_COUNT) + 1; job.setServer(serverId); emit jobUpdated(job); diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 652eec82..7b754bb4 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -63,6 +63,8 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi : m_jobCount(0) , m_totalJobsLength(0.0f) , m_finishedJobCount(0) + , m_totalRequestedJobsLength(0.0f) + , m_requestedJobCount(0) , m_view(view) { const int row = layout->rowCount(); @@ -86,6 +88,12 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi l->show(); labelLayout->addWidget(l); + m_speedLabel = new QLabel(labelBox); + m_speedLabel->setToolTip(QApplication::tr("Average job time for a file sent by this client / total number of jobs sent.")); + m_speedLabel->setAlignment(Qt::AlignCenter); + m_speedLabel->show(); + labelLayout->addWidget(m_speedLabel); + const int maxJobs = view->hostInfoManager()->maxJobs(hostid); m_jobHandlers.resize(maxJobs); @@ -113,6 +121,7 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi grid->setSpacing(5); m_jobsLabel = addLine(QApplication::tr("Jobs:"), detailsBox, grid, Qt::AlignBottom, QStringLiteral("0")); + m_jobsLabel->setToolTip(QApplication::tr("Total number of jobs processed by this server / average duration of each job.")); for (int i = 0; i < maxJobs; i++) { if (maxJobs > 1) { @@ -135,12 +144,32 @@ SummaryViewItem::~SummaryViewItem() m_widgets.clear(); } -void SummaryViewItem::updateLabel() +void SummaryViewItem::updateStats() { - double avgDuration = 0; - if (m_finishedJobCount>0) - avgDuration = m_totalJobsLength / m_finishedJobCount; - m_jobsLabel->setText(QString::number(m_jobCount) + " Average duration: " + QString::number(avgDuration, 'f', 2)); + const double avgDuration = m_finishedJobCount > 0 ? m_totalJobsLength / m_finishedJobCount : 0.0f; + m_jobsLabel->setText(QApplication::tr("%1 (Ø duration: %2 ms)").arg( + QString::number(m_jobCount), + QString::number(avgDuration, 'f', 0) + )); + + const double avgTime = m_requestedJobCount > 0 ? m_totalRequestedJobsLength / m_requestedJobCount : 0.0f; + if (qIsNull(avgTime)) { + m_speedLabel->setText(QString()); + } else { + m_speedLabel->setText(QApplication::tr("Ø job time: %1 ms\nrequested jobs count: %2").arg( + QString::number(avgTime, 'f', 0), + QString::number(m_requestedJobCount) + )); + } +} + +void SummaryViewItem::updateClient(const Job &job) +{ + if (job.state() == Job::Finished) { + m_totalRequestedJobsLength += job.getRealTime(); + m_requestedJobCount++; + updateStats(); + } } void SummaryViewItem::update(const Job &job) @@ -149,7 +178,7 @@ void SummaryViewItem::update(const Job &job) case Job::Compiling: { m_jobCount++; - updateLabel(); + updateStats(); QVector::Iterator it = m_jobHandlers.begin(); while (it != m_jobHandlers.end() && !(*it).currentFile.isNull()) @@ -186,7 +215,7 @@ void SummaryViewItem::update(const Job &job) if (job.state() == Job::Finished) { m_totalJobsLength += job.getRealTime(); m_finishedJobCount++; - updateLabel(); + updateStats(); } } break; @@ -276,8 +305,14 @@ void SummaryView::update(const Job &job) if (!i) { i = new SummaryViewItem(job.server(), m_base, this, m_layout); m_items.insert(job.server(), i); + m_widget->widget()->setMinimumHeight(m_widget->widget()->sizeHint().height()); } i->update(job); + + i = m_items[job.client()]; + if (i) { + i->updateClient(job); + } } void SummaryView::checkNode(unsigned int hostid) @@ -290,5 +325,6 @@ void SummaryView::checkNode(unsigned int hostid) } else if (!m_items[hostid]) { auto i = new SummaryViewItem(hostid, m_base, this, m_layout); m_items.insert(hostid, i); + m_widget->widget()->setMinimumHeight(m_widget->widget()->sizeHint().height()); } } diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 6c18c6b6..7a038fbc 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -38,12 +38,13 @@ class SummaryViewItem SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryView *view, QGridLayout *layout); ~SummaryViewItem(); void update(const Job &job); + void updateClient(const Job &job); private: QLabel *addLine(const QString &caption, QWidget *parent, QGridLayout *grid, Qt::Alignment flags = Qt::AlignTop, const QString &status = QString()); - void updateLabel(); + void updateStats(); struct JobHandler { @@ -58,11 +59,16 @@ class SummaryViewItem QString currentFile; }; + QLabel *m_speedLabel; QLabel *m_jobsLabel; int m_jobCount; double m_totalJobsLength; int m_finishedJobCount; + + double m_totalRequestedJobsLength; + int m_requestedJobCount; + SummaryView *m_view; QVector m_jobHandlers; From 4d0b1dd7a117a2969a83f4ac8a620cf86415c625 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 7 Apr 2017 00:06:07 +0200 Subject: [PATCH 11/77] Job: Simplify, only use public accessible members --- src/fakemonitor.cc | 8 +++--- src/icecreammonitor.cc | 14 +++++------ src/job.cc | 22 ++++++++-------- src/job.h | 49 +++++++++++------------------------- src/mainwindow.cc | 6 ++--- src/models/joblistmodel.cc | 20 +++++++-------- src/statusview.cc | 10 ++++---- src/views/flowtableview.cc | 18 ++++++------- src/views/ganttstatusview.cc | 28 ++++++++++----------- src/views/starview.cc | 32 +++++++++++------------ src/views/summaryview.cc | 30 +++++++++++----------- 11 files changed, 109 insertions(+), 128 deletions(-) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index 9e823ba7..5568fbe1 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -95,15 +95,15 @@ void FakeMonitor::update() Job job(JOB_ID++, clientId, fileName); time_t rawtime; time(&rawtime); - job.setStartTime(rawtime); - job.setState(Job::Compiling); + job.startTime = rawtime; + job.state = Job::Compiling; job.in_compressed = qrand() % MAX_JOB_SIZE * 0.75; // random factor job.in_uncompressed = qrand() % MAX_JOB_SIZE; job.in_compressed = qrand() % MAX_JOB_SIZE ; job.in_uncompressed = qrand() % MAX_JOB_SIZE * 0.75; // random factor job.real_msec = 200; const int serverId = ((JOB_ID + 1) % MAX_HOST_COUNT) + 1; - job.setServer(serverId); + job.server = serverId; emit jobUpdated(job); m_activeJobs << job; @@ -111,7 +111,7 @@ void FakeMonitor::update() if (m_activeJobs.size() > MAX_JOB_COUNT) { Job job = m_activeJobs.first(); m_activeJobs.removeFirst(); - job.setState(Job::Finished); + job.state = Job::Finished; emit jobUpdated(job); } diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 90a26e56..2633e221 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -242,7 +242,7 @@ void IcecreamMonitor::handle_local_begin(Msg *_m) m_rememberedJobs[m->job_id] = Job(m->job_id, m->hostid, QString::fromStdString(m->file), QStringLiteral("C++")); - m_rememberedJobs[m->job_id].setState(Job::LocalOnly); + m_rememberedJobs[m->job_id].state = Job::LocalOnly; emit jobUpdated(m_rememberedJobs[m->job_id]); } @@ -259,7 +259,7 @@ void IcecreamMonitor::handle_local_done(Msg *_m) return; } - (*it).setState(Job::Finished); + (*it).state = Job::Finished; emit jobUpdated(*it); if (m_rememberedJobs.size() > 3000) { // now remove 1000 @@ -310,9 +310,9 @@ void IcecreamMonitor::handle_job_begin(Msg *_m) return; } - (*it).setServer(m->hostid); - (*it).setStartTime(m->stime); - (*it).setState(Job::Compiling); + (*it).server = m->hostid; + (*it).startTime = m->stime; + (*it).state = Job::Compiling; emit jobUpdated(*it); } @@ -332,9 +332,9 @@ void IcecreamMonitor::handle_job_done(Msg *_m) (*it).exitcode = m->exitcode; if (m->exitcode) { - (*it).setState(Job::Failed); + (*it).state = Job::Failed; } else { - (*it).setState(Job::Finished); + (*it).state = Job::Finished; (*it).real_msec = m->real_msec; (*it).user_msec = m->user_msec; (*it).sys_msec = m->sys_msec; /* system time used */ diff --git a/src/job.cc b/src/job.cc index 49f9bdb7..64feb4bd 100644 --- a/src/job.cc +++ b/src/job.cc @@ -26,17 +26,17 @@ #include Job::Job(unsigned int id, unsigned int client, const QString &filename, const QString &lang) - : m_id(id) - , m_fileName(filename) - , m_lang(lang) - , m_state(WaitingForCS) - , m_client(client) + : id(id) + , fileName(filename) + , server(0) + , client(client) + , lang(lang) + , state(WaitingForCS) , real_msec(0) , user_msec(0) , sys_msec(0) , pfaults(0) , exitcode(0) - , m_server(0) , in_compressed(0) , in_uncompressed(0) , out_compressed(0) @@ -46,7 +46,7 @@ Job::Job(unsigned int id, unsigned int client, const QString &filename, const QS QString Job::stateAsString() const { - switch (m_state) { + switch (state) { case WaitingForCS: return QApplication::tr("Waiting"); break; @@ -71,10 +71,10 @@ QString Job::stateAsString() const QDebug operator<<(QDebug dbg, const Job &job) { - return dbg.nospace() << "Job[id=" << job.jobId() - << ", client=" << job.client() - << ", server=" << job.server() - << ", fileName=" << job.fileName() + return dbg.nospace() << "Job[id=" << job.id + << ", client=" << job.client + << ", server=" << job.server + << ", fileName=" << job.fileName << ", state=" << job.stateAsString() << "]"; } diff --git a/src/job.h b/src/job.h index 2050b6a3..41458333 100644 --- a/src/job.h +++ b/src/job.h @@ -37,41 +37,22 @@ class Job const QString &filename = QString(), const QString &lang = QString()); - bool operator==(const Job &rhs) const { return m_id == rhs.m_id; } - bool operator!=(const Job &rhs) const { return m_id != rhs.m_id; } - int operator<(const Job &rhs) const { return m_id < rhs.m_id; } - - unsigned int jobId() const { return m_id; } - QString fileName() const { return m_fileName; } - unsigned int client() const { return m_client; } - unsigned int server() const { return m_server; } - State state() const { return m_state; } + bool operator==(const Job &rhs) const { return id == rhs.id; } + bool operator!=(const Job &rhs) const { return id != rhs.id; } + int operator<(const Job &rhs) const { return id < rhs.id; } + QString stateAsString() const; - time_t stime() const { return m_stime; } - unsigned int getRealTime() const { return real_msec; } - bool isDone() const { return m_state == Finished || m_state == Failed; } - bool isActive() const { return m_state == LocalOnly || m_state == Compiling; } - - void setServer(unsigned int hostid) { - m_server = hostid; - } - void setStartTime(time_t t) { - m_stime = t; - } - void setState(State ss) { - m_state = ss; - } - -private: - unsigned int m_id; - QString m_fileName; - unsigned int m_server; - unsigned int m_client; - QString m_lang; - State m_state; - time_t m_stime; + bool isDone() const { return state == Finished || state == Failed; } + bool isActive() const { return state == LocalOnly || state == Compiling; } + + unsigned int id; + QString fileName; + unsigned int server; + unsigned int client; + QString lang; + State state; + time_t startTime; -public: unsigned int real_msec; /* real time it used */ unsigned int user_msec; /* user time used */ unsigned int sys_msec; /* system time used */ @@ -92,7 +73,7 @@ class IdleJob { public: IdleJob() - : Job() { setState(Job::Idle); } + : Job() { state = Job::Idle; } }; typedef QMap JobList; diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 3da206c4..6669af4f 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -292,10 +292,10 @@ void MainWindow::updateSchedulerState(Monitor::SchedulerState state) void MainWindow::updateJob(const Job &job) { if (job.isActive()) { - m_activeJobs[job.jobId()] = job; + m_activeJobs[job.id] = job; updateJobStats(); } else if (job.isDone()) { - m_activeJobs.remove(job.jobId()); + m_activeJobs.remove(job.id); updateJobStats(); } } @@ -316,7 +316,7 @@ void MainWindow::updateJobStats() } } for (JobList::const_iterator i = m_activeJobs.constBegin(); i != m_activeJobs.constEnd(); ++i) { - const HostInfo *server = hostMap[i.value().server() != 0 ? i.value().server() : i.value().client()]; + const HostInfo *server = hostMap[i.value().server != 0 ? i.value().server : i.value().client]; if (!server->isOffline() && !server->noRemote()) { ++perPlatformStats[server->platform()].jobs; } diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index 7edc82de..dc3218c2 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -124,16 +124,16 @@ void JobListModel::updateJob(const Job &job) m_jobs[index] = job; emit dataChanged(indexForJob(job, 0), indexForJob(job, _JobColumnCount - 1)); } else { - if (m_hostid && m_jobType == RemoteJobs && job.server() != m_hostid) + if (m_hostid && m_jobType == RemoteJobs && job.server != m_hostid) return; - if (m_hostid && m_jobType == LocalJobs && job.client() != m_hostid) + if (m_hostid && m_jobType == LocalJobs && job.client != m_hostid) return; beginInsertRows(QModelIndex(), m_jobs.size(), m_jobs.size()); m_jobs << job; endInsertRows(); } - const bool finished = (job.state() == Job::Finished || job.state() == Job::Failed); + const bool finished = (job.state == Job::Finished || job.state == Job::Failed); if (finished) { expireItem(job); } @@ -206,13 +206,13 @@ QVariant JobListModel::data(const QModelIndex &index, int role) const if (role == Qt::DisplayRole) { switch (column) { case JobColumnID: - return job.jobId(); + return job.id; case JobColumnFilename: - return trimFilePath(job.fileName(), m_numberOfFilePathParts); + return trimFilePath(job.fileName, m_numberOfFilePathParts); case JobColumnClient: - return manager->nameForHost(job.client()); + return manager->nameForHost(job.client); case JobColumnServer: - return manager->nameForHost(job.server()); + return manager->nameForHost(job.server); case JobColumnState: return job.stateAsString(); case JobColumnReal: @@ -270,7 +270,7 @@ struct find_jobid bool operator()(const Job &job) const { - return job.jobId() == m_jobId; + return job.id == m_jobId; } private: @@ -302,7 +302,7 @@ void JobListModel::slotExpireFinishedJobs() void JobListModel::removeItem(const Job &job) { - removeItemById(job.jobId()); + removeItemById(job.id); } void JobListModel::removeItemById(unsigned int jobId) @@ -322,7 +322,7 @@ void JobListModel::expireItem(const Job &job) } const uint currentTime = QDateTime::currentDateTime().toTime_t(); - m_finishedJobs.push_back(FinishedJob(currentTime, job.jobId())); + m_finishedJobs.push_back(FinishedJob(currentTime, job.id)); if (!m_expireTimer->isActive()) { m_expireTimer->start(1000); diff --git a/src/statusview.cc b/src/statusview.cc index f8359bbc..d0b72fd6 100644 --- a/src/statusview.cc +++ b/src/statusview.cc @@ -124,13 +124,13 @@ QColor StatusView::hostColor(HostId id) unsigned int StatusView::processor(const Job &job) { unsigned int ret = 0; - if (job.state() == Job::LocalOnly || job.state() == Job::WaitingForCS) { - ret = job.client(); + if (job.state == Job::LocalOnly || job.state == Job::WaitingForCS) { + ret = job.client; } else { - ret = job.server(); + ret = job.server; if (!ret) { - // Q_ASSERT( job.state() == Job::Finished ); - ret = job.client(); + // Q_ASSERT( job.m_state == Job::Finished ); + ret = job.client; } } Q_ASSERT(ret); diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index f9c45051..c3ca59d3 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -51,12 +51,12 @@ void ProgressWidget::paintEvent(QPaintEvent *) m_isVirgin = false; } - if (m_currentJob.state() == Job::Compiling || - m_currentJob.state() == Job::LocalOnly) { + if (m_currentJob.state == Job::Compiling || + m_currentJob.state == Job::LocalOnly) { QLinearGradient gradient; gradient.setCoordinateMode(QGradient::ObjectBoundingMode); gradient.setColorAt(0, palette().base().color()); - gradient.setColorAt(1, m_statusView->hostColor(m_currentJob.client())); + gradient.setColorAt(1, m_statusView->hostColor(m_currentJob.client)); p.fillRect(width() - 1, 0, 1, height(), gradient); } else { p.fillRect(width() - 1, 0, 1, height(), palette().base().color()); @@ -92,7 +92,7 @@ FlowTableView::FlowTableView(QObject *parent) void FlowTableView::update(const Job &job) { - int serverId = job.server(); + int serverId = job.server; if (serverId == 0) { return; } @@ -106,14 +106,14 @@ void FlowTableView::update(const Job &job) QTableWidgetItem *fileNameItem = m_widget->item(serverRow, 1); QTableWidgetItem *jobStateItem = m_widget->item(serverRow, 3); - if (job.state() == Job::Finished) { + if (job.state == Job::Finished) { fileNameItem->setText(QLatin1String("")); jobStateItem->setText(QLatin1String("")); } else { - QString filePath = job.fileName(); + QString filePath = job.fileName; QString fileName = filePath.mid(filePath.lastIndexOf(QLatin1Char('/')) + 1); fileNameItem->setText(fileName); - fileNameItem->setToolTip(job.fileName()); + fileNameItem->setToolTip(job.fileName); fileNameItem->setFlags(Qt::ItemIsEnabled); jobStateItem->setText(job.stateAsString()); jobStateItem->setToolTip(job.stateAsString()); @@ -127,9 +127,9 @@ void FlowTableView::update(const Job &job) // update the host column for the server requesting the job QTableWidgetItem *hostNameItem = m_widget->item(serverRow, 0); int usageCount = hostNameItem->data(Qt::UserRole).toInt(); - if (job.state() == Job::LocalOnly || job.state() == Job::Compiling) { + if (job.state == Job::LocalOnly || job.state == Job::Compiling) { ++usageCount; - } else if (job.state() == Job::Finished || job.state() == Job::Failed) { + } else if (job.state == Job::Finished || job.state == Job::Failed) { --usageCount; } diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 82d4f21f..ef855b01 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -156,14 +156,14 @@ void GanttProgress::adjustGraph() void GanttProgress::update(const Job &job) { if (!m_jobs.isEmpty() && m_jobs.first().job == job) { - if (job.state() == Job::Finished || job.state() == Job::Failed) { + if (job.state == Job::Finished || job.state == Job::Failed) { Job j = IdleJob(); m_jobs.prepend(JobData(j, mClock)); mIsFree = true; } } else { m_jobs.prepend(JobData(job, mClock)); - mIsFree = (job.state() == Job::Idle); + mIsFree = (job.state == Job::Idle); } } @@ -197,7 +197,7 @@ void GanttProgress::drawGraph(QPainter &p) if (xWidth > 4 && height() > 4) { int width = xWidth - 4; - QString s = (*it).job.fileName(); + QString s = (*it).job.fileName; if (!s.isEmpty()) { s = s.mid(s.lastIndexOf(QLatin1Char('/')) + 1, s.length()); @@ -247,11 +247,11 @@ void GanttProgress::drawGraph(QPainter &p) QColor GanttProgress::colorForStatus(const Job &job) const { - if (job.state() == Job::Idle) { + if (job.state == Job::Idle) { return Qt::gray; } else { - QColor c = mStatusView->hostColor(job.client()); - if (job.state() == Job::LocalOnly) { + QColor c = mStatusView->hostColor(job.client); + if (job.state == Job::LocalOnly) { return c.light(); } else { return c; @@ -319,33 +319,33 @@ void GanttStatusView::update(const Job &job) return; } - if (job.state() == Job::WaitingForCS) { + if (job.state == Job::WaitingForCS) { return; } QMap::Iterator it; - it = mJobMap.find(job.jobId()); + it = mJobMap.find(job.id); if (it != mJobMap.end()) { it.value()->update(job); - if (job.state() == Job::Finished || job.state() == Job::Failed) { + if (job.state == Job::Finished || job.state == Job::Failed) { mJobMap.erase(it); } return; } - if (job.state() == Job::Finished || job.state() == Job::Failed) { + if (job.state == Job::Finished || job.state == Job::Failed) { return; } GanttProgress *slot = nullptr; unsigned int processor; - if (job.state() == Job::LocalOnly) { - processor = job.client(); + if (job.state == Job::LocalOnly) { + processor = job.client; } else { - processor = job.server(); + processor = job.server; } if (!processor) { @@ -371,7 +371,7 @@ void GanttStatusView::update(const Job &job) } Q_ASSERT(slot); - mJobMap.insert(job.jobId(), slot); + mJobMap.insert(job.id, slot); slot->update(job); mAgeMap[processor] = 0; } diff --git a/src/views/starview.cc b/src/views/starview.cc index 548fa4ca..26664949 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -265,17 +265,17 @@ void HostItem::setCenterPos(double x, double y) void HostItem::update(const Job &job) { - setIsCompiling(job.state() == Job::Compiling); - setClient(job.client()); + setIsCompiling(job.state == Job::Compiling); + setClient(job.client); - if (job.state() == Job::WaitingForCS) { + if (job.state == Job::WaitingForCS) { return; } - bool finished = job.state() == Job::Finished || - job.state() == Job::Failed; + bool finished = job.state == Job::Finished || + job.state == Job::Failed; - JobList::Iterator it = m_jobs.find(job.jobId()); + JobList::Iterator it = m_jobs.find(job.id); bool newJob = (it == m_jobs.end()); if (newJob && finished) { @@ -286,7 +286,7 @@ void HostItem::update(const Job &job) } if (newJob) { - m_jobs.insert(job.jobId(), job); + m_jobs.insert(job.id, job); createJobHalo(job); updateName(); } else if (finished) { @@ -335,8 +335,8 @@ void HostItem::updateHalos() QGraphicsEllipseItem *halo = it.value(); halo->setZValue(70 - count); halo->setRect(halo->x() - baseXMargin() - count * HaloMargin, halo->y() - baseYMargin() - count * HaloMargin, mBaseWidth + count * HaloMargin * 2, mBaseHeight + count * HaloMargin * 2); - halo->setBrush(mHostInfoManager->hostColor(it.key().client())); - halo->setPen(mHostInfoManager->hostColor(it.key().client()).darker(PenDarkerFactor)); + halo->setBrush(mHostInfoManager->hostColor(it.key().client)); + halo->setPen(mHostInfoManager->hostColor(it.key().client).darker(PenDarkerFactor)); ++count; } } @@ -382,7 +382,7 @@ void StarView::writeSettings() void StarView::update(const Job &job) { - if (job.state() == Job::WaitingForCS) { + if (job.state == Job::WaitingForCS) { m_widget->drawNodeStatus(); return; } @@ -399,15 +399,15 @@ void StarView::update(const Job &job) hostItem->update(job); - bool finished = job.state() == Job::Finished || job.state() == Job::Failed; + bool finished = job.state == Job::Finished || job.state == Job::Failed; QMap::Iterator it; - it = mJobMap.find(job.jobId()); + it = mJobMap.find(job.id); if (it != mJobMap.end()) { (*it)->update(job); if (finished) { mJobMap.erase(it); - unsigned int clientid = job.client(); + unsigned int clientid = job.client; HostItem *clientItem = findHostItem(clientid); if (clientItem) { clientItem->setIsActiveClient(false); @@ -418,11 +418,11 @@ void StarView::update(const Job &job) } if (!finished) { - mJobMap.insert(job.jobId(), hostItem); + mJobMap.insert(job.id, hostItem); } - if (job.state() == Job::Compiling) { - unsigned int clientid = job.client(); + if (job.state == Job::Compiling) { + unsigned int clientid = job.client; HostItem *clientItem = findHostItem(clientid); if (clientItem) { clientItem->setClient(clientid); diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 7b754bb4..72e044e6 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -165,8 +165,8 @@ void SummaryViewItem::updateStats() void SummaryViewItem::updateClient(const Job &job) { - if (job.state() == Job::Finished) { - m_totalRequestedJobsLength += job.getRealTime(); + if (job.state == Job::Finished) { + m_totalRequestedJobsLength += job.real_msec; m_requestedJobCount++; updateStats(); } @@ -174,7 +174,7 @@ void SummaryViewItem::updateClient(const Job &job) void SummaryViewItem::update(const Job &job) { - switch (job.state()) { + switch (job.state) { case Job::Compiling: { m_jobCount++; @@ -185,15 +185,15 @@ void SummaryViewItem::update(const Job &job) ++it; if (it != m_jobHandlers.end()) { - const QColor nodeColor = m_view->hostInfoManager()->hostColor(job.client()); + const QColor nodeColor = m_view->hostInfoManager()->hostColor(job.client); QPalette palette = (*it).stateWidget->palette(); palette.setColor((*it).stateWidget->foregroundRole(), nodeColor); (*it).stateWidget->setPalette(palette); - const QString fileName = job.fileName().section(QLatin1Char('/'), -1); - const QString hostName = m_view->nameForHost(job.client()); + const QString fileName = job.fileName.section(QLatin1Char('/'), -1); + const QString hostName = m_view->nameForHost(job.client); (*it).sourceLabel->setText(QStringLiteral("%1 (%2)").arg(fileName).arg(hostName)); (*it).stateLabel->setText(job.stateAsString()); - (*it).currentFile = job.fileName(); + (*it).currentFile = job.fileName; } break; } @@ -201,7 +201,7 @@ void SummaryViewItem::update(const Job &job) case Job::Failed: { QVector::Iterator it = m_jobHandlers.begin(); - while (it != m_jobHandlers.end() && (*it).currentFile != job.fileName()) + while (it != m_jobHandlers.end() && (*it).currentFile != job.fileName) ++it; if (it != m_jobHandlers.end()) { @@ -212,8 +212,8 @@ void SummaryViewItem::update(const Job &job) (*it).sourceLabel->clear(); (*it).stateLabel->setText(job.stateAsString()); (*it).currentFile = QString(); - if (job.state() == Job::Finished) { - m_totalJobsLength += job.getRealTime(); + if (job.state == Job::Finished) { + m_totalJobsLength += job.real_msec; m_finishedJobCount++; updateStats(); } @@ -297,19 +297,19 @@ QWidget *SummaryView::widget() const void SummaryView::update(const Job &job) { - if (!job.server()) { + if (!job.server) { return; } - SummaryViewItem *i = m_items[job.server()]; + SummaryViewItem *i = m_items[job.server]; if (!i) { - i = new SummaryViewItem(job.server(), m_base, this, m_layout); - m_items.insert(job.server(), i); + i = new SummaryViewItem(job.server, m_base, this, m_layout); + m_items.insert(job.server, i); m_widget->widget()->setMinimumHeight(m_widget->widget()->sizeHint().height()); } i->update(job); - i = m_items[job.client()]; + i = m_items[job.client]; if (i) { i->updateClient(job); } From 8e919a637b231a1b971ac69fb01bd716e785f1fa Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 7 Apr 2017 00:12:56 +0200 Subject: [PATCH 12/77] Add Travis badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 4367c08a..f3bb358f 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Icemon is an Icecream GUI monitor. ![Screenshot: Star View](https://github.com/icecc/icemon/wiki/screenshots/icemon-starview.png) +[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=master)](https://travis-ci.org/icecc/icemon) + Installation ------------ From 968c0fa1a5be3b9d3bff54349844663cbdcb169b Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 7 Apr 2017 00:14:44 +0200 Subject: [PATCH 13/77] Prepare for 3.1.0 release --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5afcadca..a3c329cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include(FeatureSummary) # version info set(ICEMON_VERSION_MAJOR "3") -set(ICEMON_VERSION_MINOR "0") +set(ICEMON_VERSION_MINOR "1") set(ICEMON_VERSION_PATCH "0") set(ICEMON_VERSION "${ICEMON_VERSION_MAJOR}.${ICEMON_VERSION_MINOR}.${ICEMON_VERSION_PATCH}") set(ICEMON_VERSION_STRING "${ICEMON_VERSION}") From 2cab17907697a4160c0a30bbd5fede4342bac8bd Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 7 Apr 2017 00:20:44 +0200 Subject: [PATCH 14/77] Update change log --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18fc2f2a..64f0bd18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +## 3.1.0 (2017-04-07) + +Features: + +- Summary view: Multiple improvements (#23) + - Displays average time for each submitted jobs + - Added display of average build time for finished jobs +- Added scheduler hostname option (#27) + +Bugfixes: + +- Fixed summary view stateWidget color not updated correctly (#23) +- ListView: Sorted file sizes correctly (643abfbbdeed806aa5a08f0c1cfcdaf7ba79d748) +- Fixed filtering in detailed host view (#26) + +Internal Changes: + +- Lots of cleanups, more strict compiler flags, etc. + ## 3.0.1 (2016-02-06) Bugfixes: From 317fc62a8ca5939a114347a5a7c9f8c155a34838 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 7 Apr 2017 00:41:43 +0200 Subject: [PATCH 15/77] FakeMonitor: Fixup, set noRemote to false Fixes status bar widget in main window --- src/fakemonitor.cc | 1 + src/hostinfo.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index 5568fbe1..7d5439fa 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -81,6 +81,7 @@ void FakeMonitor::createHostInfo(HostId id) info.setName(HOST_NAMES[id % HOST_NAMES.length()] + QString::number(id)); info.setColor(info.createColor(info.name())); info.setOffline(false); + info.setNoRemote(false); info.setPlatform(randomPlatform()); info.setServerLoad(1.0); info.setServerSpeed(10); diff --git a/src/hostinfo.h b/src/hostinfo.h index 1d39eab5..39589736 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -51,6 +51,7 @@ class HostInfo void setOffline(bool offline) { mOffline = offline; } bool isOffline() const { return mOffline; } + void setNoRemote(bool noRemote) { mNoRemote = noRemote; } bool noRemote() const { return mNoRemote; } typedef QMap StatsMap; From 3dbaea159bba93b884080b92bfeb074f4fbb3663 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 18 Apr 2017 16:42:52 +0200 Subject: [PATCH 16/77] Mark pkg-config as required Related to #30 --- README.md | 2 +- cmake/modules/FindIcecream.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3bb358f..43cf1e75 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Installation To compile icemon, install, the icecc development package, e.g. for Debian/Ubuntu: - $ apt-get install libicecc-dev + $ apt-get install pkg-config libicecc-dev Finally, make sure you have g++, Qt and cmake installed diff --git a/cmake/modules/FindIcecream.cmake b/cmake/modules/FindIcecream.cmake index 5e15fdf4..26040e41 100644 --- a/cmake/modules/FindIcecream.cmake +++ b/cmake/modules/FindIcecream.cmake @@ -26,7 +26,7 @@ else () if(NOT WIN32) # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig) + find_package(PkgConfig REQUIRED) pkg_check_modules(PC_ICECC icecc) # The icecream lib may optionally need linking to -lcap-ng, so dig it out # of pkg-config data. From 4ad50032aec9f4d52326969726406a1854e3b6a6 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 27 Apr 2017 17:36:22 +0200 Subject: [PATCH 17/77] Fix -pedantic warning --- src/fakemonitor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index 7d5439fa..ffa1a8a0 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -53,7 +53,7 @@ QString randomPlatform() { static const QStringList hostNames = {QStringLiteral("Linux 2.6"), QStringLiteral("Linux 3.2"), QStringLiteral("Linux 3.6")}; return hostNames[qrand() % hostNames.size()]; -}; +} } FakeMonitor::FakeMonitor(HostInfoManager *manager, QObject *parent) From 293811aacfe69f2f2cbefaac603af3287d8e3d21 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Tue, 11 Jul 2017 23:57:38 +0200 Subject: [PATCH 18/77] Minor: Coding style++ --- src/models/joblistmodel.cc | 14 ++++++++------ src/models/joblistmodel.h | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index dc3218c2..e1ac6173 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -83,7 +83,7 @@ JobListModel::JobListModel(QObject *parent) , m_expireDuration(-1) , m_expireTimer(new QTimer(this)) , m_jobType(AllJobs) - , m_hostid(0) + , m_hostId(0) { connect(m_expireTimer, SIGNAL(timeout()), this, SLOT(slotExpireFinishedJobs())); @@ -109,11 +109,13 @@ void JobListModel::setMonitor(Monitor *monitor) } } -void JobListModel::setHostId(unsigned int hostid) +void JobListModel::setHostId(unsigned int hostId) { - if (m_hostid == hostid) + if (m_hostId == hostId) { return; - m_hostid = hostid; + } + + m_hostId = hostId; clear(); } @@ -124,9 +126,9 @@ void JobListModel::updateJob(const Job &job) m_jobs[index] = job; emit dataChanged(indexForJob(job, 0), indexForJob(job, _JobColumnCount - 1)); } else { - if (m_hostid && m_jobType == RemoteJobs && job.server != m_hostid) + if (m_hostId && m_jobType == RemoteJobs && job.server != m_hostId) return; - if (m_hostid && m_jobType == LocalJobs && job.client != m_hostid) + if (m_hostId && m_jobType == LocalJobs && job.client != m_hostId) return; beginInsertRows(QModelIndex(), m_jobs.size(), m_jobs.size()); m_jobs << job; diff --git a/src/models/joblistmodel.h b/src/models/joblistmodel.h index 079af4d3..72cceedc 100644 --- a/src/models/joblistmodel.h +++ b/src/models/joblistmodel.h @@ -81,8 +81,8 @@ class JobListModel Job jobForIndex(const QModelIndex &index) const; QModelIndex indexForJob(const Job &job, int column); - void setHostId(unsigned int hostid); - unsigned int hostId() const { return m_hostid; } + void setHostId(unsigned int hostId); + unsigned int hostId() const { return m_hostId; } void setJobType(JobType type) { m_jobType = type; } JobType jobType() const { return m_jobType; } @@ -135,7 +135,7 @@ private Q_SLOTS: QTimer *m_expireTimer; JobType m_jobType; - unsigned int m_hostid; + unsigned int m_hostId; }; class JobListSortFilterProxyModel From 600a6769ca4ca9f1c558dd0ea6be21d451c57a6f Mon Sep 17 00:00:00 2001 From: Michael Cullen Date: Thu, 27 Jul 2017 18:57:12 +0100 Subject: [PATCH 19/77] FindDocbook2X.cmake: Add Fedora's executable name FindDocbook2X.cmake tries various executable names, but misses Fedora's db2x_docbook2man - this commit adds it. Closes #32 --- cmake/modules/FindDocbook2X.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindDocbook2X.cmake b/cmake/modules/FindDocbook2X.cmake index 47330e4c..81d9f7a5 100644 --- a/cmake/modules/FindDocbook2X.cmake +++ b/cmake/modules/FindDocbook2X.cmake @@ -51,7 +51,7 @@ endmacro() if (DOCBOOK_TO_MAN_EXECUTABLE) _check_docbook2x_executable() else() - foreach(test_exec docbook2x-man docbook-to-man docbook2man) + foreach(test_exec docbook2x-man docbook-to-man db2x_docbook2man docbook2man) find_program(DOCBOOK_TO_MAN_EXECUTABLE NAMES ${test_exec} ) From bea090fd65ab79520badbcf6355ab084a483b732 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 31 Aug 2017 22:41:09 +0200 Subject: [PATCH 20/77] clang-tidy: modernize-use-override --- src/hostinfo.h | 2 +- src/icecreammonitor.h | 4 ++-- src/mainwindow.h | 2 +- src/models/hostlistmodel.h | 10 +++++----- src/models/joblistmodel.h | 12 ++++++------ src/statusview.h | 2 +- src/views/detailedhostview.h | 2 +- src/views/flowtableview.h | 2 +- src/views/ganttstatusview.h | 14 +++++++------- src/views/hostlistview.h | 2 +- src/views/joblistview.h | 2 +- src/views/listview.h | 8 ++++---- src/views/starview.h | 12 ++++++------ src/views/summaryview.cc | 2 +- src/views/summaryview.h | 10 +++++----- 15 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/hostinfo.h b/src/hostinfo.h index 39589736..1be7e2f3 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -107,7 +107,7 @@ class HostInfoManager public: HostInfoManager(); - ~HostInfoManager(); + ~HostInfoManager() override; HostInfo *find(unsigned int hostid) const; diff --git a/src/icecreammonitor.h b/src/icecreammonitor.h index c097977a..3bf14dcf 100644 --- a/src/icecreammonitor.h +++ b/src/icecreammonitor.h @@ -41,9 +41,9 @@ class IcecreamMonitor public: IcecreamMonitor(HostInfoManager *, QObject *parent); - ~IcecreamMonitor(); + ~IcecreamMonitor() override; - virtual QList jobHistory() const override; + QList jobHistory() const override; private slots: void slotCheckScheduler(); diff --git a/src/mainwindow.h b/src/mainwindow.h index da882e6a..ed404e90 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -43,7 +43,7 @@ class MainWindow public: MainWindow(QWidget *parent = nullptr); - virtual ~MainWindow(); + ~MainWindow() override; void setCurrentNet(const QByteArray &netname); void setCurrentSched(const QByteArray &schedname); diff --git a/src/models/hostlistmodel.h b/src/models/hostlistmodel.h index 3a1955d3..35176d60 100644 --- a/src/models/hostlistmodel.h +++ b/src/models/hostlistmodel.h @@ -56,11 +56,11 @@ class HostListModel explicit HostListModel(QObject *parent = nullptr); - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - virtual QVariant data(const QModelIndex &index, int role) const override; - virtual int columnCount(const QModelIndex &parent) const override; - virtual int rowCount(const QModelIndex &parent) const override; - virtual QModelIndex parent(const QModelIndex &child) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex &index, int role) const override; + int columnCount(const QModelIndex &parent) const override; + int rowCount(const QModelIndex &parent) const override; + QModelIndex parent(const QModelIndex &child) const override; Monitor *monitor() const; void setMonitor(Monitor *monitor); diff --git a/src/models/joblistmodel.h b/src/models/joblistmodel.h index 72cceedc..dafb1335 100644 --- a/src/models/joblistmodel.h +++ b/src/models/joblistmodel.h @@ -72,11 +72,11 @@ class JobListModel m_expireDuration = duration; } - virtual int columnCount(const QModelIndex &parent = QModelIndex()) const override; - virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; - virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - virtual QModelIndex parent(const QModelIndex &child) const override; - virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override; + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QModelIndex parent(const QModelIndex &child) const override; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; Job jobForIndex(const QModelIndex &index) const; QModelIndex indexForJob(const Job &job, int column); @@ -146,7 +146,7 @@ class JobListSortFilterProxyModel JobListSortFilterProxyModel(QObject *parent = nullptr); protected: - virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; + bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; }; #endif diff --git a/src/statusview.h b/src/statusview.h index 4ca08ed4..d1d7812c 100644 --- a/src/statusview.h +++ b/src/statusview.h @@ -49,7 +49,7 @@ class StatusView Q_DECLARE_FLAGS(Options, Option) StatusView(QObject *parent = nullptr); - virtual ~StatusView(); + ~StatusView() override; virtual Options options() const; diff --git a/src/views/detailedhostview.h b/src/views/detailedhostview.h index 1102262d..cd64c1a3 100644 --- a/src/views/detailedhostview.h +++ b/src/views/detailedhostview.h @@ -41,7 +41,7 @@ class DetailedHostView public: DetailedHostView(QObject *parent); - virtual void setMonitor(Monitor *monitor) override; + void setMonitor(Monitor *monitor) override; QWidget *widget() const override; diff --git a/src/views/flowtableview.h b/src/views/flowtableview.h index 4fb80823..5d4c7810 100644 --- a/src/views/flowtableview.h +++ b/src/views/flowtableview.h @@ -60,7 +60,7 @@ class FlowTableView public: explicit FlowTableView(QObject *parent); - virtual QWidget *widget() const override; + QWidget *widget() const override; void update(const Job &job) override; void checkNode(unsigned int hostid) override; diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index 32199b36..9ea49ec8 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -61,7 +61,7 @@ class GanttTimeScaleWidget void setPixelsPerSecond(int); protected: - virtual void paintEvent(QPaintEvent *e) override; + void paintEvent(QPaintEvent *e) override; private: int mPixelsPerSecond; @@ -83,8 +83,8 @@ public slots: void update(const Job &job); protected: - virtual void paintEvent(QPaintEvent *e) override; - virtual void resizeEvent(QResizeEvent *e) override; + void paintEvent(QPaintEvent *e) override; + void resizeEvent(QResizeEvent *e) override; private: void adjustGraph(); @@ -125,11 +125,11 @@ class GanttStatusView Q_OBJECT public: GanttStatusView(QObject *parent = nullptr); - virtual ~GanttStatusView() {} + ~GanttStatusView() override {} QString id() const override { return QStringLiteral("gantt"); } - virtual void checkNode(unsigned int hostid) override; + void checkNode(unsigned int hostid) override; void start() override; void stop() override; @@ -138,10 +138,10 @@ class GanttStatusView bool isPausable() override { return true; } bool isConfigurable() override { return true; } - virtual QWidget *widget() const override; + QWidget *widget() const override; public slots: - virtual void update(const Job &job) override; + void update(const Job &job) override; private slots: void slotConfigChanged(); diff --git a/src/views/hostlistview.h b/src/views/hostlistview.h index 39b978fd..cd44cd70 100644 --- a/src/views/hostlistview.h +++ b/src/views/hostlistview.h @@ -34,7 +34,7 @@ class HostListView public: HostListView(QWidget *parent); - virtual void setModel(QAbstractItemModel *model) override; + void setModel(QAbstractItemModel *model) override; }; #endif diff --git a/src/views/joblistview.h b/src/views/joblistview.h index f5e73f98..2003bc7a 100644 --- a/src/views/joblistview.h +++ b/src/views/joblistview.h @@ -39,7 +39,7 @@ class JobListView public: JobListView(QWidget *parent = nullptr); - virtual void setModel(QAbstractItemModel *model) override; + void setModel(QAbstractItemModel *model) override; bool isClientColumnVisible() const; void setClientColumnVisible(bool visible); diff --git a/src/views/listview.h b/src/views/listview.h index 3ffc648d..11b22827 100644 --- a/src/views/listview.h +++ b/src/views/listview.h @@ -37,11 +37,11 @@ class ListStatusView public: ListStatusView(QObject *parent); - virtual Options options() const override; - virtual QWidget *widget() const override; - virtual QString id() const override { return QStringLiteral("list"); } + Options options() const override; + QWidget *widget() const override; + QString id() const override { return QStringLiteral("list"); } - virtual void setMonitor(Monitor *monitor) override; + void setMonitor(Monitor *monitor) override; private: QScopedPointer m_widget; diff --git a/src/views/starview.h b/src/views/starview.h index 69e67078..bd3b2d5b 100644 --- a/src/views/starview.h +++ b/src/views/starview.h @@ -82,7 +82,7 @@ class HostItem HostItem(const QString &text); HostItem(HostInfo *hostInfo, HostInfoManager *); - ~HostItem(); + ~HostItem() override; void init(); @@ -158,8 +158,8 @@ class StarViewGraphicsView void drawNodeStatus(); protected: - virtual void resizeEvent(QResizeEvent *e) override; - virtual bool event(QEvent *event) override; + void resizeEvent(QResizeEvent *e) override; + bool event(QEvent *event) override; private: void arrangeHostItems(); @@ -177,20 +177,20 @@ class StarView public: StarView(QObject *parent); - virtual ~StarView(); + ~StarView() override; void readSettings(); void writeSettings(); void update(const Job &job) override; - virtual QWidget *widget() const override; + QWidget *widget() const override; QString id() const override { return QStringLiteral("star"); } QList hostItems() const; HostItem *findHostItem(unsigned int hostid) const; - virtual void setMonitor(Monitor *monitor) override; + void setMonitor(Monitor *monitor) override; void checkNode(unsigned int hostid) override; void removeNode(unsigned int hostid) override; diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 72e044e6..4d9e59df 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -52,7 +52,7 @@ class SummaryViewScrollArea public: explicit SummaryViewScrollArea(QWidget *parent = nullptr); - virtual void resizeEvent(QResizeEvent *) override; + void resizeEvent(QResizeEvent *) override; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 7a038fbc..37f3a150 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -82,12 +82,12 @@ class SummaryView public: SummaryView(QObject *parent = nullptr); - ~SummaryView(); + ~SummaryView() override; - virtual QWidget *widget() const override; - virtual void update(const Job &job) override; - virtual void checkNode(unsigned int hostid) override; - virtual QString id() const override { return QStringLiteral("summary"); } + QWidget *widget() const override; + void update(const Job &job) override; + void checkNode(unsigned int hostid) override; + QString id() const override { return QStringLiteral("summary"); } private: QScopedPointer m_widget; From 6778d9642d4cabc423d4ea652e732c8418cc1e90 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 31 Aug 2017 22:42:02 +0200 Subject: [PATCH 21/77] clang-tidy: hicpp-explicit-conversions --- src/mainwindow.h | 2 +- src/models/hostlistmodel.cc | 2 +- src/models/joblistmodel.cc | 2 +- src/models/joblistmodel.h | 4 ++-- src/statusview.h | 2 +- src/views/detailedhostview.h | 2 +- src/views/ganttstatusview.h | 6 +++--- src/views/hostlistview.h | 2 +- src/views/joblistview.h | 2 +- src/views/listview.h | 2 +- src/views/starview.h | 6 +++--- src/views/summaryview.h | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/mainwindow.h b/src/mainwindow.h index ed404e90..3e81ba7a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -42,7 +42,7 @@ class MainWindow Q_OBJECT public: - MainWindow(QWidget *parent = nullptr); + explicit MainWindow(QWidget *parent = nullptr); ~MainWindow() override; void setCurrentNet(const QByteArray &netname); diff --git a/src/models/hostlistmodel.cc b/src/models/hostlistmodel.cc index bee3ccaf..cd405352 100644 --- a/src/models/hostlistmodel.cc +++ b/src/models/hostlistmodel.cc @@ -207,7 +207,7 @@ struct find_hostid : public std::unary_function { public: - find_hostid(unsigned int hostId) + explicit find_hostid(unsigned int hostId) : m_hostId(hostId) {} bool operator()(const HostInfo &info) const diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index e1ac6173..5123b85c 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -267,7 +267,7 @@ struct find_jobid : public std::unary_function { public: - find_jobid(unsigned int jobId) + explicit find_jobid(unsigned int jobId) : m_jobId(jobId) {} bool operator()(const Job &job) const diff --git a/src/models/joblistmodel.h b/src/models/joblistmodel.h index dafb1335..65d5d212 100644 --- a/src/models/joblistmodel.h +++ b/src/models/joblistmodel.h @@ -122,7 +122,7 @@ private Q_SLOTS: struct FinishedJob { - FinishedJob(uint _time = 0, uint _jobId = 0) + explicit FinishedJob(uint _time = 0, uint _jobId = 0) : time(_time) , jobId(_jobId) {} uint time; @@ -143,7 +143,7 @@ class JobListSortFilterProxyModel { Q_OBJECT public: - JobListSortFilterProxyModel(QObject *parent = nullptr); + explicit JobListSortFilterProxyModel(QObject *parent = nullptr); protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const override; diff --git a/src/statusview.h b/src/statusview.h index d1d7812c..b80ad9b0 100644 --- a/src/statusview.h +++ b/src/statusview.h @@ -48,7 +48,7 @@ class StatusView }; Q_DECLARE_FLAGS(Options, Option) - StatusView(QObject *parent = nullptr); + explicit StatusView(QObject *parent = nullptr); ~StatusView() override; virtual Options options() const; diff --git a/src/views/detailedhostview.h b/src/views/detailedhostview.h index cd64c1a3..dfe8708a 100644 --- a/src/views/detailedhostview.h +++ b/src/views/detailedhostview.h @@ -39,7 +39,7 @@ class DetailedHostView Q_OBJECT public: - DetailedHostView(QObject *parent); + explicit DetailedHostView(QObject *parent); void setMonitor(Monitor *monitor) override; diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index 9ea49ec8..0e0bd43a 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -40,7 +40,7 @@ class GanttConfigDialog { Q_OBJECT public: - GanttConfigDialog(QWidget *parent); + explicit GanttConfigDialog(QWidget *parent); bool isTimeScaleVisible(); @@ -56,7 +56,7 @@ class GanttTimeScaleWidget { Q_OBJECT public: - GanttTimeScaleWidget(QWidget *parent); + explicit GanttTimeScaleWidget(QWidget *parent); void setPixelsPerSecond(int); @@ -124,7 +124,7 @@ class GanttStatusView { Q_OBJECT public: - GanttStatusView(QObject *parent = nullptr); + explicit GanttStatusView(QObject *parent = nullptr); ~GanttStatusView() override {} QString id() const override { return QStringLiteral("gantt"); } diff --git a/src/views/hostlistview.h b/src/views/hostlistview.h index cd44cd70..838131cb 100644 --- a/src/views/hostlistview.h +++ b/src/views/hostlistview.h @@ -32,7 +32,7 @@ class HostListView Q_OBJECT public: - HostListView(QWidget *parent); + explicit HostListView(QWidget *parent); void setModel(QAbstractItemModel *model) override; }; diff --git a/src/views/joblistview.h b/src/views/joblistview.h index 2003bc7a..2f65d9c6 100644 --- a/src/views/joblistview.h +++ b/src/views/joblistview.h @@ -37,7 +37,7 @@ class JobListView Q_OBJECT public: - JobListView(QWidget *parent = nullptr); + explicit JobListView(QWidget *parent = nullptr); void setModel(QAbstractItemModel *model) override; diff --git a/src/views/listview.h b/src/views/listview.h index 11b22827..f10a209e 100644 --- a/src/views/listview.h +++ b/src/views/listview.h @@ -35,7 +35,7 @@ class ListStatusView { Q_OBJECT public: - ListStatusView(QObject *parent); + explicit ListStatusView(QObject *parent); Options options() const override; QWidget *widget() const override; diff --git a/src/views/starview.h b/src/views/starview.h index bd3b2d5b..c456c2c3 100644 --- a/src/views/starview.h +++ b/src/views/starview.h @@ -45,7 +45,7 @@ class StarViewConfigDialog Q_OBJECT public: - StarViewConfigDialog(QWidget *parent); + explicit StarViewConfigDialog(QWidget *parent); int nodesPerRing(); void setNodesPerRing(int nodes); @@ -80,7 +80,7 @@ class HostItem enum { RttiHostItem = 1000 }; - HostItem(const QString &text); + explicit HostItem(const QString &text); HostItem(HostInfo *hostInfo, HostInfoManager *); ~HostItem() override; @@ -176,7 +176,7 @@ class StarView Q_OBJECT public: - StarView(QObject *parent); + explicit StarView(QObject *parent); ~StarView() override; void readSettings(); diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 37f3a150..23dca205 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -81,7 +81,7 @@ class SummaryView Q_OBJECT public: - SummaryView(QObject *parent = nullptr); + explicit SummaryView(QObject *parent = nullptr); ~SummaryView() override; QWidget *widget() const override; From 5a85427b0daed0bb92dc6d3f379ccdb4921fb8f2 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 20 Oct 2017 10:50:07 +0200 Subject: [PATCH 22/77] Fix some issues reported by codacy.com See: https://www.codacy.com/app/icecc/icemon/issues --- src/hostinfo.cc | 7 +++---- src/hostinfo.h | 12 ++++++------ src/job.cc | 1 + src/views/ganttstatusview.cc | 3 +-- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/hostinfo.cc b/src/hostinfo.cc index cd448303..74ceb584 100644 --- a/src/hostinfo.cc +++ b/src/hostinfo.cc @@ -122,13 +122,12 @@ void HostInfo::updateFromStatsMap(const StatsMap &stats) QColor HostInfo::createColor(const QString &name) { unsigned long h = 0; - unsigned long g; - int ch; for (uint i = 0; i < ( uint )name.length(); ++i) { - ch = name[i].unicode(); + const int ch = name[i].unicode(); h = (h << 4) + ch; - if ((g = (h & 0xf0000000)) != 0) { + const unsigned long g = h & 0xf0000000; + if (g != 0) { h ^= g >> 24; h ^= g; } diff --git a/src/hostinfo.h b/src/hostinfo.h index 1be7e2f3..0dcbb086 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -81,20 +81,20 @@ class HostInfo QColor createColor(const QString &name); private: - unsigned int mId; + unsigned int mId = 0; QString mName; QColor mColor; QString mPlatform; QString mIp; - unsigned int mMaxJobs; - bool mOffline; - bool mNoRemote; + unsigned int mMaxJobs = 0; + bool mOffline = false; + bool mNoRemote = true; - float mServerSpeed; + float mServerSpeed = 0.0; - unsigned int mServerLoad; + unsigned int mServerLoad = 0; static QVector mColorTable; static QMap mColorNameMap; diff --git a/src/job.cc b/src/job.cc index 64feb4bd..dda3a636 100644 --- a/src/job.cc +++ b/src/job.cc @@ -32,6 +32,7 @@ Job::Job(unsigned int id, unsigned int client, const QString &filename, const QS , client(client) , lang(lang) , state(WaitingForCS) + , startTime{} , real_msec(0) , user_msec(0) , sys_msec(0) diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index ef855b01..0af5d993 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -422,14 +422,13 @@ GanttProgress *GanttStatusView::registerNode(unsigned int hostid) { // qDebug() << "GanttStatusView::registerNode(): " << ip << endl; - static int lastRow = 0; - QColor color = hostColor(hostid); QVBoxLayout *nodeLayout; NodeLayoutMap::ConstIterator it = mNodeLayouts.constFind(hostid); if (it == mNodeLayouts.constEnd()) { + static int lastRow = 0; ++lastRow; nodeLayout = new QVBoxLayout(); From 363744709599bb96ca9e2db5bb5d24a11cc870c0 Mon Sep 17 00:00:00 2001 From: Henry Miller Date: Sun, 22 Oct 2017 13:07:39 -0500 Subject: [PATCH 23/77] Add badges for external tools (#36) * Add badges for external tools * Formatting: add newline to make reading easier. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 43cf1e75..d83aebb0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=v3.0.1)](https://travis-ci.org/icecc/icemon) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8bc2d59bad544258a47209cc9bfb8e7)](https://www.codacy.com/app/icecc/icemon?utm_source=github.com&utm_medium=referral&utm_content=icecc/icemon&utm_campaign=Badge_Grade) + Icemon ====== From 36941d1e827c57967d64add0632fa42ee44cc890 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Sun, 22 Oct 2017 20:09:13 +0200 Subject: [PATCH 24/77] README: Only show badge for travis on master --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index d83aebb0..d80d1dcb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=v3.0.1)](https://travis-ci.org/icecc/icemon) +[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=master)](https://travis-ci.org/icecc/icemon) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8bc2d59bad544258a47209cc9bfb8e7)](https://www.codacy.com/app/icecc/icemon?utm_source=github.com&utm_medium=referral&utm_content=icecc/icemon&utm_campaign=Badge_Grade) Icemon @@ -11,8 +11,6 @@ Icemon is an Icecream GUI monitor. ![Screenshot: Star View](https://github.com/icecc/icemon/wiki/screenshots/icemon-starview.png) -[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=master)](https://travis-ci.org/icecc/icemon) - Installation ------------ From c7f5e316741e69d83c59670ac2ee02e01dcff5fa Mon Sep 17 00:00:00 2001 From: Andrew Guenther Date: Wed, 14 Mar 2018 18:52:18 -0700 Subject: [PATCH 25/77] Update hostlistmodel.cc If an attempt is made to remove a hostId which does not map to a node, return immediately. Fixes #37 --- src/models/hostlistmodel.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/models/hostlistmodel.cc b/src/models/hostlistmodel.cc index bee3ccaf..e38fe4ae 100644 --- a/src/models/hostlistmodel.cc +++ b/src/models/hostlistmodel.cc @@ -222,6 +222,9 @@ struct find_hostid void HostListModel::removeNodeById(unsigned int hostId) { QVector::iterator it = std::find_if(m_hostInfos.begin(), m_hostInfos.end(), find_hostid(hostId)); + if (it == m_hostInfos.end()) { + return; + } int index = std::distance(m_hostInfos.begin(), it); beginRemoveRows(QModelIndex(), index, index); m_hostInfos.erase(it); From d71e5952744f8315f53dc0b15bf09d17d9630e08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 1 Jul 2018 10:04:40 +0200 Subject: [PATCH 26/77] adjust for icecream change that has broken scheduler discovery 47ba035d4dc024d460758c3cf99df1a1a2908db2 in icecream has changed the discovery to always timeout and only then return a scheduler. So first checking for timeout and only then trying to get a scheduler now never provides the scheduler. Change the code the same way iceccd has been changed in that commit. --- src/icecreammonitor.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 2633e221..5d243397 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -126,13 +126,11 @@ void IcecreamMonitor::slotCheckScheduler() ++it) { setCurrentNetname(QBA_fromStdString(*it)); if (!m_discover - || m_discover->timed_out()) { + || ((m_scheduler = m_discover->try_get_scheduler()) == NULL && m_discover->timed_out())) { delete m_discover; m_discover = new DiscoverSched(QBA_toStdString(currentNetname()), 2, hostname); } - m_scheduler = m_discover->try_get_scheduler(); - if (m_scheduler) { hostInfoManager()->setSchedulerName(QString::fromLatin1(m_discover->schedulerName().data())); hostInfoManager()->setNetworkName(QString::fromLatin1(m_discover->networkName().data())); From 3886323a8d9957905711d3f0da0a56253d2844c9 Mon Sep 17 00:00:00 2001 From: Valentine Barshak Date: Sun, 23 Sep 2018 21:47:43 +0300 Subject: [PATCH 27/77] Update views to handle node remove and node add events Switching between views clear all the data. For example, switching back to flow or summary view causes nodes to disappear. Also, if a icecc host is disconnected, it's still displayed in the view. This is an attempt to workaround the above issues. Scan host map when the view is created so that the hosts are not lost when switching between views. When host is disconnected, remove it from the host map and update the data displayed in the view accordingly. This involves overriding setMonitor() and addint createKnownHosts() callback to the view classes. With the list view we have to recreate known hosts when a host node is removed since the rowId -> hostId map gets messed up when removing a host. The nodeRemoved signal is emitted when the node is already removed and its HostInfo is deleted. Signed-off-by: Valentine Barshak --- src/hostinfo.cc | 6 +++++ src/icecreammonitor.cc | 2 +- src/mainwindow.cc | 2 +- src/views/flowtableview.cc | 31 ++++++++++++++++++++++-- src/views/flowtableview.h | 4 ++++ src/views/ganttstatusview.cc | 5 ++++ src/views/ganttstatusview.h | 1 + src/views/starview.cc | 21 ++++------------ src/views/starview.h | 3 --- src/views/summaryview.cc | 46 +++++++++++++++++++++++++++--------- src/views/summaryview.h | 5 ++++ 11 files changed, 91 insertions(+), 35 deletions(-) diff --git a/src/hostinfo.cc b/src/hostinfo.cc index 74ceb584..6e8a63d2 100644 --- a/src/hostinfo.cc +++ b/src/hostinfo.cc @@ -188,6 +188,12 @@ HostInfo *HostInfoManager::checkNode(unsigned int hostid, } hostInfo->updateFromStatsMap(stats); + if (hostInfo->isOffline()) { + mHostMap.remove(hostid); + delete hostInfo; + hostInfo = nullptr; + } + emit hostMapChanged(); return hostInfo; diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 5d243397..82ead60d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -288,7 +288,7 @@ void IcecreamMonitor::handle_stats(Msg *_m) HostInfo *hostInfo = hostInfoManager()->checkNode(m->hostid, stats); - if (hostInfo->isOffline()) { + if (!hostInfo) { emit nodeRemoved(m->hostid); } else { emit nodeUpdated(m->hostid); diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 6669af4f..4ce94b29 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -317,7 +317,7 @@ void MainWindow::updateJobStats() } for (JobList::const_iterator i = m_activeJobs.constBegin(); i != m_activeJobs.constEnd(); ++i) { const HostInfo *server = hostMap[i.value().server != 0 ? i.value().server : i.value().client]; - if (!server->isOffline() && !server->noRemote()) { + if (server && !server->isOffline() && !server->noRemote()) { ++perPlatformStats[server->platform()].jobs; } } diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index c3ca59d3..5c201481 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -88,6 +88,8 @@ FlowTableView::FlowTableView(QObject *parent) m_updateTimer->setInterval(50); m_updateTimer->start(); + + createKnownHosts(); } void FlowTableView::update(const Job &job) @@ -154,6 +156,30 @@ QString FlowTableView::hostInfoText(HostInfo *hostInfo, int runningProcesses) { } } +void FlowTableView::createKnownHosts() +{ + if (!hostInfoManager()) { + return; + } + + m_widget->setRowCount(0); + m_idToRowMap.clear(); + + const HostInfoManager::HostMap hosts(hostInfoManager()->hostMap()); + + foreach(int hostid, hosts.keys()) { + checkNode(hostid); + } +} + +void FlowTableView::setMonitor(Monitor *monitor) +{ + StatusView::setMonitor(monitor); + + if (monitor) + createKnownHosts(); +} + void FlowTableView::checkNode(unsigned int hostId) { if (m_idToRowMap.contains(hostId)) { @@ -191,6 +217,7 @@ void FlowTableView::checkNode(unsigned int hostId) void FlowTableView::removeNode(unsigned int hostId) { - m_widget->removeRow(m_idToRowMap.value(hostId)); - m_idToRowMap.remove(hostId); + Q_UNUSED(hostId); + + createKnownHosts(); } diff --git a/src/views/flowtableview.h b/src/views/flowtableview.h index 5d4c7810..6d1a7940 100644 --- a/src/views/flowtableview.h +++ b/src/views/flowtableview.h @@ -62,6 +62,8 @@ class FlowTableView QWidget *widget() const override; + void setMonitor(Monitor *monitor) override; + void update(const Job &job) override; void checkNode(unsigned int hostid) override; void removeNode(unsigned int hostid) override; @@ -79,6 +81,8 @@ class FlowTableView QString hostInfoText(HostInfo *hostInfo, int runningProcesses = 0); HostIdRowMap m_idToRowMap; QTimer *m_updateTimer; + + void createKnownHosts(); }; #endif // FLOWTABLEVIEW_H diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 0af5d993..04ff6056 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -381,6 +381,11 @@ QWidget *GanttStatusView::widget() const return m_widget.data(); } +void GanttStatusView::removeNode(unsigned int hostid) +{ + unregisterNode(hostid); +} + void GanttStatusView::checkNode(unsigned int hostid) { if (!mRunning) { diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index 0e0bd43a..b8b41432 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -129,6 +129,7 @@ class GanttStatusView QString id() const override { return QStringLiteral("gantt"); } + void removeNode(unsigned int hostid) override; void checkNode(unsigned int hostid) override; void start() override; diff --git a/src/views/starview.cc b/src/views/starview.cc index 26664949..07fa928e 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -478,23 +478,10 @@ void StarView::removeNode(unsigned int hostid) HostItem *hostItem = findHostItem(hostid); - if (hostItem && hostItem->hostInfo()->isOffline()) { - removeItem(hostItem); - } -} - -void StarView::forceRemoveNode(unsigned int hostid) -{ - HostItem *hostItem = findHostItem(hostid); + if (!hostItem) + return; - if (hostItem) { - removeItem(hostItem); - } -} - -void StarView::removeItem(HostItem *hostItem) -{ - m_hostItems.remove(hostItem->hostInfo()->id()); + m_hostItems.remove(hostid); QList obsoleteJobs; @@ -621,7 +608,7 @@ void StarView::slotConfigChanged() if (filterArch(*it)) { checkNode(it.key()); } else { - forceRemoveNode(it.key()); + removeNode(it.key()); } } diff --git a/src/views/starview.h b/src/views/starview.h index c456c2c3..d8f1469e 100644 --- a/src/views/starview.h +++ b/src/views/starview.h @@ -210,9 +210,6 @@ class StarView */ bool filterArch(HostInfo *); - void removeItem(HostItem *); - void forceRemoveNode(unsigned int hostid); - protected slots: void slotConfigChanged(); diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 4d9e59df..116fc2e6 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -284,6 +284,7 @@ SummaryView::SummaryView(QObject *parent) m_widget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_widget->setMinimumHeight(150); + createKnownHosts(); } SummaryView::~SummaryView() @@ -297,29 +298,47 @@ QWidget *SummaryView::widget() const void SummaryView::update(const Job &job) { - if (!job.server) { + if (!job.server) return; - } SummaryViewItem *i = m_items[job.server]; - if (!i) { - i = new SummaryViewItem(job.server, m_base, this, m_layout); - m_items.insert(job.server, i); - m_widget->widget()->setMinimumHeight(m_widget->widget()->sizeHint().height()); + if (i) + i->update(job); + + i= m_items[job.client]; + if (i) + i->updateClient(job); +} + +void SummaryView::createKnownHosts() +{ + if (!hostInfoManager()) { + return; } - i->update(job); - i = m_items[job.client]; - if (i) { - i->updateClient(job); + qDeleteAll(m_items); + m_items.clear(); + + const HostInfoManager::HostMap hosts(hostInfoManager()->hostMap()); + + foreach(int hostid, hosts.keys()) { + checkNode(hostid); } } +void SummaryView::setMonitor(Monitor *monitor) +{ + StatusView::setMonitor(monitor); + + if (monitor) + createKnownHosts(); +} + void SummaryView::checkNode(unsigned int hostid) { HostInfo *hostInfo = hostInfoManager()->find(hostid); - if (hostInfo && nameForHost(hostid).isNull()) { + if (!hostInfo) { delete m_items[hostid]; m_items.remove(hostid); } else if (!m_items[hostid]) { @@ -328,3 +347,8 @@ void SummaryView::checkNode(unsigned int hostid) m_widget->widget()->setMinimumHeight(m_widget->widget()->sizeHint().height()); } } +void SummaryView::removeNode(unsigned int hostid) +{ + delete m_items[hostid]; + m_items.remove(hostid); +} diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 23dca205..1e39cf67 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -85,7 +85,10 @@ class SummaryView ~SummaryView() override; QWidget *widget() const override; + + void setMonitor(Monitor *monitor) override; void update(const Job &job) override; + void removeNode(unsigned int hostid) override; void checkNode(unsigned int hostid) override; QString id() const override { return QStringLiteral("summary"); } @@ -95,6 +98,8 @@ class SummaryView QMap m_items; QGridLayout *m_layout; QWidget *m_base; + + void createKnownHosts(); }; #endif From d5da57a3de57e64cc1f8c34cd78710081dbae503 Mon Sep 17 00:00:00 2001 From: Valentine Barshak Date: Sun, 23 Sep 2018 22:05:38 +0300 Subject: [PATCH 28/77] Fix usage count value in the flow table When switching back to flow table form some other view we may get negative job count value for a node. This happens because the job counter is not saved in the HostInfo structure. it is recreated each time we switch to the flow table view. This adds active job counter to the HostInfo structure and updates it whenever a job is started or finished. This counter is displayed in the flow view. While at it, do not display the host disabled if the active job counter is greater than 0 even if the speed is zero. Signed-off-by: Valentine Barshak --- src/hostinfo.h | 4 ++++ src/icecreammonitor.cc | 8 ++++++++ src/views/flowtableview.cc | 21 ++++++--------------- src/views/flowtableview.h | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/hostinfo.h b/src/hostinfo.h index 0dcbb086..c0525b94 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -47,6 +47,9 @@ class HostInfo void setMaxJobs(unsigned int jobs) { mMaxJobs = jobs; } unsigned int maxJobs() const { return mMaxJobs; } + void incJobs() { mNumJobs++; } + void decJobs() { if (mNumJobs) mNumJobs--; } + unsigned int numJobs() const { return mNumJobs; } void setOffline(bool offline) { mOffline = offline; } bool isOffline() const { return mOffline; } @@ -89,6 +92,7 @@ class HostInfo QString mIp; unsigned int mMaxJobs = 0; + unsigned int mNumJobs = 0; bool mOffline = false; bool mNoRemote = true; diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 82ead60d..3cf1570d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -308,6 +308,10 @@ void IcecreamMonitor::handle_job_begin(Msg *_m) return; } + HostInfo *hostInfo = hostInfoManager()->find(m->hostid); + if (hostInfo) + hostInfo->incJobs(); + (*it).server = m->hostid; (*it).startTime = m->stime; (*it).state = Job::Compiling; @@ -328,6 +332,10 @@ void IcecreamMonitor::handle_job_done(Msg *_m) return; } + HostInfo *hostInfo = hostInfoManager()->find((*it).server); + if (hostInfo) + hostInfo->decJobs(); + (*it).exitcode = m->exitcode; if (m->exitcode) { (*it).state = Job::Failed; diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index 5c201481..bdd0a8e8 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -128,19 +128,12 @@ void FlowTableView::update(const Job &job) // update the host column for the server requesting the job QTableWidgetItem *hostNameItem = m_widget->item(serverRow, 0); - int usageCount = hostNameItem->data(Qt::UserRole).toInt(); - if (job.state == Job::LocalOnly || job.state == Job::Compiling) { - ++usageCount; - } else if (job.state == Job::Finished || job.state == Job::Failed) { - --usageCount; - } - - hostNameItem->setData(Qt::UserRole, usageCount); + HostInfo *hostInfo = hostInfoManager()->find(serverId); QFont f = m_widget->font(); - f.setBold(usageCount > 0); + f.setBold(hostInfo->numJobs() > 0); hostNameItem->setFont(f); - hostNameItem->setText(hostInfoText(hostInfoManager()->find(serverId), usageCount)); + hostNameItem->setText(hostInfoText(hostInfo)); } QWidget *FlowTableView::widget() const @@ -148,11 +141,11 @@ QWidget *FlowTableView::widget() const return m_widget.data(); } -QString FlowTableView::hostInfoText(HostInfo *hostInfo, int runningProcesses) { - if (hostInfo->serverSpeed() == 0) { // host disabled +QString FlowTableView::hostInfoText(HostInfo *hostInfo) { + if ((hostInfo->serverSpeed() == 0) && (hostInfo->numJobs() == 0)) { // host disabled return tr("%1 (Disabled)").arg(hostInfo->name()); } else { - return tr("%1 (%2/%3)").arg(hostInfo->name()).arg(runningProcesses).arg(hostInfo->maxJobs()); + return tr("%1 (%2/%3)").arg(hostInfo->name()).arg(hostInfo->numJobs()).arg(hostInfo->maxJobs()); } } @@ -191,8 +184,6 @@ void FlowTableView::checkNode(unsigned int hostId) widgetItem->setIcon(QIcon(QStringLiteral(":/images/icemonnode.png"))); widgetItem->setToolTip(hostInfo->toolTip()); widgetItem->setBackgroundColor(hostInfo->color()); - // usage count - widgetItem->setData(Qt::UserRole, 0); widgetItem->setFlags(Qt::ItemIsEnabled); int insertRow = m_widget->rowCount(); m_widget->setRowCount(insertRow + 1); diff --git a/src/views/flowtableview.h b/src/views/flowtableview.h index 6d1a7940..789698e0 100644 --- a/src/views/flowtableview.h +++ b/src/views/flowtableview.h @@ -78,7 +78,7 @@ class FlowTableView private: QScopedPointer m_widget; - QString hostInfoText(HostInfo *hostInfo, int runningProcesses = 0); + QString hostInfoText(HostInfo *hostInfo); HostIdRowMap m_idToRowMap; QTimer *m_updateTimer; From 23c9eada1c4b1f2f6da2107fe9d7a87632ebb1ec Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 10 Dec 2018 10:04:22 +0100 Subject: [PATCH 29/77] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 48fd3548..c6035840 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ moc_*.cpp ui_*.h qrc_*.cpp Thumbs.db -*.pro.user* +*.user* # xemacs temporary files # --------------------- From 6b120f3ea8393b89f446446bc26eaf8c5f765bb1 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Mon, 10 Dec 2018 10:03:52 +0100 Subject: [PATCH 30/77] Prepare for 3.2.0 release --- CHANGELOG.md | 11 +++++++++++ CMakeLists.txt | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64f0bd18..e9b2ec61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## 3.2.0 (2018-12-10) + +Bugfixes: + +- Fix broken scheduler discovery with newer Icecream (#40) + +Internal Changes: + +- Add some badges to README.md +- Coding style improvements + ## 3.1.0 (2017-04-07) Features: diff --git a/CMakeLists.txt b/CMakeLists.txt index a3c329cd..40f7b836 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include(FeatureSummary) # version info set(ICEMON_VERSION_MAJOR "3") -set(ICEMON_VERSION_MINOR "1") +set(ICEMON_VERSION_MINOR "2") set(ICEMON_VERSION_PATCH "0") set(ICEMON_VERSION "${ICEMON_VERSION_MAJOR}.${ICEMON_VERSION_MINOR}.${ICEMON_VERSION_PATCH}") set(ICEMON_VERSION_STRING "${ICEMON_VERSION}") From 10b13f88708751f7d49c59a48a7bb5e4f23ee04d Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 23 Dec 2018 00:43:48 +0100 Subject: [PATCH 31/77] RFC: use ECM (#44) * Start requiring ECM Find, and require ECM (extra-cmake-modules) during build, to make use of some of its modules in the future. Bump the distribution used in Travis to Xenial, since Trusty does not have extra-cmake-modules (installed now). * Switch to ECMInstallIcons Use this ECM module to install the application icons, replacing the old copy of a KDE4 cmake module. The names of the icons are adjusted according to the naming scheme of ECMInstallIcons. --- .travis.yml | 4 +- CMakeLists.txt | 6 +- cmake/modules/KDE4Macros-Icecream.cmake | 136 ------------------ src/icemon.qrc | 10 +- ...128-app-icemon.png => 128-apps-icemon.png} | Bin ...hi16-app-icemon.png => 16-apps-icemon.png} | Bin ...hi22-app-icemon.png => 22-apps-icemon.png} | Bin ...hi32-app-icemon.png => 32-apps-icemon.png} | Bin ...hi48-app-icemon.png => 48-apps-icemon.png} | Bin src/images/CMakeLists.txt | 13 +- src/mainwindow.cc | 10 +- 11 files changed, 28 insertions(+), 151 deletions(-) delete mode 100644 cmake/modules/KDE4Macros-Icecream.cmake rename src/images/{hi128-app-icemon.png => 128-apps-icemon.png} (100%) rename src/images/{hi16-app-icemon.png => 16-apps-icemon.png} (100%) rename src/images/{hi22-app-icemon.png => 22-apps-icemon.png} (100%) rename src/images/{hi32-app-icemon.png => 32-apps-icemon.png} (100%) rename src/images/{hi48-app-icemon.png => 48-apps-icemon.png} (100%) diff --git a/.travis.yml b/.travis.yml index 7ca6a4af..0ec333d0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ sudo: required -dist: trusty +dist: xenial language: cpp @@ -9,7 +9,7 @@ compiler: before_install: - sudo apt-get update -qq -- sudo apt-get install -qq cmake qtbase5-dev libicecc-dev +- sudo apt-get install -qq cmake qtbase5-dev libicecc-dev extra-cmake-modules before_script: - cmake --version diff --git a/CMakeLists.txt b/CMakeLists.txt index 40f7b836..2d1e7221 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,16 +2,18 @@ project(icemon) cmake_minimum_required(VERSION 2.8.9) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) +find_package(ECM REQUIRED NO_MODULE) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) include(GNUInstallDirs) -include(KDE4Macros-Icecream) include(CheckIncludeFileCXX) include(FeatureSummary) +include(ECMInstallIcons) # version info set(ICEMON_VERSION_MAJOR "3") diff --git a/cmake/modules/KDE4Macros-Icecream.cmake b/cmake/modules/KDE4Macros-Icecream.cmake deleted file mode 100644 index e9e78bfb..00000000 --- a/cmake/modules/KDE4Macros-Icecream.cmake +++ /dev/null @@ -1,136 +0,0 @@ -# for documentation look at FindKDE4Internal.cmake - -# this file contains the following macros (or functions): -# KDE4_UPDATE_ICONCACHE -# KDE4_INSTALL_ICONS - -# Copyright (c) 2006-2009 Alexander Neundorf, -# Copyright (c) 2006, 2007, Laurent Montel, -# Copyright (c) 2007 Matthias Kretz -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -macro (KDE4_UPDATE_ICONCACHE) - # Update mtime of hicolor icon theme dir. - # We don't always have touch command (e.g. on Windows), so instead create - # and delete a temporary file in the theme dir. - install(CODE " - set(DESTDIR_VALUE \"\$ENV{DESTDIR}\") - if (NOT DESTDIR_VALUE) - file(WRITE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\" \"update\") - file(REMOVE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\") - endif (NOT DESTDIR_VALUE) - ") -endmacro (KDE4_UPDATE_ICONCACHE) - -# a "map" of short type names to the directories -# unknown names should give empty results -# KDE 3 compatibility -set(_KDE4_ICON_GROUP_mime "mimetypes") -set(_KDE4_ICON_GROUP_filesys "places") -set(_KDE4_ICON_GROUP_device "devices") -set(_KDE4_ICON_GROUP_app "apps") -set(_KDE4_ICON_GROUP_action "actions") -# KDE 4 / icon naming specification compatibility -set(_KDE4_ICON_GROUP_mimetypes "mimetypes") -set(_KDE4_ICON_GROUP_places "places") -set(_KDE4_ICON_GROUP_devices "devices") -set(_KDE4_ICON_GROUP_apps "apps") -set(_KDE4_ICON_GROUP_actions "actions") -set(_KDE4_ICON_GROUP_categories "categories") -set(_KDE4_ICON_GROUP_status "status") -set(_KDE4_ICON_GROUP_emblems "emblems") -set(_KDE4_ICON_GROUP_emotes "emotes") -set(_KDE4_ICON_GROUP_animations "animations") -set(_KDE4_ICON_GROUP_intl "intl") - -# a "map" of short theme names to the theme directory -set(_KDE4_ICON_THEME_ox "oxygen") -set(_KDE4_ICON_THEME_cr "crystalsvg") -set(_KDE4_ICON_THEME_lo "locolor") -set(_KDE4_ICON_THEME_hi "hicolor") - - -# only used internally by KDE4_INSTALL_ICONS -macro (_KDE4_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME _l10n_SUBDIR) - - # if the string doesn't match the pattern, the result is the full string, so all three have the same content - if (NOT ${_group} STREQUAL ${_install_NAME} ) - set(_icon_GROUP ${_KDE4_ICON_GROUP_${_group}}) - if(NOT _icon_GROUP) - set(_icon_GROUP "actions") - endif(NOT _icon_GROUP) -# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name} l10n: ${_l10n_SUBDIR}") - install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/${_l10n_SUBDIR}/ RENAME ${_install_NAME} ) - endif (NOT ${_group} STREQUAL ${_install_NAME} ) - -endmacro (_KDE4_ADD_ICON_INSTALL_RULE) - - -macro (KDE4_INSTALL_ICONS _defaultpath ) - - # the l10n-subdir if language given as second argument (localized icon) - set(_lang ${ARGV1}) - if(_lang) - set(_l10n_SUBDIR l10n/${_lang}) - else(_lang) - set(_l10n_SUBDIR ".") - endif(_lang) - - # first the png icons - file(GLOB _icons *.png) - foreach (_current_ICON ${_icons} ) - # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty - string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" _dummy "${_current_ICON}") - set(_type "${CMAKE_MATCH_1}") - set(_size "${CMAKE_MATCH_2}") - set(_group "${CMAKE_MATCH_3}") - set(_name "${CMAKE_MATCH_4}") - - set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) - if( _theme_GROUP) - _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake - ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} - ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) - endif( _theme_GROUP) - endforeach (_current_ICON) - - # mng icons - file(GLOB _icons *.mng) - foreach (_current_ICON ${_icons} ) - # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty - string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" _dummy "${_current_ICON}") - set(_type "${CMAKE_MATCH_1}") - set(_size "${CMAKE_MATCH_2}") - set(_group "${CMAKE_MATCH_3}") - set(_name "${CMAKE_MATCH_4}") - - set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) - if( _theme_GROUP) - _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake - ${_defaultpath}/${_theme_GROUP}/${_size}x${_size} - ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) - endif( _theme_GROUP) - endforeach (_current_ICON) - - # and now the svg icons - file(GLOB _icons *.svgz) - foreach (_current_ICON ${_icons} ) - # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty - string(REGEX MATCH "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" _dummy "${_current_ICON}") - set(_type "${CMAKE_MATCH_1}") - set(_group "${CMAKE_MATCH_2}") - set(_name "${CMAKE_MATCH_3}") - - set(_theme_GROUP ${_KDE4_ICON_THEME_${_type}}) - if( _theme_GROUP) - _KDE4_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake - ${_defaultpath}/${_theme_GROUP}/scalable - ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR}) - endif( _theme_GROUP) - endforeach (_current_ICON) - - kde4_update_iconcache() - -endmacro (KDE4_INSTALL_ICONS) diff --git a/src/icemon.qrc b/src/icemon.qrc index 03bf8122..87c1299f 100644 --- a/src/icemon.qrc +++ b/src/icemon.qrc @@ -1,10 +1,10 @@ - images/hi128-app-icemon.png + images/128-apps-icemon.png images/icemonnode.png - images/hi16-app-icemon.png - images/hi48-app-icemon.png - images/hi22-app-icemon.png - images/hi32-app-icemon.png + images/16-apps-icemon.png + images/48-apps-icemon.png + images/22-apps-icemon.png + images/32-apps-icemon.png diff --git a/src/images/hi128-app-icemon.png b/src/images/128-apps-icemon.png similarity index 100% rename from src/images/hi128-app-icemon.png rename to src/images/128-apps-icemon.png diff --git a/src/images/hi16-app-icemon.png b/src/images/16-apps-icemon.png similarity index 100% rename from src/images/hi16-app-icemon.png rename to src/images/16-apps-icemon.png diff --git a/src/images/hi22-app-icemon.png b/src/images/22-apps-icemon.png similarity index 100% rename from src/images/hi22-app-icemon.png rename to src/images/22-apps-icemon.png diff --git a/src/images/hi32-app-icemon.png b/src/images/32-apps-icemon.png similarity index 100% rename from src/images/hi32-app-icemon.png rename to src/images/32-apps-icemon.png diff --git a/src/images/hi48-app-icemon.png b/src/images/48-apps-icemon.png similarity index 100% rename from src/images/hi48-app-icemon.png rename to src/images/48-apps-icemon.png diff --git a/src/images/CMakeLists.txt b/src/images/CMakeLists.txt index 02e3c9ec..f74a21e0 100644 --- a/src/images/CMakeLists.txt +++ b/src/images/CMakeLists.txt @@ -1 +1,12 @@ -kde4_install_icons(${ICON_INSTALL_DIR}) +set(icons + 128-apps-icemon.png + 16-apps-icemon.png + 22-apps-icemon.png + 32-apps-icemon.png + 48-apps-icemon.png +) +ecm_install_icons( + ICONS ${icons} + DESTINATION ${ICON_INSTALL_DIR} + THEME hicolor +) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 6669af4f..9d289bed 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -62,11 +62,11 @@ MainWindow::MainWindow(QWidget *parent) , m_view(nullptr) { QIcon appIcon = QIcon(); - appIcon.addFile(QStringLiteral(":/images/hi128-app-icemon.png"), QSize(128, 128)); - appIcon.addFile(QStringLiteral(":/images/hi48-app-icemon.png"), QSize(48, 48)); - appIcon.addFile(QStringLiteral(":/images/hi32-app-icemon.png"), QSize(32, 32)); - appIcon.addFile(QStringLiteral(":/images/hi22-app-icemon.png"), QSize(22, 22)); - appIcon.addFile(QStringLiteral(":/images/hi16-app-icemon.png"), QSize(16, 16)); + appIcon.addFile(QStringLiteral(":/images/128-apps-icemon.png"), QSize(128, 128)); + appIcon.addFile(QStringLiteral(":/images/48-apps-icemon.png"), QSize(48, 48)); + appIcon.addFile(QStringLiteral(":/images/32-apps-icemon.png"), QSize(32, 32)); + appIcon.addFile(QStringLiteral(":/images/22-apps-icemon.png"), QSize(22, 22)); + appIcon.addFile(QStringLiteral(":/images/16-apps-icemon.png"), QSize(16, 16)); setWindowIcon(appIcon); setWindowTitle(QApplication::translate("appName", Icemon::Version::appName)); From 206801d4eb531fc7b606d80cfd98e13716a965f4 Mon Sep 17 00:00:00 2001 From: Ahmed Elghoroury Date: Mon, 24 Dec 2018 13:26:10 +0100 Subject: [PATCH 32/77] Update README.md (#45) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d80d1dcb..b01b015c 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ To compile icemon, install, the icecc development package, e.g. for Debian/Ubunt $ apt-get install pkg-config libicecc-dev -Finally, make sure you have g++, Qt and cmake installed +Finally, make sure you have g++, Qt, cmake and ECM installed - $ apt-get install build-essential qtbase5-dev cmake + $ apt-get install build-essential qtbase5-dev cmake extra-cmake-modules Finally, compile and install the application: From 85c0ef8cad247def3ecc7e1d82979e9544a8974e Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 28 Feb 2019 20:08:52 +0100 Subject: [PATCH 33/77] Let CMake manage the project version Bumps the minimum required CMake version to 3.1.0 --- CMakeLists.txt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d1e7221..9a1e7f03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,5 @@ -project(icemon) - -cmake_minimum_required(VERSION 2.8.9) +cmake_minimum_required(VERSION 3.1.0) +project(icemon VERSION 3.2.0) find_package(ECM REQUIRED NO_MODULE) @@ -15,12 +14,7 @@ include(CheckIncludeFileCXX) include(FeatureSummary) include(ECMInstallIcons) -# version info -set(ICEMON_VERSION_MAJOR "3") -set(ICEMON_VERSION_MINOR "2") -set(ICEMON_VERSION_PATCH "0") -set(ICEMON_VERSION "${ICEMON_VERSION_MAJOR}.${ICEMON_VERSION_MINOR}.${ICEMON_VERSION_PATCH}") -set(ICEMON_VERSION_STRING "${ICEMON_VERSION}") +set(ICEMON_VERSION_STRING "${PROJECT_VERSION}") if(EXISTS "${CMAKE_SOURCE_DIR}/.git") find_package(Git) From d5abd17808526be8bfb336a7a222641720237d4e Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 28 Feb 2019 20:15:50 +0100 Subject: [PATCH 34/77] Modernize code a bit, require Qt 5.4 --- CMakeLists.txt | 2 +- src/icecreammonitor.cc | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a1e7f03..a3555c45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git") endif() endif() -set(QT_MIN_VERSION "5.2.0") +set(QT_MIN_VERSION "5.4.0") # Because of QByteArray::fromStdString find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets) find_package(Icecream) set_package_properties(Icecream PROPERTIES diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 5d243397..2203838b 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -43,16 +43,6 @@ using namespace std; -namespace { - -// TODO: Just use QByteArray static methods when depending on Qt 5.4 -inline QByteArray QBA_fromStdString(const std::string& s) -{ return QByteArray(s.data(), int(s.size())); } -inline std::string QBA_toStdString(const QByteArray& s) -{ return std::string(s.constData(), s.length()); } - -} - IcecreamMonitor::IcecreamMonitor(HostInfoManager *manager, QObject *parent) : Monitor(manager, parent) , m_scheduler(nullptr) @@ -122,13 +112,12 @@ void IcecreamMonitor::slotCheckScheduler() if (!qgetenv("USE_SCHEDULER").isEmpty()) { names.push_front(""); // try $USE_SCHEDULER } - for (list::const_iterator it = names.begin(); it != names.end(); - ++it) { - setCurrentNetname(QBA_fromStdString(*it)); + for (auto it = names.begin(); it != names.end(); ++it) { + setCurrentNetname(QByteArray::fromStdString(*it)); if (!m_discover || ((m_scheduler = m_discover->try_get_scheduler()) == NULL && m_discover->timed_out())) { delete m_discover; - m_discover = new DiscoverSched(QBA_toStdString(currentNetname()), 2, hostname); + m_discover = new DiscoverSched(currentNetname().toStdString(), 2, hostname); } if (m_scheduler) { From 2110ce48c10bb032e4f1acbed14ba2545de78c88 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 28 Feb 2019 20:22:29 +0100 Subject: [PATCH 35/77] cmake: Prepare for CMP0025 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3555c45..e453a1c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,11 +60,11 @@ if(DOXYGEN_FOUND) ) endif() -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") endif() -if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") check_cxx_compiler_flag(-Wunused-but-set-variable HAVE_GCC_UNUSED_BUT_SET) check_cxx_compiler_flag(-Wlogical-op HAVE_GCC_LOGICAL_OP) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-noreturn -Werror=return-type -pedantic") From 85adf6e658388c82629be27d1c3a19ae91639d68 Mon Sep 17 00:00:00 2001 From: Daniel d'Andrada Date: Tue, 19 Jun 2018 13:40:40 +0200 Subject: [PATCH 36/77] SummaryView: Remove hardcoded background color Otherwise we will get white text on a white background when a dark theme is used, such as KDE's "Breeze Dark". Fixes #39 --- src/views/summaryview.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 4d9e59df..6ba6ab26 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -274,7 +274,6 @@ SummaryView::SummaryView(QObject *parent) , m_widget(new SummaryViewScrollArea) { m_base = new QWidget; - m_base->setStyleSheet(QStringLiteral("QWidget { background-color: 'white'; }")); m_widget->setWidget(m_base); m_layout = new QGridLayout(m_base); From db207e0adc3cb12f4c4c13a4165c2d27692bc445 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Mon, 20 May 2019 19:30:32 +0200 Subject: [PATCH 37/77] Use QDialogButtonBox for dialogs (#46) Make use of QDialogButtonBox in dialogs, instead of creating Close buttons manually. This makes their look a bit more native. --- src/views/ganttstatusview.cc | 7 ++++--- src/views/starview.cc | 9 +++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 0af5d993..6321ee83 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -40,6 +40,7 @@ #include #include #include +#include GanttConfigDialog::GanttConfigDialog(QWidget *parent) : QDialog(parent) @@ -62,9 +63,9 @@ GanttConfigDialog::GanttConfigDialog(QWidget *parent) buttonLayout->addStretch(1); - QPushButton *button = new QPushButton(tr("&Close"), this); - buttonLayout->addWidget(button); - connect(button, SIGNAL(clicked()), SLOT(hide())); + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); + buttonLayout->addWidget(buttonBox); + connect(buttonBox, SIGNAL(rejected()), SLOT(hide())); setWindowTitle(tr("Configure Gantt View")); // apply some minimum size diff --git a/src/views/starview.cc b/src/views/starview.cc index 26664949..6ef429b8 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include @@ -85,14 +86,14 @@ StarViewConfigDialog::StarViewConfigDialog(QWidget *parent) hline->setFrameShape(QFrame::HLine); hline->setFrameShadow(QFrame::Sunken); topLayout->addWidget(hline); - QPushButton *closeButton = new QPushButton(tr("&Close")); - closeButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - topLayout->addWidget(closeButton, 0, Qt::AlignRight); + + QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); + topLayout->addWidget(buttonBox); connect(mSuppressDomainName, SIGNAL(toggled(bool)), SLOT(slotSuppressDomainName(bool))); - connect(closeButton, SIGNAL(clicked()), SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), SLOT(accept())); } void StarViewConfigDialog::slotNodesPerRingChanged(int nodes) From 98367c38633cc3268a8911c02575711bacfd6f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 12 Jul 2019 18:52:03 +0200 Subject: [PATCH 38/77] make finding icecc pkgconfig file required (#43) --- cmake/modules/FindIcecream.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindIcecream.cmake b/cmake/modules/FindIcecream.cmake index 26040e41..1af7451c 100644 --- a/cmake/modules/FindIcecream.cmake +++ b/cmake/modules/FindIcecream.cmake @@ -27,7 +27,7 @@ else () # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig REQUIRED) - pkg_check_modules(PC_ICECC icecc) + pkg_check_modules(PC_ICECC icecc REQUIRED) # The icecream lib may optionally need linking to -lcap-ng, so dig it out # of pkg-config data. # Somewhat hackish, but I can't find a simpler way to do this with CMake. From c9b6b6bb7bce257a657b27408d68715c10004e73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 18 Jul 2019 15:16:35 +0200 Subject: [PATCH 39/77] make travis build using git icecream instead of ubuntu package It makes sense in general, and #51 actually requires this. --- .travis.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0ec333d0..97d71bb6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,16 +7,32 @@ compiler: - gcc - clang -before_install: -- sudo apt-get update -qq -- sudo apt-get install -qq cmake qtbase5-dev libicecc-dev extra-cmake-modules - before_script: +- | + git clone --depth=50 --branch=master https://github.com/icecc/icecream.git icecream + pushd icecream + autoreconf -fiv + ./configure --prefix=$(pwd) + make install -C services -s -j $(getconf _NPROCESSORS_ONLN) + popd + - cmake --version - qtchooser -run-tool=qmake -qt=qt5 --version - mkdir build - cd build -- cmake .. +- PKG_CONFIG_PATH=../icecream/lib/pkgconfig cmake .. script: make + +addons: + apt: + packages: + - cmake + - qtbase5-dev + - extra-cmake-modules + # for icecream + - libcap-ng-dev + - liblzo2-dev + - libzstd1-dev + - libarchive-dev From 4262348d385ac39f5eeecd48fbc1d2a75e5f2307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 18 Jul 2019 16:01:23 +0200 Subject: [PATCH 40/77] do not create twice the same QSocketNotifier (#47) Apparently Qt can't handle that. --- src/icecreammonitor.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index e8ad9528..86f35a9d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -86,11 +86,18 @@ void IcecreamMonitor::checkScheduler(bool deleteit) void IcecreamMonitor::registerNotify(int fd, QSocketNotifier::Type type, const char *slot) { if (m_fd_notify) { + if(m_fd_notify->socket() != fd || m_fd_notify->type() != type) { + m_fd_notify->disconnect(this); + m_fd_notify->deleteLater(); + m_fd_notify = nullptr; + } + // Reuse, but the slot will change. m_fd_notify->disconnect(this); - m_fd_notify->deleteLater(); } - m_fd_notify = new QSocketNotifier(fd, type, this); - m_fd_type = type; + if (!m_fd_notify) { + m_fd_notify = new QSocketNotifier(fd, type, this); + m_fd_type = type; + } QObject::connect(m_fd_notify, SIGNAL(activated(int)), slot); } From df8d77c12d9fd90f1d3a6752ece642d8535f3f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 28 Jul 2019 11:00:07 +0200 Subject: [PATCH 41/77] uncomment and add few more colors --- src/hostinfo.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/hostinfo.cc b/src/hostinfo.cc index 6e8a63d2..da676d2a 100644 --- a/src/hostinfo.cc +++ b/src/hostinfo.cc @@ -39,6 +39,7 @@ void HostInfo::initColorTable() initColor(QStringLiteral("#db1230"), QApplication::tr("strawberry")); initColor(QStringLiteral("#a6ea5e"), QApplication::tr("apple")); initColor(QStringLiteral("#D6A3D8"), QApplication::tr("bubblegum")); + initColor(QStringLiteral("#f2aa4d"), QApplication::tr("peach")); initColor(QStringLiteral("#aa1387"), QApplication::tr("plum")); initColor(QStringLiteral("#26c3f7"), QApplication::tr("polar sea")); @@ -49,14 +50,17 @@ void HostInfo::initColorTable() initColor(QStringLiteral("#1e1407"), QApplication::tr("mocha")); initColor(QStringLiteral("#29B450"), QApplication::tr("kiwi")); initColor(QStringLiteral("#F8DD31"), QApplication::tr("lemon")); + initColor(QStringLiteral("#fa7e91"), QApplication::tr("raspberry")); initColor(QStringLiteral("#c5a243"), QApplication::tr("caramel")); initColor(QStringLiteral("#b8bcff"), QApplication::tr("blueberry")); + initColor(QStringLiteral("#af3765"), QApplication::tr("blackcurrant")); + initColor(QStringLiteral("#f7d36f"), QApplication::tr("passionfruit")); + initColor(QStringLiteral("#d51013"), QApplication::tr("pomegranate")); + initColor(QStringLiteral("#C2C032"), QApplication::tr("pumpkin")); + initColor(QStringLiteral("#f0e8e3"), QApplication::tr("vanilla")); + initColor(QStringLiteral("#d8e0e3"), QApplication::tr("stracciatella")); // try to make the count a prime number (reminder: 19, 23, 29, 31) - // initColor( "#ffb8c0", QApplication::tr("blackcurrant")); - // initColor( "#f7d36f", QApplication::tr("passionfruit")); - // initColor( "#d51013", QApplication::tr("pomegranate")); - // initColor( "#C2C032", QApplication::tr("pumpkin" ) ); } void HostInfo::initColor(const QString &value, const QString &name) From e22a5eff7618ea58512bba2d1f92cda4beb613df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 28 Jul 2019 11:29:29 +0200 Subject: [PATCH 42/77] better column widths in views The Qt default of having the last column stretch was a rather poor result here, e.g. with the filename column not being large enough to show the data while the last size-out column was needlessly taking a lot of space. --- src/views/flowtableview.cc | 1 + src/views/hostlistview.cc | 10 ++++++++-- src/views/joblistview.cc | 7 +++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index bdd0a8e8..d4130d1a 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -83,6 +83,7 @@ FlowTableView::FlowTableView(QObject *parent) labels << tr("Host") << tr("File") << tr("History") << tr("State"); m_widget->setHorizontalHeaderLabels(labels); m_widget->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); + m_widget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); m_widget->verticalHeader()->hide(); m_widget->setSelectionMode(QAbstractItemView::NoSelection); diff --git a/src/views/hostlistview.cc b/src/views/hostlistview.cc index 1c83b1d6..6b66cfc2 100644 --- a/src/views/hostlistview.cc +++ b/src/views/hostlistview.cc @@ -23,6 +23,8 @@ #include "models/hostlistmodel.h" +#include + HostListView::HostListView(QWidget *parent) : QTreeView(parent) { @@ -34,9 +36,13 @@ HostListView::HostListView(QWidget *parent) void HostListView::setModel(QAbstractItemModel *model) { + QTreeView::setModel(model); if (model) { sortByColumn(HostListModel::ColumnID); + header()->setStretchLastSection(false); + header()->setSectionResizeMode(HostListModel::ColumnName, QHeaderView::Stretch); + header()->setSectionResizeMode(HostListModel::ColumnColor, QHeaderView::ResizeToContents); + header()->setSectionResizeMode(HostListModel::ColumnIP, QHeaderView::ResizeToContents); + header()->setSectionResizeMode(HostListModel::ColumnPlatform, QHeaderView::ResizeToContents); } - - QTreeView::setModel(model); } diff --git a/src/views/joblistview.cc b/src/views/joblistview.cc index 8098df19..fea9e9bb 100644 --- a/src/views/joblistview.cc +++ b/src/views/joblistview.cc @@ -44,11 +44,14 @@ JobListModel *JobListView::jobListModel() const void JobListView::setModel(QAbstractItemModel *model) { + QTreeView::setModel(model); if (model) { sortByColumn(JobListModel::JobColumnID); + header()->setStretchLastSection(false); + header()->setSectionResizeMode(JobListModel::JobColumnFilename, QHeaderView::Stretch); + header()->setSectionResizeMode(JobListModel::JobColumnClient, QHeaderView::ResizeToContents); + header()->setSectionResizeMode(JobListModel::JobColumnServer, QHeaderView::ResizeToContents); } - - QTreeView::setModel(model); } bool JobListView::isClientColumnVisible() const From e6751d516d591b6b7a73eedcd9c77aa14fe80eaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 1 Sep 2019 21:21:55 +0200 Subject: [PATCH 43/77] display also node protocol version and features in detailed host view This should be useful when checking if there are old nodes or ones that do not support e.g. xz tarball compression. The telnet interface provides this info, but icemon is more known and easier to use. --- src/fakemonitor.cc | 4 ++++ src/hostinfo.cc | 2 ++ src/hostinfo.h | 9 ++++++++- src/models/hostlistmodel.cc | 10 ++++++++++ src/models/hostlistmodel.h | 2 ++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index ffa1a8a0..20afd4b7 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -29,6 +29,8 @@ #include #include +#include + namespace { // counter variable int JOB_ID = 0; @@ -83,6 +85,8 @@ void FakeMonitor::createHostInfo(HostId id) info.setOffline(false); info.setNoRemote(false); info.setPlatform(randomPlatform()); + info.setProtocol(PROTOCOL_VERSION); + info.setFeatures(id % 2 == 0 ? QStringLiteral("env_xz") : QStringLiteral("env_zstd")); info.setServerLoad(1.0); info.setServerSpeed(10); hostInfoManager()->checkNode(info); diff --git a/src/hostinfo.cc b/src/hostinfo.cc index da676d2a..38f78b05 100644 --- a/src/hostinfo.cc +++ b/src/hostinfo.cc @@ -112,6 +112,8 @@ void HostInfo::updateFromStatsMap(const StatsMap &stats) mColor = createColor(mName); mIp = stats[QStringLiteral("IP")]; mPlatform = stats[QStringLiteral("Platform")]; + mProtocol = stats[QStringLiteral("Version")].toInt(); + mFeatures = stats[QStringLiteral("Features")]; } mNoRemote = (stats[QStringLiteral("NoRemote")].compare(QLatin1String("true"), Qt::CaseInsensitive) == 0); diff --git a/src/hostinfo.h b/src/hostinfo.h index c0525b94..684d5d64 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -69,6 +69,12 @@ class HostInfo void setServerLoad(unsigned int load) { mServerLoad = load; } unsigned int serverLoad() const { return mServerLoad; } + void setProtocol(unsigned int protocol) { mProtocol = protocol; } + int protocol() const { return mProtocol; } + + void setFeatures(const QString& features) { mFeatures = features; } + QString features() const { return mFeatures; } + QString toolTip() const; bool operator==(const HostInfo &rhs) const { return mId == rhs.mId; } @@ -95,9 +101,10 @@ class HostInfo unsigned int mNumJobs = 0; bool mOffline = false; bool mNoRemote = true; + int mProtocol = 0; + QString mFeatures; float mServerSpeed = 0.0; - unsigned int mServerLoad = 0; static QVector mColorTable; diff --git a/src/models/hostlistmodel.cc b/src/models/hostlistmodel.cc index 72d3b16b..38ec20f7 100644 --- a/src/models/hostlistmodel.cc +++ b/src/models/hostlistmodel.cc @@ -76,6 +76,10 @@ QVariant HostListModel::headerData(int section, Qt::Orientation orientation, int return tr("IP"); case ColumnPlatform: return tr("Platform"); + case ColumnProtocol: + return tr("Protocol"); + case ColumnFeatures: + return tr("Features"); case ColumnMaxJobs: return tr("Max Jobs"); case ColumnSpeed: @@ -114,6 +118,10 @@ QVariant HostListModel::data(const QModelIndex &index, int role) const return info.ip(); case ColumnPlatform: return info.platform(); + case ColumnProtocol: + return info.protocol() > 0 ? QString::number(info.protocol()) : QStringLiteral("?"); + case ColumnFeatures: + return info.features().isEmpty() ? QStringLiteral( " - " ) : info.features(); case ColumnMaxJobs: return info.maxJobs(); case ColumnSpeed: @@ -129,6 +137,8 @@ QVariant HostListModel::data(const QModelIndex &index, int role) const return Qt::AlignRight; case ColumnNoRemote: return Qt::AlignCenter; + case ColumnProtocol: + return Qt::AlignRight; case ColumnMaxJobs: return Qt::AlignRight; case ColumnSpeed: diff --git a/src/models/hostlistmodel.h b/src/models/hostlistmodel.h index 35176d60..aa1521ec 100644 --- a/src/models/hostlistmodel.h +++ b/src/models/hostlistmodel.h @@ -43,6 +43,8 @@ class HostListModel ColumnColor, ColumnIP, ColumnPlatform, + ColumnProtocol, + ColumnFeatures, ColumnMaxJobs, ColumnSpeed, ColumnLoad, From dc5a6810015230d44a6d21d4dd16db28e2b8d95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 1 Sep 2019 21:28:25 +0200 Subject: [PATCH 44/77] set development version (3.2.90) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e453a1c4..617151d0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1.0) -project(icemon VERSION 3.2.0) +project(icemon VERSION 3.2.90) find_package(ECM REQUIRED NO_MODULE) From c4d6145f15572a1adb63e0879243f83d8d811708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 1 Sep 2019 21:38:51 +0200 Subject: [PATCH 45/77] add 'make dist' Sort of, it packages e.g. .gitignore, which it shouldn't. Based on https://agateau.com/2009/cmake-and-make-dist-the-simple-version/ . --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 617151d0..82b9c762 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,3 +134,9 @@ add_subdirectory(src) add_subdirectory(doc) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) +add_custom_target(dist + COMMAND git archive --prefix=${ARCHIVE_NAME}/ HEAD + | xz -T0 > ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.xz + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) From 7e0151c6751b995ef5479fcd9ba02e3fa20bcbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 1 Sep 2019 21:48:18 +0200 Subject: [PATCH 46/77] fix -Wreorder warning --- src/views/flowtableview.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index d4130d1a..edd35a50 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -75,8 +75,8 @@ void ProgressWidget::resizeEvent(QResizeEvent *) { FlowTableView::FlowTableView(QObject *parent) : StatusView(parent) - , m_updateTimer(new QTimer) , m_widget(new QTableWidget) + , m_updateTimer(new QTimer) { m_widget->setColumnCount(4); QStringList labels; From cf89c78183f05c4e77b0fac8497ebc9c3f730ca8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Sun, 28 Jul 2019 12:05:03 +0200 Subject: [PATCH 47/77] remove commented out file that's been removed --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce667764..a54836dc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,6 @@ set(icemon_SRCS views/hostlistview.cc views/joblistview.cc views/listview.cc - #views/poolview.cc views/starview.cc views/summaryview.cc ) From 56d5a7c2be359ddeac945b6ac01c5dc1b84eb891 Mon Sep 17 00:00:00 2001 From: Raphael Grimm Date: Tue, 5 Mar 2019 19:12:31 +0100 Subject: [PATCH 48/77] Add cli option to specify the scheduler port --- src/icecreammonitor.cc | 3 ++- src/main.cc | 8 ++++++++ src/mainwindow.cc | 5 +++++ src/mainwindow.h | 1 + src/monitor.cc | 10 ++++++++++ src/monitor.h | 4 ++++ 6 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 86f35a9d..d1110c88 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -109,6 +109,7 @@ void IcecreamMonitor::slotCheckScheduler() const string hostname = currentSchedname().isEmpty() ? "" : currentSchedname().data(); list names; + const uint port = currentSchedport(); if (!currentNetname().isEmpty()) { names.push_front(currentNetname().data()); @@ -124,7 +125,7 @@ void IcecreamMonitor::slotCheckScheduler() if (!m_discover || ((m_scheduler = m_discover->try_get_scheduler()) == NULL && m_discover->timed_out())) { delete m_discover; - m_discover = new DiscoverSched(currentNetname().toStdString(), 2, hostname); + m_discover = new DiscoverSched(currentNetname().toStdString(), 2, hostname, port); } if (m_scheduler) { diff --git a/src/main.cc b/src/main.cc index db8b8039..0d906997 100644 --- a/src/main.cc +++ b/src/main.cc @@ -47,6 +47,10 @@ int main(int argc, char **argv) QCoreApplication::translate("main", "Icecream scheduler hostname"), QCoreApplication::translate("main", "hostname", "scheduler hostname")); parser.addOption(schednameOption); + QCommandLineOption schedportOption(QStringList() << QStringLiteral("p") << QStringLiteral("port"), + QCoreApplication::translate("main", "Icecream scheduler port"), + QCoreApplication::translate("main", "port", "scheduler port")); + parser.addOption(schedportOption); QCommandLineOption testmodeOption(QStringLiteral("testmode"), QCoreApplication::translate("main", "Testing mode.")); parser.addOption(testmodeOption); @@ -63,6 +67,10 @@ int main(int argc, char **argv) if (!schedName.isEmpty()) { mainWindow.setCurrentSched(schedName); } + if (!parser.value(schedportOption).isEmpty()) + { + mainWindow.setCurrentPort(parser.value(schedportOption).toUInt()); + } if (parser.isSet(testmodeOption)) { mainWindow.setTestModeEnabled(true); } diff --git a/src/mainwindow.cc b/src/mainwindow.cc index c7b3da72..59728c02 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -364,6 +364,11 @@ void MainWindow::setCurrentSched(const QByteArray &schedname) m_monitor->setCurrentSchedname(schedname); } +void MainWindow::setCurrentPort(uint schedport) +{ + m_monitor->setCurrentSchedport(schedport); +} + void MainWindow::handleViewModeActionTriggered(QAction *action) { const QString viewId = action->data().toString(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 3e81ba7a..1c11970d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -47,6 +47,7 @@ class MainWindow void setCurrentNet(const QByteArray &netname); void setCurrentSched(const QByteArray &schedname); + void setCurrentPort(uint schedport); Monitor *monitor() const; StatusView *view() const; diff --git a/src/monitor.cc b/src/monitor.cc index 9fa340e8..8c0b3711 100644 --- a/src/monitor.cc +++ b/src/monitor.cc @@ -26,6 +26,7 @@ Monitor::Monitor(HostInfoManager *manager, QObject *parent) : QObject(parent) , m_hostInfoManager(manager) , m_schedulerState(Offline) + , m_currentSchedport(0) { } @@ -49,6 +50,15 @@ void Monitor::setCurrentSchedname(const QByteArray &schedname) m_currentSchedname = schedname; } +uint Monitor::currentSchedport() const +{ + return m_currentSchedport; +} +void Monitor::setCurrentSchedport(uint port) +{ + m_currentSchedport = port; +} + Monitor::SchedulerState Monitor::schedulerState() const { return m_schedulerState; diff --git a/src/monitor.h b/src/monitor.h index 4ef7c791..90050dcd 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -54,6 +54,9 @@ public QByteArray currentSchedname() const; void setCurrentSchedname(const QByteArray &); + uint currentSchedport() const; + void setCurrentSchedport(uint port); + SchedulerState schedulerState() const; virtual QList jobHistory() const; @@ -74,6 +77,7 @@ public HostInfoManager *m_hostInfoManager; QByteArray m_currentNetname; QByteArray m_currentSchedname; + uint m_currentSchedport; SchedulerState m_schedulerState; }; From dc5a456a345240adae5715f7d667565af3cb459b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 5 Sep 2019 22:17:57 +0200 Subject: [PATCH 49/77] 3.3.0 NEWS --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b2ec61..184e82e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +## 3.3.0 (?) + +Features: +- Display node protocol version and features in detailed host view +- Several more icecream flavors added +- Add --port option to specify the scheduler port + +Bugfixes: +- Remote hardcoded background color (#39) +- Fix data loss when switching views +- Avoid a possible QSocketNotifier crash (#47) +- Improve column widths in views + +Internal Changes: +- Require extra-cmake-modules for building +- Fix finding icecc pkgconfig file + ## 3.2.0 (2018-12-10) Bugfixes: From 04b143fca284b0c2bc0c747a31ed36612f528eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Mon, 9 Sep 2019 18:42:39 +0200 Subject: [PATCH 50/77] require icecream >= 1.3 for building This is required by at least 56d5a7c2be359ddeac945b6ac01c5dc1b84eb891. --- cmake/modules/FindIcecream.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/modules/FindIcecream.cmake b/cmake/modules/FindIcecream.cmake index 1af7451c..43af6c77 100644 --- a/cmake/modules/FindIcecream.cmake +++ b/cmake/modules/FindIcecream.cmake @@ -27,7 +27,7 @@ else () # use pkg-config to get the directories and then use these values # in the FIND_PATH() and FIND_LIBRARY() calls find_package(PkgConfig REQUIRED) - pkg_check_modules(PC_ICECC icecc REQUIRED) + pkg_check_modules(PC_ICECC icecc>=1.3 REQUIRED) # The icecream lib may optionally need linking to -lcap-ng, so dig it out # of pkg-config data. # Somewhat hackish, but I can't find a simpler way to do this with CMake. From ea144ffd51338ef4e26146854ca5788b9a05cc89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 11 Sep 2019 18:50:53 +0200 Subject: [PATCH 51/77] 3.3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 82b9c762..ff033d86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1.0) -project(icemon VERSION 3.2.90) +project(icemon VERSION 3.3) find_package(ECM REQUIRED NO_MODULE) From 5b0cef4498283f7bcb05d448c1bebe4cb9296283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 11 Sep 2019 19:37:46 +0200 Subject: [PATCH 52/77] add date to 3.3 release in the changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 184e82e6..4a7cfdce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 3.3.0 (?) +## 3.3.0 (2019-09-11) Features: - Display node protocol version and features in detailed host view From f936e9d93ea71c83fbba41b3612f3408ae22b21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 12 Sep 2019 16:44:18 +0200 Subject: [PATCH 53/77] fix a -Wreorder warning --- CMakeLists.txt | 2 +- src/monitor.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff033d86..10c2b825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,7 +67,7 @@ endif() if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") check_cxx_compiler_flag(-Wunused-but-set-variable HAVE_GCC_UNUSED_BUT_SET) check_cxx_compiler_flag(-Wlogical-op HAVE_GCC_LOGICAL_OP) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wextra -Woverloaded-virtual -Winit-self -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-noreturn -Werror=return-type -pedantic") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wall -Wextra -Woverloaded-virtual -Winit-self -Wmissing-include-dirs -Wunused -Wno-div-by-zero -Wundef -Wpointer-arith -Wcast-qual -Wcast-align -Wmissing-noreturn -Werror=return-type -pedantic") if(HAVE_GCC_UNUSED_BUT_SET) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wunused-but-set-variable") endif() diff --git a/src/monitor.cc b/src/monitor.cc index 8c0b3711..8b78c0d5 100644 --- a/src/monitor.cc +++ b/src/monitor.cc @@ -25,8 +25,8 @@ Monitor::Monitor(HostInfoManager *manager, QObject *parent) : QObject(parent) , m_hostInfoManager(manager) - , m_schedulerState(Offline) , m_currentSchedport(0) + , m_schedulerState(Offline) { } From 479490ffbe0d13ed3059b67241671cb78521a10a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Tue, 28 Jul 2020 16:34:03 +0200 Subject: [PATCH 54/77] use asciidoc for manpages, instead of docbook This is the same like the matching Icecream commit. --- .travis.yml | 8 ++- CMakeLists.txt | 22 ------- cmake/modules/FindDocbook2X.cmake | 97 ------------------------------- doc/CMakeLists.txt | 25 +++++++- doc/icemon.adoc | 54 +++++++++++++++++ doc/man-icemon.1.xml | 93 ----------------------------- 6 files changed, 83 insertions(+), 216 deletions(-) delete mode 100644 cmake/modules/FindDocbook2X.cmake create mode 100644 doc/icemon.adoc delete mode 100644 doc/man-icemon.1.xml diff --git a/.travis.yml b/.travis.yml index 97d71bb6..838d0bf5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,9 +21,11 @@ before_script: - mkdir build - cd build -- PKG_CONFIG_PATH=../icecream/lib/pkgconfig cmake .. +- PKG_CONFIG_PATH=../icecream/lib/pkgconfig cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/_inst -script: make +script: +- make +- make install addons: apt: @@ -31,6 +33,8 @@ addons: - cmake - qtbase5-dev - extra-cmake-modules + - asciidoc + - xsltproc # for asciidoc # for icecream - libcap-ng-dev - liblzo2-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 10c2b825..6be47d37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,28 +37,6 @@ set_package_properties(Icecream PROPERTIES URL "http://en.opensuse.org/Icecream" TYPE REQUIRED ) -find_package(Docbook2X) -set_package_properties(Docbook2X PROPERTIES - DESCRIPTION "docbook2X converts DocBook documents into the traditional Unix man page format" - PURPOSE "Required for man-page generation" - URL "http://docbook2x.sourceforge.net/" -) - -# add a target to generate API documentation with Doxygen -find_package(Doxygen) -set_package_properties(Doxygen PROPERTIES - TYPE OPTIONAL - DESCRIPTION "Doxygen documentation generator" - PURPOSE "Needed for generating API documentation (make doc)" -) -if(DOXYGEN_FOUND) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - add_custom_target(doc - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" VERBATIM - ) -endif() if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") diff --git a/cmake/modules/FindDocbook2X.cmake b/cmake/modules/FindDocbook2X.cmake deleted file mode 100644 index 81d9f7a5..00000000 --- a/cmake/modules/FindDocbook2X.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# Attempt to find docbook-to-man binary from docbook2x package -# -# This module defines: -# - DOCBOOK_TO_MAN_EXECUTABLE, path to docbook2x-man binary -# -# Note that the binary docbook-to-man in debian systems is a different application -# than in other distributions. -# -# Debian systems -# * docbook-to-man comes from the package docbook-to-man -# * docbook2man comes from the package docbook-utils -# * docbook2x-man comes from the package docbook2x -# Suse -# * docbook-to-man comes from the package docbook2x -# * docbook2man comes from the package docbook-utils-minimal -# ArchLinux -# * docbook-to-man comes from the package docbook-to-man -# * docbook2man comes from the package docbook2x -# -# We actually want the binary from docbook2x, which supports XML - -#============================================================================= -# Copyright 2013 Kevin Funk -# Copyright 2015 Alex Merry -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= - -macro(_check_docbook2x_executable) - if (DOCBOOK_TO_MAN_EXECUTABLE) - execute_process( - COMMAND ${DOCBOOK_TO_MAN_EXECUTABLE} --version - OUTPUT_VARIABLE _output - ERROR_QUIET - ) - if("${_output}" MATCHES "docbook2X ([0-9]+\\.[0-9]+\\.[0-9]+)") - set(DOCBOOK_TO_MAN_EXECUTABLE ${_docbook_to_man_executable}) - set(Docbook2X_VERSION ${CMAKE_MATCH_1}) - else() - unset(DOCBOOK_TO_MAN_EXECUTABLE) - unset(DOCBOOK_TO_MAN_EXECUTABLE CACHE) - endif() - endif() -endmacro() - -if (DOCBOOK_TO_MAN_EXECUTABLE) - _check_docbook2x_executable() -else() - foreach(test_exec docbook2x-man docbook-to-man db2x_docbook2man docbook2man) - find_program(DOCBOOK_TO_MAN_EXECUTABLE - NAMES ${test_exec} - ) - _check_docbook2x_executable() - if (DOCBOOK_TO_MAN_EXECUTABLE) - break() - endif() - endforeach() -endif() - -include(FindPackageHandleStandardArgs) - -find_package_handle_standard_args(Docbook2X -# TODO: Use FOUND_VAR when requiring CMake 2.8.11 -# FOUND_VAR Docbook2X_FOUND - REQUIRED_VARS DOCBOOK_TO_MAN_EXECUTABLE - VERSION_VAR Docbook2X_VERSION -) -set(Docbook2X_FOUND DOCBOOK2X_FOUND) - -if (Docbook2X_FOUND) - macro(install_docbook_man_page name section) - set(inputfn "man-${name}.${section}.xml") - set(input "${CMAKE_CURRENT_SOURCE_DIR}/${inputfn}") - set(outputfn "${name}.${section}") - set(output "${CMAKE_CURRENT_BINARY_DIR}/${outputfn}") - set(target "manpage-${outputfn}") - - add_custom_command( - OUTPUT ${output} - COMMAND ${DOCBOOK_TO_MAN_EXECUTABLE} ${input} - DEPENDS ${input} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - ) - add_custom_target(${target} ALL - DEPENDS "${output}" - ) - install( - FILES ${output} - DESTINATION ${CMAKE_INSTALL_MANDIR}/man${section} - ) - endmacro() -endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 4e83c15f..8138dfe0 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,6 +1,27 @@ # It's not possible to install the docbook right now (Qt-only project) #add_subdirectory(icemon) -if(DOCBOOK_TO_MAN_EXECUTABLE) - install_docbook_man_page(icemon 1) +find_program(ASCIIDOC asciidoc) +find_program(A2X a2x) + +if(NOT ASCIIDOC OR NOT A2X) + message(WARNING "Could not find asciidoc or a2x, manual page will not be generated.") +else() + add_custom_target(manpage ALL) + add_custom_command( + TARGET manpage + COMMAND ${ASCIIDOC} -a revnumber=${PROJECT_VERSION} -d manpage -b docbook + -o ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml ${CMAKE_CURRENT_SOURCE_DIR}/icemon.adoc + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/icemon.adoc + BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml) + add_custom_command( + TARGET manpage + COMMAND ${A2X} --doctype manpage --format manpage + ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml + BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/icemon.1) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/icemon.1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1) endif() diff --git a/doc/icemon.adoc b/doc/icemon.adoc new file mode 100644 index 00000000..7a233892 --- /dev/null +++ b/doc/icemon.adoc @@ -0,0 +1,54 @@ +ICEMON(1) +========= +:doctype: manpage +:man source: icemon +:man version: {revnumber} +:man manual: Icemon User's Manual + + +Name +---- +icemon - Icecream network monitor + + +Synopsis +-------- +*icemon* _OPTION_ + + +Description +----------- +Icemon is a graphical application to view an Icecream compile network and monitor its traffic. + + + +Options +------- + +*-h, --help*:: + Print help message and exit. + +*-n, --netname* _net-name_:: + The name of the Icecream network `icemon` should connect to. + +*-s, --scheduler* _host-name_:: + The hostname of the Icecream scheduler `icemon` should connect to. + + + +See Also +-------- +ifdef::env-github[] +link:https://github.com/icecc/icecream/tree/master/doc/icecream.adoc[icecream(7)] +link:https://github.com/icecc/icecream/tree/master/doc/icecc-scheduler.adoc[icecc-scheduler(1)] +link:https://github.com/icecc/icecream/tree/master/doc/iceccd.adoc[iceccd(1)] +endif::[] + +ifndef::env-github[] +icecream(7), icecc-scheduler(1), iceccd(1) +endif::[] + + +Website +------- +Project home: https://github.com/icecc/icemon diff --git a/doc/man-icemon.1.xml b/doc/man-icemon.1.xml deleted file mode 100644 index 66cb6d81..00000000 --- a/doc/man-icemon.1.xml +++ /dev/null @@ -1,93 +0,0 @@ - - -icemon"> -]> - - - - - Codestin Search App - - - Pino - Toscano - - - June 12th, 2013 - Icecream - - - - icemon - 1 - - - - icemon - Icecream network monitor - - - - -icemon -OPTION - - - - -Codestin Search App -&icemon; is a graphical application to view an Icecream compile -network and monitor its traffic. - - - -Codestin Search App - - - - -, -Print help message and exit. - - - -, -net-name -The name of the Icecream network &icemon; should connect to. - - - - - -, -host-name -The hostname of the Icecream scheduler &icemon; should connect to. - - - - - - - - - -Codestin Search App -icecream(7), icecc-scheduler(1), iceccd(1) - - - -Codestin Search App - -Daniel Molkentin <molkentin@kde.org> -Kevin Funk <kfunk@kde.org> - - - - -Codestin Search App -Project home: https://github.com/icecc/icemon - - - From b07bf3eb0c28ac5cd527d3ab675d2273d1866b48 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 28 Apr 2025 03:39:49 +0100 Subject: [PATCH 55/77] Fix build with CMake 4.0 Newer CMake doesn't support such old minimum version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6be47d37..e149f84a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1.0) +cmake_minimum_required(VERSION 3.10.0) project(icemon VERSION 3.3) find_package(ECM REQUIRED NO_MODULE) From d0969453c7d4467e22dcff0f218b31e81136afbe Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 28 Apr 2025 04:16:40 +0100 Subject: [PATCH 56/77] Port to Qt 6 For issue #71 --- CMakeLists.txt | 9 ++++----- src/CMakeLists.txt | 4 ++-- src/fakemonitor.cc | 13 ++++++------- src/icecreammonitor.cc | 5 +++-- src/mainwindow.cc | 1 + src/models/joblistmodel.cc | 4 ++-- src/views/detailedhostview.cc | 8 ++++---- src/views/flowtableview.cc | 4 ++-- src/views/ganttstatusview.cc | 18 +++++++++--------- src/views/hostlistview.cc | 2 +- src/views/joblistview.cc | 2 +- src/views/listview.cc | 2 +- src/views/starview.cc | 6 +++--- src/views/summaryview.cc | 10 +++++----- 14 files changed, 44 insertions(+), 44 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e149f84a..e3b22611 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,8 +29,8 @@ if(EXISTS "${CMAKE_SOURCE_DIR}/.git") endif() endif() -set(QT_MIN_VERSION "5.4.0") # Because of QByteArray::fromStdString -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets) +set(QT_MIN_VERSION "6.2.0") +find_package(Qt6 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets) find_package(Icecream) set_package_properties(Icecream PROPERTIES DESCRIPTION "Package providing API for accessing icecc information. Provides 'icecc/comm.h' header" @@ -38,9 +38,8 @@ set_package_properties(Icecream PROPERTIES TYPE REQUIRED ) -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -endif() +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) if(CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") check_cxx_compiler_flag(-Wunused-but-set-variable HAVE_GCC_UNUSED_BUT_SET) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a54836dc..04725b38 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,11 +25,11 @@ set(icemon_SRCS views/summaryview.cc ) -qt5_add_resources(resources_SRCS icemon.qrc) +qt_add_resources(resources_SRCS icemon.qrc) add_executable(icemon ${icemon_SRCS} ${resources_SRCS}) target_link_libraries(icemon Icecream - Qt5::Widgets + Qt6::Widgets ) install(TARGETS icemon ${INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index 20afd4b7..ed2265dc 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -54,7 +55,7 @@ const QStringList HOST_NAMES(QStringList() QString randomPlatform() { static const QStringList hostNames = {QStringLiteral("Linux 2.6"), QStringLiteral("Linux 3.2"), QStringLiteral("Linux 3.6")}; - return hostNames[qrand() % hostNames.size()]; + return hostNames[QRandomGenerator::global()->generate() % hostNames.size()]; } } @@ -71,8 +72,6 @@ FakeMonitor::FakeMonitor(HostInfoManager *manager, QObject *parent) for (HostId i = 0; i < MAX_HOST_COUNT; ++i) { createHostInfo(i + 1); } - - qsrand(QTime::currentTime().msec()); } void FakeMonitor::createHostInfo(HostId id) @@ -102,10 +101,10 @@ void FakeMonitor::update() time(&rawtime); job.startTime = rawtime; job.state = Job::Compiling; - job.in_compressed = qrand() % MAX_JOB_SIZE * 0.75; // random factor - job.in_uncompressed = qrand() % MAX_JOB_SIZE; - job.in_compressed = qrand() % MAX_JOB_SIZE ; - job.in_uncompressed = qrand() % MAX_JOB_SIZE * 0.75; // random factor + job.in_compressed = QRandomGenerator::global()->generate() % MAX_JOB_SIZE * 0.75; // random factor + job.in_uncompressed = QRandomGenerator::global()->generate() % MAX_JOB_SIZE; + job.in_compressed = QRandomGenerator::global()->generate() % MAX_JOB_SIZE ; + job.in_uncompressed = QRandomGenerator::global()->generate() % MAX_JOB_SIZE * 0.75; // random factor job.real_msec = 200; const int serverId = ((JOB_ID + 1) % MAX_HOST_COUNT) + 1; job.server = serverId; diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index d1110c88..cdd7213d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -80,7 +81,7 @@ void IcecreamMonitor::checkScheduler(bool deleteit) } else if (m_scheduler) { return; } - QTimer::singleShot(1000 + (qrand() & 1023), this, SLOT(slotCheckScheduler())); // TODO: check if correct + QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, SLOT(slotCheckScheduler())); // TODO: check if correct } void IcecreamMonitor::registerNotify(int fd, QSocketNotifier::Type type, const char *slot) @@ -157,7 +158,7 @@ void IcecreamMonitor::slotCheckScheduler() QSocketNotifier::Read, SLOT(slotCheckScheduler())); } if (m_fd_type == QSocketNotifier::Read) { - QTimer::singleShot(1000 + (qrand() & 1023), this, SLOT(slotCheckScheduler())); + QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, SLOT(slotCheckScheduler())); } } diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 59728c02..7c4b2db5 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index 5123b85c..c69a9e1e 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -281,7 +281,7 @@ struct find_jobid void JobListModel::slotExpireFinishedJobs() { - const uint currentTime = QDateTime::currentDateTime().toTime_t(); + const uint currentTime = QDateTime::currentDateTime().toSecsSinceEpoch(); // this list is sorted by the age of the finished jobs, the oldest is the first // so we've to find the first job which isn't old enough to expire @@ -323,7 +323,7 @@ void JobListModel::expireItem(const Job &job) return; } - const uint currentTime = QDateTime::currentDateTime().toTime_t(); + const uint currentTime = QDateTime::currentDateTime().toSecsSinceEpoch(); m_finishedJobs.push_back(FinishedJob(currentTime, job.id)); if (!m_expireTimer->isActive()) { diff --git a/src/views/detailedhostview.cc b/src/views/detailedhostview.cc index 91be0a6a..197c23f5 100644 --- a/src/views/detailedhostview.cc +++ b/src/views/detailedhostview.cc @@ -49,7 +49,7 @@ DetailedHostView::DetailedHostView(QObject *parent) , m_widget(new QWidget) { QBoxLayout *topLayout = new QVBoxLayout(m_widget.data()); - topLayout->setMargin(10); + topLayout->setContentsMargins({10, 10, 10, 10}); auto viewSplitter = new QSplitter(Qt::Vertical); topLayout->addWidget(viewSplitter); @@ -57,7 +57,7 @@ DetailedHostView::DetailedHostView(QObject *parent) auto hosts = new QWidget(viewSplitter); auto dummy = new QVBoxLayout(hosts); dummy->setSpacing(10); - dummy->setMargin(0); + dummy->setContentsMargins({}); mHostListModel = new HostListModel(this); @@ -75,7 +75,7 @@ DetailedHostView::DetailedHostView(QObject *parent) auto locals = new QWidget(viewSplitter); dummy = new QVBoxLayout(locals); dummy->setSpacing(10); - dummy->setMargin(0); + dummy->setContentsMargins({}); mLocalJobsModel = new JobListModel(this); mLocalJobsModel->setExpireDuration(5); @@ -93,7 +93,7 @@ DetailedHostView::DetailedHostView(QObject *parent) auto remotes = new QWidget(viewSplitter); dummy = new QVBoxLayout(remotes); dummy->setSpacing(10); - dummy->setMargin(0); + dummy->setContentsMargins({}); mRemoteJobsModel = new JobListModel(this); mRemoteJobsModel->setExpireDuration(5); diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index edd35a50..db9514c9 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -184,14 +184,14 @@ void FlowTableView::checkNode(unsigned int hostId) QTableWidgetItem *widgetItem = new QTableWidgetItem(hostInfoText(hostInfo)); widgetItem->setIcon(QIcon(QStringLiteral(":/images/icemonnode.png"))); widgetItem->setToolTip(hostInfo->toolTip()); - widgetItem->setBackgroundColor(hostInfo->color()); + widgetItem->setBackground(hostInfo->color()); widgetItem->setFlags(Qt::ItemIsEnabled); int insertRow = m_widget->rowCount(); m_widget->setRowCount(insertRow + 1); m_idToRowMap.insert(hostId, insertRow); m_widget->setItem(insertRow, 0, widgetItem); // adjust column width - int width = QFontMetrics(widgetItem->font()).width(widgetItem->text()) + 32; + int width = QFontMetrics(widgetItem->font()).horizontalAdvance(widgetItem->text()) + 32; m_widget->horizontalHeader()->resizeSection(0, qMax(m_widget->horizontalHeader()->sectionSize(0), width)); widgetItem = new QTableWidgetItem; diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 51158f16..5faef0d2 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -46,7 +46,7 @@ GanttConfigDialog::GanttConfigDialog(QWidget *parent) : QDialog(parent) { QBoxLayout *topLayout = new QVBoxLayout(this); - topLayout->setMargin(10); + topLayout->setContentsMargins({10, 10, 10, 10}); topLayout->setSpacing(10); mTimeScaleVisibleCheck = new QCheckBox(tr("Show time scale"), this); @@ -103,7 +103,7 @@ void GanttTimeScaleWidget::paintEvent(QPaintEvent *pe) if (r.x() % 100 != 0) { const int lastNumberXPos = r.x() - (r.x() % 100); QString lastNumber = QString::number(lastNumberXPos / 100 * 5); - if (r.x() % 100 < p.fontMetrics().width(lastNumber)) { + if (r.x() % 100 < p.fontMetrics().horizontalAdvance(lastNumber)) { p.drawText(lastNumberXPos - r.x() + 2, fm.ascent(), lastNumber); } } @@ -193,7 +193,7 @@ void GanttProgress::drawGraph(QPainter &p) // Draw the rectangle for the current job QColor color = colorForStatus((*it).job); p.fillRect(xStart, 0, xWidth, height(), color); - p.setPen(color.dark()); + p.setPen(color.darker()); p.drawRect(xStart, 0, xWidth, height()); if (xWidth > 4 && height() > 4) { @@ -209,16 +209,16 @@ void GanttProgress::drawGraph(QPainter &p) || height() - 4 != (*it).text_cache.height()) { // If we print the filename, check whether we need to truncate it and // append "..." at the end. - int text_width = p.fontMetrics().width(s); + int text_width = p.fontMetrics().horizontalAdvance(s); if (text_width > width) { - int threeDotsWidth = p.fontMetrics().width(QStringLiteral("...")); + int threeDotsWidth = p.fontMetrics().horizontalAdvance(QStringLiteral("...")); int next_width = 0; int newLength = 0; for (; next_width <= width; ++newLength) { text_width = next_width; - next_width = p.fontMetrics().width(s.left(newLength)) + + next_width = p.fontMetrics().horizontalAdvance(s.left(newLength)) + threeDotsWidth; } @@ -253,7 +253,7 @@ QColor GanttProgress::colorForStatus(const Job &job) const } else { QColor c = mStatusView->hostColor(job.client); if (job.state == Job::LocalOnly) { - return c.light(); + return c.lighter(); } else { return c; } @@ -264,7 +264,7 @@ void GanttProgress::paintEvent(QPaintEvent *) { QPainter p(this); p.setBackgroundMode(Qt::OpaqueMode); - p.setBackground(palette().background()); + p.setBackground(palette().window()); drawGraph(p); } @@ -292,7 +292,7 @@ GanttStatusView::GanttStatusView(QObject *parent) m_topLayout = new QGridLayout(mTopWidget); m_topLayout->setSpacing(5); - m_topLayout->setMargin(4); + m_topLayout->setContentsMargins({4, 4, 4, 4}); m_topLayout->setColumnStretch(1, 10); mTimeScale = new GanttTimeScaleWidget(mTopWidget); diff --git a/src/views/hostlistview.cc b/src/views/hostlistview.cc index 6b66cfc2..8a22acad 100644 --- a/src/views/hostlistview.cc +++ b/src/views/hostlistview.cc @@ -38,7 +38,7 @@ void HostListView::setModel(QAbstractItemModel *model) { QTreeView::setModel(model); if (model) { - sortByColumn(HostListModel::ColumnID); + sortByColumn(HostListModel::ColumnID, Qt::AscendingOrder); header()->setStretchLastSection(false); header()->setSectionResizeMode(HostListModel::ColumnName, QHeaderView::Stretch); header()->setSectionResizeMode(HostListModel::ColumnColor, QHeaderView::ResizeToContents); diff --git a/src/views/joblistview.cc b/src/views/joblistview.cc index fea9e9bb..b0b12d6f 100644 --- a/src/views/joblistview.cc +++ b/src/views/joblistview.cc @@ -46,7 +46,7 @@ void JobListView::setModel(QAbstractItemModel *model) { QTreeView::setModel(model); if (model) { - sortByColumn(JobListModel::JobColumnID); + sortByColumn(JobListModel::JobColumnID, Qt::AscendingOrder); header()->setStretchLastSection(false); header()->setSectionResizeMode(JobListModel::JobColumnFilename, QHeaderView::Stretch); header()->setSectionResizeMode(JobListModel::JobColumnClient, QHeaderView::ResizeToContents); diff --git a/src/views/listview.cc b/src/views/listview.cc index 13768025..cb8d956d 100644 --- a/src/views/listview.cc +++ b/src/views/listview.cc @@ -41,7 +41,7 @@ ListStatusView::ListStatusView(QObject *parent) mJobsListView->setModel(mSortedJobsListModel); auto topLayout = new QVBoxLayout(m_widget.data()); - topLayout->setMargin(0); + topLayout->setContentsMargins({}); topLayout->addWidget(mJobsListView); } diff --git a/src/views/starview.cc b/src/views/starview.cc index 2947f1a6..436c7b38 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -41,6 +40,7 @@ #include #include #include +#include #include @@ -753,9 +753,9 @@ bool StarView::filterArch(HostInfo *i) return true; } - QRegExp regExp(mConfigDialog->archFilter()); + static QRegularExpression regExp(mConfigDialog->archFilter()); - if (regExp.indexIn(i->platform()) >= 0) { + if (regExp.match(i->platform()).hasMatch()) { return true; } diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 59803407..72e2474e 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -71,14 +71,14 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi const QColor nodeColor = view->hostInfoManager()->hostColor(hostid); auto labelBox = new NodeInfoFrame(parent, nodeColor); - layout->setMargin(5); + layout->setContentsMargins({5, 5, 5, 5}); layout->addWidget(labelBox, row, 0); labelBox->show(); labelBox->setMinimumWidth(75); m_widgets.append(labelBox); auto labelLayout = new QVBoxLayout(labelBox); - labelLayout->setMargin(10); + labelLayout->setContentsMargins({10, 10, 10, 10}); labelLayout->setSpacing(5); QLabel *l; @@ -111,13 +111,13 @@ SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryVi } auto detailsBox = new NodeInfoFrame(parent, nodeColor); - layout->setMargin(5); + layout->setContentsMargins({5, 5, 5, 5}); layout->addWidget(detailsBox, row, 1); detailsBox->show(); m_widgets.append(detailsBox); auto grid = new QGridLayout(detailsBox); - grid->setMargin(10); + grid->setContentsMargins({10, 10, 10, 10}); grid->setSpacing(5); m_jobsLabel = addLine(QApplication::tr("Jobs:"), detailsBox, grid, Qt::AlignBottom, QStringLiteral("0")); @@ -279,7 +279,7 @@ SummaryView::SummaryView(QObject *parent) m_layout = new QGridLayout(m_base); m_layout->setColumnStretch(1, 1); m_layout->setSpacing(5); - m_layout->setMargin(5); + m_layout->setContentsMargins({5, 5, 5, 5}); m_widget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_widget->setMinimumHeight(150); From e868de10e3cc58d81dfb3e8abcff6f29a3bf6fbb Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 16 May 2025 00:47:11 +0200 Subject: [PATCH 57/77] Remove no longer working badges --- .travis.yml | 42 ------------------------------------------ README.md | 3 --- 2 files changed, 45 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 838d0bf5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -sudo: required -dist: xenial - -language: cpp - -compiler: -- gcc -- clang - -before_script: -- | - git clone --depth=50 --branch=master https://github.com/icecc/icecream.git icecream - pushd icecream - autoreconf -fiv - ./configure --prefix=$(pwd) - make install -C services -s -j $(getconf _NPROCESSORS_ONLN) - popd - -- cmake --version -- qtchooser -run-tool=qmake -qt=qt5 --version - -- mkdir build -- cd build -- PKG_CONFIG_PATH=../icecream/lib/pkgconfig cmake .. -DCMAKE_INSTALL_PREFIX=$(pwd)/_inst - -script: -- make -- make install - -addons: - apt: - packages: - - cmake - - qtbase5-dev - - extra-cmake-modules - - asciidoc - - xsltproc # for asciidoc - # for icecream - - libcap-ng-dev - - liblzo2-dev - - libzstd1-dev - - libarchive-dev diff --git a/README.md b/README.md index b01b015c..a58e7f3e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,3 @@ -[![Build Status](https://travis-ci.org/icecc/icemon.svg?branch=master)](https://travis-ci.org/icecc/icemon) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/b8bc2d59bad544258a47209cc9bfb8e7)](https://www.codacy.com/app/icecc/icemon?utm_source=github.com&utm_medium=referral&utm_content=icecc/icemon&utm_campaign=Badge_Grade) - Icemon ====== From 8a8589a019e7e8c56f91eac703cc3eff3e52b5db Mon Sep 17 00:00:00 2001 From: "Kenneth Perry (thothonegan)" Date: Thu, 20 May 2021 21:50:21 -0400 Subject: [PATCH 58/77] Add system tray icon with a simple tooltip --- src/mainwindow.cc | 95 ++++++++++++++++++++++++++++++++++++++++++++++- src/mainwindow.h | 6 +++ 2 files changed, 100 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 7c4b2db5..2674e802 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -32,6 +32,7 @@ #include "utils.h" +#include #include #include #include @@ -61,6 +62,7 @@ struct PlatformStat MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , m_view(nullptr) + , m_systemTrayIcon(nullptr) { QIcon appIcon = QIcon(); appIcon.addFile(QStringLiteral(":/images/128-apps-icemon.png"), QSize(128, 128)); @@ -81,8 +83,32 @@ MainWindow::MainWindow(QWidget *parent) m_jobStatsWidget = new QLabel; m_jobStatsWidget->setVisible(false); statusBar()->addPermanentWidget(m_jobStatsWidget); + + QAction *action = nullptr; - QAction *action = fileMenu->addAction(tr("&Quit"), this, SLOT(close()), tr("Ctrl+Q")); + if (QSystemTrayIcon::isSystemTrayAvailable()) + { + action = fileMenu->addAction(tr("Show in System Tray")); + action->setIcon(QIcon::fromTheme(QStringLiteral("systemtray"))); + action->setCheckable(true); + connect(action, &QAction::triggered, this, &MainWindow::updateSystemTrayVisible); + m_showInSystemTrayAction = action; + + QMenu *systrayMenu = new QMenu(this); + QAction *quitAction = systrayMenu->addAction(tr("&Quit"), this, SLOT(quit()), tr("Ctrl+Q")); + quitAction->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); + quitAction->setMenuRole(QAction::QuitRole); + + m_systemTrayIcon = new QSystemTrayIcon(this); + m_systemTrayIcon->setIcon(appIcon); + m_systemTrayIcon->setToolTip(windowTitle()); + m_systemTrayIcon->setContextMenu(systrayMenu); + connect(m_systemTrayIcon, &QSystemTrayIcon::activated, this, &MainWindow::systemTrayIconActivated); + + fileMenu->addSeparator(); + } + + action = fileMenu->addAction(tr("&Quit"), this, SLOT(quit()), tr("Ctrl+Q")); action->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); action->setMenuRole(QAction::QuitRole); @@ -146,6 +172,25 @@ MainWindow::~MainWindow() void MainWindow::closeEvent(QCloseEvent *e) { + if (m_systemTrayIcon->isVisible()) + { + QSettings settings; + const bool shownBefore = settings.value(QStringLiteral("programWillKeepRunningWarningShown")).toBool(); + if (!shownBefore) { + QMessageBox::information(this, tr("Systray"), + tr("The program will keep running in the " + "system tray. To terminate the program, " + "choose Quit in the context menu " + "of the system tray entry.")); + settings.setValue(QStringLiteral("programWillKeepRunningWarningShown"), true); + settings.sync(); + } + + hide(); + e->ignore(); + return; + } + writeSettings(); QMainWindow::closeEvent(e); @@ -156,10 +201,14 @@ void MainWindow::readSettings() QSettings settings; restoreGeometry(settings.value(QStringLiteral("geometry")).toByteArray()); restoreState(settings.value(QStringLiteral("windowState")).toByteArray()); + bool showSystemTray = settings.value(QStringLiteral("showSystemTray")).toBool(); QString viewId = settings.value(QStringLiteral("currentView")).toString(); auto view = StatusViewFactory::create(viewId, this); setView(view); + + m_showInSystemTrayAction->setChecked(showSystemTray); + updateSystemTrayVisible(); } void MainWindow::writeSettings() @@ -167,6 +216,7 @@ void MainWindow::writeSettings() QSettings settings; settings.setValue(QStringLiteral("geometry"), saveGeometry()); settings.setValue(QStringLiteral("windowState"), saveState()); + settings.setValue(QStringLiteral("showSystemTray"), m_systemTrayIcon->isVisible()); settings.setValue(QStringLiteral("currentView"), (m_view ? m_view->id() : QString())); settings.sync(); } @@ -247,6 +297,44 @@ void MainWindow::configureView() m_view->configureView(); } +void MainWindow::updateSystemTrayVisible() +{ + if (m_showInSystemTrayAction->isChecked()) { + m_systemTrayIcon->show(); + } else { + m_systemTrayIcon->hide(); + } +} + +void MainWindow::quit() +{ + writeSettings(); + qApp->quit(); +} + +void MainWindow::systemTrayIconActivated(QSystemTrayIcon::ActivationReason reason) +{ + switch (reason) { + case QSystemTrayIcon::Trigger: + if (isVisible()) { + if (isMinimized()) { + showMaximized(); + } else { + hide(); + } + } else { + show(); + } + break; + + case QSystemTrayIcon::DoubleClick: + case QSystemTrayIcon::MiddleClick: + case QSystemTrayIcon::Unknown: + default: + ; + } +} + void MainWindow::about() { QString about = tr("

%1
" @@ -306,6 +394,7 @@ void MainWindow::updateJobStats() if (!m_monitor->schedulerState()) { m_jobStatsWidget->clear(); m_jobStatsWidget->setVisible(false); + m_systemTrayIcon->setToolTip(tr("Scheduler is offline.")); return; } @@ -337,6 +426,7 @@ void MainWindow::updateJobStats() // Compose the text QString text; + QString textNoHTML; foreach (auto pair, statistics) { const QString& platform = pair.first; const PlatformStat& stat = pair.second; @@ -346,13 +436,16 @@ void MainWindow::updateJobStats() if (!text.isEmpty()) { text.append(QStringLiteral(" - ")); + textNoHTML.append(QStringLiteral(" - ")); } text.append(QStringLiteral("%2/%3 on %1").arg(platform).arg(stat.jobs).arg(stat.maxJobs)); + textNoHTML.append(QStringLiteral("%2/%3 on %1").arg(platform).arg(stat.jobs).arg(stat.maxJobs)); } m_jobStatsWidget->setText(tr("| Active jobs: %1").arg(text)); m_jobStatsWidget->setVisible(true); + m_systemTrayIcon->setToolTip(tr("Active jobs: %1").arg(textNoHTML)); } void MainWindow::setCurrentNet(const QByteArray &netname) diff --git a/src/mainwindow.h b/src/mainwindow.h index 1c11970d..43c497d0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -26,6 +26,7 @@ #include #include +#include #include "monitor.h" #include "job.h" @@ -60,6 +61,9 @@ class MainWindow private slots: void pauseView(); void configureView(); + void updateSystemTrayVisible(); + void systemTrayIconActivated(QSystemTrayIcon::ActivationReason reason); + void quit(); void about(); @@ -81,6 +85,7 @@ private slots: HostInfoManager *m_hostInfoManager; QPointer m_monitor; StatusView *m_view; + QSystemTrayIcon* m_systemTrayIcon; QLabel *m_schedStatusWidget; QLabel *m_jobStatsWidget; @@ -88,6 +93,7 @@ private slots: QActionGroup *m_viewMode; QAction *m_configureViewAction; QAction *m_pauseViewAction; + QAction *m_showInSystemTrayAction; JobList m_activeJobs; }; From 59936a6728ea1aac7add0f28650ced48b72fcfd5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 16 May 2025 00:34:00 +0200 Subject: [PATCH 59/77] Create cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/cmake-single-platform.yml diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml new file mode 100644 index 00000000..0064615a --- /dev/null +++ b/.github/workflows/cmake-single-platform.yml @@ -0,0 +1,36 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - name: Install Qt + uses: jurplel/install-qt-action@v4 + - name: Install dependencies (linux) + run: sudo apt install ninja-build extra-cmake-modules libicecc-dev + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} From 9253464db801bf3d9031b2f1a97c25bd00455dcc Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 15 Sep 2022 10:38:20 +0200 Subject: [PATCH 60/77] Modernize: Use new-signal-slot-syntax --- src/fakemonitor.cc | 2 +- src/icecreammonitor.cc | 6 +++--- src/mainwindow.cc | 28 ++++++++++++++-------------- src/statusview.cc | 20 ++++++++++---------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/fakemonitor.cc b/src/fakemonitor.cc index ed2265dc..cb6bf728 100644 --- a/src/fakemonitor.cc +++ b/src/fakemonitor.cc @@ -65,7 +65,7 @@ FakeMonitor::FakeMonitor(HostInfoManager *manager, QObject *parent) { m_updateTimer->setInterval(200); m_updateTimer->start(); - connect(m_updateTimer, SIGNAL(timeout()), SLOT(update())); + connect(m_updateTimer, &QTimer::timeout, this, &FakeMonitor::update); setSchedulerState(Online); diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index cdd7213d..defcb2b1 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -81,7 +81,7 @@ void IcecreamMonitor::checkScheduler(bool deleteit) } else if (m_scheduler) { return; } - QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, SLOT(slotCheckScheduler())); // TODO: check if correct + QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, &IcecreamMonitor::slotCheckScheduler); // TODO: check if correct } void IcecreamMonitor::registerNotify(int fd, QSocketNotifier::Type type, const char *slot) @@ -140,7 +140,7 @@ void IcecreamMonitor::slotCheckScheduler() if (!m_scheduler->send_msg(MonLoginMsg())) { checkScheduler(true); - QTimer::singleShot(0, this, SLOT(slotCheckScheduler())); + QTimer::singleShot(0, this, &IcecreamMonitor::slotCheckScheduler); } else { setSchedulerState(Online); } @@ -158,7 +158,7 @@ void IcecreamMonitor::slotCheckScheduler() QSocketNotifier::Read, SLOT(slotCheckScheduler())); } if (m_fd_type == QSocketNotifier::Read) { - QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, SLOT(slotCheckScheduler())); + QTimer::singleShot(1000 + (QRandomGenerator::global()->generate() & 1023), this, &IcecreamMonitor::slotCheckScheduler); } } diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 2674e802..7c04aaae 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -83,7 +83,7 @@ MainWindow::MainWindow(QWidget *parent) m_jobStatsWidget = new QLabel; m_jobStatsWidget->setVisible(false); statusBar()->addPermanentWidget(m_jobStatsWidget); - + QAction *action = nullptr; if (QSystemTrayIcon::isSystemTrayAvailable()) @@ -108,7 +108,7 @@ MainWindow::MainWindow(QWidget *parent) fileMenu->addSeparator(); } - action = fileMenu->addAction(tr("&Quit"), this, SLOT(quit()), tr("Ctrl+Q")); + action = fileMenu->addAction(tr("&Quit"), this, &QWidget::close, tr("Ctrl+Q")); action->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); action->setMenuRole(QAction::QuitRole); @@ -131,7 +131,7 @@ MainWindow::MainWindow(QWidget *parent) action = m_viewMode->addAction(tr("&Detailed Host View")); action->setCheckable(true); action->setData(QStringLiteral("detailedhost")); - connect(m_viewMode, SIGNAL(triggered(QAction *)), this, SLOT(handleViewModeActionTriggered(QAction *))); + connect(m_viewMode, &QActionGroup::triggered, this, &MainWindow::handleViewModeActionTriggered); viewMenu->addActions(m_viewMode->actions()); viewMenu->addSeparator(); @@ -139,14 +139,14 @@ MainWindow::MainWindow(QWidget *parent) action = viewMenu->addAction(tr("Pause")); action->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-pause"))); action->setCheckable(true); - connect(action, SIGNAL(triggered()), this, SLOT(pauseView())); + connect(action, &QAction::triggered, this, &MainWindow::pauseView); m_pauseViewAction = action; viewMenu->addSeparator(); action = viewMenu->addAction(tr("Configure View...")); action->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); - connect(action, SIGNAL(triggered()), this, SLOT(configureView())); + connect(action, &QAction::triggered, this, &MainWindow::configureView); m_configureViewAction = action; action = helpMenu->addAction(tr("About Qt...")); @@ -155,7 +155,7 @@ MainWindow::MainWindow(QWidget *parent) action = helpMenu->addAction(tr("About...")); action->setIcon(appIcon); - connect(action, SIGNAL(triggered()), this, SLOT(about())); + connect(action, &QAction::triggered, this, &MainWindow::about); action->setMenuRole(QAction::AboutRole); m_hostInfoManager = new HostInfoManager; @@ -233,19 +233,19 @@ void MainWindow::setMonitor(Monitor *monitor) } if (m_monitor) { - disconnect(m_monitor, SIGNAL(schedulerStateChanged(Monitor::SchedulerState)), - this, SLOT(updateSchedulerState(Monitor::SchedulerState))); - disconnect(m_monitor, SIGNAL(jobUpdated(const Job &)), this, SLOT(updateJob(Job))); - disconnect(m_monitor->hostInfoManager(), SIGNAL(hostMapChanged()), this, SLOT(updateJobStats())); + disconnect(m_monitor.data(), &Monitor::schedulerStateChanged, + this, &MainWindow::updateSchedulerState); + disconnect(m_monitor.data(), &Monitor::jobUpdated, this, &MainWindow::updateJob); + disconnect(m_monitor->hostInfoManager(), &HostInfoManager::hostMapChanged, this, &MainWindow::updateJobStats); } m_monitor = monitor; if (m_monitor) { - connect(m_monitor, SIGNAL(schedulerStateChanged(Monitor::SchedulerState)), - this, SLOT(updateSchedulerState(Monitor::SchedulerState))); - connect(m_monitor, SIGNAL(jobUpdated(const Job &)), this, SLOT(updateJob(Job))); - connect(m_monitor->hostInfoManager(), SIGNAL(hostMapChanged()), this, SLOT(updateJobStats())); + connect(m_monitor.data(), &Monitor::schedulerStateChanged, + this, &MainWindow::updateSchedulerState); + connect(m_monitor.data(), &Monitor::jobUpdated, this, &MainWindow::updateJob); + connect(m_monitor->hostInfoManager(), &HostInfoManager::hostMapChanged, this, &MainWindow::updateJobStats); } if (m_view) { diff --git a/src/statusview.cc b/src/statusview.cc index d0b72fd6..da242d65 100644 --- a/src/statusview.cc +++ b/src/statusview.cc @@ -57,21 +57,21 @@ void StatusView::setMonitor(Monitor *monitor) } if (m_monitor) { - disconnect(m_monitor.data(), SIGNAL(jobUpdated(Job)), this, SLOT(update(Job))); - disconnect(m_monitor.data(), SIGNAL(nodeRemoved(HostId)), this, SLOT(removeNode(HostId))); - disconnect(m_monitor.data(), SIGNAL(nodeUpdated(HostId)), this, SLOT(checkNode(HostId))); - disconnect(m_monitor.data(), SIGNAL(schedulerStateChanged(Monitor::SchedulerState)), - this, SLOT(updateSchedulerState(Monitor::SchedulerState))); + disconnect(m_monitor.data(), &Monitor::jobUpdated, this, &StatusView::update); + disconnect(m_monitor.data(), &Monitor::nodeRemoved, this, &StatusView::removeNode); + disconnect(m_monitor.data(), &Monitor::nodeUpdated, this, &StatusView::checkNode); + disconnect(m_monitor.data(), &Monitor::schedulerStateChanged, + this, &StatusView::updateSchedulerState); } m_monitor = monitor; if (m_monitor) { - connect(m_monitor.data(), SIGNAL(jobUpdated(Job)), this, SLOT(update(Job))); - connect(m_monitor.data(), SIGNAL(nodeRemoved(HostId)), this, SLOT(removeNode(HostId))); - connect(m_monitor.data(), SIGNAL(nodeUpdated(HostId)), this, SLOT(checkNode(HostId))); - connect(m_monitor.data(), SIGNAL(schedulerStateChanged(Monitor::SchedulerState)), - this, SLOT(updateSchedulerState(Monitor::SchedulerState))); + connect(m_monitor.data(), &Monitor::jobUpdated, this, &StatusView::update); + connect(m_monitor.data(), &Monitor::nodeRemoved, this, &StatusView::removeNode); + connect(m_monitor.data(), &Monitor::nodeUpdated, this, &StatusView::checkNode); + connect(m_monitor.data(), &Monitor::schedulerStateChanged, + this, &StatusView::updateSchedulerState); if (options().testFlag(RememberJobsOption)) { foreach(const Job &job, m_monitor->jobHistory()) { From 1f9d2915c03949d565464c419b045e2770f553d1 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Fri, 16 May 2025 08:52:07 +0200 Subject: [PATCH 61/77] Support icecc after Msg refactor But keep possibility to build against released icecc version. Fixes #68 --- CMakeLists.txt | 15 +++++++++++---- config-icemon.h.cmake | 3 ++- src/icecreammonitor.cc | 42 ++++++++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3b22611..3f7cd0b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10.0) +cmake_minimum_required(VERSION 3.12) project(icemon VERSION 3.3) find_package(ECM REQUIRED NO_MODULE) @@ -72,18 +72,25 @@ include_directories( set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) if (Icecream_FOUND) + set(CMAKE_REQUIRED_LIBRARIES Icecream) + check_include_file_cxx(icecc/logging.h ICECC_HAVE_LOGGING_H) + check_cxx_source_compiles(" + #include + + int main() { Msg msg(M_MON_GET_CS); (void)msg.type; } + " ICECC_TEST_USE_OLD_MSG_API) + # Check whether icecc was compiled against old CXXABI # Work-around for: https://github.com/icecc/icemon/issues/24 # See: https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html set(USE_OLDCXXABI_DEFINE -D_GLIBCXX_USE_CXX11_ABI=0) - set(CMAKE_REQUIRED_LIBRARIES Icecream) set(CMAKE_REQUIRED_DEFINITIONS ${USE_OLDCXXABI_DEFINE}) check_cxx_source_compiles(" - #include + #include - int main() { DiscoverSched sched(\"foo\"); } + int main() { DiscoverSched sched(\"foo\"); } " ICECC_TEST_USE_OLDABI) if (ICECC_TEST_USE_OLDABI) diff --git a/config-icemon.h.cmake b/config-icemon.h.cmake index 38f27238..1e7ad22c 100644 --- a/config-icemon.h.cmake +++ b/config-icemon.h.cmake @@ -1,3 +1,4 @@ #define ICEMON_VERSION_STRING "@ICEMON_VERSION_STRING@" -#cmakedefine ICECC_HAVE_LOGGING_H 1 +#cmakedefine01 ICECC_HAVE_LOGGING_H +#cmakedefine01 ICECC_TEST_USE_OLD_MSG_API diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index defcb2b1..7471675d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -29,7 +29,7 @@ #include #include -#ifdef ICECC_HAVE_LOGGING_H +#if ICECC_HAVE_LOGGING_H #include #endif @@ -38,10 +38,17 @@ #include #include +#include #include #include #include +#if ICECC_TEST_USE_OLD_MSG_API +#define ICECC_MSG_API_COMPAT(old, new) old +#else +#define ICECC_MSG_API_COMPAT(old, new) new +#endif + using namespace std; IcecreamMonitor::IcecreamMonitor(HostInfoManager *manager, QObject *parent) @@ -175,41 +182,40 @@ void IcecreamMonitor::msgReceived() bool IcecreamMonitor::handle_activity() { - Msg *m = m_scheduler->get_msg(); + std::unique_ptr m(m_scheduler->get_msg()); if (!m) { checkScheduler(true); setSchedulerState(Offline); return false; } - switch (m->type) { - case M_MON_GET_CS: - handle_getcs(m); + switch (ICECC_MSG_API_COMPAT(m->type, *m)) { + case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::GET_CS): + handle_getcs(m.get()); break; - case M_MON_JOB_BEGIN: - handle_job_begin(m); + case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::JOB_BEGIN): + handle_job_begin(m.get()); break; - case M_MON_JOB_DONE: - handle_job_done(m); + case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::JOB_DONE): + handle_job_done(m.get()); break; - case M_END: + case ICECC_MSG_API_COMPAT(M_END, Msg::END): std::cout << "END" << endl; checkScheduler(true); break; - case M_MON_STATS: - handle_stats(m); + case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::STATS): + handle_stats(m.get()); break; - case M_MON_LOCAL_JOB_BEGIN: - handle_local_begin(m); + case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::JOB_LOCAL_BEGIN): + handle_local_begin(m.get()); break; - case M_JOB_LOCAL_DONE: - handle_local_done(m); + case ICECC_MSG_API_COMPAT(M_JOB_LOCAL_DONE, Msg::JOB_LOCAL_DONE): + handle_local_done(m.get()); break; default: cout << "UNKNOWN" << endl; break; } - delete m; return true; } @@ -355,7 +361,7 @@ void IcecreamMonitor::handle_job_done(Msg *_m) void IcecreamMonitor::setupDebug() { -#ifdef ICECC_HAVE_LOGGING_H +#if ICECC_HAVE_LOGGING_H char *env = getenv("ICECC_DEBUG"); int debug_level = Error; From d7e45f14a9ea1090101ae5928b80594ebe207513 Mon Sep 17 00:00:00 2001 From: Aykhan Hagverdili Date: Thu, 5 Jun 2025 11:40:12 +0400 Subject: [PATCH 62/77] Update README.md Qt6 is required, not Qt5 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a58e7f3e..a4cc84af 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ To compile icemon, install, the icecc development package, e.g. for Debian/Ubunt Finally, make sure you have g++, Qt, cmake and ECM installed - $ apt-get install build-essential qtbase5-dev cmake extra-cmake-modules + $ apt-get install build-essential qtbase6-dev cmake extra-cmake-modules Finally, compile and install the application: From e698e5ee808e1ca6e6ece758fb75b483efd9f242 Mon Sep 17 00:00:00 2001 From: Martin Hanzlowsky Date: Sun, 7 Dec 2025 17:54:12 +0100 Subject: [PATCH 63/77] Add nullptr check for tray. --- src/mainwindow.cc | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 7c04aaae..a7560a79 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -172,7 +172,7 @@ MainWindow::~MainWindow() void MainWindow::closeEvent(QCloseEvent *e) { - if (m_systemTrayIcon->isVisible()) + if (m_systemTrayIcon && m_systemTrayIcon->isVisible()) { QSettings settings; const bool shownBefore = settings.value(QStringLiteral("programWillKeepRunningWarningShown")).toBool(); @@ -216,7 +216,10 @@ void MainWindow::writeSettings() QSettings settings; settings.setValue(QStringLiteral("geometry"), saveGeometry()); settings.setValue(QStringLiteral("windowState"), saveState()); - settings.setValue(QStringLiteral("showSystemTray"), m_systemTrayIcon->isVisible()); + if (m_systemTrayIcon) + { + settings.setValue(QStringLiteral("showSystemTray"), m_systemTrayIcon->isVisible()); + } settings.setValue(QStringLiteral("currentView"), (m_view ? m_view->id() : QString())); settings.sync(); } @@ -299,6 +302,10 @@ void MainWindow::configureView() void MainWindow::updateSystemTrayVisible() { + if (!m_systemTrayIcon) + { + return; + } if (m_showInSystemTrayAction->isChecked()) { m_systemTrayIcon->show(); } else { @@ -394,7 +401,10 @@ void MainWindow::updateJobStats() if (!m_monitor->schedulerState()) { m_jobStatsWidget->clear(); m_jobStatsWidget->setVisible(false); - m_systemTrayIcon->setToolTip(tr("Scheduler is offline.")); + if (m_systemTrayIcon) + { + m_systemTrayIcon->setToolTip(tr("Scheduler is offline.")); + } return; } @@ -445,7 +455,10 @@ void MainWindow::updateJobStats() m_jobStatsWidget->setText(tr("| Active jobs: %1").arg(text)); m_jobStatsWidget->setVisible(true); - m_systemTrayIcon->setToolTip(tr("Active jobs: %1").arg(textNoHTML)); + if (m_systemTrayIcon) + { + m_systemTrayIcon->setToolTip(tr("Active jobs: %1").arg(textNoHTML)); + } } void MainWindow::setCurrentNet(const QByteArray &netname) From 770793588309bec4e3d1167322da9c4e074a00ea Mon Sep 17 00:00:00 2001 From: Martin Hanzlowsky Date: Sun, 7 Dec 2025 20:12:25 +0100 Subject: [PATCH 64/77] Another system tray check. --- src/mainwindow.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index a7560a79..84c2af50 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -207,8 +207,11 @@ void MainWindow::readSettings() auto view = StatusViewFactory::create(viewId, this); setView(view); - m_showInSystemTrayAction->setChecked(showSystemTray); - updateSystemTrayVisible(); + if (m_systemTrayIcon) + { + m_showInSystemTrayAction->setChecked(showSystemTray); + updateSystemTrayVisible(); + } } void MainWindow::writeSettings() From bcde0eb5b9accd8033bffd0795722828878f1791 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Wed, 4 Mar 2026 21:39:00 +0100 Subject: [PATCH 65/77] cmake: Add basic CMakePresets.json --- CMakePresets.json | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 CMakePresets.json diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..7df32b13 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,42 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "base", + "displayName": "base preset", + "generator": "Ninja", + "binaryDir": "${sourceDir}/build-${presetName}", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_EXPORT_COMPILE_COMMANDS": true + }, + "hidden": true + }, + { + "name": "dev", + "inherits": [ + "base" + ] + }, + { + "name": "dev-clang", + "inherits": [ + "base" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + } + { + "name": "dev-qt5-clang", + "inherits": [ + "base" + ], + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + } + ] +} From 0b752acf74fca5eb05e330406ad90805b6f269a0 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Wed, 4 Mar 2026 21:59:00 +0100 Subject: [PATCH 66/77] cpp: Remove deprecated std::unary_function template Fixes #80 --- CMakePresets.json | 2 +- src/models/hostlistmodel.cc | 21 ++++----------------- src/models/joblistmodel.cc | 21 ++++----------------- 3 files changed, 9 insertions(+), 35 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index 7df32b13..538db84a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -27,7 +27,7 @@ "CMAKE_C_COMPILER": "clang", "CMAKE_CXX_COMPILER": "clang++" } - } + }, { "name": "dev-qt5-clang", "inherits": [ diff --git a/src/models/hostlistmodel.cc b/src/models/hostlistmodel.cc index 38ec20f7..d9bc1c97 100644 --- a/src/models/hostlistmodel.cc +++ b/src/models/hostlistmodel.cc @@ -213,25 +213,12 @@ void HostListModel::checkNode(unsigned int hostid) } } -struct find_hostid - : public std::unary_function -{ -public: - explicit find_hostid(unsigned int hostId) - : m_hostId(hostId) {} - - bool operator()(const HostInfo &info) const - { - return info.id() == m_hostId; - } - -private: - unsigned int m_hostId; -}; - void HostListModel::removeNodeById(unsigned int hostId) { - QVector::iterator it = std::find_if(m_hostInfos.begin(), m_hostInfos.end(), find_hostid(hostId)); + auto it = std::find_if(m_hostInfos.begin(), m_hostInfos.end(), + [hostId](const HostInfo &info) { + return info.id() == hostId; + }); if (it == m_hostInfos.end()) { return; } diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index c69a9e1e..5b871493 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -263,22 +263,6 @@ int JobListModel::rowCount(const QModelIndex &parent) const return m_jobs.size(); } -struct find_jobid - : public std::unary_function -{ -public: - explicit find_jobid(unsigned int jobId) - : m_jobId(jobId) {} - - bool operator()(const Job &job) const - { - return job.id == m_jobId; - } - -private: - unsigned int m_jobId; -}; - void JobListModel::slotExpireFinishedJobs() { const uint currentTime = QDateTime::currentDateTime().toSecsSinceEpoch(); @@ -309,7 +293,10 @@ void JobListModel::removeItem(const Job &job) void JobListModel::removeItemById(unsigned int jobId) { - QVector::iterator it = std::find_if(m_jobs.begin(), m_jobs.end(), find_jobid(jobId)); + QVector::iterator it = std::find_if(m_jobs.begin(), m_jobs.end(), + [jobId](const Job &job) { + return job.id == jobId; + }); int index = std::distance(m_jobs.begin(), it); beginRemoveRows(QModelIndex(), index, index); m_jobs.erase(it); From 96e13ca15d4c057eb02241c9c78c49fc49423af7 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Wed, 4 Mar 2026 22:26:21 +0100 Subject: [PATCH 67/77] icecreammonitor: Fixup after Msg refactor Some enums mixed up in icecreammonitor.cc during the refactor Fixes #83 --- src/icecreammonitor.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 7471675d..52ce1437 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -190,30 +190,30 @@ bool IcecreamMonitor::handle_activity() } switch (ICECC_MSG_API_COMPAT(m->type, *m)) { - case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::GET_CS): + case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::MON_GET_CS): handle_getcs(m.get()); break; - case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::JOB_BEGIN): + case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::MON_JOB_BEGIN): handle_job_begin(m.get()); break; - case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::JOB_DONE): + case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::MON_JOB_DONE): handle_job_done(m.get()); break; case ICECC_MSG_API_COMPAT(M_END, Msg::END): std::cout << "END" << endl; checkScheduler(true); break; - case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::STATS): + case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::MON_STATS): handle_stats(m.get()); break; - case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::JOB_LOCAL_BEGIN): + case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::MON_LOCAL_JOB_BEGIN): handle_local_begin(m.get()); break; case ICECC_MSG_API_COMPAT(M_JOB_LOCAL_DONE, Msg::JOB_LOCAL_DONE): handle_local_done(m.get()); break; default: - cout << "UNKNOWN" << endl; + cout << "UNKNOWN message type " << ICECC_MSG_API_COMPAT(m->type, m->to_string()) << endl; break; } return true; From 03209d1f622c46b6ddef967fbc659bbfffe471d5 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Wed, 4 Mar 2026 23:19:47 +0100 Subject: [PATCH 68/77] icecreammonitor: Add some useful asserts --- src/icecreammonitor.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 52ce1437..17b4ac25 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -222,9 +222,11 @@ bool IcecreamMonitor::handle_activity() void IcecreamMonitor::handle_getcs(Msg *_m) { MonGetCSMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } + m_rememberedJobs[m->job_id] = Job(m->job_id, m->clientid, QString::fromStdString(m->filename), m->lang == CompileJob::Lang_C ? @@ -237,6 +239,7 @@ void IcecreamMonitor::handle_getcs(Msg *_m) void IcecreamMonitor::handle_local_begin(Msg *_m) { MonLocalJobBeginMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } @@ -251,6 +254,7 @@ void IcecreamMonitor::handle_local_begin(Msg *_m) void IcecreamMonitor::handle_local_done(Msg *_m) { JobLocalDoneMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } @@ -275,6 +279,7 @@ void IcecreamMonitor::handle_local_done(Msg *_m) void IcecreamMonitor::handle_stats(Msg *_m) { MonStatsMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } @@ -302,6 +307,7 @@ void IcecreamMonitor::handle_stats(Msg *_m) void IcecreamMonitor::handle_job_begin(Msg *_m) { MonJobBeginMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } @@ -313,6 +319,7 @@ void IcecreamMonitor::handle_job_begin(Msg *_m) } HostInfo *hostInfo = hostInfoManager()->find(m->hostid); + assert(hostInfo); if (hostInfo) hostInfo->incJobs(); @@ -326,6 +333,7 @@ void IcecreamMonitor::handle_job_begin(Msg *_m) void IcecreamMonitor::handle_job_done(Msg *_m) { MonJobDoneMsg *m = dynamic_cast(_m); + assert(m); if (!m) { return; } From b70453586289fe6169ff2227c93bde7edbc1cf15 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Wed, 4 Mar 2026 23:47:14 +0100 Subject: [PATCH 69/77] flowtableview: Do not use bold font Do not use bold font for indicating active hosts. This causes unnessary resizeevents for the progress widget which then resets the view. Fixes #69 --- src/views/flowtableview.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index db9514c9..361758e3 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -132,7 +132,6 @@ void FlowTableView::update(const Job &job) HostInfo *hostInfo = hostInfoManager()->find(serverId); QFont f = m_widget->font(); - f.setBold(hostInfo->numJobs() > 0); hostNameItem->setFont(f); hostNameItem->setText(hostInfoText(hostInfo)); } From dc5cc6ddc101d7142810c3bbd55a5b797e013191 Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 00:03:12 +0100 Subject: [PATCH 70/77] flowtableview: Clarify string Fixes #63 --- src/views/flowtableview.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index 361758e3..b0b47204 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -143,7 +143,7 @@ QWidget *FlowTableView::widget() const QString FlowTableView::hostInfoText(HostInfo *hostInfo) { if ((hostInfo->serverSpeed() == 0) && (hostInfo->numJobs() == 0)) { // host disabled - return tr("%1 (Disabled)").arg(hostInfo->name()); + return tr("%1 (not accepting jobs)").arg(hostInfo->name()); } else { return tr("%1 (%2/%3)").arg(hostInfo->name()).arg(hostInfo->numJobs()).arg(hostInfo->maxJobs()); } From 1f658987c5664dd2c5ff5fa84ae1ac29254e203b Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:05:36 +0100 Subject: [PATCH 71/77] clang-tidy: modernize-use-auto --- src/icecreammonitor.cc | 12 ++++++------ src/mainwindow.cc | 2 +- src/views/detailedhostview.cc | 2 +- src/views/flowtableview.cc | 4 ++-- src/views/ganttstatusview.cc | 2 +- src/views/starview.cc | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 17b4ac25..55d41556 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -221,7 +221,7 @@ bool IcecreamMonitor::handle_activity() void IcecreamMonitor::handle_getcs(Msg *_m) { - MonGetCSMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; @@ -238,7 +238,7 @@ void IcecreamMonitor::handle_getcs(Msg *_m) void IcecreamMonitor::handle_local_begin(Msg *_m) { - MonLocalJobBeginMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; @@ -253,7 +253,7 @@ void IcecreamMonitor::handle_local_begin(Msg *_m) void IcecreamMonitor::handle_local_done(Msg *_m) { - JobLocalDoneMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; @@ -278,7 +278,7 @@ void IcecreamMonitor::handle_local_done(Msg *_m) void IcecreamMonitor::handle_stats(Msg *_m) { - MonStatsMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; @@ -306,7 +306,7 @@ void IcecreamMonitor::handle_stats(Msg *_m) void IcecreamMonitor::handle_job_begin(Msg *_m) { - MonJobBeginMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; @@ -332,7 +332,7 @@ void IcecreamMonitor::handle_job_begin(Msg *_m) void IcecreamMonitor::handle_job_done(Msg *_m) { - MonJobDoneMsg *m = dynamic_cast(_m); + auto *m = dynamic_cast(_m); assert(m); if (!m) { return; diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 84c2af50..36e03dbe 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -94,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent) connect(action, &QAction::triggered, this, &MainWindow::updateSystemTrayVisible); m_showInSystemTrayAction = action; - QMenu *systrayMenu = new QMenu(this); + auto *systrayMenu = new QMenu(this); QAction *quitAction = systrayMenu->addAction(tr("&Quit"), this, SLOT(quit()), tr("Ctrl+Q")); quitAction->setIcon(QIcon::fromTheme(QStringLiteral("application-exit"))); quitAction->setMenuRole(QAction::QuitRole); diff --git a/src/views/detailedhostview.cc b/src/views/detailedhostview.cc index 197c23f5..8299e226 100644 --- a/src/views/detailedhostview.cc +++ b/src/views/detailedhostview.cc @@ -150,7 +150,7 @@ void DetailedHostView::createKnownHosts() void DetailedHostView::slotNodeActivated() { - const unsigned int hostid = mHostListView->currentIndex().data(HostListModel::HostIdRole).value(); + const auto hostid = mHostListView->currentIndex().data(HostListModel::HostIdRole).value(); if (!hostid) return; mLocalJobsModel->setHostId(hostid); diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index b0b47204..291d2080 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -123,7 +123,7 @@ void FlowTableView::update(const Job &job) jobStateItem->setFlags(Qt::ItemIsEnabled); } - if (ProgressWidget * progressWidget = static_cast(m_widget->cellWidget(serverRow, 2))) { + if (auto * progressWidget = static_cast(m_widget->cellWidget(serverRow, 2))) { progressWidget->setCurrentJob(job); } @@ -180,7 +180,7 @@ void FlowTableView::checkNode(unsigned int hostId) } HostInfo *hostInfo = hostInfoManager()->hostMap().value(hostId); - QTableWidgetItem *widgetItem = new QTableWidgetItem(hostInfoText(hostInfo)); + auto *widgetItem = new QTableWidgetItem(hostInfoText(hostInfo)); widgetItem->setIcon(QIcon(QStringLiteral(":/images/icemonnode.png"))); widgetItem->setToolTip(hostInfo->toolTip()); widgetItem->setBackground(hostInfo->color()); diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 5faef0d2..161fb295 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -63,7 +63,7 @@ GanttConfigDialog::GanttConfigDialog(QWidget *parent) buttonLayout->addStretch(1); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); buttonLayout->addWidget(buttonBox); connect(buttonBox, SIGNAL(rejected()), SLOT(hide())); diff --git a/src/views/starview.cc b/src/views/starview.cc index 436c7b38..8aaaa848 100644 --- a/src/views/starview.cc +++ b/src/views/starview.cc @@ -54,7 +54,7 @@ StarViewConfigDialog::StarViewConfigDialog(QWidget *parent) QBoxLayout *topLayout = new QVBoxLayout(this); - QLabel *label = new QLabel(tr("Number of nodes per ring:")); + auto *label = new QLabel(tr("Number of nodes per ring:")); topLayout->addWidget(label); QBoxLayout *nodesLayout = new QHBoxLayout(); @@ -87,7 +87,7 @@ StarViewConfigDialog::StarViewConfigDialog(QWidget *parent) hline->setFrameShadow(QFrame::Sunken); topLayout->addWidget(hline); - QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); + auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close, this); topLayout->addWidget(buttonBox); connect(mSuppressDomainName, SIGNAL(toggled(bool)), From 0ee9d7d5ac5a7ce6d78763c8b161ef60bc1e7f4d Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:09:25 +0100 Subject: [PATCH 72/77] clang-tidy: modernize-use-using --- src/hostinfo.h | 4 ++-- src/job.h | 2 +- src/views/flowtableview.h | 2 +- src/views/ganttstatusview.h | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hostinfo.h b/src/hostinfo.h index 684d5d64..98b8bd0a 100644 --- a/src/hostinfo.h +++ b/src/hostinfo.h @@ -57,7 +57,7 @@ class HostInfo void setNoRemote(bool noRemote) { mNoRemote = noRemote; } bool noRemote() const { return mNoRemote; } - typedef QMap StatsMap; + using StatsMap = QMap; void updateFromStatsMap(const StatsMap &stats); static void initColorTable(); @@ -122,7 +122,7 @@ class HostInfoManager HostInfo *find(unsigned int hostid) const; - typedef QMap HostMap; + using HostMap = QMap; HostMap hostMap() const; diff --git a/src/job.h b/src/job.h index 41458333..0d03d9b1 100644 --- a/src/job.h +++ b/src/job.h @@ -76,7 +76,7 @@ class IdleJob : Job() { state = Job::Idle; } }; -typedef QMap JobList; +using JobList = QMap; #endif // vim:ts=4:sw=4:noet diff --git a/src/views/flowtableview.h b/src/views/flowtableview.h index 789698e0..127a30a1 100644 --- a/src/views/flowtableview.h +++ b/src/views/flowtableview.h @@ -31,7 +31,7 @@ class Job; -typedef QHash HostIdRowMap; +using HostIdRowMap = QHash; class ProgressWidget : public QWidget diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index b8b41432..af11d5b4 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -163,17 +163,17 @@ private slots: GanttTimeScaleWidget *mTimeScale; using SlotList = QList; - typedef QMap NodeMap; + using NodeMap = QMap; NodeMap mNodeMap; - typedef QMap AgeMap; + using AgeMap = QMap; AgeMap mAgeMap; - typedef QMap JobMap; + using JobMap = QMap; JobMap mJobMap; - typedef QMap NodeLayoutMap; + using NodeLayoutMap = QMap; NodeLayoutMap mNodeLayouts; - typedef QMap NodeRowMap; + using NodeRowMap = QMap; NodeRowMap mNodeRows; - typedef QMap NodeLabelMap; + using NodeLabelMap = QMap; NodeLabelMap mNodeLabels; QTimer *m_progressTimer; QTimer *m_ageTimer; From 9e3ddedbe606b02a9eb6f30ad08cacd0c29a776e Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:13:03 +0100 Subject: [PATCH 73/77] Update .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index c6035840..aa5c3597 100644 --- a/.gitignore +++ b/.gitignore @@ -85,3 +85,9 @@ icemon *.BASE.* *.LOCAL.* *.REMOTE.* + +# Others +# ------ +.clangd +.vscode +build*/* From 3b0c6b9a62846afba2be79db5f75d8dc505be48c Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:17:30 +0100 Subject: [PATCH 74/77] clang-tidy: modernize-use-default-member-init --- src/icecreammonitor.cc | 4 ---- src/icecreammonitor.h | 8 ++++---- src/job.cc | 12 ------------ src/job.h | 24 ++++++++++++------------ src/mainwindow.cc | 10 ++-------- src/mainwindow.h | 4 ++-- src/models/joblistmodel.cc | 4 ---- src/models/joblistmodel.h | 8 ++++---- src/monitor.cc | 2 -- src/monitor.h | 4 ++-- src/statusview.cc | 1 - src/statusview.h | 2 +- src/views/flowtableview.cc | 1 - src/views/flowtableview.h | 2 +- src/views/ganttstatusview.cc | 3 --- src/views/ganttstatusview.h | 6 +++--- src/views/summaryview.cc | 7 +------ src/views/summaryview.h | 21 ++++++++------------- 18 files changed, 40 insertions(+), 83 deletions(-) diff --git a/src/icecreammonitor.cc b/src/icecreammonitor.cc index 55d41556..75fa487d 100644 --- a/src/icecreammonitor.cc +++ b/src/icecreammonitor.cc @@ -53,10 +53,6 @@ using namespace std; IcecreamMonitor::IcecreamMonitor(HostInfoManager *manager, QObject *parent) : Monitor(manager, parent) - , m_scheduler(nullptr) - , m_discover(nullptr) - , m_fd_notify(nullptr) - , m_fd_type(QSocketNotifier::Exception) { setupDebug(); checkScheduler(); diff --git a/src/icecreammonitor.h b/src/icecreammonitor.h index 3bf14dcf..c504ea19 100644 --- a/src/icecreammonitor.h +++ b/src/icecreammonitor.h @@ -63,11 +63,11 @@ private slots: void handle_local_done(Msg *m); JobList m_rememberedJobs; - MsgChannel *m_scheduler; + MsgChannel *m_scheduler{nullptr}; - DiscoverSched *m_discover; - QSocketNotifier *m_fd_notify; - QSocketNotifier::Type m_fd_type; + DiscoverSched *m_discover{nullptr}; + QSocketNotifier *m_fd_notify{nullptr}; + QSocketNotifier::Type m_fd_type{QSocketNotifier::Exception}; }; #endif // ICEMON_ICECREAMMONITOR_H diff --git a/src/job.cc b/src/job.cc index dda3a636..eab231e9 100644 --- a/src/job.cc +++ b/src/job.cc @@ -28,20 +28,8 @@ Job::Job(unsigned int id, unsigned int client, const QString &filename, const QString &lang) : id(id) , fileName(filename) - , server(0) , client(client) , lang(lang) - , state(WaitingForCS) - , startTime{} - , real_msec(0) - , user_msec(0) - , sys_msec(0) - , pfaults(0) - , exitcode(0) - , in_compressed(0) - , in_uncompressed(0) - , out_compressed(0) - , out_uncompressed(0) { } diff --git a/src/job.h b/src/job.h index 0d03d9b1..7654275b 100644 --- a/src/job.h +++ b/src/job.h @@ -47,23 +47,23 @@ class Job unsigned int id; QString fileName; - unsigned int server; + unsigned int server{0}; unsigned int client; QString lang; - State state; - time_t startTime; + State state{WaitingForCS}; + time_t startTime{}; - unsigned int real_msec; /* real time it used */ - unsigned int user_msec; /* user time used */ - unsigned int sys_msec; /* system time used */ - unsigned int pfaults; /* page faults */ + unsigned int real_msec{0}; /* real time it used */ + unsigned int user_msec{0}; /* user time used */ + unsigned int sys_msec{0}; /* system time used */ + unsigned int pfaults{0}; /* page faults */ - int exitcode; /* exit code */ + int exitcode{0}; /* exit code */ - unsigned int in_compressed; - unsigned int in_uncompressed; - unsigned int out_compressed; - unsigned int out_uncompressed; + unsigned int in_compressed{0}; + unsigned int in_uncompressed{0}; + unsigned int out_compressed{0}; + unsigned int out_uncompressed{0}; }; QDebug operator<<(QDebug dbg, const Job &job); diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 36e03dbe..52e2787c 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -49,20 +49,14 @@ namespace { struct PlatformStat { - PlatformStat() - : jobs(0) - , maxJobs(0) {} - - unsigned int jobs; - unsigned int maxJobs; + unsigned int jobs{0}; + unsigned int maxJobs{0}; }; } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) - , m_view(nullptr) - , m_systemTrayIcon(nullptr) { QIcon appIcon = QIcon(); appIcon.addFile(QStringLiteral(":/images/128-apps-icemon.png"), QSize(128, 128)); diff --git a/src/mainwindow.h b/src/mainwindow.h index 43c497d0..7d941aa2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -84,8 +84,8 @@ private slots: HostInfoManager *m_hostInfoManager; QPointer m_monitor; - StatusView *m_view; - QSystemTrayIcon* m_systemTrayIcon; + StatusView *m_view{nullptr}; + QSystemTrayIcon* m_systemTrayIcon{nullptr}; QLabel *m_schedStatusWidget; QLabel *m_jobStatsWidget; diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index 5b871493..80836778 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -79,11 +79,7 @@ static QString trimFilePath(const QString &filePath, int numberOfFilePathParts) JobListModel::JobListModel(QObject *parent) : QAbstractListModel(parent) - , m_numberOfFilePathParts(2) - , m_expireDuration(-1) , m_expireTimer(new QTimer(this)) - , m_jobType(AllJobs) - , m_hostId(0) { connect(m_expireTimer, SIGNAL(timeout()), this, SLOT(slotExpireFinishedJobs())); diff --git a/src/models/joblistmodel.h b/src/models/joblistmodel.h index 65d5d212..48c4e54f 100644 --- a/src/models/joblistmodel.h +++ b/src/models/joblistmodel.h @@ -109,7 +109,7 @@ private Q_SLOTS: * the complete file path is displayed else .../partN/.../part1/fileName. * Default is 2. */ - int m_numberOfFilePathParts; + int m_numberOfFilePathParts{2}; /** * The number of seconds after which finished jobs should be expired. @@ -118,7 +118,7 @@ private Q_SLOTS: * - > 0 after some seconds. * Default is -1. */ - int m_expireDuration; + int m_expireDuration{-1}; struct FinishedJob { @@ -134,8 +134,8 @@ private Q_SLOTS: FinishedJobs m_finishedJobs; QTimer *m_expireTimer; - JobType m_jobType; - unsigned int m_hostId; + JobType m_jobType{AllJobs}; + unsigned int m_hostId{0}; }; class JobListSortFilterProxyModel diff --git a/src/monitor.cc b/src/monitor.cc index 8b78c0d5..7b0f5605 100644 --- a/src/monitor.cc +++ b/src/monitor.cc @@ -25,8 +25,6 @@ Monitor::Monitor(HostInfoManager *manager, QObject *parent) : QObject(parent) , m_hostInfoManager(manager) - , m_currentSchedport(0) - , m_schedulerState(Offline) { } diff --git a/src/monitor.h b/src/monitor.h index 90050dcd..708cecc3 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -77,8 +77,8 @@ public HostInfoManager *m_hostInfoManager; QByteArray m_currentNetname; QByteArray m_currentSchedname; - uint m_currentSchedport; - SchedulerState m_schedulerState; + uint m_currentSchedport{0}; + SchedulerState m_schedulerState{Offline}; }; #endif // ICEMON_MONITOR_H diff --git a/src/statusview.cc b/src/statusview.cc index da242d65..013fbc46 100644 --- a/src/statusview.cc +++ b/src/statusview.cc @@ -32,7 +32,6 @@ StatusView::StatusView(QObject *parent) : QObject(parent) - , m_paused(false) { } diff --git a/src/statusview.h b/src/statusview.h index b80ad9b0..524f9845 100644 --- a/src/statusview.h +++ b/src/statusview.h @@ -86,7 +86,7 @@ protected Q_SLOTS: private: QPointer m_monitor; - bool m_paused; + bool m_paused{false}; }; #endif diff --git a/src/views/flowtableview.cc b/src/views/flowtableview.cc index 291d2080..4d1864e2 100644 --- a/src/views/flowtableview.cc +++ b/src/views/flowtableview.cc @@ -30,7 +30,6 @@ ProgressWidget::ProgressWidget(HostInfo *info, StatusView *statusView, QWidget * : QWidget(parent) , m_hostInfo(info) , m_statusView(statusView) - , m_isVirgin(true) { setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent); diff --git a/src/views/flowtableview.h b/src/views/flowtableview.h index 127a30a1..30ff9d7d 100644 --- a/src/views/flowtableview.h +++ b/src/views/flowtableview.h @@ -50,7 +50,7 @@ class ProgressWidget StatusView *m_statusView; Job m_currentJob; QImage m_backingStore; - bool m_isVirgin; + bool m_isVirgin{true}; }; class FlowTableView diff --git a/src/views/ganttstatusview.cc b/src/views/ganttstatusview.cc index 161fb295..cf18df9a 100644 --- a/src/views/ganttstatusview.cc +++ b/src/views/ganttstatusview.cc @@ -79,7 +79,6 @@ bool GanttConfigDialog::isTimeScaleVisible() GanttTimeScaleWidget::GanttTimeScaleWidget(QWidget *parent) : QWidget(parent) - , mPixelsPerSecond(40) { QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::white); @@ -130,8 +129,6 @@ void GanttTimeScaleWidget::paintEvent(QPaintEvent *pe) GanttProgress::GanttProgress(StatusView *statusView, QWidget *parent) : QWidget(parent) , mStatusView(statusView) - , mClock(0) - , mIsFree(true) { QPalette pal = palette(); pal.setColor(backgroundRole(), Qt::white); diff --git a/src/views/ganttstatusview.h b/src/views/ganttstatusview.h index af11d5b4..257e9ee8 100644 --- a/src/views/ganttstatusview.h +++ b/src/views/ganttstatusview.h @@ -64,7 +64,7 @@ class GanttTimeScaleWidget void paintEvent(QPaintEvent *e) override; private: - int mPixelsPerSecond; + int mPixelsPerSecond{40}; }; class GanttProgress @@ -114,9 +114,9 @@ public slots: QList m_jobs; - int mClock; + int mClock{0}; - bool mIsFree; + bool mIsFree{true}; }; class GanttStatusView diff --git a/src/views/summaryview.cc b/src/views/summaryview.cc index 72e2474e..d0bf9ca4 100644 --- a/src/views/summaryview.cc +++ b/src/views/summaryview.cc @@ -60,12 +60,7 @@ class SummaryViewScrollArea //////////////////////////////////////////////////////////////////////////////// SummaryViewItem::SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryView *view, QGridLayout *layout) - : m_jobCount(0) - , m_totalJobsLength(0.0f) - , m_finishedJobCount(0) - , m_totalRequestedJobsLength(0.0f) - , m_requestedJobCount(0) - , m_view(view) + : m_view(view) { const int row = layout->rowCount(); const QColor nodeColor = view->hostInfoManager()->hostColor(hostid); diff --git a/src/views/summaryview.h b/src/views/summaryview.h index 1e39cf67..224e2863 100644 --- a/src/views/summaryview.h +++ b/src/views/summaryview.h @@ -48,26 +48,21 @@ class SummaryViewItem struct JobHandler { - JobHandler() - : stateWidget(nullptr) - , sourceLabel(nullptr) - , stateLabel(nullptr) {} - - QFrame *stateWidget; - QLabel *sourceLabel; - QLabel *stateLabel; + QFrame *stateWidget{nullptr}; + QLabel *sourceLabel{nullptr}; + QLabel *stateLabel{nullptr}; QString currentFile; }; QLabel *m_speedLabel; QLabel *m_jobsLabel; - int m_jobCount; - double m_totalJobsLength; - int m_finishedJobCount; + int m_jobCount{0}; + double m_totalJobsLength{0.0f}; + int m_finishedJobCount{0}; - double m_totalRequestedJobsLength; - int m_requestedJobCount; + double m_totalRequestedJobsLength{0.0f}; + int m_requestedJobCount{0}; SummaryView *m_view; From 5bd3eb7106b67adaee104042486be223a67ae12f Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:18:12 +0100 Subject: [PATCH 75/77] clangd: Fix unused includes warnings --- src/mainwindow.cc | 2 -- src/models/joblistmodel.cc | 1 - src/statusview.cc | 1 - 3 files changed, 4 deletions(-) diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 52e2787c..1eca3075 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -30,8 +30,6 @@ #include "statusview.h" #include "statusviewfactory.h" -#include "utils.h" - #include #include #include diff --git a/src/models/joblistmodel.cc b/src/models/joblistmodel.cc index 80836778..08a7690e 100644 --- a/src/models/joblistmodel.cc +++ b/src/models/joblistmodel.cc @@ -31,7 +31,6 @@ #include #include -#include static QString formatByteSize(unsigned int value) { diff --git a/src/statusview.cc b/src/statusview.cc index 013fbc46..0d0527bb 100644 --- a/src/statusview.cc +++ b/src/statusview.cc @@ -25,7 +25,6 @@ #include "hostinfo.h" #include "job.h" -#include "utils.h" #include #include From c14b4530f3404af96262fcce51760fa1570eeb3f Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:50:23 +0100 Subject: [PATCH 76/77] doc: Use pandoc to generate manpage Let's use use much less dependencies to generate a manpage (just pandoc and a few dependencies) instead of the archaic asciidoc framework. And also let's use more widely known Markdown as input format. --- CMakeLists.txt | 1 + doc/CMakeLists.txt | 32 +++++++++++++-------------- doc/icemon.adoc | 54 ---------------------------------------------- doc/icemon.md | 36 +++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 70 deletions(-) delete mode 100644 doc/icemon.adoc create mode 100644 doc/icemon.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f7cd0b2..2cea7d2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,7 @@ include(CheckCXXCompilerFlag) include(CheckCXXSourceCompiles) include(GNUInstallDirs) include(CheckIncludeFileCXX) +include(FindPackageHandleStandardArgs) include(FeatureSummary) include(ECMInstallIcons) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8138dfe0..cfe3ec50 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,25 +1,25 @@ # It's not possible to install the docbook right now (Qt-only project) #add_subdirectory(icemon) -find_program(ASCIIDOC asciidoc) -find_program(A2X a2x) +find_program(pandoc_EXECUTABLE pandoc) +find_package_handle_standard_args(pandoc + REQUIRED_VARS + pandoc_EXECUTABLE +) +mark_as_advanced(pandoc_EXECUTABLE) +set_package_properties(pandoc PROPERTIES + TYPE REQUIRED + DESCRIPTION "A universal document converter. Used for generating manpages." + URL "https://pandoc.org/" +) -if(NOT ASCIIDOC OR NOT A2X) - message(WARNING "Could not find asciidoc or a2x, manual page will not be generated.") -else() - add_custom_target(manpage ALL) +if (pandoc_FOUND) + add_custom_target(manpage) add_custom_command( TARGET manpage - COMMAND ${ASCIIDOC} -a revnumber=${PROJECT_VERSION} -d manpage -b docbook - -o ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml ${CMAKE_CURRENT_SOURCE_DIR}/icemon.adoc - MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/icemon.adoc - BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml) - add_custom_command( - TARGET manpage - COMMAND ${A2X} --doctype manpage --format manpage - ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - MAIN_DEPENDENCY ${CMAKE_CURRENT_BINARY_DIR}/icemon.xml + COMMAND ${pandoc_EXECUTABLE} -s -t man ${CMAKE_CURRENT_SOURCE_DIR}/icemon.md + -o ${CMAKE_CURRENT_BINARY_DIR}/icemon.1 + MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/icemon.md BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/icemon.1) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/icemon.1 diff --git a/doc/icemon.adoc b/doc/icemon.adoc deleted file mode 100644 index 7a233892..00000000 --- a/doc/icemon.adoc +++ /dev/null @@ -1,54 +0,0 @@ -ICEMON(1) -========= -:doctype: manpage -:man source: icemon -:man version: {revnumber} -:man manual: Icemon User's Manual - - -Name ----- -icemon - Icecream network monitor - - -Synopsis --------- -*icemon* _OPTION_ - - -Description ------------ -Icemon is a graphical application to view an Icecream compile network and monitor its traffic. - - - -Options -------- - -*-h, --help*:: - Print help message and exit. - -*-n, --netname* _net-name_:: - The name of the Icecream network `icemon` should connect to. - -*-s, --scheduler* _host-name_:: - The hostname of the Icecream scheduler `icemon` should connect to. - - - -See Also --------- -ifdef::env-github[] -link:https://github.com/icecc/icecream/tree/master/doc/icecream.adoc[icecream(7)] -link:https://github.com/icecc/icecream/tree/master/doc/icecc-scheduler.adoc[icecc-scheduler(1)] -link:https://github.com/icecc/icecream/tree/master/doc/iceccd.adoc[iceccd(1)] -endif::[] - -ifndef::env-github[] -icecream(7), icecc-scheduler(1), iceccd(1) -endif::[] - - -Website -------- -Project home: https://github.com/icecc/icemon diff --git a/doc/icemon.md b/doc/icemon.md new file mode 100644 index 00000000..1e202840 --- /dev/null +++ b/doc/icemon.md @@ -0,0 +1,36 @@ +% ICEMON(1) Icemon User Manuals + +# icemon(1) + +## Name + +`icemon` — Icecream network monitor + +## Synopsis + +**icemon** *OPTION* + +## Description + +Icemon is a graphical application to view an Icecream compile network and monitor its traffic. + +## Options + +- **-h, --help** + Print help message and exit. + +- **-n, --netname** *net-name* + The name of the Icecream network `icemon` should connect to. + +- **-s, --scheduler** *host-name* + The hostname of the Icecream scheduler `icemon` should connect to. + +## See Also + +- (icecream(7)) +- (icecc-scheduler(1)) +- (iceccd(1)) + +## Website + +Project home: From 94125709e44e6358e31ad5bb6c6469e484b02fad Mon Sep 17 00:00:00 2001 From: Kevin Funk Date: Thu, 5 Mar 2026 08:52:32 +0100 Subject: [PATCH 77/77] workflows: Add docs building to CI --- .github/workflows/cmake-single-platform.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 0064615a..bb45fc87 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -23,7 +23,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v4 - name: Install dependencies (linux) - run: sudo apt install ninja-build extra-cmake-modules libicecc-dev + run: sudo apt install ninja-build extra-cmake-modules libicecc-dev pandoc - uses: actions/checkout@v4 - name: Configure CMake @@ -32,5 +32,7 @@ jobs: run: cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build - # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + + - name: Docs + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target manpage