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

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

* empty log message *

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