src/core/gui/configuration/configurationbasebox.h
00001 //------------------------------------------------------------------------------
00002 // configurationbasebox.h
00003 //------------------------------------------------------------------------------
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018 // 02110-1301, USA.
00019 //
00020 //------------------------------------------------------------------------------
00021 // Copyright (C) 2009 "Zalewa" <zalewapl@gmail.com>
00022 //------------------------------------------------------------------------------
00023 
00024 #ifndef __CONFIGURATION_BASE_BOX_H_
00025 #define __CONFIGURATION_BASE_BOX_H_
00026 
00027 #include "ini/ini.h"
00028 #include "global.h"
00029 #include <QGroupBox>
00030 #include <QPushButton>
00031 #include <QStandardItem>
00032 
00041 class MAIN_EXPORT ConfigurationBaseBox : public QGroupBox
00042 {
00043         Q_OBJECT;
00044 
00045         public:
00046                 ConfigurationBaseBox(QWidget* parent = NULL)
00047                 : QGroupBox(parent)
00048                 {
00049                         this->bAllowSave = false;
00050                         this->bSettingsAlreadyRead = false;
00051                         hide();
00052                 }
00053 
00054                 virtual ~ConfigurationBaseBox() {}
00055 
00056                 bool                    allowSave() { return this->bAllowSave; }
00057                 bool                    areSettingsAlreadyRead() { return this->bSettingsAlreadyRead; }
00058 
00066                 virtual QIcon   icon() const = 0;
00067 
00072                 virtual QString name() const = 0;
00073 
00074                 void                    setAllowSave(bool b)
00075                 {
00076                         this->bAllowSave = b;
00077                 }
00078 
00079                 void                    read()
00080                 {
00081                         this->bSettingsAlreadyRead = true;
00082                         readSettings();
00083                 }
00084 
00085                 bool                    save()
00086                 {
00087                         if (this->bAllowSave)
00088                         {
00089                                 saveSettings();
00090                                 return true;
00091                         }
00092                         else
00093                         {
00094                                 return false;
00095                         }
00096                 }
00097 
00098         signals:
00103                 void                    appearanceChanged();
00104 
00110                 void                    wantChangeDefaultButton(QPushButton* btn);
00111 
00112         protected:
00113                 bool                    bAllowSave;
00114                 bool                    bSettingsAlreadyRead;
00115 
00121                 virtual void    readSettings()=0;
00122 
00128                 virtual void    saveSettings()=0;
00129 
00130 };
00131 
00132 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator