aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2020-11-25 17:22:38 -0600
committerluigi1111 <luigi1111w@gmail.com>2020-11-25 17:22:38 -0600
commit148d487988b67a66e559d60fe9b6151c725f3c6f (patch)
treefa00ecfeba480a62e093d3ec338adf781475024e
parent7b137f76828c36f7fbe43beb92587cce049bbd28 (diff)
parentec8cd137cc9592aa910e9829f8e9ce251488c70f (diff)
downloadmonzero-gui-148d487988b67a66e559d60fe9b6151c725f3c6f.tar.gz
monzero-gui-148d487988b67a66e559d60fe9b6151c725f3c6f.tar.xz
monzero-gui-148d487988b67a66e559d60fe9b6151c725f3c6f.zip
Merge pull request #3245
ec8cd13 portable: use portable storage folder to store QML disk cache (xiphon)
-rw-r--r--src/main/main.cpp18
-rw-r--r--src/qt/MoneroSettings.cpp4
-rw-r--r--src/qt/MoneroSettings.h4
3 files changed, 18 insertions, 8 deletions
diff --git a/src/main/main.cpp b/src/main/main.cpp
index 4035e194..79e172ca 100644
--- a/src/main/main.cpp
+++ b/src/main/main.cpp
@@ -190,6 +190,20 @@ int main(int argc, char *argv[])
// Turn off colors in monerod log output.
qputenv("TERM", "goaway");
+#if defined(Q_OS_MACOS)
+ QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
+#endif
+
+ if (MoneroSettings::portableConfigExists())
+ {
+ const QString cacheDir(MoneroSettings::portableFolderName() + QDir::separator() + ".cache");
+ if (!qputenv("QML_DISK_CACHE_PATH", cacheDir.toUtf8()))
+ {
+ qCritical() << "Error: failed to set QML disk cache path";
+ return 1;
+ }
+ }
+
MainApp app(argc, argv);
#if defined(Q_OS_WIN)
@@ -326,10 +340,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
// start listening
QTimer::singleShot(0, ipc, SLOT(bind()));
-#if defined(Q_OS_MACOS)
- QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
-#endif
-
// screen settings
// Mobile is designed on 128dpi
qreal ref_dpi = 128;
diff --git a/src/qt/MoneroSettings.cpp b/src/qt/MoneroSettings.cpp
index bcd358e0..b70aa994 100644
--- a/src/qt/MoneroSettings.cpp
+++ b/src/qt/MoneroSettings.cpp
@@ -179,13 +179,13 @@ bool MoneroSettings::portable() const
return this->m_settings && this->m_settings->fileName() == portableFilePath();
}
-bool MoneroSettings::portableConfigExists() const
+bool MoneroSettings::portableConfigExists()
{
QFileInfo info(portableFilePath());
return info.exists() && info.isFile();
}
-QString MoneroSettings::portableFilePath() const
+QString MoneroSettings::portableFilePath()
{
static QString filename(QDir(portableFolderName()).absoluteFilePath("settings.ini"));
return filename;
diff --git a/src/qt/MoneroSettings.h b/src/qt/MoneroSettings.h
index 30f4b35b..d5db0885 100644
--- a/src/qt/MoneroSettings.h
+++ b/src/qt/MoneroSettings.h
@@ -64,6 +64,7 @@ public:
Q_INVOKABLE void setWritable(bool enabled);
static QString portableFolderName();
+ static bool portableConfigExists();
public slots:
void _q_propertyChanged();
@@ -84,8 +85,7 @@ private:
void store();
bool portable() const;
- bool portableConfigExists() const;
- QString portableFilePath() const;
+ static QString portableFilePath();
std::unique_ptr<QSettings> portableSettings() const;
std::unique_ptr<QSettings> unportableSettings() const;
void swap(std::unique_ptr<QSettings> newSettings);