PreferenceWidget.h 2.2 KB
Newer Older
1 2 3 4
/*****************************************************************************
 * PreferenceWidget.h: Abstract class that will be used to save load / preferences
 * values.
 *****************************************************************************
Ludovic Fauvet's avatar
Ludovic Fauvet committed
5
 * Copyright (C) 2008-2010 VideoLAN
6 7
 *
 * Authors: Clement CHAVANCE <kinder@vlmc.org>
8
 *          Hugo Beauzée-Luyssen <hugo@beauzee.fr>
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 * 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.
 *****************************************************************************/

#ifndef PREFERENCEWIDGET_H
#define PREFERENCEWIDGET_H

28
#include <QScrollArea>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
29
#include <QString>
30
#include <QHash>
31 32
#include "SettingsManager.h"

33
class   ISettingsCategoryWidget;
34
class   SettingValue;
35 36
class   QLabel;
class   QEvent;
37

38
class   PreferenceWidget : public QScrollArea
39
{
40
    Q_OBJECT
41
    public:
42
        typedef QList<ISettingsCategoryWidget*>    SettingsList;
43
        PreferenceWidget( const QString &name, const char* category, SettingsManager::Type type,
44
                          QWidget* parent = 0 );
45 46
        virtual ~PreferenceWidget() {}

47
        virtual bool    save();
48
        virtual void    reset();
49
        void            discard();
50
        const char      *category() const;
51 52 53
    protected:
        void            changeEvent( QEvent *e );

54
    private:
55
        ISettingsCategoryWidget        *widgetFactory( SettingValue* s );
56
        void            retranslateUi();
57

58
    private:
59
        const char                  *m_category;
60 61
        SettingsList                m_settings;
        QHash<SettingValue*, QLabel*>  m_labels;
62 63 64
};

#endif