コード例 #1
0
// Start method main
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Create splashscreen object
    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap(":/img/images/splash.png"));
    splash->show();

    // Create database object
    Database *db = new Database();

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

    splash->showMessage(QObject::tr("Establishing connections..."),
                        topRight, Qt::white);
    // Database connection
    if(!db->createConnection())
        return 1;
    // Client connection
    Clock clock;
    clock.show();


    splash->showMessage(QObject::tr("Setting up main window..."),
                        topRight, Qt::white);
    // Create game window
    GameWindow gameWindow;

    splash->showMessage(QObject::tr("Setting up game..."),
                            topRight, Qt::white);
    // create game
    Game *game = new Game();

    gameWindow.setCentralWidget(game);
    gameWindow.show();
    splash->finish(&gameWindow);

    delete splash;

    return a.exec();
}// End method main
コード例 #2
0
ファイル: main.cpp プロジェクト: cesarTag/Semg
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;

    QSplashScreen *splash = new QSplashScreen(QPixmap("/home/cesar/Git/appSignal/ucm.png"),Qt::WindowStaysOnTopHint | Qt::SplashScreen);
    splash->show();
    //splash->showMessage("Iniciando ventana principal ...");

    w.upOctave();
    //splash->showMessage("Cargando modulos ...", Qt::TopRightSection, Qt::white);
    //splash->showMessage("Estableciendo conexiones ...", Qt::AlignRight | Qt::AlignTop,Qt::white);
    QThread::sleep(5);

    w.show();
    splash->finish(&w);
    delete splash;


    return a.exec();
}
コード例 #3
0
ファイル: main.cpp プロジェクト: lililqth/DigitalImage
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    QPixmap pixmap=QPixmap("hello1.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();
    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
    splash->showMessage(QString::fromLocal8Bit("Setting up the main window..."),topRight, Qt::white);
    splash->showMessage(QString::fromLocal8Bit("Loading modules..."), topRight,Qt::white);
    QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("GBK")); //路径名支持中文
    QTextCodec::setCodecForTr(QTextCodec::codecForName("GBK")); //QString支持中文
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GBK")); //string支持中文
    QApplication::setFont(QFont(QString::fromLocal8Bit("宋体"), 10, QFont::Normal));
    w.setWindowTitle(QString::fromLocal8Bit("数字图像处理"));
    w.show();
    splash->finish(&w);
    delete splash;
    return a.exec();
}
コード例 #4
0
ファイル: main.cpp プロジェクト: Isaac96/eepe
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(eepe);
    QApplication app(argc, argv);

    QString dir;
    if(argc) dir = QFileInfo(argv[0]).canonicalPath() + "/lang";

    if ( argc > 1 )
    {
      DebugMode = 1 ;
    }

    QSettings settings("er9x-eePe", "eePe");
    QString locale = settings.value("locale",QLocale::system().name()).toString();
    bool showSplash = settings.value("show_splash", true).toBool();


    QPixmap pixmap(":/images/eepe-title.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    if(showSplash)
    {
        splash->show();

        bool checkER9X  = settings.value("startup_check_er9x", true).toBool();
        bool checkEEPE  = settings.value("startup_check_eepe", true).toBool();

        if(checkEEPE || checkER9X)
            splash->showMessage(QObject::tr("Checking for updates..."));
    }

    QTranslator *translator = new QTranslator();
    translator->load(QString("eepe_") + locale, dir);
    app.installTranslator(translator);

    MainWindow mainWin;
    mainWin.show();
    splash->finish(&mainWin);
    return app.exec();
}
コード例 #5
0
ファイル: main.cpp プロジェクト: bzaragoz/NotepadND
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap("C:/Users/Nate/Desktop/Qtstuff/texteditor/Splash.png"));
    //splash->setPixmap(QPixmap("C:/Users/Byron/CSE-20212/Images/Splash.png"));
    splash->show();

    a.setWindowIcon(QIcon("C:/Users/Nate/Desktop/Qtstuff/texteditor/Icon.png"));
    // a.setWindowIcon(QIcon("C:/Users/Byron/CSE-20212/Images/Icon.png"));
    a.processEvents();
    sleep(3);
    QFont font("Lucida", 10, 0, false);
    MainWindow * mainWin = new MainWindow;
    a.setFont(font, "QPlainTextEdit");
    mainWin->show();

    splash->finish(mainWin);

    return a.exec();
}
コード例 #6
0
ファイル: main.cpp プロジェクト: VcamX/MIPS-Virtual-Machine
int main(int argc, char *argv[])
{
    qRegisterMetaType<byte>("byte");
    qRegisterMetaType<word>("word");
    qRegisterMetaType<dword>("dword");

    QApplication a(argc, argv);

    QSplashScreen *splash = new QSplashScreen;
    splash->setPixmap(QPixmap(":/icon/icon/splash.png"));
    splash->setDisabled(true);
    splash->show();

    splash->showMessage(QObject::tr("Starting..."), Qt::AlignRight | Qt::AlignTop, Qt::white);

    MainWindow w;
    w.show();

    splash->finish(&w);
    delete splash;
    
    return a.exec();
}
コード例 #7
0
ファイル: main.cpp プロジェクト: nrj123/pvb
int main(int argc, char *argv[])
{
  Q_INIT_RESOURCE(pvbrowser);

  wsa(); // init windows sockets
  QApplication app(argc, argv);
  QPixmap pm(splash);
  QSplashScreen *splash = new QSplashScreen(pm);
  splash->show();
  init(argc,argv);
  perhapsSetFont(app);
  QIcon appIcon(":/images/app.png");
  app.setWindowIcon(appIcon);
  MainWindow mainWin;
  app.processEvents();
  splash->finish(&mainWin);
  delete splash;
  mainWin.show();
  app.processEvents();
  mainWin.slotReconnect();
  mainWin.slotTimeOut();
  mainWin.mythread.start(QThread::HighestPriority);
  return app.exec();
}
int main(int argc, char *argv[])
{
    Q_INIT_RESOURCE(icons);

    QApplication a(argc, argv);

    // 系统图标
    if (!QSystemTrayIcon::isSystemTrayAvailable()) {
        QMessageBox::critical(0, QObject::tr("Systray"),
                              QObject::tr("I couldn't detect any system tray "
                                          "on this system."));
        return 1;
    }

    QApplication::setQuitOnLastWindowClosed(false);

    QApplication::addLibraryPath("./plugins");

    QTextCodec::setCodecForTr(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("GB2312"));//让显示的文字不乱码

    bool isrunning = CheckIfRunning("lz_master_gui.exe", false);
    if (isrunning)
    {
        return 1;
    }
    isrunning = CheckIfRunning("lz_master_monitor.exe", true);
    if (isrunning)
    {
        return 1;
    }

    QSplashScreen *splash = new QSplashScreen();
    splash->setPixmap(QPixmap(":/image/start.png"));
    QTimer::singleShot(3000, splash, SLOT(close()));
    splash->show();
    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
    splash->showMessage(QObject::tr("正在初始化..."),topRight,Qt::yellow);

    // 加载本地文件存储目录
    QFile file("master_datastore_path.txt");
    if (!file.open(QIODevice::ReadOnly))
    {
        qDebug() << QObject::tr("无文件master_datastore_path.txt,无法加载主控机数据存储目录位置");
        return 1;
    }
    else
    {
        QString parentpath = file.readLine().trimmed();
        MasterSetting::getSettingInstance()->setParentPath(parentpath);
        file.close();
    }

    // 【标记2】此处作废-因为MasterProgram类的run函数作废
    // 【注意】顺序:先有masterProgramInstance,才run,能连接信号槽
    //MasterProgram::getMasterProgramInstance()->run();
    /*******************************/
    MainWidget *w = new MainWidget(true, Collecting);
    w->show();

    // 【注意】顺序:先有masterProgramInstance,才能连接信号槽
    MasterProgram::getMasterProgramInstance();
    // connect函数必在MasterProgram::getMasterProgramInstance()之后
    MasterProgram::getMasterProgramInstance()->init();

    splash->showMessage(QObject::tr("正在启动程序..."),topRight,Qt::yellow);

    splash->finish(w);
    delete splash;

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

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

    qApp->processEvents();

    loadMimeType();
    loadPlugins();

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

    qApp->processEvents();
    initPlugins();

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

    qApp->processEvents();

    loadState();
    m_mainwindow->show();

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

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

    qApp->processEvents();

    appendLog("LiteApp","loaded");
    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");    
}
コード例 #10
0
ファイル: main.cpp プロジェクト: FatCat1411/opencvr
int main(int argc, char *argv[])
{
	int dummy = errno;

	QApplication a(argc, argv);
	Debug::init(0);

#ifdef WIN32
	QFont font;
	font.setPointSize(10); 
	font.setFamily(("΢ÈíÑźÚ"));
	font.setBold(false);

	a.setFont(font);
#else
	QFont font;
	font.setPointSize(10); 
	font.setFamily(("WenQuanYi Zen Hei"));
	font.setBold(false);

	a.setFont(font);
#endif

	QPixmap pixmap(":/logo/resources/splash.png");
	QSplashScreen *splash = new QSplashScreen(pixmap);

    	splash->setStyleSheet(QStringLiteral("color : white;"));    
    	splash->show();

    	gFactory = new Factory;

	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(QObject::tr("Create Video Database ..."));
		gFactory->Init();
	}
	VSCLangType m_lang;
	gFactory->GetLang(m_lang);
	if (m_lang == VSC_LANG_AUTO)
	{
		if (QLocale::system().name() == "zh_CN")
		{
			LoadLangZH(a);
		}
	}
	else if (m_lang == VSC_LANG_ZH)
	{
		LoadLangZH(a);
	}//else if add more language to here
	
	splash->showMessage(QObject::tr("Starting ..."));
	VEvent::Init(*gFactory);
	VEMap::Init(*gFactory);
	VServiceMgr *pServiceMgr = VServiceMgr::CreateObject(*gFactory);
	
	VSCMainWindows w;

	//w.showMaximized();
	w.hide();
	//w.showFullScreen();
	splash->finish(&w);
	/* Auto  */
	if (gFactory->GetAutoLogin() == FALSE)
	{
		w.ShowLogin();
	}else
	{
		w.showMaximized();
	}

	delete splash;
	/* Every thread is ready, start the factory thread */
	
	gFactory->start();
	/* Init Mining framework */
	gMFramework = new MFramework(*gFactory);
	gMFramework->Init();

	gMFramework->start();

	/* Start the OpenCVR api server */
	gOAPIServer = new OAPIServer(*gFactory);
	gOAPIServer->start();
	
	return a.exec();
}
コード例 #11
0
ファイル: main.cpp プロジェクト: AliYousuf/abanq-port
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();
}
コード例 #12
0
ファイル: mainwindow.cpp プロジェクト: kanbodows/kafpocs
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    dal_main = new DAL_main(this);
    QCoreApplication::setApplicationName("pocskaf2");
    QCoreApplication::setOrganizationName("team2");
    QSettings prevSettings("team2", "pocskaf2");
    if (prevSettings.value("databaseName").isNull() || prevSettings.value("port").isNull() || prevSettings.value("username").isNull() || prevSettings.value("password").isNull() || prevSettings.value("host").isNull())
    {
        accessdb *access = new accessdb(this);
        access->marker = 1;
        access->exec();
    }
    else
    {
        if( dal_main->setConnection(prevSettings.value("databaseName").toString(),prevSettings.value("port").toInt(),prevSettings.value("host").toString(),prevSettings.value("username").toString(),prevSettings.value("password").toString()))
        {
            QMessageBox::information(this, tr("Соединение успешно"), tr("Соединение с базой данных установлено"));
        }
        else
        {
            QMessageBox::critical(this, tr("Ошибка подключения"), tr("Соединение с базой данных невозможно"));
            accessdb *access = new accessdb(this);
            access->marker = 1;
            access->exec();
        }
    }
    Authorization *w=new Authorization(this) ;
    w->setWindowFlags(Qt::Dialog | Qt::Desktop);
    w->exec();

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(showTime()));
    timer->start(1000);
    showTime();

    QPixmap pixmap(":/img/img/pocs2.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    QFont splashFont;
    splashFont.setPixelSize(17);
    splash->setFont(splashFont);
    splash->show();
    QTime time;
    time.start();
    for (int i = 0; i < 100; )
    {
        if (time.elapsed() > 5)
        {
            time.start();
            ++i;
        }
        splash->showMessage(tr("     Загрузка системы: ") + QString::number(i) + "%", Qt::AlignLeft | Qt::AlignBottom , Qt::black);
        QCoreApplication::processEvents();
    }

    QSqlQuery * empNameQuery = new QSqlQuery(dal_main->db);
    empNameQuery->prepare("SELECT st_fio, st_photo FROM is_sotrudniki where id_sotr = " + QString::number(dal_main->getCurrentEmployee()));
    empNameQuery->exec();
    empNameQuery->first();
    if(empNameQuery->isValid())
        this->setWindowTitle("SMT v. 1.0 (текущий пользователь - " + empNameQuery->value(0).toString() + ")");


    checkNaznPoruch = new QSqlQuery(dal_main->db);
    checkNaznPoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where  checkPoruch = 0 and poruchitel = " + QString::number(dal_main->getCurrentEmployee()));
    checkIspolPoruch = new QSqlQuery(dal_main->db);
    checkIspolPoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where  checkIspoln = 0 and ispolnitel = " + QString::number(dal_main->getCurrentEmployee()));
    checker = new QTimer;
    //        checkDatePoruch = new QSqlQuery(dal_main->db);
    //        checkDatePoruch->prepare("SELECT count(id_poruchenie) FROM is_porucheniya where check_date  and checkIspoln = 1 and ispolnitel = " + QString::number(dal_main->getCurrentEmployee()));
    connect(checker,SIGNAL(timeout()),this,SLOT(on_check()));
    checker->setInterval(10000);
    checker->start();
    icon = new QSystemTrayIcon(this);
    icon->setIcon(QIcon(":/img/img/institution_icon.png"));
    icon->show();
    //icon->setContextMenu(ui->menu_file);
    connect(icon,SIGNAL(messageClicked()),this,SLOT(on_actionChecks())); //Open form Request

    ui->pushButton_show->setVisible(false);
    ui->pushButton_show->setFlat(true);
    ui->pushButton_hide->setFlat(true);
    ui->groupBox_main->setContentsMargins(0,0,0,0);
    ui->mdiArea->setVisible(false);
    QGraphicsDropShadowEffect * ef1 =  new QGraphicsDropShadowEffect;
    ef1->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef2 =  new QGraphicsDropShadowEffect;
    ef2->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef3 =  new QGraphicsDropShadowEffect;
    ef3->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef4 =  new QGraphicsDropShadowEffect;
    ef4->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef5 =  new QGraphicsDropShadowEffect;
    ef5->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef6 =  new QGraphicsDropShadowEffect;
    ef6->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef7 =  new QGraphicsDropShadowEffect;
    ef7->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef8 =  new QGraphicsDropShadowEffect;
    ef8->setBlurRadius(15);
    QGraphicsDropShadowEffect * ef9 =  new QGraphicsDropShadowEffect;
    ef9->setBlurRadius(15);
    ui->pushButton1->setGraphicsEffect(ef1);
    ui->pushButton2->setGraphicsEffect(ef2);
    ui->pushButton3->setGraphicsEffect(ef3);
    ui->pushButton4->setGraphicsEffect(ef4);
    ui->pushButton5->setGraphicsEffect(ef5);
    ui->pushButton6->setGraphicsEffect(ef6);
    ui->pushButton7->setGraphicsEffect(ef7);
    ui->pushButton8->setGraphicsEffect(ef8);
    ui->pushButton9->setGraphicsEffect(ef9);
    //    this->setCentralWidget(ui->mdiArea);

    // Настраиваем виджет перекрытия
    QLightBoxWidget* lightBox = new QLightBoxWidget(this);
    QLabel* lbTitle = new QLabel(empNameQuery->value(0).toString());
    lbTitle->setStyleSheet("font-size: 28px; font-weight: bold; color: white");
    QLabel* lbProgress = new QLabel;
    QMovie* progressMovie = new QMovie(empNameQuery->value(1).toString());
    progressMovie->setScaledSize(QSize(250,200));
    lbProgress->setMovie(progressMovie);
    progressMovie->start();
    QLabel* lbDescription = new QLabel(tr("Для входа в систему нажмите Войти"));
    lbDescription->setStyleSheet("color: white");
    QPushButton* lbClose = new QPushButton(tr("Войти"));
    QGridLayout* lbLayout = new QGridLayout;
    lbLayout->setRowStretch(0, 1);
    lbLayout->setColumnStretch(0, 1);
    lbLayout->addWidget(lbTitle, 1, 1);
    lbLayout->addWidget(lbProgress, 1, 2, Qt::AlignRight);
    lbLayout->setColumnStretch(3, 1);
    lbLayout->addWidget(lbDescription, 2, 1, 1, 2);
    lbLayout->addWidget(lbClose, 3, 2);
    lbLayout->setRowStretch(4, 1);
    connect(ui->action_Oteshel, SIGNAL(triggered()), lightBox, SLOT(show()));
    connect(lbClose, SIGNAL(clicked()), lightBox, SLOT(hide()));
    lightBox->setLayout(lbLayout);
//    ui->menuBar->setVisible(false);
    ui->mainToolBar->setVisible(false);
    ui->groupBox->setVisible(false);
    splash->finish(this);

    /*QGridLayout *userl = new QGridLayout(ui->userWidget);
    ui->userWidget->setLayout(userl);
    QLabel* lbProgress1 = new QLabel;
    QMovie* progressMovie1 = new QMovie(empNameQuery->value(1).toString());
    progressMovie1->setScaledSize(QSize(250,200));
    lbProgress1->setMovie(progressMovie1);
    progressMovie1->start();
    userl->addWidget(lbProgress1);*/
}
コード例 #13
0
ファイル: main.cpp プロジェクト: nschimme/MMapper
 void finish(QWidget *w) override { splash.finish(w); }
コード例 #14
0
ファイル: main.cpp プロジェクト: zpc930/pandoramapper
int main(int argc, char *argv[])
{
    int i;
    const char *resPath = 0;
    char    override_base_file[MAX_STR_LEN] = "";
    int     override_local_port = 0;
    char    override_remote_host[MAX_STR_LEN] = "";
    int     override_remote_port = 0;
    char    configfile[MAX_STR_LEN] = "mume.ini";
    int     default_local_port = 3000;
    int     default_remote_port = 4242;
    int     mud_emulation = 0;

#ifdef Q_OS_MACX
    CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
    CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef,
						  kCFURLPOSIXPathStyle);
    const char *appPath = CFStringGetCStringPtr(macPath,
						CFStringGetSystemEncoding());
    resPath = (char *)malloc(strlen(appPath)+25);
    strcpy(resPath, appPath);
    strcat(resPath, "/Contents/Resources/");

    char    default_base_file[MAX_STR_LEN] = "mume.pmf";
    char    default_remote_host[MAX_STR_LEN] = "";
    strcpy(configfile, "configs/default.conf");

    CFRelease(pluginRef);
    CFRelease(macPath);

#else
    resPath = "";
    char    default_base_file[MAX_STR_LEN] = "mume.pmf";
    char    default_remote_host[MAX_STR_LEN] = "129.241.210.221";
#endif
    QApplication::setColorSpec( QApplication::CustomColor );
    QApplication app( argc, argv );

    QPixmap pixmap("images/logo.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();

    splash->showMessage("Loading configuration and database...");

    for (i=1; i < argc; i++) {

      if ((strcmp(argv[i], "--config") == 0) || ( strcmp(argv[i], "-c") == 0))
      {
        if (i == argc) {
          printf("Too few arguments. Missing config file name.\r\n");
          print_usage();
          exit(1);
        }
        i++;

        strcpy(configfile, argv[i]);
	resPath = ""; // obviously the user has an own config file - including the path
      }

      if ((strcmp(argv[i], "--emulate") == 0) || ( strcmp(argv[i], "-e") == 0))
      {
        printf("Pandora: Starting in MUD emulation mode.\r\n");
        mud_emulation = 1;
      }

      if ((strcmp(argv[i], "--base") == 0) || ( strcmp(argv[i], "-b") == 0))
      {
        if (i == argc) {
          printf("Too few arguments. Missing database.\r\n");
          print_usage();
          exit(1);
        }
        i++;
        strcpy(override_base_file, argv[i]); // overriding the database file is possible even with default config file
      }

      if ((strcmp(argv[i], "--hostname") == 0) || ( strcmp(argv[i], "-hn") == 0))
      {
        if (i == argc) {
          printf("Too few arguments. Wrong hostname given.\r\n");
          print_usage();
          exit(1);
        }
        i++;
        strcpy(override_remote_host, argv[i]);
      }

      if ((strcmp(argv[i], "--localport") == 0) || ( strcmp(argv[i], "-lp") == 0))
      {
        if (i == argc) {
          printf("Too few arguments. Missing localport.\r\n");
          print_usage();
          exit(1);
        }
        i++;
        override_local_port = atoi(argv[i]);
      }

      if ((strcmp(argv[i], "--remoteport") == 0) || ( strcmp(argv[i], "-rp") == 0))
      {
        if (i == argc) {
          printf("Too few arguments. Missing targetport.\r\n");
          print_usage();
          exit(1);
        }
        i++;
        override_remote_port = atoi(argv[i]);
      }


      if ((strcmp(argv[i], "--help") == 0) || ( strcmp(argv[i], "-h") == 0))
      {
        print_usage();
        exit(1);
      }

    }


    /* set analyzer engine defaults */
    //engine_init();
    splash->showMessage(QString("Loading the configuration ") + configfile);
    conf = new Cconfigurator();
    conf->loadConfig(resPath, configfile);
    print_debug(DEBUG_SYSTEM, "starting up...");


    if (override_base_file[0] != 0) {
      conf->setBaseFile(override_base_file);
    } else if ( conf->getBaseFile() == "") {
      conf->setBaseFile(default_base_file);
    }
    print_debug(DEBUG_SYSTEM, "Using database file : %s.", (const char*) conf->getBaseFile() );

    if (override_remote_host[0] != 0) {
      conf->setRemoteHost(override_remote_host);
    } else if ( conf->getRemoteHost().isEmpty() ) {
      conf->setRemoteHost(default_remote_host);
    }
    print_debug(DEBUG_SYSTEM, "Using target hostname : %s.", (const char*) conf->getRemoteHost() );

    if (override_local_port != 0) {
      conf->setLocalPort(override_local_port);
    } else if ( conf->getLocalPort() == 0) {
      conf->setLocalPort(default_local_port);
    }
    print_debug(DEBUG_SYSTEM, "Using local port : %i.", conf->getLocalPort());

    if (override_remote_port != 0) {
      conf->setRemotePort(override_remote_port);
    } else if (conf->getRemotePort() == 0) {
      conf->setRemotePort(default_remote_port);
    }
    print_debug(DEBUG_SYSTEM, "Using target port : %i.", conf->getRemotePort());

    conf->setConfigModified( false );

    splash->showMessage("Starting Analyzer and Proxy...");

    engine = new CEngine(new CRoomManager());
    proxy = new Proxy();

    /* special init for the mud emulation */
    if (mud_emulation) {
        print_debug(DEBUG_SYSTEM, "Starting in MUD emulation mode...");
        engine->initEmulationMode();
    }

    proxy->setMudEmulation( mud_emulation );


    print_debug(DEBUG_SYSTEM, "Starting renderer ...\n");

    if ( !QGLFormat::hasOpenGL() ) {
        qWarning( "This system has no OpenGL support. Quiting." );
        return -1;
    }

    QRect rect = app.desktop()->availableGeometry(-1);
    if (conf->getWindowRect().x() == 0 || conf->getWindowRect().x() >= rect.width() ||
        conf->getWindowRect().y() >= rect.height() ) {
        print_debug(DEBUG_SYSTEM && DEBUG_INTERFACE, "Autosettings for window size and position");
        int x, y, height, width;

        x = rect.width() / 3 * 2;
        y = 0;
        height = rect.height() / 3;
        width = rect.width() - x;

        conf->setWindowRect( x, y, width, height);
    }


    QGLFormat f = QGLFormat::defaultFormat();
    f.setDoubleBuffer( true );
    f.setDirectRendering( true );
    f.setRgba( true );
    f.setDepth( true );
    f.setAlpha( true );

    if (conf->getMultisampling())
   	f.setSampleBuffers( true );
    //f.setSamples(4);

    QGLFormat::setDefaultFormat( f );

    renderer_window = new CMainWindow;

    renderer_window->show();

    splash->finish(renderer_window);
    delete splash;

    proxy->start();
    QObject::connect(proxy, SIGNAL(startEngine()), engine, SLOT(slotRunEngine()), Qt::QueuedConnection );
    QObject::connect(proxy, SIGNAL(startRenderer()), renderer_window->renderer, SLOT(display()), Qt::QueuedConnection);

    // this will be done via mainwindow itself
    //userland_parser->parse_user_input_line("mload");

    return app.exec();
}
コード例 #15
0
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    int currentExitCode = 0;

    QScopedPointer<QSymbianApplication> app(new QSymbianApplication(argc, argv));

    // Set App Info:
    app->setApplicationName("Battery Status");
    app->setOrganizationName("Motaz Alnuweiri");
    app->setApplicationVersion(APP_Version);

    // QT_DEBUG or QT_NO_DEBUG
//    #ifdef QT_DEBUG
//        // Install Debug Msgs Handler:
//        ClearDebugFile();
//        qInstallMsgHandler(DebugFileHandler);
//    #endif

    // Install EventFilter in QApplication:
    //app->installEventFilter(new myEventFilter);

    // Set App Splash Screen:
    QSplashScreen *splash = new QSplashScreen(QPixmap(":qml/Images/JPG/Splash_Screen.jpg"),
                                              Qt::WindowStaysOnTopHint);
    splash->show();

    // Check System Language & Load App Translator:
    QString systemLang = QLocale::system().name();
    QTranslator appTranslator;

    systemLang.truncate(2); //truncate(2) to ignore the country code

    if (QFile::exists("Languages/batterystatus_" + systemLang + ".qm")) {
        appTranslator.load("batterystatus_" + systemLang, "Languages");
    } else {
        appTranslator.load("batterystatus_en", "Languages");
    }

    // Install QTranslator to QApplication:
    app->installTranslator(&appTranslator);

    // Hide The App If Deactive:
    if (!app->foreground())
        QSymbianHelper::hideInBackground();

    // Register QSettings:
    QAppSettings appSettings;

    // Register QmlApplicationViewer:
    QmlApplicationViewer *viewer = new QmlApplicationViewer();
    //viewer.setResizeMode(QmlApplicationViewer::SizeRootObjectToView);
    //viewer.setAutoFillBackground(false);
    //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);

    // Register App HSWidget:
    QBatteryHSWidget *batteryHSWidget = new QBatteryHSWidget();
    batteryHSWidget->setBackgroundOpacity(appSettings.getWidgetOpacity());

    // Register QDeviceName:
    QDeviceName deviceName;

    // Register Class to QML:
    qmlRegisterType<QPSMode>("PSMode", 1, 0, "PSMode");
    qmlRegisterType<QGlobalNote>("GlobalNote", 1, 0, "GlobalNote");
    qmlRegisterType<QCBatteryInfo>("CBatteryInfo", 1, 0, "CBatteryInfo");
    qmlRegisterType<CommonType>("CommonType", 1, 0, "CommonType");

    // Set Propertys to QML:
    viewer->rootContext()->setContextProperty("APPName", QObject::tr("Battery Status"));
    viewer->rootContext()->setContextProperty("APPVersion", app->applicationVersion());
    viewer->rootContext()->setContextProperty("AppPath", app->applicationDirPath());
    viewer->rootContext()->setContextProperty("SymbianHelper", new QSymbianHelper);
    viewer->rootContext()->setContextProperty("AppSettings", &appSettings);
    viewer->rootContext()->setContextProperty("HSWidget", batteryHSWidget);
    viewer->rootContext()->setContextProperty("DeviceName", &deviceName);
    viewer->rootContext()->setContextProperty("QApp", app->instance());

    viewer->setSource(QUrl(QLatin1String("qrc:qml/main.qml")));
    //viewer.setSource(QUrl::fromLocalFile("qrc:qml/main.qml"));

    // Lock screen orientation in portrait only
    //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);

    //viewer.setGeometry(app->desktop()->screenGeometry());
    viewer->showFullScreen();

    // Stop Splash Screen & Delete It:
    splash->finish(viewer);
    splash->deleteLater();

    //viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);

    // Enter App Event Loop:
    currentExitCode = app->exec();

    // Cleun Pointers:
    delete viewer;
    delete batteryHSWidget;

    // Check If App Is Restarting:
    if(app->isRestarting()) {
        // Workround for my app to restart it self
        QProcess::startDetached(qApp->applicationFilePath());
    }

    return currentExitCode;
}
コード例 #16
0
ファイル: sasi_app.cpp プロジェクト: hoijui/springlobby
int SasiApp::exec()
{		
	QSplashScreen* splash = 0;
	QPixmap splash_pixmap;
	QWidget* show_screen = desktop()->screen( 0 );
	if ( splash_pixmap.load( SLcustomizations().GraphicsDir() + "/splash.png" ) )
	{
		splash = new QSplashScreen(show_screen,splash_pixmap);
		splash->show();
	}
	wxLogChain* logchain = 0;
	wxLog::SetActiveTarget( new wxLogChain( new wxLogStream( &std::cout ) ) );

	//this needs to called _before_ mainwindow instance is created
	wxInitAllImageHandlers();
	wxFileSystem::AddHandler(new wxZipFSHandler);
	wxSocketBase::Initialize();

	usync().FastLoadUnitSyncLibInit( );

	QDeclarativeView view(show_screen);
	QString qmldir;
	try {
		qmldir = SLcustomizations().QmlDir();
	}
	catch ( Customizations::DataException& e )
	{
		//for some f****d up reason the strings get internally f****d up w/o the hardcopy
		QList<QString> copy = e.errors_;
		QErrorWindow error_win ( copy );
		return error_win.exec();
	}

	AudioManager audio_manager (this);
	audio_manager.start();

	view.engine()->addImportPath( qmldir );
#ifdef __WXMSW__
	//for webkit declarative plugin
	view.engine()->addImportPath( QDir( QCoreApplication::applicationDirPath() + "/imports").absolutePath() );
#endif

	// Visual initialization
	view.engine()->addImageProvider("minimaps", new MinimapImageProvider);
	view.engine()->addImageProvider("graphics", new GraphicsProvider);
	view.engine()->addImageProvider("sides", new SideImageProvider);
#if USE_OPENGL
	QGLFormat format = QGLFormat::defaultFormat();
	#ifdef Q_WS_MAC
		format.setSampleBuffers(true);
	#else
		format.setSampleBuffers(false);
	#endif
	QGLWidget *glWidget = new QGLWidget(format, &view);
	view.setViewport(glWidget);
	view.setViewportUpdateMode(QGraphicsView::MinimalViewportUpdate);
#endif
	view.setAttribute(Qt::WA_OpaquePaintEvent);
	view.setAttribute(Qt::WA_NoSystemBackground);
	view.setResizeMode(QDeclarativeView::SizeRootObjectToView);

	MaplistModel maplist_model( usync().GetMapList() );
	SkirmishModel skirmish_model;
	SideModel side_model( SLcustomizations().GetModname() );
	PresetModel preset_model(this);
	ScreenResolutionModel screenres_model(this);

	spring().connect( &spring(), SIGNAL(springStarted()), &audio_manager, SLOT(pause()));
	spring().connect( &spring(), SIGNAL(springStopped()), &audio_manager, SLOT(resume()));

	QObject::connect((QObject*)view.engine(), SIGNAL(quit()), this, SLOT(quit()));
	QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &audio_manager, SLOT(doQuit()));
	QDeclarativeContext* ctxt = view.rootContext();
	ctxt->setContextProperty("maplistModel", &maplist_model );
	ctxt->setContextProperty("skirmishModel", &skirmish_model );
	ctxt->setContextProperty("sideModel", &side_model );
	ctxt->setContextProperty("audioManager", &audio_manager );
	ctxt->setContextProperty("presetModel", &preset_model );
	ctxt->setContextProperty("screenresModel", &screenres_model );

	const int sleep_seconds = -1;
	for ( int i = sleep_seconds; splash && i > 0; i-- ) {
		splash->showMessage( QString("sleeping for %1 seconds, just to show you this").arg( i ), Qt::AlignHCenter | Qt::AlignBottom );
		processEvents();
		sleep( 1 );
	}

	//	view.showFullScreen();
	if ( splash )
		splash->finish(&view);
	view.setSource(QUrl(qmldir + "/main.qml"));
	QObject::connect(this, SIGNAL(appLoaded()), (QObject*)view.rootObject(), SLOT(onAppLoaded()));

	QList<QDeclarativeError> errors = view.errors();
	if ( errors.size() )
	{
		QErrorWindow error_window ( errors );
		return error_window.exec();
	}
	view.show();
	view.setFocus();
	emit appLoaded();
	int ret = QApplication::exec();
	audio_manager.wait( 5 /*seconds*/ );
	return ret;
}
コード例 #17
0
ファイル: main.cpp プロジェクト: K1161411/opencvr
int main(int argc, char *argv[])
{
	int dummy = errno;
	ClientFactory *pFactory = NULL;

	QApplication a(argc, argv);

	a.setStyle(new VStyle); 
	astring strVSCDefaultPath = VSC_DEFAULT_SYSPATH;
#ifdef WIN32
#ifndef _WIN64
	astring strLoggerPath = strVSCDefaultPath + "\\vidstor\\logs\\";
#else
	astring strLoggerPath = strVSCDefaultPath + "\\vidstor64\\logs\\";
#endif
#else
	astring strLoggerPath = strVSCDefaultPath + "/vidstor/logs/";
#endif
	Poco::File file1(strLoggerPath);
	file1.createDirectories();
	astring strLoggerFile = strLoggerPath + "opencvrclient";
	Debug::init(9200, strLoggerFile);

	Debug::logger().info("opencvrclient started");
	//Debug::logger().info("opencvrclient started {} {}", __LINE__, __FUNCTION__);
	//Debug::logger().info("opencvrclient started {} {}", __LINE__, __FUNCTION__);

#ifdef WIN32
	QFont font;
	font.setPointSize(10); 
	font.setFamily(("΢ÈíÑźÚ"));
	font.setBold(false);

	a.setFont(font);
#else
	QFont font;
	font.setPointSize(10); 
	font.setFamily(("WenQuanYi Zen Hei"));
	font.setBold(false);

	a.setFont(font);
#endif

	QPixmap pixmap(":/logo/resources/splash.png");
	QSplashScreen *splash = new QSplashScreen(pixmap);

	splash->setStyleSheet(QStringLiteral("color : white;"));    
	splash->show();
	
    pFactory = new ClientFactory;

	if (pFactory->Init() == FALSE)
	{
		astring strPath = VSC_DEFAULT_SYSPATH;
		pFactory->SetSystemPath(strPath);
		pFactory->Init();
	}

	VidLanguage m_lang;
	pFactory->GetLang(m_lang);
	if (m_lang == VID_LANG_AUTO)
	{
		if (QLocale::system().name() == "zh_CN")
		{
			LoadLangZH(a);
		}
	}
	else if (m_lang == VID_ZH_CN)
	{
		LoadLangZH(a);
	}//else if add more language to here

	
	splash->showMessage(QObject::tr("Starting ..."));

	VTaskMgr *pVTaskMgr = new VTaskMgr();

	VSCMainWindows w(*pFactory);

	//w.showMaximized();
	w.hide();
	//w.showFullScreen();
	splash->finish(&w);
	/* Auto  */
	if (pFactory->GetAutoLogin() == false)
	{
		w.ShowLogin();
	}else
	{
		w.showMaximized();
	}

	delete splash;
	return a.exec();
}
コード例 #18
0
int main(int argc, char **argv)
{
  QApplication* app = new QApplication(argc, argv);
  Q_INIT_RESOURCE(ngrt4n);
  INIT_TRANSLATION;
  app->setWindowIcon(QIcon(":images/built-in/icon.png"));
  app->setApplicationName(APP_NAME.toUpper());
  app->setStyleSheet(GuiPreferences::style());
  QString cmdName = ngrt4n::basename(argv[0]);
  QString versionMsg = ngrt4n::getWelcomeMsg("Workstation");
  QString module = "config";
  QString file = (argc >= 2)? argv[1] : "";
  int opt;
  if ((opt = getopt(argc, argv, "chvd:e:")) != -1) {
    switch (opt) {
      case 'c':
        module = "config";
        break;
      case 'd':
        module = "dashboard";
        file = optarg;
        break;
      case 'e':
        module = "editor";
        file = optarg;
        break;
      case 'v':
        std::cout << versionMsg.toStdString()<<"\n";
        exit(0);
      case 'h': {
        std::cout << usage.arg(cmdName).toStdString();
        exit(0);
      }
      default:
        std::cout << usage.arg(cmdName).toStdString();
        exit(1);
        break;
    }
  }
  std::clog << versionMsg.toStdString()<<"\n";
  Auth authentication;
  int userRole = authentication.exec();
  if (userRole != Auth::AdmUserRole && userRole != Auth::OpUserRole) exit(1);
  if (module == "dashboard") {
    QSplashScreen* info = ngrt4n::infoScreen(versionMsg);
    ngrt4n::delay(1);
    if (file == "") {
      info->clearMessage();
      info->showMessage(QObject::tr("You need to select a description file!"), Qt::AlignCenter|Qt::AlignCenter);
      ngrt4n::delay(1); info->finish(0);
      file = QFileDialog::getOpenFileName(0,
                                          QObject::tr("%1 | Select a description file").arg(APP_NAME),
                                          ".",
                                          QObject::tr("Xml files (*.xml);;All files (*)"));

      if (!file.length()){
        ngrt4n::alert(QObject::tr("No description file has been selected and the program will exit!"));
        exit (1);
      }

    }
    info->finish(0);
    MainWindow* console= new MainWindow(userRole, file);
    console->render();
  } else if (module == "editor") {
    SvCreator* editor = new SvCreator(userRole);
    editor->load(file);
  } else if (module == "config") {
    GuiPreferences* monPref = new GuiPreferences(userRole, Preferences::ChangeMonitoringSettings);
    monPref->exec();
    exit(0);
  }
  return app->exec();
}
コード例 #19
0
ファイル: main.cpp プロジェクト: NLxjtu/McCad
// MAIN
//////////////////////
int main(int argc, char *argv[]) {
    // define messenger system
    McCadMessenger_Singleton *msgr = McCadMessenger_Singleton::Instance();
    McCadMessenger_ObserverInterface* stdCoutObserver = new McCadMessenger_StdOut;
    msgr->Register(stdCoutObserver);

    // define plugin path
    char* pLibPath = getenv("MCCAD_LIBDIR");
    OSD_Path pluginPath("empty");
    if (pLibPath == NULL) {
        cout << "MCCAD_LIBDIR is not defined!!! " << endl;
        return 1;
    }
    else
        pluginPath = OSD_Path(pLibPath);

    // load plugins
    McCadEXPlug_PluginManager* pluginManager = McCadEXPlug_PluginManager::Instance();
    pluginManager->LoadSharedLibrary(pluginPath);

    // handle input parameters
    TCollection_AsciiString Prog = argv[0];
    if(argc > 4 ) {
        string arg3(argv[3]), arg4(argv[4]);
        if(arg3 == ">" || arg3 == ">>") {
            argc = 3;
        }
        else if(arg4 == ">" || arg4 == ">>") {
            argc = 4;
        }
        else {
            printUsage(Prog);
            exit(0);
        }
    }
    bool openFile = false;

    // handle input
    TCollection_AsciiString inName;
 if(argc > 1)

//if (1)
   {
        TCollection_AsciiString inParameter;
        inParameter = argv[1];
        if(argc > 2)
            inName = argv[2];
        TCollection_AsciiString outputName;        
        TCollection_AsciiString strMatName = "";
        if (argc > 3)
            strMatName = argv[3];
        if(inParameter.IsEqual("-h") || inParameter.IsEqual("--help")) {
            printUsage();
            exit(0);
        }

        /* test code */
        //inParameter = "-m";
        TCollection_AsciiString config_file = "McCadConfig.txt";
        //inName = "convertedTest.stp";
        //strMatName = "material.xml";
        /* test code */

        // Expander
        if(inParameter.IsEqual("-e") || inParameter.IsEqual("--explode")) {
            cout << "\nMcCad_Exploder\n====================\n\n";
            Handle_TopTools_HSequenceOfShape inputShapes = readFile( inName );
            McCadIOHelper_Expander expander(inputShapes);
            Handle_TopTools_HSequenceOfShape expandedFiles = expander.GetExplodedShapes();
            if(expandedFiles->Length() < 2){
                TCollection_AsciiString message("Failed to expand file : ");
                message.AssignCat(inName);
                msgr->Message(message.ToCString());
                exit(0);
            }
            TCollection_AsciiString tmpName(inName);
            TCollection_AsciiString fileFilter = tmpName.Split( tmpName.SearchFromEnd(".") -1 );
            for(int i=1; i<=expandedFiles->Length(); i++){
                TCollection_AsciiString outName(tmpName);
                outName.Prepend("ExOut");
                outName.AssignCat("_");
                outName.AssignCat(i);
                outName.AssignCat(fileFilter);
                Handle_TopTools_HSequenceOfShape singleShape = new TopTools_HSequenceOfShape;
                singleShape->Append(expandedFiles->Value(i));
                writeFile(outName, singleShape);
            }
        }

        // Convertor
        else if(inParameter.IsEqual("-d") || inParameter.IsEqual("--decompose")) {
            cout << "\nMcCad_Decomposer\n====================\n\n";
            // read file
            Handle_TopTools_HSequenceOfShape inputShapes = readFile( inName );

            // decompose geometry
            McCadConvertTools_Convertor convertor(inputShapes);
            convertor.Convert();
            if (argc == 4 && !outputName.IsEmpty())
                convertor.SetFileName(outputName);

            if(!convertor.IsConverted()){
                cout << "Conversion failed!!!\n";
                return -1;
            }

            // export decomposed geometry to stp file
            TCollection_AsciiString exportName("converted");
            exportName += inName;
            inName = exportName.Split(exportName.SearchFromEnd("."));
            exportName += "stp";
            writeFile( exportName, convertor.GetConvertedModel());
            }

            // export decomposed geometry to stp file
        // Lei Lu 20150501
//            TCollection_AsciiString exportName("converted");
//            exportName += inName;
//            inName = exportName.Split(exportName.SearchFromEnd("."));
//            exportName += "stp";
//            writeFile( exportName, convertor.GetConvertedModel());
      //  }

        // Fuse
        else if(inParameter.IsEqual("-f") || inParameter.IsEqual("--fuse")) {
            cout << "\nMcCad_Fusioner\n====================\n\n";
            McCadIOHelper_Merger myMerger(inName);
            if(argc == 4 && !outputName.IsEmpty())
                myMerger.MergeToFile(outputName);
            else
                myMerger.Merge();
        }

        // Surface check
        else if(inParameter.IsEqual("-s") || inParameter.IsEqual("--surface-check")) {
            cout << "\n McCad_SurfaceChecker\n====================\n\n";
            if(argc < 3 || (argc == 4 && outputName.IsEmpty()) || argc > 4) {
                cout << "Output file name required\n\n";
                exit(-1);
            }
            McCadCSGTool_SurfaceChecker surfCheck;
            surfCheck.readDirectory(inName, outputName);
        }

        // Void Generator
        else if(inParameter.IsEqual("-m") || inParameter.IsEqual("--mcnp") ||
                inParameter.IsEqual("-t") || inParameter.IsEqual("--tripoli")||
                inParameter.IsEqual("-g") || inParameter.IsEqual("--gdml"))
        {
            // read parameter file
            if (!McCadConvertConfig::ReadPrmt(config_file))
            {
                return 0;
            }

            McCadInputModelData input_model;           
            if (!input_model.LoadSTEPModel(inName))
            {
                cout << "#Main Function: Read geometry data error! Please check the input file name!\n\n";
                return 0;
            }

            // New void generation algorithm
            // Modified by Lei Lu 12/08/2012 ~ 18/12/2013
            McCadVoidCellManager * pVoidCellManager = new McCadVoidCellManager();



            Handle(TopTools_HSequenceOfShape) hInputShape = input_model.GetModelData();
            pVoidCellManager->ReadGeomData( hInputShape );
            pVoidCellManager->ReadMatData(strMatName);
            TCollection_AsciiString outName = inName;       // Set the output file name
            outName.Split(outName.SearchFromEnd(".")-1);    // Remove the file extension.

            if(inParameter.IsEqual("-t") || inParameter.IsEqual("--tripoli"))
            {
                pVoidCellManager->SetConvetor("TRIPOLI");
                outName += "_TRIPOLI.txt";
            }
            else if(inParameter.IsEqual("-m") || inParameter.IsEqual("--mcnp"))
            {
                pVoidCellManager->SetConvetor("MCNP");
                outName += "_MCNP.txt";
            }
            //qiu add to generate GDML input
            else if (inParameter.IsEqual("-g") || inParameter.IsEqual("--gdml"))
            {
                pVoidCellManager->SetConvetor("GDML");
                outName += ".gdml";
            }


            pVoidCellManager->SetOutFileName(outName);
            pVoidCellManager->Process();                    // Process the conversion work

            delete pVoidCellManager;
            pVoidCellManager = NULL;
        }

        // open file for GUI
        else if(inParameter.Search(".stp")  > 0 || inParameter.Search(".mcn")  > 0 ||
                inParameter.Search(".d")    > 0 || inParameter.Search(".step") > 0 ||
                inParameter.Search(".mcnp") > 0 || inParameter.Search(".tri")  > 0 ||
                inParameter.IsEqual(".") )
        {
            openFile = true;
            inName = inParameter;
        }

        // print version
        else if(inParameter.IsEqual("-v") || inParameter.IsEqual("--version"))
            printVersion();
        else {
            cout << "\nUnknown Parameter ... " << argv[1] << endl;
            printUsage(Prog);
        }

        if(!openFile)
            return 0;
    }

    // GUI
    //////////////////////////////////////
    QApplication app(argc, argv);
    QSplashScreen* splash = new QSplashScreen(QPixmap(":images/splash.png"), Qt::WindowStaysOnTopHint);
    splash->show();
    splash->showMessage(app.tr("Loading libraries ....."), Qt::AlignRight | Qt::AlignBottom);
    QMcCad_Application QMcWin;

    // loading plugins
    QMcWin.SetPluginPath(pluginPath);
    QMcWin.LoadPlugins();
    Handle_TColStd_HSequenceOfAsciiString Formats = QMcWin.Formats();
    for (int j=1; j<= Formats->Length(); j++)
        splash->showMessage(app.tr(Formats->Value(j).ToCString()), Qt::AlignRight|Qt::AlignBottom);

    QMcWin.show();

    // delete splash
    if (splash) {
        splash->finish(&QMcWin);
        delete splash;
    }

    // open file imediately after window is loaded
    if(openFile)
        QMcWin.SetOpenFile(inName);

    // run Qt program
    return app.exec();
}
コード例 #20
0
ファイル: main.cpp プロジェクト: mblancomuriel/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 );

	//MFVec2::initClass();
	UserMField::initClass();
	UserSField::initClass();
	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();


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


	QDir pluginsDirectory( qApp->applicationDirPath() );
	pluginsDirectory.cd( "plugins" );
	PluginManager pluginManager;
	pluginManager.LoadAvailablePlugins( pluginsDirectory );

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

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

    		QString fileName( argv[1] );
    		QFileInfo fileInfo( fileName );

    		QDir testDirectory( fileInfo.absolutePath() );
    		testDirectory.cd( "." );

    		QScriptEngine* interpreter = new QScriptEngine;
    		qScriptRegisterSequenceMetaType<QVector<QVariant> >(interpreter);


    		MainWindow* mw = new MainWindow( QLatin1String("") );
    		mw->SetPluginManager( &pluginManager );
    		QScriptValue tonatiuh = interpreter->newQObject( mw );
    		interpreter->globalObject().setProperty( "tonatiuh", tonatiuh );


    		QFile scriptFile( fileName );
    		if( !scriptFile.open( QIODevice::ReadOnly) )
    		{
    			QString errorMessage = QString( "Cannot open file %1." ).arg( fileName );
    			std::cerr<<errorMessage.toStdString()<<std::endl;
    		}


    		QTextStream in( &scriptFile );
    		QString program = in.readAll();
    		scriptFile.close();


    		QScriptSyntaxCheckResult checkResult = interpreter->checkSyntax( program );
    		if( checkResult.state() != QScriptSyntaxCheckResult::Valid )
    		{
    			QString errorMessage = QString( "Script Syntaxis Error.\n"
    					"Line: %1. %2" ).arg( QString::number( checkResult.errorLineNumber() ), checkResult.errorMessage () );
    			std::cerr<<errorMessage.toStdString()<<std::endl;
    			return -1;
    		}

    		QScriptValue result = interpreter->evaluate( program );
    		if( result.isError () )
    		{
    			QScriptValue lineNumber = result.property( "lineNumber");

    			QString errorMessage = QString( "Script Execution Error.\nLine %1. %2" ).arg( QString::number( lineNumber.toNumber() ), result.toString() );
    			std::cerr<<errorMessage.toStdString()<<std::endl;
    			return -1;

    		}

       		delete mw;
       		delete interpreter;
    		exit = 0;
    	}
    	else
    	{

    		MainWindow* mw = new MainWindow( tonatiuhFile );
    		mw->SetPluginManager( &pluginManager );


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

   	}

	return exit;
}
コード例 #21
0
ファイル: main.cpp プロジェクト: midzer/LibreCAD
/**
 * Main. Creates Application window.
 */
int main(int argc, char** argv)
{
    RS_DEBUG->setLevel(RS_Debug::D_WARNING);

    QApplication app(argc, argv);
    QCoreApplication::setOrganizationName("LibreCAD");
    QCoreApplication::setApplicationName("/LibreCAD");
    QCoreApplication::setApplicationVersion("master");

    QSplashScreen* splash = new QSplashScreen;

    RS_SETTINGS->beginGroup("Appearance");
    bool show_splash = RS_SETTINGS->readNumEntry("/ShowSplash", 1);
    RS_SETTINGS->endGroup();

    if (show_splash)
    {
        QPixmap pixmap(":/main/splash_librecad.png");
        splash->setPixmap(pixmap);
        splash->setAttribute(Qt::WA_DeleteOnClose);
        splash->show();
        splash->showMessage(QObject::tr("Loading.."),
                            Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
        app.processEvents();
        RS_DEBUG->print("main: splashscreen: OK");
    }

    #if defined(Q_OS_MAC) && QT_VERSION > 0x050000
        //need stylesheet for Qt5 on mac
        app.setStyleSheet(
"QToolButton:checked"
"{"
"    background-color: rgb(160,160,160);"
"    border-style: inset;"
"}"
""
"QToolButton"
"{"
"    background-color: transparent;"
"}"
""
"QToolButton:hover"
"{"
"    background-color: rgb(255,255,255);"
"    border-style: outset;"
"}"
        );
    #endif

    const QString lpDebugSwitch0("-d"),lpDebugSwitch1("--debug") ;
    const QString help0("-h"), help1("--help");
    bool allowOptions=true;
    QList<int> argClean;
    for (int i=0; i<argc; i++)
    {
        QString argstr(argv[i]);
        if(allowOptions&&QString::compare("--", argstr)==0)
        {
            allowOptions=false;
            continue;
        }
        if (allowOptions && (help0.compare(argstr, Qt::CaseInsensitive)==0 ||
                             help1.compare(argstr, Qt::CaseInsensitive)==0 ))
        {
            qDebug()<<"librecad::usage: <options> <dxf file>";
            qDebug()<<"-h, --help\tdisplay this message";
            qDebug()<<"";
            qDebug()<<" --help\tdisplay this message";
            qDebug()<<"-d, --debug <level>";
            RS_DEBUG->print( RS_Debug::D_NOTHING, "possible debug levels:");
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Nothing", RS_Debug::D_NOTHING);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Critical", RS_Debug::D_CRITICAL);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Error", RS_Debug::D_ERROR);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Warning", RS_Debug::D_WARNING);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Notice", RS_Debug::D_NOTICE);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Informational", RS_Debug::D_INFORMATIONAL);
            RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Debugging", RS_Debug::D_DEBUGGING);
            exit(0);
        }
        if ( allowOptions&& (argstr.startsWith(lpDebugSwitch0, Qt::CaseInsensitive) ||
                             argstr.startsWith(lpDebugSwitch1, Qt::CaseInsensitive) ))
        {
            argClean<<i;

            // to control the level of debugging output use --debug with level 0-6, e.g. --debug3
            // for a list of debug levels use --debug?
            // if no level follows, the debugging level is set
            argstr.remove(QRegExp("^"+lpDebugSwitch0));
            argstr.remove(QRegExp("^"+lpDebugSwitch1));
            char level;
            if(argstr.size()==0)
            {
                if(i+1<argc)
                {
                    if(QRegExp("\\d*").exactMatch(argv[i+1]))
                    {
                        ++i;
                        qDebug()<<"reading "<<argv[i]<<" as debugging level";
                        level=argv[i][0];
                        argClean<<i;
                    }
                    else
                        level='3';
                }
                else
                    level='3'; //default to D_WARNING
            }
            else
                level=argstr.toStdString()[0];

            switch(level)
            {
            case '?' :
                RS_DEBUG->print( RS_Debug::D_NOTHING, "possible debug levels:");
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Nothing", RS_Debug::D_NOTHING);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Critical", RS_Debug::D_CRITICAL);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Error", RS_Debug::D_ERROR);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Warning", RS_Debug::D_WARNING);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Notice", RS_Debug::D_NOTICE);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Informational", RS_Debug::D_INFORMATIONAL);
                RS_DEBUG->print( RS_Debug::D_NOTHING, "    %d Debugging", RS_Debug::D_DEBUGGING);
                return 0;

            case '0' + RS_Debug::D_NOTHING :
                RS_DEBUG->setLevel( RS_Debug::D_NOTHING);
                ++i;
                break;

            case '0' + RS_Debug::D_CRITICAL :
                RS_DEBUG->setLevel( RS_Debug::D_CRITICAL);
                ++i;
                break;

            case '0' + RS_Debug::D_ERROR :
                RS_DEBUG->setLevel( RS_Debug::D_ERROR);
                ++i;
                break;

            case '0' + RS_Debug::D_WARNING :
                RS_DEBUG->setLevel( RS_Debug::D_WARNING);
                ++i;
                break;

            case '0' + RS_Debug::D_NOTICE :
                RS_DEBUG->setLevel( RS_Debug::D_NOTICE);
                ++i;
                break;

            case '0' + RS_Debug::D_INFORMATIONAL :
                RS_DEBUG->setLevel( RS_Debug::D_INFORMATIONAL);
                ++i;
                break;

            case '0' + RS_Debug::D_DEBUGGING :
                RS_DEBUG->setLevel( RS_Debug::D_DEBUGGING);
                ++i;
                break;

            default :
                RS_DEBUG->setLevel(RS_Debug::D_DEBUGGING);
                break;
            }
        }
    }
    RS_DEBUG->print("param 0: %s", argv[0]);

    QFileInfo prgInfo( QFile::decodeName(argv[0]) );
    QString prgDir(prgInfo.absolutePath());
    RS_SETTINGS->init(XSTR(QC_COMPANYKEY), XSTR(QC_APPKEY));
    RS_SYSTEM->init(XSTR(QC_APPNAME), XSTR(QC_VERSION), XSTR(QC_APPDIR), prgDir);

    // parse command line arguments that might not need a launched program:
    QStringList fileList = handleArgs(argc, argv, argClean);

    QString lang;
    QString langCmd;
    QString unit;

    RS_SETTINGS->beginGroup("/Defaults");
    #ifndef QC_PREDEFINED_UNIT
        unit = RS_SETTINGS->readEntry("/Unit", "Invalid");
    #else
        unit = RS_SETTINGS->readEntry("/Unit", QC_PREDEFINED_UNIT);
    #endif
    RS_SETTINGS->endGroup();

    // show initial config dialog:
    if (unit=="Invalid")
    {
        RS_DEBUG->print("main: show initial config dialog..");
        QG_DlgInitial di(nullptr);
        QPixmap pxm(":/main/intro_librecad.png");
        di.setPixmap(pxm);
        if (di.exec())
        {
            RS_SETTINGS->beginGroup("/Defaults");
            unit = RS_SETTINGS->readEntry("/Unit", "None");
            RS_SETTINGS->endGroup();
        }
        RS_DEBUG->print("main: show initial config dialog: OK");
    }

    RS_DEBUG->print("main: init fontlist..");
    RS_FONTLIST->init();
    RS_DEBUG->print("main: init fontlist: OK");

    RS_DEBUG->print("main: init patternlist..");
    RS_PATTERNLIST->init();
    RS_DEBUG->print("main: init patternlist: OK");

    RS_DEBUG->print("main: init scriptlist..");
    RS_SCRIPTLIST->init();
    RS_DEBUG->print("main: init scriptlist: OK");

    RS_DEBUG->print("main: loading translation..");
    RS_SETTINGS->beginGroup("/Appearance");
    #ifdef QC_PREDEFINED_LOCALE
        lang = RS_SETTINGS->readEntry("/Language", "");
        if (lang.isEmpty())
        {
            lang=QC_PREDEFINED_LOCALE;
            RS_SETTINGS->writeEntry("/Language", lang);
        }
        langCmd = RS_SETTINGS->readEntry("/LanguageCmd", "");
        if (langCmd.isEmpty())
        {
            langCmd=QC_PREDEFINED_LOCALE;
            RS_SETTINGS->writeEntry("/LanguageCmd", langCmd);
        }
    #else
        lang = RS_SETTINGS->readEntry("/Language", "en");
        langCmd = RS_SETTINGS->readEntry("/LanguageCmd", "en");
    #endif
    RS_SETTINGS->endGroup();

    RS_SYSTEM->loadTranslation(lang, langCmd);
    RS_DEBUG->print("main: loading translation: OK");

    RS_DEBUG->print("main: creating main window..");
    QC_ApplicationWindow appWin;
    RS_DEBUG->print("main: setting caption");
    appWin.setWindowTitle(XSTR(QC_APPNAME));

    RS_DEBUG->print("main: show main window");

    RS_SETTINGS->beginGroup("/Geometry");
    int windowWidth = RS_SETTINGS->readNumEntry("/WindowWidth", 0);
    int windowHeight = RS_SETTINGS->readNumEntry("/WindowHeight", 0);
    int windowX = RS_SETTINGS->readNumEntry("/WindowX", 30);
    int windowY = RS_SETTINGS->readNumEntry("/WindowY", 30);
    RS_SETTINGS->endGroup();

    if (windowWidth != 0)
        appWin.resize(windowWidth, windowHeight);

    appWin.move(windowX, windowY);

    RS_SETTINGS->beginGroup("Defaults");
    bool maximize = RS_SETTINGS->readNumEntry("/Maximize", 0);
    RS_SETTINGS->endGroup();
    if (maximize || windowWidth == 0)
        appWin.showMaximized();
    else
        appWin.show();

    RS_DEBUG->print("main: set focus");
    appWin.setFocus();
    RS_DEBUG->print("main: creating main window: OK");

    if (show_splash)
    {
        RS_DEBUG->print("main: updating splash");
        splash->raise();
        splash->showMessage(QObject::tr("Loading..."),
                Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
        RS_DEBUG->print("main: processing events");
        qApp->processEvents();
        RS_DEBUG->print("main: updating splash: OK");
    }

    // Set LC_NUMERIC so that entering numeric values uses . as the decimal seperator
    setlocale(LC_NUMERIC, "C");

    RS_DEBUG->print("main: loading files..");
    bool files_loaded = false;
    for (QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it )
    {
        if (show_splash)
        {
            splash->showMessage(QObject::tr("Loading File %1..")
                    .arg(QDir::toNativeSeparators(*it)),
            Qt::AlignRight|Qt::AlignBottom, QC_SPLASH_TXTCOL);
            qApp->processEvents();
        }
        appWin.slotFileOpen(*it, RS2::FormatUnknown);
        files_loaded = true;
    }
    RS_DEBUG->print("main: loading files: OK");

    RS_DEBUG->print("main: app.exec()");

    if (!files_loaded)
    {
        appWin.slotFileNewNew();
    }

    if (show_splash)
        splash->finish(&appWin);
    else
        delete splash;

    int return_code = app.exec();

    RS_DEBUG->print("main: exited Qt event loop");

    return return_code;
}
コード例 #22
0
ファイル: liteapp.cpp プロジェクト: G-Moriarty/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");
	
    appendLog("LiteApp","Finished loading");
}
コード例 #23
0
int main( int argc, char **argv )
{
	QPCApplication app(argc, argv);

	QApplication::setStyle("plastik");
	
	qapital::QPLOGGER.salvarLog(SBLogger::QP_INFO, SBLogger::CLIENTE, QObject::tr("Iniciando QPCliente"));
	
	QString splash = qapital::GUIDATADIR + QString("qapital-splash-2004-08-31.png");
	
	QPixmap pixmap( splash );
    	QSplashScreen *pantalla = new QSplashScreen( pixmap );
      	pantalla->show();
	pantalla->message(QObject::tr("Iniciando aplicacion..."));

	QFile configFile( qapital::CONFIGRC +  QString("QPCConfig.xml"));

	QXmlInputSource sourceXML(configFile);
	configFile.close();
	
	QPCConfigHandler *handler = new QPCConfigHandler;
	QXmlSimpleReader reader;
    	reader.setContentHandler( handler );
		
	if ( ! reader.parse( sourceXML ) )
	{
		std::cout << QObject::tr("Error en la configuracion del cliente") << std::endl;
	}		
	
	ClnRed cliente ( handler->obtenerQPSHost(), handler->obtenerQPSPuerto() );

	pantalla->message(QObject::tr("creando interfaz..."));

	//GCLMdiMainWindow *qpCliente;
	QMainWindow *qpCliente = 0;

	switch ( int opt = handler->obtenerTipoDeInterfaz() )
	{
		case SBGui::MenuBased:
		{
			std::cout << "Iniciando MenuBased" << std::endl;
			qpCliente = new GCLPrincipal(&cliente);
		}
		break;
		case SBGui::MDIBased:
		{
			std::cout << "Iniciando MDIBased" << std::endl;
			qpCliente = new GCLMdiMainWindow();
		}
		break;
		default:
		{
			std::cout << "Tipo de interfaz desconocido " << opt << std::endl;
			qpCliente = new GCLMdiMainWindow();
		}
		break;
	}
	
	app.setMainWidget( qpCliente );
	
	
	QObject::connect( qApp, SIGNAL( lastWindowClosed() ), &cliente, SLOT( clnCerrarConexion() ) );
	
	pantalla->finish( qpCliente );

    	delete pantalla;
	
	return app.exec();
}
コード例 #24
0
int gui_main(int argc, char **argv) {

	File_logger* initialization_log = new File_logger("sgems_status.log");
	initialization_log->subscribe(GsTLlog);

	QTscribe* qt_error_scribe = new QTscribe;
	qt_error_scribe->subscribe(GsTLcerr);

	GsTLlog << gstlIO::no_wait_end;
	//-----

	//---------------------
	// Initialize the libraries, manage the splash-screen, and set-up the
	// main application window

	QApplication app(argc, argv);
	QApplication::addLibraryPath(path_to_plugins());

	//QPixmap pixmap(path_to_splash_image());
  QPixmap pixmap(":/sgems-main/new_splash2-beta.bmp");

	QSplashScreen* splash = new QSplashScreen(pixmap);
  splash->show();

	splash->setFont(QFont("Times", 8, QFont::Bold));
	splash->showMessage("Initializing...");
	app.processEvents();

	Lib_initializer::init();

	splash->showMessage("Loading colormaps...");
	app.processEvents();
	Lib_initializer::load_colormaps();

	splash->showMessage("Loading geostat plugins...");
	app.processEvents();
	Lib_initializer::load_geostat_algos();
	Lib_initializer::load_filters_plugins();

	splash->showMessage("Loading action plugins...");
	app.processEvents();
	Lib_initializer::load_action_plugins();
	Lib_initializer::load_python_scripts();
	Lib_initializer::load_python_group_scripts();

	SoDB::init();
	//  QSP_application* appli = new QSP_application( 0 );
	//  SoQt::init( appli );
	//SoClipPlaneManip::initClass();
	//  GsTL_SoClipPlaneManip::initClass();
	GsTL_SoNode::initClass();
	SoVolumeRendering::init();

	QSP_application* appli = new QSP_application(0);
	SoQt::init(appli);

	//deprecated
	//app.setMainWidget( appli );

	Status_bar_scribe* statusbar_scribe = new Status_bar_scribe(appli->statusBar());
	statusbar_scribe->subscribe(GsTLcerr);
	statusbar_scribe->subscribe(GsTLcout);

	appli->init();  
	appli->setWindowTitle("SGeMS beta");

	// restore preferences
	QSettings settings;
	settings.setPath(QSettings::NativeFormat, QSettings::UserScope, "scrf.stanford.edu");
	int height = settings.value("/geometry/height", 480).toInt();
	int width = settings.value("/geometry/width", 640).toInt();
	appli->resize(QSize(width, height));

	bool show_algo_panel = settings.value("/panels/algo", true).toBool();
	bool show_cli_panel = settings.value("/panels/cli", false).toBool();

	appli->setWindowIcon(QIcon(":/sgems-main/new_icon6_32x32.bmp"));
  //QIcon windowIcon("d:/code-dev/GsTLAppli-qt4/GsTLAppli/main/new_icon6_32x32.bmp");
  //appli->setWindowIcon(windowIcon);
  
	appli->show();
  appli->show_algo_panel(show_algo_panel);
	appli->show_commands_panel(show_cli_panel);

	//------------------
	SmartPtr<Named_interface> ni = Root::instance()->interface(projects_manager + "/" + "project");
	GsTL_project* project = dynamic_cast<GsTL_project*> (ni.raw_ptr());
	appli_assert( project );
	Python_project_wrapper::set_project(project);
	//------------------


	splash->finish(appli);
	delete splash;

	//------------------------
	// Everything is now ready. We set up one more logging device, and it's done

	GsTLlog << gstlIO::wait_end;

	initialization_log->unsubscribe(GsTLlog);

	File_logger* main_log = new File_logger("sgems_history.log");
	main_log->subscribe(GsTLlog);
	main_log->append_newline(true);

	/*
	 //-------------
	 QSP_application appli( 0 );
	 SoQt::init( &appli );

	 app.setMainWidget( &appli );

	 Status_bar_scribe* statusbar_scribe = new Status_bar_scribe( appli.statusBar() );
	 statusbar_scribe->subscribe( GsTLcerr );

	 appli.init();
	 appli.show();
	 appli.setCaption( "SGeMS" );
	 //--------------
	 */
	SoQt::mainLoop();

	//delete appli;
	Lib_initializer::release();

	Root::instance()->list_all(std::cout);

	return 0;
}
コード例 #25
0
ファイル: main.cpp プロジェクト: KdeOs/pcbsd
int runSingleSession(int argc, char *argv[]){
  //QTime clock;
  //clock.start();
  Backend::checkLocalDirs();  // Create and fill "/usr/local/share/PCDM" if needed
  Backend::openLogFile("/var/log/PCDM.log");  
  //qDebug() << "Backend Checks Finished:" << QString::number(clock.elapsed())+" ms";
  //Check for the flag to try and auto-login
  bool ALtriggered = FALSE;
  if(QFile::exists(TMPAUTOLOGINFILE)){ ALtriggered=TRUE; QFile::remove(TMPAUTOLOGINFILE); }
  
  QString changeLang; 
  // Load the configuration file
  QString confFile = "/usr/local/etc/pcdm.conf";
  if(!QFile::exists(confFile)){ 
    qDebug() << "PCDM: Configuration file missing:"<<confFile<<"\n  - Using default configuration";
    confFile = ":samples/pcdm.conf"; 
  }
  
  Config::loadConfigFile(confFile);
  //qDebug() << "Config File Loaded:" << QString::number(clock.elapsed())+" ms";
  // Startup the main application
  QApplication a(argc,argv); 
  
  // Show our splash screen, so the user doesn't freak that that it takes a few seconds to show up
  QSplashScreen splash;
  if(!Config::splashscreen().isEmpty()){
    splash.setPixmap( QPixmap(Config::splashscreen()) ); //load the splashscreen file
  }
  splash.show();
  QCoreApplication::processEvents(); //Process the splash screen event immediately
  //qDebug() << "SplashScreen Started:" << QString::number(clock.elapsed())+" ms";
  //Initialize the xprocess
  XProcess desktop;
  
  //*** STARTUP THE PROGRAM ***
  bool goodAL = FALSE; //Flag for whether the autologin was successful
  // Start the autologin procedure if applicable
  if( ALtriggered && Config::useAutoLogin() ){
    //Setup the Auto Login
    QString user = Backend::getALUsername();
    QString pwd = Backend::getALPassword();
    QString dsk = Backend::getLastDE(user);
    if( user.isEmpty() || dsk.isEmpty() ){
	 goodAL=FALSE;   
    }else{
	desktop.loginToXSession(user,pwd, dsk);
	splash.close();
	if(desktop.isRunning()){
	  goodAL=TRUE; //flag this as a good login to skip the GUI
	}
    }
  }
  //qDebug() << "AutoLogin Finished:" << QString::number(clock.elapsed())+" ms";
  if(!goodAL){
    // ------START THE PCDM GUI-------
    
    // Check what directory our app is in
    QString appDir = "/usr/local/share/PCDM";
    // Load the translator
    QTranslator translator;
    QLocale mylocale;
    QString langCode = mylocale.name();
    //Check for a language change detected
    if ( ! changeLang.isEmpty() )       
       langCode = changeLang;
    //Load the proper locale for the translator
    if ( QFile::exists(appDir + "/i18n/PCDM_" + langCode + ".qm" ) ) {
      translator.load( QString("PCDM_") + langCode, appDir + "/i18n/" );
      a.installTranslator(&translator);
      Backend::log("Loaded Translation:" + appDir + "/i18n/PCDM_" + langCode + ".qm");
    } else {
      Backend::log("Could not find: " + appDir + "/i18n/PCDM_" + langCode + ".qm");
      langCode = "";
    }
    //qDebug() << "Translation Finished:" << QString::number(clock.elapsed())+" ms";

    Backend::log("Starting up PCDM interface");
    PCDMgui w;
    //qDebug() << "Main GUI Created:" << QString::number(clock.elapsed())+" ms";
    splash.finish(&w); //close the splash when the GUI starts up

    // Set full-screen dimensions
    QRect dimensions = QApplication::desktop()->screenGeometry();
    int wid = dimensions.width();     // returns desktop width
    int hig = dimensions.height();    // returns desktop height
    w.setGeometry(0, 0, wid, hig);

    //Set the proper size on the Application
    w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnBottomHint);
    w.setWindowState(Qt::WindowMaximized); //Qt::WindowFullScreen);

    //Setup the signals/slots to startup the desktop session
    if(USECLIBS){ QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString)), &desktop,SLOT(setupDesktop(QString,QString,QString))); }
    else{ QObject::connect( &w,SIGNAL(xLoginAttempt(QString,QString,QString)), &desktop,SLOT(loginToXSession(QString,QString,QString)) ); }
    //Setup the signals/slots for return information for the GUI
    QObject::connect( &desktop, SIGNAL(InvalidLogin()), &w, SLOT(slotLoginFailure()) );
    QObject::connect( &desktop, SIGNAL(started()), &w, SLOT(slotLoginSuccess()) );
    QObject::connect( &desktop, SIGNAL(ValidLogin()), &w, SLOT(slotLoginSuccess()) );
    
    //qDebug() << "Showing GUI:" << QString::number(clock.elapsed())+" ms";
    w.show();
    a.exec();
  }  // end of PCDM GUI running
  int retcode = 0;
  //Wait for the desktop session to finish before exiting
  if(USECLIBS){ desktop.startDesktop(); }
  else{ desktop.waitForSessionClosed(); }
  splash.show(); //show the splash screen again
  splash.showMessage(QObject::tr("System Shutting Down"), Qt::AlignHCenter | Qt::AlignBottom, Qt::white);
  //check for shutdown process
  if(QFile::exists("/var/run/nologin")){
    //Pause for a few seconds to prevent starting a new session during a shutdown
    QTime wTime = QTime::currentTime().addSecs(30);
    while( QTime::currentTime() < wTime ){ 
      //Keep processing events during the wait (for splashscreen)
      QCoreApplication::processEvents(QEventLoop::AllEvents, 100); 
    }
    //set the return code for a shutdown
    retcode = -1; //make sure it does not start a new session
  }
  
  //Clean up Code
  delete &desktop;
  delete &a;
  delete &splash;
  
  
  return retcode;
}
コード例 #26
0
ファイル: main.cpp プロジェクト: mbravod/aeros
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QSplashScreen *splash;
    splash = new QSplashScreen;
    splash->setPixmap(QPixmap(":/Resources/cfesplash.png"));
    splash->show();
    Qt::Alignment bottomLeft = Qt::AlignLeft | Qt::AlignBottom;

    splash->showMessage(QObject::tr("Cargando Ajustes..."), bottomLeft, Qt::white);
    splash->showMessage(QObject::tr("Creando Interfaces..."), bottomLeft, Qt::white);

