aboutsummaryrefslogtreecommitdiff
path: root/test/config/main.cpp
blob: 7be84d0bf09bd098ac704fd6679ea14808bb6007 (plain)
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
/*
 * This file is part of smolbote. It's copyrighted by the contributors recorded
 * in the version control history of the file, available from its original
 * location: git://neueland.iserlohn-fortress.net/smolbote.git
 * 
 * SPDX-License-Identifier: GPL-3.0
 */

#include <iostream>
#include "settings/configuration.h"

#include <QFile>

int main(int argc, char** argv)
{
    Configuration *settings = new Configuration();

    // Use QFile so we can easily access qrc:
    QFile defaultCfg(":/poi.cfg");
    defaultCfg.open(QIODevice::ReadOnly);

    std::cout << "UserCfg: " << (settings->readUserConfiguration("file.cfg") ? "true" : "false") << std::endl;
    std::cout << "DefaultCfg: " << (settings->readDefaultConfiguration(defaultCfg.readAll().toStdString()) ? "true" : "false") << std::endl;

    std::cout << "test = " << settings->value<std::string>("test").value_or("unknown") << std::endl;

    return 0;
}