コード例 #1
0
ファイル: main.cpp プロジェクト: ydxt25/ithome-1
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));
    //qDebug()<<QString::fromUtf8("主线程地址是:")<<QThread::currentThread();
#if defined(Q_OS_SYMBIAN)||defined(Q_WS_SIMULATOR)
    QPixmap pixmap(":/Image/Symbian.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();
    splash->raise();
#endif

#ifndef QT_NO_DEBUG
    QNetworkProxy proxy;
    proxy.setType(QNetworkProxy::HttpProxy);
    proxy.setHostName("localhost");
    proxy.setPort(8888);
    QNetworkProxy::setApplicationProxy(proxy);
#endif
    //int width=QApplication::desktop()->width();
    //int height=QApplication::desktop()->height();
    app->setApplicationName (QString::fromUtf8("IT之家"));
    app->setOrganizationName ("Stars");
    app->setApplicationVersion ("1.2.2");
    Settings *setting=new Settings;
    Utility *unility=new Utility;
    Cache *cacheContent=new Cache(setting);
    //qmlRegisterType<MyXmlListModel>("myXmlListModel",1,0,"MyXmlListModel");
    //qmlRegisterType<MyXmlRole>("myXmlListModel", 1, 0, "MyXmlRole");

    QmlApplicationViewer viewer;
    
    MyNetworkAccessManagerFactory *network = new MyNetworkAccessManagerFactory();
    viewer.engine()->setNetworkAccessManagerFactory(network);
    
    viewer.rootContext ()->setContextProperty ("cacheContent",cacheContent);
    viewer.rootContext()->setContextProperty("settings",setting);
    viewer.rootContext()->setContextProperty("utility",unility);
    
    QWebSettings::globalSettings ()->setAttribute (QWebSettings::LocalContentCanAccessRemoteUrls,true);
    QWebSettings::globalSettings ()->setAttribute (QWebSettings::SpatialNavigationEnabled,true);
    QWebSettings::globalSettings ()->setAttribute (QWebSettings::SpatialNavigationEnabled, true);
#if defined(Q_OS_SYMBIAN)||defined(Q_WS_SIMULATOR)
#if defined(Q_OS_S60V5)//判断qt的版本
    qWarning("build symbian s60v5");
    viewer.setMainQmlFile(QLatin1String("qml/symbian-v5/main.qml"));
    if(setting->getValue("night_mode",false).toBool())
        unility->setCss("./qml/symbian-v5/theme_black.css",viewer.width()-20);//设置默认的css
    else
        unility->setCss("./qml/symbian-v5/theme_white.css",viewer.width()-20);
#elif defined(Q_OS_S60V3)
    qWarning("build symbian s60v3");
    viewer.setMainQmlFile(QLatin1String("qml/symbian-v3/main.qml"));
    if(setting->getValue("night_mode",false).toBool())
        unility->setCss("./qml/symbian-v3/theme_black.css",viewer.width()-20);//设置默认的css
    else
        unility->setCss("./qml/symbian-v3/theme_white.css",viewer.width()-20);
#else
    qWarning("build symbian anna or simulator");
    viewer.setMainQmlFile(QLatin1String("qml/symbian-anna/main.qml"));
    if(setting->getValue("night_mode",false).toBool())
        unility->setCss("./qml/symbian-anna/theme_black.css",viewer.width()-20);//设置默认的css
    else
        unility->setCss("./qml/symbian-anna/theme_white.css",viewer.width()-20);
#endif
    viewer.showExpanded();
    splash->finish(&viewer);
    splash->deleteLater();
#elif defined(Q_OS_HARMATTAN)
    qWarning("build meego");
    viewer.setMainQmlFile(QLatin1String("qml/meego/main.qml"));
    if(setting->getValue("night_mode",false).toBool())
        unility->setCss("/opt/ithome/qml/meego/theme_black.css",460);//设置默认的css
    else
        unility->setCss("/opt/ithome/qml/meego/theme_white.css",460);
    viewer.showExpanded();
#endif
    return app->exec();
}
コード例 #2
0
ファイル: main.cpp プロジェクト: dkr/ananas-labs
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") );
	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
	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") ));

	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;
	}
}
コード例 #3
0
ファイル: main.cpp プロジェクト: geolffrey/ve
int main(int argc, char *argv[])
{
    int dummy = errno;
    QApplication a(argc, argv);
    Debug::init(0);
    //mediaPipeline::init(argc, argv);

	// Set the Application Language
#if 0
	//if (QLocale::system().name() == "zh_CN")
	{
		QTranslator *translator = new QTranslator(&a);
		bool ok = translator->load("vscloudnode_zh.qm",
			QCoreApplication::applicationDirPath() + "/translations");
		
		if (ok)
		{
			qDebug("Translation Files loaded.");
			a.installTranslator(translator);
		}
	}
#endif

    QPixmap pixmap(":/logo/resources/splash.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    QFont splashFont;
    //splashFont.setFamily("Arial");
    splashFont.setBold(true);

    splash->setStyleSheet(QStringLiteral("color : red;"));
    splash->setFont(splashFont);
    
    splash->show();

    //QApplication::setStyle(QStyleFactory::create("Fusion"));
	//QApplication::setStyle(QStyleFactory::create("Plastique"));
    //QApplication::setStyle("WindowsVista"); 
#if 0
	QFile f(":qdarkstyle/style.qss");
	if (!f.exists())
	{
		printf("Unable to set stylesheet, file not found\n");
	}
	else 
	{
		f.open(QFile::ReadOnly | QFile::Text);
		QTextStream ts(&f);
		a.setStyleSheet(ts.readAll());
	}
#endif


    gFactory = new Factory;
    splash->showMessage("Starting ...");

   if (gFactory->Init() == FALSE)
   {
#ifdef WIN32
       astring strPath = "C:\\";//TODO get the hdd from hdd
       VSCHddDevice hdd;
       hdd.show();
       hdd.exec();
       s32 size = hdd.GetDiskSize();
       hdd.GetDiskPath(strPath);
#else

	astring strPath = "ve/";//TODO get the hdd from hdd
	s32 size = 2;
#endif
       gFactory->SetSystemPath(strPath);
       splash->showMessage("Create Video Database ...");
       gFactory->Init();
#ifndef WIN32
	//gFactory->AddHDD(strPath, size);
#endif
   }

   VEvent::Init(*gFactory);
   VServiceMgr *pServiceMgr = VServiceMgr::CreateObject(*gFactory);

    VSCMainWindows w;
    //w.setWindowIcon(QIcon(":/logo/resources/vscsmall.jpg"));
    //w.show();
    //Sleep(1000);
    //w.setWindowFlags(Qt::FramelessWindowHint );
    //w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::CustomizeWindowHint );
    w.showMaximized();
    //w.showFullScreen();
    splash->finish(&w);

	//stacked s;
	//s.show();

    delete splash;
    /* Every thread is ready, start the factory thread */
    gFactory->start();
    return a.exec();
}
コード例 #4
0
/*
 * @brief 	Constructor of the main class
 * The Constructor initializes all needed variables and one instance of every used dialog.
 */
CReaderTool::CReaderTool(QWidget *parent)
    : QMainWindow(parent)
	, QrfeTraceModule("Reader_Tool")
{
	m_updateThread = NULL;

	int alignment = Qt::AlignHCenter | Qt::AlignBottom;

	//Mod by yingwei tseng for hiding AMS code, 2010/03/10
	#if 0
	QPixmap logo(":/ams logos/amsStartupLogo");
	#endif
	QPixmap logo(":/ams logos/mtiRfidLogo");
	//End by yingwei tseng for hiding AMS code, 2010/03/10
	
	//clark 2011.12.15
	//logo.setMask(logo.createHeuristicMask());
	QSplashScreen *splash = new QSplashScreen(logo);
	splash->setMask(logo.mask());
	splash->setWindowOpacity(0);
	splash->show();
	for(double i = 0; i < 1; i += 0.05)
	{
		splash->setWindowOpacity(i);
		Sleep(50);
	}

	/* Init variables */
	m_scanActive = false;

	splash->showMessage(tr("Initialize GUI..."), alignment);
	/* Setup the ui */
	ui.setupUi(this);

	this->setWindowTitle(QString(APPLICATION_NAME));

	splash->showMessage(tr("Create Handlers..."), alignment);

	/* Create Action Handler */
	m_actionHandler = new CActionHandler(&m_dataHandler, this);

	/* Create Read Rate Calculator */
	m_readRateCalc = new CReadRateCalc(this);

	/* Create Tag Manager */
	m_tagManager = new CTagManager(this);

	m_amsComWrapper = new USBHIDWrapper(0x0);

	splash->showMessage(tr("Create Dialogs..."), alignment);

	/* Create Dialogs */
	m_aboutDialog = new QrfeAboutDialog(this);
	m_keyDialog = new QrfeKeyWindow(this);
	m_tagListDialog = new CTagListView(m_tagManager, this);
	m_settingsDialog = new CSettingsDialog(this);
	m_tagSettingsDialog = new CTagSettingsDialog(&m_dataHandler, this);
	m_gen2SettingsDialog = new CGen2TagDialog(this);

       
	/* Create the view manager */
	m_tagViewManager = new CTagViewManager(ui.readerTreeWidget, &m_dataHandler, m_readRateCalc, this);
	m_tagViewManager->setUp(	m_settingsDialog->showAlias(),
								m_settingsDialog->useTtl(),
								m_settingsDialog->msecsToShowInactive(),
								m_settingsDialog->msecsToShowOutOfRange(),
								m_settingsDialog->msecsToDelete());
	QObject::connect(m_tagViewManager, SIGNAL(requestTagSettings(QString)), this, SLOT(requestTagSettingsDialog(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestTagAdvancedSettings(QString, QString)), this, SLOT(requestTagAdvancedSettingsDialog(QString, QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestReaderAdvancedSettings(QString)), this, SLOT(requestReaderAdvancedSettingsDialog(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(requestReaderRegisterMap(QString)), this, SLOT(requestReaderRegisterMap(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(newTagCount(int)), ui.tagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(newDifferentTagCount(int)), ui.differentTagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(newOverallDifferentTagCount(int)), ui.overallDifferentTagCountNumber, SLOT(display(int)));
	QObject::connect(m_tagViewManager, SIGNAL(oldTagEntryRemoved(QString,QString)), m_tagManager, SLOT(oldTagEntryRemoved(QString,QString)));
	QObject::connect(m_tagViewManager, SIGNAL(currentReaderChanged(QString)), this, SLOT(currentReaderChanged(QString)));
	QObject::connect(m_tagViewManager, SIGNAL(countTotalTags(QString)), this, SLOT(countTotalTags(QString)));
	splash->showMessage(tr("Connect..."), alignment);

	/* Connect the signals of the gui to the right slots */
	QObject::connect(QrfeTrace::getInstance(), SIGNAL(traceSignal(QString)), 	ui.traceBrowser, SLOT(append(QString)));
	QObject::connect(ui.actionAboutReaderTool, SIGNAL(triggered (bool)), 		m_aboutDialog, SLOT(exec()));
	QObject::connect(ui.actionShow_TagList, SIGNAL(triggered (bool)), 			m_tagListDialog, SLOT(exec()));

	QObject::connect(ui.readerTabWidget, SIGNAL(currentChanged(int)), 			this, SLOT(selectReader(int)));
	QObject::connect(ui.startScanButton, SIGNAL(toggled (bool)), 				this, SLOT(startScan(bool)));
	QObject::connect(ui.handleActionPushButton, SIGNAL(toggled(bool)), 			this, SLOT(handleActionsToggled(bool)));
	QObject::connect(ui.actionAdd_Serial_Reader, SIGNAL(triggered(bool)), 		this, SLOT(addSerialReader()));
	//Del by yingwei tseng for hiding AMS code, 2010/03/10
	//QObject::connect(ui.actionAdd_Tcp_Reader, SIGNAL(triggered(bool)), 			this, SLOT(addTcpReader()));
	//End by yingwei tseng for hiding AMS code, 2010/03/10	
	QObject::connect(ui.actionHandle_Actions, SIGNAL(triggered(bool)), 			this, SLOT(handleActionsToggled(bool)));
	QObject::connect(ui.actionShow_Alias_Names, SIGNAL(triggered ( bool)), 		this, SLOT(showAliasNames(bool)));
	QObject::connect(ui.actionUse_Time_To_Live, SIGNAL(triggered ( bool)), 		this, SLOT(useTimeToLive(bool)));
	QObject::connect(ui.actionPreferences, SIGNAL(triggered ( bool)), 			this, SLOT(showSettings()));
	QObject::connect(ui.actionOpen_Register_Map, SIGNAL(triggered ( bool)), 	this, SLOT(showRegisterMap()));
	QObject::connect(ui.clearButton, SIGNAL(clicked()), 						m_readRateCalc, SLOT(clearResults()));
	QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), 			m_readRateCalc, SLOT(clearResults()));
	QObject::connect(ui.clearButton, SIGNAL(clicked()), 						m_tagViewManager, SLOT(clearTags()));
	QObject::connect(ui.actionClear_Tags, SIGNAL(triggered (bool)), 			m_tagViewManager, SLOT(clearTags()));
	QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), 			m_tagViewManager, SLOT(clearOfflineReader()));
	QObject::connect(ui.clearOfflineReaderButton, SIGNAL(clicked()), 			this, SLOT(clearOfflineReader()));
	QObject::connect(ui.actionClear_Offline_Reader, SIGNAL(triggered(bool)), 	m_tagViewManager, SLOT(clearOfflineReader()));

	QObject::connect(m_gen2SettingsDialog,    SIGNAL(easterKeyUnlocked()),      this, SLOT(easterKeyUnlocked()));

	/* Create the scan timer to get the end of the scan */
	m_scanTimer = new QTimer(this);
	m_scanTimer->setSingleShot(true);
	QObject::connect(m_scanTimer, SIGNAL(timeout()), this, SLOT(stopScan()));

	/* Create timer for the scan progress bar */
	m_scanProgressTimer = new QTimer(this);
	m_scanProgressTimer->setSingleShot(false);
	m_scanProgressTimer->setInterval(1000);

	m_regMapWindow = NULL;

	/* Connect to the Reader Manager */
	QObject::connect(this, SIGNAL(currentReaderChanged(QrfeReaderInterface*)), m_amsComWrapper, SLOT(gotReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), m_amsComWrapper, SLOT(lostReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(gotReader(QrfeReaderInterface*)), this, SLOT(gotReader(QrfeReaderInterface*)));
	QObject::connect(&m_readerManager, SIGNAL(lostReader(QrfeReaderInterface*)), this, SLOT(lostReader(QrfeReaderInterface*)));

    //Add by yingwei tseng for using bar to set power, 2010/07/09
    QObject::connect(ui.powerSlider, SIGNAL(valueChanged(int)), this, SLOT(powerSliderChange(int)));
	//End by yingwei tseng for using bar to set power, 2010/07/09

	/* Create the timer for the multiplexer control */
	m_multiplexTimer = new QTimer(this);
	m_multiplexTimer->setSingleShot(true);
	m_multiplexTimer->setInterval(m_settingsDialog->multiplexTime());
	QObject::connect(m_multiplexTimer, SIGNAL(timeout()), this, SLOT(multiplexISR()));

	/* Finally set up the gui */
	ui.traceDockWidget->setVisible(false);
	ui.informationBox->setVisible(false);
	ui.actionShow_Alias_Names->setChecked(m_settingsDialog->showAlias());
	ui.actionUse_Time_To_Live->setChecked(m_settingsDialog->useTtl());

	splash->showMessage(tr("Starting up..."), alignment);
	ActivateSettings();
	Sleep(1000);
	splash->close();

	//Add by yingwei tseng for hiding AMS code, 2010/03/10
	ui.handleActionPushButton->hide();
	ui.clearOfflineReaderButton->hide();
	//ui.actionAdd_Serial_Reader->setVisible(false);
	ui.actionAdd_USB->setVisible(false);
	ui.actionAdd_Tcp_Reader->setVisible(false);
	ui.actionHandle_Actions->setVisible(false);
	ui.actionClear_Offline_Reader->setVisible(false);
	//End by yingwei tseng for hiding AMS code, 2010/03/10

	//Add by yingwei tseng for hiding items, 2010/12/08
    ui.actionShow_Alias_Names->setVisible(false);
	ui.actionUse_Time_To_Live->setVisible(false);
	ui.actionShow_Trace_Browser->setVisible(false);
	ui.actionShow_TagList->setVisible(false);
	//End by yingwei tseng for hiding items, 2010/12/08
	ui.groupBox_3->hide();
}
コード例 #5
0
ファイル: main.cpp プロジェクト: vmichele/RAY_TRACER
int main(int argc, char** argv) {

    //ImplicitSurface s(Color(), Material(), "x^3+x^2y+x^2z+xy^2+xyz+xz^2+y^3+y^2z+yz^2+z^3+x^2+xy+xz+y^2+yz+z^2+x+y+z-9");
    //ImplicitSurface s(Color(), Material(), "x^2+y^2+z^2-9");
    //ImplicitSurface s(Color(), Material(), "2x^4-3xy+5xz^2+yz^2-xy+4y-6+2z^3+3z^2y^2");
    //ImplicitSurface s(Color(), Material(), "x^2+y^2+z^2-9");
    /*cerr << s.getEquation().toStdString() << endl;
    cerr << s.getParsedEq().getFormatedExpr().toStdString() << endl;
    cerr << s.getConstant() << endl;
    cerr << s.getDeg1Mat() << endl;
    cerr << s.getDeg2Mat() << endl;
    cerr << s.getDeg3Mat() << endl;
    cerr << s.getDeg4Mat() << endl;*/
    //cerr << s.normal(Vector3(3, 1, 2)) << endl;
    //cerr << s.ensIntersect(Ray(Vector3(-4, 0, 0), Vector3(1, 0, 0))).at(0) << endl;
    //cerr << s.ensIntersect(Ray(Vector3(-4, 0, 0), Vector3(1, 0, 0))).at(1) << endl;


    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve3degree(.0, .0, .0, .0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve3degree(1.0, 2.0, 1.0, 0.0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve3degree(1.0, 0.0, -1.0, 0.0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve3degree(1.0, -3.0, 3.0, -1.0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve3degree(1.0, -2.0, -1.0, 2.0));

    //vector<double> sol3 = Solver::solve4degree(1.0, 4.0, 6.0, 4.0, 1.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, -4.0, 6.0, -4.0, 1.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 2.0, 0.0, -2.0, -1.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 4.0, 3.0, -4.0, -4.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 0.0, -5.0, 0.0, 4.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 0.0, -2.0, 0.0, 1.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 3.0, 3.0, 1.0, 0.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 1.0, -1.0, -1.0, 0.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 2.0, -1.0, -2.0, 0.0);
    //vector<double> sol3 = Solver::solve4degree(1.0, 0.0, 0.0, 0.0, 1.0);
    /*

    for (int k = 0; k < sol3.size(); k++) {
        qDebug() << sol3.at(k);
    }

    cerr << "#######################" << endl;

    int k = 0;
    for (; k < sol3.size(); k++) {
        if (sol3.at(k) >= 0) {
            break;
        }
    }

    sol3.erase(sol3.begin(), sol3.begin()+k);

    for (int k = 0; k < sol3.size(); k++) {
        qDebug() << sol3.at(k);
    }

    //*/

    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve4degree(1.0, 1.0, -3.0, -1.0, 2.0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve4degree(1.0, 0.0, -2.0, 0.0, 1.0));
    //vector<double> sol3 = Solver::getRealSortedSol(Solver::solve4degree(1.0, -4.0, 6.0, -4.0, 1.0));

/*
    cerr << "(2, 5, -12)" << endl;
    for (int k = 0; k < sol3.size(); k++) {
        cerr << sol3.at(k) << endl;
    }


    Vector3 OM(0, 0, 1);
    Vector3 Oz(0, 1, 0);
    double _theta = atan((cross_product(OM, Oz)).norm() / dot_product(OM, Oz));

    QMessageBox::information(0, "Test0", QSt
            vector<double> sol1 = Solver::solve2degree(2, 5, -12);ring::number(_theta/M_PI));

    Ray ray(Vector3(0, 0, 0),
            Vector3(0, 1, 0)
         );

    Vector3 origin = ray[0];
    Vector3 direction = ray[1];
    Ray newRay(Vector3(-sin(_theta)*origin[0] + _translation[0], cos(_theta)*origin[1] + _translation[1], origin[2]+_translation[2]),
               Vector3(cos(_theta)*direction[0], sin(_theta)*direction[1], direction[2]));


    Quadrics qSphere(Color(), Material(), 1, 1, 1, 0, 0, 0, 0, 0, 0, -9);
    Sphere sphere(Color(), Material(), Vector3(), 3);



    for (int i = -40; i < 40; i++) {
        for (int j = -30; j < 30; j++) {
            Ray ray(Vector3(-10, 0, 0), Vector3(1, i, j));

            vector<double> qInter = qSphere.ensIntersect(ray);
            vector<double> inter = sphere.ensIntersect(ray);

            if (qInter.size() > 0 &&  inter.size() > 0) {

                cerr << qInter.at(0) << " " << inter.at(0) << endl;
            }
        }
    }


    Ray ray(Vector3(-10, 0, 0), Vector3(1, 0, 0));

    vector<double> qInter = qSphere.ensIntersect(ray);
    vector<double> inter = sphere.ensIntersect(ray);

    cerr << "qInter " << endl;
    for (int k = 0; k < qInter.size(); k++) {
        cerr << qInter.at(k) << endl;
    }

    cerr << "inter " << endl;
    for (int k = 0; k < inter.size(); k++) {
        cerr << inter.at(k) << endl;
    }

    Vector3 qNormal = qSphere.normal(ray.getPoint(qInter.at(0)));
    cerr << "qNormal " << endl << qNormal << endl;

    Vector3 normal = sphere.normal(ray.getPoint(inter.at(0)));
    cerr << "normal " << endl << normal << endl;

/*


    QStringList params;
    params << "x^2-y^2-z^2" << "2xz" << "2xy" << "x^2+y^2+z^2";
    Surface sphere = Surface(Color(), Material(), params);

    Ray rayon(Vector3(0, -2, 0), Vector3(0, 1, 0));

    cerr << "Intersections" << endl;
    vector<double> inter = sphere.ensIntersect(rayon);
    for (int k = 0; k < inter.size(); k++) {
        cerr << inter.at(k) << endl;
    }



    MatrixOpp mo;
    itpp::mat test = "7.11726e-16 0; 0 2.24717e-16";
    cerr << test << endl;
    cerr << mo.rank(test, pow(10, -10)) << endl;

    //itpp::mat test = "1.40508 -1.2714; 0.354598 0.490605";
    //itpp::vec testSing = svd(test);
    //cerr << test << endl;
    //cerr << testSing << endl;

    //itpp::mat testDel = "1.40508 -1.2714 0.354598 -1.2714 0.490605; 1.40508 -1.2714 0.354598 -1.2714 0.490605";
    //testDel.del_cols(3, 4);
    //cerr << testDel << endl;


    /*
    itpp::mat MatA="-0.107357 -0.0510009 0.830732 0.216346 0.0731312 0.545236 0.598673 0.435944 -0.174946 -0.0154371 0.0188213; 0.394865 0.684388 -0.609272 -0.00989498 0.0179188 -0.0925767 0.445025 0.890383 -0.0217646 0.834316 -0.571974; -0.0386261 -0.126441 0.0246027 0.46594 0.752696 0.316755 0.543039 0.534491 -0.762077 -0.332822 0.558157; -0.172559 1.07088 -0.00299878 0.601361 -0.119217 -0.300484 -0.123059 0.256296 0.430866 -0.801376 0.317803; -0.178008 0.0443514 -0.322137 -0.269033 0.756054 0.325227 0.24626 0.29693 1.14214 0.472322 0.349494; -0.0274508 -0.259354 -0.383347 0.14874 0.275636 -0.348788 -0.0465805 0.731172 -0.188873 -0.609764 0.361292";
    itpp::mat MatB="-0.119899 -0.0323817 0.428454 0.0186514 0.00329174 0.0354584 0.278651 0.233471 -0.0232638 -0.00133084 -0.00467978; 0.0330396 0.318083 -0.163199 0.0262524 0.0825663 -0.0136418 -0.0788958 0.43979 -0.104738 0.414932 -0.283949; 0.0191853 0.0191573 -0.132727 0.188931 0.385542 0.145688 0.177995 -0.032711 -0.386778 -0.0134809 0.245401; -0.00388032 0.542053 0.00900084 0.0919673 -0.0771502 -0.0154893 -0.0814925 0.164284 0.112838 -0.385796 0.260114; -0.100031 0.0119408 -0.136066 -0.21962 0.422891 0.168009 0.166844 0.0380245 0.507365 0.0156707 0.0228195; 0.0429022 -0.132374 -0.138398 0.0694264 -0.0216792 -0.0100782 -0.091603 0.366442 0.0347433 -0.304529 0.0720361";

    Pencil pen(MatA, MatB);

    std::cerr << "########################################" << std::endl;
    std::cerr << "A=" << pen.A << std::endl;
    std::cerr << "B=" << pen.B << std::endl;
    std::cerr << "########################################" << std::endl;
    //*/

//*

    QApplication app(argc, argv);

    QSplashScreen* splash = new QSplashScreen(QPixmap("misc/splash.png"), Qt::WindowStaysOnTopHint);
    splash->show();

    splash->showMessage("Loading...", Qt::AlignBottom, Qt::white);

    MainWindow window;
    window.show();

    qApp->setStyleSheet("QStringListModel QAbstractItemView { border: 2px solid darkgray; selection-background-color: lightgray; }");

    splash->finish(&window);

    return app.exec();
//*/
}
コード例 #6
0
ファイル: companion.cpp プロジェクト: CoyotteDundee/opentx
int main(int argc, char *argv[])
{
  Q_INIT_RESOURCE(companion);
  QApplication app(argc, argv);
  app.setApplicationName("OpenTX Companion");
  app.setOrganizationName("OpenTX");
  app.setOrganizationDomain("open-tx.org");
  app.setAttribute(Qt::AA_DontShowIconsInMenus, false);

#ifdef __APPLE__
  app.setStyle(new MyProxyStyle);
#endif

  QTranslator companionTranslator;
  companionTranslator.load(":/companion_" + g.locale());
  QTranslator qtTranslator;
  qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
  app.installTranslator(&companionTranslator);
  app.installTranslator(&qtTranslator);

  QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));

#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
  uint32_t sdlFlags = 0;
  #ifdef JOYSTICKS
    sdlFlags |= SDL_INIT_JOYSTICK;
  #endif
  #ifdef SIMU_AUDIO
    sdlFlags |= SDL_INIT_AUDIO;
  #endif
  if (SDL_Init(sdlFlags) < 0) {
    fprintf(stderr, "ERROR: couldn't initialize SDL: %s\n", SDL_GetError());
  }
#endif

  RegisterEepromInterfaces();
  registerOpenTxFirmwares();

  if (g.profile[g.id()].fwType().isEmpty()){
    g.profile[g.id()].fwType(default_firmware_variant->getId());
    g.profile[g.id()].fwName("");
  }

  QString splashScreen;
  if ( g.profile[g.id()].fwType().contains("taranis"))     splashScreen = ":/images/splasht.png";
  else if ( g.profile[g.id()].fwType().contains("9xrpro")) splashScreen = ":/images/splashp.png";
  else if ( g.profile[g.id()].fwType().contains("9xr"))    splashScreen = ":/images/splashr.png";
  else  splashScreen = ":/images/splash.png";

  QPixmap pixmap = QPixmap(splashScreen);
  QSplashScreen *splash = new QSplashScreen(pixmap);

  current_firmware_variant = GetFirmware(g.profile[g.id()].fwType());

  MainWindow *mainWin = new MainWindow();
  if (g.showSplash()) {
    splash->show();
    QTimer::singleShot(1000*SPLASH_TIME, splash, SLOT(close()));
    QTimer::singleShot(1000*SPLASH_TIME, mainWin, SLOT(show()));
  }
  else {
    mainWin->show();
  }

  int result = app.exec();

  delete splash;
  delete mainWin;

  UnregisterFirmwares();
  UnregisterEepromInterfaces();

#if defined(JOYSTICKS) || defined(SIMU_AUDIO)
  SDL_Quit();
#endif

  return result;
}
コード例 #7
0
ファイル: main.cpp プロジェクト: VivekVetri/noobs
int main(int argc, char *argv[])
{
    GpioInput gpio(3);
    QApplication a(argc, argv);
    RightButtonFilter rbf;
    QString currentLangCode;
    bool runinstaller = false;

    // Process command-line arguments
    for (int i=1; i<argc; i++)
    {
        if (strcmp(argv[i], "-runinstaller") == 0)
            runinstaller = true;
        else if (strcmp(argv[i], "-lang") == 0)
            if (argc > i+1)
                currentLangCode = argv[++i];
    }

    // Intercept right mouse clicks sent to the title bar
    a.installEventFilter(&rbf);

#ifdef Q_WS_QWS
    QWSServer::setCursorVisible(false);

    // Set wallpaper and icon, if we have resource files for that
    if (QFile::exists(":/icons/raspberry_icon.png"))
        a.setWindowIcon(QIcon(":/icons/raspberry_icon.png"));

    //if (QFile::exists(":/wallpaper.png"))
    // {
//#ifdef CENTER_BACKGROUND_IMAGE
        // Using QSplashScreen to get a centered background image
        QWSServer::setBackground(BACKGROUND_COLOR);
        QSplashScreen *splash = new QSplashScreen(QPixmap(":/wallpaper.png"));
        splash->show();
        QApplication::processEvents();
//#else
        // Scale background image to fit screen
//        QRect dim = a.desktop()->availableGeometry();
        //       QWSServer::setBackground(QImage(":/wallpaper.png").scaled(dim.width(), dim.height()));
//#endif
//    }
//    else
//    {
//        QWSServer::setBackground(BACKGROUND_COLOR);
        //   }
//#endif
#endif

    // If -runinstaller is not specified, only continue if SHIFT is pressed, GPIO is triggered or no OS is installed (/dev/mmcblk0p6 does not exist)
    bool bailout = !runinstaller
         && gpio.value() != 0
         && !KeyDetection::isF10pressed()
         && QFile::exists(FAT_PARTITION_OF_IMAGE);

    if (bailout)
    {
        reboot_to_extended();
        //return 1;
    }

    // Keyboard detection done, load normal hid driver
    QProcess::execute("/sbin/modprobe usbhid");

#ifdef Q_WS_QWS
    QWSServer::setCursorVisible(true);
#endif

#ifdef ENABLE_LANGUAGE_CHOOSER
    // Language chooser at the bottom center
    LanguageDialog* ld = new LanguageDialog(&currentLangCode);
    ld->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter | Qt::AlignBottom, ld->size(), a.desktop()->availableGeometry()));
    ld->show();
#endif

    // Main window in the middle of screen
    MainWindow mw(&currentLangCode, splash, ld);
    mw.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mw.size(), a.desktop()->availableGeometry()));
    mw.show();

    a.exec();
    reboot_to_extended();

    return 0;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: XECDesign/noobs
int main(int argc, char *argv[])
{
    bool hasTouchScreen = QFile::exists("/sys/devices/platform/rpi_ft5406");

    // Unless we have a touch screen, wait for keyboard to appear before displaying anything
    if (!hasTouchScreen)
        KeyDetection::waitForKeyboard();

    int rev = readBoardRevision();

    qDebug() << "Board revision is " << rev;

    int gpioChannel;

    if (rev == 2 || rev == 3)
        gpioChannel = 0;
    else
        gpioChannel = 2;

    QApplication a(argc, argv);
    RightButtonFilter rbf;
    LongPressHandler lph;
    GpioInput gpio(gpioChannel);

    bool runinstaller = false;
    bool gpio_trigger = false;
    bool keyboard_trigger = true;
    bool force_trigger = false;

    QString defaultLang = "en";
    QString defaultKeyboard = "gb";
    QString defaultDisplay = "0";
    QString defaultPartition = "800";

    // Process command-line arguments
    for (int i=1; i<argc; i++)
    {
        // Flag to indicate first boot
        if (strcmp(argv[i], "-runinstaller") == 0)
            runinstaller = true;
        // Enables use of GPIO 3 to force NOOBS to launch by pulling low
        else if (strcmp(argv[i], "-gpiotriggerenable") == 0)
            gpio_trigger = true;
        // Disables use of keyboard to trigger recovery GUI
        else if (strcmp(argv[i], "-keyboardtriggerdisable") == 0)
            keyboard_trigger = false;
        // Forces display of recovery GUI every time
        else if (strcmp(argv[i], "-forcetrigger") == 0)
            force_trigger = true;
        // Allow default language to be specified in commandline
        else if (strcmp(argv[i], "-lang") == 0)
        {
            if (argc > i+1)
                defaultLang = argv[i+1];
        }
        // Allow default keyboard layout to be specified in commandline
        else if (strcmp(argv[i], "-kbdlayout") == 0)
        {
            if (argc > i+1)
                defaultKeyboard = argv[i+1];
        }
        // Allow default display mode to be specified in commandline
        else if (strcmp(argv[i], "-dispmode") == 0)
        {
            if (argc > i+1)
                defaultDisplay = --argv[i+1];
        }
        // Allow default boot partition to be specified in commandline
        else if (strcmp(argv[i], "-partition") == 0)
        {
            if (argc > i+1)
                defaultPartition = argv[i+1];
        }
    }

    // Intercept right mouse clicks sent to the title bar
    a.installEventFilter(&rbf);

    // Treat long holds as double-clicks
    if (hasTouchScreen)
        a.installEventFilter(&lph);

#ifdef Q_WS_QWS
    QWSServer::setCursorVisible(false);
#endif

    QDir settingsdir;
    settingsdir.mkdir("/settings");

    // Set wallpaper and icon, if we have resource files for that
    if (QFile::exists(":/icons/raspberry_icon.png"))
        a.setWindowIcon(QIcon(":/icons/raspberry_icon.png"));

#ifdef Q_WS_QWS
    QWSServer::setBackground(BACKGROUND_COLOR);
#endif
    QSplashScreen *splash = new QSplashScreen(QPixmap(":/wallpaper.png"));
    splash->show();
    QApplication::processEvents();

    // Wait for drive device to show up
    QString drive;
    bool driveReady = false;
    QTime t;
    t.start();

    while (t.elapsed() < 10000)
    {
        if (drive.isEmpty())
        {
            /* We do not know the exact drive name to wait for */
            drive = findRecoveryDrive();
            if (!drive.isEmpty())
            {
                driveReady = true;
                break;
            }
        }
        else if (drive.startsWith("/dev"))
        {
            if (QFile::exists(drive))
            {
                driveReady = true;
                break;
            }
        }

        QApplication::processEvents(QEventLoop::WaitForMoreEvents, 100);
    }
    if (!driveReady)
    {
        QMessageBox::critical(NULL, "Files not found", QString("Cannot find the drive with NOOBS files %1").arg(drive), QMessageBox::Close);
        return 1;
    }
    qDebug() << "NOOBS drive:" << drive;

    // If -runinstaller is not specified, only continue if SHIFT is pressed, GPIO is triggered,
    // or no OS is installed (/settings/installed_os.json does not exist)
    bool bailout = !runinstaller
        && !force_trigger
        && !(gpio_trigger && (gpio.value() == 0 ))
        && hasInstalledOS(drive);

    if (bailout && keyboard_trigger)
    {
        t.start();

        while (t.elapsed() < 2000)
        {
            QApplication::processEvents(QEventLoop::WaitForMoreEvents, 10);
            if (QApplication::queryKeyboardModifiers().testFlag(Qt::ShiftModifier))
            {
                bailout = false;
                qDebug() << "Shift detected";
                break;
            }
            if (hasTouchScreen && QApplication::mouseButtons().testFlag(Qt::LeftButton))
            {
                bailout = false;
                qDebug() << "Tap detected";
                break;
            }
        }
    }

    if (bailout)
    {
        splash->hide();
        showBootMenu(drive, defaultPartition, true);
    }

#ifdef Q_WS_QWS
    QWSServer::setCursorVisible(true);
#endif

    // Main window in the middle of screen
    MainWindow mw(drive, defaultDisplay, splash);
    mw.setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mw.size(), a.desktop()->availableGeometry()));
    mw.show();

#ifdef ENABLE_LANGUAGE_CHOOSER
     // Language chooser at the bottom center
    LanguageDialog* ld = new LanguageDialog(defaultLang, defaultKeyboard);
    ld->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignHCenter | Qt::AlignBottom, ld->size(), a.desktop()->availableGeometry()));
    ld->show();
