2014-09-15 21:45:41 +02:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
|
|
index 0ee9154..597a7de 100644
|
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
|
|
|
@@ -91,7 +91,7 @@ install(FILES ${CMAKE_BINARY_DIR}/dbusmenu-${QT_SUFFIX}.pc
|
2013-11-25 21:47:49 +01:00
|
|
|
|
|
|
|
add_subdirectory(src)
|
|
|
|
if (NOT USE_QT5) # TODO port tests to Qt5
|
|
|
|
-add_subdirectory(tests)
|
|
|
|
+#add_subdirectory(tests)
|
|
|
|
endif()
|
|
|
|
add_subdirectory(tools)
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
diff --git a/src/dbusmenuexporter.cpp b/src/dbusmenuexporter.cpp
|
|
|
|
index f25718d..8868efb 100644
|
|
|
|
--- a/src/dbusmenuexporter.cpp
|
|
|
|
+++ b/src/dbusmenuexporter.cpp
|
|
|
|
@@ -160,7 +160,9 @@ void DBusMenuExporterPrivate::fillLayoutItem(DBusMenuLayoutItem *item, QMenu *me
|
2013-11-25 21:47:49 +01:00
|
|
|
Q_FOREACH(QAction *action, menu->actions()) {
|
|
|
|
int actionId = m_idForAction.value(action, -1);
|
|
|
|
if (actionId == -1) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "No id for action";
|
|
|
|
+#endif
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -185,7 +187,9 @@ void DBusMenuExporterPrivate::addAction(QAction *action, int parentId)
|
2013-11-25 21:47:49 +01:00
|
|
|
{
|
|
|
|
int id = m_idForAction.value(action, -1);
|
|
|
|
if (id != -1) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Already tracking action" << action->text() << "under id" << id;
|
|
|
|
+#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
QVariantMap map = propertiesForAction(action);
|
2014-09-15 21:45:41 +02:00
|
|
|
diff --git a/src/dbusmenuimporter.cpp b/src/dbusmenuimporter.cpp
|
|
|
|
index 2a4c514..2f03729 100644
|
|
|
|
--- a/src/dbusmenuimporter.cpp
|
|
|
|
+++ b/src/dbusmenuimporter.cpp
|
|
|
|
@@ -94,7 +94,9 @@ public:
|
|
|
|
QDBusPendingCallWatcher *refresh(int id)
|
|
|
|
{
|
|
|
|
#ifdef BENCHMARK
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMDEBUG << "Starting refresh chrono for id" << id;
|
|
|
|
+#endif
|
|
|
|
sChrono.start();
|
|
|
|
#endif
|
|
|
|
QDBusPendingCall call = m_interface->asyncCall("GetLayout", id, 1, QStringList());
|
|
|
|
@@ -193,7 +195,9 @@ public:
|
2013-11-25 21:47:49 +01:00
|
|
|
updateActionShortcut(action, value);
|
2013-12-18 22:00:02 +01:00
|
|
|
} else if (key == "children-display") {
|
2013-11-25 21:47:49 +01:00
|
|
|
} else {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Unhandled property update" << key;
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -241,7 +245,9 @@ public:
|
2013-12-18 22:03:50 +01:00
|
|
|
action->setProperty(DBUSMENU_PROPERTY_ICON_DATA_HASH, dataHash);
|
|
|
|
QPixmap pix;
|
|
|
|
if (!pix.loadFromData(data)) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Failed to decode icon-data property for action" << action->text();
|
|
|
|
+#endif
|
|
|
|
action->setIcon(QIcon());
|
|
|
|
return;
|
|
|
|
}
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -312,7 +318,9 @@ public:
|
|
|
|
}
|
|
|
|
|
|
|
|
if (watcher->isError()) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << watcher->error().message();
|
|
|
|
+#endif
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -436,18 +444,24 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher)
|
2013-11-25 21:47:49 +01:00
|
|
|
|
|
|
|
QDBusPendingReply<uint, DBusMenuLayoutItem> reply = *watcher;
|
|
|
|
if (!reply.isValid()) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << reply.error().message();
|
|
|
|
+#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
#ifdef BENCHMARK
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMDEBUG << "- items received:" << sChrono.elapsed() << "ms";
|
|
|
|
+#endif
|
|
|
|
#endif
|
|
|
|
DBusMenuLayoutItem rootItem = reply.argumentAt<1>();
|
2013-11-25 21:47:49 +01:00
|
|
|
|
|
|
|
QMenu *menu = d->menuForId(parentId);
|
|
|
|
if (!menu) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "No menu for id" << parentId;
|
|
|
|
+#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -474,7 +488,9 @@ void DBusMenuImporter::slotGetLayoutFinished(QDBusPendingCallWatcher *watcher)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef BENCHMARK
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMDEBUG << "- Menu filled:" << sChrono.elapsed() << "ms";
|
|
|
|
+#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -513,7 +529,9 @@ void DBusMenuImporter::slotMenuAboutToShow()
|
2013-11-25 21:47:49 +01:00
|
|
|
QPointer<QObject> guard(this);
|
|
|
|
|
2014-09-15 21:45:41 +02:00
|
|
|
if (!d->waitForWatcher(watcher, ABOUT_TO_SHOW_TIMEOUT)) {
|
2013-11-25 21:47:49 +01:00
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Application did not answer to AboutToShow() before timeout";
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef BENCHMARK
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -541,7 +559,9 @@ void DBusMenuImporter::slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *
|
2013-11-25 21:47:49 +01:00
|
|
|
|
|
|
|
QDBusPendingReply<bool> reply = *watcher;
|
|
|
|
if (reply.isError()) {
|
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Call to AboutToShow() failed:" << reply.error().message();
|
|
|
|
+#endif
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
bool needRefresh = reply.argumentAt<0>();
|
2014-09-15 21:45:41 +02:00
|
|
|
@@ -553,7 +573,9 @@ void DBusMenuImporter::slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *
|
2013-11-25 21:47:49 +01:00
|
|
|
d->m_idsRefreshedByAboutToShow << id;
|
|
|
|
watcher = d->refresh(id);
|
2014-09-15 21:45:41 +02:00
|
|
|
if (!d->waitForWatcher(watcher, REFRESH_TIMEOUT)) {
|
2013-11-25 21:47:49 +01:00
|
|
|
+#ifndef QT_NO_DEBUG
|
|
|
|
DMWARNING << "Application did not refresh before timeout";
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-09-15 21:45:41 +02:00
|
|
|
diff --git a/src/debug_p.h b/src/debug_p.h
|
|
|
|
index bff37bd..ecdd3a5 100644
|
|
|
|
--- a/src/debug_p.h
|
|
|
|
+++ b/src/debug_p.h
|
2013-11-25 21:47:49 +01:00
|
|
|
@@ -36,12 +36,10 @@
|
|
|
|
#define DMVAR(var) DMDEBUG << #var ":" << var
|
|
|
|
|
|
|
|
#define DMRETURN_IF_FAIL(cond) if (!(cond)) { \
|
|
|
|
- DMWARNING << "Condition failed: " #cond; \
|
|
|
|
return; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DMRETURN_VALUE_IF_FAIL(cond, value) if (!(cond)) { \
|
|
|
|
- DMWARNING << "Condition failed: " #cond; \
|
|
|
|
return (value); \
|
|
|
|
}
|
|
|
|
|