Commit 4b858ff2 authored by Halla Rempt's avatar Halla Rempt
Browse files

BUG:321361 Load resources from subfolders

If we've got saved in subfolders, we assume that they are meant
to be different and should both be loaded. This only works for
resources the user saved themselves, not in bundles or for
resources in the system location.
parent a9721710
......@@ -180,12 +180,20 @@ public:
QString front = filenames.first();
QString fname = QFileInfo(front).fileName();
// In the save location, people can use sub-folders... And then they probably want
// to load both versions! See
QString fname;
if (front.contains(saveLocation())) {
fname = front.split(saveLocation())[1];
else {
fname = QFileInfo(front).fileName();
// XXX: Don't load resources with the same filename. Actually, we should look inside
// the resource to find out whether they are really the same, but for now this
// will prevent the same brush etc. showing up twice.
if (uniqueFiles.empty() || uniqueFiles.indexOf(fname) == -1) {
if (!uniqueFiles.contains(fname)) {
QList<PointerType> resources = createResources(front);
......@@ -197,8 +205,8 @@ public:
m_resourcesByFilename[resource->shortFilename()] = resource;
if ( resource->name().isEmpty() ) {
resource->setName( fname );
if (resource->name() != fname) {
if (m_resourcesByName.contains(resource->name())) {
resource->setName(resource->name() + "(" + resource->shortFilename() + ")");
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment