Ejemplo n.º 1
0
/*---------------------------------------------------------------------------
   Program entry point.
  ---------------------------------------------------------------------------*/
int cdeclare main(int argc, char** argv)
   {
   int Error = 0;

   Q_INIT_RESOURCE(kfx_resource);
   
   QApplication Application(argc, argv);

   try {
      Application.setApplicationName(NAMESPACE_PROJECT::AppName);
      Application.setApplicationVersion(NAMESPACE_PROJECT::AppVersion);
      Application.setOrganizationName(NAMESPACE_PROJECT::AppOrg);
      Application.setOrganizationDomain(NAMESPACE_PROJECT::AppAuthorWeb);

      MainCreateLogFile();
      MainSetAssetDir();

      if (!QGLFormat::hasOpenGL())
         {throw dexception("This system does not support OpenGL.");}

      if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
         {throw dexception("This system does not support OpenGL framebuffer objects.");}

      FormWindow Window;
      Window.show();

      Error = Application.exec();
      }

   catch (std::exception &e)
      {
      QMessageBox::information(nullptr, NAMESPACE_PROJECT::AppName, e.what());
      Error = MAIN_EXIT_ERROR;
      }

   catch (...)
      {
      QMessageBox::information(nullptr, NAMESPACE_PROJECT::AppName, "Trapped an unhandled exception.");
      Error = MAIN_EXIT_ERROR;
      }

   NAMESPACE_PROJECT::Debug::Close();

   return Error;
   }
Ejemplo n.º 2
0
void Project::designerCreated()
{
    for ( FormFile *ff = formfiles.first(); ff; ff = formfiles.next() ) {
	FormWindow *fw = ff->formWindow();
	if ( !fw || fw->mainWindow() )
	    continue;
	fw->setMainWindow( MainWindow::self );
	connect( fw, SIGNAL( undoRedoChanged( bool, bool, const QString &,
					      const QString & ) ),
		 MainWindow::self, SLOT( updateUndoRedo( bool, bool,
					 const QString &, const QString & ) ) );
	fw->reparent( MainWindow::self->qWorkspace(), QPoint( 0, 0 ), FALSE );
	QApplication::sendPostedEvents( MainWindow::self->qWorkspace(),
					QEvent::ChildInserted );
	fw->parentWidget()->setFixedSize( 1, 1 );
	fw->show();
    }
}
Ejemplo n.º 3
0
void Project::addObject( QObject *o )
{
    bool wasModified = modified;
    objs.append( o );
    FormFile *ff = new FormFile( "", FALSE, this, "qt_fakewindow" );
    ff->setFileName( "__APPOBJ" + QString( o->name() ) + ".ui" );
    fakeFormFiles.insert( (void*)o, ff );
    MetaDataBase::addEntry( o );
    if ( hasGUI() ) {
	QWidget *parent = MainWindow::self ? MainWindow::self->qWorkspace() : 0;
	FormWindow *fw = new FormWindow( ff, MainWindow::self, parent, "qt_fakewindow" );
	fw->setProject( this );
	if ( QFile::exists( ff->absFileName() ) )
	    Resource::loadExtraSource( ff, ff->absFileName(),
				       MetaDataBase::languageInterface( language() ), FALSE );
	if ( MainWindow::self )
	    fw->setMainWindow( MainWindow::self );
	if ( MainWindow::self ) {
	    QApplication::sendPostedEvents( MainWindow::self->qWorkspace(), QEvent::ChildInserted );
	    connect( fw,
		     SIGNAL( undoRedoChanged( bool, bool, const QString &, const QString & ) ),
		     MainWindow::self,
		     SLOT( updateUndoRedo( bool, bool, const QString &, const QString & ) )
		);
	}
	if ( fw->parentWidget() ) {
	    fw->parentWidget()->setFixedSize( 1, 1 );
	    fw->show();
	}
    } else {
	if ( QFile::exists( ff->absFileName() ) )
	    Resource::loadExtraSource( ff, ff->absFileName(),
				       MetaDataBase::languageInterface( language() ), FALSE );
    }
    emit objectAdded( o );
    modified = wasModified;
}