#endif

    a.exec();
    showBootMenu(drive, defaultPartition, false);

    return 0;
}
コード例 #9
0
ファイル: main.cpp プロジェクト: FloArt/qrecipewriter
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QString openFilename = NULL;
    if (a.arguments().count() > 1) {
        QFile *oFile = new QFile(a.arguments()[1]);
        if (oFile->exists()) {
            openFilename = oFile->fileName();
        }
    }
    QSplashScreen *splash = new QSplashScreen;
    splash -> setPixmap(QPixmap(":/images/splash.png"));
    splash->show();
    QTimer::singleShot(2000,splash,SLOT(close())); //Start splash screen and keep it 2 seconds
#ifdef Q_OS_LINUX
    systExp = "linuxAutre"; //Operating system of the user
    QFile fileOs ("/etc/os-release");
    if (fileOs.exists())
    {
        fileOs.open(QFile::ReadOnly);
        QTextStream stream (&fileOs);
        QString osTxt = stream.readAll();
        if (osTxt.contains("ID=slackware")) {
            systExp = "linuxSlackware";
        }
        else if (osTxt.contains("ID=ubuntu") || osTxt.contains("ID=debian")) {
            systExp = "linuxDebian";
        }
        else if (osTxt.contains("ID=arch") || osTxt.contains("ID=manjaro")) {
            systExp = "linuxArch";
        }
        fileOs.close();
    }
