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