| 75 | #endif |
| 76 | |
| 77 | SystrayHandler::SystrayHandler(HyperHdrDaemon* hyperhdrDaemon, quint16 webPort, QString rootFolder) |
| 78 | : QObject(), |
| 79 | _menu(nullptr), |
| 80 | _haveSystray(false), |
| 81 | _webPort(webPort), |
| 82 | _rootFolder(rootFolder), |
| 83 | _selectedInstance(-1) |
| 84 | { |
| 85 | Q_INIT_RESOURCE(resources); |
| 86 | |
| 87 | std::shared_ptr<HyperHdrManager> instanceManager; |
| 88 | hyperhdrDaemon->getInstanceManager(instanceManager); |
| 89 | _instanceManager = instanceManager; |
| 90 | connect(instanceManager.get(), &HyperHdrManager::SignalInstanceStateChanged, this, &SystrayHandler::signalInstanceStateChangedHandler); |
| 91 | connect(instanceManager.get(), &HyperHdrManager::SignalSettingsChanged, this, &SystrayHandler::signalSettingsChangedHandler); |
| 92 | |
| 93 | #ifdef __linux__ |
| 94 | // Load library |
| 95 | _library = dlopen(SYSTRAY_WIDGET_LIB, RTLD_NOW); |
| 96 | |
| 97 | if (_library) |
| 98 | { |
| 99 | SystrayInitialize = (SystrayInitializeFun)dlsym(_library, "SystrayInitialize"); |
| 100 | SystrayLoop = (SystrayLoopFun)dlsym(_library, "SystrayLoop"); |
| 101 | SystrayUpdate = (SystrayUpdateFun)dlsym(_library, "SystrayUpdate"); |
| 102 | SystrayClose = (SystrayCloseFun)dlsym(_library, "SystrayClose"); |
| 103 | |
| 104 | if (SystrayInitialize == nullptr || SystrayLoop == nullptr || SystrayUpdate == nullptr || SystrayClose == nullptr) |
| 105 | { |
| 106 | printf("Could not resolve libSystrayWidget.so functions\n"); |
| 107 | dlclose(_library); |
| 108 | _library = nullptr; |
| 109 | } |
| 110 | } |
| 111 | else |
| 112 | printf("Could not load libSystrayWidget.so library\n"); |
| 113 | |
| 114 | if (_library != nullptr) |
| 115 | _haveSystray = SystrayInitialize(nullptr); |
| 116 | #else |
| 117 | _haveSystray = SystrayInitialize(nullptr); |
| 118 | #endif |
| 119 | } |
| 120 | |
| 121 | SystrayHandler::~SystrayHandler() |
| 122 | { |
nothing calls this directly
no test coverage detected