[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [pairs/new_qml2] src: Delay models initialization. Improves a lot
From: Aleix Pol <aleixpol () kde ! org>
Date: 2011-11-30 23:57:25
Message-ID: 20111130235725.14BE4A60C9 () git ! kde ! org
[Download RAW message or body]
Git commit fe8c45745ddd33f59a5f6173f3d6d16715bd3d6a by Aleix Pol.
Committed on 01/12/2011 at 00:57.
Pushed by apol into branch 'new_qml2'.
Delay models initialization. Improves a lot startup time.
M +1 -1 src/playersmodel.cpp
M +3 -2 src/playersmodel.h
M +2 -1 src/themesmodel.cpp
http://commits.kde.org/pairs/fe8c45745ddd33f59a5f6173f3d6d16715bd3d6a
diff --git a/src/playersmodel.cpp b/src/playersmodel.cpp
index 3e6322f..8e1b989 100644
--- a/src/playersmodel.cpp
+++ b/src/playersmodel.cpp
@@ -38,7 +38,7 @@ PlayersModel::PlayersModel(QObject* parent)
setRoleNames(names);
m_playerIcons = KGlobal::dirs()->findAllResources("appdata", QLatin1String( "players/*.png"));
- refresh();
+ QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
}
PlayersModel::~PlayersModel()
diff --git a/src/playersmodel.h b/src/playersmodel.h
index e7f85df..87cd417 100644
--- a/src/playersmodel.h
+++ b/src/playersmodel.h
@@ -48,9 +48,10 @@ class PlayersModel : public QStandardItemModel
QString randomIcon();
QString iconsDir(const QString& path);
-
- private:
+ private slots:
void refresh();
+
+ private:
QStringList m_playerIcons;
};
diff --git a/src/themesmodel.cpp b/src/themesmodel.cpp
index 959233a..52e4486 100644
--- a/src/themesmodel.cpp
+++ b/src/themesmodel.cpp
@@ -27,12 +27,13 @@
ThemesModel::ThemesModel(QObject* parent): QStandardItemModel(parent)
{
qsrand(QTime::currentTime().elapsed());
- reload();
QStringList themesdirs=KGlobal::dirs()->findDirs("appdata", "themes");
QFileSystemWatcher* fs=new QFileSystemWatcher(this);
fs->addPaths(themesdirs);
connect(fs, SIGNAL(directoryChanged(QString)), SLOT(reload()));
+
+ QMetaObject::invokeMethod(this, "reload", Qt::QueuedConnection);
}
void ThemesModel::refresh(const QString &type, const QString &lang)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic