You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

WBConfig.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef WBCONFIG_H
  2. #define WBCONFIG_H
  3. #include <QSettings>
  4. #include <QMap>
  5. #include "Environments.h"
  6. #include "wine/Execute.h"
  7. struct stWBBottle{
  8. QString bottle;
  9. QString wine;
  10. QString launcher;
  11. stWBBottle(QString bottle, QString wine = "/usr/", QString launcher = "");
  12. stWBBottle(){}
  13. };
  14. struct stWBProgram{
  15. QString bottleName;
  16. QStringList args;
  17. Environments *envs;
  18. int dxMode = 0;
  19. eWineLog logMode = eWineLog::WL_disable;
  20. eWineDesktop deskMode = eWineDesktop::WD_disable;
  21. QPoint wndSize;
  22. stWBProgram(QString bottleName, QStringList args = QStringList(), QStringList envs = QStringList());
  23. stWBProgram(){}
  24. ~stWBProgram();
  25. };
  26. // TODO: синглтон, ибо не только в WBMain нужен, а и в настройках
  27. class WBConfig : QObject
  28. {
  29. Q_OBJECT
  30. public:
  31. explicit WBConfig(QObject *parent = nullptr);
  32. virtual ~WBConfig();
  33. virtual stWBBottle &bottle(const QString &name);
  34. virtual QStringList names();
  35. virtual stWBProgram loadProgram(const QString &name);
  36. virtual void saveProgram(const QString &name, const stWBProgram &program);
  37. protected:
  38. QSettings *_settings;
  39. uint _bottleCount;
  40. uint _lastBottleId;
  41. QString _lastBottle;
  42. QMap<QString, stWBBottle> _bottles;
  43. };
  44. #endif // WBCONFIG_H