cache: improved setting manual cache path on a per project basis
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include "common/xmlutils.h"
|
||||
#include "core.h"
|
||||
#include "dialog/progress/progress.h"
|
||||
#include "render/diskmanager.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
@@ -63,6 +64,10 @@ void Project::Load(QXmlStreamReader *reader, MainWindowLayoutInfo* layout, const
|
||||
}
|
||||
}
|
||||
|
||||
} else if (reader->name() == QStringLiteral("cachepath")) {
|
||||
|
||||
set_cache_path(reader->readElementText());
|
||||
|
||||
} else if (reader->name() == QStringLiteral("layout")) {
|
||||
|
||||
// Since the main window's functions have to occur in the GUI thread (and we're likely
|
||||
@@ -98,6 +103,8 @@ void Project::Save(QXmlStreamWriter *writer) const
|
||||
|
||||
writer->writeTextElement("url", filename_);
|
||||
|
||||
writer->writeTextElement("cachepath", cache_path(false));
|
||||
|
||||
root_.Save(writer);
|
||||
|
||||
writer->writeStartElement("colormanagement");
|
||||
@@ -195,4 +202,12 @@ bool Project::is_new() const
|
||||
return !is_modified_ && filename_.isEmpty();
|
||||
}
|
||||
|
||||
const QString &Project::cache_path(bool default_if_empty) const
|
||||
{
|
||||
if (cache_path_.isEmpty() && default_if_empty) {
|
||||
return DiskManager::instance()->GetDefaultCachePath();
|
||||
}
|
||||
return cache_path_;
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user