Ejemplo n.º 1
0
//-------------------------------------------------------------------------
void MainWindow::exportRectDialog(const QRectF& exportRectangle )
{
	//Select filename & export type
	QString savePath = getFileDialogPath();
	if ( savePath == "" )
		savePath = windowFilePath();
	savePath += "/" + QFileInfo(windowFilePath()).fileName();

	QString filters =	PNG_FILE_FILTER 
					+	QString("\n") +	PDF_FILE_FILTER
//					+	QString("\n") +	PS_FILE_FILTER
					;
	QString selectedFilter("");
	QString fileName = QFileDialog::getSaveFileName(this, tr("Export the scene"),
							savePath,
							tr(filters.toAscii().data()) ,
							&selectedFilter);

	if ( fileName.isEmpty() )
		return;
	
	setLastManagedFile(fileName);
	formatFileName(fileName,selectedFilter,filters);

	exportRect( exportRectangle , fileName , selectedFilter );
}
Ejemplo n.º 2
0
//-------------------------------------------------------------------------
void MainWindow::exportItemToMidi()
{
	QLanguageItem * container = dynamic_cast<QLanguageItem *>( sender() );
	assert(container);

	QString savePath;
	if ( container->file().length() )
		savePath = QFileInfo( container->file() ).absolutePath();
	if ( savePath == "" )	
		savePath = windowFilePath();
	if ( savePath == "" )
		savePath = QDir::homePath();

	savePath += "/" + container->name();

	QString filters = MIDI_FILE_FILTER;

	QString selectedFilter("");
	QString fileName = QFileDialog::getSaveFileName(this, tr("Export item"),
                            savePath,
                            tr(filters.toAscii().data()) ,
							&selectedFilter);

	if ( fileName.isEmpty() )
		return;

	formatFileName(fileName,selectedFilter,filters);

	QGuidoAR::midiExport(container->code() , fileName );
}
Ejemplo n.º 3
0
void Exception::formatEntry(std::ostream &stream, size_t depth) const {
	LocaleUtils::CLocaleScope localeScope(stream);

	if (depth > maxDepth_) {
		return;
	}

	if (hasTypeName(depth)) {
		formatTypeName(stream, depth);
	}
	else {
		stream << "(Unknown exception)";
	}

	if (hasFileName(depth)) {
		stream << " ";
		formatFileName(stream, depth);
	}

	if (hasFunctionName(depth)) {
		stream << " ";
		formatFunctionName(stream, depth);
	}

	if (hasLineNumber(depth)) {
		stream << " line=" << getLineNumber(depth);
	}

	if (hasErrorCode(depth)) {
		stream << " [";

		if (!hasErrorCodeName(depth)) {
			stream << "Code:";
		}

		stream << getErrorCode(depth);

		if (hasErrorCodeName(depth)) {
			stream << ":";
			formatErrorCodeName(stream, depth);
		}

		stream << "]";
	}

	if (hasMessage(depth)) {
		stream << " " ;
		formatMessage(stream, depth);
	}
#ifdef UTIL_STACK_TRACE_ENABLED

	if (hasStackTrace(depth)) {
		stream << " : " ;
		formatStackTrace(stream, depth);
	}
#endif
}
Ejemplo n.º 4
0
//-------------------------------------------------------------------------
void MainWindow::exportItem(QGuidoItemContainer * item)
{
	//Select filename & export type
	QString savePath;
	if ( item->file().length() )
		savePath = QFileInfo( item->file() ).absolutePath();
	if ( savePath == "" )	
		savePath = getFileDialogPath();

	savePath += "/" + item->name();

	QString filters =	PNG_FILE_FILTER 
					+	QString("\n") +	PDF_FILE_FILTER
//					+	QString("\n") +	GMN_FILE_FILTER
//						+	QString("\n") +	PS_FILE_FILTER
					;
	QString selectedFilter("");
	QString fileName = QFileDialog::getSaveFileName(this, "Export the selected " + GraphicsSceneMainWindow::applicationSettings().mLanguageNameShort + " item",
							savePath,
							tr(filters.toAscii().data()) ,
							&selectedFilter);

	if ( fileName.isEmpty() )
		return;
		
	formatFileName(fileName,selectedFilter,filters);
	setLastManagedFile(fileName );


	if ( selectedFilter == PNG_FILE_FILTER )
	{
		int result = QResolutionDialog( item->guidoItem()->boundingRect() , EXPORT_MIN_DETAIL , EXPORT_MAX_DETAIL , EXPORT_DEFAULT_DETAIL , EXPORT_DETAIL_TO_SCALE_FACTOR ).exec();
		if ( result )
			itemToImage( item->guidoItem() , result * EXPORT_DETAIL_TO_SCALE_FACTOR , QColor(Qt::white).rgb() ).save( fileName );

		return;
	}
	
	if ( selectedFilter == PDF_FILE_FILTER )
	{
		item->exportToPdf( fileName );
		return;
	}

	assert(0);
}
Ejemplo n.º 5
0
void Exception::formatField(
		std::ostream &stream, FieldType fieldType, size_t depth) const {

	switch (fieldType) {
	case FIELD_ERROR_CODE:
		{
			LocaleUtils::CLocaleScope localeScope(stream);
			stream << getErrorCode(depth);
		}
		break;
	case FIELD_ERROR_CODE_NAME:
		formatErrorCodeName(stream, depth);
		break;
	case FIELD_MESSAGE:
		formatMessage(stream, depth);
		break;
	case FIELD_FILE_NAME:
		formatFileName(stream, depth);
		break;
	case FIELD_FUNCTION_NAME:
		formatFunctionName(stream, depth);
		break;
	case FIELD_LINE_NUMBER:
		{
			LocaleUtils::CLocaleScope localeScope(stream);
			stream << getLineNumber(depth);
		}
		break;
	case FIELD_STACK_TRACE:
		formatStackTrace(stream, depth);
		break;
	case FIELD_TYPE_NAME:
		formatTypeName(stream, depth);
		break;
	default:
		assert(false);
		break;
	}
}