[Kstars-devel] [kstars] kstars: Try to load textures from main data directory if they aren't in 'textures' dir.

Rafal Kulaga rl.kulaga at gmail.com
Mon Apr 16 19:23:03 UTC 2012


Git commit 0d7ee486b0522454928fc0e08d545f8ca7cac8b0 by Rafal Kulaga.
Committed on 16/04/2012 at 21:22.
Pushed by kulaga into branch 'master'.

Try to load textures from main data directory if they aren't in 'textures' dir.

This fixes the issue reported by Manfred. This might not be the best option available,
but we don't want to break anything for people that are happy with textures in
main data directory.

CCMAIL: manfred.kitzbichler at gmail.com
CCMAIL: kstars-devel at kde.org
CCBUG: 297210

M  +8    -2    kstars/texturemanager.cpp

http://commits.kde.org/kstars/0d7ee486b0522454928fc0e08d545f8ca7cac8b0

diff --git a/kstars/texturemanager.cpp b/kstars/texturemanager.cpp
index fc71910..ce78bd0 100644
--- a/kstars/texturemanager.cpp
+++ b/kstars/texturemanager.cpp
@@ -61,12 +61,18 @@ TextureManager::CacheIter TextureManager::findTexture(const QString& name)
     if( it != m_p->m_textures.constEnd() ) {
         return it;
     } else {
-        // Try to load from file
+        // Try to load from file in 'textures' subdirectory
         QString filename = KStandardDirs::locate("appdata",QString("textures/%1.png").arg(name));
         if( !filename.isNull() ) {
             return (TextureManager::CacheIter)m_p->m_textures.insert( name, QImage(filename) );
         } else {
-            return m_p->m_textures.constEnd();
+            // Try to load from file in main data directory
+            filename = KStandardDirs::locate("appdata",QString("%1.png").arg(name));
+            if( !filename.isNull() ) {
+                return (TextureManager::CacheIter)m_p->m_textures.insert( name, QImage(filename) );
+            } else {
+                return m_p->m_textures.constEnd();
+            }
         }
     }
 }


More information about the Kstars-devel mailing list