Icemon  3.3
icecc-monitor is a monitoring application for icecc (a distributed compiler)
summaryview.h
1 /*
2  This file is part of Icecream.
3 
4  Copyright (c) 2004 Scott Wheeler <wheeler@kde.org>
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef SUMMARYVIEW_H
22 #define SUMMARYVIEW_H
23 
24 #include "statusview.h"
25 
26 #include <QScrollArea>
27 #include <QResizeEvent>
28 
29 class QLabel;
30 class QGridLayout;
31 
32 class SummaryView;
34 
36 {
37 public:
38  SummaryViewItem(unsigned int hostid, QWidget *parent, SummaryView *view, QGridLayout *layout);
39  ~SummaryViewItem();
40  void update(const Job &job);
41  void updateClient(const Job &job);
42 
43 private:
44  QLabel *addLine(const QString &caption, QWidget *parent, QGridLayout *grid,
45  Qt::Alignment flags = Qt::AlignTop,
46  const QString &status = QString());
47  void updateStats();
48 
49  struct JobHandler
50  {
51  JobHandler()
52  : stateWidget(nullptr)
53  , sourceLabel(nullptr)
54  , stateLabel(nullptr) {}
55 
56  QFrame *stateWidget;
57  QLabel *sourceLabel;
58  QLabel *stateLabel;
59  QString currentFile;
60  };
61 
62  QLabel *m_speedLabel;
63  QLabel *m_jobsLabel;
64 
65  int m_jobCount;
66  double m_totalJobsLength;
67  int m_finishedJobCount;
68 
69  double m_totalRequestedJobsLength;
70  int m_requestedJobCount;
71 
72  SummaryView *m_view;
73 
74  QVector<JobHandler> m_jobHandlers;
75  QList<QWidget *> m_widgets;
76 };
77 
79  : public StatusView
80 {
81  Q_OBJECT
82 
83 public:
84  explicit SummaryView(QObject *parent = nullptr);
85  ~SummaryView() override;
86 
87  QWidget *widget() const override;
88 
89  void setMonitor(Monitor *monitor) override;
90  void update(const Job &job) override;
91  void removeNode(unsigned int hostid) override;
92  void checkNode(unsigned int hostid) override;
93  QString id() const override { return QStringLiteral("summary"); }
94 
95 private:
96  QScopedPointer<SummaryViewScrollArea> m_widget;
97 
98  QMap<unsigned int, SummaryViewItem *> m_items;
99  QGridLayout *m_layout;
100  QWidget *m_base;
101 
102  void createKnownHosts();
103 };
104 
105 #endif
Definition: job.h:30
Definition: summaryview.h:78
Definition: summaryview.h:35
Definition: summaryview.cc:49
Definition: monitor.h:36
Definition: statusview.h:39