Newer
Older
// ************************************************************************** //
//
// BornAgain: simulate and fit scattering at grazing incidence
//

Wuttke, Joachim
committed
//! @file GUI/main/main.cpp
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2016
//! @authors Scientific Computing Group at MLZ Garching
//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov
//! @authors Walter Van Herck, Joachim Wuttke
//
// ************************************************************************** //
#include "FitProgressInfo.h"
#include "SplashScreen.h"
#include "appoptions.h"
#include "ComboProperty.h"
#include <QTime>
#include <iostream>
Mohammad Mahadi Hasan
committed
void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
{
Q_UNUSED(type);
Q_UNUSED(msg);
}
ApplicationOptions options(argc, argv);
if(!options.isConsistent()) return 0;
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
qRegisterMetaType<QVector<double> >("QVector<double>");
Pospelov, Gennady
committed
qRegisterMetaType<FitProgressInfo>("FitProgressInfo");
// If uncomment line below, we will be able to compare QVariant containig ComboProperty
// but the program will be unstable.
// QMetaType::registerComparators<ComboProperty>();
Mohammad Mahadi Hasan
committed
if(!a.arguments().contains(QLatin1String("--with-debug"))) {
qInstallMessageHandler(messageHandler);
}
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 );
}
if(splash)
splash->finish(&w);