Add a Qt-API style QStandardPaths::setTestModeEnabled
QStandardPaths::enableTestMode has a verb in the imperative ("enable") as the core word in the name. That indicates an action. The function should not have had a parameter. Instead, add a Qt-style setXXXEnabled function. [ChangeLog][QtCore][QStandardPaths] QStandardPaths::enableTestMode is deprecated and is replaced by QStandardPaths::setTestModeEnabled. Change-Id: Ib26ad72d7c635890d2cb22ae9d44cbda08a6f17c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org>
This commit is contained in:
parent
652d51eda6
commit
73251f22f3
@ -347,6 +347,10 @@ QString QStandardPaths::displayName(StandardLocation type)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void QStandardPaths::enableTestMode(bool testMode)
|
\fn void QStandardPaths::enableTestMode(bool testMode)
|
||||||
|
\obsolete Use QStandardPaths::setTestModeEnabled
|
||||||
|
*/
|
||||||
|
/*!
|
||||||
|
\fn void QStandardPaths::setTestModeEnabled(bool testMode)
|
||||||
|
|
||||||
If \a testMode is true, this enables a special "test mode" in
|
If \a testMode is true, this enables a special "test mode" in
|
||||||
QStandardPaths, which changes writable locations
|
QStandardPaths, which changes writable locations
|
||||||
@ -369,10 +373,17 @@ QString QStandardPaths::displayName(StandardLocation type)
|
|||||||
|
|
||||||
static bool qsp_testMode = false;
|
static bool qsp_testMode = false;
|
||||||
|
|
||||||
|
#if QT_DEPRECATED_SINCE(5, 2)
|
||||||
void QStandardPaths::enableTestMode(bool testMode)
|
void QStandardPaths::enableTestMode(bool testMode)
|
||||||
{
|
{
|
||||||
qsp_testMode = testMode;
|
qsp_testMode = testMode;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void QStandardPaths::setTestModeEnabled(bool testMode)
|
||||||
|
{
|
||||||
|
qsp_testMode = testMode;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void QStandardPaths::isTestModeEnabled()
|
\fn void QStandardPaths::isTestModeEnabled()
|
||||||
|
@ -89,7 +89,10 @@ 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);
|
#if QT_DEPRECATED_SINCE(5, 2)
|
||||||
|
static QT_DEPRECATED void enableTestMode(bool testMode);
|
||||||
|
#endif
|
||||||
|
static void setTestModeEnabled(bool testMode);
|
||||||
static bool isTestModeEnabled();
|
static bool isTestModeEnabled();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -166,7 +166,7 @@ void tst_qstandardpaths::testCustomLocations()
|
|||||||
void tst_qstandardpaths::enableTestMode()
|
void tst_qstandardpaths::enableTestMode()
|
||||||
{
|
{
|
||||||
QVERIFY(!QStandardPaths::isTestModeEnabled());
|
QVERIFY(!QStandardPaths::isTestModeEnabled());
|
||||||
QStandardPaths::enableTestMode(true);
|
QStandardPaths::setTestModeEnabled(true);
|
||||||
QVERIFY(QStandardPaths::isTestModeEnabled());
|
QVERIFY(QStandardPaths::isTestModeEnabled());
|
||||||
|
|
||||||
#ifdef Q_XDG_PLATFORM
|
#ifdef Q_XDG_PLATFORM
|
||||||
@ -204,7 +204,7 @@ void tst_qstandardpaths::enableTestMode()
|
|||||||
// On Windows, what should "Program Files" become, in test mode?
|
// On Windows, what should "Program Files" become, in test mode?
|
||||||
//testLocations.insert(QStandardPaths::ApplicationsLocation, QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation));
|
//testLocations.insert(QStandardPaths::ApplicationsLocation, QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation));
|
||||||
|
|
||||||
QStandardPaths::enableTestMode(false);
|
QStandardPaths::setTestModeEnabled(false);
|
||||||
|
|
||||||
for (LocationHash::const_iterator it = testLocations.constBegin(); it != testLocations.constEnd(); ++it)
|
for (LocationHash::const_iterator it = testLocations.constBegin(); it != testLocations.constEnd(); ++it)
|
||||||
QVERIFY2(QStandardPaths::writableLocation(it.key()) != it.value(), qPrintable(it.value()));
|
QVERIFY2(QStandardPaths::writableLocation(it.key()) != it.value(), qPrintable(it.value()));
|
||||||
|
Loading…
Reference in New Issue
Block a user