main.cpp 2.6 KB
Newer Older
1 2 3
/*
 *  main.cpp
 *  Program:  kalarm
4
 *  Copyright © 2001-2017 by David Jarvie <djarvie@kde.org>
5 6 7 8 9
 *
 *  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.
David Jarvie's avatar
David Jarvie committed
10 11 12 13 14 15
 *
 *  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.
 *
David Jarvie's avatar
David Jarvie committed
16 17 18
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 20 21 22
 */

#include "kalarm.h"

23
#include "kalarmapp.h"
David Jarvie's avatar
David Jarvie committed
24
#include "kalarm_debug.h"
25

Laurent Montel's avatar
Laurent Montel committed
26
#include <kalarmcal/version.h>
David Jarvie's avatar
David Jarvie committed
27

David Jarvie's avatar
David Jarvie committed
28
#include <KAboutData>
Laurent Montel's avatar
Laurent Montel committed
29
#include <KLocalizedString>
David Jarvie's avatar
David Jarvie committed
30 31

#include <QDir>
Palo Kisa's avatar
Palo Kisa committed
32
#include <QScopedPointer>
33

34
#include <stdlib.h>
35

David Jarvie's avatar
David Jarvie committed
36
#define PROGRAM_NAME "kalarm"
37

David Jarvie's avatar
Tidy  
David Jarvie committed
38
int main(int argc, char* argv[])
39
{
Palo Kisa's avatar
Palo Kisa committed
40 41 42 43
    // Use QScopedPointer to ensure the QCoreApplication instance is deleted
    // before libraries unload, to avoid crashes during clean-up.
    QScopedPointer<KAlarmApp> app(KAlarmApp::create(argc, argv));

David Jarvie's avatar
David Jarvie committed
44 45
    QStringList args = app->arguments();
    app->setAttribute(Qt::AA_UseHighDpiPixmaps, true);
Laurent Montel's avatar
Laurent Montel committed
46
    app->setAttribute(Qt::AA_EnableHighDpiScaling);
David Jarvie's avatar
David Jarvie committed
47

Laurent Montel's avatar
Laurent Montel committed
48
    KLocalizedString::setApplicationDomain("kalarm");
David Jarvie's avatar
David Jarvie committed
49 50 51 52
    KAboutData aboutData(QStringLiteral(PROGRAM_NAME), i18n("KAlarm"),
                         QStringLiteral(KALARM_VERSION),
                         i18n("Personal alarm message, command and email scheduler for KDE"),
                         KAboutLicense::GPL,
53
                         ki18n("Copyright 2001-%1, David Jarvie").subs(2017).toString(), QString(),
David Jarvie's avatar
David Jarvie committed
54 55
                         QStringLiteral("http://www.astrojar.org.uk/kalarm"));
    aboutData.addAuthor(i18n("David Jarvie"), i18n("Author"), QStringLiteral("djarvie@kde.org"));
56
    aboutData.setOrganizationDomain("kde.org");
David Jarvie's avatar
David Jarvie committed
57
    KAboutData::setApplicationData(aboutData);
58

Laurent Montel's avatar
Laurent Montel committed
59
    qCDebug(KALARM_LOG) << "initialising";
David Jarvie's avatar
David Jarvie committed
60 61

    app->activate(args, QDir::currentPath());
62 63
    app->restoreSession();
    return app->exec();
64
}
65 66 67 68 69 70 71 72 73

namespace KAlarm
{

/******************************************************************************
* Return the current KAlarm version number.
*/
int Version()
{
74 75
    static int version = 0;
    if (!version)
Laurent Montel's avatar
Laurent Montel committed
76
        version = KAlarmCal::getVersionNumber(QStringLiteral(KALARM_VERSION));
77
    return version;
78 79 80
}

} // namespace KAlarm
81 82

// vim: et sw=4: