summaryrefslogtreecommitdiff
path: root/src/pmchart/tab.h
blob: a9bc0f572ea4c7fb217c94230404ad3fce196bf1 (plain)
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
/*
 * Copyright (c) 2006-2008, Aconex.  All Rights Reserved.
 * Copyright (c) 2006, Ken McDonell.  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 TAB_H
#define TAB_H

#include <QtCore/QList>
#include <QtGui/QSplitter>
#include <QtGui/QTabWidget>
#include "groupcontrol.h"
#include "gadget.h"

class PmLogger;

class Tab : public QWidget
{
    Q_OBJECT

public:
    Tab();
    void init(QTabWidget *, GroupControl *, QString);
    QWidget *splitter() { return my.splitter; }
    GroupControl *group() { return my.group; }
    bool isArchiveSource();	// query if tab is for archives

    void addGadget(Gadget *);	// append gadget to the Tab, make it current
    int deleteCurrent();	// remove current gadget, return new current
    int deleteGadget(Gadget *);	// remove given gadget, return current index
    int deleteGadget(int);	// remove 'N'th gadget, return current index

    int gadgetCount();		// count of entries in the list of gadgets
    Gadget *gadget(int);	// gadget at specified list position
    Gadget *currentGadget();	// current gadget (can be NULL)
    void setCurrent(Gadget *);
    int currentGadgetIndex();	// current gadget index (can be -1)
    void setCurrentGadget(int);

    void showGadgets();

    void addFolio(QString, QString);
    void addLogger(PmLogger *, QString);

    bool isRecording();
    bool startRecording();
    void queryRecording();
    void stopRecording();
    void detachLoggers();

private:
    void cleanupRecording();

    struct {
	QSplitter *splitter;		// dynamically divides charts

	GroupControl *group;
	QList<Gadget*> gadgetsList;
	int currentGadget;

	bool recording;			// running any pmlogger's?
	QString view;
	QString folio;
	QList<QString> archiveList;	// list of archive names
	QList<PmLogger*> loggerList;	// list of pmloggers for our Tab
    } my;
};

#endif	// TAB_H