summaryrefslogblamecommitdiffstats
path: root/src/main.cpp
blob: 839aa4370fda3f4745d5d19119eb09b743872921 (plain) (tree)








































                                                                           


                                                            














                                                                        





                         
/*
 * Copyright (c) 2011 - RZ Uni Freiburg
 * Copyright (c) 2011 - OpenSLX Project
 *
 * This program/file is free software distributed under the GPL version 2.
 * See http://gpl.openslx.org/
 *
 * If you have any feedback please consult http://feedback.openslx.org/ and
 * send your feedback to feedback@openslx.org
 *
 * General information about OpenSLX - libChooser can be found under
 * http://openslx.org
 *
 */

#include <iostream>

#include <QApplication>
#include <QDebug>

#include <VSession.h>
#include <VSessionHandler.h>
#include <XSession.h>
#include <XSessionHandler.h>

#include "Globals.h"
#include "Dialog.h"

bool myLessThan(Session* a, Session* b) {
    return *a < *b;
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    VSessionHandler *vh = new VSessionHandler;
    vh->setConfPath(etcPath);
    vh->setFilterScript(filterScript + ".disabled");
    vh->setRunVmScript(runVmScript);

    /* read session files */
    QList<Session*> vsessions(vh->readXmlDir(vSessionPath));

    Dialog *w = new Dialog;

    if (vsessions.size()) {
//        if (!(QFile::permissions(runVmScript) & QFile::ExeUser)) {
//            std::cerr << a.translate(
//                    "Console",
//                    "vmchooser: external script %1 is not executable")
//                    .arg(runVmScript).toUtf8().data()
//                    << std::endl;
//            return EXIT_FAILURE;
//        }
        qSort(vsessions.begin(), vsessions.end(), myLessThan);
        w->addItems(vsessions);
    }

    w->center();
    w->show();

    a.setActiveWindow(w);
    return a.exec();
}