Merge pull request #2165 from zonkmachine/openRecentFix

Recent file menu fixes
This commit is contained in:
Colin Wallace
2015-07-06 13:16:51 -07:00
2 changed files with 16 additions and 3 deletions

View File

@@ -197,7 +197,7 @@ void ConfigManager::addRecentlyOpenedProject( const QString & _file )
if( !_file.endsWith( ".mpt", Qt::CaseInsensitive ) )
{
m_recentlyOpenedProjects.removeAll( _file );
if( m_recentlyOpenedProjects.size() > 15 )
if( m_recentlyOpenedProjects.size() > 30 )
{
m_recentlyOpenedProjects.removeLast();
}

View File

@@ -830,10 +830,23 @@ void MainWindow::updateRecentlyOpenedProjectsMenu()
{
m_recentlyOpenedProjectsMenu->clear();
QStringList rup = ConfigManager::inst()->recentlyOpenedProjects();
// The file history goes 30 deep but we only show the 15
// most recent ones that we can open.
int shownInMenu = 0;
for( QStringList::iterator it = rup.begin(); it != rup.end(); ++it )
{
m_recentlyOpenedProjectsMenu->addAction(
embed::getIconPixmap( "project_file" ), *it );
QFileInfo recentFile( *it );
if ( recentFile.exists() )
{
m_recentlyOpenedProjectsMenu->addAction(
embed::getIconPixmap( "project_file" ), *it );
shownInMenu++;
if( shownInMenu >= 15 )
{
return;
}
}
}
}