# components and tools that will be build, changed depending on the requirements availability
set(KATIE_COMPONENTS "Core Gui Declarative Network Svg Xml Script ScriptTools Test UiTools")
-set(KATIE_TOOLS "moc uic rcc qscript qtconfig")
+set(KATIE_TOOLS "moc uic qscript qtconfig")
set(KATIE_HEADERS_PATH "${CMAKE_INSTALL_FULL_INCLUDEDIR}/katie" CACHE PATH "Headers installation path")
set(KATIE_LIBRARIES_PATH "${CMAKE_INSTALL_FULL_LIBDIR}" CACHE PATH "Libraries installation path")
set(KATIE_APPLICATIONS_PATH "${CMAKE_INSTALL_FULL_DATADIR}/applications" CACHE PATH "Desktop applications register installation path")
set(KATIE_PIXMAPS_PATH "${CMAKE_INSTALL_FULL_DATADIR}/pixmaps" CACHE PATH "Desktop applications icon installation path")
set(KATIE_PKGCONFIG_PATH "${KATIE_LIBRARIES_PATH}/pkgconfig" CACHE PATH "pkg-config installation path")
-set(KATIE_TOOLS_SUFFIX "" CACHE STRING "Tools (moc, uic, rcc, etc.) suffix")
+set(KATIE_TOOLS_SUFFIX "" CACHE STRING "Tools (moc, uic, etc.) suffix")
# bundled packages
option(WITH_DEFLATE "Build with external libdeflate" ON)
- Jansson, Freetype, ICU, X11 and libpng are required for building
- D-Bus and CUPS must be linked to during build
- QtUiTools is build as shared library by default
- - moc, uic, rcc, etc. are linked to components
+ - moc, uic, etc. are linked to components
- updated bundled Harfbuzz from upstream (not Harfbuzz-NG)
- versioned and extended classes have been merged into the base class,
e.g. QIconEngineV2 into QIconEngine and QKeyEventEx into QKeyEvent
endmacro()
# a function to create an array of source files for a target setting up proper
-# dependency for the moc/uic/rcc generated resources
+# dependency for the moc/uic generated resources
function(KATIE_SETUP_TARGET FORTARGET)
get_directory_property(dirdefs COMPILE_DEFINITIONS)
get_directory_property(dirincs INCLUDE_DIRECTORIES)
OUTPUT "${rscout}"
)
set_property(SOURCE "${fileabs}" APPEND PROPERTY OBJECT_DEPENDS "${rscout}")
- elseif("${fileext}" STREQUAL ".qrc")
- set(rscout "${rscpath}/qrc_${filename}.cpp")
- make_directory("${rscpath}")
- include_directories("${rscpath}")
- add_custom_command(
- COMMAND "${CMAKE_BINARY_DIR}/exec.sh" "${CMAKE_BINARY_DIR}/bin/rcc${KATIE_TOOLS_SUFFIX}" "${fileabs}" -o "${rscout}" -name "${filename}"
- DEPENDS "rcc"
- OUTPUT "${rscout}"
- )
- set_property(SOURCE "${fileabs}" APPEND PROPERTY OBJECT_DEPENDS "${rscout}")
elseif("${fileext}" MATCHES "(.c|.h|.hpp|.cc|.cpp)")
file(READ "${fileabs}" rsccontent)
if("${rsccontent}" MATCHES "(Q_OBJECT|Q_OBJECT_FAKE|Q_GADGET)")
include/katie/QtCore/QRect
include/katie/QtCore/QRectF
include/katie/QtCore/QRegExp
-include/katie/QtCore/QResource
include/katie/QtCore/QReturnArgument
include/katie/QtCore/QRunnable
include/katie/QtCore/QScopedPointer
include/katie/QtCore/qqueue.h
include/katie/QtCore/qrect.h
include/katie/QtCore/qregexp.h
-include/katie/QtCore/qresource.h
include/katie/QtCore/qrunnable.h
include/katie/QtCore/qscopedpointer.h
include/katie/QtCore/qscopedvaluerollback.h
"QRegExpValidator",
"QRegion",
"QResizeEvent",
- "QResource",
"QReturnArgument",
"QRgb",
"QRubberBand",
QFile
QCache
QAbstractEventDispatcher
- QResource
QRunnable
QTimeLine
QTextCodec
${CMAKE_CURRENT_SOURCE_DIR}/io/qprocess_p.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qtextstream.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qtemporaryfile.h
- ${CMAKE_CURRENT_SOURCE_DIR}/io/qresource.h
- ${CMAKE_CURRENT_SOURCE_DIR}/io/qresource_p.h
- ${CMAKE_CURRENT_SOURCE_DIR}/io/qresource_iterator_p.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qurl.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qtldurl_p.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qsettings.h
${CMAKE_CURRENT_SOURCE_DIR}/io/qprocess.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/qtextstream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/qtemporaryfile.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/io/qresource.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/io/qresource_iterator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/qurl.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/qsettings.cpp
${CMAKE_CURRENT_SOURCE_DIR}/io/qstandardpaths.cpp
typedef qint64 qlonglong;
typedef quint64 qulonglong;
-#define Q_INIT_RESOURCE(name) \
- extern int qInitResources_ ## name (); \
- qInitResources_ ## name ();
-#define Q_CLEANUP_RESOURCE(name) \
- extern int qCleanupResources_ ## name (); \
- qCleanupResources_ ## name ();
-
/*
Useful type definitions for Qt
*/
#include "qabstractfileengine_p.h"
#include "qdatetime.h"
#include "qvariant.h"
+#include "qfilesystementry_p.h"
+#include "qfilesystemengine_p.h"
// built-in handlers
#include "qfsfileengine.h"
#include "qdiriterator.h"
-#ifndef QT_BOOTSTRAPPED
-# include "qresource_p.h"
-#endif
-
-#include "qfilesystementry_p.h"
-#include "qfilesystemengine_p.h"
QT_BEGIN_NAMESPACE
*/
QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
{
-#ifndef QT_BOOTSTRAPPED
- // check if a resource file is being handled
- if(fileName.startsWith(":/"))
- return new QResourceFileEngine(fileName);
-#endif
#ifndef QT_NO_FSFILEENGINE
// fall back to regular file engine
return new QFSFileEngine(fileName);
return ret;
}
-/*!
- \macro void Q_INIT_RESOURCE(name)
- \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.
-
- For example, if your application's resources are listed in a file
- called \c myapp.qrc, you can ensure that the resources are
- initialized at startup by adding this line to your \c main()
- function:
-
- \snippet doc/src/snippets/code/src_corelib_io_qdir.cpp 13
-
- If the file name contains characters that cannot be part of a valid C++ function name
- (such as '-'), they have to be replaced by the underscore character ('_').
-
- Note: This macro cannot be used in a namespace. It should be called from
- main(). If that is not possible, the following workaround can be used
- to init the resource \c myapp from the function \c{MyNamespace::myFunction}:
-
- \snippet doc/src/snippets/code/src_corelib_io_qdir.cpp 14
-
- \sa Q_CLEANUP_RESOURCE(), {The Qt Resource System}
-*/
-
-/*!
- \since 4.1
- \macro void Q_CLEANUP_RESOURCE(name)
- \relates QDir
-
- Unloads the resources specified by the \c .qrc file with the base
- name \a name.
-
- Normally, Qt resources are unloaded automatically when the
- application terminates, but if the resources are located in a
- plugin that is being unloaded, call Q_CLEANUP_RESOURCE() to force
- removal of your resources.
-
- Note: This macro cannot be used in a namespace. Please see the
- Q_INIT_RESOURCE documentation for a workaround.
-
- Example:
-
- \snippet doc/src/snippets/code/src_corelib_io_qdir.cpp 15
-
- \sa Q_INIT_RESOURCE(), {The Qt Resource System}
-*/
-
-
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug debug, QDir::Filters filters)
{
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtCore module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qresource.h"
-#include "qresource_p.h"
-#include "qresource_iterator_p.h"
-#include "qset.h"
-#include "qhash.h"
-#include "qmutex.h"
-#include "qdebug.h"
-#include "qlocale.h"
-#include "qvector.h"
-#include "qdatetime.h"
-#include "qbytearray.h"
-#include "qstringlist.h"
-#include "qshareddata.h"
-#include "qplatformdefs.h"
-#include "qabstractfileengine_p.h"
-#include "qfilesystemmetadata_p.h"
-#include "qcore_unix_p.h"
-#include "qstdcontainers_p.h"
-
-//#define DEBUG_RESOURCE_MATCH
-
-QT_BEGIN_NAMESPACE
-
-
-class QStringSplitter
-{
-public:
- QStringSplitter(const QString &s)
- : m_string(s), m_pos(0), m_splitChar(QLatin1Char('/'))
- {
- }
-
- inline bool hasNext() {
- while (m_pos < m_string.length() && m_string[m_pos] == m_splitChar)
- ++m_pos;
- return m_pos < m_string.length();
- }
-
- inline QStringRef next() {
- int start = m_pos;
- while (m_pos < m_string.length() && m_string[m_pos] != m_splitChar)
- ++m_pos;
- return QStringRef(&m_string, start, m_pos - start);
- }
-
- QString m_string;
- int m_pos;
- const QChar m_splitChar;
-};
-
-
-//resource glue
-class QResourceRoot
-{
- enum Flags
- {
- Directory = 0x01
- };
- const uchar *tree, *names, *payloads;
- inline int findOffset(int node) const { return node * 14; } //sizeof each tree element
- int hash(int node) const;
- QString name(int node) const;
- short flags(int node) const;
-public:
- mutable QAtomicInt ref;
-
- inline QResourceRoot(): tree(nullptr), names(nullptr), payloads(nullptr) {}
- inline QResourceRoot(const uchar *t, const uchar *n, const uchar *d) { setSource(t, n, d); }
- virtual ~QResourceRoot() { }
- int findNode(const QString &path, const QLocale &locale=QLocale()) const;
- inline bool isContainer(int node) const { return flags(node) & Directory; }
- const uchar *data(int node, qint64 *size) const;
- QStringList children(int node) const;
- virtual QString mappingRoot() const { return QString(); }
- bool mappingRootSubdir(const QString &path, QString *match=nullptr) const;
- inline bool operator==(const QResourceRoot &other) const
- { return tree == other.tree && names == other.names && payloads == other.payloads; }
- inline bool operator!=(const QResourceRoot &other) const
- { return !operator==(other); }
- enum ResourceRootType { Resource_Builtin, Resource_Buffer };
- virtual ResourceRootType type() const { return Resource_Builtin; }
-
-protected:
- inline void setSource(const uchar *t, const uchar *n, const uchar *d) {
- tree = t;
- names = n;
- payloads = d;
- }
-};
-
-static std::recursive_mutex qGlobalResourceMutex;
-
-typedef QStdVector<QResourceRoot*> ResourceList;
-Q_GLOBAL_STATIC(ResourceList, qGlobalResourceList)
-
-/*!
- \class QResource
- \brief The QResource class provides an interface for reading directly from resources.
-
- \ingroup io
-
- \reentrant
- \since 4.2
-
- QResource is an object that represents a set of data (and possibly
- children) relating to a single resource entity. QResource gives direct
- access to the bytes in their raw format. In this way direct access
- allows reading data without buffer copying or indirection. Indirection
- is often useful when interacting with the resource entity as if it is a
- file, this can be achieved with QFile. The data and children behind a
- QResource are normally compiled into an application/library, but it is
- also possible to load a resource at runtime. When loaded at run time
- the resource file will be loaded as one big set of data and then given
- out in pieces via references into the resource tree.
-
- A QResource can either be loaded with an absolute path, either treated
- as a file system rooted with a \c{/} character, or in resource notation
- rooted with a \c{:} character.
-
- A QResource that is representing a file will have data backing it; this
- happens implicitly when accessed through a QFile. A QResource that is
- representing a directory will have only children and no data.
-
- \section1 Dynamic Resource Loading
-
- A resource can be left out of an application's binary and loaded when
- it is needed at run-time by using the registerResource() function. The
- resource file passed into registerResource() must be a binary resource
- as created by rcc. Further information about binary resources can be
- found in \l{The Qt Resource System} documentation.
-
- This can often be useful when loading a large set of application icons
- that may change based on a setting, or that can be edited by a user and
- later recreated. The resource is immediately loaded into memory, either
- as a result of a single file read operation, or as a memory mapped file.
-
- This approach can prove to be a significant performance gain as only a
- single file will be loaded, and pieces of data will be given out via the
- path requested in setFileName().
-
- The unregisterResource() function removes a reference to a particular
- file. If there are QResources that currently reference resources related
- to the unregistered file, they will continue to be valid but the resource
- file itself will be removed from the resource roots, and thus no further
- QResource can be created pointing into this resource data. The resource
- itself will be unmapped from memory when the last QResource that points
- to it is destroyed.
-
- \sa {The Qt Resource System}, QFile, QDir, QFileInfo
-*/
-
-class QResourcePrivate {
-public:
- inline QResourcePrivate() { clear(); }
- inline ~QResourcePrivate() { clear(); }
-
- void ensureInitialized() const;
- void ensureChildren() const;
-
- bool load(const QString &file);
- void clear();
-
- QLocale locale;
- QString fileName, absoluteFilePath;
- QList<QResourceRoot*> related;
- bool container;
- mutable qint64 size;
- mutable const uchar *data;
- mutable QStringList children;
-};
-
-void
-QResourcePrivate::clear()
-{
- absoluteFilePath.clear();
- container = false;
- data = nullptr;
- size = 0;
- children.clear();
- for(int i = 0; i < related.size(); ++i) {
- QResourceRoot *root = related.at(i);
- if(!root->ref.deref())
- delete root;
- }
- related.clear();
-}
-
-bool
-QResourcePrivate::load(const QString &file)
-{
- related.clear();
- std::lock_guard<std::recursive_mutex> lock(qGlobalResourceMutex);
- const ResourceList *list = qGlobalResourceList();
- QString cleaned = QDir::cleanPath(file);
- for(int i = 0; i < list->size(); ++i) {
- QResourceRoot *res = list->at(i);
- const int node = res->findNode(cleaned, locale);
- if(node != -1) {
- if(related.isEmpty()) {
- container = res->isContainer(node);
- if(!container) {
- data = res->data(node, &size);
- } else {
- data = nullptr;
- size = 0;
- }
- } else if(Q_UNLIKELY(res->isContainer(node) != container)) {
- qWarning("QResourceInfo: Resource [%s] has both data and children!", file.toLatin1().constData());
- }
- res->ref.ref();
- related.append(res);
- } else if(res->mappingRootSubdir(file)) {
- container = true;
- data = nullptr;
- size = 0;
- res->ref.ref();
- related.append(res);
- }
- }
- return !related.isEmpty();
-}
-
-void
-QResourcePrivate::ensureInitialized() const
-{
- if(!related.isEmpty())
- return;
- QResourcePrivate *that = const_cast<QResourcePrivate *>(this);
- that->absoluteFilePath = fileName;
- if(!that->absoluteFilePath.startsWith(QLatin1String(":/")))
- that->absoluteFilePath.prepend(QLatin1String(":/"));
-
- if(fileName.startsWith(QLatin1String(":/"))) {
- that->load(fileName.mid(1));
- }
-}
-
-void
-QResourcePrivate::ensureChildren() const
-{
- ensureInitialized();
- if(!children.isEmpty() || !container || related.isEmpty())
- return;
-
- QString path = absoluteFilePath, k;
- if(path.startsWith(QLatin1Char(':')))
- path = path.mid(1);
- QString cleaned = QDir::cleanPath(path);
- for(int i = 0; i < related.size(); ++i) {
- QResourceRoot *res = related.at(i);
- if(res->mappingRootSubdir(path, &k) && !k.isEmpty()) {
- if(!children.contains(k)) {
- children.append(k);
- }
- } else {
- const int node = res->findNode(cleaned);
- if(node != -1) {
- QStringList related_children = res->children(node);
- for(int kid = 0; kid < related_children.size(); ++kid) {
- k = related_children.at(kid);
- if(!children.contains(k)) {
- children.append(k);
- }
- }
- }
- }
- }
-}
-
-/*!
- Constructs a QResource pointing to \a file. \a locale is used to
- load a specific localization of a resource data.
-
- \sa QFileInfo, setFileName(), setLocale()
-*/
-
-QResource::QResource(const QString &file, const QLocale &locale) : d_ptr(new QResourcePrivate())
-{
- Q_D(QResource);
- d->fileName = file;
- d->locale = locale;
-}
-
-/*!
- Releases the resources of the QResource object.
-*/
-QResource::~QResource()
-{
- delete d_ptr;
-}
-
-/*!
- Sets a QResource to only load the localization of resource to for \a
- locale. If a resource for the specific locale is not found then the
- C locale is used.
-
- \sa setFileName()
-*/
-
-void QResource::setLocale(const QLocale &locale)
-{
- Q_D(QResource);
- d->clear();
- d->locale = locale;
-}
-
-/*!
- Returns the locale used to locate the data for the QResource.
-*/
-
-QLocale QResource::locale() const
-{
- Q_D(const QResource);
- return d->locale;
-}
-
-/*!
- Sets a QResource to point to \a file. \a file should be absolute.
-
- \sa absoluteFilePath()
-*/
-
-void QResource::setFileName(const QString &file)
-{
- Q_D(QResource);
- d->clear();
- d->fileName = file;
-}
-
-/*!
- Returns the full path to the file that this QResource represents as it
- was passed.
-
- \sa absoluteFilePath()
-*/
-
-QString QResource::fileName() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return d->fileName;
-}
-
-/*!
- Returns the real path that this QResource represents.
-
- \sa fileName()
-*/
-
-QString QResource::absoluteFilePath() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return d->absoluteFilePath;
-}
-
-/*!
- Returns true if the resource really exists in the resource hierarchy,
- false otherwise.
-
-*/
-
-bool QResource::isValid() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return !d->related.isEmpty();
-}
-
-/*!
- \fn bool QResource::isFile() const
-
- Returns true if the resource represents a file and thus has data
- backing it, false if it represents a directory.
-
- \sa isDir()
-*/
-
-/*!
- Returns the size of the data backing the resource.
-
- \sa data(), isFile()
-*/
-
-qint64 QResource::size() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return d->size;
-}
-
-/*!
- Returns direct access to a read only segment of data that this resource
- represents. If the resource is a directory 0 is returned.
-
- \sa size(), isFile()
-*/
-
-const uchar *QResource::data() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return d->data;
-}
-
-/*!
- Returns true if the resource represents a directory and thus may have
- children() in it, false if it represents a file.
-
- \sa isFile()
-*/
-
-bool QResource::isDir() const
-{
- Q_D(const QResource);
- d->ensureInitialized();
- return d->container;
-}
-
-/*!
- Returns a list of all resources in this directory, if the resource
- represents a file the list will be empty.
-
- \sa isDir()
-*/
-
-QStringList QResource::children() const
-{
- Q_D(const QResource);
- d->ensureChildren();
- return d->children;
-}
-
-inline int QResourceRoot::hash(int node) const
-{
- if(!node) //root
- return 0;
- const int offset = findOffset(node);
- int name_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- name_offset += 2; //jump past name length
- return (names[name_offset+0] << 24) + (names[name_offset+1] << 16) +
- (names[name_offset+2] << 8) + (names[name_offset+3] << 0);
-}
-inline QString QResourceRoot::name(int node) const
-{
- if(!node) // root
- return QString();
- const int offset = findOffset(node);
-
- int name_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- const short name_length = (names[name_offset+0] << 8) +
- (names[name_offset+1] << 0);
- name_offset += 2;
- name_offset += 4; //jump past hash
-
- QString ret(name_length, Qt::Uninitialized);
- QChar *strData = ret.data();
- for(int i = 0; i < name_length*2; i+=2) {
- QChar c(names[name_offset+i+1], names[name_offset+i]);
- *strData = c;
- ++strData;
- }
- return ret;
-}
-
-int QResourceRoot::findNode(const QString &_path, const QLocale &locale) const
-{
- QString path = _path;
- {
- QString root = mappingRoot();
- if(!root.isEmpty()) {
- if(root == path) {
- path = QLatin1Char('/');
- } else {
- if(!root.endsWith(QLatin1Char('/')))
- root += QLatin1Char('/');
- if(path.size() >= root.size() && path.startsWith(root))
- path = path.mid(root.length()-1);
- if(path.isEmpty())
- path = QLatin1Char('/');
- }
- }
- }
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << "!!!!" << "START" << path << locale.country() << locale.language();
-#endif
-
- if(path == QLatin1String("/"))
- return 0;
-
- //the root node is always first
- int child_count = (tree[6] << 24) + (tree[7] << 16) +
- (tree[8] << 8) + (tree[9] << 0);
- int child = (tree[10] << 24) + (tree[11] << 16) +
- (tree[12] << 8) + (tree[13] << 0);
-
- //now iterate up the tree
- int node = -1;
-
- QStringSplitter splitter(path);
- while (child_count && splitter.hasNext()) {
- QStringRef segment = splitter.next();
-
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << " CHILDREN" << segment;
- for(int j = 0; j < child_count; ++j) {
- qDebug() << " " << child+j << " :: " << name(child+j);
- }
-#endif
- const int h = qHash(segment);
-
- //do the binary search for the hash
- int l = 0, r = child_count-1;
- int sub_node = (l+r+1)/2;
- while(r != l) {
- const int sub_node_hash = hash(child+sub_node);
- if(h == sub_node_hash)
- break;
- else if(h < sub_node_hash)
- r = sub_node - 1;
- else
- l = sub_node;
- sub_node = (l + r + 1) / 2;
- }
- sub_node += child;
-
- //now do the "harder" compares
- bool found = false;
- if(hash(sub_node) == h) {
- while(sub_node > child && hash(sub_node-1) == h) //backup for collisions
- --sub_node;
- for(; sub_node < child+child_count && hash(sub_node) == h; ++sub_node) { //here we go...
- if(name(sub_node) == segment) {
- found = true;
- int offset = findOffset(sub_node);
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << " TRY" << sub_node << name(sub_node) << offset;
-#endif
- offset += 4; //jump past name
-
- const short flags = (tree[offset+0] << 8) +
- (tree[offset+1] << 0);
- offset += 2;
-
- if(!splitter.hasNext()) {
- if(!(flags & Directory)) {
- const short country = (tree[offset+0] << 8) +
- (tree[offset+1] << 0);
- offset += 2;
-
- const short language = (tree[offset+0] << 8) +
- (tree[offset+1] << 0);
- offset += 2;
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << " " << "LOCALE" << country << language;
-#endif
- if(country == locale.country() && language == locale.language()) {
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << "!!!!" << "FINISHED" << __LINE__ << sub_node;
-#endif
- return sub_node;
- } else if((country == QLocale::AnyCountry && language == locale.language()) ||
- (country == QLocale::AnyCountry && language == QLocale::C && node == -1)) {
- node = sub_node;
- }
- continue;
- } else {
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << "!!!!" << "FINISHED" << __LINE__ << sub_node;
-#endif
-
- return sub_node;
- }
- }
-
- if(!(flags & Directory))
- return -1;
-
- child_count = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- offset += 4;
- child = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- break;
- }
- }
- }
- if(!found)
- break;
- }
-#ifdef DEBUG_RESOURCE_MATCH
- qDebug() << "!!!!" << "FINISHED" << __LINE__ << node;
-#endif
- return node;
-}
-short QResourceRoot::flags(int node) const
-{
- if(node == -1)
- return 0;
- const int offset = findOffset(node) + 4; //jump past name
- return (tree[offset+0] << 8) + (tree[offset+1] << 0);
-}
-const uchar *QResourceRoot::data(int node, qint64 *size) const
-{
- if(node == -1) {
- *size = 0;
- return nullptr;
- }
- int offset = findOffset(node) + 4; //jump past name
-
- const short flags = (tree[offset+0] << 8) + (tree[offset+1] << 0);
- offset += 2;
-
- offset += 4; //jump past locale
-
- if(!(flags & Directory)) {
- const int data_offset = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- const uint data_length = (payloads[data_offset+0] << 24) + (payloads[data_offset+1] << 16) +
- (payloads[data_offset+2] << 8) + (payloads[data_offset+3] << 0);
- const uchar *ret = payloads+data_offset+4;
- *size = data_length;
- return ret;
- }
- *size = 0;
- return nullptr;
-}
-QStringList QResourceRoot::children(int node) const
-{
- if(node == -1)
- return QStringList();
- int offset = findOffset(node) + 4; //jump past name
-
- const short flags = (tree[offset+0] << 8) + (tree[offset+1] << 0);
- offset += 2;
-
- QStringList ret;
- if(flags & Directory) {
- const int child_count = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- offset += 4;
- const int child_off = (tree[offset+0] << 24) + (tree[offset+1] << 16) +
- (tree[offset+2] << 8) + (tree[offset+3] << 0);
- ret.reserve(child_count);
- for(int i = child_off; i < child_off+child_count; ++i)
- ret << name(i);
- }
- return ret;
-}
-bool QResourceRoot::mappingRootSubdir(const QString &path, QString *match) const
-{
- const QString root = mappingRoot();
- if(!root.isEmpty()) {
- const QStringList root_segments = root.split(QLatin1Char('/'), QString::SkipEmptyParts),
- path_segments = path.split(QLatin1Char('/'), QString::SkipEmptyParts);
- if(path_segments.size() <= root_segments.size()) {
- int matched = 0;
- for(int i = 0; i < path_segments.size(); ++i) {
- if(root_segments[i] != path_segments[i])
- break;
- ++matched;
- }
- if(matched == path_segments.size()) {
- if(match && root_segments.size() > matched)
- *match = root_segments.at(matched);
- return true;
- }
- }
- }
- return false;
-}
-
-Q_CORE_EXPORT bool qRegisterResourceData(int version, const unsigned char *tree,
- const unsigned char *name, const unsigned char *data)
-{
- std::lock_guard<std::recursive_mutex> lock(qGlobalResourceMutex);
- if(version == Q_RCC_OUTPUT_REVISION && qGlobalResourceList()) {
- bool found = false;
- QResourceRoot res(tree, name, data);
- for(int i = 0; i < qGlobalResourceList()->size(); ++i) {
- if(*qGlobalResourceList()->at(i) == res) {
- found = true;
- break;
- }
- }
- if(!found) {
- QResourceRoot *root = new QResourceRoot(tree, name, data);
- root->ref.ref();
- qGlobalResourceList()->append(root);
- }
- return true;
- }
- return false;
-}
-
-Q_CORE_EXPORT bool qUnregisterResourceData(int version, const unsigned char *tree,
- const unsigned char *name, const unsigned char *data)
-{
- std::lock_guard<std::recursive_mutex> lock(qGlobalResourceMutex);
- if(version == Q_RCC_OUTPUT_REVISION && qGlobalResourceList()) {
- QResourceRoot res(tree, name, data);
- for(int i = 0; i < qGlobalResourceList()->size(); ) {
- if(*qGlobalResourceList()->at(i) == res) {
- QResourceRoot *root = qGlobalResourceList()->takeAt(i);
- if(!root->ref.deref())
- delete root;
- } else {
- ++i;
- }
- }
- return true;
- }
- return false;
-}
-
-//run time resource creation
-
-class QDynamicBufferResourceRoot: public QResourceRoot
-{
- QString root;
- const uchar *buffer;
-
-public:
- inline QDynamicBufferResourceRoot(const QString &_root) : root(_root), buffer(nullptr) { }
- inline ~QDynamicBufferResourceRoot() { }
- inline const uchar *mappingBuffer() const { return buffer; }
- virtual QString mappingRoot() const { return root; }
- virtual ResourceRootType type() const { return Resource_Buffer; }
-
- bool registerSelf(const uchar *b) {
- //magic number
- if(b[0] != 'q' || b[1] != 'r' || b[2] != 'e' || b[3] != 's') {
- return false;
- }
- //setup the data now
- int offset = 4;
-
- const int version = (b[offset+0] << 24) + (b[offset+1] << 16) +
- (b[offset+2] << 8) + (b[offset+3] << 0);
- offset += 4;
-
- const int tree_offset = (b[offset+0] << 24) + (b[offset+1] << 16) +
- (b[offset+2] << 8) + (b[offset+3] << 0);
- offset += 4;
-
- const int data_offset = (b[offset+0] << 24) + (b[offset+1] << 16) +
- (b[offset+2] << 8) + (b[offset+3] << 0);
- offset += 4;
-
- const int name_offset = (b[offset+0] << 24) + (b[offset+1] << 16) +
- (b[offset+2] << 8) + (b[offset+3] << 0);
-
- if(version == Q_RCC_OUTPUT_REVISION) {
- buffer = b;
- setSource(b+tree_offset, b+name_offset, b+data_offset);
- return true;
- }
- return false;
- }
-};
-
-/*!
- \fn bool QResource::registerResource(const uchar *rccData, const QString &mapRoot)
- \since 4.3
-
- Registers the resource with the given \a rccData at the location in the
- resource tree specified by \a mapRoot, and returns true if the file is
- successfully opened; otherwise returns false.
-
- \warning The data must remain valid throughout the life of any QFile
- that may reference the resource data.
-
- \sa unregisterResource()
-*/
-
-bool
-QResource::registerResource(const uchar *rccData, const QString &resourceRoot)
-{
- if(Q_UNLIKELY(!resourceRoot.startsWith(QLatin1String(":/")))) {
- qWarning("QResource::registerResource: Registering a resource [%p] must be rooted in an absolute path (start with :/) [%s]",
- rccData, resourceRoot.toLocal8Bit().data());
- return false;
- }
-
- QDynamicBufferResourceRoot *root = new QDynamicBufferResourceRoot(resourceRoot);
- if(root->registerSelf(rccData)) {
- root->ref.ref();
- std::lock_guard<std::recursive_mutex> lock(qGlobalResourceMutex);
- qGlobalResourceList()->append(root);
- return true;
- }
- delete root;
- return false;
-}
-
-/*!
- \fn bool QResource::unregisterResource(const uchar *rccData, const QString &mapRoot)
- \since 4.3
-
- Unregisters the resource with the given \a rccData at the location in the
- resource tree specified by \a mapRoot, and returns true if the resource is
- successfully unloaded and no references exist into the resource; otherwise returns false.
-
- \sa registerResource()
-*/
-
-bool
-QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot)
-{
- std::lock_guard<std::recursive_mutex> lock(qGlobalResourceMutex);
- ResourceList *list = qGlobalResourceList();
- for(int i = 0; i < list->size(); ++i) {
- QResourceRoot *res = list->at(i);
- if(res->type() == QResourceRoot::Resource_Buffer) {
- QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res);
- if(root->mappingBuffer() == rccData && root->mappingRoot() == resourceRoot) {
- qGlobalResourceList()->removeAt(i);
- if(!root->ref.deref()) {
- delete root;
- return true;
- }
- return false;
- }
- }
- }
- return false;
-}
-
-//resource engine
-class QResourceFileEnginePrivate : public QAbstractFileEnginePrivate
-{
-protected:
- Q_DECLARE_PUBLIC(QResourceFileEngine)
-private:
- uchar *map(qint64 offset, qint64 size);
- bool unmap(uchar *ptr);
- qint64 offset;
- QResource resource;
-protected:
- QResourceFileEnginePrivate() : offset(0) { }
-};
-
-bool QResourceFileEngine::mkdir(const QString &, bool) const
-{
- return false;
-}
-
-bool QResourceFileEngine::rmdir(const QString &, bool) const
-{
- return false;
-}
-
-bool QResourceFileEngine::setSize(qint64)
-{
- return false;
-}
-
-bool QResourceFileEngine::caseSensitive() const
-{
- return true;
-}
-
-QResourceFileEngine::QResourceFileEngine(const QString &file) :
- QAbstractFileEngine(*new QResourceFileEnginePrivate)
-{
- Q_D(QResourceFileEngine);
- d->resource.setFileName(file);
-}
-
-QResourceFileEngine::~QResourceFileEngine()
-{
-}
-
-void QResourceFileEngine::setFileName(const QString &file)
-{
- Q_D(QResourceFileEngine);
- d->resource.setFileName(file);
-}
-
-bool QResourceFileEngine::open(QIODevice::OpenMode flags)
-{
- Q_D(QResourceFileEngine);
- if (Q_UNLIKELY(d->resource.fileName().isEmpty())) {
- qWarning("QResourceFileEngine::open: Missing file name");
- return false;
- }
- if(flags & QIODevice::WriteOnly)
- return false;
- if(!d->resource.isValid())
- return false;
- return true;
-}
-
-bool QResourceFileEngine::close()
-{
- Q_D(QResourceFileEngine);
- d->offset = 0;
- return true;
-}
-
-bool QResourceFileEngine::flush()
-{
- return true;
-}
-
-qint64 QResourceFileEngine::read(char *data, qint64 len)
-{
- Q_D(QResourceFileEngine);
- if(len > size()-d->offset)
- len = size()-d->offset;
- if(len <= 0)
- return 0;
- memcpy(data, d->resource.data()+d->offset, len);
- d->offset += len;
- return len;
-}
-
-qint64 QResourceFileEngine::write(const char *, qint64)
-{
- return -1;
-}
-
-bool QResourceFileEngine::remove()
-{
- return false;
-}
-
-bool QResourceFileEngine::copy(const QString &)
-{
- return false;
-}
-
-bool QResourceFileEngine::rename(const QString &)
-{
- return false;
-}
-
-bool QResourceFileEngine::link(const QString &)
-{
- return false;
-}
-
-qint64 QResourceFileEngine::size() const
-{
- Q_D(const QResourceFileEngine);
- if(!d->resource.isValid())
- return 0;
- return d->resource.size();
-}
-
-qint64 QResourceFileEngine::pos() const
-{
- Q_D(const QResourceFileEngine);
- return d->offset;
-}
-
-bool QResourceFileEngine::atEnd() const
-{
- Q_D(const QResourceFileEngine);
- if(!d->resource.isValid())
- return true;
- return d->offset == size();
-}
-
-bool QResourceFileEngine::seek(qint64 pos)
-{
- Q_D(QResourceFileEngine);
- if(!d->resource.isValid())
- return false;
-
- if(d->offset > size())
- return false;
- d->offset = pos;
- return true;
-}
-
-bool QResourceFileEngine::isSequential() const
-{
- return false;
-}
-
-QAbstractFileEngine::FileFlags QResourceFileEngine::fileFlags(QAbstractFileEngine::FileFlags type) const
-{
- Q_D(const QResourceFileEngine);
- QAbstractFileEngine::FileFlags ret = 0;
- if(!d->resource.isValid())
- return ret;
-
- if(type & PermsMask)
- ret |= QAbstractFileEngine::FileFlags(ReadOwnerPerm|ReadUserPerm|ReadGroupPerm|ReadOtherPerm);
- if(type & TypesMask) {
- if(d->resource.isDir())
- ret |= DirectoryType;
- else
- ret |= FileType;
- }
- if(type & FlagsMask) {
- ret |= ExistsFlag;
- if(d->resource.absoluteFilePath() == QLatin1String(":/"))
- ret |= RootFlag;
- }
- return ret;
-}
-
-bool QResourceFileEngine::setPermissions(uint)
-{
- return false;
-}
-
-QString QResourceFileEngine::fileName(FileName file) const
-{
- Q_D(const QResourceFileEngine);
- const QString filepath = d->resource.fileName();
- if(file == BaseName) {
- int slash = filepath.lastIndexOf(QLatin1Char('/'));
- if (slash == -1)
- return filepath;
- return filepath.mid(slash + 1);
- } else if(file == PathName || file == AbsolutePathName) {
- const QString path = (file == AbsolutePathName) ? d->resource.absoluteFilePath() : filepath;
- const int slash = path.lastIndexOf(QLatin1Char('/'));
- if (slash <= 1 || slash == path.size())
- return QLatin1String(":/");
- return path.left(slash);
- } else if(file == CanonicalName || file == CanonicalPathName) {
- const QString absoluteFilePath = d->resource.absoluteFilePath();
- if(file == CanonicalPathName) {
- const int slash = absoluteFilePath.lastIndexOf(QLatin1Char('/'));
- if (slash != -1)
- return absoluteFilePath.left(slash);
- }
- return absoluteFilePath;
- }
- return filepath;
-}
-
-bool QResourceFileEngine::isRelativePath() const
-{
- return false;
-}
-
-uint QResourceFileEngine::ownerId(FileOwner) const
-{
- return QFileSystemMetaData::nobodyID;
-}
-
-QString QResourceFileEngine::owner(FileOwner) const
-{
- return QString();
-}
-
-QDateTime QResourceFileEngine::fileTime(FileTime) const
-{
- return QDateTime();
-}
-
-/*!
- \internal
-*/
-QAbstractFileEngine::Iterator *QResourceFileEngine::beginEntryList(QDir::Filters filters,
- const QStringList &filterNames)
-{
- return new QResourceFileEngineIterator(filters, filterNames);
-}
-
-bool QResourceFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output)
-{
- Q_D(QResourceFileEngine);
- if (extension == MapExtension) {
- const MapExtensionOption *options = (MapExtensionOption*)(option);
- MapExtensionReturn *returnValue = static_cast<MapExtensionReturn*>(output);
- returnValue->address = d->map(options->offset, options->size);
- return (returnValue->address != nullptr);
- }
- if (extension == UnMapExtension) {
- UnMapExtensionOption *options = (UnMapExtensionOption*)option;
- return d->unmap(options->address);
- }
- return false;
-}
-
-bool QResourceFileEngine::supportsExtension(Extension extension) const
-{
- return (extension == UnMapExtension || extension == MapExtension);
-}
-
-uchar *QResourceFileEnginePrivate::map(qint64 offset, qint64 size)
-{
- Q_Q(QResourceFileEngine);
- if (offset < 0 || size <= 0 || !resource.isValid() || offset + size > resource.size()) {
- q->setError(QFile::UnspecifiedError, QString());
- return nullptr;
- }
- uchar *address = const_cast<uchar *>(resource.data());
- return (address + offset);
-}
-
-bool QResourceFileEnginePrivate::unmap(uchar *ptr)
-{
- Q_UNUSED(ptr);
- return true;
-}
-
-QT_END_NAMESPACE
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtCore module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRESOURCE_H
-#define QRESOURCE_H
-
-#include <QtCore/qlocale.h>
-#include <QtCore/qstringlist.h>
-
-
-QT_BEGIN_NAMESPACE
-
-#define Q_RCC_OUTPUT_REVISION 0x02
-
-class QResourcePrivate;
-
-class Q_CORE_EXPORT QResource
-{
-public:
- QResource(const QString &file=QString(), const QLocale &locale=QLocale());
- ~QResource();
-
- void setFileName(const QString &file);
- QString fileName() const;
- QString absoluteFilePath() const;
-
- void setLocale(const QLocale &locale);
- QLocale locale() const;
-
- bool isValid() const;
-
- qint64 size() const;
- const uchar *data() const;
-
- static bool registerResource(const uchar *rccData, const QString &resourceRoot=QString());
- static bool unregisterResource(const uchar *rccData, const QString &resourceRoot=QString());
-
-protected:
- friend class QResourceFileEngine;
- friend class QResourceFileEngineIterator;
- bool isDir() const;
- inline bool isFile() const { return !isDir(); }
- QStringList children() const;
-
-protected:
- QResourcePrivate* d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QResource)
-};
-
-QT_END_NAMESPACE
-
-
-#endif // QRESOURCE_H
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtCore module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qresource.h"
-#include "qresource_iterator_p.h"
-
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-QResourceFileEngineIterator::QResourceFileEngineIterator(QDir::Filters filters,
- const QStringList &filterNames)
- : QAbstractFileEngineIterator(filters, filterNames), index(-1)
-{
-}
-
-QResourceFileEngineIterator::~QResourceFileEngineIterator()
-{
-}
-
-QString QResourceFileEngineIterator::next()
-{
- if (!hasNext())
- return QString();
- ++index;
- return currentFilePath();
-}
-
-bool QResourceFileEngineIterator::hasNext() const
-{
- if (index == -1) {
- // Lazy initialization of the iterator
- QResource resource(path());
- if (!resource.isValid())
- return false;
-
- // Initialize and move to the next entry.
- entries = resource.children();
- index = 0;
- }
-
- return index < entries.size();
-}
-
-QString QResourceFileEngineIterator::currentFileName() const
-{
- if (index <= 0 || index > entries.size())
- return QString();
- return entries.at(index - 1);
-}
-
-QT_END_NAMESPACE
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtCore module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRESOURCE_ITERATOR_P_H
-#define QRESOURCE_ITERATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Katie API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qabstractfileengine.h"
-#include "qdir.h"
-
-QT_BEGIN_NAMESPACE
-
-class QResourceFileEngineIteratorPrivate;
-class QResourceFileEngineIterator : public QAbstractFileEngineIterator
-{
-public:
- QResourceFileEngineIterator(QDir::Filters filters, const QStringList &filterNames);
- ~QResourceFileEngineIterator();
-
- QString next();
- bool hasNext() const;
-
- QString currentFileName() const;
-
-private:
- mutable QStringList entries;
- mutable int index;
-};
-
-QT_END_NAMESPACE
-
-#endif
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the QtCore module of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRESOURCE_P_H
-#define QRESOURCE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Katie API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "QtCore/qabstractfileengine.h"
-
-QT_BEGIN_NAMESPACE
-
-class QResourceFileEnginePrivate;
-class QResourceFileEngine : public QAbstractFileEngine
-{
-private:
- Q_DECLARE_PRIVATE(QResourceFileEngine)
-public:
- explicit QResourceFileEngine(const QString &path);
- ~QResourceFileEngine();
-
- virtual void setFileName(const QString &file);
-
- virtual bool open(QIODevice::OpenMode flags) ;
- virtual bool close();
- virtual bool flush();
- virtual qint64 size() const;
- virtual qint64 pos() const;
- virtual bool atEnd() const;
- virtual bool seek(qint64);
- virtual qint64 read(char *data, qint64 maxlen);
- virtual qint64 write(const char *data, qint64 len);
-
- virtual bool remove();
- virtual bool copy(const QString &newName);
- virtual bool rename(const QString &newName);
- virtual bool link(const QString &newName);
-
- virtual bool isSequential() const;
-
- virtual bool isRelativePath() const;
-
- virtual bool mkdir(const QString &dirName, bool createParentDirectories) const;
- virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const;
-
- virtual bool setSize(qint64 size);
-
- virtual bool caseSensitive() const;
-
- virtual FileFlags fileFlags(FileFlags type) const;
-
- virtual bool setPermissions(uint perms);
-
- virtual QString fileName(QAbstractFileEngine::FileName file) const;
-
- virtual uint ownerId(FileOwner) const;
- virtual QString owner(FileOwner) const;
-
- virtual QDateTime fileTime(FileTime time) const;
-
- virtual Iterator *beginEntryList(QDir::Filters filters, const QStringList &filterNames);
-
- bool extension(Extension extension, const ExtensionOption *option = nullptr, ExtensionReturn *output = nullptr);
- bool supportsExtension(Extension extension) const;
-};
-
-QT_END_NAMESPACE
-
-#endif // QRESOURCE_P_H
add_subdirectory(moc)
# essential tools
-add_subdirectory(rcc)
add_subdirectory(uic)
# not so much
+++ /dev/null
-# add_definitions()
-set(EXTRA_RCC_LIBS
- KtCore KtXml
-)
-
-include_directories(
- ${CMAKE_BINARY_DIR}/include
- ${CMAKE_BINARY_DIR}/privateinclude
- ${CMAKE_BINARY_DIR}/include/QtCore
- ${CMAKE_BINARY_DIR}/include/QtXml
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-set(RCC_SOURCES
- ${CMAKE_CURRENT_SOURCE_DIR}/rccmain.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/rcc.cpp
-)
-
-set(RCC_HEADERS
- ${CMAKE_CURRENT_SOURCE_DIR}/rcc.h
-)
-
-katie_setup_target(rcc ${RCC_SOURCES} ${RCC_HEADERS})
-
-add_executable(rcc ${rcc_SOURCES})
-target_link_libraries(rcc ${EXTRA_RCC_LIBS})
-
-set_target_properties(rcc PROPERTIES
- EXPORT_NAME rcc
- OUTPUT_NAME rcc${KATIE_TOOLS_SUFFIX}
-)
-
-install(
- TARGETS rcc
- EXPORT KatieTargets
- RUNTIME DESTINATION ${KATIE_BINARIES_PATH}
- COMPONENT Tools
-)
-
-install(
- FILES ${CMAKE_CURRENT_SOURCE_DIR}/rcc.1
- DESTINATION ${KATIE_MAN_PATH}/man1
- RENAME rcc${KATIE_TOOLS_SUFFIX}.1
- COMPONENT Doc
-)
+++ /dev/null
-.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)
-.\"
-.\" Standard preamble:
-.\" ========================================================================
-.de Sp \" Vertical space (when we can't use .PP)
-.if t .sp .5v
-.if n .sp
-..
-.de Vb \" Begin verbatim text
-.ft CW
-.nf
-.ne \\$1
-..
-.de Ve \" End verbatim text
-.ft R
-.fi
-..
-.\" Set up some character translations and predefined strings. \*(-- will
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
-.\" double quote, and \*(R" will give a right double quote. \*(C+ will
-.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
-.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
-.\" nothing in troff, for use with C<>.
-.tr \(*W-
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
-.ie n \{\
-. ds -- \(*W-
-. ds PI pi
-. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
-. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
-. ds L" ""
-. ds R" ""
-. ds C` ""
-. ds C' ""
-'br\}
-.el\{\
-. ds -- \|\(em\|
-. ds PI \(*p
-. ds L" ``
-. ds R" ''
-. ds C`
-. ds C'
-'br\}
-.\"
-.\" Escape single quotes in literal strings from groff's Unicode transform.
-.ie \n(.g .ds Aq \(aq
-.el .ds Aq '
-.\"
-.\" If the F register is >0, we'll generate index entries on stderr for
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
-.\" entries marked with X<> in POD. Of course, you'll have to process the
-.\" output yourself in some meaningful fashion.
-.\"
-.\" Avoid warning from groff about undefined register 'F'.
-.de IX
-..
-.nr rF 0
-.if \n(.g .if rF .nr rF 1
-.if (\n(rF:(\n(.g==0)) \{\
-. if \nF \{\
-. de IX
-. tm Index:\\$1\t\\n%\t"\\$2"
-..
-. if !\nF==2 \{\
-. nr % 0
-. nr F 2
-. \}
-. \}
-.\}
-.rr rF
-.\" ========================================================================
-.\"
-.IX Title "RCC 1"
-.TH RCC 1 "2022-06-13" "Katie 4.12.0" "Katie Manual"
-.\" For nroff, turn off justification. Always turn off hyphenation; it makes
-.\" way too many mistakes in technical documents.
-.if n .ad l
-.nh
-.SH "NAME"
-rcc \- Katie resource compiler
-.SH "SYNOPSIS"
-.IX Header "SYNOPSIS"
-rcc [options] <resource\-file> [<resource\-file>] ...
-.SH "DESCRIPTION"
-.IX Header "DESCRIPTION"
-\&\s-1TODO\s0
-.SH "OPTIONS"
-.IX Header "OPTIONS"
-.Vb 2
-\& \-o <file>
-\& Write output to file rather than stdout.
-\&
-\& \-name <name>
-\& Create an external initialization function with name.
-\&
-\& \-root <path>
-\& Prefix resource access path with root path.
-\&
-\& \-binary
-\& Output a binary file for use as a dynamic resource.
-\&
-\& \-namespace
-\& Turn off namespace macros.
-\&
-\& \-project
-\& Output a resource file containing all files from the current directory.
-\&
-\& \-list
-\& Lists .qrc file entries.
-\&
-\& \-version
-\& Display version.
-\&
-\& \-help
-\& Display this information.
-.Ve
-.SH "EXIT STATUS"
-.IX Header "EXIT STATUS"
-rcc returns 0 on success and other on unexcepted failure.
-.SH "AUTHORS"
-.IX Header "AUTHORS"
-Copyright (C) 2015 The Qt Company Ltd.
-Copyright (C) 2016 Ivailo Monev
-.PP
-Licensed through \s-1GNU\s0 Lesser General Public License.
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the tools applications of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "rcc.h"
-
-#include <QtCore/QByteArray>
-#include <QtCore/QDateTime>
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-#include <QtCore/QDirIterator>
-#include <QtCore/QFile>
-#include <QtCore/QIODevice>
-#include <QtCore/QLocale>
-#include <QtCore/QStack>
-
-#include <QtXml/qdom.h>
-
-QT_BEGIN_NAMESPACE
-
-enum {
- CONSTANT_USENAMESPACE = 1
-};
-
-
-#define writeString(s) write(s, sizeof(s))
-
-void RCCResourceLibrary::write(const char *str, int len)
-{
- --len; // trailing \0 on string literals...
- int n = m_out.size();
- m_out.resize(n + len);
- memcpy(m_out.data() + n, str, len);
-}
-
-void RCCResourceLibrary::writeByteArray(const QByteArray &other)
-{
- m_out.append(other);
-}
-
-static inline QString msgOpenReadFailed(const QString &fname, const QString &why)
-{
- return QString::fromLatin1("Unable to open %1 for reading: %2\n").arg(fname).arg(why);
-}
-
-
-///////////////////////////////////////////////////////////
-//
-// RCCFileInfo
-//
-///////////////////////////////////////////////////////////
-
-class RCCFileInfo
-{
-public:
- enum Flags
- {
- NoFlags = 0x00,
- Directory = 0x01
- };
-
- RCCFileInfo(const QString &name = QString(), const QFileInfo &fileInfo = QFileInfo(),
- QLocale::Language language = QLocale::C,
- QLocale::Country country = QLocale::AnyCountry,
- uint flags = NoFlags);
- ~RCCFileInfo();
-
- QString resourceName() const;
-
-public:
- qint64 writeDataBlob(RCCResourceLibrary &lib, qint64 offset, QString *errorMessage);
- qint64 writeDataName(RCCResourceLibrary &, qint64 offset);
- void writeDataInfo(RCCResourceLibrary &lib);
-
- int m_flags;
- QString m_name;
- QLocale::Language m_language;
- QLocale::Country m_country;
- QFileInfo m_fileInfo;
- RCCFileInfo *m_parent;
- QHash<QString, RCCFileInfo*> m_children;
-
- qint64 m_nameOffset;
- qint64 m_dataOffset;
- qint64 m_childOffset;
-};
-
-RCCFileInfo::RCCFileInfo(const QString &name, const QFileInfo &fileInfo,
- QLocale::Language language, QLocale::Country country, uint flags)
-{
- m_name = name;
- m_fileInfo = fileInfo;
- m_language = language;
- m_country = country;
- m_flags = flags;
- m_parent = 0;
- m_nameOffset = 0;
- m_dataOffset = 0;
- m_childOffset = 0;
-}
-
-RCCFileInfo::~RCCFileInfo()
-{
- qDeleteAll(m_children);
-}
-
-QString RCCFileInfo::resourceName() const
-{
- QString resource = (m_name.isEmpty() ? QLatin1String("/") : m_name);
- for (RCCFileInfo *p = m_parent; p; p = p->m_parent)
- resource = resource.prepend(p->m_name + QLatin1Char('/'));
- return QLatin1Char(':') + resource;
-}
-
-void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib)
-{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
- //some info
- if (text) {
- if (m_language != QLocale::C) {
- lib.writeString(" // ");
- lib.writeByteArray(resourceName().toLocal8Bit());
- lib.writeString(" [");
- lib.writeByteArray(QByteArray::number(m_country));
- lib.writeString("::");
- lib.writeByteArray(QByteArray::number(m_language));
- lib.writeString("[\n ");
- } else {
- lib.writeString(" // ");
- lib.writeByteArray(resourceName().toLocal8Bit());
- lib.writeString("\n ");
- }
- }
-
- //pointer data
- if (m_flags & RCCFileInfo::Directory) {
- // name offset
- lib.writeNumber4(m_nameOffset);
-
- // flags
- lib.writeNumber2(m_flags);
-
- // child count
- lib.writeNumber4(m_children.size());
-
- // first child offset
- lib.writeNumber4(m_childOffset);
- } else {
- // name offset
- lib.writeNumber4(m_nameOffset);
-
- // flags
- lib.writeNumber2(m_flags);
-
- // locale
- lib.writeNumber2(m_country);
- lib.writeNumber2(m_language);
-
- //data offset
- lib.writeNumber4(m_dataOffset);
- }
- if (text)
- lib.writeChar('\n');
-}
-
-qint64 RCCFileInfo::writeDataBlob(RCCResourceLibrary &lib, qint64 offset,
- QString *errorMessage)
-{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
-
- //capture the offset
- m_dataOffset = offset;
-
- //find the data to be written
- QFile file(m_fileInfo.absoluteFilePath());
- if (!file.open(QFile::ReadOnly)) {
- *errorMessage = msgOpenReadFailed(m_fileInfo.absoluteFilePath(), file.errorString());
- return 0;
- }
- QByteArray data = file.readAll();
-
- // some info
- if (text) {
- lib.writeString(" // ");
- lib.writeByteArray(m_fileInfo.absoluteFilePath().toLocal8Bit());
- lib.writeString("\n ");
- }
-
- // write the length
- lib.writeNumber4(data.size());
- if (text)
- lib.writeString("\n ");
- offset += 4;
-
- // write the payload
- const char *p = data.constData();
- if (text) {
- for (int i = data.size(), j = 0; --i >= 0; --j) {
- lib.writeHex(*p++);
- if (j == 0) {
- lib.writeString("\n ");
- j = 16;
- }
- }
- } else {
- for (int i = data.size(); --i >= 0; )
- lib.writeChar(*p++);
- }
- offset += data.size();
-
- // done
- if (text)
- lib.writeString("\n ");
- return offset;
-}
-
-qint64 RCCFileInfo::writeDataName(RCCResourceLibrary &lib, qint64 offset)
-{
- const bool text = (lib.m_format == RCCResourceLibrary::C_Code);
-
- // capture the offset
- m_nameOffset = offset;
-
- // some info
- if (text) {
- lib.writeString(" // ");
- lib.writeByteArray(m_name.toLocal8Bit());
- lib.writeString("\n ");
- }
-
- // write the length
- lib.writeNumber2(m_name.length());
- if (text)
- lib.writeString("\n ");
- offset += 2;
-
- // write the hash
- lib.writeNumber4(qHash(m_name));
- if (text)
- lib.writeString("\n ");
- offset += 4;
-
- // write the m_name
- const QChar *unicode = m_name.unicode();
- for (int i = 0; i < m_name.length(); ++i) {
- lib.writeNumber2(unicode[i].unicode());
- if (text && i % 16 == 0)
- lib.writeString("\n ");
- }
- offset += m_name.length()*2;
-
- // done
- if (text)
- lib.writeString("\n ");
- return offset;
-}
-
-
-///////////////////////////////////////////////////////////
-//
-// RCCResourceLibrary
-//
-///////////////////////////////////////////////////////////
-
-static const QLatin1String TAG_RCC = QLatin1String("RCC");
-static const QLatin1String TAG_RESOURCE = QLatin1String("qresource");
-static const QLatin1String TAG_FILE = QLatin1String("file");
-static const QLatin1String ATTRIBUTE_LANG = QLatin1String("lang");
-static const QLatin1String ATTRIBUTE_PREFIX = QLatin1String("prefix");
-static const QLatin1String ATTRIBUTE_ALIAS = QLatin1String("alias");
-
-RCCResourceLibrary::RCCResourceLibrary()
- : m_root(0),
- m_format(C_Code),
- m_verbose(false),
- m_treeOffset(0),
- m_namesOffset(0),
- m_dataOffset(0),
- m_useNameSpace(CONSTANT_USENAMESPACE),
- m_errorDevice(0)
-{
- m_out.reserve(30 * 1000 * 1000);
-}
-
-RCCResourceLibrary::~RCCResourceLibrary()
-{
- delete m_root;
-}
-
-bool RCCResourceLibrary::interpretResourceFile(QIODevice *inputDevice,
- const QString &fname, QString currentPath, bool ignoreErrors)
-{
- Q_ASSERT(m_errorDevice);
- const QChar slash = QLatin1Char('/');
- if (!currentPath.isEmpty() && !currentPath.endsWith(slash))
- currentPath += slash;
-
- QDomDocument document;
- {
- QString errorMsg;
- int errorLine = 0;
- int errorColumn = 0;
- if (!document.setContent(inputDevice, &errorMsg, &errorLine, &errorColumn)) {
- if (ignoreErrors)
- return true;
- const QString msg = QString::fromLatin1("RCC Parse Error: '%1' Line: %2 Column: %3 [%4]\n").arg(fname).arg(errorLine).arg(errorColumn).arg(errorMsg);
- m_errorDevice->write(msg.toUtf8());
- return false;
- }
- }
-
- QDomElement domRoot = document.firstChildElement(TAG_RCC).toElement();
- if (!domRoot.isNull() && domRoot.tagName() == TAG_RCC) {
- for (QDomNode node = domRoot.firstChild(); !node.isNull(); node = node.nextSibling()) {
- if (!node.isElement())
- continue;
-
- QDomElement child = node.toElement();
- if (!child.isNull() && child.tagName() == TAG_RESOURCE) {
- QLocale::Language language = QLocale::c().language();
- QLocale::Country country = QLocale::c().country();
-
- if (child.hasAttribute(ATTRIBUTE_LANG)) {
- QString attribute = child.attribute(ATTRIBUTE_LANG);
- QLocale lang = QLocale(attribute);
- language = lang.language();
- if (2 == attribute.length()) {
- // Language only
- country = QLocale::AnyCountry;
- } else {
- country = lang.country();
- }
- }
-
- QString prefix;
- if (child.hasAttribute(ATTRIBUTE_PREFIX))
- prefix = child.attribute(ATTRIBUTE_PREFIX);
- if (!prefix.startsWith(slash))
- prefix.prepend(slash);
- if (!prefix.endsWith(slash))
- prefix += slash;
-
- for (QDomNode res = child.firstChild(); !res.isNull(); res = res.nextSibling()) {
- if (res.isElement() && res.toElement().tagName() == TAG_FILE) {
-
- QString fileName(res.firstChild().toText().data());
- if (fileName.isEmpty()) {
- const QString msg = QString::fromLatin1("RCC: Warning: Null node in XML of '%1'\n").arg(fname);
- m_errorDevice->write(msg.toUtf8());
- }
- QString alias;
- if (res.toElement().hasAttribute(ATTRIBUTE_ALIAS))
- alias = res.toElement().attribute(ATTRIBUTE_ALIAS);
- else
- alias = fileName;
-
- alias = QDir::cleanPath(alias);
- while (alias.startsWith(QLatin1String("../")))
- alias.remove(0, 3);
- alias = QDir::cleanPath(m_resourceRoot) + prefix + alias;
-
- QString absFileName = fileName;
- if (QDir::isRelativePath(absFileName))
- absFileName.prepend(currentPath);
- QFileInfo file(absFileName);
- if (!file.exists()) {
- m_failedResources.push_back(absFileName);
- const QString msg = QString::fromLatin1("RCC: Error in '%1': Cannot find file '%2'\n").arg(fname).arg(fileName);
- m_errorDevice->write(msg.toUtf8());
- if (ignoreErrors)
- continue;
- else
- return false;
- } else if (file.isFile()) {
- const bool arc =
- addFile(alias,
- RCCFileInfo(alias.section(slash, -1),
- file,
- language,
- country,
- RCCFileInfo::NoFlags)
- );
- if (!arc)
- m_failedResources.push_back(absFileName);
- } else {
- QDir dir;
- if (file.isDir()) {
- dir.setPath(file.filePath());
- } else {
- dir.setPath(file.path());
- dir.setNameFilters(QStringList(file.fileName()));
- if (alias.endsWith(file.fileName()))
- alias = alias.left(alias.length()-file.fileName().length());
- }
- if (!alias.endsWith(slash))
- alias += slash;
- QDirIterator it(dir, QDirIterator::FollowSymlinks|QDirIterator::Subdirectories);
- while (it.hasNext()) {
- it.next();
- QFileInfo child(it.fileInfo());
- if (child.fileName() != QLatin1String(".") && child.fileName() != QLatin1String("..")) {
- const bool arc =
- addFile(alias + child.fileName(),
- RCCFileInfo(child.fileName(),
- child,
- language,
- country,
- RCCFileInfo::NoFlags)
- );
- if (!arc)
- m_failedResources.push_back(child.fileName());
- }
- }
- }
- }
- }
- }
- }
- }
- if (m_root == 0) {
- const QString msg = QString::fromLatin1("RCC: Warning: No resources in '%1'.\n").arg(fname);
- m_errorDevice->write(msg.toUtf8());
- if (!ignoreErrors && m_format == Binary) {
- // create dummy entry, otherwise loading qith QResource will crash
- m_root = new RCCFileInfo(QString(), QFileInfo(),
- QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
- }
- }
-
- return true;
-}
-
-bool RCCResourceLibrary::addFile(const QString &alias, const RCCFileInfo &file)
-{
- Q_ASSERT(m_errorDevice);
- if (file.m_fileInfo.size() > 0xffffffff) {
- const QString msg = QString::fromLatin1("File too big: %1\n").arg(file.m_fileInfo.absoluteFilePath());
- m_errorDevice->write(msg.toUtf8());
- return false;
- }
- if (!m_root)
- m_root = new RCCFileInfo(QString(), QFileInfo(), QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
-
- RCCFileInfo *parent = m_root;
- const QStringList nodes = alias.split(QLatin1Char('/'));
- for (int i = 1; i < nodes.size()-1; ++i) {
- const QString node = nodes.at(i);
- if (node.isEmpty())
- continue;
- if (!parent->m_children.contains(node)) {
- RCCFileInfo *s = new RCCFileInfo(node, QFileInfo(), QLocale::C, QLocale::AnyCountry, RCCFileInfo::Directory);
- s->m_parent = parent;
- parent->m_children.insert(node, s);
- parent = s;
- } else {
- parent = parent->m_children[node];
- }
- }
-
- const QString filename = nodes.at(nodes.size()-1);
- RCCFileInfo *s = new RCCFileInfo(file);
- s->m_parent = parent;
- if (parent->m_children.contains(filename)) {
- foreach (const QString &fileName, m_fileNames)
- qWarning("%s: Warning: potential duplicate alias detected: '%s'",
- qPrintable(fileName), qPrintable(filename));
- }
- parent->m_children.insertMulti(filename, s);
- return true;
-}
-
-void RCCResourceLibrary::reset()
-{
- if (m_root) {
- delete m_root;
- m_root = 0;
- }
- m_errorDevice = 0;
- m_failedResources.clear();
-}
-
-
-bool RCCResourceLibrary::readFiles(bool ignoreErrors, QIODevice &errorDevice)
-{
- reset();
- m_errorDevice = &errorDevice;
- //read in data
- if (m_verbose) {
- const QString msg = QString::fromLatin1("Processing %1 files [%2]\n")
- .arg(m_fileNames.size()).arg(static_cast<int>(ignoreErrors));
- m_errorDevice->write(msg.toUtf8());
- }
- for (int i = 0; i < m_fileNames.size(); ++i) {
- QFile fileIn;
- QString fname = m_fileNames.at(i);
- QString pwd;
- if (fname == QLatin1String("-")) {
- fname = QLatin1String("(stdin)");
- pwd = QDir::currentPath();
- fileIn.setFileName(fname);
- if (!fileIn.open(stdin, QIODevice::ReadOnly)) {
- m_errorDevice->write(msgOpenReadFailed(fname, fileIn.errorString()).toUtf8());
- return false;
- }
- } else {
- pwd = QFileInfo(fname).path();
- fileIn.setFileName(fname);
- if (!fileIn.open(QIODevice::ReadOnly)) {
- m_errorDevice->write(msgOpenReadFailed(fname, fileIn.errorString()).toUtf8());
- return false;
- }
- }
- if (m_verbose) {
- const QString msg = QString::fromLatin1("Interpreting %1\n").arg(fname);
- m_errorDevice->write(msg.toUtf8());
- }
-
- if (!interpretResourceFile(&fileIn, fname, pwd, ignoreErrors))
- return false;
- }
- return true;
-}
-
-QStringList RCCResourceLibrary::dataFiles() const
-{
- QStringList ret;
- QStack<RCCFileInfo*> pending;
-
- if (!m_root)
- return ret;
- pending.push(m_root);
- while (!pending.isEmpty()) {
- RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
- it != file->m_children.end(); ++it) {
- RCCFileInfo *child = it.value();
- if (child->m_flags & RCCFileInfo::Directory)
- pending.push(child);
- ret.append(child->m_fileInfo.filePath());
- }
- }
- return ret;
-}
-
-void RCCResourceLibrary::setInitName(const QString &name)
-{
- QString saneName = name;
- if (!saneName.isEmpty()) {
- saneName.prepend(QLatin1Char('_'));
- saneName.replace(QRegExp(QLatin1String("[^a-zA-Z0-9_]")), QLatin1String("_"));
- }
- m_initName = saneName;
-}
-
-// Determine map of resource identifier (':/newPrefix/images/p1.png') to file via recursion
-static void resourceDataFileMapRecursion(const RCCFileInfo *m_root, const QString &path, RCCResourceLibrary::ResourceDataFileMap &m)
-{
- typedef QHash<QString, RCCFileInfo*>::const_iterator ChildConstIterator;
- const QChar slash = QLatin1Char('/');
- const ChildConstIterator cend = m_root->m_children.constEnd();
- for (ChildConstIterator it = m_root->m_children.constBegin(); it != cend; ++it) {
- const RCCFileInfo *child = it.value();
- QString childName = path;
- childName += slash;
- childName += child->m_name;
- if (child->m_flags & RCCFileInfo::Directory) {
- resourceDataFileMapRecursion(child, childName, m);
- } else {
- m.insert(childName, child->m_fileInfo.filePath());
- }
- }
-}
-
-RCCResourceLibrary::ResourceDataFileMap RCCResourceLibrary::resourceDataFileMap() const
-{
- ResourceDataFileMap rc;
- if (m_root)
- resourceDataFileMapRecursion(m_root, QString(QLatin1Char(':')), rc);
- return rc;
-}
-
-bool RCCResourceLibrary::output(QIODevice &outDevice, QIODevice &errorDevice)
-{
- m_errorDevice = &errorDevice;
- //write out
- if (m_verbose)
- m_errorDevice->write("Outputting code\n");
- if (!writeHeader()) {
- m_errorDevice->write("Could not write header\n");
- return false;
- }
- if (m_root) {
- if (!writeDataBlobs()) {
- m_errorDevice->write("Could not write data blobs.\n");
- return false;
- }
- if (!writeDataNames()) {
- m_errorDevice->write("Could not write file names\n");
- return false;
- }
- if (!writeDataStructure()) {
- m_errorDevice->write("Could not write data tree\n");
- return false;
- }
- }
- if (!writeInitializer()) {
- m_errorDevice->write("Could not write footer\n");
- return false;
- }
- outDevice.write(m_out, m_out.size());
- return true;
-}
-
-void RCCResourceLibrary::writeHex(quint8 tmp)
-{
- static const char * const digits = "0123456789abcdef";
- writeChar('0');
- writeChar('x');
- if (tmp < 16) {
- writeChar(digits[tmp]);
- } else {
- writeChar(digits[tmp >> 4]);
- writeChar(digits[tmp & 0xf]);
- }
- writeChar(',');
-}
-
-void RCCResourceLibrary::writeNumber2(quint16 number)
-{
- if (m_format == RCCResourceLibrary::Binary) {
- writeChar(number >> 8);
- writeChar(number);
- } else {
- writeHex(number >> 8);
- writeHex(number);
- }
-}
-
-void RCCResourceLibrary::writeNumber4(quint32 number)
-{
- if (m_format == RCCResourceLibrary::Binary) {
- writeChar(number >> 24);
- writeChar(number >> 16);
- writeChar(number >> 8);
- writeChar(number);
- } else {
- writeHex(number >> 24);
- writeHex(number >> 16);
- writeHex(number >> 8);
- writeHex(number);
- }
-}
-
-bool RCCResourceLibrary::writeHeader()
-{
- if (m_format == C_Code) {
- writeString("/****************************************************************************\n");
- writeString("** Resource object code\n");
- writeString("**\n");
- writeString("** Created by: The Resource Compiler for Katie version ");
- writeByteArray(QT_VERSION_STR);
- writeString("\n**\n");
- writeString("** WARNING! All changes made in this file will be lost!\n");
- writeString( "*****************************************************************************/\n\n");
- writeString("#include <QtCore/qresource.h>\n\n");
- } else if (m_format == Binary) {
- writeString("qres");
- writeNumber4(0);
- writeNumber4(0);
- writeNumber4(0);
- writeNumber4(0);
- }
- return true;
-}
-
-bool RCCResourceLibrary::writeDataBlobs()
-{
- Q_ASSERT(m_errorDevice);
- if (m_format == C_Code) {
- QByteArray tmpString = "static const unsigned char qt_resource_data_" + m_initName.toLatin1() + "[] = {\n";
- writeByteArray(tmpString);
- } else if (m_format == Binary) {
- m_dataOffset = m_out.size();
- }
- QStack<RCCFileInfo*> pending;
-
- if (!m_root)
- return false;
-
- pending.push(m_root);
- qint64 offset = 0;
- QString errorMessage;
- while (!pending.isEmpty()) {
- RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
- it != file->m_children.end(); ++it) {
- RCCFileInfo *child = it.value();
- if (child->m_flags & RCCFileInfo::Directory)
- pending.push(child);
- else {
- offset = child->writeDataBlob(*this, offset, &errorMessage);
- if (offset == 0)
- m_errorDevice->write(errorMessage.toUtf8());
- }
- }
- }
- if (m_format == C_Code)
- writeString("\n};\n\n");
- return true;
-}
-
-bool RCCResourceLibrary::writeDataNames()
-{
- if (m_format == C_Code) {
- QByteArray tmpString = "static const unsigned char qt_resource_name_" + m_initName.toLatin1() + "[] = {\n";
- writeByteArray(tmpString);
- } else if (m_format == Binary) {
- m_namesOffset = m_out.size();
- }
-
- QHash<QString, int> names;
- QStack<RCCFileInfo*> pending;
-
- if (!m_root)
- return false;
-
- pending.push(m_root);
- qint64 offset = 0;
- while (!pending.isEmpty()) {
- RCCFileInfo *file = pending.pop();
- for (QHash<QString, RCCFileInfo*>::iterator it = file->m_children.begin();
- it != file->m_children.end(); ++it) {
- RCCFileInfo *child = it.value();
- if (child->m_flags & RCCFileInfo::Directory)
- pending.push(child);
- if (names.contains(child->m_name)) {
- child->m_nameOffset = names.value(child->m_name);
- } else {
- names.insert(child->m_name, offset);
- offset = child->writeDataName(*this, offset);
- }
- }
- }
- if (m_format == C_Code)
- writeString("\n};\n\n");
- return true;
-}
-
-static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right)
-{
- return qHash(left->m_name) < qHash(right->m_name);
-}
-
-bool RCCResourceLibrary::writeDataStructure()
-{
- if (m_format == C_Code) {
- QByteArray tmpString = "static const unsigned char qt_resource_struct_" + m_initName.toLatin1() + "[] = {\n";
- writeByteArray(tmpString);
- } else if (m_format == Binary) {
- m_treeOffset = m_out.size();
- }
- QStack<RCCFileInfo*> pending;
-
- if (!m_root)
- return false;
-
- //calculate the child offsets (flat)
- pending.push(m_root);
- int offset = 1;
- while (!pending.isEmpty()) {
- RCCFileInfo *file = pending.pop();
- file->m_childOffset = offset;
-
- //sort by hash value for binary lookup
- QList<RCCFileInfo*> m_children = file->m_children.values();
- qSort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
-
- //write out the actual data now
- for (int i = 0; i < m_children.size(); ++i) {
- RCCFileInfo *child = m_children.at(i);
- ++offset;
- if (child->m_flags & RCCFileInfo::Directory)
- pending.push(child);
- }
- }
-
- //write out the structure (ie iterate again!)
- pending.push(m_root);
- m_root->writeDataInfo(*this);
- while (!pending.isEmpty()) {
- RCCFileInfo *file = pending.pop();
-
- //sort by hash value for binary lookup
- QList<RCCFileInfo*> m_children = file->m_children.values();
- qSort(m_children.begin(), m_children.end(), qt_rcc_compare_hash);
-
- //write out the actual data now
- for (int i = 0; i < m_children.size(); ++i) {
- RCCFileInfo *child = m_children.at(i);
- child->writeDataInfo(*this);
- if (child->m_flags & RCCFileInfo::Directory)
- pending.push(child);
- }
- }
- if (m_format == C_Code)
- writeString("\n};\n\n");
-
- return true;
-}
-
-void RCCResourceLibrary::writeAddNamespaceFunction(const QByteArray &name)
-{
- if (m_useNameSpace) {
- writeString("QT_PREPEND_NAMESPACE(");
- writeByteArray(name);
- writeChar(')');
- } else {
- writeByteArray(name);
- }
-}
-
-bool RCCResourceLibrary::writeInitializer()
-{
- if (m_format == C_Code) {
- QByteArray initLatin = m_initName.toLatin1();
- QByteArray resourceDataString = "\n (Q_RCC_OUTPUT_REVISION, qt_resource_struct_" + initLatin +
- ", qt_resource_name_" + initLatin +
- ", qt_resource_data_" + initLatin + ");\n";
- //write("\nQT_BEGIN_NAMESPACE\n");
- //init
- if (m_useNameSpace)
- writeString("QT_BEGIN_NAMESPACE\n\n");
- if (m_root) {
- writeString("extern Q_CORE_EXPORT bool qRegisterResourceData\n "
- "(int, const unsigned char *, "
- "const unsigned char *, const unsigned char *);\n\n");
- writeString("extern Q_CORE_EXPORT bool qUnregisterResourceData\n "
- "(int, const unsigned char *, "
- "const unsigned char *, const unsigned char *);\n\n");
- }
- if (m_useNameSpace)
- writeString("QT_END_NAMESPACE\n\n\n");
- QString initResources = QLatin1String("qInitResources") + m_initName;
- writeString("int ");
- writeByteArray(initResources.toLatin1());
- writeString("()\n{\n");
-
- if (m_root) {
- writeString(" ");
- writeAddNamespaceFunction("qRegisterResourceData");
- writeByteArray(resourceDataString);
- }
- writeString(" return 1;\n");
- writeString("}\n\n");
- writeString("Q_CONSTRUCTOR_FUNCTION(");
- writeByteArray(initResources.toLatin1());
- writeString(")\n\n");
-
- //cleanup
- QString cleanResources = QLatin1String("qCleanupResources") + m_initName;
- writeString("int ");
- writeByteArray(cleanResources.toLatin1());
- writeString("()\n{\n");
- if (m_root) {
- writeString(" ");
- writeAddNamespaceFunction("qUnregisterResourceData");
- writeByteArray(resourceDataString);
- }
- writeString(" return 1;\n");
- writeString("}\n\n");
- writeString("Q_DESTRUCTOR_FUNCTION(");
- writeByteArray(cleanResources.toLatin1());
- writeString(")\n\n");
- } else if (m_format == Binary) {
- int i = 4;
- char *p = m_out.data();
- p[i++] = 0; // Q_RCC_OUTPUT_REVISION
- p[i++] = 0;
- p[i++] = 0;
- p[i++] = 2;
-
- p[i++] = (m_treeOffset >> 24) & 0xff;
- p[i++] = (m_treeOffset >> 16) & 0xff;
- p[i++] = (m_treeOffset >> 8) & 0xff;
- p[i++] = (m_treeOffset >> 0) & 0xff;
-
- p[i++] = (m_dataOffset >> 24) & 0xff;
- p[i++] = (m_dataOffset >> 16) & 0xff;
- p[i++] = (m_dataOffset >> 8) & 0xff;
- p[i++] = (m_dataOffset >> 0) & 0xff;
-
- p[i++] = (m_namesOffset >> 24) & 0xff;
- p[i++] = (m_namesOffset >> 16) & 0xff;
- p[i++] = (m_namesOffset >> 8) & 0xff;
- p[i++] = (m_namesOffset >> 0) & 0xff;
- }
- return true;
-}
-
-QT_END_NAMESPACE
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the tools applications of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef RCC_H
-#define RCC_H
-
-#include <QtCore/QStringList>
-#include <QtCore/QHash>
-#include <QtCore/QString>
-
-QT_BEGIN_NAMESPACE
-
-class RCCFileInfo;
-class QIODevice;
-class QTextStream;
-
-
-class RCCResourceLibrary
-{
- RCCResourceLibrary(const RCCResourceLibrary &);
- RCCResourceLibrary &operator=(const RCCResourceLibrary &);
-
-public:
- RCCResourceLibrary();
- ~RCCResourceLibrary();
-
- bool output(QIODevice &out, QIODevice &errorDevice);
-
- bool readFiles(bool ignoreErrors, QIODevice &errorDevice);
-
- enum Format { Binary, C_Code };
- void setFormat(Format f) { m_format = f; }
- Format format() const { return m_format; }
-
- void setInputFiles(const QStringList &files) { m_fileNames = files; }
- QStringList inputFiles() const { return m_fileNames; }
-
- QStringList dataFiles() const;
-
- // Return a map of resource identifier (':/newPrefix/images/p1.png') to file.
- typedef QHash<QString, QString> ResourceDataFileMap;
- ResourceDataFileMap resourceDataFileMap() const;
-
- void setVerbose(bool b) { m_verbose = b; }
- bool verbose() const { return m_verbose; }
-
- void setInitName(const QString &name);
- QString initName() const { return m_initName; }
-
- void setResourceRoot(const QString &root) { m_resourceRoot = root; }
- QString resourceRoot() const { return m_resourceRoot; }
-
- void setUseNameSpace(bool v) { m_useNameSpace = v; }
- bool useNameSpace() const { return m_useNameSpace; }
-
- QStringList failedResources() const { return m_failedResources; }
-
-private:
- friend class RCCFileInfo;
- void reset();
- bool addFile(const QString &alias, const RCCFileInfo &file);
- bool interpretResourceFile(QIODevice *inputDevice, const QString &file,
- QString currentPath = QString(), bool ignoreErrors = false);
- bool writeHeader();
- bool writeDataBlobs();
- bool writeDataNames();
- bool writeDataStructure();
- bool writeInitializer();
- void writeAddNamespaceFunction(const QByteArray &name);
- void writeHex(quint8 number);
- void writeNumber2(quint16 number);
- void writeNumber4(quint32 number);
- void writeChar(char c) { m_out.append(c); }
- void writeByteArray(const QByteArray &);
- void write(const char *, int len);
-
- RCCFileInfo *m_root;
- QStringList m_fileNames;
- QString m_resourceRoot;
- QString m_initName;
- Format m_format;
- bool m_verbose;
- int m_treeOffset;
- int m_namesOffset;
- int m_dataOffset;
- bool m_useNameSpace;
- QStringList m_failedResources;
- QIODevice *m_errorDevice;
- QByteArray m_out;
-};
-
-QT_END_NAMESPACE
-
-#endif // RCC_H
+++ /dev/null
-=head1 NAME
-
-rcc - Katie resource compiler
-
-=head1 SYNOPSIS
-
-rcc [options] <resource-file> [<resource-file>] ...
-
-=head1 DESCRIPTION
-
-TODO
-
-=head1 OPTIONS
-
- -o <file>
- Write output to file rather than stdout.
-
- -name <name>
- Create an external initialization function with name.
-
- -root <path>
- Prefix resource access path with root path.
-
- -binary
- Output a binary file for use as a dynamic resource.
-
- -namespace
- Turn off namespace macros.
-
- -project
- Output a resource file containing all files from the current directory.
-
- -list
- Lists .qrc file entries.
-
- -version
- Display version.
-
- -help
- Display this information.
-
-=head1 EXIT STATUS
-
-rcc returns 0 on success and other on unexcepted failure.
-
-=head1 AUTHORS
-
-Copyright (C) 2015 The Qt Company Ltd.
-Copyright (C) 2016 Ivailo Monev
-
-Licensed through GNU Lesser General Public License.
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2016 Ivailo Monev
-**
-** This file is part of the tools applications of the Katie Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-**
-** GNU Lesser General Public License Usage
-** 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.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "rcc.h"
-
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QFileInfo>
-#include <QTextStream>
-
-QT_BEGIN_NAMESPACE
-
-void showHelp( const QString &error)
-{
- if (!error.isEmpty())
- fprintf(stderr, "rcc: %s\n", qPrintable(error));
- fprintf(stderr, "Usage:\n"
- " rcc [options] <resource-file> [<resource-file>] ...\n\n"
- "Options:\n"
- " -o <file>\n"
- " Write output to file rather than stdout.\n\n"
- " -name <name>\n"
- " Create an external initialization function with name.\n\n"
- " -root <path>\n"
- " Prefix resource access path with root path.\n\n"
- " -binary\n"
- " Output a binary file for use as a dynamic resource.\n\n"
- " -namespace\n"
- " Turn off namespace macros.\n\n"
- " -project\n"
- " Output a resource file containing all files from the\n"
- " current directory.\n\n"
- " -list\n"
- " Lists .qrc file entries.\n\n"
- " -version\n"
- " Display version.\n\n"
- " -help\n"
- " Display this information.\n");
-}
-
-void dumpRecursive(const QDir &dir, QTextStream &out)
-{
- QFileInfoList entries = dir.entryInfoList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot
- | QDir::NoSymLinks);
- foreach (const QFileInfo &entry, entries) {
- if (entry.isDir()) {
- dumpRecursive(entry.filePath(), out);
- } else {
- out << QLatin1String("<file>")
- << entry.filePath()
- << QLatin1String("</file>\n");
- }
- }
-}
-
-int createProject(const QString &outFileName)
-{
- QDir currentDir = QDir::current();
- QString currentDirName = currentDir.dirName();
- if (currentDirName.isEmpty())
- currentDirName = QLatin1String("root");
-
- QFile file;
- bool isOk = false;
- if (outFileName.isEmpty()) {
- isOk = file.open(stdout, QFile::WriteOnly | QFile::Text);
- } else {
- file.setFileName(outFileName);
- isOk = file.open(QFile::WriteOnly | QFile::Text);
- }
- if (!isOk) {
- fprintf(stderr, "Unable to open %s: %s\n",
- outFileName.isEmpty() ? qPrintable(outFileName) : "standard output",
- qPrintable(file.errorString()));
- return 1;
- }
-
- QTextStream out(&file);
- out << QLatin1String("<!DOCTYPE RCC><RCC version=\"1.0\">\n"
- "<qresource>\n");
-
- // use "." as dir to get relative file pathes
- dumpRecursive(QDir(QLatin1String(".")), out);
-
- out << QLatin1String("</qresource>\n"
- "</RCC>\n");
-
- return 0;
-}
-
-int runRcc(int argc, char *argv[])
-{
- QString outFilename;
- bool helpRequested = false;
- bool list = false;
- bool projectRequested = false;
- QStringList filenamesIn;
-
- QStringList args;
- for (int i = 0; i != argc; ++i)
- args += QString::fromLocal8Bit(argv[i]);
-
- RCCResourceLibrary library;
-
- // parse options
- QString errorMsg;
- for (int i = 1; i < args.count() && errorMsg.isEmpty(); i++) {
- if (args[i].isEmpty())
- continue;
- if (args[i][0] == QLatin1Char('-')) { // option
- QString opt = args[i];
- if (opt == QLatin1String("-o")) {
- if (!(i < argc-1)) {
- errorMsg = QLatin1String("Missing output name");
- break;
- }
- outFilename = args[++i];
- } else if (opt == QLatin1String("-name")) {
- if (!(i < argc-1)) {
- errorMsg = QLatin1String("Missing target name");
- break;
- }
- library.setInitName(args[++i]);
- } else if (opt == QLatin1String("-root")) {
- if (!(i < argc-1)) {
- errorMsg = QLatin1String("Missing root path");
- break;
- }
- library.setResourceRoot(QDir::cleanPath(args[++i]));
- if (library.resourceRoot().isEmpty()
- || library.resourceRoot().at(0) != QLatin1Char('/'))
- errorMsg = QLatin1String("Root must start with a /");
- } else if (opt == QLatin1String("-binary")) {
- library.setFormat(RCCResourceLibrary::Binary);
- } else if (opt == QLatin1String("-namespace")) {
- library.setUseNameSpace(!library.useNameSpace());
- } else if (opt == QLatin1String("-verbose")) {
- library.setVerbose(true);
- } else if (opt == QLatin1String("-list")) {
- list = true;
- } else if (opt == QLatin1String("-version") || opt == QLatin1String("-v")) {
- fprintf(stderr, "Katie Resource Compiler version %s\n", QT_VERSION_STR);
- return 1;
- } else if (opt == QLatin1String("-help") || opt == QLatin1String("-h")) {
- helpRequested = true;
- } else if (opt == QLatin1String("-project")) {
- projectRequested = true;
- } else {
- errorMsg = QString::fromLatin1("Unknown option: '%1'").arg(args[i]);
- }
- } else {
- if (!QFile::exists(args[i])) {
- qWarning("%s: File does not exist '%s'",
- qPrintable(args[0]), qPrintable(args[i]));
- return 1;
- }
- filenamesIn.append(args[i]);
- }
- }
-
- if (projectRequested && !helpRequested) {
- return createProject(outFilename);
- }
-
- if (!filenamesIn.size() || !errorMsg.isEmpty() || helpRequested) {
- showHelp(errorMsg);
- return 1;
- }
- QFile errorDevice;
- errorDevice.open(stderr, QIODevice::WriteOnly|QIODevice::Text);
-
- if (library.verbose())
- errorDevice.write("Katie resource compiler\n");
-
- library.setInputFiles(filenamesIn);
-
- if (!library.readFiles(list, errorDevice))
- return 1;
-
- // open output
- QFile out;
- QIODevice::OpenMode mode = QIODevice::WriteOnly;
- if (library.format() == RCCResourceLibrary::C_Code)
- mode |= QIODevice::Text;
-
- if (outFilename.isEmpty() || outFilename == QLatin1String("-")) {
- // using this overload close() only flushes.
- out.open(stdout, mode);
- } else {
- out.setFileName(outFilename);
- if (!out.open(mode)) {
- const QString msg = QString::fromLatin1("Unable to open %1 for writing: %2\n").arg(outFilename).arg(out.errorString());
- errorDevice.write(msg.toUtf8());
- return 1;
- }
- }
-
- // do the task
- if (list) {
- foreach (const QString &path, library.dataFiles()) {
- out.write(qPrintable(QDir::cleanPath(path)));
- out.write("\n");
- }
- return 0;
- }
-
- return library.output(out, errorDevice) ? 0 : 1;
-}
-
-QT_END_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- return QT_PREPEND_NAMESPACE(runRcc)(argc, argv);
-}
{ QLatin1String("QRegExpValidator"), QLatin1String("QtGui/qvalidator.h") },
{ QLatin1String("QRegion"), QLatin1String("QtGui/qregion.h") },
{ QLatin1String("QResizeEvent"), QLatin1String("QtGui/qevent.h") },
- { QLatin1String("QResource"), QLatin1String("QtCore/qresource.h") },
{ QLatin1String("QRubberBand"), QLatin1String("QtGui/qrubberband.h") },
{ QLatin1String("QScopedValueRollback"), QLatin1String("QtCore/qscopedvaluerollback.h") },
{ QLatin1String("QScriptClass"), QLatin1String("QtScript/qscriptclass.h") },
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-10-28 22:12+0300\n"
+"POT-Creation-Date: 2022-10-29 10:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
msgstr ""
#: src/gui/dialogs/qwizard.cpp:581
-#: src/scripttools/debugging/qscriptdebugger.cpp:1666
+#: src/scripttools/debugging/qscriptdebugger.cpp:1676
msgid "Continue"
msgstr ""
msgid "&Help"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:226
+#: src/gui/dialogs/qprintpreviewdialog.cpp:227
msgid "%1%"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:295
+#: src/gui/dialogs/qprintpreviewdialog.cpp:296
msgctxt "QPrintPreviewDialog"
msgid "Print Preview"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:326
+#: src/gui/dialogs/qprintpreviewdialog.cpp:334
msgctxt "QPrintPreviewDialog"
msgid "Next page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:327
+#: src/gui/dialogs/qprintpreviewdialog.cpp:335
msgctxt "QPrintPreviewDialog"
msgid "Previous page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:328
+#: src/gui/dialogs/qprintpreviewdialog.cpp:336
msgctxt "QPrintPreviewDialog"
msgid "First page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:329
+#: src/gui/dialogs/qprintpreviewdialog.cpp:337
msgctxt "QPrintPreviewDialog"
msgid "Last page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:338
+#: src/gui/dialogs/qprintpreviewdialog.cpp:346
msgctxt "QPrintPreviewDialog"
msgid "Fit width"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:339
+#: src/gui/dialogs/qprintpreviewdialog.cpp:347
msgctxt "QPrintPreviewDialog"
msgid "Fit page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:350
+#: src/gui/dialogs/qprintpreviewdialog.cpp:358
msgctxt "QPrintPreviewDialog"
msgid "Zoom in"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:351
+#: src/gui/dialogs/qprintpreviewdialog.cpp:359
msgctxt "QPrintPreviewDialog"
msgid "Zoom out"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:357
+#: src/gui/dialogs/qprintpreviewdialog.cpp:365
msgctxt "QPrintPreviewDialog"
msgid "Portrait"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:358
+#: src/gui/dialogs/qprintpreviewdialog.cpp:366
msgctxt "QPrintPreviewDialog"
msgid "Landscape"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:368
+#: src/gui/dialogs/qprintpreviewdialog.cpp:384
msgctxt "QPrintPreviewDialog"
msgid "Show single page"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:369
+#: src/gui/dialogs/qprintpreviewdialog.cpp:385
msgctxt "QPrintPreviewDialog"
msgid "Show facing pages"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:370
+#: src/gui/dialogs/qprintpreviewdialog.cpp:386
msgctxt "QPrintPreviewDialog"
msgid "Show overview of all pages"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:385
+#: src/gui/dialogs/qprintpreviewdialog.cpp:413
msgctxt "QPrintPreviewDialog"
msgid "Print"
msgstr ""
-#: src/gui/dialogs/qprintpreviewdialog.cpp:386
+#: src/gui/dialogs/qprintpreviewdialog.cpp:414
msgctxt "QPrintPreviewDialog"
msgid "Page setup"
msgstr ""
msgid "Computer"
msgstr ""
-#: src/gui/dialogs/qmessagebox.cpp:102
+#: src/gui/dialogs/qmessagebox.cpp:103
msgid "Show Details..."
msgstr ""
-#: src/gui/dialogs/qmessagebox.cpp:102
+#: src/gui/dialogs/qmessagebox.cpp:103
msgid "Hide Details..."
msgstr ""
-#: src/gui/dialogs/qmessagebox.cpp:1448
+#: src/gui/dialogs/qmessagebox.cpp:1439
msgid "<h3>About Katie</h3><p>This program uses Katie version %1.</p>"
msgstr ""
-#: src/gui/dialogs/qmessagebox.cpp:1452
+#: src/gui/dialogs/qmessagebox.cpp:1443
msgid ""
"<p>Katie is a C++ toolkit derived from the Qt 4.8 framework.</p><p>Katie is "
"licensed under the GNU LGPL version 2.1</p><p>Copyright (C) 2015 The Qt "
"a> for more information.</p>"
msgstr ""
-#: src/gui/dialogs/qmessagebox.cpp:1460
+#: src/gui/dialogs/qmessagebox.cpp:1451
msgid "About Katie"
msgstr ""
msgid "Page Setup"
msgstr ""
-#: src/gui/dialogs/qdialog.cpp:487 src/gui/kernel/qwhatsthis.cpp:456
+#: src/gui/dialogs/qdialog.cpp:487 src/gui/kernel/qwhatsthis.cpp:437
msgid "What's This?"
msgstr ""
msgid "Points (pt)"
msgstr ""
-#: src/gui/dialogs/qprintdialog_unix.cpp:342
-#: src/gui/dialogs/qprintdialog_unix.cpp:411
+#: src/gui/dialogs/qprintdialog_unix.cpp:346
+#: src/gui/dialogs/qprintdialog_unix.cpp:415
msgid "&Options >>"
msgstr ""
-#: src/gui/dialogs/qprintdialog_unix.cpp:347
+#: src/gui/dialogs/qprintdialog_unix.cpp:351
msgid "&Print"
msgstr ""
-#: src/gui/dialogs/qprintdialog_unix.cpp:415
+#: src/gui/dialogs/qprintdialog_unix.cpp:419
msgid "&Options <<"
msgstr ""
-#: src/gui/dialogs/qprintdialog_unix.cpp:941
+#: src/gui/dialogs/qprintdialog_unix.cpp:945
msgctxt "QPPDOptionsModel"
msgid "Name"
msgstr ""
-#: src/gui/dialogs/qprintdialog_unix.cpp:943
+#: src/gui/dialogs/qprintdialog_unix.cpp:947
msgctxt "QPPDOptionsModel"
msgid "Value"
msgstr ""
msgstr ""
#: src/gui/widgets/qlineedit.cpp:1742 src/gui/text/qtextcontrol.cpp:1868
-#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:279
+#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:292
msgid "Delete"
msgstr ""
msgstr ""
#: src/gui/widgets/qmdisubwindow.cpp:309
-#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:56
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:116
+#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:62
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:122
msgid "Close"
msgstr ""
msgid "*"
msgstr ""
-#: src/gui/kernel/qapplication.cpp:1615
+#: src/gui/kernel/qapplication.cpp:1601
msgid "QT_LAYOUT_DIRECTION"
msgstr ""
msgid "This platform does not support IPv6"
msgstr ""
-#: src/scripttools/debugging/qscriptedit.cpp:384
-#: src/scripttools/debugging/qscriptdebugger.cpp:1767
+#: src/scripttools/debugging/qscriptedit.cpp:398
+#: src/scripttools/debugging/qscriptdebugger.cpp:1797
msgid "Toggle Breakpoint"
msgstr ""
-#: src/scripttools/debugging/qscriptedit.cpp:386
+#: src/scripttools/debugging/qscriptedit.cpp:400
msgid "Disable Breakpoint"
msgstr ""
-#: src/scripttools/debugging/qscriptedit.cpp:387
+#: src/scripttools/debugging/qscriptedit.cpp:401
msgid "Enable Breakpoint"
msgstr ""
-#: src/scripttools/debugging/qscriptedit.cpp:391
+#: src/scripttools/debugging/qscriptedit.cpp:405
msgid "Breakpoint Condition:"
msgstr ""
-#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:273
+#: src/scripttools/debugging/qscriptbreakpointswidget.cpp:282
msgid "New"
msgstr ""
msgid "Hit-count"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:859
-#: src/scripttools/debugging/qscriptdebugger.cpp:1870
+#: src/scripttools/debugging/qscriptdebugger.cpp:851
+#: src/scripttools/debugging/qscriptdebugger.cpp:1905
msgid "Go to Line"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:860
+#: src/scripttools/debugging/qscriptdebugger.cpp:852
msgid "Line:"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1649
+#: src/scripttools/debugging/qscriptdebugger.cpp:1650
msgid "Interrupt"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1651
+#: src/scripttools/debugging/qscriptdebugger.cpp:1652
msgid "Shift+F5"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1668
+#: src/scripttools/debugging/qscriptdebugger.cpp:1678
msgid "F5"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1683
+#: src/scripttools/debugging/qscriptdebugger.cpp:1697
msgid "Step Into"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1685
+#: src/scripttools/debugging/qscriptdebugger.cpp:1699
msgid "F11"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1700
+#: src/scripttools/debugging/qscriptdebugger.cpp:1718
msgid "Step Over"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1702
+#: src/scripttools/debugging/qscriptdebugger.cpp:1720
msgid "F10"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1717
+#: src/scripttools/debugging/qscriptdebugger.cpp:1739
msgid "Step Out"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1719
+#: src/scripttools/debugging/qscriptdebugger.cpp:1741
msgid "Shift+F11"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1734
+#: src/scripttools/debugging/qscriptdebugger.cpp:1760
msgid "Run to Cursor"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1736
+#: src/scripttools/debugging/qscriptdebugger.cpp:1762
msgid "Ctrl+F10"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1752
+#: src/scripttools/debugging/qscriptdebugger.cpp:1782
msgid "Run to New Script"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1768
+#: src/scripttools/debugging/qscriptdebugger.cpp:1798
msgid "F9"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1782
+#: src/scripttools/debugging/qscriptdebugger.cpp:1812
msgid "Clear Debug Output"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1795
+#: src/scripttools/debugging/qscriptdebugger.cpp:1825
msgid "Clear Error Log"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1808
+#: src/scripttools/debugging/qscriptdebugger.cpp:1838
msgid "Clear Console"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1822
+#: src/scripttools/debugging/qscriptdebugger.cpp:1857
msgid "&Find in Script..."
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1823
+#: src/scripttools/debugging/qscriptdebugger.cpp:1858
msgid "Ctrl+F"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1840
+#: src/scripttools/debugging/qscriptdebugger.cpp:1875
msgid "Find &Next"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1842
+#: src/scripttools/debugging/qscriptdebugger.cpp:1877
msgid "F3"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1855
+#: src/scripttools/debugging/qscriptdebugger.cpp:1890
msgid "Find &Previous"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1857
+#: src/scripttools/debugging/qscriptdebugger.cpp:1892
msgid "Shift+F3"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1871
+#: src/scripttools/debugging/qscriptdebugger.cpp:1906
msgid "Ctrl+G"
msgstr ""
-#: src/scripttools/debugging/qscriptdebugger.cpp:1882
+#: src/scripttools/debugging/qscriptdebugger.cpp:1917
msgid "Debug"
msgstr ""
msgid "Katie Script Debugger"
msgstr ""
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:129
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:135
msgid "Previous"
msgstr ""
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:136
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:146
msgid "Next"
msgstr ""
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:141
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:155
msgid "Case Sensitive"
msgstr ""
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:144
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:158
msgid "Whole words"
msgstr ""
-#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:153
-msgid ""
-"<img src=\":/qt/scripttools/debugging/images/wrap.png\"> Search wrapped"
+#: src/scripttools/debugging/qscriptdebuggercodefinderwidget.cpp:167
+msgid "Search wrapped"
msgstr ""
#: src/uitools/formbuilderextra.cpp:321
msgid "The property %1 could not be written. The type %2 is not supported yet."
msgstr ""
-#: src/uitools/formbuilder.cpp:146
+#: src/uitools/formbuilder.cpp:140
msgctxt "QFormBuilder"
msgid "An empty class name was passed on to %1 (object name: '%2')."
msgstr ""
-#: src/uitools/formbuilder.cpp:200
+#: src/uitools/formbuilder.cpp:194
msgctxt "QFormBuilder"
msgid ""
"QFormBuilder was unable to create a custom widget of the class '%1'; "
"defaulting to base class '%2'."
msgstr ""
-#: src/uitools/formbuilder.cpp:206
+#: src/uitools/formbuilder.cpp:200
msgctxt "QFormBuilder"
msgid "QFormBuilder was unable to create a widget of the class '%1'."
msgstr ""
-#: src/uitools/formbuilder.cpp:247
+#: src/uitools/formbuilder.cpp:241
msgctxt "QFormBuilder"
msgid "The layout type `%1' is not supported."
msgstr ""
msgid "Empty widget item in %1 '%2'."
msgstr ""
-#: src/uitools/abstractformbuilder.cpp:1565
+#: src/uitools/abstractformbuilder.cpp:1566
msgctxt "QAbstractFormBuilder"
msgid "Flags property are not supported yet."
msgstr ""
-#: src/uitools/abstractformbuilder.cpp:1646
+#: src/uitools/abstractformbuilder.cpp:1647
msgctxt "QAbstractFormBuilder"
msgid "While applying tab stops: The widget '%1' could not be found."
msgstr ""
-#: src/uitools/abstractformbuilder.cpp:2383
+#: src/uitools/abstractformbuilder.cpp:2384
msgctxt "QAbstractFormBuilder"
msgid "Invalid QButtonGroup reference '%1' referenced by '%2'."
msgstr ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2022-10-28 22:12+0300\n"
+"POT-Creation-Date: 2022-10-29 10:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"will disable the Global Strut feature.</p>"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:160
+#: src/tools/qtconfig/mainwindow.cpp:169
msgid "Desktop Settings (Default)"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:166
+#: src/tools/qtconfig/mainwindow.cpp:175
msgid "Choose style and palette based on your desktop settings."
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:181
+#: src/tools/qtconfig/mainwindow.cpp:190
msgid "Unknown"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:315
+#: src/tools/qtconfig/mainwindow.cpp:324
msgid "No changes to be saved."
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:321
+#: src/tools/qtconfig/mainwindow.cpp:330
msgid "Saving changes..."
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:399
+#: src/tools/qtconfig/mainwindow.cpp:408
msgid "Saved changes."
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:520
+#: src/tools/qtconfig/mainwindow.cpp:529
msgid ""
"<h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2015 The Qt Company Ltd."
"<br/><br/>Copyright (C) 2016 Ivailo Monev"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:525 src/tools/qtconfig/mainwindow.cpp:526
-#: src/tools/qtconfig/mainwindow.cpp:533
+#: src/tools/qtconfig/mainwindow.cpp:534 src/tools/qtconfig/mainwindow.cpp:535
+#: src/tools/qtconfig/mainwindow.cpp:542
msgid "Katie Configuration"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:556
+#: src/tools/qtconfig/mainwindow.cpp:565
msgid "Save Changes"
msgstr ""
-#: src/tools/qtconfig/mainwindow.cpp:557
+#: src/tools/qtconfig/mainwindow.cpp:566
msgid "Save changes to settings?"
msgstr ""
msgid "Choose a color for the selected effect color role."
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:51
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:49
msgctxt "QtDBusViewer"
msgid "Katie D-Bus Viewer"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:58
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:56
msgid "Session Bus"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:59
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:57
msgid "System Bus"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:61
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:59
msgid "&File"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:62
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:60
msgid "&Quit"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:65
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:63
msgid "&Help"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:66
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:64
msgid "&About"
msgstr ""
-#: src/tools/qdbusviewer/qdbusviewermain.cpp:70
+#: src/tools/qdbusviewer/qdbusviewermain.cpp:68
msgid "About &Katie"
msgstr ""