summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qdir.cpp15
-rw-r--r--src/corelib/io/qfileinfo.cpp2
-rw-r--r--src/corelib/io/qfileselector.cpp32
-rw-r--r--src/corelib/io/qfileselector.h2
-rw-r--r--src/corelib/io/qlockfile_unix.cpp17
-rw-r--r--src/corelib/io/qloggingcategory.cpp323
-rw-r--r--src/corelib/io/qloggingcategory.h76
-rw-r--r--src/corelib/io/qloggingregistry.cpp8
-rw-r--r--src/corelib/io/qsettings.cpp4
-rw-r--r--src/corelib/io/qsettings_mac.cpp3
-rw-r--r--src/corelib/io/qstandardpaths.cpp7
-rw-r--r--src/corelib/io/qstandardpaths.h3
-rw-r--r--src/corelib/io/qstandardpaths_blackberry.cpp1
-rw-r--r--src/corelib/io/qstandardpaths_ios.mm136
-rw-r--r--src/corelib/io/qstandardpaths_mac.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_unix.cpp2
-rw-r--r--src/corelib/io/qstandardpaths_win.cpp10
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/io/qurl.h36
20 files changed, 235 insertions, 448 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index 701f79d21e..0ec3d949b9 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -137,6 +137,8 @@ win32 {
mac {
macx {
SOURCES += io/qstandardpaths_mac.cpp
+ } else:ios {
+ OBJECTIVE_SOURCES += io/qstandardpaths_ios.mm
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index bb2b2e99f3..624f45caaf 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1863,9 +1863,12 @@ bool QDir::setCurrent(const QString &path)
*/
/*!
- Returns the absolute path of the application's current directory.
+ Returns the absolute path of the application's current directory. The
+ current directory is the last directory set with QDir::setCurrent() or, if
+ that was never called, the directory at which this application was started
+ at by the parent process.
- \sa current(), setCurrent(), homePath(), rootPath(), tempPath()
+ \sa current(), setCurrent(), homePath(), rootPath(), tempPath(), QCoreApplication::applicationDirPath()
*/
QString QDir::currentPath()
{
@@ -2205,10 +2208,10 @@ QStringList QDir::nameFiltersFromString(const QString &nameFilter)
\relates QDir
Initializes the resources specified by the \c .qrc file with the
- specified base \a name. Normally, Qt resources are loaded
- automatically at startup. The Q_INIT_RESOURCE() macro is
- necessary on some platforms for resources stored in a static
- library.
+ specified base \a name. Normally, when resources are built as part
+ of the application, the resources are loaded automatically at
+ startup. The Q_INIT_RESOURCE() macro is necessary on some platforms
+ for resources stored in a static library.
For example, if your application's resources are listed in a file
called \c myapp.qrc, you can ensure that the resources are
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index 897af352c9..2cf97ef94e 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -682,7 +682,7 @@ bool QFileInfo::exists() const
\note If \a file is a symlink that points to a non-existing
file, false is returned.
- \note Using this function is faster for than using
+ \note Using this function is faster than using
\c QFileInfo(file).exists() for file system access.
*/
bool QFileInfo::exists(const QString &file)
diff --git a/src/corelib/io/qfileselector.cpp b/src/corelib/io/qfileselector.cpp
index d67ea80e51..72e4198fb0 100644
--- a/src/corelib/io/qfileselector.cpp
+++ b/src/corelib/io/qfileselector.cpp
@@ -348,22 +348,30 @@ void QFileSelectorPrivate::updateSelectors()
QStringList QFileSelectorPrivate::platformSelectors()
{
QStringList ret;
-#if defined(Q_OS_LINUX_ANDROID)
+#if defined(Q_OS_WIN)
+ ret << QStringLiteral("windows");
+# if defined(Q_OS_WINCE)
+ ret << QStringLiteral("wince");
+# endif
+#elif defined(Q_OS_UNIX)
+ ret << QStringLiteral("unix");
+# if defined(Q_OS_LINUX_ANDROID)
ret << QStringLiteral("android");
-#elif defined(Q_OS_BLACKBERRY)
+# elif defined(Q_OS_BLACKBERRY)
ret << QStringLiteral("blackberry");
-#elif defined(Q_OS_IOS)
+# elif defined(Q_OS_QNX)
+ ret << QStringLiteral("qnx");
+# elif defined(Q_OS_IOS)
ret << QStringLiteral("ios");
-#elif defined(Q_OS_WINCE)
- ret << QStringLiteral("wince");
-#elif defined(Q_OS_WIN)
- ret << QStringLiteral("windows");
-#elif defined(Q_OS_LINUX)
+# elif defined(Q_OS_LINUX)
ret << QStringLiteral("linux");
-#elif defined(Q_OS_OSX)
- ret << QStringLiteral("osx");
-#elif defined(Q_OS_UNIX)
- ret << QStringLiteral("generic_unix");
+# elif defined(Q_OS_MAC)
+ ret << QStringLiteral("mac");
+# else
+ struct utsname u;
+ if (uname(&u) != -1)
+ ret << QString::fromLatin1(u.sysname).toLower();
+# endif
#endif
return ret;
}
diff --git a/src/corelib/io/qfileselector.h b/src/corelib/io/qfileselector.h
index 9afd985757..cb5f71faae 100644
--- a/src/corelib/io/qfileselector.h
+++ b/src/corelib/io/qfileselector.h
@@ -52,7 +52,7 @@ class Q_CORE_EXPORT QFileSelector : public QObject
{
Q_OBJECT
public:
- QFileSelector(QObject *parent = 0);
+ explicit QFileSelector(QObject *parent = 0);
~QFileSelector();
QString select(const QString &filePath) const;
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp
index dc8817706c..d1ef9c1770 100644
--- a/src/corelib/io/qlockfile_unix.cpp
+++ b/src/corelib/io/qlockfile_unix.cpp
@@ -54,16 +54,17 @@
#include <sys/file.h> // flock
#include <sys/types.h> // kill
#include <signal.h> // kill
+#include <unistd.h> // gethostname
QT_BEGIN_NAMESPACE
-static QString localHostName() // from QHostInfo::localHostName()
+static QByteArray localHostName() // from QHostInfo::localHostName(), modified to return a QByteArray
{
- char hostName[512];
- if (gethostname(hostName, sizeof(hostName)) == -1)
- return QString();
- hostName[sizeof(hostName) - 1] = '\0';
- return QString::fromLocal8Bit(hostName);
+ QByteArray hostName(512, Qt::Uninitialized);
+ if (gethostname(hostName.data(), hostName.size()) == -1)
+ return QByteArray();
+ hostName.truncate(strlen(hostName.data()));
+ return hostName;
}
// ### merge into qt_safe_write?
@@ -145,7 +146,7 @@ QLockFile::LockError QLockFilePrivate::tryLock_sys()
// Use operator% from the fast builder to avoid multiple memory allocations.
QByteArray fileData = QByteArray::number(QCoreApplication::applicationPid()) % '\n'
% qAppName().toUtf8() % '\n'
- % localHostName().toUtf8() % '\n';
+ % localHostName() % '\n';
const QByteArray lockFileName = QFile::encodeName(fileName);
const int fd = qt_safe_open(lockFileName.constData(), O_WRONLY | O_CREAT | O_EXCL, 0644);
@@ -190,7 +191,7 @@ bool QLockFilePrivate::isApparentlyStale() const
QString hostname, appname;
if (!getLockInfo(&pid, &hostname, &appname))
return false;
- if (hostname == localHostName()) {
+ if (hostname == QString::fromLocal8Bit(localHostName())) {
if (::kill(pid, 0) == -1 && errno == ESRCH)
return true; // PID doesn't exist anymore
}
diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp
index 8d337ec630..93a98b1835 100644
--- a/src/corelib/io/qloggingcategory.cpp
+++ b/src/corelib/io/qloggingcategory.cpp
@@ -75,10 +75,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
\l isCriticalEnabled(), \l isTraceEnabled(), as well as \l isEnabled()
to check whether messages for the given message type should be logged.
- \note The qCDebug(), qCWarning(), qCCritical(), qCTrace() and
- qCTraceGuard() macros prevent arguments from being evaluated if the
- respective message types are not enabled for the category, so explicit
- checking is not needed:
+ \note The qCDebug(), qCWarning(), qCCritical() macros prevent arguments
+ from being evaluated if the respective message types are not enabled for the
+ category, so explicit checking is not needed:
\snippet qloggingcategory/main.cpp 4
@@ -103,14 +102,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QLoggingCategory, qtDefaultCategory,
\snippet qloggingcategory/main.cpp 3
*/
-typedef QVector<QTracer *> Tracers;
-
-class QLoggingCategoryPrivate
-{
-public:
- Tracers tracers;
-};
-
/*!
Constructs a QLoggingCategory object with the provided \a category name.
The object becomes the local identifier for the category.
@@ -118,16 +109,15 @@ public:
If \a category is \c{0}, the category name is changed to \c "default".
*/
QLoggingCategory::QLoggingCategory(const char *category)
- : d(new QLoggingCategoryPrivate),
+ : d(0),
name(0),
enabledDebug(false),
enabledWarning(true),
- enabledCritical(true),
- enabledTrace(false),
- placeholder1(false),
- placeholder2(false),
- placeholder3(false)
+ enabledCritical(true)
{
+ Q_UNUSED(d);
+ Q_UNUSED(placeholder);
+
bool isDefaultCategory
= (category == 0) || (strcmp(category, qtDefaultCategoryName) == 0);
@@ -151,7 +141,6 @@ QLoggingCategory::~QLoggingCategory()
{
if (QLoggingRegistry *reg = QLoggingRegistry::instance())
reg->unregisterCategory(this);
- delete d;
}
/*!
@@ -194,18 +183,6 @@ QLoggingCategory::~QLoggingCategory()
*/
/*!
- \fn bool QLoggingCategory::isTraceEnabled() const
-
- Returns \c true if the tracers associated with this category should
- receive messages. Returns \c false otherwise.
-
- \note The \l qCTrace() and \l qCTraceGuard() macros already do this check
- before executing any
- code. However, calling this method may be useful to avoid
- expensive generation of data that is only used for debug output.
-*/
-
-/*!
Returns \c true if a message of type \a msgtype for the category should be
shown. Returns \c false otherwise.
*/
@@ -215,7 +192,6 @@ bool QLoggingCategory::isEnabled(QtMsgType msgtype) const
case QtDebugMsg: return enabledDebug;
case QtWarningMsg: return enabledWarning;
case QtCriticalMsg: return enabledCritical;
- case QtTraceMsg: return enabledTrace;
case QtFatalMsg: return true;
}
return false;
@@ -237,7 +213,6 @@ void QLoggingCategory::setEnabled(QtMsgType type, bool enable)
case QtDebugMsg: enabledDebug = enable; break;
case QtWarningMsg: enabledWarning = enable; break;
case QtCriticalMsg: enabledCritical = enable; break;
- case QtTraceMsg: enabledTrace = enable; break;
case QtFatalMsg: break;
}
}
@@ -313,7 +288,7 @@ QLoggingCategory::installFilter(QLoggingCategory::CategoryFilter filter)
where \c <category> is the name of the category, potentially with \c{*} as a
wildcard symbol at the start and/or the end. The optional \c <type> must
- be either \c debug, \c warning, \c critical, or \c trace.
+ be either \c debug, \c warning, or \c critical.
Example:
@@ -395,56 +370,6 @@ void QLoggingCategory::setFilterRules(const QString &rules)
*/
/*!
- \relates QLoggingCategory
- \macro qCTrace(category)
- \since 5.2
-
- Returns an output stream for trace messages in the logging category
- \a category.
-
- The macro expands to code that checks whether
- \l QLoggingCategory::isTraceEnabled() evaluates to \c true.
- If so, the stream arguments are processed and sent to the \l QTracer objects
- registered with the category.
-
- \note Arguments are not processed if trace output for the category is not
- enabled, so do not rely on any side effects.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 6
-
- \sa qCTraceGuard() QTraceGuard
-*/
-
-/*!
- \relates QLoggingCategory
- \macro qCTraceGuard(category)
- \since 5.2
-
- The macro expands to code that creates a guard object with automatic
- storage. The guard constructor checks whether
- \l QLoggingCategory::isTraceEnabled() evaluates to \c true.
- If so, the stream arguments are processed and the \c{start()}
- functions of the \l QTracer objects registered with the \a category are
- called.
-
- The guard destructor also checks whether the category is enabled for
- tracing and if so, the \c{end()}
- functions of the \l QTracer objects registered with the \a category are called.
-
- \note Arguments are always processed, even if trace output for the
- category is disabled. They will, however, in that case not be passed
- to the \c{record()} functions of the registered tracers.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 4
-
- \sa qCTrace() QTracer
-*/
-
-/*!
\macro Q_DECLARE_LOGGING_CATEGORY(name)
\relates QLoggingCategory
\since 5.2
@@ -469,234 +394,4 @@ void QLoggingCategory::setFilterRules(const QString &rules)
This macro must be used outside of a class or method.
*/
-
-/*!
- \class QTracer
- \inmodule QtCore
- \since 5.2
-
- \brief The QTracer class provides an interface for handling
- trace events associated with a logging category.
-
- \c QTracer objects are registered with logging categories.
- Multiple \c QTracer objects
- can be registered with the same category, and the same
- \c QTracer object can be registered with different categories.
-
- If code containing \c qCTrace is executed, and the associated
- logging category is enabled for tracing, all \c QTracer objects
- that are registered with the category are notified.
-
- \c QTracer objects
-*/
-
-/*!
- \fn QTracer::QTracer()
-
- Constructs a tracer object.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 2
-*/
-
-/*!
- \fn QTracer::~QTracer()
-
- Destroys the tracer object.
-*/
-
-/*!
- Registers this tracer for the \a category.
-
- The tracer will later be notified of messages of type
- \c QtTraceMsg, as long as that message type
- is enabled in the category.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 1
- \codeline
- \snippet qtracer/ftracer.cpp 7
-*/
-
-void QTracer::addToCategory(QLoggingCategory &category)
-{
- category.d->tracers.append(this);
-}
-
-/*!
- \fn void QTracer::start()
-
- This function is invoked when a tracing activity starts,
- typically from the constructor of a \c QTraceGuard object
- defined by \c qCTrace() or \c qCTraceGuard().
-
- The base implementation does nothing. \c QTracer subclasses
- are advised to override it if needed.
-
- \sa qCTrace(), qCTraceGuard()
-*/
-
-/*!
- \fn void QTracer::end()
-
- This function is invoked when a tracing activity ends,
- typically from the destructor of a \c QTraceGuard object
- defined by \c qCTrace() or \c qCTraceGuard().
-
- The base implementation does nothing. It is common for
- \c QTracer subclasses to override it to perform flushing
- of collected data.
-
- \sa qCTrace(), qCTraceGuard()
-*/
-
-/*!
- \fn void QTracer::record(int data)
-
- This function is invoked during a tracing activity to
- pass integer \a data to the \c QTracer object.
-
- Example:
-
- \snippet qtracer/ftracer.cpp 3
-*/
-
-/*!
- \fn void QTracer::record(const char *data)
-
- This function is invoked during a tracing activity to
- pass string \a data to the \c QTracer object.
-*/
-
-/*!
- \fn void QTracer::record(const QVariant &data)
-
- This function is invoked during a tracing activity to
- pass abitrary (non-integer, non-string) \a data to
- the \c QTracer object.
-*/
-
-/*!
- \class QTraceGuard
- \since 5.2
- \inmodule QtCore
-
- \brief The QTraceGuard class facilitates notifications to
- \c QTracer objects.
-
- \c QTraceGuard objects are typically implicitly created on the
- stack when using the \c qCTrace or \c qCTraceGuard macros and
- are associated to a \c QLoggingCategory.
-
- The constructor of a \c QTraceGuard objects checks whether
- its associated category is enabled, and if so, informs all
- \c QTracer objects registered with the category that a
- tracing activity starts.
-
- The destructor of a \c QTraceGuard objects checks whether
- its associated category is enabled, and if so, informs all
- \c QTracer objects registered with the category that a
- tracing activity ended.
-
- A \c QTraceGuard object created by \c qCTrace will be destroyed
- at the end of the full expression, a guard created by
- \c qCTraceGuard at the end of the block containing the macro.
-
- During the lifetime of a QTraceGuard object, its \c operator<<()
- can be used to pass additional data to the active tracers.
- The fast path handles only \c int and \c{const char *} data,
- but it is possible to use arbitrary values wrapped in \c QVariants.
-
- \sa QTracer
-*/
-
-/*!
- \fn QTraceGuard::QTraceGuard(QLoggingCategory &category)
- \internal
-
- Constructs a trace guard object relaying to \a category.
-*/
-
-/*!
- \fn QTraceGuard::~QTraceGuard()
- \internal
-
- Destroys the trace guard object.
-*/
-
-/*!
- \internal
-
- Calls \c start() on all registered tracers.
-*/
-
-void QTraceGuard::start()
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->start();
-}
-
-/*!
- \internal
-
- Calls \c end() on all registered tracers.
-*/
-
-void QTraceGuard::end()
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->end();
-}
-
-
-/*!
- \internal
-
- This function is called for int parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(int msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
-/*!
- \internal
-
- This function is called for string parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(const char *msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
-
-/*!
- \internal
-
- This function is called for QVariant parameters passed to the
- qCTrace stream.
-*/
-
-QTraceGuard &QTraceGuard::operator<<(const QVariant &msg)
-{
- const Tracers &tracers = target->d->tracers;
- for (int i = tracers.size(); --i >= 0; )
- tracers.at(i)->record(msg);
- return *this;
-}
-
QT_END_NAMESPACE
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 7a119f4937..15c0519827 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -44,14 +44,9 @@
#include <QtCore/qglobal.h>
#include <QtCore/qdebug.h>
-#include <QtCore/qvector.h>
QT_BEGIN_NAMESPACE
-class QTracer;
-class QTraceGuard;
-class QLoggingCategoryPrivate;
-
class Q_CORE_EXPORT QLoggingCategory
{
Q_DISABLE_COPY(QLoggingCategory)
@@ -65,7 +60,6 @@ public:
bool isDebugEnabled() const { return enabledDebug; }
bool isWarningEnabled() const { return enabledWarning; }
bool isCriticalEnabled() const { return enabledCritical; }
- bool isTraceEnabled() const { return enabledTrace; }
const char *categoryName() const { return name; }
@@ -80,66 +74,13 @@ public:
static void setFilterRules(const QString &rules);
private:
- friend class QLoggingCategoryPrivate;
- friend class QLoggingRegistry;
- friend class QTraceGuard;
- friend class QTracer;
-
- QLoggingCategoryPrivate *d;
+ void *d; // reserved for future use
const char *name;
bool enabledDebug;
bool enabledWarning;
bool enabledCritical;
- bool enabledTrace;
- // reserve space for future use
- bool placeholder1;
- bool placeholder2;
- bool placeholder3;
-};
-
-class Q_CORE_EXPORT QTracer
-{
- Q_DISABLE_COPY(QTracer)
-public:
- QTracer() {}
- virtual ~QTracer() {}
-
- void addToCategory(QLoggingCategory &category);
-
- virtual void start() {}
- virtual void end() {}
- virtual void record(int) {}
- virtual void record(const char *) {}
- virtual void record(const QVariant &) {}
-};
-
-class Q_CORE_EXPORT QTraceGuard
-{
- Q_DISABLE_COPY(QTraceGuard)
-public:
- QTraceGuard(QLoggingCategory &category)
- {
- target = category.isTraceEnabled() ? &category : 0;
- if (target)
- start();
- }
-
- ~QTraceGuard()
- {
- if (target)
- end();
- }
-
- QTraceGuard &operator<<(int msg);
- QTraceGuard &operator<<(const char *msg);
- QTraceGuard &operator<<(const QVariant &msg);
-
-private:
- void start();
- void end();
-
- QLoggingCategory *target;
+ bool placeholder[5]; // reserve for future use
};
#define Q_DECLARE_LOGGING_CATEGORY(name) \
@@ -154,7 +95,7 @@ private:
}
#define qCDebug(category) \
- for (bool enabled = category().isDebugEnabled(); enabled; enabled = false) \
+ for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug()
#define qCWarning(category) \
for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \
@@ -162,17 +103,6 @@ private:
#define qCCritical(category) \
for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \
QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical()
-#define qCTrace(category) \
- for (bool enabled = category.isTraceEnabled(); enabled; enabled = false) \
- QTraceGuard(category)
-
-
-#define Q_TRACE_GUARD_NAME_HELPER(line) qTraceGuard ## line
-#define Q_TRACE_GUARD_NAME(line) Q_TRACE_GUARD_NAME_HELPER(line)
-
-#define qCTraceGuard(category) \
- QTraceGuard Q_TRACE_GUARD_NAME(__LINE__)(category);
-
#if defined(QT_NO_DEBUG_OUTPUT)
# undef qCDebug
diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp
index 885b51709d..a82e6f65f4 100644
--- a/src/corelib/io/qloggingregistry.cpp
+++ b/src/corelib/io/qloggingregistry.cpp
@@ -86,9 +86,6 @@ int QLoggingRule::pass(const QString &categoryName, QtMsgType msgType) const
case QtCriticalMsg:
fullCategory += QLatin1String(".critical");
break;
- case QtTraceMsg:
- fullCategory += QLatin1String(".trace");
- break;
default:
break;
}
@@ -291,7 +288,6 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
bool debug = (cat->categoryName() == qtDefaultCategoryName);
bool warning = true;
bool critical = true;
- bool trace = true;
QString categoryName = QLatin1String(cat->categoryName());
QLoggingRegistry *reg = QLoggingRegistry::instance();
@@ -305,15 +301,11 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat)
filterpass = item.pass(categoryName, QtCriticalMsg);
if (filterpass != 0)
critical = (filterpass > 0);
- filterpass = item.pass(categoryName, QtTraceMsg);
- if (filterpass != 0)
- trace = (filterpass > 0);
}
cat->setEnabled(QtDebugMsg, debug);
cat->setEnabled(QtWarningMsg, warning);
cat->setEnabled(QtCriticalMsg, critical);
- cat->setEnabled(QtTraceMsg, trace);
}
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index a0910869c6..8b67fc1962 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -900,7 +900,9 @@ StNormal:
++j;
}
-#ifndef QT_NO_TEXTCODEC
+#ifdef QT_NO_TEXTCODEC
+ Q_UNUSED(codec)
+#else
if (codec) {
stringResult += codec->toUnicode(str.constData() + i, j - i);
} else
diff --git a/src/corelib/io/qsettings_mac.cpp b/src/corelib/io/qsettings_mac.cpp
index f6b14c3027..23cff6af27 100644
--- a/src/corelib/io/qsettings_mac.cpp
+++ b/src/corelib/io/qsettings_mac.cpp
@@ -691,7 +691,8 @@ bool QConfFileSettingsPrivate::writePlistFile(const QString &fileName,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
- QCFType<CFDataRef> xmlData = CFPropertyListCreateXMLData(kCFAllocatorDefault, propertyList);
+ QCFType<CFDataRef> xmlData = CFPropertyListCreateData(
+ kCFAllocatorDefault, propertyList, kCFPropertyListXMLFormat_v1_0, 0, 0);
SInt32 code;
return CFURLWriteDataAndPropertiesToResource(urlFromFileName(fileName), xmlData, 0, &code);
diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp
index 5e2428527c..1181d1b980 100644
--- a/src/corelib/io/qstandardpaths.cpp
+++ b/src/corelib/io/qstandardpaths.cpp
@@ -139,6 +139,9 @@ QT_BEGIN_NAMESPACE
\value DownloadLocation Returns a directory for user's downloaded files. This is a generic value.
If no directory specific for downloads exists, a sensible fallback for storing user
documents is returned.
+ \value GenericConfigLocation Returns a directory location where user-specific
+ configuration files shared between multiple applications should be written.
+ This is a generic value and the returned path is never empty.
The following table gives examples of paths on different operating systems.
The first path is the writable path (unless noted). Other, additional
@@ -499,6 +502,8 @@ QString QStandardPaths::displayName(StandardLocation type)
return QCoreApplication::translate("QStandardPaths", "Runtime");
case ConfigLocation:
return QCoreApplication::translate("QStandardPaths", "Configuration");
+ case GenericConfigLocation:
+ return QCoreApplication::translate("QStandardPaths", "Shared Configuration");
case GenericCacheLocation:
return QCoreApplication::translate("QStandardPaths", "Shared Cache");
case DownloadLocation:
@@ -522,7 +527,7 @@ QString QStandardPaths::displayName(StandardLocation type)
or writing to the current user's configuration.
This affects the locations into which test programs might write files:
- GenericDataLocation, DataLocation, ConfigLocation,
+ GenericDataLocation, DataLocation, ConfigLocation, GenericConfigLocation,
GenericCacheLocation, CacheLocation.
Other locations are not affected.
diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h
index df9089ace7..08d6d7b50c 100644
--- a/src/corelib/io/qstandardpaths.h
+++ b/src/corelib/io/qstandardpaths.h
@@ -69,7 +69,8 @@ public:
RuntimeLocation,
ConfigLocation,
DownloadLocation,
- GenericCacheLocation
+ GenericCacheLocation,
+ GenericConfigLocation
};
static QString writableLocation(StandardLocation type);
diff --git a/src/corelib/io/qstandardpaths_blackberry.cpp b/src/corelib/io/qstandardpaths_blackberry.cpp
index a801c2fba3..815756ff9a 100644
--- a/src/corelib/io/qstandardpaths_blackberry.cpp
+++ b/src/corelib/io/qstandardpaths_blackberry.cpp
@@ -75,6 +75,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case GenericCacheLocation:
return QDir::homePath() + testModeInsert() + QLatin1String("/Cache");
case ConfigLocation:
+ case GenericConfigLocation:
return QDir::homePath() + testModeInsert() + QLatin1String("/Settings");
case GenericDataLocation:
return sharedRoot + testModeInsert() + QLatin1String("/misc");
diff --git a/src/corelib/io/qstandardpaths_ios.mm b/src/corelib/io/qstandardpaths_ios.mm
new file mode 100644
index 0000000000..e2100045a6
--- /dev/null
+++ b/src/corelib/io/qstandardpaths_ios.mm
@@ -0,0 +1,136 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#import <UIKit/UIKit.h>
+
+#include "qstandardpaths.h"
+
+#ifndef QT_NO_STANDARDPATHS
+
+QT_BEGIN_NAMESPACE
+
+static QString pathForDirectory(NSSearchPathDirectory directory)
+{
+ return QString::fromNSString(
+ [NSSearchPathForDirectoriesInDomains(directory, NSUserDomainMask, YES) lastObject]);
+}
+
+static QString bundlePath()
+{
+ return QString::fromNSString([[NSBundle mainBundle] bundlePath]);
+}
+
+QString QStandardPaths::writableLocation(StandardLocation type)
+{
+ QString location;
+
+ switch (type) {
+ case DesktopLocation:
+ location = pathForDirectory(NSDesktopDirectory);
+ break;
+ case DocumentsLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case FontsLocation:
+ location = bundlePath() + QLatin1String("/.fonts");
+ break;
+ case ApplicationsLocation:
+ location = pathForDirectory(NSApplicationDirectory);
+ break;
+ case MusicLocation:
+ location = pathForDirectory(NSMusicDirectory);
+ break;
+ case MoviesLocation:
+ location = pathForDirectory(NSMoviesDirectory);
+ break;
+ case PicturesLocation:
+ location = pathForDirectory(NSPicturesDirectory);
+ break;
+ case TempLocation:
+ location = QString::fromNSString(NSTemporaryDirectory());
+ break;
+ case HomeLocation:
+ location = bundlePath();
+ break;
+ case DataLocation:
+ case GenericDataLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case CacheLocation:
+ case GenericCacheLocation:
+ location = pathForDirectory(NSCachesDirectory);
+ break;
+ case ConfigLocation:
+ case GenericConfigLocation:
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ case DownloadLocation:
+ location = pathForDirectory(NSDownloadsDirectory);
+ break;
+ default:
+ break;
+ }
+
+ switch (type) {
+ case RuntimeLocation:
+ break;
+ default:
+ // All other types must return something, so use the document directory
+ // as a reasonable fall-back (which will always exist).
+ if (location.isEmpty())
+ location = pathForDirectory(NSDocumentDirectory);
+ break;
+ }
+
+ return location;
+}
+
+QStringList QStandardPaths::standardLocations(StandardLocation type)
+{
+ QStringList dirs;
+ const QString localDir = writableLocation(type);
+ dirs.prepend(localDir);
+ return dirs;
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qstandardpaths_mac.cpp b/src/corelib/io/qstandardpaths_mac.cpp
index 6744bfeab4..0efdfae253 100644
--- a/src/corelib/io/qstandardpaths_mac.cpp
+++ b/src/corelib/io/qstandardpaths_mac.cpp
@@ -58,6 +58,7 @@ OSType translateLocation(QStandardPaths::StandardLocation type)
{
switch (type) {
case QStandardPaths::ConfigLocation:
+ case QStandardPaths::GenericConfigLocation:
return kPreferencesFolderType;
case QStandardPaths::DesktopLocation:
return kDesktopFolderType;
@@ -149,6 +150,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (type == CacheLocation)
appendOrganizationAndApp(path);
return path;
+ case GenericConfigLocation:
case ConfigLocation:
return qttestDir + QLatin1String("/Preferences");
default:
diff --git a/src/corelib/io/qstandardpaths_unix.cpp b/src/corelib/io/qstandardpaths_unix.cpp
index 61e2e03a3d..1b9078f712 100644
--- a/src/corelib/io/qstandardpaths_unix.cpp
+++ b/src/corelib/io/qstandardpaths_unix.cpp
@@ -103,6 +103,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return xdgDataHome;
}
case ConfigLocation:
+ case GenericConfigLocation:
{
// http://standards.freedesktop.org/basedir-spec/latest/
QString xdgConfigHome = QFile::decodeName(qgetenv("XDG_CONFIG_HOME"));
@@ -277,6 +278,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
QStringList dirs;
switch (type) {
case ConfigLocation:
+ case GenericConfigLocation:
{
// http://standards.freedesktop.org/basedir-spec/latest/
const QString xdgConfigDirs = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS"));
diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp
index d4e0779381..6a79c7c00b 100644
--- a/src/corelib/io/qstandardpaths_win.cpp
+++ b/src/corelib/io/qstandardpaths_win.cpp
@@ -99,7 +99,8 @@ QString QStandardPaths::writableLocation(StandardLocation type)
wchar_t path[MAX_PATH];
switch (type) {
- case ConfigLocation: // same as DataLocation, on Windows
+ case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it)
+ case GenericConfigLocation: // same as GenericDataLocation, on Windows
case DataLocation:
case GenericDataLocation:
#if defined Q_OS_WINCE
@@ -111,7 +112,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
if (isTestModeEnabled())
result += QLatin1String("/qttest");
#ifndef QT_BOOTSTRAPPED
- if (type != GenericDataLocation) {
+ if (type != GenericDataLocation && type != GenericConfigLocation) {
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
if (!QCoreApplication::applicationName().isEmpty())
@@ -188,12 +189,13 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
if (SHGetSpecialFolderPath) {
wchar_t path[MAX_PATH];
switch (type) {
- case ConfigLocation: // same as DataLocation, on Windows
+ case ConfigLocation: // same as DataLocation, on Windows (oversight, but too late to fix it)
+ case GenericConfigLocation: // same as GenericDataLocation, on Windows
case DataLocation:
case GenericDataLocation:
if (SHGetSpecialFolderPath(0, path, CSIDL_COMMON_APPDATA, FALSE)) {
QString result = convertCharArray(path);
- if (type != GenericDataLocation) {
+ if (type != GenericDataLocation && type != GenericConfigLocation) {
#ifndef QT_BOOTSTRAPPED
if (!QCoreApplication::organizationName().isEmpty())
result += QLatin1Char('/') + QCoreApplication::organizationName();
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index fe5faa2be7..77aa3c4821 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3586,7 +3586,7 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const
else if (d->fragment != url.d->fragment)
return false;
- if (!(d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask))
+ if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask))
return false;
// Compare paths, after applying path-related options
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index e7edb4365e..602e91ce30 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -51,8 +51,10 @@
#include <QtCore/qglobal.h>
#ifdef Q_OS_MAC
-Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
Q_FORWARD_DECLARE_CF_TYPE(CFURL);
+# ifdef __OBJC__
+Q_FORWARD_DECLARE_OBJC_CLASS(NSURL);
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -84,36 +86,36 @@ public:
inline QUrlTwoFlags &operator^=(E1 f) { i ^= f; return *this; }
inline QUrlTwoFlags &operator^=(E2 f) { i ^= f; return *this; }
- Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return E1(i); }
- Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return E2(i); }
+ Q_DECL_CONSTEXPR inline operator QFlags<E1>() const { return QFlag(i); }
+ Q_DECL_CONSTEXPR inline operator QFlags<E2>() const { return QFlag(i); }
Q_DECL_CONSTEXPR inline operator int() const { return i; }
Q_DECL_CONSTEXPR inline bool operator!() const { return !i; }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(QUrlTwoFlags f) const
- { return QUrlTwoFlags(E1(i | f.i)); }
+ { return QUrlTwoFlags(QFlag(i | f.i)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E1 f) const
- { return QUrlTwoFlags(E1(i | f)); }
+ { return QUrlTwoFlags(QFlag(i | f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator|(E2 f) const
- { return QUrlTwoFlags(E2(i | f)); }
+ { return QUrlTwoFlags(QFlag(i | f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(QUrlTwoFlags f) const
- { return QUrlTwoFlags(E1(i ^ f.i)); }
+ { return QUrlTwoFlags(QFlag(i ^ f.i)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E1 f) const
- { return QUrlTwoFlags(E1(i ^ f)); }
+ { return QUrlTwoFlags(QFlag(i ^ f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator^(E2 f) const
- { return QUrlTwoFlags(E2(i ^ f)); }
+ { return QUrlTwoFlags(QFlag(i ^ f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(int mask) const
- { return QUrlTwoFlags(E1(i & mask)); }
+ { return QUrlTwoFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(uint mask) const
- { return QUrlTwoFlags(E1(i & mask)); }
+ { return QUrlTwoFlags(QFlag(i & mask)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E1 f) const
- { return QUrlTwoFlags(E1(i & f)); }
+ { return QUrlTwoFlags(QFlag(i & f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator&(E2 f) const
- { return QUrlTwoFlags(E2(i & f)); }
+ { return QUrlTwoFlags(QFlag(i & f)); }
Q_DECL_CONSTEXPR inline QUrlTwoFlags operator~() const
- { return QUrlTwoFlags(E1(~i)); }
+ { return QUrlTwoFlags(QFlag(~i)); }
- inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
- inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ Q_DECL_CONSTEXPR inline bool testFlag(E1 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
+ Q_DECL_CONSTEXPR inline bool testFlag(E2 f) const { return (i & f) == f && (f != 0 || i == int(f)); }
};
template<typename E1, typename E2>
@@ -265,8 +267,10 @@ public:
#if defined(Q_OS_MAC) || defined(Q_QDOC)
static QUrl fromCFURL(CFURLRef url);
CFURLRef toCFURL() const Q_DECL_CF_RETURNS_RETAINED;
+# if defined(__OBJC__) || defined(Q_QDOC)
static QUrl fromNSURL(const NSURL *url);
NSURL *toNSURL() const Q_DECL_NS_RETURNS_AUTORELEASED;
+# endif
#endif
#if QT_DEPRECATED_SINCE(5,0)