Log global menu usage

This commit is contained in:
Ilya Fedin 2020-03-28 07:34:13 +04:00 committed by John Preston
parent aa4968faaa
commit 86b9927965
1 changed files with 15 additions and 13 deletions

View File

@ -291,6 +291,14 @@ std::unique_ptr<QTemporaryFile> TrayIconFile(
return ret; return ret;
} }
bool UseUnityCounter() {
static const auto UnityCounter = QDBusInterface(
"com.canonical.Unity",
"/").isValid();
return UnityCounter;
}
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION #endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
bool IsSNIAvailable() { bool IsSNIAvailable() {
@ -319,18 +327,6 @@ bool IsSNIAvailable() {
return false; return false;
} }
bool UseUnityCounter() {
#ifdef TDESKTOP_DISABLE_DBUS_INTEGRATION
static const auto UnityCounter = false;
#else // TDESKTOP_DISABLE_DBUS_INTEGRATION
static const auto UnityCounter = QDBusInterface(
"com.canonical.Unity",
"/").isValid();
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
return UnityCounter;
}
quint32 djbStringHash(QString string) { quint32 djbStringHash(QString string) {
quint32 hash = 5381; quint32 hash = 5381;
QByteArray chars = string.toLatin1(); QByteArray chars = string.toLatin1();
@ -438,13 +434,19 @@ void MainWindow::initHook() {
&QWindow::visibleChanged, &QWindow::visibleChanged,
this, this,
&MainWindow::onVisibleChanged); &MainWindow::onVisibleChanged);
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
if (AppMenuSupported()) {
LOG(("Using D-Bus global menu."));
} else {
LOG(("Not using D-Bus global menu."));
}
if (UseUnityCounter()) { if (UseUnityCounter()) {
LOG(("Using Unity launcher counter.")); LOG(("Using Unity launcher counter."));
} else { } else {
LOG(("Not using Unity launcher counter.")); LOG(("Not using Unity launcher counter."));
} }
#endif // !TDESKTOP_DISABLE_DBUS_INTEGRATION
} }
bool MainWindow::hasTrayIcon() const { bool MainWindow::hasTrayIcon() const {