Settings.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. GNU General Public License version 3 notice
  3. Copyright (C) 2012 Mihawk <luiz@netdome.biz>. All rights reserved.
  4. This program is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see < http://www.gnu.org/licenses/ >.
  14. */
  15. #ifndef SETTINGS_H
  16. #define SETTINGS_H
  17. class QSettings;
  18. class QString;
  19. class QStringList;
  20. /**
  21. This class provides direct settings file access for the whole application.
  22. @author Mihawk <luiz@netdome.biz>
  23. @file Settings.h
  24. */
  25. class Settings
  26. {
  27. public:
  28. /**
  29. The class single instance.
  30. @return The settings class
  31. */
  32. static Settings* globalInstance();
  33. /**
  34. Changes the config file used by us.
  35. @param fileName The filename to be used
  36. @return True if the file was loaded successfully, false otherwise
  37. */
  38. bool changeConfigFile(const QString& fileName);
  39. /**
  40. Gets and sets the serverlist
  41. */
  42. QStringList serverList();
  43. void setServerList(QStringList& list);
  44. /**
  45. Config file direct parameter accessors
  46. */
  47. QString quakeFolder() const;
  48. QString botName() const;
  49. int botPing() const;
  50. int botTopColor() const;
  51. int botBottomColor() const;
  52. bool botSpectator() const;
  53. int floodProtTime() const;
  54. int qwFloodProtTime() const;
  55. int spamFloodProtTime() const;
  56. unsigned int queryInterval() const;
  57. int timeToSayHiAfterConnected() const;
  58. int timeToWaitForCountReply() const;
  59. bool developerMode() const;
  60. /**
  61. Save current settings to the file.
  62. */
  63. void save();
  64. private:
  65. static Settings* ourInstance; // Myself
  66. static QSettings* ourSettings; // The QSettings object
  67. // Disable direct object creation, copy and destruction
  68. Settings();
  69. ~Settings();
  70. Settings(Settings&) {}
  71. };
  72. #endif // SETTINGS_H