本文整理汇总了C++中Preferences::getLastSongFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ Preferences::getLastSongFilename方法的具体用法?C++ Preferences::getLastSongFilename怎么用?C++ Preferences::getLastSongFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::getLastSongFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MainForm::MainForm( QApplication *app, const QString& songFilename )
: QMainWindow( 0, 0 )
, Object( __class_name )
{
setMinimumSize( QSize( 1000, 500 ) );
setWindowIcon( QPixmap( Skin::getImagePath() + "/icon16.png" ) );
#ifndef WIN32
if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sigusr1Fd))
qFatal("Couldn't create HUP socketpair");
snUsr1 = new QSocketNotifier(sigusr1Fd[1], QSocketNotifier::Read, this);
connect(snUsr1, SIGNAL(activated(int)), this, SLOT( handleSigUsr1() ));
#endif
m_pQApp = app;
m_pQApp->processEvents();
// Load default song
Song *pSong = NULL;
if ( !songFilename.isEmpty() ) {
pSong = Song::load( songFilename );
/*
* If the song could not be loaded, create
* a new one with the specified filename
*/
if (pSong == NULL) {
pSong = Song::get_empty_song();
pSong->set_filename( songFilename );
}
}
else {
Preferences *pref = Preferences::get_instance();
bool restoreLastSong = pref->isRestoreLastSongEnabled();
QString filename = pref->getLastSongFilename();
if ( restoreLastSong && ( !filename.isEmpty() )) {
pSong = Song::load( filename );
if (pSong == NULL) {
//QMessageBox::warning( this, "Hydrogen", trUtf8("Error restoring last song.") );
pSong = Song::get_empty_song();
pSong->set_filename( "" );
}
}
else {
pSong = Song::get_empty_song();
pSong->set_filename( "" );
}
}
h2app = new HydrogenApp( this, pSong );
h2app->addEventListener( this );
createMenuBar();
h2app->setStatusBarMessage( trUtf8("Hydrogen Ready."), 10000 );
initKeyInstMap();
// we need to do all this to support the keyboard playing
// for all the window modes
h2app->getMixer()->installEventFilter (this);
h2app->getPatternEditorPanel()->installEventFilter (this);
h2app->getPatternEditorPanel()->getPianoRollEditor()->installEventFilter (this);
h2app->getSongEditorPanel()->installEventFilter (this);
h2app->getPlayerControl()->installEventFilter(this);
InstrumentEditorPanel::get_instance()->installEventFilter(this);
h2app->getAudioEngineInfoForm()->installEventFilter(this);
h2app->getDirector()->installEventFilter(this);
// h2app->getPlayListDialog()->installEventFilter(this);
installEventFilter( this );
showDevelWarning();
connect( &m_autosaveTimer, SIGNAL(timeout()), this, SLOT(onAutoSaveTimer()));
m_autosaveTimer.start( 60 * 1000 );
#ifdef H2CORE_HAVE_LASH
if ( Preferences::get_instance()->useLash() ){
LashClient* lashClient = LashClient::get_instance();
if (lashClient->isConnected())
{
// send alsa client id now since it can only be sent
// after the audio engine has been started.
Preferences *pref = Preferences::get_instance();
if ( pref->m_sMidiDriver == "ALSA" ) {
// infoLog("[LASH] Sending alsa seq id to LASH server");
lashClient->sendAlsaClientId();
}
// start timer for polling lash events
lashPollTimer = new QTimer(this);
connect( lashPollTimer, SIGNAL( timeout() ), this, SLOT( onLashPollTimer() ) );
lashPollTimer->start(500);
}
}
#endif
//.........这里部分代码省略.........
示例2: main
//.........这里部分代码省略.........
* for example if you start hydrogen from a local
* build directory.
*/
// QString path = pQApp->applicationFilePath();
// preferences->setJackSessionApplicationPath ( path );
#endif
Hydrogen::create_instance();
Hydrogen *pHydrogen = Hydrogen::get_instance();
Song *pSong = NULL;
Playlist *pPlaylist = NULL;
// Load playlist
if ( ! playlistFilename.isEmpty() ) {
pPlaylist = Playlist::load ( playlistFilename );
if ( ! pPlaylist ) {
___ERRORLOG( "Error loading the playlist" );
return 0;
}
/* Load first song */
preferences->setLastPlaylistFilename( playlistFilename );
pPlaylist->loadSong( 0 );
pSong = pHydrogen->getSong();
show_playlist ( pHydrogen, pPlaylist->getActiveSongNumber() );
}
// Load song - if wasn't already loaded with playlist
if ( ! pSong ) {
if ( !songFilename.isEmpty() ) {
pSong = Song::load( songFilename );
} else {
/* Try load last song */
bool restoreLastSong = preferences->isRestoreLastSongEnabled();
QString filename = preferences->getLastSongFilename();
if ( restoreLastSong && ( !filename.isEmpty() ))
pSong = Song::load( filename );
}
/* Still not loaded */
if (! pSong) {
___INFOLOG("Starting with empty song");
pSong = Song::get_empty_song();
pSong->set_filename( "" );
}
pHydrogen->setSong( pSong );
preferences->setLastSongFilename( songFilename );
}
if ( ! drumkitToLoad.isEmpty() ){
Drumkit* drumkitInfo = Drumkit::load_by_name( drumkitToLoad, true );
if ( drumkitInfo ) {
pHydrogen->loadDrumkit( drumkitInfo );
} else {
___ERRORLOG ( "Error loading the drumkit" );
}
}
AudioEngine* AudioEngine = AudioEngine::get_instance();
Sampler* sampler = AudioEngine->get_sampler();
switch ( interpolation ) {
case 1:
sampler->setInterpolateMode( Sampler::COSINE );
break;
case 2:
sampler->setInterpolateMode( Sampler::THIRD );