The complete source code of IdealIRC
http://www.idealirc.org/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
48 lines
1.3 KiB
#ifndef CONFIGMGR_H
|
|
#define CONFIGMGR_H
|
|
|
|
#include "IniFile.h"
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QStringList>
|
|
#include <QHash>
|
|
#include <QVector>
|
|
#include <QColor>
|
|
#include <optional>
|
|
|
|
class ConfigMgr : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
static ConfigMgr& instance();
|
|
void save();
|
|
|
|
QString geometry(const QString& key) const;
|
|
QString connection(const QString& key) const;
|
|
QString common(const QString& key) const;
|
|
QString color(const QString& key) const;
|
|
std::optional<QColor> prefixColor(const QChar& prefix) const;
|
|
QHash<QString,QString> color() const;
|
|
QVector<std::pair<QChar,QColor>> prefixColor() const; // QVector of pairs preserves the order.
|
|
QString logging(const QString& key) const;
|
|
QStringList scripts() const;
|
|
|
|
void setGeometry(const QString& key, const QString& value);
|
|
void setConnection(const QString& key, const QString& value);
|
|
void setCommon(const QString& key, const QString& value);
|
|
void setLogging(const QString& key, const QString& value);
|
|
void setColorPalette(const QHash<QString,QString>& palette);
|
|
void setPrefixColorPalette(const QVector<std::pair<QChar,QColor>>& palette);
|
|
void addScript(const QString& path);
|
|
void delScript(const QString& path);
|
|
|
|
private:
|
|
ConfigMgr();
|
|
IniFile ini;
|
|
|
|
signals:
|
|
void saved();
|
|
};
|
|
|
|
#endif // CONFIGMGR_H
|
|
|