Index: trunk/BNC/src/bncapp.cpp
===================================================================
--- trunk/BNC/src/bncapp.cpp	(revision 4904)
+++ trunk/BNC/src/bncapp.cpp	(revision 5066)
@@ -27,5 +27,5 @@
  * -------------------------------------------------------------------------
  *
- * Class:      bncApp
+ * Class:      t_pgmCore
  *
  * Purpose:    This class implements the main application
@@ -58,7 +58,5 @@
 // Constructor
 ////////////////////////////////////////////////////////////////////////////
-bncApp::bncApp(int& argc, char* argv[], bool GUIenabled) : 
-  QApplication(argc, argv, GUIenabled) {
-
+t_pgmCore::t_pgmCore(int& argc, char* argv[], bool GUIenabled) {
   _GUIenabled  = GUIenabled;
   _logFileFlag = 0;
@@ -127,5 +125,5 @@
 // Destructor
 ////////////////////////////////////////////////////////////////////////////
-bncApp::~bncApp() {
+t_pgmCore::~t_pgmCore() {
   delete _logStream;
   delete _logFile;
@@ -163,5 +161,5 @@
 // Write a Program Message
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotMessage(QByteArray msg, bool showOnScreen) {
+void t_pgmCore::slotMessage(QByteArray msg, bool showOnScreen) {
 
   QMutexLocker locker(&_mutexMessage);
@@ -173,5 +171,5 @@
 // Write a Program Message (private, no lock)
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::messagePrivate(const QByteArray& msg) {
+void t_pgmCore::messagePrivate(const QByteArray& msg) {
 
   // First time resolve the log file name
@@ -215,5 +213,5 @@
 // New GPS Ephemeris 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGPSEph(gpsephemeris* gpseph) {
+void t_pgmCore::slotNewGPSEph(gpsephemeris* gpseph) {
 
   QMutexLocker locker(&_mutex);
@@ -246,5 +244,5 @@
 // New Glonass Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGlonassEph(glonassephemeris* glonasseph) {
+void t_pgmCore::slotNewGlonassEph(glonassephemeris* glonasseph) {
 
   QMutexLocker locker(&_mutex);
@@ -292,5 +290,5 @@
 // New Galileo Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewGalileoEph(galileoephemeris* galileoeph) {
+void t_pgmCore::slotNewGalileoEph(galileoephemeris* galileoeph) {
 
   QMutexLocker locker(&_mutex);
@@ -327,5 +325,5 @@
 // Print Header of the output File(s)
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::printEphHeader() {
+void t_pgmCore::printEphHeader() {
 
   bncSettings settings;
@@ -499,5 +497,5 @@
 // Print One GPS Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::printGPSEph(gpsephemeris* ep, bool printFile) {
+void t_pgmCore::printGPSEph(gpsephemeris* ep, bool printFile) {
 
   t_ephGPS eph;
@@ -512,5 +510,5 @@
 // Print One Glonass Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::printGlonassEph(glonassephemeris* ep, bool printFile) {
+void t_pgmCore::printGlonassEph(glonassephemeris* ep, bool printFile) {
 
   t_ephGlo eph;
@@ -526,5 +524,5 @@
 // Print One Galileo Ephemeris
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::printGalileoEph(galileoephemeris* ep, bool printFile) {
+void t_pgmCore::printGalileoEph(galileoephemeris* ep, bool printFile) {
 
   t_ephGal eph;
@@ -539,5 +537,5 @@
 // Output
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::printOutput(bool printFile, QTextStream* stream,
+void t_pgmCore::printOutput(bool printFile, QTextStream* stream,
                          const QString& strV2, const QString& strV3) {
 
@@ -576,5 +574,5 @@
 // Set Port Number
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::setPort(int port) {
+void t_pgmCore::setPort(int port) {
   _port = port;
   if (_port != 0) {
@@ -582,5 +580,5 @@
     _server = new QTcpServer;
     if ( !_server->listen(QHostAddress::Any, _port) ) {
-      slotMessage("bncApp: Cannot listen on ephemeris port", true);
+      slotMessage("t_pgmCore: Cannot listen on ephemeris port", true);
     }
     connect(_server, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
@@ -592,5 +590,5 @@
 // Set Port Number
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::setPortCorr(int port) {
+void t_pgmCore::setPortCorr(int port) {
   _portCorr = port;
   if (_portCorr != 0) {
@@ -598,5 +596,5 @@
     _serverCorr = new QTcpServer;
     if ( !_serverCorr->listen(QHostAddress::Any, _portCorr) ) {
-      slotMessage("bncApp: Cannot listen on correction port", true);
+      slotMessage("t_pgmCore: Cannot listen on correction port", true);
     }
     connect(_serverCorr, SIGNAL(newConnection()), this, SLOT(slotNewConnectionCorr()));
@@ -608,5 +606,5 @@
 // New Connection
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewConnection() {
+void t_pgmCore::slotNewConnection() {
   _sockets->push_back( _server->nextPendingConnection() );
 }
@@ -614,5 +612,5 @@
 // New Connection
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewConnectionCorr() {
+void t_pgmCore::slotNewConnectionCorr() {
   _socketsCorr->push_back( _serverCorr->nextPendingConnection() );
 }
@@ -620,13 +618,13 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotQuit() {
-  cout << "bncApp::slotQuit" << endl;
+void t_pgmCore::slotQuit() {
+  cout << "t_pgmCore::slotQuit" << endl;
   delete _caster;
-  quit();
+  qApp->quit();
 }
 
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::slotNewCorrLine(QString line, QString staID, long coTime) {
+void t_pgmCore::slotNewCorrLine(QString line, QString staID, long coTime) {
 
   QMutexLocker locker(&_mutex);
@@ -680,5 +678,5 @@
 // Dump Complete Correction Epochs
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs(long minTime, long maxTime) {
+void t_pgmCore::dumpCorrs(long minTime, long maxTime) {
   for (long sec = minTime; sec <= maxTime; sec++) {
     QList<QString> allCorrs = _corrs->values(sec);
@@ -690,5 +688,5 @@
 // Dump all corrections
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs() {
+void t_pgmCore::dumpCorrs() {
   QList<QString> allCorrs;
   QMutableMapIterator<long, QString> it(*_corrs);
@@ -702,5 +700,5 @@
 // Dump List of Corrections 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::dumpCorrs(const QList<QString>& allCorrs) {
+void t_pgmCore::dumpCorrs(const QList<QString>& allCorrs) {
   emit newCorrections(allCorrs);
   if (_socketsCorr) {
@@ -729,10 +727,10 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::setConfFileName(const QString& confFileName) {
+void t_pgmCore::setConfFileName(const QString& confFileName) {
   if (confFileName.isEmpty()) {
     _confFileName = QDir::homePath() + QDir::separator() 
                   + ".config" + QDir::separator()
-                  + organizationName() + QDir::separator()
-                  + applicationName() + ".bnc";
+                  + qApp->organizationName() + QDir::separator()
+                  + qApp->applicationName() + ".bnc";
   }
   else {
@@ -743,5 +741,5 @@
 // Raw Output
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::writeRawData(const QByteArray& data, const QByteArray& staID,
+void t_pgmCore::writeRawData(const QByteArray& data, const QByteArray& staID,
                           const QByteArray& format) {
 
@@ -763,5 +761,5 @@
 // Get Glonass Slot Numbers from Global Array
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::getGlonassSlotNums(int GLOFreq[]) {
+void t_pgmCore::getGlonassSlotNums(int GLOFreq[]) {
 
   QMutexLocker locker(&_mutex);
@@ -776,5 +774,5 @@
 // Store Glonass Slot Numbers to Global Array
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::storeGlonassSlotNums(const int GLOFreq[]) {
+void t_pgmCore::storeGlonassSlotNums(const int GLOFreq[]) {
 
   QMutexLocker locker(&_mutex);
@@ -789,5 +787,5 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::initCombination() {
+void t_pgmCore::initCombination() {
 #ifdef USE_COMBINATION
   _bncComb = new bncComb();
@@ -801,5 +799,5 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::stopCombination() {
+void t_pgmCore::stopCombination() {
 #ifdef USE_COMBINATION
   delete _bncComb;
@@ -808,20 +806,7 @@
 }
 
-// Handling Events (virtual)
-////////////////////////////////////////////////////////////////////////////
-bool bncApp::event(QEvent* ev) {
-
-  if (ev->type() == QEvent::FileOpen) {  // currently happens on Mac only
-    QString fileName = static_cast<QFileOpenEvent*>(ev)->file();
-    setConfFileName(fileName);
-    return true;
-  }
-    
-  return QApplication::event(ev);
-}
-
 // Check Ephemeris Consistency
 ////////////////////////////////////////////////////////////////////////////
-void bncApp::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
+void t_pgmCore::checkEphemeris(gpsephemeris* oldEph, gpsephemeris* newEph) {
   if (oldEph->clock_bias      != newEph->clock_bias      ||
       oldEph->clock_drift     != newEph->clock_drift     ||
