Skip to content
Snippets Groups Projects
main.cpp 2.84 KiB
Newer Older

/*******************************************************************************
* Copyright (c) 2015 Olivier Langella <Olivier.Langella@moulon.inra.fr>.
*
* This file is part of PAPPSOms-tools.
*
*     PAPPSOms-tools is free software: you can redistribute it and/or modify
*     it under the terms of the GNU General Public License as published by
*     the Free Software Foundation, either version 3 of the License, or
*     (at your option) any later version.
*
*     PAPPSOms-tools is distributed in the hope that it will be useful,
*     but WITHOUT ANY WARRANTY; without even the implied warranty of
*     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*     GNU General Public License for more details.
*
*     You should have received a copy of the GNU General Public License
*     along with PAPPSOms-tools.  If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
*     Olivier Langella <Olivier.Langella@moulon.inra.fr> - initial API and implementation
******************************************************************************/

#include <QApplication>
#include <iostream>
Olivier Langella's avatar
Olivier Langella committed
#include <pappsomspp/pappsoexception.h>
#include "config.h"
#include "gui/mainwindow.h"
#include "utils/types.h"

using namespace std;

int main(int argc, char *argv[])
{
    QTextStream errorStream(stderr, QIODevice::WriteOnly);
    QApplication app(argc, argv);
Langella Olivier's avatar
Langella Olivier committed

    qRegisterMetaType<TandemRunBatch>("TandemRunBatch");
    qRegisterMetaType<std::vector<pappso::mz>>("std::vector<pappso::mz>");
    qRegisterMetaType<pappso::PrecisionP>("pappso::PrecisionP");
    qRegisterMetaType<std::vector<pappso::XicSp>>("std::vector<pappso::XicSp>");
    qRegisterMetaType<pappso::PeptideSp>("pappso::PeptideSp");
    qRegisterMetaType<XicExtractMethod>("XicExtractMethod");
    qRegisterMetaType<pappso::SpectrumSp>("pappso::SpectrumSp");
    qRegisterMetaType<std::vector<pappso::PeptideNaturalIsotopeAverageSp>>("std::vector<pappso::PeptideNaturalIsotopeAverageSp>");
    try {
        QCoreApplication::setOrganizationName("PAPPSO");
        QCoreApplication::setOrganizationDomain("pappso.inra.fr");
        QCoreApplication::setApplicationName("xtpcpp");
Olivier Langella's avatar
Olivier Langella committed
        MainWindow window;
        window.show();

        // This code will start the messaging engine in QT and in
        // 10ms it will start the execution in the MainClass.run routine;
        QTimer::singleShot(10, &window, SLOT(run()));

        return app.exec();
    }
    catch (pappso::PappsoException& error)
    {
        errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
        errorStream << error.qwhat() << endl;
        app.exit(1);
    }

    catch (std::exception& error)
    {
        errorStream << "Oops! an error occurred in XTPcpp. Dont Panic :" << endl;
        errorStream << error.what() << endl;
        app.exit(1);
    }
}