Skip to content

Commit

Permalink
Added Status Notifier Plugin, from equim/lxqt-panel-plugin-snw
Browse files Browse the repository at this point in the history
  • Loading branch information
paulolieuthier authored and palinek committed Mar 10, 2015
1 parent 6f2ccd3 commit 4782baa
Show file tree
Hide file tree
Showing 18 changed files with 1,497 additions and 7 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ find_package(Qt5LinguistTools REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5X11Extras REQUIRED)
find_package(KF5WindowSystem REQUIRED)
find_package(PkgConfig REQUIRED)

find_package(lxqt REQUIRED)
find_package(Qt5Xdg REQUIRED QUIET)
find_package(lxqt-globalkeys REQUIRED)
find_package(lxqt-globalkeys-ui REQUIRED)
pkg_check_modules(dbusmenu-qt5 REQUIRED dbusmenu-qt5)

include(${LXQT_USE_FILE})
include(${QTXDG_USE_FILE})
Expand All @@ -55,6 +57,7 @@ include_directories(
${LXQT_INCLUDE_DIRS}
${QTXDG_INCLUDE_DIRS}
${Qt5X11Extras_INCLUDE_DIRS}
${dbusmenu-qt5_INCLUDE_DIRS}
)

# Warning: This must be before add_subdirectory(panel). Move with caution.
Expand Down Expand Up @@ -194,6 +197,13 @@ if(TASKBAR_PLUGIN)
add_subdirectory(plugin-taskbar)
endif()

setByDefault(STATUSNOTIFIER_PLUGIN Yes)
if(STATUSNOTIFIER_PLUGIN)
list(APPEND STATIC_PLUGINS "statusnotifier")
set(ENABLED_PLUGINS ${ENABLED_PLUGINS} "Status Notifier")
add_subdirectory(plugin-statusnotifier)
endif()

setByDefault(TRAY_PLUGIN Yes)
if(TRAY_PLUGIN)
list(APPEND STATIC_PLUGINS "tray")
Expand Down
15 changes: 8 additions & 7 deletions panel/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include <LXQt/Settings>
#include <LXQt/Translator>
#include <XdgIcon>
#include <algorithm> // for std::lower_bound()

// statically linked built-in plugins
#include "../plugin-clock/lxqtclock.h" // clock
Expand All @@ -55,6 +54,7 @@
#include "../plugin-quicklaunch/lxqtquicklaunchplugin.h" // quicklaunch
#include "../plugin-showdesktop/showdesktop.h" // showdesktop
#include "../plugin-taskbar/lxqttaskbarplugin.h" // taskbar
#include "../plugin-statusnotifier/statusnotifier.h" // statusnotifier
#include "../plugin-tray/lxqttrayplugin.h" // tray
#include "../plugin-worldclock/lxqtworldclock.h" // worldclock

Expand Down Expand Up @@ -187,6 +187,7 @@ ILxQtPanelPluginLibrary* Plugin::findStaticPlugin(const QString &libraryName)
static LxQtQuickLaunchPluginLibrary quicklaunch_lib; // quicklaunch
static ShowDesktopLibrary showdesktop_lib; //showdesktop
static LxQtTaskBarPluginLibrary taskbar_lib; //taskbar
static StatusNotifierLibrary statusnotifier_lib; // statusnotifier
static LxQtTrayPluginLibrary tray_lib; //tray
static LxQtWorldClockLibrary worldclock_lib; // worldclock

Expand All @@ -198,6 +199,7 @@ ILxQtPanelPluginLibrary* Plugin::findStaticPlugin(const QString &libraryName)
QStringLiteral("quicklaunch"),
QStringLiteral("showdesktop"),
QStringLiteral("taskbar"),
QStringLiteral("statusnotifier"),
QStringLiteral("tray"),
QStringLiteral("worldclock")
};
Expand All @@ -209,16 +211,15 @@ ILxQtPanelPluginLibrary* Plugin::findStaticPlugin(const QString &libraryName)
&quicklaunch_lib,
&showdesktop_lib,
&taskbar_lib,
&statusnotifier_lib,
&tray_lib,
&worldclock_lib
};

// for small tables, binary search is often faster than hash tables
const QString* end = names + sizeof(names)/sizeof(QString);
const QString* it = std::lower_bound(names, end, libraryName);
if(it != end && *it == libraryName) {
return staticPlugins[(it - names)];
}
for (int i = 0; i < sizeof(names) / sizeof(QString); i++)
if (names[i] == libraryName)
return staticPlugins[i];

return NULL;
}

Expand Down
47 changes: 47 additions & 0 deletions plugin-statusnotifier/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
set(PLUGIN "statusnotifier")

include(CheckLibraryExists)

set(QT_USE_QTDBUS 1)
set(QT_USE_QTXML 1)

set(HEADERS
statusnotifier.h
dbustypes.h
statusnotifierbutton.h
statusnotifieriteminterface.h
statusnotifierwatcher.h
statusnotifierwidget.h
)

set(SOURCES
statusnotifier.cpp
dbustypes.cpp
statusnotifierbutton.cpp
statusnotifieriteminterface.cpp
statusnotifierwatcher.cpp
statusnotifierwidget.cpp
)

set(MOCS
statusnotifier.h
dbustypes.h
statusnotifierbutton.h
statusnotifieriteminterface.h
statusnotifierwatcher.h
statusnotifierwidget.h
)

qt5_add_dbus_adaptor(SOURCES
org.kde.StatusNotifierItem.xml
statusnotifieriteminterface.h
StatusNotifierItemInterface
)

set(LIBRARIES
${LXQT_LIBRARIES}
${QTXDG_LIBRARIES}
${dbusmenu-qt5_LIBRARIES}
)

BUILD_LXQT_PLUGIN(${PLUGIN})
Loading

0 comments on commit 4782baa

Please sign in to comment.