Debian Codegraph @

libqnapi/src/config/qnapiconfig.cpp

raw symbols SCIP
1 /*****************************************************************************
2 ** QNapi
3 ** Copyright (C) 2008-2017 Piotr KrzemiƄski <[email protected]>
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12 **
13 *****************************************************************************/
14
15 #include "config/qnapiconfig.h"
16 #include <QTextStream>
17
18 QString QNapiConfig::toString() const {
19 QString enabledEnginesStr, enginesCfgStr;
20
21 QTextStream ees(&enabledEnginesStr);
22 typedef QPair<QString, bool> EngineEnableCfg;
23 foreach (EngineEnableCfg engineCfg, enabledEngines()) {
24 QString engineName = engineCfg.first;
25 bool engineEnabled = engineCfg.second;
26 QString engineEnabledStr = engineEnabled ? "enabled" : "disabled";
27 ees << " " << engineName << ": " << engineEnabledStr << endl;
28 }
29
30 QTextStream es(&enginesCfgStr);
31 foreach (QString engineName, enginesConfig().keys()) {
32 EngineConfig cfg = *enginesConfig().find(engineName);
33 es << " " << engineName << ": " << endl
34 << " nick: " << cfg.nick() << endl
35 << " password: " << cfg.password() << endl;
36 }
37
38 QString s;
39 QTextStream(&s) << "Version: " << version() << endl
40 << "First run? " << (firstrun() ? "yes" : "no") << endl
41 << endl
42 << "General config:" << endl
43 << generalConfig().toString() << endl
44 << "Enabled Engines:" << endl
45 << enabledEnginesStr << endl
46 << "Engines config:" << endl
47 << enginesCfgStr << endl
48 << "Post-processing config:" << endl
49 << postProcessingConfig().toString() << endl
50 << "Scan config:" << endl
51 << scanConfig().toString() << endl
52 << "Last open-dialog dir:" << endl
53 << lastOpenedDir() << endl;
54 return s;
55 }