1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
/*
* Copyright (c) 2012-2014, Red Hat.
* Copyright (c) 2007-2008, Aconex. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef PMCHART_H
#define PMCHART_H
#include "ui_pmchart.h"
#include "statusbar.h"
#include <qmc_time.h>
class TimeAxis;
class NameSpace;
class TabDialog;
class InfoDialog;
class ChartDialog;
class ExportDialog;
class SearchDialog;
class SamplesDialog;
class OpenViewDialog;
class SaveViewDialog;
class SettingsDialog;
class PmChart : public QMainWindow, public Ui::PmChart
{
Q_OBJECT
public:
PmChart();
typedef enum {
DebugApp = 0x1,
DebugUi = 0x1,
DebugProtocol = 0x2,
DebugView = 0x4,
DebugTimeless = 0x8,
DebugForce = 0x10,
} DebugOptions;
static int defaultFontSize();
static const char *defaultFontFamily() { return "Sans Serif"; }
static double defaultChartDelta() { return 1.0; } // seconds
static double defaultLoggerDelta() { return 1.0; }
static int defaultVisibleHistory() { return 60; } // points
static int defaultSampleHistory() { return 180; }
static int defaultTimeout() { return 8000; } // milliseconds
static int minimumPoints() { return 2; }
static int maximumPoints() { return 720; }
static int maximumLegendLength() { return 120; } // chars
static int minimumChartHeight() { return 80; } // pixels
Tab *activeTab() { return chartTabWidget->activeTab(); }
void setActiveTab(int index, bool redisplay);
void addActiveTab(Tab *tab);
bool isArchiveTab();
bool isTabRecording();
TabWidget *tabWidget() { return chartTabWidget; }
TimeAxis *timeAxis() { return my.statusBar->timeAxis(); }
QLabel *dateLabel() { return my.statusBar->dateLabel(); }
Chart *acceptNewChart();
virtual void step(bool livemode, QmcTime::Packet *pmtime);
virtual void VCRMode(bool livemode, QmcTime::Packet *pmtime, bool drag);
virtual void timeZone(bool livemode, QmcTime::Packet *pmtime, char *tzdata);
virtual void setStyle(char *style);
virtual void updateHeight(int);
virtual void metricInfo(QString src, QString m, QString inst, int srcType);
virtual void metricSearch(QTreeWidget *pmns);
virtual void createNewTab(bool liveMode);
virtual void setValueText(QString &text);
virtual void setDateLabel(QString label);
virtual void setDateLabel(time_t seconds, QString tz);
virtual void setButtonState(QedTimeButton::State state);
virtual void setRecordState(bool recording);
virtual void updateToolbarContents();
virtual void updateToolbarLocation();
virtual QList<QAction*> toolbarActionsList();
virtual QList<QAction*> enabledActionsList();
virtual void setupEnabledActionsList();
virtual void addSeparatorAction();
virtual void setEnabledActionsList(QStringList tools, bool redisplay);
virtual void newScheme(); // request new scheme of settings dialog
virtual void newScheme(QString); // reply back to requesting dialog(s)
virtual void updateBackground();
virtual void updateFont(const QString &family, const QString &style, int size);
void painter(QPainter *qp, int pw, int ph, bool transparent, bool currentOnly);
// Adjusted height for exporting images (without UI elements)
int exportHeight()
{ return height() - menuBar()->height() - toolBar->height(); }
public slots:
virtual void init();
virtual void quit();
virtual void enableUi();
virtual void exportFile();
virtual void setupDialogs();
virtual void fileOpenView();
virtual void fileSaveView();
virtual void fileExport();
virtual void acceptExport();
virtual void filePrint();
virtual void fileQuit();
virtual void helpManual();
virtual void helpAbout();
virtual void helpAboutQt();
virtual void helpSeeAlso();
virtual void whatsThis();
virtual void optionsShowTimeControl();
virtual void optionsHideTimeControl();
virtual void optionsToolbar();
virtual void optionsConsole();
virtual void optionsNewPmchart();
virtual void fileNewChart();
virtual void editChart();
virtual void acceptEditChart();
virtual void closeChart();
virtual void editTab();
virtual void acceptEditTab();
virtual void editSamples();
virtual void acceptEditSamples();
virtual void addTab();
virtual void acceptNewTab();
virtual void closeTab();
virtual void activeTabChanged(int);
virtual void editSettings();
virtual void recordStart();
virtual void recordQuery();
virtual void recordStop();
virtual void recordDetach();
virtual void timeout();
virtual void zoomIn();
virtual void zoomOut();
virtual void updateToolbarOrientation(Qt::Orientation);
protected slots:
virtual void languageChange();
virtual void closeEvent(QCloseEvent *);
private:
struct {
bool dialogsSetup;
bool toolbarHidden;
bool consoleHidden;
TabDialog *newtab;
TabDialog *edittab;
InfoDialog *info;
ChartDialog *newchart; // shared by New and Edit Chart actions
ExportDialog *exporter;
SearchDialog *search;
SamplesDialog *samples;
OpenViewDialog *openview;
SaveViewDialog *saveview;
SettingsDialog *settings;
QList<QAction*> separatorsList; // separator follow these
QList<QAction*> toolbarActionsList; // all toolbar actions
QList<QAction*> enabledActionsList; // currently visible actions
int timeAxisRightAlign;
StatusBar *statusBar;
} my;
void editTab(int index);
};
#endif // PMCHART_H
|