mirror of https://notabug.org/acetone/ircabot.git
81 lines
2.5 KiB
C++
81 lines
2.5 KiB
C++
/*
|
|
This file is part of IRCaBot.
|
|
IRCaBot is IRC logger with features.
|
|
Source code: https://notabug.org/acetone/ircabot.
|
|
Copyright (C) 2023, acetone.
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "versioninformation.h"
|
|
|
|
#include <QString>
|
|
#include <QStringList>
|
|
|
|
class QJsonObject;
|
|
|
|
class Config
|
|
{
|
|
public:
|
|
Config() = delete;
|
|
|
|
struct Network
|
|
{
|
|
// default values defined in initFromJson()
|
|
QString networkName;
|
|
QString host;
|
|
quint16 port;
|
|
bool ssl;
|
|
QString nickname;
|
|
QString password;
|
|
QString identifyFormat;
|
|
QString ident;
|
|
QString realName;
|
|
QStringList channels;
|
|
bool autoReconnect;
|
|
bool voiceGate;
|
|
};
|
|
|
|
static void setConfigurationFilePath(const QString& path) { m_configurationFilePath = path; }
|
|
static bool initFromFile(QString* errorString = nullptr);
|
|
static bool initFromJson(const QJsonObject& config, QString* errorString = nullptr);
|
|
|
|
static const QString& configurationFilePath() { return m_configurationFilePath; }
|
|
static const QString& logFilePath() { return m_logFilePath; }
|
|
static const QString& logFileDateFormat() { return m_logFileDateFormat; }
|
|
|
|
static const QString& webUiAddress() { return m_webUiAddress; }
|
|
static quint16 webUiPort() { return m_webUiPort; }
|
|
static int webUiThreads() { return m_webUiThreads; }
|
|
|
|
static const QString& workingDirectory() { return m_workingDirectory; }
|
|
|
|
static const QList<Network>& networks() { return m_networks; }
|
|
|
|
private:
|
|
static QString m_configurationFilePath;
|
|
static QString m_logFilePath;
|
|
static QString m_logFileDateFormat;
|
|
static QString m_workingDirectory;
|
|
|
|
static QString m_webUiAddress;
|
|
static quint16 m_webUiPort;
|
|
static uint m_webUiThreads;
|
|
|
|
static QList<Network> m_networks;
|
|
};
|
|
|