Commit 3e72085f authored by Rafał Malinowski's avatar Rafał Malinowski

core: rename configuration directory to profile directory

Signed-off-by: Rafał Malinowski's avatarRafał Malinowski <rafal.przemyslaw.malinowski@gmail.com>
parent 00b2e224
......@@ -45,9 +45,9 @@ ExecutionArgumentsBuilder & ExecutionArgumentsBuilder::setDebugMask(QString debu
return *this;
}
ExecutionArgumentsBuilder & ExecutionArgumentsBuilder::setConfigurationDirectory(QString configurationDirectory)
ExecutionArgumentsBuilder & ExecutionArgumentsBuilder::setProfileDirectory(QString profileDirectory)
{
m_configurationDirectory = std::move(configurationDirectory);
m_profileDirectory = std::move(profileDirectory);
return *this;
}
......@@ -63,7 +63,7 @@ ExecutionArguments ExecutionArgumentsBuilder::build() const
m_queryVersion,
m_queryUsage,
m_debugMask,
m_configurationDirectory,
m_profileDirectory,
m_openIds
};
}
......@@ -51,7 +51,7 @@ public:
ExecutionArgumentsBuilder & setQueryVersion(bool queryVersion);
ExecutionArgumentsBuilder & setQueryUsage(bool queryUsage);
ExecutionArgumentsBuilder & setDebugMask(QString debugMask);
ExecutionArgumentsBuilder & setConfigurationDirectory(QString configurationDirectory);
ExecutionArgumentsBuilder & setProfileDirectory(QString profileDirectory);
ExecutionArgumentsBuilder & setOpenIds(QStringList openIds);
/**
......@@ -63,7 +63,7 @@ private:
bool m_queryVersion;
bool m_queryUsage;
QString m_debugMask;
QString m_configurationDirectory;
QString m_profileDirectory;
QStringList m_openIds;
};
......
......@@ -27,7 +27,7 @@ ExecutionArguments ExecutionArgumentsParser::parse(const QStringList &arguments)
auto queryVersion = false;
auto queryUsage = false;
auto debugMask = QString{};
auto configurationDirectory = QString{};
auto profileDirectory = QString{};
auto openIds = QStringList{};
for (auto it = arguments.constBegin(); it != arguments.constEnd(); ++it)
......@@ -44,7 +44,7 @@ ExecutionArguments ExecutionArgumentsParser::parse(const QStringList &arguments)
debugMask = *it;
}
else if (*it == QLatin1String("--config-dir") && (it + 1) != arguments.constEnd())
configurationDirectory = *(++it);
profileDirectory = *(++it);
else if (QRegExp("^[a-zA-Z]+:(/){0,3}.+").exactMatch(*it))
openIds.append(*it);
else
......@@ -55,7 +55,7 @@ ExecutionArguments ExecutionArgumentsParser::parse(const QStringList &arguments)
.setQueryVersion(queryVersion)
.setQueryUsage(queryUsage)
.setDebugMask(std::move(debugMask))
.setConfigurationDirectory(std::move(configurationDirectory))
.setProfileDirectory(std::move(profileDirectory))
.setOpenIds(std::move(openIds))
.build();
}
......@@ -19,11 +19,11 @@
#include "execution-arguments.h"
ExecutionArguments::ExecutionArguments(bool queryVersion, bool queryUsage, QString debugMask, QString configurationDirectory, QStringList openIds) :
ExecutionArguments::ExecutionArguments(bool queryVersion, bool queryUsage, QString debugMask, QString profileDirectory, QStringList openIds) :
m_queryVersion{queryVersion},
m_queryUsage{queryUsage},
m_debugMask{std::move(debugMask)},
m_configurationDirectory{std::move(configurationDirectory)},
m_profileDirectory{std::move(profileDirectory)},
m_openIds{std::move(openIds)}
{
}
......@@ -43,9 +43,9 @@ QString ExecutionArguments::debugMask() const
return m_debugMask;
}
QString ExecutionArguments::configurationDirectory() const
QString ExecutionArguments::profileDirectory() const
{
return m_configurationDirectory;
return m_profileDirectory;
}
QStringList ExecutionArguments::openIds() const
......
......@@ -39,7 +39,7 @@ class KADUAPI ExecutionArguments final
{
public:
ExecutionArguments(bool queryVersion, bool queryUsage, QString debugMask, QString configurationDirectory, QStringList openIds);
ExecutionArguments(bool queryVersion, bool queryUsage, QString debugMask, QString profileDirectory, QStringList openIds);
/**
* @return True if version information is requested.
......@@ -58,9 +58,9 @@ public:
QString debugMask() const;
/**
* @return Requested value of configuation directory.
* @return Requested value of profile directory.
*/
QString configurationDirectory() const;
QString profileDirectory() const;
/**
* @return Requested list of ids to open chat with.
......@@ -71,7 +71,7 @@ private:
bool m_queryVersion;
bool m_queryUsage;
QString m_debugMask;
QString m_configurationDirectory;
QString m_profileDirectory;
QStringList m_openIds;
};
......
......@@ -225,9 +225,9 @@ int main(int argc, char *argv[]) try
fprintf(stderr, "Ignoring invalid debug mask '%s'\n", executionArguments.debugMask().toUtf8().constData());
}
if (!executionArguments.configurationDirectory().isEmpty())
if (!executionArguments.profileDirectory().isEmpty())
{
qputenv("CONFIG_DIR", executionArguments.configurationDirectory().toUtf8());
qputenv("CONFIG_DIR", executionArguments.profileDirectory().toUtf8());
}
// It has to be called after putting CONFIG_DIR environment variable.
......
......@@ -35,9 +35,9 @@ private slots:
void shouldIgnoreInvalidDebugMask();
void shouldIgnoreEmptyDebugMask();
void shouldAcceptLastValidDebugMask();
void shouldProperlyParseConfigurationDirectory();
void shouldIgnoreEmptyConfigurationDirectory();
void shouldAcceptLastConfigurationDirectory();
void shouldProperlyParseProfileDirectory();
void shouldIgnoreEmptyProfileDirectory();
void shouldAcceptLastProfileDirectory();
void shouldProperlyParseListOfIds();
void shouldIgnoreInvalidIds();
void shouldProperlyParseComplexArguments();
......@@ -53,7 +53,7 @@ void tst_ExcutionArgumentsParser::shouldCreateDefaultArgumentsWhenNonePassed()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -66,7 +66,7 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseQueryVersion()
QCOMPARE(executionArguments.queryVersion(), true);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -79,7 +79,7 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseQueryUsage()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), true);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -92,7 +92,7 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseValidDebugMask()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{"126"});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -105,7 +105,7 @@ void tst_ExcutionArgumentsParser::shouldIgnoreEmptyDebugMask()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -118,7 +118,7 @@ void tst_ExcutionArgumentsParser::shouldIgnoreInvalidDebugMask()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -131,11 +131,11 @@ void tst_ExcutionArgumentsParser::shouldAcceptLastValidDebugMask()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{"256"});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
void tst_ExcutionArgumentsParser::shouldProperlyParseConfigurationDirectory()
void tst_ExcutionArgumentsParser::shouldProperlyParseProfileDirectory()
{
auto arguments = QStringList{} << "--config-dir" << "kadu-2";
auto parser = ExecutionArgumentsParser{};
......@@ -144,11 +144,11 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseConfigurationDirectory()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{"kadu-2"});
QCOMPARE(executionArguments.profileDirectory(), QString{"kadu-2"});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
void tst_ExcutionArgumentsParser::shouldIgnoreEmptyConfigurationDirectory()
void tst_ExcutionArgumentsParser::shouldIgnoreEmptyProfileDirectory()
{
auto arguments = QStringList{} << "--config-dir";
auto parser = ExecutionArgumentsParser{};
......@@ -157,11 +157,11 @@ void tst_ExcutionArgumentsParser::shouldIgnoreEmptyConfigurationDirectory()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
void tst_ExcutionArgumentsParser::shouldAcceptLastConfigurationDirectory()
void tst_ExcutionArgumentsParser::shouldAcceptLastProfileDirectory()
{
auto arguments = QStringList{} << "--config-dir" << "kadu-2" << "--config-dir" << "kadu-3";
auto parser = ExecutionArgumentsParser{};
......@@ -170,7 +170,7 @@ void tst_ExcutionArgumentsParser::shouldAcceptLastConfigurationDirectory()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{"kadu-3"});
QCOMPARE(executionArguments.profileDirectory(), QString{"kadu-3"});
QCOMPARE(executionArguments.openIds(), QStringList{});
}
......@@ -183,7 +183,7 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseListOfIds()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{} << "gg:123" << "gg:456" << "xmpp:test@example.com");
}
......@@ -196,7 +196,7 @@ void tst_ExcutionArgumentsParser::shouldIgnoreInvalidIds()
QCOMPARE(executionArguments.queryVersion(), false);
QCOMPARE(executionArguments.queryUsage(), false);
QCOMPARE(executionArguments.debugMask(), QString{});
QCOMPARE(executionArguments.configurationDirectory(), QString{});
QCOMPARE(executionArguments.profileDirectory(), QString{});
QCOMPARE(executionArguments.openIds(), QStringList{} << "gg:123" << "gg:456" << "xmpp:test@example.com");
}
......@@ -209,7 +209,7 @@ void tst_ExcutionArgumentsParser::shouldProperlyParseComplexArguments()
QCOMPARE(executionArguments.queryVersion(), true);
QCOMPARE(executionArguments.queryUsage(), true);
QCOMPARE(executionArguments.debugMask(), QString{"15"});
QCOMPARE(executionArguments.configurationDirectory(), QString{"kadu-7"});
QCOMPARE(executionArguments.profileDirectory(), QString{"kadu-7"});
QCOMPARE(executionArguments.openIds(), QStringList{} << "gg:15" << "xmpp:12");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment