[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [pairs/frameworks] game: get rid of KGlobal::dirs
From:       Marco Calignano <marco.calignano () gmail ! com>
Date:       2014-09-15 20:16:48
Message-ID: E1XTchc-00040W-Sg () scm ! kde ! org
[Download RAW message or body]

Git commit 73c5fc14f5c677548163044d8c837dbab06b1df5 by Marco Calignano.
Committed on 10/07/2014 at 09:29.
Pushed by calignano into branch 'frameworks'.

get rid of KGlobal::dirs

M  +3    -4    game/pairstheme.cpp
M  +2    -1    game/pairsview.cpp
M  +2    -2    game/playersmodel.cpp
M  +5    -6    game/themeiconsprovider.cpp

http://commits.kde.org/pairs/73c5fc14f5c677548163044d8c837dbab06b1df5

diff --git a/game/pairstheme.cpp b/game/pairstheme.cpp
index fbfe276..0e87c02 100644
--- a/game/pairstheme.cpp
+++ b/game/pairstheme.cpp
@@ -22,10 +22,9 @@
 
 #include "pairstheme.h"
 #include <QtCore/QDebug>
-#include <KGlobal>
 #include <KLocalizedString>
-#include <KUrl>
-#include <KStandardDirs>
+#include <QUrl>
+#include <QStandardPaths>
 #include <QtXmlPatterns/QXmlSchemaValidator>
 #include <QtXmlPatterns/QXmlSchema>
 
@@ -59,7 +58,7 @@ PairsTheme::PairsTheme(const QString& path)
 
 bool PairsTheme::isValid(const KArchiveFile* file) {
 
-    KUrl schemaUrl = KUrl::fromLocalFile(KGlobal::dirs()->findResource("appdata", \
QLatin1String( "themes/game.xsd" ))); +    QUrl schemaUrl = \
QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, \
QLatin1String( "themes/game.xsd" )));  QXmlSchema schema;
     schema.load(schemaUrl);
 
diff --git a/game/pairsview.cpp b/game/pairsview.cpp
index f6ce583..641d29e 100644
--- a/game/pairsview.cpp
+++ b/game/pairsview.cpp
@@ -46,6 +46,7 @@
 #include <Phonon/MediaObject>
 #include <Phonon/AudioOutput>
 
+#include <QStandardPaths>
 #include <knewstuff3/downloaddialog.h>
 #include <knewstuff3/entry.h>
 #include <QResizeEvent>
@@ -179,7 +180,7 @@ void PairsView::newGame(const PairsTheme* theme, const QString& \
language, const  QByteArray file_buf;
 
     if(theme->backImage().isEmpty()){
-        QString dir = KGlobal::dirs()->findResourceDir("appdata", QLatin1String( \
"gameicons/pairs.svg")); +        QString dir = \
QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String( \
"gameicons/pairs.svg"), QStandardPaths::LocateDirectory);  QFile \
f(dir+"gameicons/pairsIcon.svg");  f.open(QIODevice::ReadOnly);
         file_buf = f.readAll();
diff --git a/game/playersmodel.cpp b/game/playersmodel.cpp
index f48d88e..43def27 100644
--- a/game/playersmodel.cpp
+++ b/game/playersmodel.cpp
@@ -43,7 +43,7 @@ PlayersModel::PlayersModel(QObject* parent)
     setRoleNames(names);
     m_playerIcons = KGlobal::dirs()->findAllResources("appdata", QLatin1String( \
                "players/*.svg"));
     for(QStringList::iterator it=m_playerIcons.begin(), itEnd=m_playerIcons.end(); \
                it!=itEnd; ++it) {
-        *it = KUrl::fromLocalFile(*it).toString();
+        *it = QUrl::fromLocalFile(*it).toString();
     }
 
     QMetaObject::invokeMethod(this, "refresh", Qt::QueuedConnection);
@@ -135,5 +135,5 @@ void PlayersModel::removePlayer(int p)
 
 QUrl PlayersModel::iconsDir(const QString& path)
 {
-    return KUrl::fromLocalFile(KGlobal::dirs()->findResource("appdata", path));
+    return QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::DataLocation, \
path));  }
diff --git a/game/themeiconsprovider.cpp b/game/themeiconsprovider.cpp
index 75dcb88..211b091 100644
--- a/game/themeiconsprovider.cpp
+++ b/game/themeiconsprovider.cpp
@@ -23,15 +23,14 @@
 #include "themeiconsprovider.h"
 #include <QPainter>
 #include <QSvgRenderer>
+#include <QStandardPaths>
 #include "themesmodel.h"
 #include <QDebug>
 #include <QFile>
-#include <KStandardDirs>
+//#include <KStandardDirs>
 
-
-
-ThemeIconsProvider::ThemeIconsProvider(QDeclarativeImageProvider::ImageType type, \
                ThemesModel* themes) :
-    QDeclarativeImageProvider(type), m_themes(themes)
+ThemeIconsProvider::ThemeIconsProvider(QQuickImageProvider::ImageType type, \
ThemesModel* themes) : +    QQuickImageProvider(type), m_themes(themes)
 {}
 
 ThemeIconsProvider::~ThemeIconsProvider()
@@ -41,7 +40,7 @@ QPixmap ThemeIconsProvider::requestPixmap(const QString& id, QSize* \
size, const  {
     QByteArray data = m_themes->themeData(id);
     if(data.isNull()) {
-        QString dir = KGlobal::dirs()->findResourceDir("appdata", QLatin1String( \
"gameicons/pairs.svg")); +        QString dir = \
QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String( \
"gameicons/pairs.svg"));  QFile f(dir+"gameicons/pairsIcon.svg");
         f.open(QIODevice::ReadOnly);
         data = f.readAll();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic