mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-17 00:07:51 +00:00
Merge pull request #3245
ec8cd13
portable: use portable storage folder to store QML disk cache (xiphon)
This commit is contained in:
commit
148d487988
3 changed files with 18 additions and 8 deletions
|
@ -190,6 +190,20 @@ int main(int argc, char *argv[])
|
||||||
// Turn off colors in monerod log output.
|
// Turn off colors in monerod log output.
|
||||||
qputenv("TERM", "goaway");
|
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);
|
MainApp app(argc, argv);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -326,10 +340,6 @@ Verify update binary using 'shasum'-compatible (SHA256 algo) output signed by tw
|
||||||
// start listening
|
// start listening
|
||||||
QTimer::singleShot(0, ipc, SLOT(bind()));
|
QTimer::singleShot(0, ipc, SLOT(bind()));
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
|
||||||
QDir::setCurrent(QDir(MacOSHelper::bundlePath() + QDir::separator() + "..").canonicalPath());
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// screen settings
|
// screen settings
|
||||||
// Mobile is designed on 128dpi
|
// Mobile is designed on 128dpi
|
||||||
qreal ref_dpi = 128;
|
qreal ref_dpi = 128;
|
||||||
|
|
|
@ -179,13 +179,13 @@ bool MoneroSettings::portable() const
|
||||||
return this->m_settings && this->m_settings->fileName() == portableFilePath();
|
return this->m_settings && this->m_settings->fileName() == portableFilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MoneroSettings::portableConfigExists() const
|
bool MoneroSettings::portableConfigExists()
|
||||||
{
|
{
|
||||||
QFileInfo info(portableFilePath());
|
QFileInfo info(portableFilePath());
|
||||||
return info.exists() && info.isFile();
|
return info.exists() && info.isFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MoneroSettings::portableFilePath() const
|
QString MoneroSettings::portableFilePath()
|
||||||
{
|
{
|
||||||
static QString filename(QDir(portableFolderName()).absoluteFilePath("settings.ini"));
|
static QString filename(QDir(portableFolderName()).absoluteFilePath("settings.ini"));
|
||||||
return filename;
|
return filename;
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
Q_INVOKABLE void setWritable(bool enabled);
|
Q_INVOKABLE void setWritable(bool enabled);
|
||||||
|
|
||||||
static QString portableFolderName();
|
static QString portableFolderName();
|
||||||
|
static bool portableConfigExists();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void _q_propertyChanged();
|
void _q_propertyChanged();
|
||||||
|
@ -84,8 +85,7 @@ private:
|
||||||
void store();
|
void store();
|
||||||
|
|
||||||
bool portable() const;
|
bool portable() const;
|
||||||
bool portableConfigExists() const;
|
static QString portableFilePath();
|
||||||
QString portableFilePath() const;
|
|
||||||
std::unique_ptr<QSettings> portableSettings() const;
|
std::unique_ptr<QSettings> portableSettings() const;
|
||||||
std::unique_ptr<QSettings> unportableSettings() const;
|
std::unique_ptr<QSettings> unportableSettings() const;
|
||||||
void swap(std::unique_ptr<QSettings> newSettings);
|
void swap(std::unique_ptr<QSettings> newSettings);
|
||||||
|
|
Loading…
Reference in a new issue