diff --git a/CMakeLists.txt b/CMakeLists.txt index 33916f3..ffec83d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,10 @@ endif(KDE4_FOUND) find_package( CryptoPP ) find_package( Boost COMPONENTS system thread) +if(Boost_USE_STATIC_RUNTIME) + add_definitions(-DBOOST_THREAD_USE_LIB ) +endif(Boost_USE_STATIC_RUNTIME) + set(PLUGIN_INSTALL_PATH LIBRARY DESTINATION bin/snoreplugins) add_subdirectory(data) diff --git a/src/core/application.cpp b/src/core/application.cpp index ea9af2a..758a2fc 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -15,6 +15,7 @@ ****************************************************************************************/ #include "application.h" +namespace Snore{ Application::Application (const QString &name, const SnoreIcon &icon) : @@ -98,6 +99,7 @@ bool Alert::isActive() const return _active; } +} #include "application.moc" diff --git a/src/core/application.h b/src/core/application.h index 588d4c8..41c2263 100644 --- a/src/core/application.h +++ b/src/core/application.h @@ -20,6 +20,8 @@ #include "notification/icon.h" #include +namespace Snore{ + typedef QHash ApplicationsList ; typedef QHash AlertList; @@ -66,4 +68,6 @@ private: }; +} + #endif // APPLICATION_H diff --git a/src/core/interface.cpp b/src/core/interface.cpp index faa8e9e..5c1cdcf 100644 --- a/src/core/interface.cpp +++ b/src/core/interface.cpp @@ -18,6 +18,7 @@ #include "snoreserver.h" #include +namespace Snore{ SnorePlugin::SnorePlugin ( QString name,SnoreServer *snore ) : _name ( name ), @@ -91,4 +92,5 @@ Notification_Frontend::~Notification_Frontend() { } +} #include "interface.moc" diff --git a/src/core/interface.h b/src/core/interface.h index 81d4037..f1c0b6f 100644 --- a/src/core/interface.h +++ b/src/core/interface.h @@ -19,6 +19,7 @@ #include "snore_exports.h" #include "notification/notification.h" +namespace Snore{ class SNORE_EXPORT SnorePlugin:public QObject { @@ -46,13 +47,16 @@ private: }; -Q_DECLARE_INTERFACE ( SnorePlugin, +} +Q_DECLARE_INTERFACE ( Snore::SnorePlugin, "org.Snore.SnorePlugin/1.0" ) +namespace Snore{ + class SNORE_EXPORT Notification_Backend:public SnorePlugin { Q_OBJECT - Q_INTERFACES(SnorePlugin) + Q_INTERFACES(Snore::SnorePlugin) public: Notification_Backend ( QString name,class SnoreServer *snore=0 ); virtual ~Notification_Backend(); @@ -74,7 +78,7 @@ public slots: class SNORE_EXPORT Notification_Frontend:public SnorePlugin { Q_OBJECT - Q_INTERFACES(SnorePlugin) + Q_INTERFACES(Snore::SnorePlugin) public: Notification_Frontend ( QString name,class SnoreServer *snore=0 ); virtual ~Notification_Frontend(); @@ -87,10 +91,12 @@ public slots: -Q_DECLARE_INTERFACE ( Notification_Frontend, + +} + +Q_DECLARE_INTERFACE ( Snore::Notification_Frontend, "org.Snore.NotificationFrontend/1.0" ) -Q_DECLARE_INTERFACE ( Notification_Backend, +Q_DECLARE_INTERFACE ( Snore::Notification_Backend, "org.Snore.NotificationBackend/1.0" ) - #endif//INTERFACE_H diff --git a/src/core/notification/icon.cpp b/src/core/notification/icon.cpp index 39ca80a..7686562 100644 --- a/src/core/notification/icon.cpp +++ b/src/core/notification/icon.cpp @@ -22,6 +22,7 @@ #include #include #include +namespace Snore{ class SnoreIcon::SnoreIconData { @@ -130,4 +131,5 @@ bool SnoreIcon::isEmpty() const{ return d->_hash.isEmpty() && d->_img.isNull() && d->_localFileName.isEmpty(); } +} #include "icon.moc" diff --git a/src/core/notification/icon.h b/src/core/notification/icon.h index d815073..a7fb632 100644 --- a/src/core/notification/icon.h +++ b/src/core/notification/icon.h @@ -21,6 +21,7 @@ #include #include +namespace Snore{ class SNORE_EXPORT SnoreIcon @@ -51,7 +52,7 @@ private: }; - +} #endif // NOTIFICATION_ICON_H diff --git a/src/core/notification/notification.cpp b/src/core/notification/notification.cpp index 3992142..a820afb 100644 --- a/src/core/notification/notification.cpp +++ b/src/core/notification/notification.cpp @@ -23,19 +23,26 @@ #include #include #include +namespace Snore{ static int metaid = qRegisterMetaType(); +static int count = 0; + class Notification::NotificationData { public: + + NotificationData ( uint id=0 ): _id ( id ), _timeout ( 10 ), _source ( NULL ), _closeReason(NotificationEnums::CloseReasons::NONE), _priority(NotificationEnums::Prioritys::NORMAL) - {} + { + qDebug()<<"ActiveNotifications"<<++count; + } NotificationData ( const QString &application,const QString &alert,const QString &title,const QString &text,const SnoreIcon &icon,int timeout,uint id,NotificationEnums::Prioritys::prioritys priority ): _id ( id ), @@ -48,11 +55,14 @@ public: _icon ( icon ), _priority(priority), _closeReason(NotificationEnums::CloseReasons::NONE) - {} + { + qDebug()<<"ActiveNotifications"<<++count; + } ~NotificationData(){ //delete _actionInvoked; + qDebug()<<"ActiveNotifications"<<--count; } uint _id; @@ -235,5 +245,6 @@ QDataStream & operator<< ( QDataStream &stream, const Notification::Action &a) stream< #include +namespace Snore{ namespace NotificationEnums{ @@ -102,9 +103,10 @@ private: QSharedPointer d; }; -Q_DECLARE_METATYPE(Notification) +} -QDataStream & operator<< ( QDataStream & stream, const Notification & noti ); -QDataStream & operator<< ( QDataStream & stream, const Notification::Action & action); +Q_DECLARE_METATYPE(Snore::Notification) +QDataStream & operator<< ( QDataStream & stream, const Snore::Notification & noti ); +QDataStream & operator<< ( QDataStream & stream, const Snore::Notification::Action & action); #endif // NOTIFICATION_H diff --git a/src/core/snoreserver.cpp b/src/core/snoreserver.cpp index 678111a..53ee780 100644 --- a/src/core/snoreserver.cpp +++ b/src/core/snoreserver.cpp @@ -25,6 +25,7 @@ #include #include +namespace Snore{ QString const SnoreServer::version(){ return "0.15"; @@ -180,5 +181,6 @@ const QString &SnoreServer::primaryNotificationBackend(){ return _notificationBackend->name(); } +} #include "snoreserver.moc" diff --git a/src/core/snoreserver.h b/src/core/snoreserver.h index f5a7d57..b90fdb4 100644 --- a/src/core/snoreserver.h +++ b/src/core/snoreserver.h @@ -23,6 +23,10 @@ #include +class QSystemTrayIcon; + +namespace Snore{ + class SNORE_EXPORT SnoreServer:public QObject { Q_OBJECT @@ -31,7 +35,7 @@ public: static const QString snoreTMP(); public: - SnoreServer ( class QSystemTrayIcon *trayIcon=0 ); + SnoreServer (QSystemTrayIcon *trayIcon=0 ); void publicatePlugin ( const QString &fileName ); void publicatePlugin ( SnorePlugin *plugin ); @@ -72,5 +76,6 @@ signals: }; +} #endif // SNORESERVER_H diff --git a/src/core/trayiconnotifer.cpp b/src/core/trayiconnotifer.cpp index 12a6e51..16dda0d 100644 --- a/src/core/trayiconnotifer.cpp +++ b/src/core/trayiconnotifer.cpp @@ -5,6 +5,8 @@ #include #include #include +using namespace Snore; + TrayIconNotifer::TrayIconNotifer ( SnoreServer *snore, QSystemTrayIcon *icon ) : Notification_Backend ( "SystemTray",snore ), @@ -79,4 +81,5 @@ void TrayIconNotifer::actionInvoked(){ } + #include "trayiconnotifer.moc" diff --git a/src/core/trayiconnotifer.h b/src/core/trayiconnotifer.h index f4b4ede..b89b28a 100644 --- a/src/core/trayiconnotifer.h +++ b/src/core/trayiconnotifer.h @@ -6,23 +6,23 @@ #include -class TrayIconNotifer:public Notification_Backend +class TrayIconNotifer:public Snore::Notification_Backend { Q_OBJECT - Q_INTERFACES(Notification_Backend) + Q_INTERFACES(Snore::Notification_Backend) public: - TrayIconNotifer ( class SnoreServer *snore=0,class QSystemTrayIcon *icon=0 ); + TrayIconNotifer ( class Snore::SnoreServer *snore=0,class QSystemTrayIcon *icon=0 ); bool isPrimaryNotificationBackend(); public slots: - void registerApplication ( Application *application ); - void unregisterApplication ( class Application *application ); - uint notify ( Notification notification ); - void closeNotification ( Notification notification ); + void registerApplication ( Snore::Application *application ); + void unregisterApplication ( Snore::Application *application ); + uint notify ( Snore::Notification notification ); + void closeNotification ( Snore::Notification notification ); private: class QSystemTrayIcon *_trayIcon; - QList _notificationQue; + QList _notificationQue; QTime _lastNotify; uint _id; uint _displayed; diff --git a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp index a73308a..1e32696 100644 --- a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp +++ b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.cpp @@ -27,6 +27,7 @@ #ifdef HAVE_KDE #include #endif +using namespace Snore; Q_EXPORT_PLUGIN2(freedesktop_frontend,FreedesktopNotification_Frontend) diff --git a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h index 95c41bd..4a08e26 100644 --- a/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h +++ b/src/plugins/freedesktopfrontend/freedesktopnotificationfrontend.h @@ -19,15 +19,15 @@ #include "core/interface.h" #include -class FreedesktopNotification_Frontend:public Notification_Frontend{ +class FreedesktopNotification_Frontend:public Snore::Notification_Frontend{ Q_OBJECT - Q_INTERFACES(Notification_Frontend) + Q_INTERFACES(Snore::Notification_Frontend) public: - FreedesktopNotification_Frontend(class SnoreServer *snore=0); + FreedesktopNotification_Frontend(class Snore::SnoreServer *snore=0); ~FreedesktopNotification_Frontend(); - void actionInvoked(Notification notification); - void notificationClosed(Notification notification); + void actionInvoked(Snore::Notification notification); + void notificationClosed(Snore::Notification notification); uint Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout); void CloseNotification( uint id ); diff --git a/src/plugins/freedesktopnotification/fredesktopnotification.cpp b/src/plugins/freedesktopnotification/fredesktopnotification.cpp index 8852992..62f911c 100644 --- a/src/plugins/freedesktopnotification/fredesktopnotification.cpp +++ b/src/plugins/freedesktopnotification/fredesktopnotification.cpp @@ -20,7 +20,6 @@ #include - static int imageHintID = qDBusRegisterMetaType(); diff --git a/src/plugins/growl/CMakeLists.txt b/src/plugins/growl/CMakeLists.txt index cda3875..db1299b 100644 --- a/src/plugins/growl/CMakeLists.txt +++ b/src/plugins/growl/CMakeLists.txt @@ -10,6 +10,12 @@ if( WITH_GROWL_BACKEND ) automoc4_add_library(growl_backend MODULE ${GROWL__SRC} ) target_link_libraries(growl_backend snorecore ${QT_QTCORE_LIBRARY} ${CRYPTOPP_LIBRARIES} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY}) + + if(MINGW) + #fiexes a multiple defenition error with static boost + SET_TARGET_PROPERTIES(growl_backend PROPERTIES LINK_FLAGS -Wl,--allow-multiple-definition) + endif(MINGW) + if(WIN32) target_link_libraries(growl_backend wsock32 ws2_32) endif(WIN32) diff --git a/src/plugins/growl/growl_backend.cpp b/src/plugins/growl/growl_backend.cpp index f8ea663..0781a00 100644 --- a/src/plugins/growl/growl_backend.cpp +++ b/src/plugins/growl/growl_backend.cpp @@ -22,7 +22,7 @@ #include - +using namespace Snore; Q_EXPORT_PLUGIN2(growl_backend,Growl_Backend) diff --git a/src/plugins/growl/growl_backend.h b/src/plugins/growl/growl_backend.h index ade9088..806b1f3 100644 --- a/src/plugins/growl/growl_backend.h +++ b/src/plugins/growl/growl_backend.h @@ -20,15 +20,15 @@ #include -class Growl_Backend:public Notification_Backend +class Growl_Backend:public Snore::Notification_Backend { Q_OBJECT - Q_INTERFACES(Notification_Backend) + Q_INTERFACES(Snore::Notification_Backend) public: - Growl_Backend(class SnoreServer *snore=0); + Growl_Backend(class Snore::SnoreServer *snore=0); ~Growl_Backend(); bool isPrimaryNotificationBackend(){return true;} - static void gntpCallback(const int &id,const std::string &reason,const std::string &data); + static void gntpCallback(const int &id,const std::string &reason,const std::string &data); private: //a static instance for the static callback methode static Growl_Backend *instance; @@ -36,10 +36,10 @@ private: QHash _applications; public slots: - void registerApplication(Application *application); - void unregisterApplication(class Application *application); - uint notify(Notification notification); - void closeNotification(Notification notification); + void registerApplication(Snore::Application *application); + void unregisterApplication(Snore::Application *application); + uint notify(Snore::Notification notification); + void closeNotification(Snore::Notification notification); }; diff --git a/src/plugins/snarl/SnarlInterface.cpp b/src/plugins/snarl/SnarlInterface.cpp index e7653cb..37bccfe 100644 --- a/src/plugins/snarl/SnarlInterface.cpp +++ b/src/plugins/snarl/SnarlInterface.cpp @@ -645,7 +645,7 @@ LPSTR SnarlInterface::WideToUTF8(LPCWSTR szWideStr) if (szWideStr == NULL) return NULL; - int nSize = WideCharToMultiByte(CP_UTF8, 0, szWideStr, -1, NULL, 0, NULL, NULL); + int nSize = WideCharToMultiByte(CP_UTF8, 0, szWideStr, -1, NULL,0, NULL, NULL); LPSTR szUTF8 = new char[nSize]; WideCharToMultiByte(CP_UTF8, 0, szWideStr, -1, szUTF8, nSize, NULL, NULL); diff --git a/src/plugins/snarl/snarl_backend.cpp b/src/plugins/snarl/snarl_backend.cpp index dfab633..b0ec381 100644 --- a/src/plugins/snarl/snarl_backend.cpp +++ b/src/plugins/snarl/snarl_backend.cpp @@ -30,6 +30,7 @@ #define SNORENOTIFIER_MESSAGE_ID WM_USER + 238 +using namespace Snore; using namespace Snarl::V42; Q_EXPORT_PLUGIN2(snarl_backend,Snarl_Backend) diff --git a/src/plugins/snarl/snarl_backend.h b/src/plugins/snarl/snarl_backend.h index 461a7b7..ef46045 100644 --- a/src/plugins/snarl/snarl_backend.h +++ b/src/plugins/snarl/snarl_backend.h @@ -23,13 +23,13 @@ class SnarlWidget; -class Snarl_Backend:public Notification_Backend +class Snarl_Backend:public Snore::Notification_Backend { Q_OBJECT - Q_INTERFACES(Notification_Backend) + Q_INTERFACES(Snore::Notification_Backend) friend class SnarlWidget; public: - Snarl_Backend(class SnoreServer *snore=0); + Snarl_Backend(class Snore::SnoreServer *snore=0); ~Snarl_Backend(); bool isPrimaryNotificationBackend(); @@ -40,10 +40,10 @@ private: bool _away; public slots: - void registerApplication(Application *application); - void unregisterApplication(class Application *application); - uint notify(Notification notification); - void closeNotification(Notification notification); + void registerApplication(Snore::Application *application); + void unregisterApplication(Snore::Application *application); + uint notify(Snore::Notification notification); + void closeNotification(Snore::Notification notification); }; diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index bca436b..a2bfaeb 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -28,13 +28,13 @@ #include - +using namespace Snore; SnoreNotify::SnoreNotify(): _settings("TheOneRing","SnoreNotify") { _trayIcon = new TrayIcon(); - _snore = new SnoreServer(_trayIcon->trayIcon()); + _snore = new Snore::SnoreServer(_trayIcon->trayIcon()); QDir pluginsDir ( qApp->applicationDirPath() +"/snoreplugins" ); foreach ( QString fileName, pluginsDir.entryList ( QDir::Files ) ) diff --git a/src/snorenotify.h b/src/snorenotify.h index 88033d0..a78e09e 100644 --- a/src/snorenotify.h +++ b/src/snorenotify.h @@ -19,6 +19,10 @@ #include +namespace Snore{ + class SnoreServer; +} + class SnoreNotify:public QObject { Q_OBJECT @@ -30,7 +34,7 @@ public: private: class TrayIcon *_trayIcon; - class SnoreServer *_snore; + Snore::SnoreServer *_snore; class QSettings _settings; private slots: diff --git a/src/trayicon.cpp b/src/trayicon.cpp index 108888d..a527752 100644 --- a/src/trayicon.cpp +++ b/src/trayicon.cpp @@ -21,6 +21,8 @@ #include #include +using namespace Snore; + TrayIcon::TrayIcon() { _trayIcon = new QSystemTrayIcon(QIcon(":/root/snore.png")); diff --git a/src/trayicon.h b/src/trayicon.h index c02f6ad..ca74272 100644 --- a/src/trayicon.h +++ b/src/trayicon.h @@ -19,12 +19,16 @@ #include +namespace Snore{ + class SnoreServer; +} + class TrayIcon:public QObject { Q_OBJECT public: TrayIcon(); - void initConextMenu(class SnoreServer *snore); + void initConextMenu(Snore::SnoreServer *snore); void hide(); class QSystemTrayIcon* trayIcon(); @@ -32,7 +36,7 @@ private: class QSystemTrayIcon *_trayIcon; class QMenu *_trayMenu; class QList _backendActions; - class SnoreServer *_snore; + class Snore::SnoreServer *_snore; public slots: