Reorganized project to avoid the ".pro not found" by having all the
pro files in the same directory. With this change the android library now builds properly. This also fixes the parallel compilation problem that happened when building using +8 cores.
This commit is contained in:
36
appindicator/appindicator.pro
Normal file
36
appindicator/appindicator.pro
Normal file
@@ -0,0 +1,36 @@
|
||||
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 += resources/images/qcma_on.png
|
||||
actions64.files += resources/images/qcma_off.png
|
||||
|
||||
target.path = /usr/lib/qcma
|
||||
INSTALLS += target actions64
|
1
appindicator/trayindicator.h
Symbolic link
1
appindicator/trayindicator.h
Symbolic link
@@ -0,0 +1 @@
|
||||
../gui/trayindicator.h
|
201
appindicator/unityindicator.cpp
Normal file
201
appindicator/unityindicator.cpp
Normal file
@@ -0,0 +1,201 @@
|
||||
/*
|
||||
* 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");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
54
appindicator/unityindicator.h
Normal file
54
appindicator/unityindicator.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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
|
Reference in New Issue
Block a user