Settings.h 2.55 KB
Newer Older
1
/*****************************************************************************
2
 * Settings.h: generic preferences interface
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * Authors: Clement CHAVANCE <kinder@vlmc.org>
 *
 * 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.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

23
24
25
#ifndef SIMPLEPREFERENCES_H
#define SIMPLEPREFERENCES_H

Ludovic Fauvet's avatar
Ludovic Fauvet committed
26
#include <QDialog>
27
28
#include <QString>
#include <QHash>
29
#include <QLabel>
30
#include <QVBoxLayout>
31
#include <QDialogButtonBox>
32
#include <QButtonGroup>
33
#include <QStackedWidget>
34
#include <QAbstractButton>
35
#include <QVector>
36

37
#include "Panel.h"
38
#include "PreferenceWidget.h"
39

Ludovic Fauvet's avatar
Ludovic Fauvet committed
40
class   Settings : public QDialog
41
42
{
    Q_OBJECT
43
    Q_DISABLE_COPY( Settings )
44
45

    public:
Ludovic Fauvet's avatar
Ludovic Fauvet committed
46
        Settings( QWidget* parent = 0, Qt::WindowFlags f = 0 );
47
        ~Settings();
48
        void                addWidget( const QString& name,
49
                                       PreferenceWidget* pWidget,
50
51
                                       const QString& icon,
                                       const QString& label );
52
        void                build();
53
54

    private:
55
        QVBoxLayout*    buildRightHLayout();
56
        void    save( void );
57
58

    private:
59
60
61
62
63
64
        QHash<int, QString>         m_widgets;
        QVector<PreferenceWidget*>  m_pWidgets;
        QWidget*                    m_currentWidget;
        Panel*                      m_panel;
        QLabel*                     m_title;
        QStackedWidget*             m_stackedWidgets;
65
        QDialogButtonBox*           m_buttons;
66
        bool                        m_saved;
67
68

    public slots:
69
        void    switchWidget( int widget );
70

71
    private slots:
72
        void    buttonClicked( QAbstractButton* button );
73

74
75
    signals:
        void    widgetSwitched( int widget );
76
77
78
};

#endif /* !SIMPLEPREFERENCES_H */