예제 #1
0
파일: editwindow.cpp 프로젝트: lgarest/42
/*
========================
updateWindowTitle
========================
*/
void CBaseEditWindow::updateWindowTitle( void )
{
	CSourceEdit* doc = activeDocument();
	if( doc != NULL )
	{
		// get the base file name
		QString title = extractFileNameFromPath( doc->fileName() );
		if( title.length() == 0 ) // source not assigned to a file
			title = QString( CONFIG_STRING_FILE_UNTITLED );

		// add 'modified' flag
		if( doc->document()->isModified() ) {
			title += tr( "*" );
		}

		// lookup the shader type name
		QString shType = QString( " (%1) " ).
			arg( IShader::getShaderTypeName( doc->shaderType() ) );

		// add app title
		title += shType; // show shader type in the window title
		title += QString( " - " CONFIG_STRING_APPLICATION_TITLE );

		setWindowTitle( title );
	}
	else // no active document
	{
		setWindowTitle( CONFIG_STRING_APPLICATION_TITLE );
	}
}
예제 #2
0
SimpleString CodeMemoryReportFormatter::createVariableNameFromFileLineInfo(const char *file, int line)
{
    SimpleString fileNameOnly = extractFileNameFromPath(file);
    fileNameOnly.replace(".", "_");

    for (int i = 1; i < 100000; i++) {
		SimpleString variableName = StringFromFormat("%s_%d_%d", fileNameOnly.asCharString(), line, i);
		if (!variableExists(variableName))
			return variableName;
    }
    return "";
}
예제 #3
0
파일: scenewidget.cpp 프로젝트: lgarest/42
/*
========================
loadMesh

 brings up a load file dialog and then loads the selected model file.
========================
*/
void CSceneWidget::loadMesh( bool )
{
	if( m_meshModel == NULL )
		return;

	// setup initial directory
	QString initialDir = m_meshFileName;
	if( initialDir.isEmpty() )
		initialDir = QString( CONFIG_MODEL_DIRECTORY );

	//
	// select a file name
	//
	QString fileName = QFileDialog::getOpenFileName( this,
		QString( "Open .OBJ model" ), initialDir,
		QString( "Wavefront Objects (*.obj);;All Files (*)" ) );
	if( !fileName.isEmpty() )
	{
		// try to load the model.
		if( !m_meshModel->loadObjModel( fileName ) )
		{
			QMessageBox::warning( this, CONFIG_STRING_ERRORDLG_TITLE,
				QString( "Failed to load mesh file %1." ).arg( fileName ) );
		}

		// loading succeeded, save the file name.
		else
		{
			m_meshFileName = fileName;
			m_btnLoadMesh->setText( extractFileNameFromPath( fileName ) );

			// make the mesh active
			if( m_meshModelIndex != -1 )
			{
				m_activeModel->setCurrentIndex( m_meshModelIndex );
			}
		}
	}
}