2006-01-28 12:29:22 +01:00
|
|
|
/******************************************************************************\
|
2008-01-26 11:38:18 +01:00
|
|
|
* Copyright (c) 2004-2007
|
2006-01-28 12:29:22 +01:00
|
|
|
*
|
|
|
|
* Author(s):
|
2008-01-26 11:38:18 +01:00
|
|
|
* Volker Fischer
|
2006-01-28 12:29:22 +01:00
|
|
|
*
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
\******************************************************************************/
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
#if !defined ( SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_ )
|
2006-01-28 12:29:22 +01:00
|
|
|
#define SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_
|
|
|
|
|
2008-01-26 11:38:18 +01:00
|
|
|
#include <qdom.h>
|
|
|
|
#include <qfile.h>
|
|
|
|
#include <qtextstream.h>
|
2008-01-19 18:14:56 +01:00
|
|
|
#include "global.h"
|
|
|
|
#include "client.h"
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Definitions ****************************************************************/
|
|
|
|
// name of the init-file
|
2006-11-25 15:46:57 +01:00
|
|
|
#define LLCON_INIT_FILE_NAME "llcon.ini"
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
/* Classes ********************************************************************/
|
|
|
|
class CSettings
|
|
|
|
{
|
|
|
|
public:
|
2006-11-25 15:46:57 +01:00
|
|
|
CSettings ( CClient* pNCliP ) : pClient ( pNCliP ) {}
|
2006-01-28 12:29:22 +01:00
|
|
|
|
2008-01-26 11:38:18 +01:00
|
|
|
void Load ( const QString& sFileName = "" ) { ReadIniFile ( sFileName ); }
|
|
|
|
void Save ( const QString& sFileName = "" ) { WriteIniFile ( sFileName ); }
|
2006-01-28 12:29:22 +01:00
|
|
|
|
|
|
|
protected:
|
2009-02-22 12:07:18 +01:00
|
|
|
void ReadIniFile ( const QString& sFileName );
|
|
|
|
void WriteIniFile ( const QString& sFileName );
|
2008-01-26 11:38:18 +01:00
|
|
|
|
|
|
|
// init file access function for read/write
|
|
|
|
void SetNumericIniSet ( QDomDocument& xmlFile, const QString& strSection,
|
|
|
|
const QString& strKey, const int iValue = 0 );
|
|
|
|
bool GetNumericIniSet ( const QDomDocument& xmlFile, const QString& strSection,
|
|
|
|
const QString& strKey, const int iRangeStart,
|
|
|
|
const int iRangeStop, int& iValue );
|
|
|
|
void SetFlagIniSet ( QDomDocument& xmlFile, const QString& strSection,
|
|
|
|
const QString& strKey, const bool bValue = false );
|
|
|
|
bool GetFlagIniSet ( const QDomDocument& xmlFile, const QString& strSection,
|
|
|
|
const QString& strKey, bool& bValue );
|
|
|
|
|
|
|
|
// actual working function for init-file access
|
|
|
|
QString GetIniSetting( const QDomDocument& xmlFile, const QString& sSection,
|
|
|
|
const QString& sKey, const QString& sDefaultVal = "" );
|
|
|
|
void PutIniSetting ( QDomDocument& xmlFile, const QString& sSection,
|
|
|
|
const QString& sKey, const QString& sValue = "" );
|
2006-11-25 15:46:57 +01:00
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
// pointer to the client object needed for the various settings
|
2006-11-25 15:46:57 +01:00
|
|
|
CClient* pClient;
|
2006-01-28 12:29:22 +01:00
|
|
|
};
|
|
|
|
|
2007-09-08 12:45:14 +02:00
|
|
|
#endif // !defined ( SETTINGS_H__3B0BA660_DGEG56G456G9876D31912__INCLUDED_ )
|