feat: initial commit for media tracking software
- Setup C++/Qt6 desktop application structure - Added initial Go proxy backend for TMDB/IGDB integration
This commit is contained in:
commit
3f07c78316
63 changed files with 6547 additions and 0 deletions
107
src/core/Settings.cpp
Normal file
107
src/core/Settings.cpp
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
#include "core/Settings.h"
|
||||
|
||||
namespace umt {
|
||||
|
||||
AppSettings::AppSettings(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_s(QStringLiteral("UMT"), QStringLiteral("UltimateMediaTracker"))
|
||||
{
|
||||
}
|
||||
|
||||
bool AppSettings::darkMode() const {
|
||||
return m_s.value(QStringLiteral("theme/dark"), true).toBool();
|
||||
}
|
||||
void AppSettings::setDarkMode(bool on) {
|
||||
if (darkMode() == on) return;
|
||||
m_s.setValue(QStringLiteral("theme/dark"), on);
|
||||
emit themeChanged();
|
||||
}
|
||||
|
||||
QColor AppSettings::accentColor() const {
|
||||
return QColor(m_s.value(QStringLiteral("theme/accent"),
|
||||
QStringLiteral("#0a84ff")).toString());
|
||||
}
|
||||
void AppSettings::setAccentColor(const QColor &c) {
|
||||
if (accentColor() == c) return;
|
||||
m_s.setValue(QStringLiteral("theme/accent"), c.name());
|
||||
emit accentChanged(c);
|
||||
emit themeChanged();
|
||||
}
|
||||
|
||||
QString AppSettings::preferredLanguage() const {
|
||||
return m_s.value(QStringLiteral("locale/language"),
|
||||
QStringLiteral("de")).toString();
|
||||
}
|
||||
void AppSettings::setPreferredLanguage(const QString &code) {
|
||||
m_s.setValue(QStringLiteral("locale/language"), code);
|
||||
}
|
||||
|
||||
QString AppSettings::tmdbMode() const {
|
||||
return m_s.value(QStringLiteral("providers/tmdbMode"),
|
||||
QStringLiteral("key")).toString();
|
||||
}
|
||||
void AppSettings::setTmdbMode(const QString &mode) {
|
||||
m_s.setValue(QStringLiteral("providers/tmdbMode"), mode);
|
||||
}
|
||||
|
||||
QString AppSettings::tmdbApiKey() const {
|
||||
return m_s.value(QStringLiteral("providers/tmdbKey")).toString();
|
||||
}
|
||||
void AppSettings::setTmdbApiKey(const QString &key) {
|
||||
m_s.setValue(QStringLiteral("providers/tmdbKey"), key);
|
||||
}
|
||||
|
||||
QString AppSettings::proxyUrl() const {
|
||||
return m_s.value(QStringLiteral("providers/proxyUrl")).toString();
|
||||
}
|
||||
void AppSettings::setProxyUrl(const QString &url) {
|
||||
m_s.setValue(QStringLiteral("providers/proxyUrl"), url);
|
||||
}
|
||||
|
||||
QString AppSettings::proxyToken() const {
|
||||
return m_s.value(QStringLiteral("providers/proxyToken")).toString();
|
||||
}
|
||||
void AppSettings::setProxyToken(const QString &token) {
|
||||
m_s.setValue(QStringLiteral("providers/proxyToken"), token);
|
||||
}
|
||||
|
||||
QString AppSettings::rawgApiKey() const {
|
||||
return m_s.value(QStringLiteral("providers/rawgKey")).toString();
|
||||
}
|
||||
void AppSettings::setRawgApiKey(const QString &key) {
|
||||
m_s.setValue(QStringLiteral("providers/rawgKey"), key);
|
||||
}
|
||||
|
||||
bool AppSettings::autoFetchCovers() const {
|
||||
return m_s.value(QStringLiteral("providers/autoCovers"), true).toBool();
|
||||
}
|
||||
void AppSettings::setAutoFetchCovers(bool on) {
|
||||
m_s.setValue(QStringLiteral("providers/autoCovers"), on);
|
||||
}
|
||||
|
||||
int AppSettings::cardWidth() const {
|
||||
return m_s.value(QStringLiteral("view/cardWidth"), 180).toInt();
|
||||
}
|
||||
void AppSettings::setCardWidth(int px) {
|
||||
if (cardWidth() == px) return;
|
||||
m_s.setValue(QStringLiteral("view/cardWidth"), px);
|
||||
emit cardSizeChanged(px);
|
||||
}
|
||||
|
||||
QString AppSettings::defaultView() const {
|
||||
return m_s.value(QStringLiteral("view/default"),
|
||||
QStringLiteral("grid")).toString();
|
||||
}
|
||||
void AppSettings::setDefaultView(const QString &v) {
|
||||
m_s.setValue(QStringLiteral("view/default"), v);
|
||||
}
|
||||
|
||||
QString AppSettings::sortMode() const {
|
||||
return m_s.value(QStringLiteral("view/sort"),
|
||||
QStringLiteral("dateAdded")).toString();
|
||||
}
|
||||
void AppSettings::setSortMode(const QString &v) {
|
||||
m_s.setValue(QStringLiteral("view/sort"), v);
|
||||
}
|
||||
|
||||
} // namespace umt
|
||||
Loading…
Add table
Add a link
Reference in a new issue