diff options
Diffstat (limited to 'SPICEConsoleAPI.h')
-rw-r--r-- | SPICEConsoleAPI.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/SPICEConsoleAPI.h b/SPICEConsoleAPI.h index d32c8e6..7935a3b 100644 --- a/SPICEConsoleAPI.h +++ b/SPICEConsoleAPI.h @@ -14,6 +14,35 @@ #ifndef H_SPICEConsoleAPI #define H_SPICEConsoleAPI +#define DECLARE_PROPERTY(property, type_getter, type_setter) \ + public: \ + type_getter get_##property() const; \ + void set_##property(type_setter a##property); \ + private: \ + type_getter m_##property; +#define DECLARE_PROPERTY_STRING(property) DECLARE_PROPERTY(property, std::string, const std::string &) +#define DECLARE_PROPERTY_BOOL(property) DECLARE_PROPERTY(property, bool, bool) + +#define DEFINE_PROPERTY(property, type_getter, type_setter) \ +type_getter SPICEConsoleAPI::get_##property() const \ +{ \ + return m_##property; \ +} \ +\ +void SPICEConsoleAPI::set_##property(type_setter a##property) \ +{ \ + m_##property = a##property; \ +} +#define DEFINE_PROPERTY_STRING(property) DEFINE_PROPERTY(property, std::string, const std::string &) +#define DEFINE_PROPERTY_BOOL(property) DEFINE_PROPERTY(property, bool, bool) + +#define REGISTER_PROPERTY(property) do { \ + registerProperty(#property, \ + make_property(this, \ + &SPICEConsoleAPI::get_##property, \ + &SPICEConsoleAPI::set_##property)); \ + } while (0) + class SPICEConsoleAPI : public FB::JSAPIAuto { public: @@ -33,6 +62,29 @@ public: { registerMethod("echo", make_method(this, &SPICEConsoleAPI::echo)); registerMethod("testEvent", make_method(this, &SPICEConsoleAPI::testEvent)); + + REGISTER_PROPERTY(hostIP); + REGISTER_PROPERTY(port); + REGISTER_PROPERTY(SecurePort); + REGISTER_PROPERTY(Password); + REGISTER_PROPERTY(CipherSuite); + REGISTER_PROPERTY(SSLChannels); + REGISTER_PROPERTY(TrustStore); + REGISTER_PROPERTY(HostSubject); + REGISTER_PROPERTY(fullScreen); + REGISTER_PROPERTY(Smartcard); + REGISTER_PROPERTY(AdminConsole); + REGISTER_PROPERTY(Title); + REGISTER_PROPERTY(dynamicMenu); + REGISTER_PROPERTY(NumberOfMonitors); + REGISTER_PROPERTY(GuestHostName); + REGISTER_PROPERTY(HotKey); + REGISTER_PROPERTY(NoTaskMgrExecution); + REGISTER_PROPERTY(SendCtrlAltDelete); + REGISTER_PROPERTY(UsbListenPort); + REGISTER_PROPERTY(UsbAutoShare); + REGISTER_PROPERTY(ColorDepth); + REGISTER_PROPERTY(DisableEffects); } /////////////////////////////////////////////////////////////////////////////// @@ -60,6 +112,34 @@ private: SPICEConsoleWeakPtr m_plugin; FB::BrowserHostPtr m_host; + /* Properties */ + std::string m_usb_filter; + std::map<std::string, std::string> m_language; + + // must be at the end of the file as after calling DECLARE_PROPERTY, + // the scope is set to private: + DECLARE_PROPERTY_STRING(hostIP) + DECLARE_PROPERTY_STRING(port) + DECLARE_PROPERTY_STRING(SecurePort) + DECLARE_PROPERTY_STRING(Password) + DECLARE_PROPERTY_STRING(CipherSuite) + DECLARE_PROPERTY_STRING(SSLChannels) + DECLARE_PROPERTY_STRING(TrustStore) + DECLARE_PROPERTY_STRING(HostSubject) + DECLARE_PROPERTY_BOOL(fullScreen) + DECLARE_PROPERTY_BOOL(Smartcard) + DECLARE_PROPERTY_BOOL(AdminConsole) + DECLARE_PROPERTY_STRING(Title) + DECLARE_PROPERTY_STRING(dynamicMenu) + DECLARE_PROPERTY_STRING(NumberOfMonitors) + DECLARE_PROPERTY_STRING(GuestHostName) + DECLARE_PROPERTY_STRING(HotKey) + DECLARE_PROPERTY_BOOL(NoTaskMgrExecution) + DECLARE_PROPERTY_BOOL(SendCtrlAltDelete) + DECLARE_PROPERTY_STRING(UsbListenPort) + DECLARE_PROPERTY_BOOL(UsbAutoShare) + DECLARE_PROPERTY_STRING(ColorDepth) + DECLARE_PROPERTY_STRING(DisableEffects) }; #endif // H_SPICEConsoleAPI |