Setting.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef SETTING_H
  2. #define SETTING_H
  3. #include <QObject>
  4. #include <QCoreApplication>
  5. #include "ark_api.h"
  6. #include <iostream>
  7. using namespace std;
  8. #define CHECK_SYSTEM(cmd) do { \
  9. int __result = system(cmd); \
  10. if (__result != 0) { \
  11. std::cerr << "Command failed: " << cmd << " (code: " << __result << ")" << std::endl; \
  12. } \
  13. } while(0)
  14. class Setting : public QObject
  15. {
  16. Q_OBJECT
  17. #ifdef g_Setting
  18. #undef g_Setting
  19. #endif
  20. #define g_Setting (Setting::instance())
  21. public:
  22. inline static Setting* instance() {
  23. static Setting *setting(new Setting(qApp));
  24. return setting;
  25. }
  26. enum WidgetType {
  27. WIDGET_UNDEFINE = -1,
  28. WIDGET_HOME,
  29. WIDGET_MULTIMUSIC,
  30. WIDGET_PHONELINK,
  31. WIDGET_BTTELEPHONE,
  32. WIDGET_VIDEOPICTURE,
  33. WIDGET_SETTING,
  34. };
  35. public:
  36. void setDisplayMode(int mode);
  37. void setWidgetType(WidgetType type);
  38. void setUsbMusicFileName(QString fileName);
  39. WidgetType getWidgetType();
  40. disp_handle* getUIDispLayer();
  41. disp_handle* getVideoDispLayer();
  42. QString getUsbMusicFileName();
  43. private:
  44. explicit Setting(QObject *parent = NULL);
  45. ~Setting();
  46. WidgetType m_WidgetType;
  47. QString m_UsbMusicFileName;
  48. };
  49. #endif // SETTING_H