Example #1
0
void ExportProjectDialog::startBtnClicked()
{
	ProjectRenderer::ExportFileFormats ft = ProjectRenderer::NumFileFormats;

	for( int i = 0; i < ProjectRenderer::NumFileFormats; ++i )
	{
		if( ui->fileFormatCB->currentText() ==
				ProjectRenderer::tr( __fileEncodeDevices[i].m_description ) )
		{
			ft = __fileEncodeDevices[i].m_fileFormat;
			break;
		}
	}

	if( ft == ProjectRenderer::NumFileFormats )
	{
		QMessageBox::information( this, tr( "Error" ),
			tr( "Error while determining file-encoder device. "
				"Please try to choose a different output "
							"format." ) );
		reject();
		return;
	}

	ui->startButton->setEnabled( false );
	ui->progressBar->setEnabled( true );


	AudioOutputContext::QualitySettings qs =
		AudioOutputContext::QualitySettings(
			static_cast<AudioOutputContext::QualitySettings::Interpolation>(
										ui->interpolationCB->currentIndex() ),
			static_cast<AudioOutputContext::QualitySettings::Oversampling>(
										ui->oversamplingCB->currentIndex() ),
					ui->sampleExactControllersCB->isChecked(),
					ui->aliasFreeOscillatorsCB->isChecked() );

	ProjectRenderer::EncoderSettings es = ProjectRenderer::EncoderSettings(
		ui->samplerateCB->currentText().section( " ", 0, 0 ).toUInt(),
		false,
		ui->bitrateCB->currentText().section( " ", 0, 0 ).toUInt(),
		static_cast<ProjectRenderer::Depths>( ui->depthCB->currentIndex() ) );

	engine::getSong()->setExportLoop( ui->exportLoopCB->isChecked() );

	m_renderer = new ProjectRenderer( qs, es, ft, m_fileName );
	if( m_renderer->isReady() )
	{
		updateTitleBar( 0 );
		connect( m_renderer, SIGNAL( progressChanged( int ) ),
				ui->progressBar, SLOT( setValue( int ) ) );
		connect( m_renderer, SIGNAL( progressChanged( int ) ),
				this, SLOT( updateTitleBar( int ) ) );
		connect( m_renderer, SIGNAL( finished() ),
				this, SLOT( accept() ) );
		connect( m_renderer, SIGNAL( finished() ),
			engine::mainWindow(), SLOT( resetWindowTitle() ) );

		m_renderer->startProcessing();
	}
Example #2
0
void ExportProjectDialog::startExport()
{
	Mixer::qualitySettings qs =
			Mixer::qualitySettings(
					static_cast<Mixer::qualitySettings::Interpolation>(interpolationCB->currentIndex()),
					static_cast<Mixer::qualitySettings::Oversampling>(oversamplingCB->currentIndex()) );

	const int samplerates[5] = { 44100, 48000, 88200, 96000, 192000 };
	const int bitrates[6] = { 64, 128, 160, 192, 256, 320 };

	ProjectRenderer::OutputSettings os = ProjectRenderer::OutputSettings(
			samplerates[ samplerateCB->currentIndex() ],
			false,
			bitrates[ bitrateCB->currentIndex() ],
			static_cast<ProjectRenderer::Depths>( depthCB->currentIndex() ) );

	m_renderManager = new RenderManager( qs, os, m_ft, m_fileName );

	Engine::getSong()->setExportLoop( exportLoopCB->isChecked() );
	Engine::getSong()->setRenderBetweenMarkers( renderMarkersCB->isChecked() );

	connect( m_renderManager, SIGNAL( progressChanged( int ) ),
			progressBar, SLOT( setValue( int ) ) );
	connect( m_renderManager, SIGNAL( progressChanged( int ) ),
			this, SLOT( updateTitleBar( int ) )) ;
	connect( m_renderManager, SIGNAL( finished() ),
			this, SLOT( accept() ) );
	connect( m_renderManager, SIGNAL( finished() ),
			gui->mainWindow(), SLOT( resetWindowTitle() ) );

	if ( m_multiExport )
	{
		m_renderManager->renderTracks();
	}
	else
	{
		m_renderManager->renderProject();
	}
}
Example #3
0
void MainWindow::finalize()
{
	resetWindowTitle();
	setWindowIcon( embed::getIconPixmap( "icon" ) );


	// project-popup-menu
	QMenu * project_menu = new QMenu( this );
	menuBar()->addMenu( project_menu )->setText( tr( "&File" ) );
	project_menu->addAction( embed::getIconPixmap( "project_new" ),
					tr( "&New" ),
					this, SLOT( createNewProject() ),
					QKeySequence::New );

	m_templatesMenu = new QMenu( tr("New from template"), this );
	connect( m_templatesMenu, SIGNAL( aboutToShow() ), SLOT( fillTemplatesMenu() ) );
	connect( m_templatesMenu, SIGNAL( triggered( QAction * ) ),
		 SLOT( createNewProjectFromTemplate( QAction * ) ) );

	project_menu->addMenu(m_templatesMenu);

	project_menu->addAction( embed::getIconPixmap( "project_open" ),
					tr( "&Open..." ),
					this, SLOT( openProject() ),
					QKeySequence::Open );

	m_recentlyOpenedProjectsMenu = project_menu->addMenu(
				embed::getIconPixmap( "project_open_recent" ),
					tr( "&Recently Opened Projects" ) );
	connect( m_recentlyOpenedProjectsMenu, SIGNAL( aboutToShow() ),
			this, SLOT( updateRecentlyOpenedProjectsMenu() ) );
	connect( m_recentlyOpenedProjectsMenu, SIGNAL( triggered( QAction * ) ),
			this, SLOT( openRecentlyOpenedProject( QAction * ) ) );

	project_menu->addAction( embed::getIconPixmap( "project_save" ),
					tr( "&Save" ),
					this, SLOT( saveProject() ),
					QKeySequence::Save );
	project_menu->addAction( embed::getIconPixmap( "project_saveas" ),
					tr( "Save &As..." ),
					this, SLOT( saveProjectAs() ),
					Qt::CTRL + Qt::SHIFT + Qt::Key_S );
	project_menu->addAction( embed::getIconPixmap( "project_save" ),
					tr( "Save as New &Version" ),
					this, SLOT( saveProjectAsNewVersion() ),
					Qt::CTRL + Qt::ALT + Qt::Key_S );

	project_menu->addAction( tr( "Save as default template" ),
				     this, SLOT( saveProjectAsDefaultTemplate() ) );

	project_menu->addSeparator();
	project_menu->addAction( embed::getIconPixmap( "project_import" ),
					tr( "Import..." ),
					Engine::getSong(),
					SLOT( importProject() ) );
	project_menu->addAction( embed::getIconPixmap( "project_export" ),
					tr( "E&xport..." ),
					Engine::getSong(),
					SLOT( exportProject() ),
					Qt::CTRL + Qt::Key_E );
	project_menu->addAction( embed::getIconPixmap( "project_export" ),
					tr( "E&xport Tracks..." ),
					Engine::getSong(),
					SLOT( exportProjectTracks() ),
					Qt::CTRL + Qt::SHIFT + Qt::Key_E );

	// temporarily disabled broken MIDI export				
	/*project_menu->addAction( embed::getIconPixmap( "midi_file" ),
					tr( "Export &MIDI..." ),
					Engine::getSong(),
					SLOT( exportProjectMidi() ),
					Qt::CTRL + Qt::Key_M );*/

	project_menu->addSeparator();
	project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ),
					qApp, SLOT( closeAllWindows() ),
					Qt::CTRL + Qt::Key_Q );


	QMenu * edit_menu = new QMenu( this );
	menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) );
	m_undoAction = edit_menu->addAction( embed::getIconPixmap( "edit_undo" ),
					tr( "Undo" ),
					this, SLOT( undo() ),
					QKeySequence::Undo );
	m_redoAction = edit_menu->addAction( embed::getIconPixmap( "edit_redo" ),
					tr( "Redo" ),
					this, SLOT( redo() ),
					QKeySequence::Redo );
	// Ensure that both (Ctrl+Y) and (Ctrl+Shift+Z) activate redo shortcut regardless of OS defaults
	if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::Key_Y))
	{
		new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_Y ), this, SLOT(redo()) );
	}
	if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z ))
	{
		new QShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_Z ), this, SLOT(redo()) );
	}

	edit_menu->addSeparator();
	edit_menu->addAction( embed::getIconPixmap( "setup_general" ),
					tr( "Settings" ),
					this, SLOT( showSettingsDialog() ) );
	connect( edit_menu, SIGNAL(aboutToShow()), this, SLOT(updateUndoRedoButtons()) );

	m_viewMenu = new QMenu( this );
	menuBar()->addMenu( m_viewMenu )->setText( tr( "&View" ) );
	connect( m_viewMenu, SIGNAL( aboutToShow() ),
		 this, SLOT( updateViewMenu() ) );
	connect( m_viewMenu, SIGNAL(triggered(QAction*)), this,
		SLOT(updateConfig(QAction*)));


	m_toolsMenu = new QMenu( this );
	for( const Plugin::Descriptor* desc : pluginFactory->descriptors(Plugin::Tool) )
	{
		m_toolsMenu->addAction( desc->logo->pixmap(), desc->displayName );
		m_tools.push_back( ToolPlugin::instantiate( desc->name, /*this*/NULL )
						   ->createView(this) );
	}
	if( !m_toolsMenu->isEmpty() )
	{
		menuBar()->addMenu( m_toolsMenu )->setText( tr( "&Tools" ) );
		connect( m_toolsMenu, SIGNAL( triggered( QAction * ) ),
					this, SLOT( showTool( QAction * ) ) );
	}
QssEditor::QssEditor(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QssEditor),
    m_changed(false)
{
    ui->setupUi(this);

    // some default values
    QHash<QString, QVariant> defaultValues;

    defaultValues.insert(SETTING_PREVIEW_DELAY, 750);

    Settings::instance()->addDefaultValues(defaultValues);

    resetWindowTitle();

    // icons
    ui->toolOpen->setIcon(QIcon::fromTheme("document-open", QIcon(":/images/open.png")));
    ui->toolSave->setIcon(QIcon::fromTheme("document-save", QIcon(":/images/save.png")));
    ui->toolSaveAs->setIcon(QIcon::fromTheme("document-save-as", QIcon(":/images/saveas.png")));
    ui->toolClose->setIcon(QIcon::fromTheme("window-close", QIcon(":/images/close.png")));
    ui->toolUndo->setIcon(QIcon::fromTheme("edit-undo", QIcon(":/images/undo.png")));
    ui->toolRedo->setIcon(QIcon::fromTheme("edit-redo", QIcon(":/images/redo.png")));
    ui->toolOptions->setIcon(QIcon::fromTheme("preferences-system", QIcon(":/images/options.png")));

    // application shortcuts
    new QShortcut(QKeySequence::Quit, this, SLOT(slotQuit()));
    new QShortcut(QKeySequence::Find, this, SLOT(slotFind()));
    new QShortcut(QKeySequence::FindNext, this, SLOT(slotFindNext()));
    new QShortcut(QKeySequence::HelpContents, this, SLOT(slotAbout()));

    // shortcuts
    ui->toolOpen->setShortcut(QKeySequence::Open);
    ui->toolSave->setShortcut(QKeySequence::Save);
    ui->toolSaveAs->setShortcut(QKeySequence::SaveAs);
    ui->toolClose->setShortcut(QKeySequence::Close);

    // built-in Qt icon
    ui->toolAboutQt->setIcon(QIcon(
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    ":/qt-project.org/qmessagebox/images/qtlogo-64.png"
#else
    ":/trolltech/qmessagebox/images/qtlogo-64.png"
#endif
                                 ));

    // menu for toolbutton
    QMenu *toolButtonMenu = new QMenu(this);
    toolButtonMenu->addAction("Item1");
    toolButtonMenu->addSeparator();
    toolButtonMenu->addAction("Item2");
    ui->toolButton->setMenu(toolButtonMenu);

    m_timerDelayedApply = new QTimer(this);
    m_timerDelayedApply->setSingleShot(true);
    connect(m_timerDelayedApply, SIGNAL(timeout()), this, SLOT(slotApplyCss()));
    resetPreviewDelay();

    QTimer *timerProgress = new QTimer(this);
    timerProgress->setInterval(500);
    connect(timerProgress, SIGNAL(timeout()), this, SLOT(slotProgress()));
    timerProgress->start();

    ui->splitter->setCollapsible(0, false);
    ui->splitter->setStretchFactor(0, 1);

    // splitter size
    QList<int> list = QList<int>() << width()/2 << width()/2;
    ui->splitter->setSizes(list);

    // some MDI windows
    QMdiSubWindow *mdi = ui->mdiArea->addSubWindow(new QLabel("MDI", ui->mdiArea));
    mdi->resize(160, 80);

#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    ui->tree->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
    ui->table->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
#else
    ui->tree->header()->setResizeMode(QHeaderView::ResizeToContents);
    ui->table->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#endif

    ui->tree->topLevelItem(0)->setExpanded(true);

    ui->text->setCaretLineVisible(true);
    ui->text->setCaretLineBackgroundColor(QColor("gainsboro"));

    ui->text->setAutoIndent(true);
    ui->text->setIndentationGuides(false);
    ui->text->setIndentationsUseTabs(true);
    ui->text->setIndentationWidth(4);

    ui->text->setMarginsBackgroundColor(QColor("gainsboro"));
    ui->text->setMarginLineNumbers(1, true);
    ui->text->setMarginWidth(1, 50);

    ui->text->setAutoCompletionSource(QsciScintilla::AcsAll);
    ui->text->setAutoCompletionReplaceWord(true);
    ui->text->setAutoCompletionCaseSensitivity(false);
    ui->text->setAutoCompletionUseSingle(QsciScintilla::AcusAlways);
    ui->text->setAutoCompletionThreshold(0);

    ui->text->setBraceMatching(QsciScintilla::SloppyBraceMatch);
    ui->text->setMatchedBraceBackgroundColor(Qt::yellow);
    ui->text->setUnmatchedBraceForegroundColor(Qt::blue);

    // QSS lexer
    QsciLexerQSS *lexQss = new QsciLexerQSS(this);
    ui->text->setLexer(lexQss);

    ui->text->setFocus();
    ui->text->installEventFilter(this);

    restoreLastFiles();

    QTimer::singleShot(0, this, SLOT(slotDelayedOpen()));
}