MCPcopy Create free account
hub / github.com/KDE/kdiff3 / initialiseCmdLineArgs

Function initialiseCmdLineArgs

src/main.cpp:35–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33#include <QTextStream>
34
35void initialiseCmdLineArgs(QCommandLineParser* cmdLineParser)
36{
37 const QString configFileName = QStandardPaths::locate(QStandardPaths::GenericConfigLocation, "kdiff3rc");
38 QFile configFile(configFileName);
39 QString ignorableOptionsLine = "-u;-query;-html;-abort";
40 if(configFile.open(QIODevice::ReadOnly))
41 {
42 QTextStream ts(&configFile);
43 while(!ts.atEnd())
44 {
45 const QString line = ts.readLine();
46 if(line.startsWith(u8"IgnorableCmdLineOptions="))
47 {
48 const qsizetype pos = line.indexOf('=');
49 if(pos >= 0)
50 {
51 ignorableOptionsLine = line.mid(pos + 1);
52 }
53 break;
54 }
55 }
56 }
57
58 const QStringList ignorableOptions = ignorableOptionsLine.split(';');
59
60 for(QString ignorableOption: ignorableOptions)
61 {
62 ignorableOption.remove('-');
63 if(!ignorableOption.isEmpty())
64 {
65 if(ignorableOption.length() == 1)
66 {
67 cmdLineParser->addOption(QCommandLineOption({ignorableOption, u8"ignore"}, i18n("Ignored. (User defined.)")));
68 }
69 else
70 {
71 cmdLineParser->addOption(QCommandLineOption(ignorableOption, i18n("Ignored. (User defined.)")));
72 }
73 }
74 }
75}
76
77qint32 main(qint32 argc, char* argv[])
78{

Callers 1

mainFunction · 0.85

Calls 3

openMethod · 0.80
splitMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected