Skip to content
Snippets Groups Projects
main.cpp 2.09 KiB
Newer Older
  • Learn to ignore specific revisions
  • Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    // ************************************************************************** //
    //
    //  BornAgain: simulate and fit scattering at grazing incidence
    //
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //! @brief     Main function of the whole GUI
    //!
    
    //! @homepage  http://www.bornagainproject.org
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //! @license   GNU General Public License v3 or higher (see COPYING)
    
    //! @copyright Forschungszentrum Jülich GmbH 2016
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //! @authors   Scientific Computing Group at MLZ Garching
    
    //! @authors   Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
    //! @authors   Walter Van Herck, Joachim Wuttke
    
    Pospelov, Gennady's avatar
    Pospelov, Gennady committed
    //
    // ************************************************************************** //
    
    
    #include "FitProgressInfo.h"
    #include "SplashScreen.h"
    
    #include "appoptions.h"
    
    pospelov's avatar
    pospelov committed
    #include "mainwindow.h"
    
    #include "ComboProperty.h"
    
    pospelov's avatar
    pospelov committed
    #include <QApplication>
    
    Mohammad Mahadi Hasan's avatar
    Mohammad Mahadi Hasan committed
    #include <QDebug>
    
    #include <QLocale>
    
    David Li's avatar
    David Li committed
    #include <QMetaType>
    
    #include <QTime>
    #include <iostream>
    
    pospelov's avatar
    pospelov committed
    
    
    void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
    {
         Q_UNUSED(type);
         Q_UNUSED(msg);
    }
    
    
    pospelov's avatar
    pospelov committed
    int main(int argc, char *argv[])
    {
    
        ApplicationOptions options(argc, argv);
        if(!options.isConsistent()) return 0;
    
    Mohammad Mahadi Hasan's avatar
    Mohammad Mahadi Hasan committed
    
    
        QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    
    David Li's avatar
    David Li committed
        qRegisterMetaType<QVector<double> >("QVector<double>");
    
        qRegisterMetaType<FitProgressInfo>("FitProgressInfo");
    
        QMetaType::registerComparators<ComboProperty>();
    
    pospelov's avatar
    pospelov committed
        QApplication a(argc, argv);
    
    Mohammad Mahadi Hasan's avatar
    Mohammad Mahadi Hasan committed
    
    
        if(!a.arguments().contains(QLatin1String("--with-debug"))) {
            qInstallMessageHandler(messageHandler);
        }
    
    
        SplashScreen *splash(0);
    
        if(!options.find("no-splash")) {
    
            splash = new SplashScreen();
            splash->show();
    
            int time(1500);
            QTime dieTime = QTime::currentTime().addMSecs(time);
            QTime timer;
            timer.start();
            while( QTime::currentTime() < dieTime )
            {
                splash->setProgress(timer.elapsed()/(time/100));
                QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );
            }
    
    pospelov's avatar
    pospelov committed
        w.show();
    
    Mohammad Mahadi Hasan's avatar
    Mohammad Mahadi Hasan committed
    
    
        if(splash)
            splash->finish(&w);
    
        return a.exec();
    
    pospelov's avatar
    pospelov committed
    }