Add src/xmbconfig.cpp
This commit is contained in:
parent
d6f9b30f06
commit
9f01179941
37
src/xmbconfig.cpp
Normal file
37
src/xmbconfig.cpp
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#include "xmbconfig.h"
|
||||||
|
#include "apppaths.h"
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
static QString absIfRelative(const QString& base, const QString& path) {
|
||||||
|
if (path.isEmpty()) return path;
|
||||||
|
if (QDir::isAbsolutePath(path)) return path;
|
||||||
|
return QDir(base).filePath(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool XmbConfig::load() {
|
||||||
|
const QString root = AppPaths::configRoot();
|
||||||
|
const QString cfgPath = QDir(root).filePath("xmb.conf");
|
||||||
|
|
||||||
|
QSettings s(cfgPath, QSettings::IniFormat);
|
||||||
|
s.setFallbacksEnabled(true);
|
||||||
|
|
||||||
|
// Defaults (wenn config nicht existiert, bleibt’s stabil)
|
||||||
|
const QString assets = AppPaths::assetsRoot();
|
||||||
|
|
||||||
|
const auto orderStr = s.value("XMB/order", "Settings,Photos,Videos,Games,Steam").toString();
|
||||||
|
m_order = orderStr.split(',', Qt::SkipEmptyParts);
|
||||||
|
for (auto& v : m_order) v = v.trimmed();
|
||||||
|
|
||||||
|
m_iconPath = absIfRelative(root, s.value("Assets/icon_path", QDir(assets).filePath("icons")).toString());
|
||||||
|
m_soundPath = absIfRelative(root, s.value("Assets/sound_path", QDir(assets).filePath("sounds")).toString());
|
||||||
|
m_fontBoot = absIfRelative(root, s.value("Assets/font_boot", QDir(assets).filePath("fonts/boot.ttf")).toString());
|
||||||
|
m_bootAnimation = absIfRelative(root, s.value("Assets/boot_animation", QDir(assets).filePath("boot/boot.qml")).toString());
|
||||||
|
|
||||||
|
m_fps = s.value("UI/fps", 60).toInt();
|
||||||
|
if (m_fps < 30) m_fps = 30;
|
||||||
|
if (m_fps > 240) m_fps = 240;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user