aboutsummaryrefslogtreecommitdiff
path: root/src/protocolsetup.cpp
blob: e5a87fbfe822a506e10dc855b1c669b29dc1e75a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "protocolsetup.hpp"

ProtocolSetup::ProtocolSetup()
{
#define MAC(X) this->X = false;
    PROTOCOLS(MAC)
#undef MAC

    this->gemini = true;
}

void ProtocolSetup::save(QSettings &settings) const
{
#define MAC(X) settings.setValue(#X, this->X);
    PROTOCOLS(MAC)
#undef MAC
}

void ProtocolSetup::load(QSettings &settings)
{
#define MAC(X) if(settings.contains(#X)) this->X = settings.value(#X).toBool();
    PROTOCOLS(MAC)
#undef MAC
}

ProtocolSetup::ProtocolSupport ProtocolSetup::isSchemeSupported(QString const & _scheme) const
{
    auto scheme = _scheme.toLower();

#define MAC(X) if(scheme == #X) return this->X ? Enabled : Disabled;
    PROTOCOLS(MAC)
#undef MAC

    // built-in schemes:
    if(scheme == "about") return Enabled;
    if(scheme == "file")  return Enabled;

    return Unsupported;
}