diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b2a4a3..e7989fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,46 +1,46 @@ cmake_minimum_required(VERSION 3.5) -project(kteatime) +project(kteatime VERSION 1.3.0) set(QT_MIN_VERSION "5.9.0") set(KF5_MIN_VERSION "5.46.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) include(ECMInstallIcons) # Search KDE installation find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets ) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED Config Crash DocTools I18n IconThemes NotifyConfig Notifications TextWidgets XmlGui ) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(FeatureSummary) if (${KF5Config_VERSION} STRGREATER "5.56.0") add_definitions(-DQT_NO_FOREACH) MESSAGE(STATUS "compile without foreach") endif() ADD_SUBDIRECTORY(doc) ADD_SUBDIRECTORY(data) ADD_SUBDIRECTORY(src) install(FILES org.kde.kteatime.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7519f87..fb08b3f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,22 +1,24 @@ add_definitions(-DTRANSLATION_DOMAIN=\"kteatime\") set(kteatime_SRCS settings.cpp timeedit.cpp toplevel.cpp tealistmodel.cpp tea.cpp main.cpp ) +set_property(SOURCE main.cpp APPEND PROPERTY COMPILE_DEFINITIONS "KTEATIME_VERSION=\"${kteatime_VERSION}\"") + ki18n_wrap_ui(kteatime_SRCS settings.ui timeedit.ui) add_executable(kteatime ${kteatime_SRCS}) target_link_libraries(kteatime KF5::ConfigCore KF5::ConfigGui KF5::Crash KF5::I18n KF5::IconThemes KF5::Notifications KF5::NotifyConfig KF5::TextWidgets KF5::XmlGui ) install( TARGETS kteatime ${INSTALL_TARGETS_DEFAULT_ARGS} ) install( PROGRAMS org.kde.kteatime.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) install( FILES kteatime.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} ) diff --git a/src/main.cpp b/src/main.cpp index 1d9676a..3e81443 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,109 +1,109 @@ /* * Copyright 1998-1999 by Matthias Hölzer-Klüpfel * Copyright 2002-2003 by Martin Willers * Copyright 2007-2009 by Stefan Böhmann * * 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 2 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 . */ #include "toplevel.h" #include #include #include #include #include int main (int argc, char *argv[]) { /** * Create application first */ QApplication app(argc, argv); /** * construct about data for KTeaTime */ - KAboutData aboutData( QStringLiteral("kteatime"), i18n("KTeaTime"), QStringLiteral("1.3.0"), + KAboutData aboutData( QStringLiteral("kteatime"), i18n("KTeaTime"), QStringLiteral(KTEATIME_VERSION), i18n( "KDE utility for making a fine cup of tea." ), KAboutLicense::GPL, i18n( "© 1998-1999, Matthias Hölzer-Klüpfel\n" "© 2002-2003, Martin Willers\n" "© 2007-2010, Stefan Böhmann" ) ); KCrash::initialize(); aboutData.addAuthor(i18n("Stefan Böhmann"), i18n("Current maintainer"), QStringLiteral("kde@hilefoks.org"), QStringLiteral("http://www.hilefoks.org"), QStringLiteral("hilefoks")); aboutData.addAuthor(i18n("Matthias Hölzer-Klüpfel"), QString(), QStringLiteral("matthias@hoelzer-kluepfel.de")); aboutData.addAuthor(i18n("Martin Willers"), QString(), QStringLiteral("willers@xm-arts.de")); aboutData.addCredit(i18n("Daniel Teske"), i18n("Many patches"), QStringLiteral("teske@bigfoot.com")); aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), i18nc("EMAIL OF TRANSLATORS", "Your emails")); /** * right dbus prefix == org.kde. */ aboutData.setOrganizationDomain("kde.org"); /** * register about data */ KAboutData::setApplicationData(aboutData); /** * take component name and org. name from KAboutData */ app.setApplicationName(aboutData.componentName()); app.setApplicationDisplayName(aboutData.displayName()); app.setOrganizationDomain(aboutData.organizationDomain()); app.setApplicationVersion(aboutData.version()); app.setQuitOnLastWindowClosed(false); /** * Create command line parser and feed it with known options */ QCommandLineParser parser; aboutData.setupCommandLine(&parser); parser.setApplicationDescription(aboutData.shortDescription()); QCommandLineOption timeOption(QStringList() << QStringLiteral("t") << QStringLiteral("time"), i18n("Start a new tea with this time."), i18n("seconds")); parser.addOption(timeOption); QCommandLineOption nameOption(QStringList() << QStringLiteral("n") << QStringLiteral("name"), i18n("Use this name for the tea started with --time."), i18n("name")); parser.addOption(nameOption); parser.process(app); aboutData.processCommandLine(&parser); TopLevel *toplevel=new TopLevel( &aboutData ); const int time=parser.value(timeOption).toInt(); if( time > 0 ) { const QString name = parser.value(nameOption); const Tea tea( name.isEmpty() ? i18n( "Anonymous Tea" ) : name, time ); toplevel->runTea( tea ); } int ret = app.exec(); delete toplevel; return ret; } // kate: word-wrap off; encoding utf-8; indent-width 4; tab-width 4; line-numbers on; mixed-indent off; remove-trailing-space-save on; replace-tabs-save on; replace-tabs on; space-indent on; // vim:set spell et sw=4 ts=4 nowrap cino=l1,cs,U1: