[Marble-commits] KDE/kdeedu/marble/src/lib
Thibaut Gridel
tgridel at free.fr
Sat Jan 15 14:34:16 CET 2011
SVN commit 1214586 by tgridel:
defer model connection to last moment.
This makes first loading of data happenning without proxies above
M +10 -0 FileManager.cpp
M +14 -4 MarbleDataFacade.cpp
M +2 -0 MarbleDataFacade.h
--- trunk/KDE/kdeedu/marble/src/lib/FileManager.cpp #1214585:1214586
@@ -85,6 +85,7 @@
{
if ( !containers().contains( filepath ) ) {
mDebug() << "adding container:" << filepath;
+ d->m_datafacade->connectTree( false );
FileLoader* loader = new FileLoader( this, filepath );
appendLoader( loader );
d->m_pathList.append( filepath );
@@ -93,6 +94,7 @@
void FileManager::addData( const QString &name, const QString &data )
{
+ d->m_datafacade->connectTree( false );
FileLoader* loader = new FileLoader( this, data, name );
appendLoader( loader );
}
@@ -166,6 +168,14 @@
d->m_pathList.removeAll( loader->path() );
delete loader;
}
+ if (d->m_loaderList.isEmpty() )
+ {
+ mDebug() << "Empty loader list, connecting";
+ QTime t;
+ t.start();
+ d->m_datafacade->connectTree( true );
+ mDebug() << "Done " << t.elapsed() << " ms";
}
+}
#include "FileManager.moc"
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.cpp #1214585:1214586
@@ -48,11 +48,10 @@
m_fileviewmodel( new FileViewModel() ),
m_treemodel( new GeoDataTreeModel),
m_descendantproxy( new KDescendantsProxyModel ),
- m_sortproxy( new QSortFilterProxyModel )
+ m_sortproxy( new QSortFilterProxyModel ),
+ m_dummytree( new GeoDataTreeModel )
{
- m_descendantproxy->setSourceModel( m_treemodel );
-
- m_sortproxy->setFilterRegExp( QRegExp( GeoDataTypes::GeoDataPlacemarkType ) );
+ m_sortproxy->setFilterFixedString( GeoDataTypes::GeoDataPlacemarkType );
m_sortproxy->setFilterKeyColumn( 1 );
m_sortproxy->setSourceModel( m_descendantproxy );
}
@@ -63,6 +62,7 @@
delete m_treemodel;
delete m_descendantproxy;
delete m_sortproxy;
+ delete m_dummytree;
}
MarbleModel *m_model;
@@ -70,6 +70,7 @@
GeoDataTreeModel *m_treemodel;
KDescendantsProxyModel *m_descendantproxy;
QSortFilterProxyModel *m_sortproxy;
+ GeoDataTreeModel *m_dummytree;
};
@@ -139,5 +140,14 @@
return d->m_treemodel;
}
+void MarbleDataFacade::connectTree(bool connect) const
+{
+ if ( connect ) {
+ d->m_descendantproxy->setSourceModel( d->m_treemodel );
+ } else {
+ d->m_descendantproxy->setSourceModel( d->m_dummytree );
}
+}
+}
+
--- trunk/KDE/kdeedu/marble/src/lib/MarbleDataFacade.h #1214585:1214586
@@ -91,6 +91,8 @@
GeoDataTreeModel* treeModel() const;
+ void connectTree(bool connect) const;
+
private:
MarbleDataFacadePrivate * const d;
};
More information about the Marble-commits
mailing list