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

Last change on this file since 389 was 389, checked in by weber, 17 years ago

* empty log message *

File size: 3.0 KB
Line 
1// Part of BNC, a utility for retrieving decoding and
2// converting GNSS data streams from NTRIP broadcasters,
3// written by Leos Mervart.
4//
5// Copyright (C) 2006
6// German Federal Agency for Cartography and Geodesy (BKG)
7// http://www.bkg.bund.de
8// Czech Technical University Prague, Department of Advanced Geodesy
9// http://www.fsv.cvut.cz
10//
11// Email: euref-ip@bkg.bund.de
12//
13// This program is free software; you can redistribute it and/or
14// modify it under the terms of the GNU General Public License
15// as published by the Free Software Foundation, version 2.
16//
17// This program is distributed in the hope that it will be useful,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20// GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program; if not, write to the Free Software
24// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26/* -------------------------------------------------------------------------
27 * BKG NTRIP Client
28 * -------------------------------------------------------------------------
29 *
30 * Class: bncApp
31 *
32 * Purpose: This class implements the main application
33 *
34 * Author: L. Mervart
35 *
36 * Created: 29-Aug-2006
37 *
38 * Changes:
39 *
40 * -----------------------------------------------------------------------*/
41
42#include <iostream>
43#include <QSettings>
44#include <QMessageBox>
45
46#include "bncapp.h"
47#include "bncutils.h"
48
49using namespace std;
50
51// Constructor
52////////////////////////////////////////////////////////////////////////////
53bncApp::bncApp(int argc, char* argv[], bool GUIenabled) :
54 QApplication(argc, argv, GUIenabled) {
55
56 _logFileFlag = 0;
57 _logFile = 0;
58 _logStream = 0;
59
60 _bncVersion = "BNC 1.2b";
61}
62
63// Destructor
64////////////////////////////////////////////////////////////////////////////
65bncApp::~bncApp() {
66 delete _logStream;
67 delete _logFile;
68}
69
70// Write a Program Message
71////////////////////////////////////////////////////////////////////////////
72void bncApp::slotMessage(const QByteArray msg) {
73
74 QMutexLocker locker(&_mutex);
75
76 // First time resolve the log file name
77 // ------------------------------------
78 if (_logFileFlag == 0) {
79 _logFileFlag = 1;
80 QSettings settings;
81 QString logFileName = settings.value("logFile").toString();
82 if ( !logFileName.isEmpty() ) {
83 expandEnvVar(logFileName);
84 _logFile = new QFile(logFileName);
85 if ( Qt::CheckState(settings.value("rnxAppend").toInt()) == Qt::Checked) {
86 _logFile->open(QIODevice::WriteOnly | QIODevice::Append);
87 }
88 else {
89 _logFile->open(QIODevice::WriteOnly);
90 }
91 _logStream = new QTextStream();
92 _logStream->setDevice(_logFile);
93 }
94 }
95
96 if (_logStream) {
97 *_logStream << QDate::currentDate().toString("yy-MM-dd ").toAscii().data();
98 *_logStream << QTime::currentTime().toString("hh:mm:ss ").toAscii().data();
99 *_logStream << msg.data() << endl;
100 _logStream->flush();
101 }
102}
Note: See TracBrowser for help on using the repository browser.