mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-01-12 09:08:53 +01:00
Added saveFirstPlaylist key to save the current playlist as firstPlaylist in the settings_saved.conf file.
This commit is contained in:
parent
c8a12bac13
commit
1d0962eafe
@ -76,6 +76,7 @@ bool UserInput::initialize()
|
||||
MapKey("random", KeyCodeRandom, false);
|
||||
MapKey("menu", KeyCodeMenu, false);
|
||||
MapKey("reboot", KeyCodeReboot, false);
|
||||
MapKey("saveFirstPlaylist", KeyCodeSaveFirstPlaylist, false);
|
||||
|
||||
bool retVal = true;
|
||||
|
||||
|
||||
@ -63,6 +63,7 @@ public:
|
||||
KeyCodeHideItem,
|
||||
KeyCodeQuit,
|
||||
KeyCodeReboot,
|
||||
KeyCodeSaveFirstPlaylist,
|
||||
KeyCodeMax
|
||||
};
|
||||
|
||||
|
||||
@ -74,6 +74,7 @@ RetroFE::RetroFE( Configuration &c )
|
||||
menuMode_ = false;
|
||||
attractMode_ = false;
|
||||
attractModePlaylistCollectionNumber_ = 0;
|
||||
firstPlaylist_ = "all";
|
||||
}
|
||||
|
||||
|
||||
@ -459,9 +460,8 @@ bool RetroFE::run( )
|
||||
|
||||
currentPage_->pushCollection(info);
|
||||
|
||||
std::string firstPlaylist = "all";
|
||||
config_.getProperty( "firstPlaylist", firstPlaylist );
|
||||
currentPage_->selectPlaylist( firstPlaylist );
|
||||
config_.getProperty( "firstPlaylist", firstPlaylist_ );
|
||||
currentPage_->selectPlaylist( firstPlaylist_ );
|
||||
|
||||
currentPage_->onNewItemSelected( );
|
||||
currentPage_->reallocateMenuSpritePoints( );
|
||||
@ -1556,6 +1556,16 @@ RetroFE::RETROFE_STATE RetroFE::processUserInput( Page *page )
|
||||
reboot_ = true;
|
||||
state = RETROFE_QUIT_REQUEST;
|
||||
}
|
||||
|
||||
else if (input_.keystate(UserInput::KeyCodeSaveFirstPlaylist))
|
||||
{
|
||||
attract_.reset( );
|
||||
if ( page->getMenuDepth( ) == 1 )
|
||||
{
|
||||
firstPlaylist_ = page->getPlaylistName( );
|
||||
saveRetroFEState( );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we're done scrolling
|
||||
@ -1768,3 +1778,21 @@ CollectionInfo *RetroFE::getMenuCollection( std::string collectionName )
|
||||
collection->playlists["all"] = &collection->items;
|
||||
return collection;
|
||||
}
|
||||
|
||||
|
||||
void RetroFE::saveRetroFEState( )
|
||||
{
|
||||
std::string file = Utils::combinePath(Configuration::absolutePath, "settings_saved.conf");
|
||||
Logger::write(Logger::ZONE_INFO, "RetroFE", "Saving settings_saved.conf");
|
||||
std::ofstream filestream;
|
||||
try
|
||||
{
|
||||
filestream.open(file.c_str());
|
||||
filestream << "firstPlaylist = " << firstPlaylist_ << std::endl;
|
||||
filestream.close();
|
||||
}
|
||||
catch(std::exception &)
|
||||
{
|
||||
Logger::write(Logger::ZONE_ERROR, "RetroFE", "Save failed: " + file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,6 +117,7 @@ private:
|
||||
void update( float dt, bool scrollActive );
|
||||
CollectionInfo *getCollection( std::string collectionName );
|
||||
CollectionInfo *getMenuCollection( std::string collectionName );
|
||||
void saveRetroFEState( );
|
||||
|
||||
Configuration &config_;
|
||||
DB *db_;
|
||||
@ -136,6 +137,7 @@ private:
|
||||
bool attractMode_;
|
||||
int attractModePlaylistCollectionNumber_;
|
||||
bool reboot_;
|
||||
std::string firstPlaylist_;
|
||||
|
||||
std::map<std::string, unsigned int> lastMenuOffsets_;
|
||||
std::map<std::string, std::string> lastMenuPlaylists_;
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
std::string retrofe_version_major = "0";
|
||||
std::string retrofe_version_minor = "9";
|
||||
std::string retrofe_version_build = "35";
|
||||
std::string retrofe_version_build = "36";
|
||||
|
||||
|
||||
std::string Version::getString( )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user