Removed system tray plugins.

This commit is contained in:
codestation
2016-09-04 16:35:12 -04:00
parent 91ddb1fb55
commit 296b8a0c54
11 changed files with 0 additions and 561 deletions

View File

@@ -1,36 +0,0 @@
include(../config.pri)
include(../gui/defines.pri)
TARGET = qcma_appindicator
TEMPLATE = lib
CONFIG += plugin link_pkgconfig
DEFINES += QCMA_TRAYINDICATOR_LIBRARY
QT += gui widgets
QT_CONFIG -= no-pkg-config
PKGCONFIG = appindicator-0.1 libnotify
SOURCES += \
unityindicator.cpp
HEADERS += \
trayindicator.h \
unityindicator.h
CXXFLAGS_WARNINGS = -Wall -Wextra -Wshadow -Wcast-align -Wctor-dtor-privacy \
-Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations \
-Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls \
-Wstrict-overflow=5 -Wundef -Wno-unused -Wno-missing-field-initializers \
-Wno-format-nonliteral
QMAKE_CXXFLAGS += -Wno-write-strings -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS $$CXXFLAGS_WARNINGS
DATADIR = $$PREFIX/share
actions64.path = $$DATADIR/icons/hicolor/64x64/actions
actions64.files += ../gui/resources/images/qcma_on.png
actions64.files += ../gui/resources/images/qcma_off.png
target.path = /usr/lib/qcma
INSTALLS += target actions64

View File

@@ -1 +0,0 @@
../gui/trayindicator.h

View File

