source: ntrip/trunk/BNC/bncapp.cpp@ 203

Last change on this file since 203 was 199, checked in by weber, 18 years ago

* empty log message *

File size: 1.7 KB
RevLine 
[82]1
2/* -------------------------------------------------------------------------
[93]3 * BKG NTRIP Client
[82]4 * -------------------------------------------------------------------------
5 *
6 * Class: bncApp
7 *
8 * Purpose: This class implements the main application
9 *
10 * Author: L. Mervart
11 *
12 * Created: 29-Aug-2006
13 *
14 * Changes:
15 *
16 * -----------------------------------------------------------------------*/
17
18#include <iostream>
[149]19#include <QSettings>
[150]20#include <QMessageBox>
[82]21
22#include "bncapp.h"
[151]23#include "bncutils.h"
[82]24
25using namespace std;
26
27// Constructor
28////////////////////////////////////////////////////////////////////////////
29bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
30 QApplication(argc, argv, GUIenabled) {
[109]31
[150]32 _logFileFlag = 0;
33 _logFile = 0;
34 _logStream = 0;
[152]35
36 _bncVersion = "BNC 1.0";
[82]37}
38
39// Destructor
40////////////////////////////////////////////////////////////////////////////
41bncApp::~bncApp() {
[109]42 delete _logStream;
43 delete _logFile;
[82]44}
45
46// Write a Program Message
47////////////////////////////////////////////////////////////////////////////
48void bncApp::slotMessage(const QByteArray msg) {
[150]49
50 // First time resolve the log file name
51 // ------------------------------------
52 if (_logFileFlag == 0) {
53 _logFileFlag = 1;
54 QSettings settings;
55 QString logFileName = settings.value("logFile").toString();
56 if ( !logFileName.isEmpty() ) {
[151]57 expandEnvVar(logFileName);
[150]58 _logFile = new QFile(logFileName);
59 _logFile->open(QIODevice::WriteOnly);
60 _logStream = new QTextStream();
61 _logStream->setDevice(_logFile);
62 }
63 }
64
[109]65 if (_logStream) {
[199]66 *_logStream << QTime::currentTime().toString("hh:mm:ss ").toAscii().data();
[109]67 *_logStream << msg.data() << endl;
68 _logStream->flush();
[82]69 }
70}
Note: See TracBrowser for help on using the repository browser.