Add bool QStandardPaths::isTestModeEnabled()
Library code might need to know this, e.g. when calling an external process, to give it the right configuration. (For instance when ksycoca code calls kbuildsycoca to recreate the DB at the right place). Change-Id: I343ddefff816586f9d391973c08ff1e1ad86bf0e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d1bb10d9b8
commit
a23da5fd6b
@ -333,6 +333,15 @@ QString QStandardPaths::displayName(StandardLocation type)
|
|||||||
On Windows, everything goes to a "qttest" directory under Application Data.
|
On Windows, everything goes to a "qttest" directory under Application Data.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void QStandardPaths::isTestModeEnabled()
|
||||||
|
|
||||||
|
\internal
|
||||||
|
|
||||||
|
Returns true if test mode is enabled in QStandardPaths; otherwise returns false.
|
||||||
|
*/
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_STANDARDPATHS
|
#endif // QT_NO_STANDARDPATHS
|
||||||
|
@ -92,6 +92,7 @@ public:
|
|||||||
static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
|
static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
|
||||||
|
|
||||||
static void enableTestMode(bool testMode);
|
static void enableTestMode(bool testMode);
|
||||||
|
static bool isTestModeEnabled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// prevent construction
|
// prevent construction
|
||||||
|
@ -55,6 +55,11 @@ void QStandardPaths::enableTestMode(bool testMode)
|
|||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QStandardPaths::isTestModeEnabled()
|
||||||
|
{
|
||||||
|
return qsp_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
static QString testModeInsert() {
|
static QString testModeInsert() {
|
||||||
if (qsp_testMode)
|
if (qsp_testMode)
|
||||||
return QStringLiteral("/.qttest");
|
return QStringLiteral("/.qttest");
|
||||||
|
@ -116,6 +116,11 @@ void QStandardPaths::enableTestMode(bool testMode)
|
|||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QStandardPaths::isTestModeEnabled()
|
||||||
|
{
|
||||||
|
return qsp_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
static void appendOrganizationAndApp(QString &path)
|
static void appendOrganizationAndApp(QString &path)
|
||||||
{
|
{
|
||||||
const QString org = QCoreApplication::organizationName();
|
const QString org = QCoreApplication::organizationName();
|
||||||
|
@ -97,6 +97,11 @@ void QStandardPaths::enableTestMode(bool testMode)
|
|||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QStandardPaths::isTestModeEnabled()
|
||||||
|
{
|
||||||
|
return qsp_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Constructs a full unicode path from a FSRef.
|
Constructs a full unicode path from a FSRef.
|
||||||
*/
|
*/
|
||||||
|
@ -70,6 +70,11 @@ void QStandardPaths::enableTestMode(bool testMode)
|
|||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QStandardPaths::isTestModeEnabled()
|
||||||
|
{
|
||||||
|
return qsp_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
QString QStandardPaths::writableLocation(StandardLocation type)
|
QString QStandardPaths::writableLocation(StandardLocation type)
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -92,6 +92,11 @@ void QStandardPaths::enableTestMode(bool testMode)
|
|||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QStandardPaths::isTestModeEnabled()
|
||||||
|
{
|
||||||
|
return qsp_testMode;
|
||||||
|
}
|
||||||
|
|
||||||
QString QStandardPaths::writableLocation(StandardLocation type)
|
QString QStandardPaths::writableLocation(StandardLocation type)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
|
@ -159,7 +159,9 @@ void tst_qstandardpaths::testCustomLocations()
|
|||||||
|
|
||||||
void tst_qstandardpaths::enableTestMode()
|
void tst_qstandardpaths::enableTestMode()
|
||||||
{
|
{
|
||||||
|
QVERIFY(!QStandardPaths::isTestModeEnabled());
|
||||||
QStandardPaths::enableTestMode(true);
|
QStandardPaths::enableTestMode(true);
|
||||||
|
QVERIFY(QStandardPaths::isTestModeEnabled());
|
||||||
|
|
||||||
#ifdef Q_XDG_PLATFORM
|
#ifdef Q_XDG_PLATFORM
|
||||||
setCustomLocations(); // for the global config dir
|
setCustomLocations(); // for the global config dir
|
||||||
|
Loading…
x
Reference in New Issue
Block a user