mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
Use SettingsManager
This commit is contained in:
parent
af2370425f
commit
f5080424a6
2 changed files with 7 additions and 8 deletions
|
|
@ -4,7 +4,7 @@
|
|||
#include <QSettings>
|
||||
|
||||
CardCounterSettings::CardCounterSettings(const QString &settingsPath, QObject *parent)
|
||||
: QObject(parent), m_settings(new QSettings(settingsPath + "global.ini", QSettings::IniFormat))
|
||||
: SettingsManager(settingsPath + "global.ini", parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -12,10 +12,10 @@ void CardCounterSettings::setColor(int counterId, const QColor &color)
|
|||
{
|
||||
QString key = QString("cards/counters/%1/color").arg(counterId);
|
||||
|
||||
if (m_settings->value(key).value<QColor>() == color)
|
||||
if (settings.value(key).value<QColor>() == color)
|
||||
return;
|
||||
|
||||
m_settings->setValue(key, color);
|
||||
settings.setValue(key, color);
|
||||
emit colorChanged(counterId, color);
|
||||
}
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ QColor CardCounterSettings::color(int counterId) const
|
|||
defaultColor = QColor::fromHsv(h, s, v);
|
||||
}
|
||||
|
||||
return m_settings->value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
||||
return settings.value(QString("cards/counters/%1/color").arg(counterId), defaultColor).value<QColor>();
|
||||
}
|
||||
|
||||
QString CardCounterSettings::displayName(int counterId) const
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
#ifndef CARD_COUNTER_SETTINGS_H
|
||||
#define CARD_COUNTER_SETTINGS_H
|
||||
|
||||
#include "settings_manager.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QSettings;
|
||||
class QColor;
|
||||
|
||||
class CardCounterSettings : public QObject
|
||||
class CardCounterSettings : public SettingsManager
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
|
@ -22,9 +24,6 @@ public slots:
|
|||
|
||||
signals:
|
||||
void colorChanged(int counterId, const QColor &color);
|
||||
|
||||
private:
|
||||
QSettings *m_settings;
|
||||
};
|
||||
|
||||
#endif // CARD_COUNTER_SETTINGS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue