| 1 |
/* |
| 2 |
This file is part of Icecream. |
| 3 |
|
| 4 |
Copyright (c) 2011 Daniel Molkentin <[email protected]> |
| 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 FLOWTABLEVIEW_H |
| 22 |
#define FLOWTABLEVIEW_H |
| 23 |
|
| 24 |
#include "job.h" |
| 25 |
#include "hostinfo.h" |
| 26 |
#include "statusview.h" |
| 27 |
|
| 28 |
#include <QScopedPointer> |
| 29 |
#include <QTableWidget> |
| 30 |
#include <QTableWidgetItem> |
| 31 |
|
| 32 |
class Job; |
| 33 |
|
| 34 |
using HostIdRowMap = QHash<int, int>; |
| 35 |
|
| 36 |
class ProgressWidget |
| 37 |
: public QWidget |
| 38 |
{ |
| 39 |
Q_OBJECT |
| 40 |
public: |
| 41 |
ProgressWidget(HostInfo *info, StatusView *statusView, QWidget *parent = nullptr); |
| 42 |
|
| 43 |
void setCurrentJob(const Job &job) { m_currentJob = job; } |
| 44 |
Job currentJob() const { return m_currentJob; } |
| 45 |
|
| 46 |
void resizeEvent(QResizeEvent *) override; |
| 47 |
void paintEvent(QPaintEvent *) override; |
| 48 |
private: |
| 49 |
HostInfo *m_hostInfo; |
| 50 |
StatusView *m_statusView; |
| 51 |
Job m_currentJob; |
| 52 |
QImage m_backingStore; |
| 53 |
bool m_isVirgin{true}; |
| 54 |
}; |
| 55 |
|
| 56 |
class FlowTableView |
| 57 |
: public StatusView |
| 58 |
{ |
| 59 |
Q_OBJECT |
| 60 |
public: |
| 61 |
explicit FlowTableView(QObject *parent); |
| 62 |
|
| 63 |
QWidget *widget() const override; |
| 64 |
|
| 65 |
void setMonitor(Monitor *monitor) override; |
| 66 |
|
| 67 |
void update(const Job &job) override; |
| 68 |
void checkNode(unsigned int hostid) override; |
| 69 |
void removeNode(unsigned int hostid) override; |
| 70 |
|
| 71 |
QString id() const override { return QStringLiteral("flow"); } |
| 72 |
|
| 73 |
void stop() override {} |
| 74 |
void start() override {} |
| 75 |
|
| 76 |
bool isPausable() override { return false; } |
| 77 |
bool isConfigurable() override { return false; } |
| 78 |
|
| 79 |
private: |
| 80 |
QScopedPointer<QTableWidget> m_widget; |
| 81 |
QString hostInfoText(HostInfo *hostInfo); |
| 82 |
HostIdRowMap m_idToRowMap; |
| 83 |
QTimer *m_updateTimer; |
| 84 |
|
| 85 |
void createKnownHosts(); |
| 86 |
}; |
| 87 |
|
| 88 |
#endif // FLOWTABLEVIEW_H |