MCPcopy Create free account
hub / github.com/codestation/qcma / createTrayObject

Method createTrayObject

gui/mainwidget.cpp:193–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

191}
192
193TrayIndicator *MainWidget::createTrayObject(QWidget *obj_parent)
194{
195 TrayFunctionPointer create_tray = NULL;
196
197#ifdef Q_OS_LINUX
198 QString desktop = getenv("XDG_CURRENT_DESKTOP");
199 qDebug() << "Current desktop: " << desktop;
200
201#ifdef QT_DEBUG
202 QString library_path = QApplication::applicationDirPath();
203#else
204 QString library_path = "/usr/lib/qcma";
205#endif
206
207 if(desktop.toLower() == "kde")
208 {
209#ifdef QT_DEBUG
210 library_path += "/../kdenotifier";
211#endif
212 // KDENotifier
213 QLibrary library(library_path + "/libqcma_kdenotifier.so");
214 if(library.load())
215 create_tray = reinterpret_cast<TrayFunctionPointer>(library.resolve("createTrayIndicator"));
216 else
217 qWarning() << "Cannot load libqcma_kdenotifier plugin from" << library_path;
218 }
219 else
220 // try to use the appindicator if is available
221 // if(desktop.toLower() == "unity")
222 {
223#ifdef QT_DEBUG
224 library_path += "/../appindicator";
225#endif
226 // AppIndicator
227 QLibrary library(library_path + "/libqcma_appindicator.so");
228 if(library.load())
229 create_tray = reinterpret_cast<TrayFunctionPointer>(library.resolve("createTrayIndicator"));
230 else
231 qWarning() << "Cannot load libqcma_appindicator plugin from" << library_path;
232 }
233#endif
234 // else QSystemTrayIcon
235 return (create_tray != NULL) ? create_tray(obj_parent) : createTrayIndicator(obj_parent);
236}
237
238void MainWidget::createTrayIcon()
239{

Callers

nothing calls this directly

Calls 2

createTrayIndicatorFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected