use KUniqueApplication if build with kde, so that there is always only one instance and we dont get problems with the dbus backend

This commit is contained in:
Patrick von Reth 2013-07-07 01:52:28 +02:00
parent b477323a33
commit adb81b0fe9
6 changed files with 36 additions and 17 deletions

View File

@ -11,7 +11,9 @@ option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend" OFF)
option(WITH_GROWL_BACKEND "Build the Growl backend" ON)
#######################################################################
set(SNORE_VERSION_MAJOR 0)
set(SNORE_VERSION_MINOR 4)
set(SNORE_VERSION_SUFFIX pre)

View File

@ -4,16 +4,14 @@ add_subdirectory(core)
QT4_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS})
set(SNORENOTIFY_DEPS ${SNORENOTIFY_DEPS} ${SNORENOTIFY_RCS})
if(WIN32)
set(WIN32_SPECIFIC WIN32)
else(WIN32)
set(WIN32_SPECIFIC)
endif(WIN32)
add_executable( snorenotify ${WIN32_SPECIFIC} main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS})
add_executable( snorenotify WIN32 main.cpp snorenotify.cpp trayicon.cpp ${SNORENOTIFY_DEPS})
target_link_libraries( snorenotify snorecore ${QT_QTGUI_LIBRARY} )
if(KDE4_FOUND)
target_link_libraries( snorenotify ${KDE4_KDEUI_LIBS} )
endif(KDE4_FOUND)
if(MSVC)
set_target_properties(snorenotify PROPERTIES LINK_FLAGS "/ENTRY:\"mainCRTStartup\"")
endif(MSVC)

View File

@ -3,9 +3,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include(GetGitRevisionDescription)
set(SNORE_VERSION_MAJOR 0)
set(SNORE_VERSION_MINOR 4)
set(SNORE_VERSION_SUFFIX pre)
get_git_head_revision(GIT_REFSPEC SNORE_REVISION)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cpp" @ONLY)

View File

@ -6,6 +6,11 @@
namespace Snore{
const QString Version::version()
{
return QString("%1.%2%3").arg(major(),minor(),suffix());
}
const QString Version::major(){
return QString(SNORE_VERSION_MAJOR);
}
@ -21,4 +26,4 @@ const QString Version::revision(){
return QString(SNORE_REVISION);
}
}
}

View File

@ -11,6 +11,8 @@ namespace Snore{
class SNORE_EXPORT Version{
public:
static const QString version();
static const QString major();
static const QString minor();
@ -22,4 +24,4 @@ static const QString revision();
};
}
#endif
#endif

View File

@ -3,11 +3,26 @@
#include <QtGui/QApplication>
#if HAVE_KDE
#include "core/version.h"
#include <KAboutData>
#include <KCmdLineArgs>
#include <KUniqueApplication>
#endif
int main ( int argc, char *argv[] )
{
QApplication a ( argc, argv );
SnoreNotify *sn = new SnoreNotify();
return a.exec();
delete sn;
#if HAVE_KDE
KAboutData about("SnoreNotify",0,ki18n("SnoreNotify"),Snore::Version::version().toLatin1(),
ki18n("A notification deamon."),KAboutData::License_GPL_V2, ki18n("Copyright (c) 2010-2013 Patrick von Reth <vonreth@kde.org>"));
KCmdLineArgs::init(argc, argv, &about);
KUniqueApplication app;
#else
QApplication app ( argc, argv );
#endif
SnoreNotify sn;
return app.exec();
}