#else
    systExp = "windows";
#endif

    //Define confFile:
    confFile  = confDir +".config";

    //Set locale:
    QString locale = QLocale::system().name();
    appI18n = locale.split("_")[0] == "fr" ? "fr" : "en";

    //Load config:
    QFile configFile(confFile);
    if (configFile.exists()) {
        Functions::loadConfig();
    }
    QTranslator translator;
    translator.load(QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
    QString trFile = ":/i18n/qrecipewriter_"+ appI18n +".qm";
    if (QFile(trFile).exists()) {
        translator.load(trFile);
    }
    a.installTranslator(&translator);

    //Define other variables:
    QString tmp = confDir + ".cats";
    confCatFile = new QFile(tmp);
    #ifdef Q_OS_LINUX
    QFile fileDictTest1 ("/usr/share/myspell/dicts/fr_FR.dic");
    QFile fileDictTest2 ("/usr/share/myspell/dicts/fr_FR.aff");
    if (fileDictTest1.exists() && fileDictTest2.exists())
    {
        corrOrtho = "/usr/share/myspell/dicts/fr_FR";
    }
    #else
        #if _WIN64
            QFile fileDictTest1 ("C:/hunspellX64/dicts/fr.dic");
            QFile fileDictTest2 ("C:/hunspellX64/dicts/fr.aff");
            if (fileDictTest1.exists() && fileDictTest2.exists())
            {
                corrOrtho = "C:/hunspellX64/dicts/fr";
            }
        #else
            QFile fileDictTest1 ("C:/hunspellI686/dicts/fr.dic");
            QFile fileDictTest2 ("C:/hunspellI686/dicts/fr.aff");
            if (fileDictTest1.exists() && fileDictTest2.exists())
            {
                corrOrtho = "C:/hunspellI686/dicts/fr";
            }
        #endif
    #endif

    QRecipeWriter w;
    w.openStartupFile = openFilename;

    //Define Dialogs:
    Apropos *apropos = new Apropos(&w);
    ptr2apropos = apropos;
    QDir tmpD (dirTmp);
    if (configFile.exists())
    {
        w.init();
        if (!tmpD.exists())
        {
            tmpD.mkpath(".");
        }
        QTimer::singleShot(2000,&w,SLOT(launch())); //Start the application
    }
    else
    {
        QTimer::singleShot(2000,&w,SLOT(config())); //Start initial config
    }
    return a.exec();
}
コード例 #10
0
ファイル: mainwindow.cpp プロジェクト: leoStone/MyBrowser
MainWindow::MainWindow(QString file_adress, QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    process = new QProcess(this);

    pfad = QCoreApplication::applicationDirPath();

    QString buffer = QCoreApplication::applicationDirPath();
    buffer.append("\\update.exe");

    if(QFile::exists(buffer) == true)
    {
        QDesktopServices::openUrl(QUrl::fromLocalFile(buffer));

        process->terminate();

    }

    QSplashScreen *splash = new QSplashScreen(QPixmap(":/tbicons/img/logo.png"), Qt::WindowStaysOnTopHint);
    splash->show();
    splash->showMessage("Laden...", Qt::AlignBottom | Qt::AlignCenter);

    ui->setupUi(this);
    this->hide();

    set = new settings(this);
    icon = new favicon(this);
    search_result = new gsuggests(ui->lineEdit);
    versionspruefung = new update_vers(this);
    versionspruefung->run_request_for_for_update();
    cookie = new cookiejar(this, set->en_cookies);
    bok = new bookmarks(this, ui->tree_bookmarks, ui->but_hinzu, ui->but_edit, ui->but_addFolder);
    download = new DownloadManager(this, qnam);

    m_faviconTimer = new QTimer(this);
    m_editorTimer = new QTimer(this);


    qnam = new QNetworkAccessManager(this);
    page = new QWebPage(this);

    ui->webView->setPage(page);
    ui->webView->page()->setNetworkAccessManager(qnam);
    QWebSettings::setIconDatabasePath(pfad);
    QWebSettings::setOfflineStoragePath((pfad + tr("\\offline_cache")));

    QString cache_path = pfad;
    cache_path.append("\\cache");
    cache = new QNetworkDiskCache(qnam);
    cache->setCacheDirectory(cache_path);
    qnam->setCache(cache);

    qnam->setCookieJar(cookie);


    // Bei klick auf Hme Button oder F6 funktion home aufrufen
    connect(ui->home_button, SIGNAL(clicked()), this, SLOT(home()));
    //Bei einem ändern der URl die neu_address auf rufen
    connect(ui->webView, SIGNAL(urlChanged(QUrl)), this, SLOT(neu_adresse(QUrl)));

    connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(neu_adresse_ein()));

    connect(ui->webView, SIGNAL(loadStarted()), this, SLOT(load_in_progress()));

    connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(load_finished(bool)));

    connect(ui->reload_button, SIGNAL(clicked()), this, SLOT(reload_button()));

    connect(ui->webView, SIGNAL(iconChanged()), this, SLOT(icon_changed()));

    connect(ui->webView, SIGNAL(titleChanged(QString)), this, SLOT(titelChanged(QString)));

    connect(ui->but_book, SIGNAL(clicked()), this, SLOT(showBar()));

    connect(ui->webView, SIGNAL(loadProgress(int)), ui->barLoadProgress, SLOT(setValue(int)));

    connect(ui->sliderrSiteZoom, SIGNAL(valueChanged(int)), this, SLOT(sliderSliding(int)));
    connect(ui->butSetZoomToNorm, SIGNAL(clicked()), this, SLOT(sliderSliding()));

    //für bookmarks
    connect(ui->tree_bookmarks, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(openBookmark(QTreeWidgetItem*, int)));

    //connections für favicons
    connect(icon, SIGNAL(neuer_icon()), this, SLOT(neuer_icon()));
    connect(icon, SIGNAL(standart_icon()), this, SLOT(set_standart_icon()));
    connect(m_faviconTimer, SIGNAL(timeout()), this, SLOT(lookForNewFavicon()));

    //connections für settings
    connect(ui->but_settings, SIGNAL(clicked()), set, SLOT(show()));
    connect(set, SIGNAL(requestForValues()), this, SLOT(returnRequestedValues()));
    connect(set, SIGNAL(settingsChagned()), this, SLOT(settingsChanged()));
    connect(set, SIGNAL(requestForCurrentPage()), this, SLOT(requestForCurrentPage()));
    connect(set->ui->but_cl_cache, SIGNAL(clicked()), this, SLOT(requestForCacheClearing()));
    //für qnam
    connect(qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(authentification_requied(QNetworkReply*,QAuthenticator*)));

    //für downloads
    connect(page, SIGNAL(downloadRequested(QNetworkRequest)), download, SLOT(Download(QNetworkRequest)));
    connect(ui->butDownloadManager, SIGNAL(clicked()), download, SLOT(show()));

    ui->lineEdit->installEventFilter(this);

    if(file_adress != NULL)
        ui->webView->load(QUrl(file_adress));
    else
    {
        if(!set->en_homePage)
            ui->webView->load(QUrl(set->lastUrl));
        else
            ui->webView->load(QUrl(set->path_cur_home));
    }

    this->resize(set->size);
    this->move(set->point);
    if(set->en_max)
        this->showMaximized();

    if(!set->en_treeBar)
        ui->tabWidget->hide();


    splash->finish(this);
    this->show();

    m_faviconTimer->start(3000);
    shutted = true;


}
コード例 #11
0
ファイル: main.cpp プロジェクト: Mr-Kumar-Abhishek/qt
QT_USE_NAMESPACE

