add seperate patchlevel variable

This commit is contained in:
Patrick von Reth 2014-07-18 11:42:45 +02:00
parent ea02af4ca8
commit 2552cbf899
6 changed files with 32 additions and 5 deletions

View File

@ -22,7 +22,8 @@ cmake_dependent_option(WITH_FREEDESKTOP_FRONTEND "Build the freedesktop frontend
set(SNORE_VERSION_MAJOR 0)
set(SNORE_VERSION_MINOR 5)
set(SNORE_VERSION_SUFFIX "0.beta2")
set(SNORE_VERSION_PATCH 0)
set(SNORE_VERSION_SUFFIX "beta3")
if(WITH_KDE)
find_package(KDE4)

View File

@ -2,9 +2,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC SNORE_REVISION)
if(NOT SNORE_REVISION)
set(SNORE_REVISION "")
endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/version.cpp")
QT4_ADD_RESOURCES(SNORENOTIFY_RCS ${SNORE_RCS})

View File

@ -25,6 +25,7 @@
#include "plugins/snorefrontend.h"
#include "plugins/plugincontainer.h"
#include "notification/notification_p.h"
#include "version.h"
#include <QApplication>
@ -34,6 +35,11 @@ SnoreCorePrivate::SnoreCorePrivate(QSystemTrayIcon *trayIcon):
m_trayIcon(trayIcon),
m_defaultApp("SnoreNotify",Icon(":/root/snore.png"))
{
snoreDebug( SNORE_INFO ) << "Version:" << Version::version();
if( !Version::revision().isEmpty() )
{
snoreDebug( SNORE_INFO ) << "Revision:" << Version::revision();
}
m_defaultApp.addAlert(Alert("Default",Icon(":/root/snore.png")));
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(slotAboutToQuit()));
}

View File

@ -4,7 +4,7 @@ namespace Snore{
const QString Version::version()
{
return QLatin1String("${SNORE_VERSION_MAJOR}.${SNORE_VERSION_MINOR}${SNORE_VERSION_SUFFIX}");
return QLatin1String("${SNORE_VERSION_MAJOR}.${SNORE_VERSION_MINOR}.${SNORE_VERSION_PATCH}${SNORE_VERSION_SUFFIX}");
}
const QString Version::major(){
@ -14,12 +14,18 @@ const QString Version::major(){
const QString Version::minor(){
return QLatin1String("${SNORE_VERSION_MINOR}");
}
const QString Version::patch(){
return QLatin1String("${SNORE_VERSION_PATCH}");
}
const QString Version::suffix(){
return QLatin1String("${SNORE_VERSION_SUFFIX}");
}
const QString Version::revision(){
return QLatin1String("${SNORE_VERSION_MAJOR}.${SNORE_VERSION_MINOR}${SNORE_VERSION_SUFFIX}-${SNORE_REVISION}");
return QLatin1String("${SNORE_REVISION}");
}
const QString Version::buildTime(){

View File

@ -34,6 +34,12 @@ public:
*/
static const QString minor();
/**
*
* @return the patch version
*/
static const QString patch();
/**
*
* @return the suffix ("pre", "alpha", "beta", "")

View File

@ -43,7 +43,12 @@ void TrayIcon::initConextMenu(SnoreCore *snore)
m_trayIcon->setVisible(true);
m_trayMenu = new QMenu("SnoreNotify");
m_trayMenu->addAction(QString("SnoreNotify ").append(Version::version()));
QString version = QString("SnoreNotify %1").arg(Version::version());
if(Version::revision() != "")
{
version += QString("-%1").arg(Version::revision());
}
m_trayMenu->addAction(version);
m_trayMenu->addSeparator();
m_trayMenu->addAction("Test Notification", this, SLOT(slotTestNotification()));
m_trayMenu->addSeparator();