Subversion Repositories public iLand

Rev

Rev 1081 | Rev 1104 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1081 Rev 1087
Line 27... Line 27...
27
#include "model.h"
27
#include "model.h"
28
#include "modelcontroller.h"
28
#include "modelcontroller.h"
29
#include "../iland/version.h"
29
#include "../iland/version.h"
30
30
31
QTextStream *ConsoleShell::mLogStream = 0;
31
QTextStream *ConsoleShell::mLogStream = 0;
-
 
32
bool ConsoleShell::mFlushLog = false;
32
33
33
// a try to really get keyboard strokes in console mode...
34
// a try to really get keyboard strokes in console mode...
34
// did not work.
35
// did not work.
35
class KeyboardTaker : public QThread
36
class KeyboardTaker : public QThread
36
 {
37
 {
Line 168... Line 169...
168
    QMutexLocker m(&qdebug_mutex);
169
    QMutexLocker m(&qdebug_mutex);
169
170
170
    switch (type) {
171
    switch (type) {
171
     case QtDebugMsg:
172
     case QtDebugMsg:
172
        *ConsoleShell::logStream() << msg << endl;
173
        *ConsoleShell::logStream() << msg << endl;
-
 
174
        if (ConsoleShell::flush())
-
 
175
            ConsoleShell::logStream()->flush();;
173
         break;
176
         break;
174
     case QtWarningMsg:
177
     case QtWarningMsg:
175
        *ConsoleShell::logStream() << msg << endl;
178
        *ConsoleShell::logStream() << msg << endl;
-
 
179
        if (ConsoleShell::flush())
-
 
180
            ConsoleShell::logStream()->flush();;
176
        printf("Warning: %s\n", msg.toLocal8Bit().data());
181
        printf("Warning: %s\n", msg.toLocal8Bit().data());
177
182
178
         break;
183
         break;
179
     case QtCriticalMsg:
184
     case QtCriticalMsg:
180
        *ConsoleShell::logStream() << msg << endl;
185
        *ConsoleShell::logStream() << msg << endl;
-
 
186
        if (ConsoleShell::flush())
-
 
187
            ConsoleShell::logStream()->flush();;
181
        printf("Critical: %s\n", msg.toLocal8Bit().data());
188
        printf("Critical: %s\n", msg.toLocal8Bit().data());
182
         break;
189
         break;
183
     case QtFatalMsg:
190
     case QtFatalMsg:
184
        *ConsoleShell::logStream() << msg << endl;
191
        *ConsoleShell::logStream() << msg << endl;
-
 
192
        if (ConsoleShell::flush())
-
 
193
            ConsoleShell::logStream()->flush();;
185
        printf("Fatal: %s\n", msg.toLocal8Bit().data());
194
        printf("Fatal: %s\n", msg.toLocal8Bit().data());
186
     }
195
     }
187
 }
196
 }
188
197
189
198
Line 195... Line 204...
195
        delete mLogStream;
204
        delete mLogStream;
196
        mLogStream = NULL;
205
        mLogStream = NULL;
197
    }
206
    }
198
207
199
    QString fname = GlobalSettings::instance()->settings().value("system.logging.logFile", "logfile.txt");
208
    QString fname = GlobalSettings::instance()->settings().value("system.logging.logFile", "logfile.txt");
-
 
209
    mFlushLog = GlobalSettings::instance()->settings().valueBool("system.logging.flush");
200
    QString timestamp = QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss");
210
    QString timestamp = QDateTime::currentDateTime().toString("yyyyMMdd_hhmmss");
201
    fname.replace("$date$", timestamp);
211
    fname.replace("$date$", timestamp);
202
    fname = GlobalSettings::instance()->path(fname, "log");
212
    fname = GlobalSettings::instance()->path(fname, "log");
203
    QFile *file = new QFile(fname);
213
    QFile *file = new QFile(fname);
204
214