1 /**
2  * Copyright (C) 2001-2015 Klaralvdalens Datakonsult AB.  All rights reserved.
3  *
4  * This file is part of the KD Chart library.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of
9  * the License, or (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
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef MAINWINDOW_H
21 #define MAINWINDOW_H
22 
23 #include "ui_mainwindow.h"
24 #include <TableModel.h>
25 #include <KChartDataValueAttributes>
26 
27 namespace KChart {
28     class Chart;
29     class BarDiagram;
30 }
31 
32 class MainWindow : public QWidget, private Ui::MainWindow
33 {
34     Q_OBJECT
35 
36 public:
37     MainWindow( QWidget* parent = nullptr );
38 
39 private Q_SLOTS:
40     void on_scopeOneBarRB_toggled(  bool checked );
41     void on_scopeBarDatasetSB_valueChanged( int i );
42     void on_scopeBarItemSB_valueChanged(    int i );
43     void on_scopeDatasetRB_toggled( bool checked );
44     void on_scopeDatasetSB_valueChanged( int i );
45     void on_scopeCommonRB_toggled( bool checked );
46 
47     void on_paintValuesCB_toggled( bool checked );
48 
49     void on_fontCombo_currentIndexChanged( const QString & text );
50     void on_relativeSizeSB_valueChanged( int i );
51     void on_minimumSizeSB_valueChanged(  int i );
52     void on_rotationSB_valueChanged( int i );
53 
54     void on_posPosCombo_currentIndexChanged(   const QString & text );
55     void on_posAlignCombo_currentIndexChanged( const QString & text );
56     void on_posPadHoriSB_valueChanged( int i );
57     void on_posPadVertSB_valueChanged( int i );
58     void on_negPosCombo_currentIndexChanged(   const QString & text );
59     void on_negAlignCombo_currentIndexChanged( const QString & text );
60     void on_negPadHoriSB_valueChanged( int i );
61     void on_negPadVertSB_valueChanged( int i );
62 
63     void on_labelLE_textEdited(  const QString & text );
64     void on_prefixLE_textEdited( const QString & text );
65     void on_suffixLE_textEdited( const QString & text );
66 
67 private:
68     const QModelIndex currentIndex() const;
69     const KChart::DataValueAttributes attributes() const;
70     const char* positionToScreenName( const KChart::Position& pos ) const;
71     const Qt::Alignment alignmentFromScreeName( const QString& name ) const;
72     const QString alignmentToScreenName( const Qt::Alignment& align ) const;
73     void populateWidgets();
74     void setAttributes( const KChart::DataValueAttributes& da );
75 
76     KChart::Chart* m_chart;
77     KChart::BarDiagram* m_bars;
78     TableModel m_model;
79 };
80 
81 
82 #endif /* MAINWINDOW_H */
83 
84