int main(int argc, char **argv)
{
    Q_INIT_RESOURCE(linguist);

    QApplication app(argc, argv);
    QApplication::setOverrideCursor(Qt::WaitCursor);

    QStringList files;
    QString resourceDir = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
    QStringList args = app.arguments();

    for (int i = 1; i < args.count(); ++i) {
        QString argument = args.at(i);
        if (argument == QLatin1String("-resourcedir")) {
            if (i + 1 < args.count()) {
                resourceDir = QFile::decodeName(args.at(++i).toLocal8Bit());
            } else {
                // issue a warning
            }
        } else if (!files.contains(argument)) {
            files.append(argument);
        }
    }

    QTranslator translator;
    QTranslator qtTranslator;
    QString sysLocale = QLocale::system().name();
    if (translator.load(QLatin1String("linguist_") + sysLocale, resourceDir)) {
        app.installTranslator(&translator);
        if (qtTranslator.load(QLatin1String("qt_") + sysLocale, resourceDir))
            app.installTranslator(&qtTranslator);
        else
            app.removeTranslator(&translator);
    }

    app.setOrganizationName(QLatin1String("Trolltech"));
    app.setApplicationName(QLatin1String("Linguist"));

    QSettings config;

    QWidget tmp;
    tmp.restoreGeometry(config.value(settingPath("Geometry/WindowGeometry")).toByteArray());

    QSplashScreen *splash = 0;
    int screenId = QApplication::desktop()->screenNumber(tmp.geometry().center());
    splash = new QSplashScreen(QApplication::desktop()->screen(screenId),
        QPixmap(QLatin1String(":/images/splash.png")));
    if (QApplication::desktop()->isVirtualDesktop()) {
        QRect srect(0, 0, splash->width(), splash->height());
        splash->move(QApplication::desktop()->availableGeometry(screenId).center() - srect.center());
    }
    splash->setAttribute(Qt::WA_DeleteOnClose);
    splash->show();

    MainWindow mw;
    mw.show();
    splash->finish(&mw);
    QApplication::restoreOverrideCursor();

    mw.openFiles(files, true);

    return app.exec();
}
コード例 #12
0
ファイル: mainwindow.cpp プロジェクト: nfrey/qreal
MainWindow::MainWindow()
	: mUi(new Ui::MainWindowUi)
	, mCloseEvent(NULL)
	, mModels(NULL)
	, mListenerManager(NULL)
	, mPropertyModel(mEditorManager)
	, mGesturesWidget(NULL)
	, mVisualDebugger(NULL)
	, mRobotInterpreter(NULL)
	, mBluetoothCommunication(NULL)
	, mErrorReporter(NULL)
{
	QSettings settings("SPbSU", "QReal");
	bool showSplash = settings.value("Splashscreen", true).toBool();
	QSplashScreen* splash =
			new QSplashScreen(QPixmap(":/icons/kroki3.PNG"), Qt::SplashScreen | Qt::WindowStaysOnTopHint);

	QProgressBar *progress = new QProgressBar((QWidget*) splash);
	progress->move(20, 270);
	progress->setFixedWidth(600);
	progress->setFixedHeight(15);
	progress->setRange(0, 100);

	// Step 1: splash screen loaded, progress bar initialized.
	progress->setValue(5);
	if (showSplash)
	{
		splash->show();
		QApplication::processEvents();
	}
	mUi->setupUi(this);

	mUi->tabs->setTabsClosable(true);
	mUi->tabs->setMovable(true);
	mUi->logicalModelDock->setVisible(false);

	if (!showSplash)
		mUi->actionShowSplash->setChecked(false);

	mUi->minimapView->setRenderHint(QPainter::Antialiasing, true);

	// Step 2: Ui is ready, splash screen shown.
	progress->setValue(20);
	mUi->actionShow_grid->setChecked(settings.value("ShowGrid", true).toBool());
	mUi->actionShow_alignment->setChecked(settings.value("ShowAlignment", true).toBool());
	mUi->actionSwitch_on_grid->setChecked(settings.value("ActivateGrid", true).toBool());
	mUi->actionSwitch_on_alignment->setChecked(settings.value("ActivateAlignment", true).toBool());

	connect(mUi->actionQuit, SIGNAL(triggered()), this, SLOT(close()));

	connect(mUi->actionShowSplash, SIGNAL(toggled(bool)), this, SLOT (toggleShowSplash(bool)));

	connect(mUi->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
	connect(mUi->actionSave, SIGNAL(triggered()), this, SLOT(saveAll()));
	connect(mUi->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
	connect(mUi->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
	connect(mUi->actionMakeSvg, SIGNAL(triggered()), this, SLOT(makeSvg()));

	connect(mUi->actionDeleteFromDiagram, SIGNAL(triggered()), this, SLOT(deleteFromDiagram()));

	connect(mUi->tabs, SIGNAL(currentChanged(int)), this, SLOT(changeMiniMapSource(int)));
	connect(mUi->tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));

	connect(mUi->actionGenerate_Editor, SIGNAL(triggered()), this, SLOT(generateEditor()));
	connect(mUi->actionParse_Editor_xml, SIGNAL(triggered()), this, SLOT(parseEditorXml()));
	connect(mUi->actionPreferences, SIGNAL(triggered()), this, SLOT(showPreferencesDialog()));

	connect(mUi->actionPlugins, SIGNAL(triggered()), this, SLOT(settingsPlugins()));
	connect(mUi->actionShow_grid, SIGNAL(toggled(bool)), this, SLOT(showGrid(bool)));
	connect(mUi->actionShow_alignment, SIGNAL(toggled(bool)), this, SLOT(showAlignment(bool)));
	connect(mUi->actionSwitch_on_grid, SIGNAL(toggled(bool)), this, SLOT(switchGrid(bool)));
	connect(mUi->actionSwitch_on_alignment, SIGNAL(toggled(bool)), this, SLOT(switchAlignment(bool)));

	connect(mUi->actionHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
	connect(mUi->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
	connect(mUi->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));

	connect(mUi->actionShow, SIGNAL(triggered()), this, SLOT(showGestures()));

	connect(mUi->minimapZoomSlider, SIGNAL(valueChanged(int)), this, SLOT(adjustMinimapZoom(int)));

	connect(mUi->actionClear, SIGNAL(triggered()), this, SLOT(exterminate()));

	connect(mUi->actionRun, SIGNAL(triggered()), this, SLOT(run()));
	connect(mUi->actionStop_Running, SIGNAL(triggered()), this, SLOT(stop()));
	connect(mUi->actionStop_Robot, SIGNAL(triggered()), this, SLOT(stopRobot()));
	connect(mUi->actionRobot_Settings, SIGNAL(triggered()), this, SLOT(showRobotSettingsDialog()));

	adjustMinimapZoom(mUi->minimapZoomSlider->value());
	initGridProperties();

	// Step 3: Ui connects are done.
	progress->setValue(40);

	mUi->paletteDock->setWidget(mUi->paletteToolbox);
	mUi->errorDock->setWidget(mUi->errorListWidget);
	mUi->errorListWidget->init(this);
	mUi->errorDock->setVisible(false);
	mUi->propertyEditor->setModel(&mPropertyModel);
	mUi->propertyEditor->verticalHeader()->hide();
	mUi->propertyEditor->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
	mUi->propertyEditor->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
	mUi->propertyEditor->setItemDelegate(&mDelegate);

	connect(mUi->graphicalModelExplorer, SIGNAL(clicked(QModelIndex const &)), this, SLOT(graphicalModelExplorerClicked(QModelIndex)));
	connect(mUi->logicalModelExplorer, SIGNAL(clicked(QModelIndex const &)), this, SLOT(logicalModelExplorerClicked(QModelIndex)));

	mUi->graphicalModelExplorer->addAction(mUi->actionDeleteFromDiagram);
	mUi->logicalModelExplorer->addAction(mUi->actionDeleteFromDiagram);

	// Step 4: Property editor and model explorers are initialized.
	progress->setValue(60);
	loadPlugins();
	showMaximized();

	// Step 5: Plugins are loaded.
	progress->setValue(70);

	settings.beginGroup("MainWindow");
	if (!settings.value("maximized", true).toBool()) {
		showNormal();
		resize(settings.value("size", QSize(1024, 800)).toSize());
		move(settings.value("pos", QPoint(0, 0)).toPoint());
	}
	settings.endGroup();

	QString workingDir = settings.value("workingDir", ".").toString();

	mRootIndex = QModelIndex();
	mModels = new models::Models(workingDir, mEditorManager);

	// Step 6: Save loaded, models initialized.
	progress->setValue(80);

	mListenerManager = new ListenerManager(mEditorManager.listeners()
			, mModels->logicalModelAssistApi(), mModels->graphicalModelAssistApi());

	IdList missingPlugins = mEditorManager.checkNeededPlugins(mModels->logicalRepoApi(), mModels->graphicalRepoApi());
	if (!missingPlugins.isEmpty()) {
		QString text = tr("These plugins are not present, but needed to load the save:\n");
		foreach (Id const id, missingPlugins)
			text += id.editor() + "\n";
		QMessageBox::warning(this, tr("Some plugins are missing"), text);
		close();
		return;
	}
コード例 #13
0
ファイル: entry.cpp プロジェクト: romansokolovski/raiblocks
int run_wallet (QApplication & application, int argc, char * const * argv, boost::filesystem::path const & data_path)
{
	rai_qt::eventloop_processor processor;
	boost::filesystem::create_directories (data_path);
	QPixmap pixmap (":/logo.png");
	QSplashScreen * splash = new QSplashScreen (pixmap);
	splash->show ();
	application.processEvents ();
	splash->showMessage (QSplashScreen::tr ("Remember - Back Up Your Wallet Seed"), Qt::AlignBottom | Qt::AlignHCenter, Qt::darkGray);
	application.processEvents ();
	qt_wallet_config config (data_path);
	auto config_path ((data_path / "config.json"));
	int result (0);
	std::fstream config_file;
	auto error (rai::fetch_object (config, config_path, config_file));
	config_file.close ();
	if (!error)
	{
		boost::asio::io_service service;
		config.node.logging.init (data_path);
		std::shared_ptr<rai::node> node;
		std::shared_ptr<rai_qt::wallet> gui;
		rai::set_application_icon (application);
		auto opencl (rai::opencl_work::create (config.opencl_enable, config.opencl, config.node.logging));
		rai::work_pool work (config.node.work_threads, opencl ? [&opencl](rai::uint256_union const & root_a) {
			return opencl->generate_work (root_a);
		}
		                                                      : std::function<boost::optional<uint64_t> (rai::uint256_union const &)> (nullptr));
		rai::alarm alarm (service);
		rai::node_init init;
		node = std::make_shared<rai::node> (init, service, data_path, alarm, config.node, work);
		if (!init.error ())
		{
			auto wallet (node->wallets.open (config.wallet));
			if (wallet == nullptr)
			{
				auto existing (node->wallets.items.begin ());
				if (existing != node->wallets.items.end ())
				{
					wallet = existing->second;
					config.wallet = existing->first;
				}
				else
				{
					wallet = node->wallets.create (config.wallet);
				}
			}
			if (config.account.is_zero () || !wallet->exists (config.account))
			{
				rai::transaction transaction (wallet->store.environment, nullptr, true);
				auto existing (wallet->store.begin (transaction));
				if (existing != wallet->store.end ())
				{
					rai::uint256_union account (existing->first.uint256 ());
					config.account = account;
				}
				else
				{
					config.account = wallet->deterministic_insert (transaction);
				}
			}
			assert (wallet->exists (config.account));
			update_config (config, config_path, config_file);
			node->start ();
			std::unique_ptr<rai::rpc> rpc = get_rpc (service, *node, config.rpc);
			if (rpc && config.rpc_enable)
			{
				rpc->start ();
			}
			rai::thread_runner runner (service, node->config.io_threads);
			QObject::connect (&application, &QApplication::aboutToQuit, [&]() {
				rpc->stop ();
				node->stop ();
			});
			application.postEvent (&processor, new rai_qt::eventloop_event ([&]() {
				gui = std::make_shared<rai_qt::wallet> (application, processor, *node, wallet, config.account);
				splash->close ();
				gui->start ();
				gui->client_window->show ();
			}));
			result = application.exec ();
			runner.join ();
		}
		else
		{
			show_error ("Error initializing node");
		}
		update_config (config, config_path, config_file);
	}
	else
	{
		show_error ("Error deserializing config");
	}
	return result;
}
コード例 #14
0
ファイル: pokerth.cpp プロジェクト: devbazy/pokerth
int main( int argc, char **argv )
{

	//ENABLE_LEAK_CHECK();

	//_CrtSetBreakAlloc(49937);
	socket_startup();
	curl_global_init(CURL_GLOBAL_NOTHING);

#ifdef __APPLE__
	// The following needs to be done before the application is created, otherwise loading platforms plugin fails.
	QDir dir(argv[0]);
	dir.cdUp();
	dir.cdUp();
	dir.cd("plugins");
	QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif

	/////// can be removed for non-qt-guis ////////////
#ifdef ANDROID
	QApplication a(argc, argv);
	a.setApplicationName("PokerTH");
#else
	SharedTools::QtSingleApplication a( "PokerTH", argc, argv );
	if (a.sendMessage("Wake up!")) {
		return 0;
	}
#endif

	//create defaultconfig
	ConfigFile *myConfig = new ConfigFile(argv[0], false);
	Log *myLog = new Log(myConfig);

	// set PlastiqueStyle even for mac-version to prevent artefacts on styled widgets
#if QT_VERSION < 0x050000
	a.setStyle(new QPlastiqueStyle);
#endif

	QString	myAppDataPath = QString::fromUtf8(myConfig->readConfigString("AppDataDir").c_str());
	//set QApplication default font

	QFontDatabase::addApplicationFont (myAppDataPath +"fonts/n019003l.pfb");
	QFontDatabase::addApplicationFont (myAppDataPath +"fonts/DejaVuSans-Bold.ttf");

#ifdef _WIN32
	QString font1String("QApplication, QWidget, QDialog { font-size: 12px; }");
#elif __APPLE__
	//            QString font1String("font-family: \"Lucida Grande\";");
	QString font1String("QApplication, QWidget, QDialog { font-size: 11px; }");
#elif ANDROID
	QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 26px; }");
	QPalette p = a.palette();
	p.setColor(QPalette::Button, QColor::fromRgb(80,80,80));
	p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
	p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
	p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(130,130,130));
	p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
	p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100));
	p.setColor(QPalette::Link, QColor::fromRgb(192,192,255));
	p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255));
	a.setPalette(p);
