~jconti/lightdm/signals

« back to all changes in this revision

Viewing changes to greeters/qt/main.cpp

  • Committer: David Edmundson
  • Date: 2011-05-21 00:55:32 UTC
  • mfrom: (455.1.2 dave_fixes)
  • Revision ID: david@davidedmundson.co.uk-20110521005532-9jcr42kttjem8kcc
merge branch replace demo greeter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QtGui/QApplication>
 
2
 
 
3
#include <QDebug>
 
4
#include <QFile>
 
5
 
 
6
#include "greeter.h"
 
7
 
 
8
//temp code to redirect qDebug to a file which can be handy for real debugging.
 
9
void messageHandler(QtMsgType type, const char *msg)
 
10
{
 
11
    QString txt;
 
12
    switch (type) {
 
13
    case QtDebugMsg:
 
14
        txt = QString("Debug: %1").arg(msg);
 
15
        break;
 
16
    case QtWarningMsg:
 
17
        txt = QString("Warning: %1").arg(msg);
 
18
        break;
 
19
    case QtCriticalMsg:
 
20
        txt = QString("Critical: %1").arg(msg);
 
21
        break;
 
22
    case QtFatalMsg:
 
23
        txt = QString("Fatal: %1").arg(msg);
 
24
        abort();
 
25
    }
 
26
 
 
27
    QFile outFile("/home/david/temp/log");
 
28
    outFile.open(QIODevice::WriteOnly | QIODevice::Append);
 
29
    QTextStream ts(&outFile);
 
30
    ts << txt << endl;
 
31
}
 
32
 
 
33
int main(int argc, char *argv[])
 
34
{
 
35
    QApplication app(argc, argv);
 
36
   // qInstallMsgHandler(messageHandler);
 
37
 
 
38
    Greeter mainUi;
 
39
    mainUi.show();
 
40
 
 
41
    return app.exec();
 
42
}