Debian Codegraph @

src/statusview.h

raw
1 /*
2 This file is part of Icecream.
3
4 Copyright (c) 2003 Frerich Raabe <[email protected]>
5 Copyright (c) 2003,2004 Stephan Kulow <[email protected]>
6 Copyright (c) 2003,2004 Cornelius Schumacher <[email protected]>
7 Copyright (c) 2014 Kevin Funk <[email protected]>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23 #ifndef ICEMON_STATUSVIEW_H
24 #define ICEMON_STATUSVIEW_H
25
26 #include "monitor.h"
27 #include "types.h"
28
29 #include <QObject>
30 #include <QPointer>
31
32 class HostInfoManager;
33 class Job;
34
35 class QColor;
36 class QString;
37 class QWidget;
38
39 class StatusView
40 : public QObject
41 {
42 Q_OBJECT
43
44 public:
45 enum Option {
46 NoOptions = 0, ///< No option
47 RememberJobsOption = 1 ///< Show old jobs in case this view gets reactivated
48 };
49 Q_DECLARE_FLAGS(Options, Option)
50
51 explicit StatusView(QObject *parent = nullptr);
52 ~StatusView() override;
53
54 virtual Options options() const;
55
56 Monitor *monitor() const;
57 virtual void setMonitor(Monitor *monitor);
58
59 /// Convenience function to access the Monitor's host info manager
60 HostInfoManager *hostInfoManager() const;
61
62 virtual QWidget *widget() const = 0;
63
64 virtual bool isPausable() { return false; }
65 virtual bool isConfigurable() { return false; }
66
67 virtual void checkNodes() {}
68 virtual void configureView() {}
69
70 virtual void stop() {}
71 virtual void start() {}
72 void togglePause();
73
74 virtual QString id() const = 0;
75
76 unsigned int processor(const Job &);
77
78 QString nameForHost(unsigned int hostid);
79 QColor hostColor(unsigned int hostid);
80
81 protected Q_SLOTS:
82 virtual void update(const Job &job);
83 virtual void checkNode(HostId hostid);
84 virtual void removeNode(HostId hostid);
85 virtual void updateSchedulerState(Monitor::SchedulerState state);
86
87 private:
88 QPointer<Monitor> m_monitor;
89 bool m_paused{false};
90 };
91
92 #endif
93 // vim:ts=4:sw=4:noet