#elif MAEMO
	QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 22px; }");
	QPalette p = a.palette();
	p.setColor(QPalette::Button, QColor::fromRgb(80,80,80));
	p.setColor(QPalette::Base, QColor::fromRgb(80,80,80));
	p.setColor(QPalette::Window, QColor::fromRgb(50,50,50));
	p.setColor(QPalette::ButtonText, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor::fromRgb(100,100,100));
	p.setColor(QPalette::WindowText, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgb(100,100,100));
	p.setColor(QPalette::Text, QColor::fromRgb(255,255,255));
	p.setColor(QPalette::Disabled, QPalette::Text, QColor::fromRgb(100,100,100));
	p.setColor(QPalette::Link, QColor::fromRgb(192,192,255));
	p.setColor(QPalette::LinkVisited, QColor::fromRgb(192,192,255));
	a.setPalette(p);
#else
	QString font1String("QApplication, QWidget, QDialog { font-family: \"Nimbus Sans L\"; font-size: 12px; }");
#endif
	a.setStyleSheet(font1String + " QDialogButtonBox, QMessageBox { dialogbuttonbox-buttons-have-icons: 1; dialog-ok-icon: url(:/gfx/dialog_ok_apply.png); dialog-cancel-icon: url(:/gfx/dialog_close.png); dialog-close-icon: url(:/gfx/dialog_close.png); dialog-yes-icon: url(:/gfx/dialog_ok_apply.png); dialog-no-icon: url(:/gfx/dialog_close.png) }");

