mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-29 19:22:57 +02:00
commit
d17bd4352a
2 changed files with 23 additions and 2 deletions
|
@ -21,15 +21,35 @@
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
|
||||||
#include "AvatarBookmarks.h"
|
#include "AvatarBookmarks.h"
|
||||||
|
#include "InterfaceLogging.h"
|
||||||
|
|
||||||
#include <QtQuick/QQuickWindow>
|
#include <QtQuick/QQuickWindow>
|
||||||
|
|
||||||
AvatarBookmarks::AvatarBookmarks() {
|
AvatarBookmarks::AvatarBookmarks() {
|
||||||
_bookmarksFilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + AVATARBOOKMARKS_FILENAME;
|
_bookmarksFilename = PathUtils::getAppDataPath() + "/" + AVATARBOOKMARKS_FILENAME;
|
||||||
readFromFile();
|
readFromFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AvatarBookmarks::readFromFile() {
|
||||||
|
// migrate old avatarbookmarks.json, used to be in 'local' folder on windows
|
||||||
|
QString oldConfigPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + AVATARBOOKMARKS_FILENAME;
|
||||||
|
QFile oldConfig(oldConfigPath);
|
||||||
|
|
||||||
|
// I imagine that in a year from now, this code for migrating (as well as the two lines above)
|
||||||
|
// may be removed since all bookmarks should have been migrated by then
|
||||||
|
// - Robbie Uvanni (6.8.2017)
|
||||||
|
if (oldConfig.exists()) {
|
||||||
|
if (QDir().rename(oldConfigPath, _bookmarksFilename)) {
|
||||||
|
qCDebug(interfaceapp) << "Successfully migrated" << AVATARBOOKMARKS_FILENAME;
|
||||||
|
} else {
|
||||||
|
qCDebug(interfaceapp) << "Failed to migrate" << AVATARBOOKMARKS_FILENAME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bookmarks::readFromFile();
|
||||||
|
}
|
||||||
|
|
||||||
void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
|
void AvatarBookmarks::setupMenus(Menu* menubar, MenuWrapper* menu) {
|
||||||
// Add menus/actions
|
// Add menus/actions
|
||||||
auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkAvatar);
|
auto bookmarkAction = menubar->addActionToQMenuAndActionHash(menu, MenuOption::BookmarkAvatar);
|
||||||
|
|
|
@ -29,6 +29,7 @@ public slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void addBookmarkToMenu(Menu* menubar, const QString& name, const QString& address) override;
|
void addBookmarkToMenu(Menu* menubar, const QString& name, const QString& address) override;
|
||||||
|
void readFromFile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json";
|
const QString AVATARBOOKMARKS_FILENAME = "avatarbookmarks.json";
|
||||||
|
|
Loading…
Reference in a new issue