forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.11'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri Change-Id: I4e339410b17df4098f17e3bb621e1c02e3f8026b
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
set(IDE_VERSION "4.11.82") # The IDE version.
|
set(IDE_VERSION "4.11.82") # The IDE version.
|
||||||
set(IDE_VERSION_COMPAT "4.11.82") # The IDE Compatibility version.
|
set(IDE_VERSION_COMPAT "4.11.82") # The IDE Compatibility version.
|
||||||
set(IDE_VERSION_DISPLAY "4.12.0-beta1") # The IDE display version.
|
set(IDE_VERSION_DISPLAY "4.12.0-beta1") # The IDE display version.
|
||||||
set(IDE_COPYRIGHT_YEAR "2019") # The IDE current copyright year.
|
set(IDE_COPYRIGHT_YEAR "2020") # The IDE current copyright year.
|
||||||
|
|
||||||
set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation.
|
set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation.
|
||||||
set(IDE_COPY_SETTINGSVARIANT "Nokia") # The IDE settings to initially import.
|
set(IDE_COPY_SETTINGSVARIANT "Nokia") # The IDE settings to initially import.
|
||||||
|
@@ -17,7 +17,7 @@ Module {
|
|||||||
property string qtcreator_compat_version: ide_compat_version_major + '.'
|
property string qtcreator_compat_version: ide_compat_version_major + '.'
|
||||||
+ ide_compat_version_minor + '.' + ide_compat_version_release
|
+ ide_compat_version_minor + '.' + ide_compat_version_release
|
||||||
|
|
||||||
property string qtcreator_copyright_year: '2019'
|
property string qtcreator_copyright_year: '2020'
|
||||||
property string qtcreator_copyright_string: "(C) " + qtcreator_copyright_year + " The Qt Company Ltd"
|
property string qtcreator_copyright_string: "(C) " + qtcreator_copyright_year + " The Qt Company Ltd"
|
||||||
|
|
||||||
property string ide_display_name: 'Qt Creator'
|
property string ide_display_name: 'Qt Creator'
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
QTCREATOR_VERSION = 4.11.82
|
QTCREATOR_VERSION = 4.11.82
|
||||||
QTCREATOR_COMPAT_VERSION = 4.11.82
|
QTCREATOR_COMPAT_VERSION = 4.11.82
|
||||||
QTCREATOR_DISPLAY_VERSION = 4.12.0-beta1
|
QTCREATOR_DISPLAY_VERSION = 4.12.0-beta1
|
||||||
QTCREATOR_COPYRIGHT_YEAR = 2019
|
QTCREATOR_COPYRIGHT_YEAR = 2020
|
||||||
BINARY_ARTIFACTS_BRANCH = master
|
BINARY_ARTIFACTS_BRANCH = master
|
||||||
|
|
||||||
IDE_DISPLAY_NAME = Qt Creator
|
IDE_DISPLAY_NAME = Qt Creator
|
||||||
|
@@ -181,7 +181,8 @@ def is_not_debug(path, filenames):
|
|||||||
def codesign(app_path):
|
def codesign(app_path):
|
||||||
signing_identity = os.environ.get('SIGNING_IDENTITY')
|
signing_identity = os.environ.get('SIGNING_IDENTITY')
|
||||||
if is_mac_platform() and signing_identity:
|
if is_mac_platform() and signing_identity:
|
||||||
codesign_call = ['codesign', '--force', '--deep', '-s', signing_identity, '-v']
|
codesign_call = ['codesign', '-o', 'runtime', '--force', '--deep', '-s', signing_identity,
|
||||||
|
'-v']
|
||||||
signing_flags = os.environ.get('SIGNING_FLAGS')
|
signing_flags = os.environ.get('SIGNING_FLAGS')
|
||||||
if signing_flags:
|
if signing_flags:
|
||||||
codesign_call.extend(signing_flags.split())
|
codesign_call.extend(signing_flags.split())
|
||||||
|
@@ -94,13 +94,13 @@ void MimeTypePrivate::addGlobPattern(const QString &pattern)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class MimeType
|
\class MimeType
|
||||||
\inmodule QtCore
|
\inmodule QtCreator
|
||||||
\ingroup shared
|
\ingroup shared
|
||||||
\brief The MimeType class describes types of file or data, represented by a MIME type string.
|
\brief The MimeType class describes types of file or data, represented by a MIME type string.
|
||||||
|
|
||||||
\since 5.0
|
\since 5.0
|
||||||
|
|
||||||
For instance a file named "readme.txt" has the MIME type "text/plain".
|
For instance, a file named \c readme.txt has the MIME type \c text/plain.
|
||||||
The MIME type can be determined from the file name, or from the file
|
The MIME type can be determined from the file name, or from the file
|
||||||
contents, or from both. MIME type determination can also be done on
|
contents, or from both. MIME type determination can also be done on
|
||||||
buffers of data not coming from files.
|
buffers of data not coming from files.
|
||||||
@@ -113,21 +113,10 @@ void MimeTypePrivate::addGlobPattern(const QString &pattern)
|
|||||||
To check if a file has the expected MIME type, you should use inherits()
|
To check if a file has the expected MIME type, you should use inherits()
|
||||||
rather than a simple string comparison based on the name(). This is because
|
rather than a simple string comparison based on the name(). This is because
|
||||||
MIME types can inherit from each other: for instance a C source file is
|
MIME types can inherit from each other: for instance a C source file is
|
||||||
a specific type of plain text file, so text/x-csrc inherits text/plain.
|
a specific type of plain text file, so \c text/x-csrc inherits \c text/plain.
|
||||||
|
|
||||||
\sa MimeDatabase
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn MimeType &MimeType::operator=(MimeType &&other)
|
|
||||||
|
|
||||||
Move-assigns \a other to this MimeType instance.
|
|
||||||
|
|
||||||
\since 5.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn MimeType::MimeType();
|
|
||||||
Constructs this MimeType object initialized with default property values that indicate an invalid MIME type.
|
Constructs this MimeType object initialized with default property values that indicate an invalid MIME type.
|
||||||
*/
|
*/
|
||||||
MimeType::MimeType() :
|
MimeType::MimeType() :
|
||||||
@@ -136,13 +125,11 @@ MimeType::MimeType() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn MimeType::MimeType(const MimeType &other);
|
|
||||||
Constructs this MimeType object as a copy of \a other.
|
Constructs this MimeType object as a copy of \a other.
|
||||||
*/
|
*/
|
||||||
MimeType::MimeType(const MimeType &other) = default;
|
MimeType::MimeType(const MimeType &other) = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn MimeType &MimeType::operator=(const MimeType &other);
|
|
||||||
Assigns the data of \a other to this MimeType object, and returns a reference to this object.
|
Assigns the data of \a other to this MimeType object, and returns a reference to this object.
|
||||||
*/
|
*/
|
||||||
MimeType &MimeType::operator=(const MimeType &other)
|
MimeType &MimeType::operator=(const MimeType &other)
|
||||||
@@ -153,8 +140,7 @@ MimeType &MimeType::operator=(const MimeType &other)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn MimeType::MimeType(const MimeTypePrivate &dd);
|
\fn MimeType::MimeType(const Internal::MimeTypePrivate &dd)
|
||||||
Assigns the data of the MimeTypePrivate \a dd to this MimeType object, and returns a reference to this object.
|
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
MimeType::MimeType(const MimeTypePrivate &dd) :
|
MimeType::MimeType(const MimeTypePrivate &dd) :
|
||||||
@@ -163,28 +149,14 @@ MimeType::MimeType(const MimeTypePrivate &dd) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn void MimeType::swap(MimeType &other);
|
|
||||||
Swaps MimeType \a other with this MimeType object.
|
|
||||||
|
|
||||||
This operation is very fast and never fails.
|
|
||||||
|
|
||||||
The swap() method helps with the implementation of assignment
|
|
||||||
operators in an exception-safe way. For more information consult
|
|
||||||
\l {http://en.wikibooks.org/wiki/More_C++_Idioms/Copy-and-swap}
|
|
||||||
{More C++ Idioms - Copy-and-swap}.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn MimeType::~MimeType();
|
|
||||||
Destroys the MimeType object, and releases the d pointer.
|
Destroys the MimeType object, and releases the d pointer.
|
||||||
*/
|
*/
|
||||||
MimeType::~MimeType() = default;
|
MimeType::~MimeType() = default;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool MimeType::operator==(const MimeType &other) const;
|
|
||||||
Returns \c true if \a other equals this MimeType object, otherwise returns \c false.
|
Returns \c true if \a other equals this MimeType object, otherwise returns \c false.
|
||||||
The name is the unique identifier for a mimetype, so two mimetypes with
|
The name is the unique identifier for a MIME type, so two MIME types with
|
||||||
the same name, are equal.
|
the same name are equal.
|
||||||
*/
|
*/
|
||||||
bool MimeType::operator==(const MimeType &other) const
|
bool MimeType::operator==(const MimeType &other) const
|
||||||
{
|
{
|
||||||
@@ -197,7 +169,11 @@ bool MimeType::operator==(const MimeType &other) const
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool MimeType::isValid() const;
|
\fn inline uint Utils::qHash(const MimeType &mime)
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
Returns \c true if the MimeType object contains valid data, otherwise returns \c false.
|
Returns \c true if the MimeType object contains valid data, otherwise returns \c false.
|
||||||
A valid MIME type has a non-empty name().
|
A valid MIME type has a non-empty name().
|
||||||
The invalid MIME type is the default-constructed MimeType.
|
The invalid MIME type is the default-constructed MimeType.
|
||||||
@@ -208,9 +184,8 @@ bool MimeType::isValid() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool MimeType::isDefault() const;
|
|
||||||
Returns \c true if this MIME type is the default MIME type which
|
Returns \c true if this MIME type is the default MIME type which
|
||||||
applies to all files: application/octet-stream.
|
applies to all files: \c application/octet-stream.
|
||||||
*/
|
*/
|
||||||
bool MimeType::isDefault() const
|
bool MimeType::isDefault() const
|
||||||
{
|
{
|
||||||
@@ -218,7 +193,6 @@ bool MimeType::isDefault() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QString MimeType::name() const;
|
|
||||||
Returns the name of the MIME type.
|
Returns the name of the MIME type.
|
||||||
*/
|
*/
|
||||||
QString MimeType::name() const
|
QString MimeType::name() const
|
||||||
@@ -258,7 +232,6 @@ QString MimeType::comment() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QString MimeType::genericIconName() const;
|
|
||||||
Returns the file name of a generic icon that represents the MIME type.
|
Returns the file name of a generic icon that represents the MIME type.
|
||||||
|
|
||||||
This should be used if the icon returned by iconName() cannot be found on
|
This should be used if the icon returned by iconName() cannot be found on
|
||||||
@@ -287,7 +260,6 @@ QString MimeType::genericIconName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QString MimeType::iconName() const;
|
|
||||||
Returns the file name of an icon image that represents the MIME type.
|
Returns the file name of an icon image that represents the MIME type.
|
||||||
|
|
||||||
The icon name can be given to QIcon::fromTheme() in order to load the icon.
|
The icon name can be given to QIcon::fromTheme() in order to load the icon.
|
||||||
@@ -306,7 +278,6 @@ QString MimeType::iconName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QStringList MimeType::globPatterns() const;
|
|
||||||
Returns the list of glob matching patterns.
|
Returns the list of glob matching patterns.
|
||||||
*/
|
*/
|
||||||
QStringList MimeType::globPatterns() const
|
QStringList MimeType::globPatterns() const
|
||||||
@@ -317,14 +288,17 @@ QStringList MimeType::globPatterns() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
A type is a subclass of another type if any instance of the first type is
|
A type is a subclass of another type if any instance of the first type is
|
||||||
also an instance of the second. For example, all image/svg+xml files are also
|
also an instance of the second. For example, all \c image/svg+xml files are
|
||||||
text/xml, text/plain and application/octet-stream files. Subclassing is about
|
also \c text/xml, \c text/plain and \c application/octet-stream files.
|
||||||
the format, rather than the category of the data (for example, there is no
|
|
||||||
'generic spreadsheet' class that all spreadsheets inherit from).
|
|
||||||
Conversely, the parent mimetype of image/svg+xml is text/xml.
|
|
||||||
|
|
||||||
A mimetype can have multiple parents. For instance application/x-perl
|
Subclassing is about the format, rather than the category of the data.
|
||||||
has two parents: application/x-executable and text/plain. This makes
|
For example, there is no \e {generic spreadsheet} class that all
|
||||||
|
spreadsheets inherit from.
|
||||||
|
|
||||||
|
Conversely, the parent MIME type of \c image/svg+xml is \c text/xml.
|
||||||
|
|
||||||
|
A MIME type can have multiple parents. For instance, \c application/x-perl
|
||||||
|
has two parents: \c application/x-executable and \c text/plain. This makes
|
||||||
it possible to both execute perl scripts, and to open them in text editors.
|
it possible to both execute perl scripts, and to open them in text editors.
|
||||||
*/
|
*/
|
||||||
QStringList MimeType::parentMimeTypes() const
|
QStringList MimeType::parentMimeTypes() const
|
||||||
@@ -348,13 +322,13 @@ static void collectParentMimeTypes(const QString &mime, QStringList &allParents)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return all the parent mimetypes of this mimetype, direct and indirect.
|
Returns all the parent MIME types of this type, direct and indirect.
|
||||||
This includes the parent(s) of its parent(s), etc.
|
This includes grandparents, and so on.
|
||||||
|
|
||||||
For instance, for image/svg+xml the list would be:
|
For instance, for \c image/svg+xml the list would be:
|
||||||
application/xml, text/plain, application/octet-stream.
|
\c application/xml, \c text/plain, \c application/octet-stream.
|
||||||
|
|
||||||
Note that application/octet-stream is the ultimate parent for all types
|
\note The \c application/octet-stream type is the ultimate parent for all types
|
||||||
of files (but not directories).
|
of files (but not directories).
|
||||||
*/
|
*/
|
||||||
QStringList MimeType::allAncestors() const
|
QStringList MimeType::allAncestors() const
|
||||||
@@ -365,12 +339,12 @@ QStringList MimeType::allAncestors() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Return the list of aliases of this mimetype.
|
Returns the list of aliases of this MIME type.
|
||||||
|
|
||||||
For instance, for text/csv, the returned list would be:
|
For instance, for \c text/csv, the returned list would be:
|
||||||
text/x-csv, text/x-comma-separated-values.
|
\c text/x-csv, \c text/x-comma-separated-values.
|
||||||
|
|
||||||
Note that all MimeType instances refer to proper mimetypes,
|
\note All MimeType instances refer to proper MIME types,
|
||||||
never to aliases directly.
|
never to aliases directly.
|
||||||
|
|
||||||
The order of the aliases in the list is undefined.
|
The order of the aliases in the list is undefined.
|
||||||
@@ -382,7 +356,8 @@ QStringList MimeType::aliases() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the known suffixes for the MIME type.
|
Returns the known suffixes for the MIME type.
|
||||||
No leading dot is included, so for instance this would return "jpg", "jpeg" for image/jpeg.
|
No leading dot is included, so for instance this would return
|
||||||
|
\c {"jpg", "jpeg"} for \c image/jpeg.
|
||||||
*/
|
*/
|
||||||
QStringList MimeType::suffixes() const
|
QStringList MimeType::suffixes() const
|
||||||
{
|
{
|
||||||
@@ -400,8 +375,9 @@ QStringList MimeType::suffixes() const
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the preferred suffix for the MIME type.
|
Returns the preferred suffix for the MIME type.
|
||||||
No leading dot is included, so for instance this would return "pdf" for application/pdf.
|
No leading dot is included, so for instance this would return \c "pdf" for
|
||||||
The return value can be empty, for mime types which do not have any suffixes associated.
|
\c application/pdf. The return value can be empty, for MIME types which do
|
||||||
|
not have any suffixes associated.
|
||||||
*/
|
*/
|
||||||
QString MimeType::preferredSuffix() const
|
QString MimeType::preferredSuffix() const
|
||||||
{
|
{
|
||||||
@@ -410,7 +386,6 @@ QString MimeType::preferredSuffix() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QString MimeType::filterString() const;
|
|
||||||
Returns a filter string usable for a file dialog.
|
Returns a filter string usable for a file dialog.
|
||||||
*/
|
*/
|
||||||
QString MimeType::filterString() const
|
QString MimeType::filterString() const
|
||||||
@@ -431,6 +406,10 @@ QString MimeType::filterString() const
|
|||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns \c true if the name or alias of the MIME type matches
|
||||||
|
\a nameOrAlias.
|
||||||
|
*/
|
||||||
bool MimeType::matchesName(const QString &nameOrAlias) const
|
bool MimeType::matchesName(const QString &nameOrAlias) const
|
||||||
{
|
{
|
||||||
if (d->name == nameOrAlias)
|
if (d->name == nameOrAlias)
|
||||||
@@ -438,6 +417,9 @@ bool MimeType::matchesName(const QString &nameOrAlias) const
|
|||||||
return MimeDatabasePrivate::instance()->provider()->resolveAlias(nameOrAlias) == d->name;
|
return MimeDatabasePrivate::instance()->provider()->resolveAlias(nameOrAlias) == d->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets the preferred filename suffix for the MIME type to \a suffix.
|
||||||
|
*/
|
||||||
void MimeType::setPreferredSuffix(const QString &suffix)
|
void MimeType::setPreferredSuffix(const QString &suffix)
|
||||||
{
|
{
|
||||||
MimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
|
MimeDatabasePrivate::instance()->provider()->loadMimeTypePrivate(*d);
|
||||||
@@ -452,10 +434,10 @@ void MimeType::setPreferredSuffix(const QString &suffix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool MimeType::inherits(const QString &mimeTypeName) const;
|
Returns \c true if this MIME type is \a mimeTypeName or inherits it,
|
||||||
Returns \c true if this mimetype is \a mimeTypeName,
|
or if \a mimeTypeName is an alias for this mimetype.
|
||||||
or inherits \a mimeTypeName (see parentMimeTypes()),
|
|
||||||
or \a mimeTypeName is an alias for this mimetype.
|
\sa parentMimeTypes()
|
||||||
*/
|
*/
|
||||||
bool MimeType::inherits(const QString &mimeTypeName) const
|
bool MimeType::inherits(const QString &mimeTypeName) const
|
||||||
{
|
{
|
||||||
|
@@ -34,9 +34,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class Utils::NetworkManager
|
\class Utils::NetworkAccessManager
|
||||||
|
\inmodule QtCreator
|
||||||
|
|
||||||
\brief The NetworkManager class provides a network access manager for use
|
\brief The NetworkAccessManager class provides a network access manager for use
|
||||||
with \QC.
|
with \QC.
|
||||||
|
|
||||||
Common initialization, \QC User Agent.
|
Common initialization, \QC User Agent.
|
||||||
@@ -55,6 +56,10 @@ void cleanupNetworkAccessManager()
|
|||||||
namInstance = nullptr;
|
namInstance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns a network access manager instance that should be used for the main
|
||||||
|
thread.
|
||||||
|
*/
|
||||||
NetworkAccessManager *NetworkAccessManager::instance()
|
NetworkAccessManager *NetworkAccessManager::instance()
|
||||||
{
|
{
|
||||||
if (!namInstance) {
|
if (!namInstance) {
|
||||||
@@ -64,12 +69,19 @@ NetworkAccessManager *NetworkAccessManager::instance()
|
|||||||
return namInstance;
|
return namInstance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Constructs a network access manager instance with the parent \a parent.
|
||||||
|
*/
|
||||||
NetworkAccessManager::NetworkAccessManager(QObject *parent)
|
NetworkAccessManager::NetworkAccessManager(QObject *parent)
|
||||||
: QNetworkAccessManager(parent)
|
: QNetworkAccessManager(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Creates \a request for the network access manager to perform the operation
|
||||||
|
\a op on \a outgoingData.
|
||||||
|
*/
|
||||||
QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
QNetworkReply* NetworkAccessManager::createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData)
|
||||||
{
|
{
|
||||||
QString agentStr = QString::fromLatin1("%1/%2 (QNetworkAccessManager %3; %4; %5; %6 bit)")
|
QString agentStr = QString::fromLatin1("%1/%2 (QNetworkAccessManager %3; %4; %5; %6 bit)")
|
||||||
|
@@ -45,27 +45,7 @@ static Q_LOGGING_CATEGORY(qrcParserLog, "qtc.qrcParser", QtWarningMsg)
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
/*!
|
|
||||||
* \class QrcParser
|
|
||||||
* \brief Parses one or more qrc files, and keeps their content cached
|
|
||||||
*
|
|
||||||
* A Qrc resource contains files read from the filesystem but organized in a possibly different way.
|
|
||||||
*
|
|
||||||
* To easily describe that with a simple structure we use a map from qrc paths to the paths in the
|
|
||||||
* filesystem.
|
|
||||||
* By using a map we can easily find all qrc paths that start with a given prefix, and thus loop
|
|
||||||
* on a qrc directory.
|
|
||||||
*
|
|
||||||
* Qrc files also support languages, those are mapped to a prefix of the qrc path.
|
|
||||||
* For example the french /image/bla.png (lang=fr) will have the path "fr/image/bla.png".
|
|
||||||
* The empty language represent the default resource.
|
|
||||||
* Languages are looked up using the locale uiLanguages() property
|
|
||||||
*
|
|
||||||
* For a single qrc a given path maps to a single file, but when one has multiple
|
|
||||||
* (platform specific exclusive) qrc files, then multiple files match, so QStringList are used.
|
|
||||||
*
|
|
||||||
* Especially the collect* functions are thought as low level interface.
|
|
||||||
*/
|
|
||||||
class QrcParserPrivate
|
class QrcParserPrivate
|
||||||
{
|
{
|
||||||
Q_DECLARE_TR_FUNCTIONS(QmlJS::QrcParser)
|
Q_DECLARE_TR_FUNCTIONS(QmlJS::QrcParser)
|
||||||
@@ -109,8 +89,44 @@ private:
|
|||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
/*! \brief normalizes the path to a file in a qrc resource by dropping the "qrc:/" or ":" and
|
/*!
|
||||||
* any extra slashes at the beginning
|
\class Utils::QrcParser
|
||||||
|
\inmodule QtCreator
|
||||||
|
\brief The QrcParser class parses one or more QRC files and keeps their
|
||||||
|
content cached.
|
||||||
|
|
||||||
|
A \l{The Qt Resource System}{Qt resource collection (QRC)} contains files
|
||||||
|
read from the file system but organized in a possibly different way.
|
||||||
|
To easily describe that with a simple structure, we use a map from QRC paths
|
||||||
|
to the paths in the filesystem.
|
||||||
|
By using a map, we can easily find all QRC paths that start with a given
|
||||||
|
prefix, and thus loop on a QRC directory.
|
||||||
|
|
||||||
|
QRC files also support languages, which are mapped to a prefix of the QRC
|
||||||
|
path. For example, the French /image/bla.png (lang=fr) will have the path
|
||||||
|
\c {fr/image/bla.png}. The empty language represents the default resource.
|
||||||
|
Languages are looked up using the locale uiLanguages() property
|
||||||
|
|
||||||
|
For a single QRC, a given path maps to a single file, but when one has
|
||||||
|
multiple (platform-specific and mutually exclusive) QRC files, multiple
|
||||||
|
files match, so QStringList are used.
|
||||||
|
|
||||||
|
Especially, the \c collect* functions are thought of as low level interface.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\typedef QrcParser::Ptr
|
||||||
|
Represents pointers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\typedef QrcParser::ConstPtr
|
||||||
|
Represents constant pointers.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Normalizes the \a path to a file in a QRC resource by dropping the \c qrc:/
|
||||||
|
or \c : and any extra slashes in the beginning.
|
||||||
*/
|
*/
|
||||||
QString QrcParser::normalizedQrcFilePath(const QString &path) {
|
QString QrcParser::normalizedQrcFilePath(const QString &path) {
|
||||||
QString normPath = path;
|
QString normPath = path;
|
||||||
@@ -128,8 +144,10 @@ QString QrcParser::normalizedQrcFilePath(const QString &path) {
|
|||||||
return normPath;
|
return normPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief normalizes the path to a directory in a qrc resource by dropping the "qrc:/" or ":" and
|
/*!
|
||||||
* any extra slashes at the beginning, and ensuring it ends with a slash
|
Returns the path to a directory normalized to \a path in a QRC resource by
|
||||||
|
dropping the \c qrc:/ or \c : and any extra slashes at the beginning, and
|
||||||
|
by ensuring that the path ends with a slash
|
||||||
*/
|
*/
|
||||||
QString QrcParser::normalizedQrcDirectoryPath(const QString &path) {
|
QString QrcParser::normalizedQrcDirectoryPath(const QString &path) {
|
||||||
QString normPath = normalizedQrcFilePath(path);
|
QString normPath = normalizedQrcFilePath(path);
|
||||||
@@ -138,6 +156,9 @@ QString QrcParser::normalizedQrcDirectoryPath(const QString &path) {
|
|||||||
return normPath;
|
return normPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the QRC directory path for \a file.
|
||||||
|
*/
|
||||||
QString QrcParser::qrcDirectoryPathForQrcFilePath(const QString &file)
|
QString QrcParser::qrcDirectoryPathForQrcFilePath(const QString &file)
|
||||||
{
|
{
|
||||||
return file.left(file.lastIndexOf(QLatin1Char('/')));
|
return file.left(file.lastIndexOf(QLatin1Char('/')));
|
||||||
@@ -148,45 +169,61 @@ QrcParser::QrcParser()
|
|||||||
d = new Internal::QrcParserPrivate(this);
|
d = new Internal::QrcParserPrivate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Destructs the QRC parser.
|
||||||
|
*/
|
||||||
QrcParser::~QrcParser()
|
QrcParser::~QrcParser()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the \a contents of the file at \a path.
|
||||||
|
*/
|
||||||
bool QrcParser::parseFile(const QString &path, const QString &contents)
|
bool QrcParser::parseFile(const QString &path, const QString &contents)
|
||||||
{
|
{
|
||||||
return d->parseFile(path, contents);
|
return d->parseFile(path, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief returns fs path of the first (active) file at the given qrc path
|
/*!
|
||||||
|
Returns the file system path of the first (active) file at the given QRC
|
||||||
|
\a path and \a locale.
|
||||||
*/
|
*/
|
||||||
QString QrcParser::firstFileAtPath(const QString &path, const QLocale &locale) const
|
QString QrcParser::firstFileAtPath(const QString &path, const QLocale &locale) const
|
||||||
{
|
{
|
||||||
return d->firstFileAtPath(path, locale);
|
return d->firstFileAtPath(path, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief adds al the fs paths for the given qrc path to *res
|
/*!
|
||||||
* If locale is null all possible files are added, otherwise just the first match
|
Adds the file system paths for the given QRC \a path to \a res.
|
||||||
* using that locale.
|
|
||||||
|
If \a locale is null, all possible files are added. Otherwise, just
|
||||||
|
the first one that matches the locale is added.
|
||||||
*/
|
*/
|
||||||
void QrcParser::collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale) const
|
void QrcParser::collectFilesAtPath(const QString &path, QStringList *res, const QLocale *locale) const
|
||||||
{
|
{
|
||||||
d->collectFilesAtPath(path, res, locale);
|
d->collectFilesAtPath(path, res, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief returns true if the given path is a non empty directory
|
/*!
|
||||||
|
Returns \c true if \a path is a non-empty directory and matches \a locale.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
bool QrcParser::hasDirAtPath(const QString &path, const QLocale *locale) const
|
bool QrcParser::hasDirAtPath(const QString &path, const QLocale *locale) const
|
||||||
{
|
{
|
||||||
return d->hasDirAtPath(path, locale);
|
return d->hasDirAtPath(path, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief adds the directory contents of the given qrc path to res
|
/*!
|
||||||
*
|
Adds the directory contents of the given QRC \a path to \a res if \a addDirs
|
||||||
* adds the qrcFileName => fs paths associations contained in the given qrc path
|
is set to \c true.
|
||||||
* to res. If addDirs is true directories are also added.
|
|
||||||
* If locale is null all possible files are added, otherwise just the first match
|
Adds the QRC filename to file system path associations contained in the
|
||||||
* using that locale.
|
given \a path to \a res. If addDirs() is \c true, directories are also
|
||||||
|
added.
|
||||||
|
|
||||||
|
If \a locale is null, all possible files are added. Otherwise, just the
|
||||||
|
first file with a matching the locale is added.
|
||||||
*/
|
*/
|
||||||
void QrcParser::collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs,
|
void QrcParser::collectFilesInPath(const QString &path, QMap<QString,QStringList> *res, bool addDirs,
|
||||||
const QLocale *locale) const
|
const QLocale *locale) const
|
||||||
@@ -194,33 +231,47 @@ void QrcParser::collectFilesInPath(const QString &path, QMap<QString,QStringList
|
|||||||
d->collectFilesInPath(path, res, addDirs, locale);
|
d->collectFilesInPath(path, res, addDirs, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Adds the resource files from the QRC file \a sourceFile to \a res.
|
||||||
|
|
||||||
|
If \a locale is null, all possible files are added. Otherwise, just
|
||||||
|
the first file with a matching the locale is added.
|
||||||
|
*/
|
||||||
void QrcParser::collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *res,
|
void QrcParser::collectResourceFilesForSourceFile(const QString &sourceFile, QStringList *res,
|
||||||
const QLocale *locale) const
|
const QLocale *locale) const
|
||||||
{
|
{
|
||||||
d->collectResourceFilesForSourceFile(sourceFile, res, locale);
|
d->collectResourceFilesForSourceFile(sourceFile, res, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief returns the errors found while parsing
|
/*!
|
||||||
|
Returns the errors found while parsing.
|
||||||
*/
|
*/
|
||||||
QStringList QrcParser::errorMessages() const
|
QStringList QrcParser::errorMessages() const
|
||||||
{
|
{
|
||||||
return d->errorMessages();
|
return d->errorMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief returns all languages used in this qrc resource
|
/*!
|
||||||
|
Returns all languages used in this QRC.
|
||||||
*/
|
*/
|
||||||
QStringList QrcParser::languages() const
|
QStringList QrcParser::languages() const
|
||||||
{
|
{
|
||||||
return d->languages();
|
return d->languages();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief if the contents are valid
|
/*!
|
||||||
|
Indicates whether the QRC contents are valid.
|
||||||
|
|
||||||
|
Returns an error if the QRC is empty.
|
||||||
*/
|
*/
|
||||||
bool QrcParser::isValid() const
|
bool QrcParser::isValid() const
|
||||||
{
|
{
|
||||||
return errorMessages().isEmpty();
|
return errorMessages().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the \a contents of the QRC file at \a path.
|
||||||
|
*/
|
||||||
QrcParser::Ptr QrcParser::parseQrcFile(const QString &path, const QString &contents)
|
QrcParser::Ptr QrcParser::parseQrcFile(const QString &path, const QString &contents)
|
||||||
{
|
{
|
||||||
Ptr res(new QrcParser);
|
Ptr res(new QrcParser);
|
||||||
@@ -231,36 +282,62 @@ QrcParser::Ptr QrcParser::parseQrcFile(const QString &path, const QString &conte
|
|||||||
|
|
||||||
// ----------------
|
// ----------------
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class Utils::QrcCache
|
||||||
|
\inmodule QtCreator
|
||||||
|
\brief The QrcCache class caches the contents of parsed QRC files.
|
||||||
|
|
||||||
|
\sa Utils::QrcParser
|
||||||
|
*/
|
||||||
|
|
||||||
QrcCache::QrcCache()
|
QrcCache::QrcCache()
|
||||||
{
|
{
|
||||||
d = new Internal::QrcCachePrivate(this);
|
d = new Internal::QrcCachePrivate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
QrcCache::~QrcCache()
|
QrcCache::~QrcCache()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the \a contents of a file at \a path.
|
||||||
|
*/
|
||||||
QrcParser::ConstPtr QrcCache::addPath(const QString &path, const QString &contents)
|
QrcParser::ConstPtr QrcCache::addPath(const QString &path, const QString &contents)
|
||||||
{
|
{
|
||||||
return d->addPath(path, contents);
|
return d->addPath(path, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Removes \a path from the cache.
|
||||||
|
*/
|
||||||
void QrcCache::removePath(const QString &path)
|
void QrcCache::removePath(const QString &path)
|
||||||
{
|
{
|
||||||
d->removePath(path);
|
d->removePath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns updates to the \a contents of a file at \a path.
|
||||||
|
*/
|
||||||
QrcParser::ConstPtr QrcCache::updatePath(const QString &path, const QString &contents)
|
QrcParser::ConstPtr QrcCache::updatePath(const QString &path, const QString &contents)
|
||||||
{
|
{
|
||||||
return d->updatePath(path, contents);
|
return d->updatePath(path, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Returns the parsed \a path.
|
||||||
|
*/
|
||||||
QrcParser::ConstPtr QrcCache::parsedPath(const QString &path)
|
QrcParser::ConstPtr QrcCache::parsedPath(const QString &path)
|
||||||
{
|
{
|
||||||
return d->parsedPath(path);
|
return d->parsedPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Clears the contents of the cache.
|
||||||
|
*/
|
||||||
void QrcCache::clear()
|
void QrcCache::clear()
|
||||||
{
|
{
|
||||||
d->clear();
|
d->clear();
|
||||||
|
Reference in New Issue
Block a user