~brian-murray/lightdm/bug-967229

« back to all changes in this revision

Viewing changes to greeters/qt/main.cpp

  • Committer: Sebastien Bacher
  • Date: 2012-01-18 09:21:40 UTC
  • mfrom: (1007.1.355 lightdm)
  • mto: This revision was merged to the branch mainline in revision 1056.
  • Revision ID: seb128@ubuntu.com-20120118092140-fhyj1fmiouth227t
Tags: upstream-1.1.1
ImportĀ upstreamĀ versionĀ 1.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2010-2011 David Edmundson.
3
 
 * Author: David Edmundson <kde@davidedmundson.co.uk>
4
 
 * 
5
 
 * This program is free software: you can redistribute it and/or modify it under
6
 
 * the terms of the GNU General Public License as published by the Free Software
7
 
 * Foundation, either version 3 of the License, or (at your option) any later
8
 
 * version. See http://www.gnu.org/copyleft/gpl.html the full text of the
9
 
 * license.
10
 
 */
11
 
 
12
 
#include <QtGui/QApplication>
13
 
 
14
 
#include <QDebug>
15
 
#include <QFile>
16
 
 
17
 
#include "greeter.h"
18
 
 
19
 
//temp code to redirect qDebug to a file which can be handy for real debugging.
20
 
void messageHandler(QtMsgType type, const char *msg)
21
 
{
22
 
    QString txt;
23
 
    switch (type) {
24
 
    case QtDebugMsg:
25
 
        txt = QString("Debug: %1").arg(msg);
26
 
        break;
27
 
    case QtWarningMsg:
28
 
        txt = QString("Warning: %1").arg(msg);
29
 
        break;
30
 
    case QtCriticalMsg:
31
 
        txt = QString("Critical: %1").arg(msg);
32
 
        break;
33
 
    case QtFatalMsg:
34
 
        txt = QString("Fatal: %1").arg(msg);
35
 
        abort();
36
 
    }
37
 
 
38
 
    QFile outFile("/home/david/temp/log");
39
 
    outFile.open(QIODevice::WriteOnly | QIODevice::Append);
40
 
    QTextStream ts(&outFile);
41
 
    ts << txt << endl;
42
 
}
43
 
 
44
 
int main(int argc, char *argv[])
45
 
{
46
 
    QApplication app(argc, argv);
47
 
   // qInstallMsgHandler(messageHandler);
48
 
 
49
 
    Greeter mainUi;
50
 
    mainUi.show();
51
 
 
52
 
    return app.exec();
53
 
}