UI: Just use json directly for service lookups

This commit accomplishes three different things:

- Makes it much less difficult to communicate service settings
  between the UI and the plugin.

- Refactors some code and makes it cleaner and easier to modify to our
  needs (although there is still a lot of work to do on that front
  because of heavy code duplication issues between auto-config and the
  stream settings pane).

- Significantly reatly reduces the number of times the json file has to
  be opened and parsed.

This also kind of denotes a bit of a failure on the plugin communication
aspect. The properties system is too limited and jank for a lot of
things we would like to do at times.
This commit is contained in:
jp9000
2022-04-14 02:10:49 -07:00
parent a4c215869f
commit 2fa5ffe4df
8 changed files with 178 additions and 142 deletions
+8 -1
View File
@@ -13,6 +13,8 @@
#include <string>
#include <mutex>
#include <json11.hpp>
class Ui_AutoConfigStartPage;
class Ui_AutoConfigVideoPage;
class Ui_AutoConfigStreamPage;
@@ -174,6 +176,10 @@ class AutoConfigStreamPage : public QWizardPage {
QString lastService;
bool ready = false;
inline void GetServicesJson();
json11::Json servicesRoot;
bool servicesLoaded = false;
void LoadServices(bool showAll);
inline bool IsCustomService() const;
@@ -248,7 +254,8 @@ class AutoConfigTestPage : public QWizardPage {
inline ServerInfo() {}
inline ServerInfo(const char *name_, const char *address_)
inline ServerInfo(const std::string &name_,
const std::string &address_)
: name(name_), address(address_)
{
}