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