summaryrefslogblamecommitdiffstats
path: root/src/server/main.cpp
blob: 2e5a32bf3491d511dbcb4f7b671e9f3654220031 (plain) (tree)
1
2
3
4
5
6
7
8
9

                   

                                  
                        
                               


                               
                                     
 


                                                 










                                                                     







                                                                  




                                                                                  


                                                                
 
 



                                                         
 
                          
                          
 
#include <iostream>
#include <stdlib.h>
#include "mainwindow/mainwindow.h"
#include "util/util.h"
#include "util/global.h"
#include "../shared/settings.h"

int main(int argc, char** argv)
{
	QApplication app(argc, argv);

	app.setOrganizationName("openslx");
	app.setOrganizationDomain("openslx.org");
	app.setApplicationName("pvsmgr");

    qDebug() << "args are " << app.arguments() << "<END>";
    for (QString a : app.arguments()) {
        if (a == "--manager-only") {
            Global::manager_only = true;
            break;
        } else if (!a.endsWith("pvsmgr")) {
            qDebug() << "ignoring unknown argument: \"" << a << "\"";
        }
    }

	QStringList supportedStyles = QStyleFactory::keys();
	for (QString style : PREFERRED_STYLES) {
		if (supportedStyles.contains(style)) {
			qDebug() << "Setting style to: " << style;
			app.setStyle(style);
			break;
		}
	}
	qsrand((uint)QDateTime::currentMSecsSinceEpoch());


	// Set the global path of the settings
	QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, "/opt/");
	SETTINGS(sys);
	qDebug() << "System settings are in:" << sys.fileName();
	QFileInfo sysfi(sys.fileName());


	// use system locale as language to translate gui
	QTranslator translator;
	translator.load(":pvsmgr");
	app.installTranslator(&translator);

	MainWindow pvsmgr;
	return app.exec();
}