📄 qmconfig.h
字号:
/* ;-*-c++-*- * qmconfig.h * * $Id: qmconfig.h,v 1.26 2002/03/11 11:50:37 amos Exp $ * * Apollo sound player: http://www.apolloplayer.org * Copyright(C) 2000-2002 Apollo Team. See CREDITS file. * * 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. * * The GNU General Public License is also available online at: * * http://www.gnu.org/copyleft/gpl.html */#ifndef QMCONFIG_H_INCLUDED#define QMCONFIG_H_INCLUDED#include <qrect.h>#include <qstring.h>#include <qdict.h>#include "qmautoptr.h"/*! \file qmconfig.h Declaration of QmConfig class.*/class QDomDocument;class QDomNode;class QPoint;class QSize;class QTextStream;class QmConfig{public: enum ConfigFile { Config, PlayList, PlayListTree, DirectoryTree, Badlist, ConfigFilesEnd }; ~QmConfig(); static QmConfig *instance(); void mergeDefaults(); void load(); void save(); void assign( const QString &group, const QString &parent = QString::null ); void clear( const QString &group, const QString &key ); void set( const QString &group, const QString &key, const QRect &rect ); void set( const QString &group, const QString &key, const QPoint &pos ); void set( const QString &group, const QString &key, const QString &text ); void set( const QString &group, const QString &key, const char *text ); void set( const QString &group, const QString &key, int i ); void set( const QString &group, const QString &key, bool b ); bool has( const QString &group, const QString &key ) const; void get( const QString &group, const QString &key, QRect &rect ) const; void get( const QString &group, const QString &key, QPoint &pos ) const; void get( const QString &group, const QString &key, QString &text ) const; void get( const QString &group, const QString &key, int &i ) const; void get( const QString &group, const QString &key, bool &b ) const; QRect getRect( const QString &group, const QString &key ) const; QPoint getPoint( const QString &group, const QString &key ) const; QString getString( const QString &group, const QString &key ) const; int getInt( const QString &group, const QString &key ) const; QString configPath() const; QString path(ConfigFile f) const; void setLoading(ConfigFile f, bool e); bool loadingEnabled(ConfigFile f) const; static QString indent( int level );protected: QDomNode findNode(const QString &name) const; QDomNode findNode(const QDomNode &start, const QString &name) const; QDomNode findKeyNode(const QString &group, const QString &key) const;private: QString configFileName() const; // Disable copy ctor and assignment operator as neither makes sense // with a singleton. QmConfig(); QmConfig(const QmConfig &other); QmConfig& operator=(const QmConfig &other); /* The QDomDocument variables don't need to be allocated on the heap, but a bizarre compile error occured when including this file in main.cpp. The error pointed to the Qt header files through #include <qdom.h> in this file. Removing the include means doing forward declarations of QDomNode and QDomDocument, the latter requiring us to move to pointers, fixed the problem. */ QDomDocument *m_pRoot; QDomDocument *m_pDefaultsRoot; QDomDocument *m_pFileRoot; bool m_SilentMode; bool m_LazySetMode; bool m_LoadConfig; bool m_LoadPlayList; bool m_LoadPlayListTree; bool m_LoadDirectoryTree; bool m_LoadBadlist; static QmAutoPtr<QmConfig> s_pInstance;};#endif // QMCONFIG_H_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -