📄 qmaccelmanager.h
字号:
/* ;-*-c++-*- * * qmaccelmanager.h * * $Id: qmaccelmanager.h,v 1.9 2002/03/21 14:31:28 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 QMACCELMANAGER_H_INCLUDED#define QMACCELMANAGER_H_INCLUDED#include "qmautoptr.h"#include <qdict.h>#include <qstring.h>#include <qstringlist.h>#include <qaccel.h>#include <qlist.h>class QObject;class Group{public: Group( const QString &n = QString::null ); const QString &name() const; void appendGroup( Group *g ); void appendKey( const QString &key ); const QList<Group> &groups() const; const QStringList &keys() const;private: QString m_Name; QList<Group> m_Groups; QStringList m_Keys;};class QmAccelManager{public: enum KeyType { NoKey, DefaultKey, CustomKey }; virtual ~QmAccelManager(); static QmAccelManager* instance(); bool set(const QString &command, int key, bool apply=true); bool setp(int key, const QString &command) const;// bool setp(const QString &command) const; QString setTo(int key) const; QString commandName(int key) const; bool remove(const QString &command, bool apply=true); bool setDefault(const QString &command, bool apply=true); void apply(); void cancel(); void save() const; int key(const QString &command) const;// int testKey(const QString &command) const; int defaultKey(const QString &command) const; KeyType keyType( const QString &command ) const; const QString& desc(const QString &command) const; const QStringList& commands() const; const Group *groups() const; static QString keyName(int key); QString keyName(const QString &command); void dump() const;private: QmAccelManager(); struct Key { struct KeyValue { KeyValue(); KeyValue( KeyType t, int k = 0 ); int key; KeyType type; }; Key( const QString &command, QObject *r, const QString &s, const QString d, KeyValue val = KeyValue(), int defkey = 0 ); QString command; KeyValue value, tmpValue; int defKey; bool modified; QObject *receiver; QString slot; QString desc; int id; }; int usedKey( Key *k ) const; int usedKey( Key *k, Key::KeyValue &kv ) const; void setKeyValue( Key::KeyValue &kv, KeyType t, int key ) const; void setCustomKey( Key *k, int key, bool apply = false ) const; void setDefaultKey( Key *k, bool apply = false ) const; void setNoKey( Key *k, bool apply = false ) const; QString dump( Key *k, Key::KeyValue &kv ) const; void addKey( Group *, Key * ); QDict<Key> m_Keys; Group m_Groups; QAccel *m_pAccel; QStringList m_Commands; static QmAutoPtr<QmAccelManager> s_pInstance;};#endif // QMACCELMANAGER_H_INCLUDED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -