Skip to content

Commit cee2871

Browse files
committed
Proposed fix for 1150 Preset Browser: division between factory and user files fails if factory has folders
1 parent 9e4db14 commit cee2871

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/FileBrowser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ class Directory : public QTreeWidgetItem
161161
QStringList m_directories;
162162
QString m_filter;
163163

164+
int m_dirCount;
165+
164166
} ;
165167

166168

src/gui/FileBrowser.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,8 @@ Directory::Directory(const QString & filename, const QString & path,
708708
const QString & filter ) :
709709
QTreeWidgetItem( QStringList( filename ), TypeDirectoryItem ),
710710
m_directories( path ),
711-
m_filter( filter )
711+
m_filter( filter ),
712+
m_dirCount( 0 )
712713
{
713714
initPixmaps();
714715

@@ -762,6 +763,7 @@ void Directory::update( void )
762763
setIcon( 0, *s_folderOpenedPixmap );
763764
if( !childCount() )
764765
{
766+
m_dirCount = 0;
765767
for( QStringList::iterator it = m_directories.begin();
766768
it != m_directories.end(); ++it )
767769
{
@@ -776,7 +778,7 @@ void Directory::update( void )
776778
"--- Factory files ---" ) );
777779
sep->setIcon( 0, embed::getIconPixmap(
778780
"factory_files" ) );
779-
insertChild( top_index, sep );
781+
insertChild( m_dirCount + top_index - 1, sep );
780782
}
781783
}
782784
}
@@ -814,6 +816,7 @@ bool Directory::addItems(const QString & path )
814816
insertChild( i, new Directory( cur_file,
815817
path, m_filter ) );
816818
orphan = false;
819+
m_dirCount++;
817820
break;
818821
}
819822
else if( cur_file == d->text( 0 ) )
@@ -827,6 +830,7 @@ bool Directory::addItems(const QString & path )
827830
{
828831
addChild( new Directory( cur_file, path,
829832
m_filter ) );
833+
m_dirCount++;
830834
}
831835

832836
added_something = true;

0 commit comments

Comments
 (0)