@@ -1,202 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "unityindicator.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#else
#include <QDesktopServices>
#define QStandardPaths QDesktopServices
#define writableLocation storageLocation
#endif
#include <QDebug>
#include <QDir>
#include <QVector>
#undef signals
extern "C" {
#include <libnotify/notify.h>
void optionsIndicator(GtkMenu *menu, gpointer data);
void reloadIndicator(GtkMenu *menu, gpointer data);
void backupIndicator(GtkMenu *menu, gpointer data);
void aboutIndicator(GtkMenu *menu, gpointer data);
void aboutQtIndicator(GtkMenu *menu, gpointer data);
void quitIndicator(GtkMenu *menu, gpointer data);
}
#define signals public
UnityIndicator::UnityIndicator(QWidget *obj_parent) :
TrayIndicator(obj_parent)
{
notify_init("qcma");
setAttribute(Qt::WA_TransparentForMouseEvents);
}
UnityIndicator::~UnityIndicator()
{
notify_uninit();
for(QVector<QPair<gpointer, gulong> >::iterator it = m_handlers.begin(); it != m_handlers.end(); ++it)
{
g_signal_handler_disconnect(it->first, it->second);
}
}
void optionsIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->openConfig();
}
void reloadIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->refreshDatabase();
}
void backupIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->openManager();
}
void aboutIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->showAboutDialog();
}
void aboutQtIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->showAboutQt();
}
void quitIndicator(GtkMenu *, gpointer data)
{
UnityIndicator *m_this = reinterpret_cast<UnityIndicator *>(data);
emit m_this->stopServer();
}
void UnityIndicator::init()
{
GtkWidget *menu = gtk_menu_new();
GtkWidget *options = gtk_menu_item_new_with_label(qPrintable(tr("Settings")));
GtkWidget *reload = gtk_menu_item_new_with_label(qPrintable(tr("Refresh database")));
GtkWidget *backup = gtk_menu_item_new_with_label(qPrintable(tr("Backup Manager")));
GtkWidget *separator1 = gtk_separator_menu_item_new();
GtkWidget *about = gtk_menu_item_new_with_label(qPrintable(tr("About QCMA")));
GtkWidget *about_qt = gtk_menu_item_new_with_label(qPrintable(tr("About Qt")));
GtkWidget *separator2 = gtk_separator_menu_item_new();
GtkWidget *quit = gtk_menu_item_new_with_label(qPrintable(tr("Quit")));
gtk_menu_shell_append(GTK_MENU_SHELL(menu), options);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), reload);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), backup);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator1);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), about);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), about_qt);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator2);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), quit);
gulong gobject_handler;
gobject_handler = g_signal_connect(options, "activate", G_CALLBACK(optionsIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(options, gobject_handler));
gobject_handler = g_signal_connect(reload, "activate", G_CALLBACK(reloadIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(reload, gobject_handler));
gobject_handler = g_signal_connect(backup, "activate", G_CALLBACK(backupIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(backup, gobject_handler));
gobject_handler = g_signal_connect(about, "activate", G_CALLBACK(aboutIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(about, gobject_handler));
gobject_handler = g_signal_connect(about_qt, "activate", G_CALLBACK(aboutQtIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(about_qt, gobject_handler));
gobject_handler = g_signal_connect(quit, "activate", G_CALLBACK(quitIndicator), this);
m_handlers.append(QPair<gpointer, gulong>(quit, gobject_handler));
gtk_widget_show(options);
gtk_widget_show(reload);
gtk_widget_show(backup);
gtk_widget_show(separator1);
gtk_widget_show(about);
gtk_widget_show(about_qt);
gtk_widget_show(separator2);
gtk_widget_show(quit);
m_indicator = app_indicator_new(
"qcma-appindicator",
"qcma-messages",
APP_INDICATOR_CATEGORY_APPLICATION_STATUS
);
QString icon_path;
QString icon_name = "share/icons/hicolor/64x64/actions/qcma_on.png";
if(QFile("/usr/" + icon_name).exists())
icon_path = QFileInfo("/usr/" + icon_name).absolutePath();
else if(QFile("/usr/local" + icon_name).exists())
icon_path = QFileInfo("/usr/" + icon_name).absolutePath();
if(!icon_path.isEmpty())
{
qDebug() << "Using " << icon_path << " as icon theme path";
app_indicator_set_icon_theme_path(m_indicator, qPrintable(icon_path));
}
else
qWarning() << "Cannot find qcma icons.";
app_indicator_set_status(m_indicator, APP_INDICATOR_STATUS_ACTIVE);
app_indicator_set_menu(m_indicator, GTK_MENU(menu));
}
bool UnityIndicator::isVisible()
{
return true;
}
void UnityIndicator::setIcon(const QString &icon)
{
app_indicator_set_icon_full(m_indicator, qPrintable(icon), "icon");
}
void UnityIndicator::show()
{
}
void UnityIndicator::hide()
{
}
void UnityIndicator::showMessage(const QString &title, const QString &message)
{
NotifyNotification *notif = notify_notification_new(qPrintable(title), qPrintable(message), "dialog-information");
notify_notification_show(notif, NULL);
g_object_unref(G_OBJECT(notif));
}
// exported library function
TrayIndicator *createTrayIndicator(QWidget *parent)
{
return new UnityIndicator(parent);
}

View File

@@ -1,54 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UNITYINDICATOR_H
#define UNITYINDICATOR_H
#include "trayindicator.h"
#include <QVector>
#undef signals
extern "C" {
#include <libappindicator/app-indicator.h>
#include <gtk/gtk.h>
}
#define signals public
class UnityIndicator : public TrayIndicator
{
Q_OBJECT
public:
explicit UnityIndicator(QWidget *parent = 0);
~UnityIndicator();
void init();
void setIcon(const QString &icon);
bool isVisible();
void show();
void hide();
void showMessage(const QString &title, const QString &message);
private:
AppIndicator *m_indicator;
QVector<QPair<gpointer, gulong> > m_handlers;
};
#endif // UNITYINDICATOR_H

View File

@@ -1,25 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kdenotifier.h"
KDENotifier::KDENotifier(const QString &notifier_id, QObject *obj_parent) :
KStatusNotifierItem(notifier_id, obj_parent)
{
}

View File

@@ -1,43 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KDENOTIFIER_H
#define KDENOTIFIER_H
#include <kstatusnotifieritem.h>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <kmenu.h>
#endif
class KDENotifier : public KStatusNotifierItem
{
Q_OBJECT
public:
explicit KDENotifier(const QString &id, QObject *parent = 0);
signals:
public slots:
// block left click because it shows the default widget
virtual void activate (const QPoint &pos=QPoint()) {
Q_UNUSED(pos);
}
};
#endif // KDENOTIFIER_H

View File

@@ -1,31 +0,0 @@
include(../config.pri)
include(../gui/defines.pri)
TARGET = qcma_kdenotifier
TEMPLATE = lib
CONFIG += plugin
QT += gui widgets
DEFINES += QCMA_TRAYINDICATOR_LIBRARY
PKGCONFIG =
greaterThan(QT_MAJOR_VERSION, 4): ENABLE_KNOTIFICATIONS {
message("Enabling KDE5 notifications")
QT += KNotifications
DEFINES += ENABLE_KNOTIFICATIONS=1
} else {
QT += widgets
LIBS += -lkdeui
}
SOURCES += \
kdenotifier.cpp \
kdenotifiertray.cpp
HEADERS += \
trayindicator.h \
kdenotifier.h \
kdenotifiertray.h
target.path = /usr/lib/qcma
INSTALLS += target

View File

@@ -1,103 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "kdenotifiertray.h"
#ifndef ENABLE_KNOTIFICATIONS
#include <kmenu.h>
#else
#include <QMenu>
#endif
KDENotifierTray::KDENotifierTray(QWidget *obj_parent)
: TrayIndicator(obj_parent)
{
setAttribute(Qt::WA_TransparentForMouseEvents);
}
void KDENotifierTray::init()
{
options = new QAction(tr("Settings"), this);
reload = new QAction(tr("Refresh database"), this);
backup = new QAction(tr("Backup Manager"), this);
about = new QAction(tr("About QCMA"), this);
about_qt = new QAction(tr("About Qt"), this);
quit = new QAction(tr("Quit"), this);
connect(options, SIGNAL(triggered()), this, SIGNAL(openConfig()));
connect(backup, SIGNAL(triggered()), this, SIGNAL(openManager()));
connect(reload, SIGNAL(triggered()), this, SIGNAL(refreshDatabase()));
connect(about, SIGNAL(triggered()), this, SIGNAL(showAboutDialog()));
connect(about_qt, SIGNAL(triggered()), this, SIGNAL(showAboutQt()));
connect(quit, SIGNAL(triggered()), this, SIGNAL(stopServer()));
#ifndef ENABLE_KNOTIFICATIONS
KMenu *tray_icon_menu = new KMenu(this);
#else
QMenu *tray_icon_menu = new QMenu(this);
#endif
tray_icon_menu->addAction(options);
tray_icon_menu->addAction(reload);
tray_icon_menu->addAction(backup);
tray_icon_menu->addSeparator();
tray_icon_menu->addAction(about);
tray_icon_menu->addAction(about_qt);
tray_icon_menu->addSeparator();
tray_icon_menu->addAction(quit);
m_notifier_item = new KDENotifier("QcmaNotifier", this);
m_notifier_item->setContextMenu(tray_icon_menu);
m_notifier_item->setTitle("Qcma");
m_notifier_item->setCategory(KStatusNotifierItem::ApplicationStatus);
m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/qcma_off.png"));
m_notifier_item->setStatus(KStatusNotifierItem::Active);
m_notifier_item->setToolTipTitle(tr("Qcma status"));
m_notifier_item->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png"));
m_notifier_item->setToolTipSubTitle(tr("Disconnected"));
m_notifier_item->setStandardActionsEnabled(false);
}
void KDENotifierTray::showMessage(const QString &title, const QString &message)
{
m_notifier_item->showMessage(title, message, "dialog-information", 3000);
}
bool KDENotifierTray::isVisible()
{
return true;
}
void KDENotifierTray::setIcon(const QString &icon)
{
m_notifier_item->setIconByPixmap(QIcon(":/main/resources/images/" + icon));
}
void KDENotifierTray::show()
{
}
void KDENotifierTray::hide()
{
}
// exported library function
TrayIndicator *createTrayIndicator(QWidget *parent)
{
return new KDENotifierTray(parent);
}

View File

@@ -1,56 +0,0 @@
/*
* QCMA: Cross-platform content manager assistant for the PS Vita
*
* Copyright (C) 2014 Codestation
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef KDENOTIFIERTRAY_H
#define KDENOTIFIERTRAY_H
#include "trayindicator.h"
#include "kdenotifier.h"
class QAction;
class QSystemTrayIcon;
class KDENotifierTray : public TrayIndicator
{
Q_OBJECT
public:
explicit KDENotifierTray(QWidget *parent = 0);
void init();
void setIcon(const QString &icon);
bool isVisible();
void show();
void hide();
void showMessage(const QString &title, const QString &message);
private:
//system tray
QAction *quit;
QAction *reload;
QAction *options;
QAction *backup;
QAction *about;
QAction *about_qt;
KDENotifier *m_notifier_item;
public slots:
};
#endif // KDENOTIFIERTRAY_H

View File

@@ -1 +0,0 @@
../gui/trayindicator.h

View File

@@ -11,15 +11,6 @@ unix:!macx:!android {
# Compile the headless binary only on Linux
SUBDIRS += cli
cli.depends = common
ENABLE_APPINDICATOR {
SUBDIRS += appindicator
appindicator.depends = gui
}
ENABLE_KDENOTIFIER {
SUBDIRS += kdenotifier
kdenotifier.depends = gui
}
}
unix {