/*    SQLite sl;
    sl.IniciaBD();
    sl.VaciarTxtBD("C:/SiTTuGAs/Punteros.csv");//*/

    // Recuperamos la configuración
    Config *config = SQLite::getConfig();
    if(config == NULL)
    {
        qDebug()<<"Ha fallado la configuración...";
    }

    //Determinamos que modo es el adecuado
    if(config->getMode() == 0)
    {
        // Creamos la consola
        Console *w = new Console(config);
        w->show();
        splash->finish(w);
    }
    else
    {
        HTTPRequest *http = new HTTPRequest(config);
        //Proporciona acceso a informacion de la pantalla en los sistemas multi-cabeza
        QDesktopWidget *m = QApplication::desktop();
        //Lista de instancias a las interfaces
        QList <SiTTuGAs *> list;
        //variable auxiliar para la instancia de cada interfaz
        SiTTuGAs *w;

        //En base al numero de pantallas es como itera este lazo
        for(int i=0; i<m->screenCount(); i++)
        {
            //Creamos el gestor de las interfaces *(se cargan todas las interfaces)
            w = new SiTTuGAs(config, http);

            //lista que contiene referencias a todos los gestores creados
            list.push_front(w);
            //Devuelve la geometria disponible por la pantalla
            QRect r1=m->availableGeometry(i);
            //Movemos la interfaz de acuerdo con los valores recabados anteriormente
            w->move(r1.x(),r1.y());
        }
        //Terminamos splash
        splash->finish(w);
        //Iteramos hasta desplegar todas las GUI de SiTTuGAs
        foreach(SiTTuGAs *W, list)
        {
            //Las pantallas mantienen un tamaño de  1024 X 662 por lo que para presentar la interfaz adecuadamente la pantalla debe tener la misma resolución
            //W->showFullScreen();
            //temporalmete utilizaremos solo el desplegado normal de la pantalla para cada instancia generada
            W->show();
        }
    }

    return a.exec();
}
コード例 #27
0
ファイル: main.cpp プロジェクト: dafx/sonic-visualizer
int
main(int argc, char **argv)
{
    svSystemSpecificInitialisation();

#ifdef Q_WS_X11
#if QT_VERSION >= 0x040500
//    QApplication::setGraphicsSystem("raster");
#endif
#endif

#ifdef Q_OS_MAC
    if (QSysInfo::MacintoshVersion > QSysInfo::MV_10_8) {
        // Fix for OS/X 10.9 font problem
        QFont::insertSubstitution(".Lucida Grande UI", "Lucida Grande");
    }
#endif

    SVApplication application(argc, argv);

    QStringList args = application.arguments();

    signal(SIGINT,  signalHandler);
    signal(SIGTERM, signalHandler);

#ifndef Q_OS_WIN32
    signal(SIGHUP,  signalHandler);
    signal(SIGQUIT, signalHandler);
#endif

    bool audioOutput = true;
    bool oscSupport = true;

    if (args.contains("--help") || args.contains("-h") || args.contains("-?")) {
        cerr << QApplication::tr(
            "\nSonic Visualiser is a program for viewing and exploring audio data\nfor semantic music analysis and annotation.\n\nUsage:\n\n  %1 [--no-audio] [--no-osc] [<file> ...]\n\n  --no-audio: Do not attempt to open an audio output device\n  --no-osc: Do not provide an Open Sound Control port for remote control\n  <file>: One or more Sonic Visualiser (.sv) and audio files may be provided.\n").arg(argv[0]) << endl;
        exit(2);
    }

    if (args.contains("--no-audio")) audioOutput = false;
    if (args.contains("--no-osc")) oscSupport = false;

    QApplication::setOrganizationName("sonic-visualiser");
    QApplication::setOrganizationDomain("sonicvisualiser.org");
    QApplication::setApplicationName(QApplication::tr("Sonic Visualiser"));

    QSplashScreen *splash = 0;

    QSettings settings;

    settings.beginGroup("Preferences");
    if (settings.value("show-splash", true).toBool()) {
        QPixmap pixmap(":/icons/sv-splash.png");
        QPainter painter;
        painter.begin(&pixmap);
        QString text = QString("v%1").arg(SV_VERSION);
        painter.drawText
            (pixmap.width() - painter.fontMetrics().width(text) - 10,
             10 + painter.fontMetrics().ascent(),
             text);
        painter.end();
        splash = new QSplashScreen(pixmap);
        splash->show();
        QTimer::singleShot(5000, splash, SLOT(hide()));
        application.processEvents();
    }
    settings.endGroup();

    settings.beginGroup("RDF");
    if (!settings.contains("rdf-indices")) {
        QStringList list;
        list << "http://www.vamp-plugins.org/rdf/plugins/index.txt";
        settings.setValue("rdf-indices", list);
    }
    settings.endGroup();

    QIcon icon;
    int sizes[] = { 16, 22, 24, 32, 48, 64, 128 };
    for (int i = 0; i < int(sizeof(sizes)/sizeof(sizes[0])); ++i) {
        icon.addFile(QString(":icons/sv-%1x%2.png").arg(sizes[i]).arg(sizes[i]));
    }
    QApplication::setWindowIcon(icon);

    QString language = QLocale::system().name();

    settings.beginGroup("Preferences");
    language = settings.value("locale", language).toString();
    settings.endGroup();

    QTranslator qtTranslator;
    QString qtTrName = QString("qt_%1").arg(language);
    SVDEBUG << "Loading " << qtTrName << "... ";
    bool success = false;
    if (!(success = qtTranslator.load(qtTrName))) {
        QString qtDir = getenv("QTDIR");
        if (qtDir != "") {
            success = qtTranslator.load
                (qtTrName, QDir(qtDir).filePath("translations"));
        }
    }
    if (!success) {
        SVDEBUG << "Failed\nFailed to load Qt translation for locale" << endl;
    } else {
        cerr << "Done" << endl;
    }
    application.installTranslator(&qtTranslator);

    QTranslator svTranslator;
    QString svTrName = QString("sonic-visualiser_%1").arg(language);
    SVDEBUG << "Loading " << svTrName << "... ";
    svTranslator.load(svTrName, ":i18n");
    SVDEBUG << "Done" << endl;
    application.installTranslator(&svTranslator);

    StoreStartupLocale();

    // Permit size_t and PropertyName to be used as args in queued signal calls
    qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");

    MainWindow *gui = new MainWindow(audioOutput, oscSupport);
    application.setMainWindow(gui);
    InteractiveFileFinder::setParentWidget(gui);
    TransformUserConfigurator::setParentWidget(gui);
    if (splash) {
        QObject::connect(gui, SIGNAL(hideSplash()), splash, SLOT(hide()));
    }

    QDesktopWidget *desktop = QApplication::desktop();
    QRect available = desktop->availableGeometry();

    int width = (available.width() * 2) / 3;
    int height = available.height() / 2;
    if (height < 450) height = (available.height() * 2) / 3;
    if (width > height * 2) width = height * 2;

    settings.beginGroup("MainWindow");

    QSize size = settings.value("size", QSize(width, height)).toSize();
    gui->resizeConstrained(size);

    if (settings.contains("position")) {
        QRect prevrect(settings.value("position").toPoint(), size);
        if (!(available & prevrect).isEmpty()) {
            gui->move(prevrect.topLeft());
        }
    }

    if (settings.value("maximised", false).toBool()) {
        gui->setWindowState(Qt::WindowMaximized);
    }

    settings.endGroup();
    
    gui->show();

    // The MainWindow class seems to have trouble dealing with this if
    // it tries to adapt to this preference before the constructor is
    // complete.  As a lazy hack, apply it explicitly from here
    gui->preferenceChanged("Property Box Layout");

    application.m_readyForFiles = true; // Ready to receive files from e.g. Apple Events

    for (QStringList::iterator i = args.begin(); i != args.end(); ++i) {

        if (i == args.begin()) continue;
        if (i->startsWith('-')) continue;

        QString path = *i;

        application.handleFilepathArgument(path, splash);
    }
    
    for (QStringList::iterator i = application.m_filepathQueue.begin(); i != application.m_filepathQueue.end(); ++i) {
        QString path = *i;
        application.handleFilepathArgument(path, splash);
    }
    
#ifdef HAVE_FFTW3F
    settings.beginGroup("FFTWisdom");
    QString wisdom = settings.value("wisdom").toString();
    if (wisdom != "") {
        fftwf_import_wisdom_from_string(wisdom.toLocal8Bit().data());
    }
#ifdef HAVE_FFTW3
    wisdom = settings.value("wisdom_d").toString();
    if (wisdom != "") {
        fftw_import_wisdom_from_string(wisdom.toLocal8Bit().data());
    }
#endif
    settings.endGroup();
#endif

    if (splash) splash->finish(gui);
    delete splash;

/*
    TipDialog tipDialog;
    if (tipDialog.isOK()) {
        tipDialog.exec();
    }
*/
    int rv = application.exec();

    gui->hide();

    cleanupMutex.lock();

    if (!cleanedUp) {
        TransformFactory::deleteInstance();
        TempDirectory::getInstance()->cleanup();
        cleanedUp = true;
    }

    application.releaseMainWindow();

#ifdef HAVE_FFTW3F
    settings.beginGroup("FFTWisdom");
    char *cwisdom = fftwf_export_wisdom_to_string();
    if (cwisdom) {
        settings.setValue("wisdom", cwisdom);
        free(cwisdom);
    }
#ifdef HAVE_FFTW3
    cwisdom = fftw_export_wisdom_to_string();
    if (cwisdom) {
        settings.setValue("wisdom_d", cwisdom);
        free(cwisdom);
    }
#endif
    settings.endGroup();
#endif

    FileSource::debugReport();
    
    delete gui;

    cleanupMutex.unlock();

    return rv;
}
コード例 #28
0
ファイル: main.cpp プロジェクト: KhuramAli/pcbsd
int main(int argc, char *argv[])
{
    QString changeLang;

    QApplication a(argc, argv);

    // Check what directory our app is in
    QString appDir;
    if ( QFile::exists("/usr/local/bin/pc-sysinstaller") )
      appDir = "/usr/local/share/pcbsd";
    else
      appDir = QCoreApplication::applicationDirPath();

    QTranslator translator;
    QLocale mylocale;
    QString langCode = mylocale.name();

    if ( ! changeLang.isEmpty() )       
       langCode = changeLang;

    if ( QFile::exists(appDir + "/i18n/SysInstaller_" + langCode + ".qm" ) ) {
      translator.load( QString("SysInstaller_") + langCode, appDir + "/i18n/" );
      a.installTranslator(&translator);
      qDebug() << "Loaded Translation:" << appDir + "/i18n/SysInstaller_" + langCode + ".qm";
    } else {
      qDebug() << "Could not find: " << appDir + "/i18n/SysInstaller_" + langCode + ".qm";
      langCode = "";
    }

    if ( argc == 2)
    {
      QString flag = argv[1];
      if ( flag == "-checkhardware" )
      {
        dialogCheckHardware d;
        QDesktopWidget *desk = a.desktop();
        QRect dimensions = desk->screenGeometry();
        int wid = dimensions.width();     // returns desktop width
        int hig = dimensions.height();    // returns desktop height
        d.setGeometry((wid/2) - (355/2), (hig/2) - (151/2), 355, 151);
        d.programInit();
        d.show();
        a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
        return a.exec();
      }
    }


    // Show our splash screen, so the user doesn't freak that that it takes a few seconds to show up
    QPixmap pixmap(":/PCBSD/images/pcbsdheader.png");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();

    Installer w;


    // Center the installer
    QRect dimensions = QApplication::desktop()->screenGeometry();
    int wid = dimensions.width();     // returns desktop width
    int hig = dimensions.height();    // returns desktop height
    w.setGeometry((wid/2) - (650/2), (hig/2) - (435/2), 650, 435);

    // Start the init
    w.initInstall(splash);

    w.show();
    splash->finish(&w);
    
    return a.exec();
}
コード例 #29
0
ファイル: main.cpp プロジェクト: app/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") );
	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;
	}
}
コード例 #30
0
ファイル: main.cpp プロジェクト: husninazer/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();
}