Changeset 8897 in ntrip


Ignore:
Timestamp:
Mar 13, 2020, 9:52:09 AM (6 months ago)
Author:
stuerze
Message:

adaptation to qt5

Location:
trunk/BNC/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/app.cpp

    r8252 r8897  
    1111 * Created:    05-Jan-2013
    1212 *
    13  * Changes:   
     13 * Changes:
    1414 *
    1515 * -----------------------------------------------------------------------*/
    1616
    17 #include <QFileOpenEvent>
    18 
    19 #include "app.h"
     17#include "app.h"
    2018#include "bnccore.h"
    2119
    2220using namespace std;
    2321
     22QCoreApplication* createApplication(int& argc, char* argv[], bool GUIenabled) {
     23
     24  if (GUIenabled) {
     25    return new t_app(argc, argv);
     26  }
     27
     28  qDebug() << "bin hier";
     29  return new QCoreApplication(argc, argv);
     30}
     31
     32
    2433// Constructor
    2534////////////////////////////////////////////////////////////////////////////
    26 t_app::t_app(int& argc, char* argv[], bool GUIenabled) : QApplication(argc, argv, GUIenabled) {
     35t_app::t_app(int& argc, char* argv[]) : QApplication(argc, argv) {
     36  setWindowIcon(QPixmap(":ntrip-logo.png"));
    2737}
    2838
     
    4151    return true;
    4252  }
    43    
     53
    4454  return QApplication::event(ev);
    4555}
    4656
     57
  • trunk/BNC/src/app.h

    r8252 r8897  
    33
    44#include <QApplication>
    5 #include <QEvent>
     5#include <QFileOpenEvent>
     6#include <QtGui>
     7
     8
     9QCoreApplication* createApplication(int& argc, char* argv[], bool GUIenabled);
    610
    711class t_app : public QApplication {
    812 Q_OBJECT
    913 public:
    10   t_app(int& argc, char* argv[], bool GUIenabled);
     14  t_app(int& argc, char* argv[]);
    1115  virtual ~t_app();
    1216 protected:
     
    1519};
    1620
     21
    1722#endif
    18 
  • trunk/BNC/src/bncmain.cpp

    r8896 r8897  
    367367
    368368  bool GUIenabled = interactive || displaySet;
    369   t_app app(argc, argv, GUIenabled);
    370 
    371   app.setApplicationName("BNC");
    372   app.setOrganizationName("BKG");
    373   app.setOrganizationDomain("www.bkg.bund.de");
    374 
    375   BNC_CORE->setGUIenabled(GUIenabled);
     369  QScopedPointer<QCoreApplication> app(createApplication(argc, argv, GUIenabled));
     370
     371  if (qobject_cast<QApplication *>(app.data())) { // start GUI version
     372    app->setApplicationName("BNC");
     373    app->setOrganizationName("BKG");
     374    app->setOrganizationDomain("www.bkg.bund.de");
     375
     376    BNC_CORE->setGUIenabled(GUIenabled);
     377  }
     378  else { // start non-gui Version
     379
     380  }
     381
    376382  BNC_CORE->setConfFileName( confFileName );
    377383
     
    418424    }
    419425
    420     app.setWindowIcon(QPixmap(":ntrip-logo.png"));
    421 
    422426    bncWin = new bncWindow();
    423427    BNC_CORE->setMainWindow(bncWin);
     
    475479    BNC_CORE->initCombination();
    476480
    477     BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), &app, SLOT(quit()));
    478 
     481    //BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), &app, SLOT(quit()));
     482    BNC_CORE->connect(caster, SIGNAL(getThreadsFinished()), app->instance(), SLOT(quit()));
    479483    BNC_CORE->slotMessage("========== Start BNC v" BNCVERSION " (" BNC_OS ") ==========", true);
    480484
     
    506510  // Start the application
    507511  // ---------------------
    508   app.exec();
     512  app->exec();
    509513  if (interactive) {
    510514    delete bncWin;
     
    523527    delete rawFile;
    524528  }
     529
    525530  return 0;
    526531}
Note: See TracChangeset for help on using the changeset viewer.