<commit_before>/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at <EMAIL>.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#include <QProcess>
#include <QStringList>

#include <DuiApplication>
#include <DuiApplicationService>
#include <DuiApplicationIfAdaptor>
#include <DuiApplicationWindow>
#include <DuiApplicationPage>
#include <DuiAction>
#include <DuiLocale>
#include <signal.h>

#include "mainpage.h"
#include "lifecycleapplication.h"

void emitMemorySignal(int sig);

DuiApplication *App;
int requestCounter = 0;

class MyApplicationService: public DuiApplicationService
{
public:
    MyApplicationService(QObject *parent = 0) :
        DuiApplicationService("com.nokia.lifecycle", parent)
    {}

    void handleServiceRegistrationFailure() {
        qDebug() << "MyApplicationService::handleServiceRegistrationFailure()";

        incrementAndRegister();
    }
};


int main(int argc, char **argv)
{
    LifeCycleApplication app(argc, argv, "lifecycle", new MyApplicationService());
    LifeCycleApplication::setPrestartMode(Dui::LazyShutdown);

    DuiApplicationWindow window;
    window.show();

    MainPage mainPage;
    mainPage.appearNow();

    (void) signal(SIGINT, emitMemorySignal);
    App = &app;

    // Run activateWidgets() here to setup things if app is NOT prestarted, otherwise
    // connect it to prestartReleased() -signal from DuiApplication so that it's run
    // at the time when the window is really being shown to the user.

    if (!app.isPrestarted()) {
        mainPage.activateWidgets();
    } else {
        app.connect(&app, SIGNAL(prestartReleased()), &mainPage, SLOT(activateWidgets()));
        app.connect(&app, SIGNAL(prestartRestored()), &mainPage, SLOT(deactivateWidgets()));
    }

    return app.exec();
}<commit_msg>Changes: Fixed the lifecycle example to compile.<commit_after>/***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at <EMAIL>.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/

#include <QProcess>
#include <QStringList>

#include <DuiApplication>
#include <DuiApplicationService>
#include <DuiApplicationIfAdaptor>
#include <DuiApplicationWindow>
#include <DuiApplicationPage>
#include <DuiAction>
#include <DuiLocale>
#include <signal.h>

#include "mainpage.h"
#include "lifecycleapplication.h"

void emitMemorySignal(int sig);

DuiApplication *App;
int requestCounter = 0;

class MyApplicationService: public DuiApplicationService
{
public:
    MyApplicationService(QObject *parent = 0) :
        DuiApplicationService("com.nokia.lifecycle", parent)
    {}

    void handleServiceRegistrationFailure() {
        qDebug() << "MyApplicationService::handleServiceRegistrationFailure()";

        incrementAndRegister();
    }
};


int main(int argc, char **argv)
{
    LifeCycleApplication app(argc, argv, "lifecycle", new MyApplicationService());
    LifeCycleApplication::setPrestartMode(Dui::LazyShutdown);

    DuiApplicationWindow window;
    window.show();

    MainPage mainPage;
    mainPage.appear();

    (void) signal(SIGINT, emitMemorySignal);
    App = &app;

    // Run activateWidgets() here to setup things if app is NOT prestarted, otherwise
    // connect it to prestartReleased() -signal from DuiApplication so that it's run
    // at the time when the window is really being shown to the user.

    if (!app.isPrestarted()) {
        mainPage.activateWidgets();
    } else {
        app.connect(&app, SIGNAL(prestartReleased()), &mainPage, SLOT(activateWidgets()));
        app.connect(&app, SIGNAL(prestartRestored()), &mainPage, SLOT(deactivateWidgets()));
    }

    return app.exec();
}
{'fraction_non_alphanumeric': 0.1692501047339757, 'fraction_numerical': 0.0033514872224549644, 'mean_word_length': 4.794902912621359, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6510288', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1282, 'n_words': 408}