Debian Codegraph @

src/mainwindow.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
24 #ifndef ICEMON_MAINWINDOW_H
25 #define ICEMON_MAINWINDOW_H
26
27 #include <QMainWindow>
28 #include <QPointer>
29
30 #include "monitor.h"
31 #include "job.h"
32
33 class HostInfoManager;
34 class StatusView;
35
36 class QActionGroup;
37 class QLabel;
38
39 class MainWindow
40 : public QMainWindow
41 {
42 Q_OBJECT
43
44 public:
45 explicit MainWindow(QWidget *parent = nullptr);
46 ~MainWindow() override;
47
48 void setCurrentNet(const QByteArray &netname);
49 void setCurrentSched(const QByteArray &schedname);
50 void setCurrentPort(uint schedport);
51
52 Monitor *monitor() const;
53 StatusView *view() const;
54
55 void setTestModeEnabled(bool testMode);
56
57 protected:
58 void closeEvent(QCloseEvent *e) override;
59
60 private slots:
61 void pauseView();
62 void configureView();
63
64 void about();
65
66 void updateSchedulerState(Monitor::SchedulerState state);
67 void updateJob(const Job &);
68 void updateJobStats();
69
70 void handleViewModeActionTriggered(QAction *action);
71
72 private:
73 void readSettings();
74 void writeSettings();
75
76 /// Does *not* take ownership over @p monitor
77 void setMonitor(Monitor *monitor);
78 /// Takes ownership over @p view
79 void setView(StatusView *view);
80
81 HostInfoManager *m_hostInfoManager;
82 QPointer<Monitor> m_monitor;
83 StatusView *m_view;
84
85 QLabel *m_schedStatusWidget;
86 QLabel *m_jobStatsWidget;
87
88 QActionGroup *m_viewMode;
89 QAction *m_configureViewAction;
90 QAction *m_pauseViewAction;
91
92 JobList m_activeJobs;
93 };
94
95 #endif // ICEMON_MAINWINDOW_H
96 // vim:ts=4:sw=4:et