File indexing completed on 2025-02-16 03:47:41
0001 /* 0002 SPDX-FileCopyrightText: 2009 Mathias Kraus <k.hias@gmx.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PLAYERSETTINGS_H 0008 #define PLAYERSETTINGS_H 0009 0010 #include <QKeySequence> 0011 #include <QString> 0012 #include <QMap> 0013 #include <QStringList> 0014 0015 class PlayerSettings 0016 { 0017 public: 0018 PlayerSettings(); 0019 ~PlayerSettings(); 0020 0021 const QStringList playerIDs() const; 0022 const QString playerName(const QString& strPlayerID) const; 0023 const QString playerDesktopFilePath(const QString& strPlayerID) const; 0024 const QString playerGraphicsFile(const QString& strPlayerID) const; 0025 bool enabled(const QString& strPlayerID) const; 0026 const QKeySequence keyUp(const QString& strPlayerID) const; 0027 const QKeySequence keyRight(const QString& strPlayerID) const; 0028 const QKeySequence keyDown(const QString& strPlayerID) const; 0029 const QKeySequence keyLeft(const QString& strPlayerID) const; 0030 const QKeySequence keyPutBomb(const QString& strPlayerID) const; 0031 0032 void savePlayerSettings(); 0033 void discardUnsavedSettings(); 0034 void setPlayerName(const QString& strPlayerID, const QString& strName); 0035 void setEnabled(const QString& strPlayerID, const bool enabled); 0036 void setKeyUp(const QString& strPlayerID, const QKeySequence& key); 0037 void setKeyRight(const QString& strPlayerID, const QKeySequence& key); 0038 void setKeyDown(const QString& strPlayerID, const QKeySequence& key); 0039 void setKeyLeft(const QString& strPlayerID, const QKeySequence& key); 0040 void setKeyPutBomb(const QString& strPlayerID, const QKeySequence& key); 0041 0042 private: 0043 struct StructPlayerSettings 0044 { 0045 QString strPlayerID; 0046 QString strPlayerName; 0047 QString strPlayerDesktopFilePath; 0048 QString strPlayerGraphicsFile; 0049 bool enabled; 0050 QKeySequence keyUp; 0051 QKeySequence keyRight; 0052 QKeySequence keyDown; 0053 QKeySequence keyLeft; 0054 QKeySequence keyPutBomb; 0055 }; 0056 0057 QMap <QString, StructPlayerSettings> m_playerSettings; 0058 QMap <QString, StructPlayerSettings> m_pendingPlayerSettings; 0059 }; 0060 0061 #endif