#ifdef ANDROID
	//check if custom background pictures for the resolution are there. Otherwise create them!
	QString UserDataDir = QString::fromUtf8(myConfig->readConfigString("UserDataDir").c_str());
	QDesktopWidget dw;
	int screenWidth = dw.screenGeometry().width();
	int screenHeight = dw.screenGeometry().height();
	QString customStartWindowBgFileString(UserDataDir+"/startwindowbg10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
	QString customWelcomePokerTHFileString(UserDataDir+"/welcomepokerth10_"+QString::number(screenWidth)+"x"+QString::number(screenHeight)+".png");
	QFile customStartWindowBgFile(customStartWindowBgFileString);
	QFile customWelcomePokerTHFile(customWelcomePokerTHFileString);

	QSplashScreen preSplashFirstRun;
	if(!customStartWindowBgFile.exists()) {

		//load preSplashPix to show that PokerTH is already running during first time pics calculation
		QPixmap prePixBase(":/gfx/logoChip3D.png");
		QPixmap prePix(300, 200);
		prePix.fill(Qt::transparent); // force alpha channel
		{
			QPainter painter(&prePix);
			painter.drawPixmap(0, 0, prePixBase);
			painter.setPen(Qt::white);
			painter.drawText(10, 160, "loading ...");
		}
		preSplashFirstRun.setPixmap(prePix);
		preSplashFirstRun.show();

		QPixmap pix(":/android/android-data/gfx/gui/misc/startwindowbg10_mobile.png");
		pix = pix.scaled(screenWidth, screenHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
		pix.save(customStartWindowBgFileString);
	}

	if(!customWelcomePokerTHFile.exists()) {
		QPixmap base(customStartWindowBgFileString);
		//scale overlay "have a lot of fun" at first
		QPixmap overlay(":/android/android-data/gfx/gui/misc/welcomepokerth10_mobile.png");
		overlay = overlay.scaled(screenWidth, screenHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
		QPixmap result(base.width(), base.height());
		result.fill(Qt::transparent); // force alpha channel
		{
			QPainter painter(&result);
			painter.drawPixmap(0, 0, base);
			painter.drawPixmap(0, 0, overlay);
		}
		result.save(customWelcomePokerTHFileString);
		preSplashFirstRun.hide();
	}

	QPixmap pixmap;
	if(customWelcomePokerTHFile.exists()) {
		pixmap.load(QFileInfo(customWelcomePokerTHFile).absoluteFilePath());
	} else {
		//if custom welcome pic could not be saved locally we need to scale it on the fly
		pixmap.load(":/android/android-data/gfx/gui/misc/welcomepokerth10_mobile.png");
		pixmap = pixmap.scaled(screenWidth, screenHeight, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
	}

#else
	QPixmap pixmap(myAppDataPath + "gfx/gui/misc/welcomepokerth10_desktop.png");
#endif
	StartSplash splash(pixmap);
	if(!myConfig->readConfigInt("DisableSplashScreenOnStartup")) {
		splash.show();
		splash.showMessage(QString("Version %1").arg(POKERTH_BETA_RELEASE_STRING), 0x0042, QColor(255,255,255));
	}

	//Set translations
	QTranslator qtTranslator;
	qtTranslator.load(QString(myAppDataPath +"translations/qt_") + QString::fromStdString(myConfig->readConfigString("Language")));
	a.installTranslator(&qtTranslator);
	QTranslator translator;
	translator.load(QString(myAppDataPath +"translations/pokerth_") + QString::fromStdString(myConfig->readConfigString("Language")));
	a.installTranslator(&translator);

	qRegisterMetaType<unsigned>("unsigned");
	qRegisterMetaType<boost::shared_ptr<Game> >("boost::shared_ptr<Game>");
	qRegisterMetaType<ServerStats>("ServerStats");
	qRegisterMetaType<DenyGameInvitationReason>("DenyGameInvitationReason");
	///////////////////////////////////////////////////

	startWindowImpl mainWin(myConfig,myLog);
#ifdef ANDROID
	mainWin.show();
#else
	a.setActivationWindow(&mainWin, true);
#endif
	int retVal = a.exec();
	curl_global_cleanup();
	socket_cleanup();
	return retVal;
}
コード例 #15
0
ファイル: main.cpp プロジェクト: luckyyd/IMA
int main(int argc, char *argv[])
{
	//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF8"));
	QApplication a(argc, argv);
	//QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
	/*QTextCodec *codec = QTextCodec::codecForName("GB2312");
	QTextCodec::setCodecForLocale(codec);
	QTextCodec::codecForUtfText("GB2312");*/
	QTextCodec *codec = QTextCodec::codecForName("GB18030");
	

	QSplashScreen *splash = new QSplashScreen;
	splash->setPixmap(QPixmap("start.png"));
	splash->show();
	for (int i = 0; i<300; i++)
	{
		splash->repaint();
	}

	#pragma region INVALID CODE
	//QWidget *win0 = new QWidget(0);
	/*
	QtCreate *w1 = new QtCreate(win0);
	w1->resize(1600, 1600);
	MyTimeSolveProject *w2 = new MyTimeSolveProject(win0);
	w2->resize(600, 600);
	*/

	/*MyTimeSolveProject *MyProject = new MyTimeSolveProject();
	QtCreate *w = new QtCreate();
	QHBoxLayout *lay = new QHBoxLayout();
	lay->addWidget(w);
	lay->addWidget(MyProject);
	win0->setLayout(lay);
	win0->show();*/

	//QWidget *win0 = new QWidget(0);
	//QtCreate *w = new QtCreate(win0);

	#pragma endregion

	QtCreate w;
	w.setWindowTitle(codec->toUnicode("IMA环境下多任务实时性能最优化系统"));
	w.show();
	
	splash->finish(&w);
	delete splash;

	//MyTimeSolveProject MyProject(ui.GantWidget);
	//MyTimeSolveProject MyPro(Ui::QtCreateClass);
	////MyTimeSolveProject *myproject = new MyTimeSolveProject(this.ui.GantWidget);
	//
	////MyProject.show();
	///*
	//MyProject.show();
	//*/

	//MyTimeSolveProject  MyProject;
	//MyProject.show();

	#pragma region VIDEOVIEW1
	QWidget *widget1 = new QWidget;
	widget1->resize(400, 300);   //
	widget1->setWindowTitle("View1");
	QVBoxLayout *layout1 = new QVBoxLayout;
	QMediaPlayer* player1 = new QMediaPlayer;
	QVideoWidget* vw1 = new QVideoWidget;

	layout1->addWidget(vw1);
	widget1->setLayout(layout1);

	player1->setVideoOutput(vw1);

	QFile file1("Video02.AVI");
	if (!file1.open(QIODevice::ReadOnly))
		qDebug() << "Could not open file";

	player1->setMedia(QUrl::fromLocalFile("Video02.AVI"));
	player1->play();
	widget1->show();
	#pragma endregion

	#pragma region VIDEOVIEW2
	QWidget *widget2 = new QWidget;
	widget2->resize(400, 300);   //
	widget2->setWindowTitle("View2");
	QVBoxLayout *layout2 = new QVBoxLayout;
	QMediaPlayer* player2 = new QMediaPlayer;
	QVideoWidget* vw2 = new QVideoWidget;

	layout2->addWidget(vw2);
	widget2->setLayout(layout2);

	player2->setVideoOutput(vw2);

	QFile file2("Video03.AVI");
	if (!file2.open(QIODevice::ReadOnly))
		qDebug() << "Could not open file";

	player2->setMedia(QUrl::fromLocalFile("Video03.AVI"));
	player2->play();
	widget2->show();
	#pragma endregion

	#pragma region VIDEOVIEWPANEL
	QWidget *widget3 = new QWidget;
	widget3->resize(400, 300);   //
	widget3->setWindowTitle("Panel");
	QVBoxLayout *layout3 = new QVBoxLayout;
	QMediaPlayer* player3 = new QMediaPlayer;
	QVideoWidget* vw3 = new QVideoWidget;

	layout3->addWidget(vw3);
	widget3->setLayout(layout3);

	player3->setVideoOutput(vw3);

	QFile file3("Video01.AVI");
	if (!file3.open(QIODevice::ReadOnly))
		qDebug() << "Could not open file";

	player3->setMedia(QUrl::fromLocalFile("Video01.AVI"));
	player3->play();
	widget3->show();
	#pragma endregion

	return a.exec();
}
コード例 #16
0
ファイル: main.cpp プロジェクト: jetcodes/JetMind
int main(int argc, char *argv[])
{
    CApplication	app(argc, argv);
    QPixmap			pixmap(":/res/icons/app-start.png");
	QSplashScreen	*splash = NULL;
	QString			tpl = "\n          %1";
    QColor			c(0, 0, 0, 168);
    CWorkbench		*bench = NULL;

    QCoreApplication::setOrganizationName("JetMind");
    QCoreApplication::setOrganizationDomain("jetmind.com");
    QCoreApplication::setApplicationName("JetMind");

    app.setWindowIcon(QIcon(QString::fromUtf8(":/res/icons/app-logo.png")));

#if defined(__APPLE__) && defined(__MACH__)
	app.setFont( QFont("Arial", 12) );
#else
	app.setFont( QFont("Arial", 9) );
#endif //

	splash = new QSplashScreen(pixmap);
	splash->setMask(pixmap.mask());
	splash->show();
	app.processEvents();

	splash->showMessage(tpl.arg( QObject::tr("Initing Environment...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();
	initEnvironment();

	splash->showMessage(tpl.arg( QObject::tr("Loading Templates...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();
    loadTemplates();

	splash->showMessage(tpl.arg( QObject::tr("Starting Workbench...") ), Qt::AlignBottom | Qt::AlignRight , c);
	app.processEvents();

	bench = new CWorkbench();
    bench->setWindowTitle("JetMind");
	bench->resize(800, 600);
	bench->show();
    bench->loadStyleSheet();
	app.setWorkbench(bench);
	CDiagramContext::env()->setMainUI(bench);

	splash->finish(bench);

	// set url handler
	QDesktopServices::setUrlHandler("topic", (QObject*)bench, "onOpenUrl");
	QDesktopServices::setUrlHandler("sheet", (QObject*)bench, "onOpenUrl");

#if defined(__APPLE__) && defined(__MACH__)
    bench->createFile();
#else
	QStringList args;
	args = app.arguments();
	if (args.length() > 1)
	{
		bench->loadFile(args.at(1));
	}
	else
	{
		bench->createFile();
	}
#endif //

	return app.exec();
}
コード例 #17
0
DianVoteControl::DianVoteControl(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::DianVoteControl),
    drawer(NULL),
    hidControl(NULL),
    stopWatch(NULL),
    splash(NULL),
    voteMode(SINGLE_VOTE),
    curState(STOP)
{
    QDir dir;
    dir.setCurrent(QCoreApplication::applicationDirPath());

    windowIcon = new QIcon(dir.absoluteFilePath("res/images/app-icon.png"));
    this->setWindowIcon(*windowIcon);

    // show splash.
    QPixmap pixmap(dir.absoluteFilePath("res/images/logo.png"));
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->setWindowIcon(*windowIcon);
    splash->setWindowFlags(Qt::WindowStaysOnTopHint);
    splash->setMask(pixmap.mask());
    splash->show();

    ui->setupUi(this);

    pbStart = new QPushButton(this);
    pbStart->setObjectName(tr("pbStart"));
    ui->buttonLayout->addWidget(pbStart, 0, 0);

    pbAuto = new QPushButton(this);
    pbAuto->setObjectName(tr("pbAuto"));
    ui->buttonLayout->addWidget(pbAuto, 0, 1);

    pbPause = new QPushButton(this);
    pbPause->setObjectName(tr("pbPause"));
    ui->buttonLayout->addWidget(pbPause, 0, 0);
    pbPause->hide();

    pbStop = new QPushButton(this);
    pbStop->setObjectName(tr("pbStop"));
    ui->buttonLayout->addWidget(pbStop, 0, 1);
    pbStop->hide();

    pbResult = new QPushButton(this);
    pbResult->setObjectName(tr("pbResult"));
    ui->buttonLayout->addWidget(pbResult, 0, 2);

    pbOption = new QToolButton(this);
    pbOption->setObjectName(tr("pbOption"));
    ui->buttonLayout->addWidget(pbOption, 0, 3);

    qaSingleMode = new QAction(tr("SingleVoteMode"), this);  // 单选模式
    qaSingleMode->setCheckable(true);
    qaSingleMode->setChecked(true);         // 默认模式
    qaMutipleMode = new QAction(tr("MutipleVoteMode"), this); // 多选
    qaMutipleMode->setCheckable(true);
    qaRaceMode = new QAction(tr("RaceVoteMode"), this);    // 抢答
    qaRaceMode->setCheckable(true);
    pbOption->addAction(qaSingleMode);
    pbOption->addAction(qaMutipleMode);
    pbOption->addAction(qaRaceMode);
    connect(qaSingleMode, SIGNAL(triggered()), this, SLOT(DoSingleMode()));
    connect(qaMutipleMode, SIGNAL(triggered()), this, SLOT(DoMutipleMode()));
    connect(qaRaceMode, SIGNAL(triggered()), this, SLOT(DoRaceVoteMode()));

    pbClose = new QPushButton(this);
    pbClose->setObjectName(tr("pbClose"));
    ui->buttonLayout->addWidget(pbClose, 0, 4);

    connect(pbClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(pbStart, SIGNAL(clicked()), this, SLOT(VoteStart()));
    connect(pbAuto, SIGNAL(clicked()), this, SLOT(VoteAuto()));
    connect(pbPause, SIGNAL(clicked()), this, SLOT(VotePause()));
    connect(pbStop, SIGNAL(clicked()), this, SLOT(VoteStop()));
    connect(pbResult, SIGNAL(clicked()), this, SLOT(DoShowResults()));

    drawer = new DianVoteDrawer();
    drawer->setWindowIcon(*windowIcon);
    drawer->setWindowTitle(tr("Result"));
    connect(pbClose, SIGNAL(clicked()), this->drawer, SLOT(close()));
    connect(this, SIGNAL(setOptionNum(int)), drawer->histgram, SLOT(SetOptionNums(int)));
    connect(this, SIGNAL(setOptionNum(int)), drawer->pie, SLOT(SetOptionNums(int)));
    connect(this, SIGNAL(clearDrawData()), drawer->histgram, SLOT(ClearData()));
    connect(this, SIGNAL(clearDrawData()), drawer->pie, SLOT(ClearData()));
    connect(this, SIGNAL(updateGraph(int)), drawer->histgram, SLOT(HandleData(int)));
    connect(this, SIGNAL(updateGraph(int)), drawer->pie, SLOT(HandleData(int)));

    LoadStyleSheet("Default");

    // 记录初始化窗口大小
    initSize = this->size();
    this->setMaximumWidth(this->width());
    this->setMaximumHeight(this->height() + 100);
    this->move(0, 0);

    // 创建Log文件,并打开,程序退出是关闭
    VoteLog->open(QIODevice::WriteOnly | QIODevice::Append);

    // 初始化log记录链表
    log = new QList< RevData* >();
}
コード例 #18
0
ファイル: main.cpp プロジェクト: karaul/tonatiuh
int main( int argc, char ** argv )
{
	QApplication::setColorSpec( QApplication::CustomColor );

    QApplication a( argc, argv );
	a.setApplicationVersion( APP_VERSION );

    QSplashScreen* splash = new QSplashScreen;
    splash->setPixmap( QPixmap(":/icons/tonatiuhsplash.png") );
    splash->show();

    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;

    splash->showMessage(QObject::tr("Loading libraries..."), topRight, Qt::black);


    QApplication::addLibraryPath( QApplication::applicationDirPath()
	        + QDir::separator() + "marble" );

	SoQt::init( (QWidget *) NULL );

	TSceneKit::initClass();
	TMaterial::initClass();
	TDefaultMaterial::initClass();
	TSeparatorKit::initClass();
	TShape::initClass();
	TCube::initClass();
	TLightShape::initClass();
	TShapeKit::initClass();
	TAnalyzerKit::initClass();
	TAnalyzerResultKit::initClass();
	TAnalyzerParameter::initClass();
	TAnalyzerResult::initClass();
	TAnalyzerLevel::initClass();
	TSquare::initClass();
	TLightKit::initClass();
	TSunShape::initClass();
	TDefaultSunShape::initClass();
	TTracker::initClass();
	TTrackerForAiming::initClass();
	TDefaultTracker::initClass();
	TSceneTracker::initClass();
	GraphicRootTracker::initClass();
	TTransmissivity::initClass();
	TDefaultTransmissivity::initClass();


	MainWindow* mw;
	splash->showMessage( QObject::tr("Setting up the main window..."), topRight, Qt::black );

    int exit;
   	if( argc > 1 )
   	{
   		QString tonatiuhFile = argv[1];

    	QFileInfo fileInfo( tonatiuhFile );
    	if( fileInfo.completeSuffix() == QLatin1String( "tnhs") )
    	{

       		mw = new MainWindow("");
       		mw->show();
       	    splash->finish( mw );
       	    delete splash;
    	    //exit = a.exec();
       		QTime dieTime = QTime::currentTime().addMSecs( 100 );
       	    while( QTime::currentTime() < dieTime )
       	    {
       	        QCoreApplication::processEvents( QEventLoop::AllEvents, 100 );
       	    }
       		mw->ExecuteScriptFile( tonatiuhFile );
       		mw->Clear();
       		mw->close();
       		exit = 0;
    	}
    	else
    	{
    		mw = new MainWindow( tonatiuhFile );

       		mw->show();
       	    splash->finish( mw );
       	    delete splash;
    	    exit = a.exec();
    	}
   	}
   	else
   	{
   		mw = new MainWindow("");
   		mw->show();
   	    splash->finish( mw );
   	    delete splash;
	    exit = a.exec();

   	}


    delete mw;

	return exit;
}
コード例 #19
0
ファイル: liteapp.cpp プロジェクト: DeanSinaean/liteide
void LiteApp::load(bool bUseSession, IApplication *baseApp)
{
    QSplashScreen *splash = 0;
    bool bSplash = m_settings->value(LITEAPP_SPLASHVISIBLE,true).toBool();
    if (baseApp) {
        bSplash = false;
    }
    if (bSplash) {
        splash = new QSplashScreen(QPixmap::fromImage(makeSplashImage(this)),Qt::WindowStaysOnTopHint);
    }
    if (bSplash) {
        splash->show();
    }

    if (bSplash) {
        splash->showMessage("Scanning plugins...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    loadMimeType();
    loadPlugins();

    if (bSplash) {
        splash->showMessage("Loading plugins...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();
    initPlugins();

    if (bSplash) {
        splash->showMessage("Loading state...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();
    loadState();
    if (baseApp) {
        if (baseApp->mainWindow()->isMaximized()) {
            m_mainwindow->resize(800,600);
            m_mainwindow->show();
        } else {
            QRect rc = baseApp->mainWindow()->geometry();
            rc.adjust(20,20,20,20);
            m_mainwindow->setGeometry(rc);
            m_mainwindow->show();
        }
    } else {
        m_mainwindow->show();
    }

    emit loaded();
    m_projectManager->setCurrentProject(0);

    if (bSplash) {
        splash->showMessage("Loading session...",Qt::AlignLeft|Qt::AlignBottom);
    }

    qApp->processEvents();

    bool b = m_settings->value(LITEAPP_AUTOLOADLASTSESSION,true).toBool();
    if (b && bUseSession) {
        loadSession("default");
    }

    if (bSplash) {
        m_mainwindow->raise();
        splash->finish(m_mainwindow);
        splash->deleteLater();
    }

    this->appendLog("HtmlWidgetFactory",m_htmlWidgetManager->classNameList().join(" "));
    this->appendLog("DefaultHtmlWidgetFactory",m_htmlWidgetManager->defaultClassName());

    m_goProxy->call("version");
    m_goProxy->call("cmdlist");    
	
    appendLog("LiteApp","Finished loading");
}
コード例 #20
0
ファイル: main.cpp プロジェクト: aroraujjwal/qt3
int main( int argc, char *argv[] )
{
    QApplication::setColorSpec( QApplication::ManyColor );

    DesignerApplication a( argc, argv );

    DesignerApplication::setOverrideCursor( Qt::WaitCursor );

    bool creatPid = FALSE;
    if ( a.argc() > 1 ) {
	QString arg1 = a.argv()[ 1 ];
	if ( arg1 == "-client" ) {
	    QFile pf( QDir::homeDirPath() + "/.designerpid" );
	    if ( pf.exists() && pf.open( IO_ReadOnly ) ) {
		QString pidStr;
		pf.readLine( pidStr, pf.size() );
		QFile f( QDir::homeDirPath() + "/.designerargs" );
		f.open( IO_WriteOnly );
		QTextStream ts( &f );
		for ( int i = 1; i < a.argc(); ++i )
		    ts << a.argv()[ i ] << " ";
		ts << endl;
		f.close();
#if defined(Q_OS_UNIX)
		if ( kill( pidStr.toInt(), SIGUSR1 ) == -1 )
		    creatPid = TRUE;
		else
		    return 0;
#elif defined(Q_OS_WIN32)
		if ( !GetProcessVersion( pidStr.toUInt() ) ) {
		    creatPid = TRUE;
		} else {
		    if ( a.winVersion() & Qt::WV_NT_based )
			    SendMessage( HWND_BROADCAST, RegisterWindowMessage((TCHAR*)"QT_DESIGNER_OPEN_FILE"), 0, 0 );
		    else
			    SendMessage( HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0 );
		    return 0;
		}
#endif
	    } else {
		creatPid = TRUE;
	    }
	} else if(arg1 == "-debug_stderr") {
	    extern bool debugToStderr; //outputwindow.cpp
	    debugToStderr = TRUE;
	}
    }

    if ( creatPid ) {
	QFile pf( QDir::homeDirPath() + "/.designerpid" );
	pf.open( IO_WriteOnly );
	QTextStream ts( &pf );
#if defined(Q_OS_UNIX)
	signal( SIGUSR1, signalHandler );
#endif
	ts << getpid() << endl;

	pf.close();
	signal( SIGABRT, exitHandler );
	signal( SIGFPE, exitHandler );
	signal( SIGILL, exitHandler );
	signal( SIGINT, exitHandler );
	signal( SIGSEGV, exitHandler );
	signal( SIGTERM, exitHandler );
    }

    extern void qInitImages_designercore();
    qInitImages_designercore();

    QSettings config;
    QString keybase = DesignerApplication::settingsKey();
    config.insertSearchPath( QSettings::Windows, "/Trolltech" );
    QStringList pluginPaths = config.readListEntry( keybase + "PluginPaths" );
    if (pluginPaths.count())
	QApplication::setLibraryPaths(pluginPaths);

    QSplashScreen *splash = a.showSplash();

    MainWindow *mw = new MainWindow( creatPid );
    a.setMainWidget( mw );
#if defined(QT_NON_COMMERCIAL)
    mw->setCaption( "Qt Designer by Trolltech for non-commercial use" );
#else
    mw->setCaption( "Qt Designer by Trolltech" );
#endif
    if ( config.readBoolEntry( keybase + "Geometries/MainwindowMaximized", FALSE ) ) {
	int x = config.readNumEntry( keybase + "Geometries/MainwindowX", 0 );
	int y = config.readNumEntry( keybase + "Geometries/MainwindowY", 0 );
	mw->move( x, y );
	mw->showMaximized();
    } else {
	mw->show();
    }
    if ( splash )
	splash->finish( mw );
    delete splash;

    QApplication::restoreOverrideCursor();
    for ( int i = 1; i < a.argc(); ++i ) {
	QString arg = a.argv()[ i ];
	if ( arg[0] != '-' )
	    mw->fileOpen( "", "", arg );
    }

    return a.exec();
}
コード例 #21
0
ファイル: main.cpp プロジェクト: afibanez/eneboo
void aq_main(int argc, char **argv) 
{
  QPalette p(QColor(229, 229, 229), QColor(229, 229, 229));
  p.setColor(QPalette::Active, QColorGroup::Dark, QColor(246, 242, 246));
  p.setColor(QPalette::Inactive, QColorGroup::Dark, QColor(246, 242, 246));
  p.setColor(QPalette::Disabled, QColorGroup::Dark, QColor(246, 242, 246));
  p.setColor(QPalette::Active, QColorGroup::Base, QColor(255, 255, 248));
  p.setColor(QPalette::Inactive, QColorGroup::Base, QColor(255, 255, 248));
  p.setColor(QPalette::Disabled, QColorGroup::Base, QColor(255, 255, 248));
  p.setColor(QPalette::Active, QColorGroup::Highlight, QColor(95, 150, 205));
  p.setColor(QPalette::Active, QColorGroup::HighlightedText, Qt::white);
  p.setColor(QPalette::Active, QColorGroup::Highlight, QColor(95, 150, 205));
  p.setColor(QPalette::Inactive, QColorGroup::HighlightedText, Qt::white);
  p.setColor(QPalette::Active, QColorGroup::Highlight, QColor(95, 150, 205));
  p.setColor(QPalette::Disabled, QColorGroup::HighlightedText, Qt::white);
  p.setColor(QPalette::Inactive, QColorGroup::Text, Qt::black);
  p.setColor(QPalette::Disabled, QColorGroup::Text, QColor(100, 100, 100));
  p.setColor(QPalette::Active, QColorGroup::Foreground, QColor(30, 30, 30));
  p.setColor(QPalette::Inactive, QColorGroup::Foreground, QColor(30, 30, 30));
  p.setColor(QPalette::Disabled, QColorGroup::Foreground, QColor(100, 100, 100));
  p.setColor(QPalette::Active, QColorGroup::ButtonText, QColor(30, 30, 30));
  p.setColor(QPalette::Inactive, QColorGroup::ButtonText, QColor(30, 30, 30));
  p.setColor(QPalette::Disabled, QColorGroup::ButtonText, QColor(100, 100, 100));

  QString formAlone, callFunction, arguments, strConn, silentConn;
  bool quitAfterCall = false, autoLogin_ = false, noMax = false;

  for (int i = 1; i < argc; i++) {
    if (qstrcmp(argv[i], "-f") == 0) {
      if (i != argc - 1) {
        i++;
        formAlone = QString::fromLatin1(argv[i]);
      }
    } else if (qstrcmp(argv[i], "-c") == 0) {
      if (i != argc - 1) {
        i++;
        callFunction = QString::fromLatin1(argv[i]);
      }
    } else if (qstrcmp(argv[i], "-a") == 0) {
      if (i != argc - 1) {
        i++;
        arguments = QString::fromLatin1(argv[i]);
      }
    } else if (qstrcmp(argv[i], "-sc") == 0) {
      if (i != argc - 1) {
        i++;
        strConn = QString::fromLatin1(argv[i]);
      }
    } else if (qstrcmp(argv[i], "-silentconn") == 0) {
      if (i != argc - 1) {
        i++;
        silentConn = QString::fromLatin1(argv[i]);
      }
    } else if (qstrcmp(argv[i], "-q") == 0) {
      quitAfterCall = true;
    } else if (qstrcmp(argv[i], "-auto") == 0) {
      autoLogin_ = true;
    } else if (qstrcmp(argv[i], "-nomax") == 0) {
      noMax = true;
    }
  }

  FLApplication *AbanQ = aqApp;
  QFont appFont;

  QStringList paths(AbanQ->libraryPaths());
  QString pathApp(AQ_PREFIX + "/plugins");
  if (!paths.contains(pathApp))
    paths << pathApp;
  if (!paths.contains(AQ_LIB))
    paths << AQ_LIB;
  AbanQ->setLibraryPaths(paths);

  int pointSize = 8;

#if defined (Q_OS_LINUX)
  appFont.setFamily(FLSettings::readEntry("font/family", "Verdana"));
#endif

#if defined(Q_OS_WIN32)
  appFont.setFamily(FLSettings::readEntry("font/family", "Tahoma"));
#endif

#if defined(Q_OS_MACX)
  appFont.setFamily(FLSettings::readEntry("font/family", "Lucida Grande"));
  pointSize = 12;
  QString envPath(getenv("PATH"));
  envPath = "/sw/sbin:/sw/bin:" + envPath + ":/usr/X11R6/bin";
  setenv("PATH", envPath.local8Bit(), 1);
#endif

  appFont.setPointSize(FLSettings::readNumEntry("font/pointSize", pointSize));
  appFont.setBold(FLSettings::readBoolEntry("font/bold", false));
  appFont.setItalic(FLSettings::readBoolEntry("font/italic", false));
  appFont.setUnderline(FLSettings::readBoolEntry("font/underline", false));
  appFont.setStrikeOut(FLSettings::readBoolEntry("font/strikeOut", false));

  AbanQ->setFont(appFont);
  AbanQ->setStyle(FLSettings::readEntry("style", "QtCurve"));

  AbanQ->installTranslator(AbanQ->createSysTranslator(QString(QTextCodec::locale()).left(2), true));
  AbanQ->installTranslator(AbanQ->createSysTranslator("multilang"));
  AbanQ->setPalette(p, true);

  FLConnectDBDialog *s = 0;
  QSplashScreen *splash = 0;

  if (silentConn.isEmpty()) {
    bool autoLogin = FLSettings::readBoolEntry("application/autoLogin", autoLogin_);
    s = new FLConnectDBDialog(autoLogin, 0, "FLConnectDBDialog", 0, strConn);

    static_cast<QWidget *>(s->child("frMore"))->hide();
    s->adjustSize();
    s->setPalette(p);
    int ret = -1;
    bool connectAttempts = 0;

    do {
      if (!s->isShown()) {
        s->show();
        s->raise();
      }
      if (autoLogin && !connectAttempts) {
        QTimer::singleShot(1000, s, SLOT(tryConnect()));
        connectAttempts++;
      } else
        s->exec();
    } while (s->error());

    ret = s->result();
    QTimer::singleShot(0, s, SLOT(deleteLater()));

    if (ret != QDialog::Accepted) {
      QTimer::singleShot(0, AbanQ, SLOT(quit()));
      return;
    }

    splash = new QSplashScreen(QPixmap::fromMimeSource("splashabanq.png"));
    splash->show();
    splash->message(QT_TR_NOOP("Inicializando..."), Qt::AlignRight, QColor(0, 0, 0));
  } else if (!silentConnect(silentConn)) {
    QTimer::singleShot(0, AbanQ, SLOT(quit()));
    return;
  }
  AbanQ->setNotExit(FLSettings::readBoolEntry("application/notExit", false));
  AbanQ->setPrintProgram(FLSettings::readEntry("printing/printProgram", QString::null));
  AbanQ->flushX();
  AbanQ->syncX();
  AbanQ->processEvents();
  AbanQ->init(
    FLSettings::readEntry("application/formAlone", formAlone),
    FLSettings::readEntry("application/callFunction", callFunction),
    FLSettings::readEntry("application/arguments", arguments),
    FLSettings::readBoolEntry("application/quitAfterCall", quitAfterCall),
    FLSettings::readBoolEntry("application/noMax", noMax)
  );

  if (AbanQ->mainWidget()) {
    AbanQ->mainWidget()->show();
    AbanQ->mainWidget()->raise();
    if (splash) {
      splash->finish(AbanQ->mainWidget());
      delete splash;
    }
  } else {
    if (splash) {
      QTimer::singleShot(0, splash, SLOT(deleteLater()));
    }
  }
    
}
コード例 #22
0
ファイル: main.cpp プロジェクト: Fisiu/pgmodeler
int main(int argc, char **argv)
{
	try
	{
    /* Registering the below classes as metatypes in order to make
		them liable to be sent through signal parameters. */
		qRegisterMetaType<ObjectType>("ObjectType");
		qRegisterMetaType<Exception>("Exception");
		qRegisterMetaType<ValidationInfo>("ValidationInfo");

		//Install a signal handler to start crashhandler when SIGSEGV or SIGABRT is emitted
		signal(SIGSEGV, startCrashHandler);
		signal(SIGABRT, startCrashHandler);

		Application app(argc,argv);

		//Loading the application splash screen
		QSplashScreen splash;
		QPixmap pix(QPixmap(":imagens/imagens/pgmodeler_splash.png"));
		splash.setPixmap(pix);
		splash.setMask(pix.mask());

		#ifndef Q_OS_MAC
			splash.setWindowFlags(Qt::SplashScreen | Qt::FramelessWindowHint);
		#else
			splash.setWindowFlags(Qt::SplashScreen | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
		#endif

    #ifdef Q_OS_WIN
      splash.show();
    #else
      splash.showMaximized();
    #endif

		app.processEvents();

		//Creates the main form
		MainWindow fmain;

		//Loading models via command line on MacOSX are disabled until the file association work correclty on that system
		#ifndef Q_OS_MAC
     QStringList params=app.arguments();
     params.pop_front();

		 //If the user specifies a list of files to be loaded
     if(!params.isEmpty())
      fmain.loadModels(params);
		#endif

		splash.finish(&fmain);
		fmain.showMaximized();

		return(app.exec());
	}
	catch(Exception &e)
	{
		QTextStream ts(stdout);
		ts << e.getExceptionsText();
		return(e.getErrorType());
	}
}