Пример #1
0
int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    MainForm *w = new MainForm;
    w->show();
    return a.exec();
}
Пример #2
0
int main(int argc, char *argv[]) 
{
#if defined(QTVIDEOSINK_PATH)
    //this allows the example to run from the QtGStreamer build tree without installing QtGStreamer
    setenv("GST_PLUGIN_PATH", QTVIDEOSINK_PATH, 0);
#endif
    
    QGst::init();

    qRegisterMetaType<GPSInfo>();
    
    GOOGLE_PROTOBUF_VERIFY_VERSION;

    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);
    
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

    MainForm mainForm;
    mainForm.show();

    int result = app.exec();
    google::protobuf::ShutdownProtobufLibrary();
    QGst::cleanup();

    return result;
}
Пример #3
0
int main(int argc, char *argv[]) {

    QApplication app(argc, argv);
    app.setApplicationName(APPLICATION_NAME);

//    for (int i = 0; i < QStyleFactory::keys().length(); i++) {
//        std::cout << QStyleFactory::keys().at(i).toStdString() << std::endl;
//    }
//    app.setStyle("Fusion");

    qRegisterMetaType<streamer::DownloadError>("streamer::DownloadError");
    qRegisterMetaType<streamer::MessageType>("streamer::MessageType");
    qRegisterMetaType<streamer::PlaybackCallbackType>("streamer::MPVCallbackType");
    qRegisterMetaType<streamer::DownloadInfo>("streamer::DownloadInfo");
    qRegisterMetaType<std::string>("std::string");
    qRegisterMetaType<std::list<std::string>>("std::list<std::string>");
    qRegisterMetaType<std::list<std::string>>("std::list<std::string>&");
    qRegisterMetaType<QTextBlock>("QTextBlock");
    qRegisterMetaType<QTextCursor>("QTextCursor");

    setlocale(LC_NUMERIC, "C"); // libmpv needs this :/


#if defined(MINGW)
    QIcon::setThemeName("icons");
#endif

    MainForm *form = new MainForm();
    form->show();

    if (form->disclaimer) {
        return 0;
    }
    return app.exec();
}
Пример #4
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainForm w;
    w.show();
    
    return a.exec();
}
Пример #5
0
int main(int argc, char *argv[])
{
	QApplication app(argc, argv);
	MainForm *mainform = new MainForm;
	app.setMainWidget(mainform); 
	mainform->show();
	return app.exec();
}
Пример #6
0
int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    MainForm w;
    w.show();
    a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    return a.exec();
}
Пример #7
0
Файл: main.cpp Проект: suma/hex
int main(int argc, char *argv[])
{
	HexApp app(argc, argv);
	QTextCodec::setCodecForLocale(QTextCodec::codecForLocale());
	MainForm *editor = new MainForm();
	editor->show();
	return app.exec();
}
Пример #8
0
int main(int argc, char **argv) {
	QApplication app(argc, argv);
	
	QTranslator qtTranslator;
	qtTranslator.load("kboy_" + QLocale::system().name(), QDir::homePath()+"/.kboy/lang");
	app.installTranslator(&qtTranslator);

	MainForm dlg;
	dlg.show();
 
	return app.exec();
}
Пример #9
0
int main(int argc, char *argv[])
{
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);

    QApplication app(argc, argv);

    MainForm mainForm;
    mainForm.show();

    return app.exec();
}
Пример #10
0
int main(int argc, char *argv[])
{
	#if _DEBUG
		AllocConsole();
	#endif

	argc =0;
	QApplication a(argc, NULL);
	MainForm w;
	w.show();

	return a.exec();	
}
Пример #11
0
int main(int argc, char *argv[]) {
    // initialize resources, if needed
    Q_INIT_RESOURCE(neoxtrainer);

    QApplication app(argc, argv);
    QString version = "3.0";
    
    // create and show your widgets here
    MainForm form;
    form.setWindowFlags(form.windowFlags() & ~Qt::WindowContextHelpButtonHint);
    form.setWindowTitle(form.windowTitle() + " " + version);
    form.show();
    return app.exec();
}
Пример #12
0
int main( int argc, char **argv ) {
	QApplication app( argc, argv );
	QTextCodec::setCodecForCStrings( QTextCodec::codecForName("utf8:") );
	//QPixmap pixmap(":/img/projekt.jpg");
	//QSplashScreen splash(pixmap);
	//app.setWindowIcon(QIcon(":/img/projekt-ikon.png"));
	//splash.show();
	//splash.showMessage(QObject::tr("Startuji..."), Qt::AlignTop | Qt::AlignRight);
	MainForm mf;
//	mf.setColor();
	mf.show();
	//splash.finish(&mf);
	return app.exec();
}
Пример #13
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    parseCmdLine(app.arguments());
    QTranslator translator;
    if (!translator.load("yagf_" + QLocale::system().name(), "/usr/local/share/yagf/translations"))
        translator.load("yagf_" + QLocale::system().name(), "/usr/share/yagf/translations");
    app.installTranslator(&translator);
    QTranslator translator2;
    translator2.load("qt_" + QLocale::system().name(), "/usr/share/qt4/translations");
    app.installTranslator(&translator2);
    MainForm window;
    window.show();
    return app.exec();
}
Пример #14
0
int main( int argc, char *argv[] )
{
    initCodec("UTF-8");
    QApplication app(argc, argv);

    DataBaseManager *db;
    db = DataBaseManager::getInstance();
    Q_UNUSED(db);

    MainForm* mainWindow = new MainForm();
    MainPresenter* presenter = new MainPresenter(mainWindow);
    Q_UNUSED(presenter);
    mainWindow->show();

    return app.exec();
}
int main(int argc, char *argv[])
{
  QApplication a(argc, argv);
  Miro::Client client(argc, argv);

  if (int rc = parseArgs(argc, argv) != 0)
    return rc;

  MainForm * mainForm = new MainForm(client);

  a.setMainWidget(mainForm);
  mainForm->setCaption("QtVideo");
  mainForm->show();

  return a.exec();
}
Пример #16
0
int main(int argc, char *argv[])
{
    QTextCodec *codec = QTextCodec::codecForName("cp1251");
    QTextCodec::setCodecForTr(codec);
    QTextCodec::setCodecForCStrings(codec);
    QTextCodec::setCodecForLocale(codec);

    QApplication a(argc, argv);
    a.setStyle("cleanlooks");
    QResource::registerResource(QDir::currentPath()+"/icons.rcc");
    a.addLibraryPath(QDir::currentPath()+"/plugins");
    MainForm w;
    w.show();

    return a.exec();
}
Пример #17
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSurfaceFormat surface;
    surface.setDepthBufferSize(24);

    MainForm w;
    w.setFormat(surface);
    w.setWidth(800);
    w.setHeight(600);
    w.setMinimumWidth(800);
    w.setMinimumHeight(600);
    w.show();
    //w.showFullScreen();

    return a.exec();
}
Пример #18
0
int main(int argc, char *argv[]) {
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);
    //QApplication::setStyle("plastique");
    //QApplication::setStyle("motif");
    //QApplication::setStyle("windows");
    //QApplication::setStyle("cde");
    //QApplication::setStyle("gtk");
    //QApplication::setStyle("cleanlooks");
    QApplication::setStyle("windowsxp");
    //QApplication::setStyle("windowsvista");
    //QApplication::setStyle("macintosh");
    QApplication app(argc, argv);
    MainForm main;
    main.show();
    // create and show your widgets here
    
    return app.exec();
}
Пример #19
0
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

