diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f863f3..7ced6b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,11 +6,11 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(KDE4) - if(MINGW) - SET (CMAKE_RC_COMPILER_INIT windres) - ENABLE_LANGUAGE (RC) - SET (CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") - endif(MINGW) +if(MINGW) +SET (CMAKE_RC_COMPILER_INIT windres) +ENABLE_LANGUAGE (RC) +SET (CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") +endif(MINGW) if(KDE4_FOUND) add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS} -D_UNICODE) diff --git a/cmake/modules/NoKDE.cmake b/cmake/modules/NoKDE.cmake index 5ce391f..c4d30b0 100644 --- a/cmake/modules/NoKDE.cmake +++ b/cmake/modules/NoKDE.cmake @@ -6,8 +6,6 @@ include_directories( ${QT_QTCORE_INCLUDE_DIR} ${QT_QTGUI_INCLUDE_DIR} ${QT_QTNETWORK_INCLUDE_DIR} ${QT_QTDBUS_INCLUDE_DIR}) - - include( ${QT_USE_FILE} ) if (CMAKE_COMPILER_IS_GNUCXX) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4737fb9..7968b1a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,7 +16,7 @@ endif(WIN32) automoc4_add_executable( snorenotify ${WIN32_SPECIFIC} main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS}) -target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} ${QT_QTXML_LIBRARY} ) +target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} ) if(MSVC) set_target_properties(snorenotify PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"") diff --git a/src/core/snoreserver.cpp b/src/core/snoreserver.cpp index 40b043e..744b857 100644 --- a/src/core/snoreserver.cpp +++ b/src/core/snoreserver.cpp @@ -35,19 +35,16 @@ QString const SnoreServer::snoreTMP(){ return tmp; } -void SnoreServer::initTMP(){ + +SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) : + _notificationBackend ( NULL ), + _trayIcon ( trayIcon ) +{ QDir home ( snoreTMP() ); if ( !home.exists() ){ home.cdUp(); home.mkdir("SnoreNotify"); } -} - -SnoreServer::SnoreServer ( QSystemTrayIcon *trayIcon ) : - _notificationBackend ( NULL ), - _trayIcon ( trayIcon ) -{ - qDebug() <<"Inititalized"; if ( trayIcon!=NULL ) { diff --git a/src/core/snoreserver.h b/src/core/snoreserver.h index d18781a..431e9dc 100644 --- a/src/core/snoreserver.h +++ b/src/core/snoreserver.h @@ -29,8 +29,6 @@ class SNORE_EXPORT SnoreServer:public QObject public: static const QString version(); static const QString snoreTMP(); - static void initTMP(); - public: SnoreServer ( class QSystemTrayIcon *trayIcon=0 ); diff --git a/src/plugins/snarl/snarl_backend.cpp b/src/plugins/snarl/snarl_backend.cpp index a48b2d4..6260c55 100644 --- a/src/plugins/snarl/snarl_backend.cpp +++ b/src/plugins/snarl/snarl_backend.cpp @@ -35,7 +35,7 @@ using namespace Snarl::V42; Q_EXPORT_PLUGIN2(snarl_backend,Snarl_Backend); Snarl_Backend::Snarl_Backend(SnoreServer *snore): -Notification_Backend("SnarlBackend",snore) +Notification_Backend("Snarl",snore) { winIDWidget = new SnarlWidget(this); SnarlInterface *snarlInterface = new SnarlInterface(); diff --git a/src/snorenotify.cpp b/src/snorenotify.cpp index 47e5c7b..df50cff 100644 --- a/src/snorenotify.cpp +++ b/src/snorenotify.cpp @@ -24,26 +24,17 @@ #include #include #include -#include -#include -#include +#include #include -#ifdef Q_WS_WIN -#define PROFILEPATH qgetenv("APPDATA") + "\\snorenotify\\" -#elif defined(Q_OS_LINUX) -#define PROFILEPATH qgetenv("HOME") + "/.snorenotify/" -#endif - - -SnoreNotify::SnoreNotify() +SnoreNotify::SnoreNotify(): + _settings("TheOneRing","SnoreNotify") { _trayIcon = new TrayIcon(); _snore = new SnoreServer(_trayIcon->trayIcon()); - _snore->initTMP(); QDir pluginsDir ( qApp->applicationDirPath() +"/snoreplugins" ); foreach ( QString fileName, pluginsDir.entryList ( QDir::Files ) ) @@ -65,50 +56,11 @@ SnoreNotify::~SnoreNotify(){ } void SnoreNotify::load(){ - QDomDocument doc( "Settings" ); - QFile file( PROFILEPATH + "settings.xml" ); - if(!file.open( QFile::ReadOnly )){ - std::cout<<"Failed openeing settings file: "<setPrimaryNotificationBackend(backend.text()); + _snore->setPrimaryNotificationBackend(_settings.value("notificationBackend").toString()); } void SnoreNotify::save(){ - QDomDocument doc("Settings"); - QDomElement root = doc.createElement( "SnoreNotifyProfile" ); - doc.appendChild(root); - QDomElement backend = doc.createElement( "notificationBackend"); - backend.appendChild(doc.createTextNode(_snore->primaryNotificationBackend())); - root.appendChild(backend); - - - QFile file( PROFILEPATH + "settings.xml" ); - if(!file.exists()){ - QDir(PROFILEPATH).mkpath(PROFILEPATH); - } - file.open(QFile::WriteOnly); - - QTextStream ts( &file ); - doc.save(ts,4); - file.close(); + _settings.setValue("notificationBackend",_snore->primaryNotificationBackend()); } void SnoreNotify::exit(){ diff --git a/src/snorenotify.h b/src/snorenotify.h index 8f15d64..88033d0 100644 --- a/src/snorenotify.h +++ b/src/snorenotify.h @@ -31,6 +31,7 @@ public: private: class TrayIcon *_trayIcon; class SnoreServer *_snore; + class QSettings _settings; private slots: void exit();