aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lumina-desktop/LPanel.cpp10
-rw-r--r--lumina-desktop/desktop-plugins/NewDP.h3
-rw-r--r--lumina-desktop/desktop-plugins/messagecenter/LXDG-DBusNotifier.h17
-rw-r--r--lumina-desktop/desktop-plugins/messagecenter/MessageCenter.cpp90
-rw-r--r--lumina-desktop/desktop-plugins/messagecenter/MessageCenter.h48
-rw-r--r--lumina-desktop/lumina-desktop.pro8
6 files changed, 171 insertions, 5 deletions
diff --git a/lumina-desktop/LPanel.cpp b/lumina-desktop/LPanel.cpp
index 870de07d..35d89576 100644
--- a/lumina-desktop/LPanel.cpp
+++ b/lumina-desktop/LPanel.cpp
@@ -264,8 +264,14 @@ void LPanel::enterEvent(QEvent *event){
}
void LPanel::leaveEvent(QEvent *event){
- //qDebug() << "Panel Leave Event:";
- if(hidden && !this->geometry().contains( this->mapFromGlobal(QCursor::pos()) ) ){
+ /*qDebug() << "Panel Leave Event:";
+ qDebug() << "Panel Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height() ;
+ QPoint pt = QCursor::pos();
+ qDebug() << "Mouse Point (global):" << pt.x() << pt.y();
+ //pt = this->mapFromGlobal(pt);
+ //qDebug() << "Mouse Point (local):" << pt.x() << pt.y();
+ qDebug() << "Contained:" << this->geometry().contains(pt);*/
+ if(hidden && !this->geometry().contains(QCursor::pos()) ){
//Move the panel back to it's "hiding" spot
this->move(hidepoint);
}
diff --git a/lumina-desktop/desktop-plugins/NewDP.h b/lumina-desktop/desktop-plugins/NewDP.h
index 43d8e8f8..d06b2e60 100644
--- a/lumina-desktop/desktop-plugins/NewDP.h
+++ b/lumina-desktop/desktop-plugins/NewDP.h
@@ -19,6 +19,7 @@
#include "desktopview/DesktopViewPlugin.h"
#include "notepad/NotepadPlugin.h"
#include "audioplayer/PlayerWidget.h"
+//#include "messagecenter/MessageCenter.h"
class NewDP{
public:
@@ -37,6 +38,8 @@ public:
plug = new NotePadPlugin(parent, plugin);
}else if(plugin.section("---",0,0)=="audioplayer"){
plug = new AudioPlayerPlugin(parent, plugin);
+ //}else if(plugin.section("---",0,0)=="messagecenter"){
+ //plug = new MessageCenterPlugin(parent, plugin);
}else{
qWarning() << "Invalid Desktop Plugin:"<<plugin << " -- Ignored";
}
diff --git a/lumina-desktop/desktop-plugins/messagecenter/LXDG-DBusNotifier.h b/lumina-desktop/desktop-plugins/messagecenter/LXDG-DBusNotifier.h
new file mode 100644
index 00000000..64413e95
--- /dev/null
+++ b/lumina-desktop/desktop-plugins/messagecenter/LXDG-DBusNotifier.h
@@ -0,0 +1,17 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// Simple DBUS message handler for the FreeDesktop desktop notifications specification
+
+
+class LXDG-DBusNotifier : public QDBusVirtualObkect{
+ Q_OBJECT
+public:
+
+private:
+
+
+};
diff --git a/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.cpp b/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.cpp
new file mode 100644
index 00000000..df07a122
--- /dev/null
+++ b/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.cpp
@@ -0,0 +1,90 @@
+#include "MessageCenter.h"
+
+#include <LuminaXDG.h>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QDBusConnection>
+#include <QDBusConnectionInterface>
+
+MessageCenterPlugin::MessageCenterPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
+ //Setup the UI
+ QVBoxLayout *vlay = new QVBoxLayout();
+ this->setLayout( new QVBoxLayout() );
+ this->layout()->setContentsMargins(0,0,0,0);
+ vlay->setContentsMargins(3,3,3,3);
+ frame = new QFrame(this);
+ frame->setObjectName("messagecenterbase");
+ this->layout()->addWidget(frame);
+ frame->setLayout(vlay);
+
+
+ //Setup the title bar header buttons
+ QHBoxLayout *hlay = new QHBoxLayout();
+ tool_clearall = new QToolButton(this);
+ tool_clearall->setAutoRaise(true);
+ tool_clearone = new QToolButton(this);
+ tool_clearone->setAutoRaise(true);
+ QWidget *spacer = new QWidget(this);
+ spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ hlay->addWidget(spacer);
+ hlay->addWidget(tool_clearone);
+ hlay->addWidget(tool_clearall);
+ vlay->addLayout(hlay);
+
+ //Setup the main text widget
+ list_messages = new QListWidget(this);
+ list_messages->setSelectionMode(QAbstractItemView::SingleSelection);
+ list_messages->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ vlay->addWidget(list_messages);
+
+ //Now setup the initial values
+ this->setInitialSize(200,300);
+ //Setup the button connections
+ connect(tool_clearall, SIGNAL(clicked()), this, SLOT(clearAllMessages()) );
+ connect(tool_clearone, SIGNAL(clicked()), this, SLOT(clearSelectedMessage()) );
+
+ //Setup the DBUS signals/slots
+ if(QDBusConnection::sessionBus().isConnected()){
+ if( QDBusConnection::sessionBus().registerService("org.freedesktop.Notifications") ){
+ //Was able to register this service, also register everything it can do...
+ //SUPPORTED: "body", "body-hyperlinks", "body-markup", "icon-static"
+
+
+ }
+ QDBusConnection::sessionBus().connect("", "", "org.freedesktop.Notifications", "Notify", this, SLOT(newMessage(QString, uint, QString, QString, QString, QStringList, dict, int)) );
+ QDBusConnection::sessionBus().interface().call("AddMatch", "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
+ qDebug() << "Available Session DBUS Services:" << QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+ //connect(QString(), QString(),
+ }
+ if(QDBusConnection::systemBus().isConnected()){
+ qDebug() << "Available System DBUS Services:" << QDBusConnection::systemBus().interface()->registeredServiceNames().value();
+ }
+
+ QTimer::singleShot(0,this, SLOT(loadIcons()) );
+}
+
+MessageCenterPlugin::~MessageCenterPlugin(){
+
+}
+
+void MessageCenterPlugin::newMessage(QString summary, QString body){
+ qDebug() << "New Message:" << summary, body;
+}
+
+void MessageCenterPlugin::clearAllMessages(){
+ list_messages->clear();
+}
+
+void MessageCenterPlugin::clearSelectedMessage(){
+ if( list_messages->currentItem()==0){ return; } //nothing selected
+ list_messages->removeItemWidget( list_messages->currentItem() );
+}
+
+
+void MessageCenterPlugin::loadIcons(){
+ tool_clearall->setIcon( LXDG::findIcon("edit-clear-list","") );
+ tool_clearall->setToolTip( tr("Clear all messages") );
+ tool_clearone->setIcon( LXDG::findIcon("edit-delete","") );
+ tool_clearone->setToolTip( tr("Clear selected message") );
+
+}
diff --git a/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.h b/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.h
new file mode 100644
index 00000000..8491546f
--- /dev/null
+++ b/lumina-desktop/desktop-plugins/messagecenter/MessageCenter.h
@@ -0,0 +1,48 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This plugin is a simple DBUS monitor which display's messages that come in
+//===========================================
+#ifndef _LUMINA_DESKTOP_MESSAGE_CENTER_PLUGIN_H
+#define _LUMINA_DESKTOP_MESSAGE_CENTER_PLUGIN_H
+
+#include <QListWidget>
+#include <QToolButton>
+#include <QFrame>
+
+#include <QTimer>
+#include "../LDPlugin.h"
+
+class MessageCenterPlugin : public LDPlugin{
+ Q_OBJECT
+public:
+ MessageCenterPlugin(QWidget* parent, QString ID);
+ ~MessageCenterPlugin();
+
+private:
+ //QDBusConnection *sess, *sys;
+ QListWidget *list_messages;
+ QFrame *frame;
+ QToolButton *tool_clearall; //clear all messages
+ QToolButton *tool_clearone; //clear selected message
+
+private slots:
+ //void newMessage(QDBusMessage *message);
+ void clearAllMessages();
+ void clearSelectedMessage();
+
+ void loadIcons();
+
+public slots:
+ void LocaleChange(){
+ QTimer::singleShot(0,this, SLOT(loadIcons()));
+ }
+ void ThemeChange(){
+ QTimer::singleShot(0,this, SLOT(loadIcons()));
+ }
+
+};
+#endif
diff --git a/lumina-desktop/lumina-desktop.pro b/lumina-desktop/lumina-desktop.pro
index da3aae44..5a05c878 100644
--- a/lumina-desktop/lumina-desktop.pro
+++ b/lumina-desktop/lumina-desktop.pro
@@ -1,6 +1,6 @@
QT += core gui network
-greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets x11extras multimedia dbus
TARGET = Lumina-DE
isEmpty(PREFIX) {
@@ -52,7 +52,8 @@ SOURCES += main.cpp \
desktop-plugins/applauncher/AppLauncherPlugin.cpp \
desktop-plugins/desktopview/DesktopViewPlugin.cpp \
desktop-plugins/notepad/NotepadPlugin.cpp \
- desktop-plugins/audioplayer/PlayerWidget.cpp
+ desktop-plugins/audioplayer/PlayerWidget.cpp
+# desktop-plugins/messagecenter/MessageCenter.cpp
HEADERS += Globals.h \
@@ -91,7 +92,8 @@ HEADERS += Globals.h \
desktop-plugins/applauncher/AppLauncherPlugin.h \
desktop-plugins/desktopview/DesktopViewPlugin.h \
desktop-plugins/notepad/NotepadPlugin.h \
- desktop-plugins/audioplayer/PlayerWidget.h
+ desktop-plugins/audioplayer/PlayerWidget.h
+# desktop-plugins/messagecenter/MessageCenter.h
FORMS += SystemWindow.ui \
panel-plugins/userbutton/UserWidget.ui \
bgstack15