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

List:       kde-commits
Subject:    [picmi] src: Search the correct locations in QStandardPath::locate
From:       Jakob Gruber <jakob.gruber () gmail ! com>
Date:       2015-07-15 13:42:41
Message-ID: E1ZFMxN-0006mw-8j () scm ! kde ! org
[Download RAW message or body]

Git commit 6f7d354daef8091dbdb5a1e98a12c4a9026dbb11 by Jakob Gruber.
Committed on 15/07/2015 at 10:36.
Pushed by gruber into branch 'master'.

Search the correct locations in QStandardPath::locate

Passing both an organization name and application name to
QCoreApplication resulted in QStandardPaths looking in
'/usr/share/picmi/picmi/', which doesn't exist. Leaving the organization
name unset fixed this issue, and exposed another problem with our
locate() usage in which we incorrectly appended the directory name to
the returned path.

M  +0    -1    src/constants.h
M  +0    -1    src/gui/mainwindow.cpp
M  +2    -2    src/gui/renderer.cpp
M  +2    -2    src/logic/levelloader.cpp

http://commits.kde.org/picmi/6f7d354daef8091dbdb5a1e98a12c4a9026dbb11

diff --git a/src/constants.h b/src/constants.h
index 18c8da8..c7096a4 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -19,7 +19,6 @@
 #ifndef CONSTANTS_H
 #define CONSTANTS_H
 
-const QString ORGANIZATION_NAME = "picmi";
 const int ZVALUE_HIGHLIGHT = -3;
 const int ZVALUE_CELLFRAME = 0;
 const int ZVALUE_STREAKFRAME = 0;
diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp
index 48bd217..f30da09 100644
--- a/src/gui/mainwindow.cpp
+++ b/src/gui/mainwindow.cpp
@@ -42,7 +42,6 @@ MainWindow::MainWindow(QWidget *parent) :
     KXmlGuiWindow(parent),
     m_key_pos("window/position"), m_in_progress(false), m_mode(Random)
 {
-    QCoreApplication::setOrganizationName(ORGANIZATION_NAME);
     QCoreApplication::setApplicationName("picmi");
 
     m_timer.setInterval(500);
diff --git a/src/gui/renderer.cpp b/src/gui/renderer.cpp
index 83beab6..cd28aec 100644
--- a/src/gui/renderer.cpp
+++ b/src/gui/renderer.cpp
@@ -59,9 +59,9 @@ void Renderer::loadResources() {
     QList<QString> paths;
     paths << QString(prefix)
           << QString(FILEPATH "/" + prefix)
-          << QStandardPaths::locate(QStandardPaths::DataLocation,
+          << QStandardPaths::locate(QStandardPaths::AppDataLocation,
                                     prefix,
-                                    QStandardPaths::LocateOption::LocateDirectory) + prefix;
+                                    QStandardPaths::LocateOption::LocateDirectory);
 
     /* try loading first from working directory, then the system directories */
     for (int i = 0; i < paths.size(); i++) {
diff --git a/src/logic/levelloader.cpp b/src/logic/levelloader.cpp
index b621018..c722e3d 100644
--- a/src/logic/levelloader.cpp
+++ b/src/logic/levelloader.cpp
@@ -137,9 +137,9 @@ QList<QSharedPointer<Level> > LevelLoader::load() {
     QList<QString> paths;
     paths << QString(prefix)
           << QString(FILEPATH "/" + prefix)
-          << QStandardPaths::locate(QStandardPaths::DataLocation,
+          << QStandardPaths::locate(QStandardPaths::AppDataLocation,
                                     prefix,
-                                    QStandardPaths::LocateOption::LocateDirectory) + prefix;
+                                    QStandardPaths::LocateOption::LocateDirectory);
 
     LevelList list;
 

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

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