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

Last change on this file since 172 was 172, 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 _bncVersion = "BNC 1.0";
37}
38
39// Destructor
40////////////////////////////////////////////////////////////////////////////
41bncApp::~bncApp() {
42 delete _logStream;
43 delete _logFile;
44}
45
46// Write a Program Message
47////////////////////////////////////////////////////////////////////////////
48void bncApp::slotMessage(const QByteArray msg) {
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() ) {
57 expandEnvVar(logFileName);
58 _logFile = new QFile(logFileName);
59 _logFile->open(QIODevice::WriteOnly);
60 _logStream = new QTextStream();
61 _logStream->setDevice(_logFile);
62 }
63 }
64
65 if (_logStream) {
66 *_logStream << msg.data() << endl;
67 _logStream->flush();
68 }
69}
Note: See TracBrowser for help on using the repository browser.