GobChartsWidget  1.0
gobchartstoolswidget.h
1 /* Copyright (C) 2012 by William Hallatt.
2  *
3  * This file forms part of the "GobChartsWidget" library.
4  *
5  * This library is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have downloaded a copy of the GNU General Public License
16  * (GNUGPL.txt) and GNU Lesser General Public License (GNULGPL.txt)
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * The official website for this project is www.goblincoding.com and,
20  * although not compulsory, it would be appreciated if all works of whatever
21  * nature referring to or using this library include a reference to this site.
22  */
23 
24 #ifndef GOBCHARTSTOOLSWIDGET_H
25 #define GOBCHARTSTOOLSWIDGET_H
26 
27 #include <QFrame>
28 #include "utils/globalincludes.h"
29 #include "utils/gobchartsnocopy.h"
30 
31 namespace Ui
32 {
34 }
35 
36 class QAbstractButton;
37 class QDomNode;
38 
40 
43 class GobChartsToolsWidget : public QFrame,
44  public GobChartsNoCopy
45 {
46  Q_OBJECT
47 
48 public:
50  explicit GobChartsToolsWidget( QWidget *parent = 0 );
51 
54 
58  QString getStateXML() const;
59 
64  void setStateXML( GobChartsType type, const QDomNode &toolNode );
65 
68  void emitStateSignals();
69 
70 public slots:
75  void receiveLabelDetails( GobChartsLabel label, QString text, QFont font, QColor colour, Qt::Alignment align);
76 
77 signals:
79  void clearChart();
80 
83  void saveChart();
84 
87  void loadChart();
88 
90  void createChart( GobChartsType );
91 
96  void setFixedColour( QColor );
97 
101  void setRandomColours();
102 
108  void setAllowedDataRange( qreal, qreal );
109 
113  void setShowTotalRange();
114 
116  void setGridLineStyle( Qt::PenStyle );
117 
120  void setVerticalGridLines( bool, int );
121 
124  void setHorizontalGridLines( bool, int );
125 
127  void setGridColour( QColor );
128 
131  void setLabelDetails( GobChartsLabel, QString, QFont, QColor, Qt::Alignment );
132 
135  void requestLabelDetails( GobChartsLabel );
136 
137 private slots:
138  void chartTypeChanged( QAbstractButton *button );
139  void chartColourPreferenceChanged();
140  void chartRangePreferenceChanged();
141  void chartRangePreferenceSelected();
142  void gridLinePreferenceChanged( QAbstractButton *button );
143  void gridLineNumbersChanged();
144  void gridLinesSelected();
145  void gridColourSelected();
146  void updateLabelDetails();
147  void labelColourPreferenceChanged();
148  void labelAlignmentPreferenceChanged( QAbstractButton *button );
149  void generateLabelDetailRequest( QAbstractButton *button );
150  void clearAndReset();
151 
152 private:
153  Ui::GobChartsToolsWidget *ui;
154 
155  friend class LabelDetails;
156  class LabelDetails;
157 
158  struct GobChartsToolsWidgetPrivate;
159  GobChartsToolsWidgetPrivate *m_private;
160 };
161 
162 #endif // GOBCHARTSTOOLSWIDGET_H