diff --git a/favoritemenu.cpp b/favoritemenu.cpp index 2d43a03..d234171 100644 --- a/favoritemenu.cpp +++ b/favoritemenu.cpp @@ -27,9 +27,10 @@ #include #include #include +#include #include -#define FAVORITE_DOWNLOAD_FILE QStringLiteral("favoritedata.json") +#define FAVORITE_DOWNLOAD_FILE QString("%1/favoritedata.json").arg(QStandardPaths::writableLocation(QStandardPaths::DataLocation)) #define FAVORITE_DOWNLOAD_URL QUrl("http://relog.xii.jp/download/kancolle/data/favoritedata.json") #define TO_VALUE(array_at, key) QJsonObject(array_at.toObject()).value(key) #define TO_STRING(array_at, key) QJsonObject(array_at.toObject()).value(key).toString() @@ -92,7 +93,6 @@ void FavoriteMenu::load(QMenu *menu, bool download) } settings.endGroup(); - //お気に入りをダウンロード if(download){ updateFromInternet(); diff --git a/qml/KanmusuMemory/timerDialog.qml b/qml/KanmusuMemory/timerDialog.qml index f0bd9b1..2445fc5 100644 --- a/qml/KanmusuMemory/timerDialog.qml +++ b/qml/KanmusuMemory/timerDialog.qml @@ -64,7 +64,7 @@ Rectangle { function responseHttp(oj){ var data = JSON.parse(oj.responseText) var i - var local_path = file.getApplicationPath() + "/timerselectguide.json" + var local_path = file.getWritablePath() + "/timerselectguide.json" var local_data = "" if(file.exists(local_path)){ diff --git a/qtquick/qmlfile.cpp b/qtquick/qmlfile.cpp index f119449..a64ba60 100644 --- a/qtquick/qmlfile.cpp +++ b/qtquick/qmlfile.cpp @@ -18,6 +18,7 @@ #include #include #include +#include QMLFile::QMLFile(QObject *parent): QObject(parent) @@ -95,6 +96,11 @@ QString QMLFile::getApplicationPath() return QApplication::applicationDirPath(); } +QString QMLFile::getWritablePath() +{ + return QStandardPaths::writableLocation(QStandardPaths::DataLocation); +} + //ファイルコピー開始 bool QMLFile::copy(const QString &fileName, const QString &newName) diff --git a/qtquick/qmlfile.h b/qtquick/qmlfile.h index 83c33c8..fd8c453 100644 --- a/qtquick/qmlfile.h +++ b/qtquick/qmlfile.h @@ -49,6 +49,7 @@ class QMLFile : public QObject Q_INVOKABLE QString getExistingDirectory(const QString &title, const QString &default_path); Q_INVOKABLE QString getOpenFileName(const QString &title, const QString &default_path, const QString &filter); Q_INVOKABLE QString getApplicationPath(); + Q_INVOKABLE QString getWritablePath(); Q_INVOKABLE bool copy(const QString &fileName, const QString &newName); Q_INVOKABLE QString currentPath(); Q_INVOKABLE bool setCurrent(const QString &path);