//    INPUT_PARAMS inputParams;

//    bzero(&inputParams, sizeof(INPUT_PARAMS));
//    inputParams.countMAP = 5;
//    inputParams.countMR = 64;
//    inputParams.countTP = 240;
//    inputParams.powerMAP = 18.0;
//    inputParams.powerMR = 15.0;
//    inputParams.rayForMeshs = 450.0;
//    inputParams.rayForTPs = 250.0;
//    inputParams.capacityBetweenBS = 300.0;
//    inputParams.capacityMAP = 10000.0;
//    inputParams.capacityTP = 40.0;
//    inputParams.squareArea = 2500;

//    bzero(&inputParams, sizeof(INPUT_PARAMS));
//    inputParams.countMAP = 2;
//    inputParams.countMR = 14;
//    inputParams.countTP = 60;
//    inputParams.powerMAP = 18.0;
//    inputParams.powerMR = 15.0;
//    inputParams.rayForMeshs = 450.0;
//    inputParams.rayForTPs = 250.0;
//    inputParams.capacityBetweenBS = 300.0;
//    inputParams.capacityMAP = 10000.0;
//    inputParams.capacityTP = 40.0;
//    inputParams.squareArea = 1000;

//    WMNMap wmn(inputParams);
//    wmn.show();

    MainForm mainform;
    mainform.show();

    return a.exec();
}
Пример #20
0
int main( int argc, char ** argv )
{
    QApplication a( argc, argv );
    MainForm w;
    QPixmap pixmap;

    application = &a;
    a.addLibraryPath( a.applicationDirPath() );
    unit = new TEScalesBase( serialport );
    if ( parseCommandLine( argc, argv ) ) return 1;
    a.installTranslator( &tr_app );
    // pixmap = QPixmap::fromMimeSource( "engine-splash-"+lang+".png" );
    // if ( pixmap.isNull() )
    if ( !batch ) {
        w.ePortNum->setValue( serialport );
        unit->open();
        QObject::connect( unit, SIGNAL( deviceEvent( int ) ), &w, SLOT( display() ) );
//        unit->startPoll(500);
        w.show();
        a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
        return a.exec();
    }
Пример #21
0
int main(int argc, char *argv[]) {
    // initialize resources, if needed
    // Q_INIT_RESOURCE(resfile);
    cout<<"se inicia aplicacion"<<endl;
    QApplication app(argc, argv); 
    app.setQuitOnLastWindowClosed(true);    
    cout<<"se declara form"<<endl;
    MainForm mainForm;
    cout<<"se muestra ventana"<<endl;
    mainForm.show();
    cout<<"se mostro ventana"<<endl;
    //clasificar bd
    //classifyBD();
    //return 0;
    //generate testset file
    //generateTestFile();
    //return 0;

    string urlBase = "";
    string image_name = "";
    Mat bgMask, image, tmp;
    int labels[numberOfImages * nCategories];
    float trainingData[numberOfImages * nCategories][nChars];
    //Preprocessing
    int flag = 1;
    int nImage = 0;
    string svmFileName = "svm_training.xml";
    string trainingFileName = "training_data.csv";
    ifstream svmFile(svmFileName);
    ifstream trainingFile(trainingFileName);
    ofstream trainingFileOutput;
    Ptr<TrainData> td;
    CharsImage ci;
    int ncols = 2240, nrows = 1488;
    int debugFlag = 0;
    if (!svmFile.is_open() || debugFlag) {
        if (!trainingFile.is_open() || debugFlag) {
            if (!debugFlag) trainingFileOutput.open(trainingFileName);
            for (int i = 0; i < nCategories; i++) {
                switch (i) {
                    case 0:
                        urlBase = "image/0-dataset/0 - normal/";
                        image_name = "n_image";
                        break;
                    case 1:
                        urlBase = "image/0-dataset/1 - leve/";
                        image_name = "l_image";
                        break;
                    case 2:
                        urlBase = "image/0-dataset/2 - moderado/";
                        image_name = "m_image";
                        break;
                    case 3:
                        urlBase = "image/0-dataset/3 - severo/";
                        image_name = "s_image";
                        break;

                }
                for (int n = 1; n <= numberOfImages; n++) {
                    ci.nImage = n;

                    image = imread(urlBase + image_name + SSTR(n) + ".tif", 1);
                    if (image.cols != ncols || image.rows != nrows) {
                        resize(image, image, Size(ncols, nrows));
                    }
                    if (flag) {
                        //backgroundSegmentation(image, bgMask);
                        readInGreenChannel("image/bgMask.tif",bgMask);
                        flag = 0;
                    }
                    bgMask.copyTo(tmp);
                    opticDiscSegmentation(tmp, image, ci);
                    //cout<<ci.nImage+i*numberOfImages<<endl;
                    //imwrite("image/3-final mask/image"+SSTR(ci.nImage)+".tif", tmp);
                    darkLessionSegmentation(tmp, image, ci);
                    brightLessionSegmentation(tmp, image, ci);



                    cout << "Imagen " << nImage << ": " << "(Tipo - " << i << ") " << ci.areaDarkZone << " " << ci.numberDarkZone << " " << ci.areaBrightZone << " " << ci.numberBrightZones << endl;
                    //cout << "Imagen " << nImage << ": " << "(Tipo - " << i << ") " << ci.areaDarkZone << " " << ci.numberDarkZone <<" " << ci.areaBrightZone <<endl;
                    trainingFileOutput << ci.areaDarkZone << "," << ci.numberDarkZone << "," << ci.areaBrightZone << "," << ci.numberBrightZones << "," << i << endl;
                    //cout<<ci.areaDarkZone<<" "<<ci.areaBrightZone<<endl;
                    labels[nImage] = i;
                    trainingData[nImage][0] = ci.areaDarkZone;
                    trainingData[nImage][1] = ci.numberDarkZone;
                    trainingData[nImage][2] = ci.areaBrightZone;
                    trainingData[nImage][3] = ci.numberBrightZones; 
                    nImage++;
                    if (debugFlag) {
                        return 0;
                    }

                }

            }
            trainingFileOutput.close();
            Mat labelsMat(numberOfImages*nCategories, 1, CV_32SC1, labels);
            Mat trainingDataMat(numberOfImages*nCategories, nChars, CV_32FC1, trainingData);
            td = TrainData::create(trainingDataMat, ROW_SAMPLE, labelsMat);
        } else {
            td = TrainData::loadFromCSV(trainingFileName, -1);
            svmFile.close();
        }

        Ptr<SVM> svm = SVM::create();
        /*svm->setType(ml::SVM::C_SVC);
        svm->setKernel(ml::SVM::POLY);
        svm->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER, 1000, 1e-6));
        svm->setDegree(3);*/
        svm->setType(ml::SVM::C_SVC);
        svm->setKernel(ml::SVM::RBF);
        svm->setGamma(9.3750000000000002e-002);
        svm->setTermCriteria(TermCriteria(TermCriteria::MAX_ITER, 1000, 1.1920928955078125e-007));
        svm->setC(2.5000000000000000e+000);
        ParamGrid noParams;
        noParams.logStep = 0;

        svm->trainAuto(td, 10, noParams,
                noParams,
                noParams,
                noParams,
                noParams,
                noParams,
                true);
        ;
        svm->save(svmFileName);


    } else {
        cout << "File Exists" << endl;

        //getCharsFromTestFolder(svmFileName);

        /*int nrows = testChars.rows;
        //float* ptr;
       
        svm->predict(testChars,results);
        
        for (int i = 0; i < nrows; i++) {
            cout << "Image " << i << ": " <<results.at<float>(i,0)<< endl;
        }*/
        /*float result;
        Mat sampleMat;
        for (int i = 0; i < nrows; i++) {
            sampleMat=Mat(1, nChars, CV_32FC1, {testChars.at<float>(i,0),testChars.at<float>(i,1),testChars.at<float>(i,2)});
            //cout << svm->getVarCount() << endl;
            result = svm->predict(sampleMat);
            cout << "Image " << i << ": " <<result<< endl;
        }*/
        /*
        float test[1][3]={542, 11, 4187};
        Mat sampleMat(1, nChars, CV_32FC1,test);
        float result = svm->predict(sampleMat);
        cout << "El resultado es: " << result << endl;*/
    }


    //svmFile.close();


    //svm->load("svm_result.xml");
    //vesselSegmentation(bgMask,maImage);



    //waitKey(0);
    cout << "App exec:"<<app.exec()<<endl;
    return 0;
    
    //return 0;
}
Пример #22
0
int main( int argc, char ** argv )
{

	QApplication a( argc, argv );
//	dSelectDB dselectdb;
	dLogin dlogin;
//	application = &a;
	int rc = 1;
	bool ok;
	QPixmap pixmap;
	BrInitError error;

	QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF8") );
	aLog::init("",aLog::MT_DEBUG);    

#ifndef _Windows
	if (br_init_lib(&error) == 0 && error != BR_INIT_ERROR_DISABLED) {
		aLog::print(aLog::MT_INFO, QObject::tr("Warning: BinReloc failed to initialize (error code %1)\n").arg(error));
		aLog::print(aLog::MT_INFO, QObject::tr("Will fallback to hardcoded default path.\n"));
	}
	aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to data dir is %1.\n").arg( br_find_data_dir("/usr/share") ));
	aLog::print(aLog::MT_DEBUG, QObject::tr("main - BinReloc path to lib dir is %1.\n").arg( br_find_data_dir("/usr/lib") ));
#endif
	if ( parseCommandLine( qApp->argc(), qApp->argv() ) ) return 1;
	qApp->installTranslator( &tr_app );
	qApp->installTranslator( &tr_lib );
	qApp->installTranslator( &tr_plugins );
	pixmap = QPixmap::fromMimeSource( "engine-splash-"+lang+".png" );
	if ( pixmap.isNull() )
#ifdef _Windows
	pixmap = QPixmap::fromMimeSource( qApp->applicationDirPath()+"/engine-splash-"+lang+".png" );
	qApp->addLibraryPath( qApp->applicationDirPath() );
#else
	pixmap = QPixmap::fromMimeSource( QString(br_find_data_dir("/usr/share") ) + "/ananas/designer/locale/engine-splash-"+lang+".png");
	qApp->addLibraryPath( QString( br_find_lib_dir("/usr/lib")) + "/ananas/qt3plugins" );

        QStringList list = a.libraryPaths();
	QString libPath = "";
	QStringList::Iterator it = list.begin();
	while( it != list.end() ) {
    	    libPath += *it+":";
    	    ++it;
	}
	aLog::print(aLog::MT_DEBUG, QString("main - qt library path is '%1'\n").arg( libPath));
#endif
	printf("extensions: \n%s\n",( const char *) AExtensionFactory::keys().join("\n") );
// Test create extension
//	AExtension *e = AExtensionFactory::create("AExtTest");
//	if (e) printf("EXT OK\n"); else printf("NO EXT OK\n");

	if ( pixmap.isNull() )
		pixmap = QPixmap::fromMimeSource( "engine-splash-en.png" );
	QSplashScreen *splash = new QSplashScreen( pixmap );
	if ( ananas_login( rcfile, username, userpassword ) ){
//	if ( rcfile.isEmpty() ) {
//    	    if (dselectdb.exec()==QDialog::Accepted) rcfile = dselectdb.rcfile;
//	}
//	if ( !rcfile.isEmpty() ) {
//    		if (dlogin.exec()==QDialog::Accepted) {
//		    username = dlogin.username;
//		    userpassword = dlogin.password;
//		}
//		if (dselectdb.rcfile.isEmpty()) return 0;

		splash->show();
		splash->message( QObject::tr("Init application"), Qt::AlignBottom, Qt::white );
		MainForm *w = new MainForm( 0, "MainForm");
		mainform = w;
		mainformws = mainform->ws;
		mainformwl = mainform->wl;
		qApp->setMainWidget( w );
		w->rcfile = rcfile;
//		printf( "rcfile = %s\n", rcfile.ascii() );
		w->show();
		ok = w->init();
		splash->clear();
       	splash->finish( w );
       	delete splash;
		if ( ok ) {
			qApp->connect( qApp, SIGNAL( lastWindowClosed() ), qApp, SLOT( quit() ) );
			rc = qApp->exec();
			if( w ) delete w;
			w=0;
		} else {
			QMessageBox::critical(0, QObject::tr("Error"), QObject::tr("Ananas runtime init error. See message window and log file for details."));
		}
		aLog::close();
		return rc;
	}
	else
	{
		aLog::close();
		return 0;
	}
}
Пример #23
0
int main(int argc, char *argv[])
{
	try {
		// Options...
		char *cp;
		struct option *op;
		char opts[NELEM(long_opts) * 3 + 1];

		// Build up the short option QString
		cp = opts;
		for (op = long_opts; op < &long_opts[NELEM(long_opts)]; op++) {
			*cp++ = op->val;
			if (op->has_arg)
				*cp++ = ':';
			if (op->has_arg == optional_argument )
				*cp++ = ':';  // gets another one
		}

		QApplication* pQApp = new QApplication(argc, argv);

		// Deal with the options
		QString songFilename;
#ifdef H2CORE_HAVE_JACKSESSION
		QString sessionId;
#endif
		QString playlistFilename;
		bool bNoSplash = false;
		QString sys_data_path;
		QString sSelectedDriver;
		bool showVersionOpt = false;
		unsigned logLevelOpt = H2Core::Logger::Error;
		QString drumkitName;
		QString drumkitToLoad;
		bool showHelpOpt = false;

		int c;
		for (;;) {
			c = getopt_long(argc, argv, opts, long_opts, NULL);
			if (c == -1)
				break;

			switch(c) {
			case 'P':
				sys_data_path = QString::fromLocal8Bit(optarg);
				break;

				case 'd':
					sSelectedDriver = QString::fromLocal8Bit(optarg);
					break;

				case 's':
					songFilename = QString::fromLocal8Bit(optarg);
					break;
#ifdef H2CORE_HAVE_JACKSESSION
			case 'S':
				sessionId = QString::fromLocal8Bit(optarg);
				break;
#endif

				case 'p':
					playlistFilename = QString::fromLocal8Bit(optarg);
					break;

				case 'k':
					//load Drumkit
					drumkitToLoad = QString::fromLocal8Bit(optarg);
					break;

				case 'v':
					showVersionOpt = true;
					break;

				case 'i':
					//install h2drumkit
					drumkitName = QString::fromLocal8Bit( optarg );
					break;

				case 'V':
					if( optarg ) {
						logLevelOpt = H2Core::Logger::parse_log_level( optarg );
					} else {
						logLevelOpt = H2Core::Logger::Error|H2Core::Logger::Warning;
					}
					break;
				case 'n':
					bNoSplash = true;
					break;

				case 'h':
				case '?':
					showHelpOpt = true;
					break;
			}
		}

		setup_unix_signal_handlers();

		if( showVersionOpt ) {
			std::cout << H2Core::get_version() << std::endl;
			exit(0);
		}
		showInfo();
		if( showHelpOpt ) {
			showUsage();
			exit(0);
		}

		// Man your battle stations... this is not a drill.
		H2Core::Logger::create_instance();
		H2Core::Logger::set_bit_mask( logLevelOpt );
		H2Core::Logger* logger = H2Core::Logger::get_instance();
		H2Core::Object::bootstrap( logger, logger->should_log(H2Core::Logger::Debug) );
		if(sys_data_path.length()==0 ) {
			H2Core::Filesystem::bootstrap( logger );
		} else {
			H2Core::Filesystem::bootstrap( logger, sys_data_path );
		}
		MidiMap::create_instance();
		H2Core::Preferences::create_instance();
		// See below for H2Core::Hydrogen.


		___INFOLOG( QString("Using QT version ") + QString( qVersion() ) );
		___INFOLOG( "Using data path: " + H2Core::Filesystem::sys_data_path() );

		H2Core::Preferences *pPref = H2Core::Preferences::get_instance();
		pPref->setH2ProcessName( QString(argv[0]) );

#ifdef H2CORE_HAVE_LASH

		LashClient::create_instance("hydrogen", "Hydrogen", &argc, &argv);
		LashClient* lashClient = LashClient::get_instance();

#endif
		if( ! drumkitName.isEmpty() ){
			H2Core::Drumkit::install( drumkitName );
			exit(0);
		}
		
		if (sSelectedDriver == "auto") {
			pPref->m_sAudioDriver = "Auto";
		}
		else if (sSelectedDriver == "jack") {
			pPref->m_sAudioDriver = "Jack";
		}
		else if ( sSelectedDriver == "oss" ) {
			pPref->m_sAudioDriver = "Oss";
		}
		else if ( sSelectedDriver == "alsa" ) {
			pPref->m_sAudioDriver = "Alsa";
		}

		QString family = pPref->getApplicationFontFamily();
		pQApp->setFont( QFont( family, pPref->getApplicationFontPointSize() ) );

		QTranslator qttor( 0 );
		QTranslator tor( 0 );
		QString sTranslationFile = QString("hydrogen.") + QLocale::system().name();
		QString sLocale = QLocale::system().name();
		if ( sLocale != "C") {
			if (qttor.load( QString( "qt_" ) + sLocale,
				QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
				pQApp->installTranslator( &qttor );
			else
				___INFOLOG( QString("Warning: No Qt translation for locale %1 found.").arg(QLocale::system().name()));


			QString sTranslationPath = "data/i18n";
			QString total = sTranslationPath + "/" + sTranslationFile + ".qm";

			bool bTransOk = tor.load( total, "." );
			if ( bTransOk ) {
				___INFOLOG( QString( "Using locale: %1/%2" ).arg( sTranslationPath ).arg( sTranslationFile ) );
			}
			else {
				sTranslationPath = H2Core::Filesystem::i18n_dir();
				total = sTranslationPath + "/" + sTranslationFile + ".qm";
				bTransOk = tor.load( total, "." );
				if (bTransOk) {
					___INFOLOG( "Using locale: " + sTranslationPath + "/" + sTranslationFile );
				}
				else {
					___INFOLOG( "Warning: no locale found: " + sTranslationPath + "/" + sTranslationFile );
				}
			}
			if (tor.isEmpty()) {
				___INFOLOG( "Warning: error loading locale: " +  total );
			}
		}
		pQApp->installTranslator( &tor );

		QString sStyle = pPref->getQTStyle();
		if ( !sStyle.isEmpty() ) {
			pQApp->setStyle( sStyle );
		}

		setPalette( pQApp );

		SplashScreen *pSplash = new SplashScreen();

		if (bNoSplash) {
			pSplash->hide();
		}
		else {
			pSplash->show();
		}

#ifdef H2CORE_HAVE_LASH
		if ( H2Core::Preferences::get_instance()->useLash() ){
			if (lashClient->isConnected())
			{
				lash_event_t* lash_event = lashClient->getNextEvent();
				if (lash_event && lash_event_get_type(lash_event) == LASH_Restore_File)
				{
					// notify client that this project was not a new one
					lashClient->setNewProject(false);

					songFilename = "";
					songFilename.append( QString::fromLocal8Bit(lash_event_get_string(lash_event)) );
					songFilename.append("/hydrogen.h2song");

					//        				H2Core::Logger::get_instance()->log("[LASH] Restore file: " + songFilename);

					lash_event_destroy(lash_event);
				}
				else if (lash_event)
				{
					//        				H2Core::Logger::get_instance()->log("[LASH] ERROR: Instead of restore file got event: " + lash_event_get_type(lash_event));
					lash_event_destroy(lash_event);
				}
			}
		}
#endif

#ifdef H2CORE_HAVE_JACKSESSION
		if(!sessionId.isEmpty()){
			pPref->setJackSessionUUID( sessionId );

			/*
					 * imo, jack sessions use jack as default audio driver.
					 * hydrogen remember last used audiodriver.
					 * here we make it save that hydrogen start in a jacksession case
					 * every time with jack as audio driver
					 */
			pPref->m_sAudioDriver = "Jack";

		}

		/*
		 * the use of applicationFilePath() make it
		 * possible to use different executables.
		* for example if you start hydrogen from a local
		* build directory.
		*/

		QString path = pQApp->applicationFilePath();
		pPref->setJackSessionApplicationPath( path );
#endif

		// Hydrogen here to honor all preferences.
		H2Core::Hydrogen::create_instance();

#ifdef H2CORE_HAVE_NSMSESSION
		H2Core::Hydrogen::get_instance()->startNsmClient();
		songFilename = pPref->getNsmSongName();
#endif

		MainForm *pMainForm = new MainForm( pQApp, songFilename );
		pMainForm->show();
		pSplash->finish( pMainForm );

		if( ! playlistFilename.isEmpty() ){
			bool loadlist = HydrogenApp::get_instance()->getPlayListDialog()->loadListByFileName( playlistFilename );
			if ( loadlist ){
				Playlist::get_instance()->setNextSongByNumber( 0 );
			} else {
				___ERRORLOG ( "Error loading the playlist" );
			}
		}

		if( ! drumkitToLoad.isEmpty() ) {
			H2Core::Drumkit* drumkitInfo = H2Core::Drumkit::load_by_name( drumkitToLoad, true );
			if ( drumkitInfo ) {
				H2Core::Hydrogen::get_instance()->loadDrumkit( drumkitInfo );
				HydrogenApp::get_instance()->onDrumkitLoad( drumkitInfo->get_name() );
			} else {
				___ERRORLOG ( "Error loading the drumkit" );
			}
		}

		pQApp->exec();

		delete pSplash;
		delete pMainForm;
		delete pQApp;
		delete pPref;
		delete H2Core::EventQueue::get_instance();
		delete H2Core::AudioEngine::get_instance();

		delete MidiMap::get_instance();
		delete MidiActionManager::get_instance();

		___INFOLOG( "Quitting..." );
		cout << "\nBye..." << endl;
		delete H2Core::Logger::get_instance();

		if (H2Core::Object::count_active()) {
			H2Core::Object::write_objects_map_to_cerr();
		}

	}
	catch ( const H2Core::H2Exception& ex ) {
		std::cerr << "[main] Exception: " << ex.what() << std::endl;
	}
	catch (...) {
		std::cerr << "[main] Unknown exception X-(" << std::endl;
	}

	return 0;
}
Пример #24
0
int main(int argc, char *argv[])
{
  // Match the locale for the default C string <-> QString conversions.
  // Hopefully it is a .UTF-8 locale, if it isn't, don't complain about
  // characters lost converting!
  QTextCodec::setCodecForCStrings(QTextCodec::codecForLocale());

  KAboutData about("ktigcc","TIGCC IDE for KDE","1.08",
  "TIGCC C and ASM SDK", KAboutData::License_GPL,
  "Copyright (C) 2004-2007 Kevin Kofler and Joey Adams. All rights reserved.\n"
  "TIGCC Copyright (C) 1999-2007 The TIGCC Team.",
  "Original linker by Xavier and Niklas\n"
  "Compiler modifications by Jean, Sebastian and Kevin\n"
  "Linker by Sebastian and Kevin\n"
  "Documentation by Zeljko\n"
  "A68k modifications by Kevin\n"
  "Windows IDE by Sebastian\n"
  "KTIGCC IDE by Kevin and Joey\n"
  "Documentation conversion to CHM by Philipp\n"
  "Documentation conversion to Qt Assistant by Kevin",
  "http://tigcc.ticalc.org/linux/", "*****@*****.**");
  pabout=&about;
  KCmdLineArgs::init(argc,argv,&about);
  KCmdLineArgs::addCmdLineOptions(options);
  KApplication::addCmdLineOptions();
  KApplication app;
  // Set the preferred large icon size so system toolbar icons don't get
  // annoying padding.
  int toolbarIconSize=KIconLoader().currentSize(KIcon::MainToolbar);
  QIconSet::setIconSize(QIconSet::Large,QSize(toolbarIconSize,toolbarIconSize));
  // Readd the images KDE kindly removes...
  qCleanupImages_ktigcc();
  qInitImages_ktigcc();
  about.setProgramLogo(QImage::fromMimeSource("icon.png"));
  pconfig=KGlobal::config();
  
  if ((tigcc_base = getenv("TIGCC")) == NULL) {
    fprintf(stderr, "Fatal error: TIGCC is not defined in the environment. "
                    "TIGCC must be defined before tigcc can run.\nFor (ba)sh, "
                    "try: export TIGCC=/path/to/tigcc\nFor (t)csh, try: setenv "
                    "TIGCC /path/to/tigcc\n");
    exit(-1);
  }
  quill_drv = (char *) malloc (strlen(tigcc_base) + 25);
  if (!quill_drv) {
    fprintf(stderr, "Fatal error: not enough free memory\n");
    exit(-1);
  }
  sprintf(quill_drv, "%s/bin/quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/bin/Quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/c/quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/c/Quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/quill/quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/quill/Quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/Quill/quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/include/Quill/Quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/lib/quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  sprintf(quill_drv, "%s/lib/Quill.drv", tigcc_base);
  if(access(quill_drv, F_OK) != -1) goto quill_drv_found;
  free(quill_drv);
  quill_drv=NULL;
  quill_drv_found:

  char runtime_archive[strlen(tigcc_base) + 15];
  sprintf(runtime_archive, "%s/lib/fargo.a", tigcc_base);
  have_fargo=(access(runtime_archive, F_OK)!=-1);
  sprintf(runtime_archive, "%s/lib/flashos.a", tigcc_base);
  have_flashos=(access(runtime_archive, F_OK)!=-1);
  
  if (!mkdtemp(tempdir)) exit(1);
  
  KCmdLineArgs *args=KCmdLineArgs::parsedArgs();
  
  if (args->count())
    parg=args->arg(0);
  else
    parg=NULL;

  // Keep the tilibs from spamming the console with INFO messages.
  g_log_set_handler("ticables",(GLogLevelFlags)(G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG),
                    log_eater,NULL);
  g_log_set_handler("tifiles",(GLogLevelFlags)(G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG),
                    log_eater,NULL);
  g_log_set_handler("ticalcs",(GLogLevelFlags)(G_LOG_LEVEL_INFO|G_LOG_LEVEL_DEBUG),
                    log_eater,NULL);

  MainForm mainForm;
  app.setMainWidget( &mainForm );
  mainForm.show();
  
  int exitcode=app.exec();

  rmdir(tempdir);
  
  return exitcode;
}
Пример #25
0
int main(int argc, char *argv[])
{
#if 0
	//打开/dev/fb1层的osd显示
	s3c_win_info_t osd_info;
	s3cfb_color_key_info_t key_info;
	s3cfb_color_val_info_t key_val;


	// LCD frame buffer open
	fb1_fd = open(FB_DEV_NAME1, O_RDWR|O_NDELAY);
	if(fb1_fd < 0)
	{
		printf("LCD frame buffer open error\n");
		return -1;
	}

	if(signal(SIGINT, sig_del) == SIG_ERR) {
		printf("Sinal Error\n");
	}

	osd_info.Bpp		= FB1_BPP;	// RGB16
	osd_info.LeftTop_x	= 0;//400;	
	osd_info.LeftTop_y	= 0;//0;
	osd_info.Width		= 800;//FB1_WIDTH;	// display width
	osd_info.Height		= 480;//FB1_HEIGHT;	// display height

	// set OSD's information 
	if(ioctl(fb1_fd, SET_OSD_INFO, &osd_info)) {
		printf("Some problem with the ioctl SET_OSD_INFO\n");
		return -1;
	}
	ioctl(fb1_fd, SET_OSD_START);

	key_info.direction = 0;
	key_info.compkey_red = 0;
	key_info.compkey_green = 0;
	key_info.compkey_blue = 0;

	key_val.colval_red = 0;
	key_val.colval_green = 0;
	key_val.colval_blue = 0;

	ioctl(fb1_fd, S3CFB_COLOR_KEY_SET_INFO, &key_info);
	ioctl(fb1_fd, S3CFB_COLOR_KEY_VALUE, &key_val);

	ioctl(fb1_fd, S3CFB_COLOR_KEY_START);
#endif

	//以下是Qt程序
	const char filename[]  = "/tmp/mediaplayer";
	int fd = open (filename, O_CREAT|O_WRONLY, 0644);
	int lock =  lockf(fd,F_TLOCK,0);//file lock:cannot be execute than 1 time simultaneously
	if (fd == -1) {
		perror("open");
		exit(-1);
	}

	if (lock == -1) {
		perror("lock");
		exit(-1);
	}

    pthread_t ntid;
    
    QApplication app(argc, argv);
    QTextCodec::setCodecForTr(QTextCodec::codecForName("utf8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf8"));
    MainForm ad;
    ad.show();
    pthread_create(&ntid, NULL, server_socket, &ad);
    return app.exec();
}