
#include "kryomol.h"
#include <kapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kdebug.h>
//static const char description[] =
//    I18N_NOOP("A General Viewer for Chemistry Related Files");

//static const char version[] = "0.7.0";

int main(int argc, char **argv)
{

    KAboutData aboutData("kryomol", 0, ki18n("KryoMol"), "0.7.0");
    aboutData.setShortDescription(ki18n("A general purpose chemistry viewer"));
    aboutData.setLicense(KAboutData::License_GPL);
    aboutData.setCopyrightStatement(ki18n("(c) 2009 Armando Navarro Vazquez"));
    aboutData.addAuthor(ki18n("Armando Navarro Vazquez"), 
                        ki18n("Author"),
                        "armando.navarro@uvigo.es");
    aboutData.setProgramIconName("kryomol");

    
    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineOptions options;
    options.add("+[URL]",ki18n("File to open"));
    KCmdLineArgs::addCmdLineOptions(options);
    

 kDebug() << "GLVisorBase::InitializeGL1" << endl;
    KApplication app;
   KCmdLineArgs* args=KCmdLineArgs::parsedArgs();
kDebug() << "GLVisorBase::InitializeGL2" << args << endl;
    // see if we are starting with session management
    if (0)
    {
        //RESTORE(KryoMol);
    }
    else
    {
         kDebug() << "GLVisorBase::InitializeGL3" << args->count() << endl;
        if ( args->count() == 0 )
        {
        KryoMol *widget = new KryoMol();
        widget->show();
        }
        else
        {
           
            for (int i=0; i < args->count(); i++ )
            {
                KryoMol *widget = new KryoMol;
                widget->resize(QSize(800,600));
                widget->show();
#warning check here
                widget->LoadUrl( args->url( i ) );
            }
        }
        args->clear();
    }
    return app.exec();
}
