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

Last change on this file since 151 was 151, checked in by mervart, 18 years ago

* empty log message *

File size: 1.7 KB
Line 
1
2/* -------------------------------------------------------------------------
3 * BKG NTRIP Client
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>
19#include <QSettings>
20#include <QMessageBox>
21
22#include "bncapp.h"
23#include "bncutils.h"
24
25using namespace std;
26
27// Constructor
28////////////////////////////////////////////////////////////////////////////
29bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
30 QApplication(argc, argv, GUIenabled) {
31
32 _logFileFlag = 0;
33 _logFile = 0;
34 _logStream = 0;
35}
36
37// Destructor
38////////////////////////////////////////////////////////////////////////////
39bncApp::~bncApp() {
40 delete _logStream;
41 delete _logFile;
42}
43
44// Write a Program Message
45////////////////////////////////////////////////////////////////////////////
46void bncApp::slotMessage(const QByteArray msg) {
47
48 // First time resolve the log file name
49 // ------------------------------------
50 if (_logFileFlag == 0) {
51 _logFileFlag = 1;
52 QSettings settings;
53 QString logFileName = settings.value("logFile").toString();
54 if ( !logFileName.isEmpty() ) {
55 expandEnvVar(logFileName);
56 _logFile = new QFile(logFileName);
57 _logFile->open(QIODevice::WriteOnly);
58 _logStream = new QTextStream();
59 _logStream->setDevice(_logFile);
60 }
61 }
62
63 if (_logStream) {
64 *_logStream << msg.data() << endl;
65 _logStream->flush();
66 }
67 else {
68 cerr << msg.data() << endl;
69 }
70}
Note: See TracBrowser for help on using the repository browser.