Added view menu

To be reviewed and reverted if undesired.

Based on https://sourceforge.net/p/lmms/patches/38/

Signed-off-by: Tobias Doerffel <tobias.doerffel@gmail.com>
This commit is contained in:
Raine M. Ekman
2015-02-17 23:36:53 +01:00
committed by Tobias Doerffel
parent 15e759b6d3
commit 96882f44d5
2 changed files with 117 additions and 1 deletions

View File

@@ -74,7 +74,8 @@ MainWindow::MainWindow() :
m_templatesMenu( NULL ),
m_recentlyOpenedProjectsMenu( NULL ),
m_toolsMenu( NULL ),
m_autoSaveTimer( this )
m_autoSaveTimer( this ),
m_viewMenu( NULL )
{
setAttribute( Qt::WA_DeleteOnClose );
@@ -300,6 +301,13 @@ void MainWindow::finalize()
tr( "Settings" ),
this, SLOT( showSettingsDialog() ) );
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 );
Plugin::DescriptorList pluginDescriptors;
@@ -1008,6 +1016,111 @@ void MainWindow::toggleFxMixerWin()
}
void MainWindow::updateViewMenu()
{
m_viewMenu->clear();
// TODO: get current visibility for these and indicate in menu?
// Not that it's straight visible <-> invisible, more like
// not on top -> top <-> invisible
m_viewMenu->addAction(embed::getIconPixmap( "songeditor" ),
tr( "Song Editor" ) + " (F5)",
this, SLOT( toggleSongEditorWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "bb_track" ),
tr( "Pattern Editor" ) + " (F6)",
this, SLOT( toggleBBEditorWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "piano" ),
tr( "Piano Roll" ) + " (F7)",
this, SLOT( togglePianoRollWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "automation" ),
tr( "Automation Editor" ) + " (F8)",
this,
SLOT( toggleAutomationEditorWin())
);
m_viewMenu->addAction(embed::getIconPixmap( "fx_mixer" ),
tr( "FX Mixer" ) + " (F9)",
this, SLOT( toggleFxMixerWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "project_notes" ),
tr( "Project Notes" ) + " (F10)",
this, SLOT( toggleProjectNotesWin() )
);
m_viewMenu->addAction(embed::getIconPixmap( "controller" ),
tr( "Show/hide controller rack" ) +
" (F11)",
this, SLOT( toggleControllerRack() )
);
m_viewMenu->addSeparator();
// Here we should put all look&feel -stuff from configmanager
// that is safe to change on the fly. There is probably some
// more elegant way to do this.
QAction *qa;
qa = new QAction(tr( "Volume as dBV" ), this);
qa->setData("displaydbv");
qa->setCheckable( true );
qa->setChecked( ConfigManager::inst()->value( "app", "displaydbv" ).
toInt() ? true : false );
m_viewMenu->addAction(qa);
// Maybe this is impossible?
/* qa = new QAction(tr( "Tooltips" ), this);
qa->setData("tooltips");
qa->setCheckable( true );
qa->setChecked( ConfigManager::inst()->value( "tooltips", "disabled" ).
toInt() ? false : true );
m_viewMenu->addAction(qa);
*/
// Should be doable.
/* qa = new QAction(tr( "Smooth scroll" ), this);
qa->setData("smoothscroll");
qa->setCheckable( true );
qa->setChecked( ConfigManager::inst()->value( "ui", "smoothscroll" ).
toInt() ? true : false );
m_viewMenu->addAction(qa);
*/
// Not yet.
/* qa = new QAction(tr( "One instrument track window" ), this);
qa->setData("oneinstrument");
qa->setCheckable( true );
qa->setChecked( ConfigManager::inst()->value( "ui", "oneinstrumenttrackwindow" ).
toInt() ? true : false );
m_viewMenu->addAction(qa);
*/
}
void MainWindow::updateConfig( QAction * _who )
{
QString tag = _who->data().toString();
bool checked = _who->isChecked();
if( tag == "displaydbv" )
{
ConfigManager::inst()->setValue( "app", "displaydbv",
QString::number(checked) );
}
else if ( tag == "tooltips" )
{
ConfigManager::inst()->setValue( "tooltips", "disabled",
QString::number(!checked) );
}
else if ( tag == "smoothscroll" )
{
ConfigManager::inst()->setValue( "ui", "smoothscroll",
QString::number(checked) );
}
else if ( tag == "oneinstrument" )
{
ConfigManager::inst()->setValue( "ui", "oneinstrumenttrackwindow",
QString::number(checked) );
}
}
void MainWindow::toggleControllerRack()