49 currentDirName =
"root"_L1;
60 fprintf(stderr,
"Unable to open %s: %s\n",
67 out <<
"<!DOCTYPE RCC><RCC version=\"1.0\">\n"
73 out <<
"</qresource>\n"
85 result.replace(u
' ',
"\\ "_L1);
87 result.replace(u
'|',
"\\|"_L1);
89 result.replace(u
'$',
"$$"_L1);
101 for (
int i = 0;
i < depsList.size(); ++
i) {
139#if QT_CONFIG(zstd) && !defined(QT_NO_COMPRESS)
140# define ALGOS "[zstd], zlib, none"
142# define ALGOS "[zstd], none"
143#elif !defined(QT_NO_COMPRESS)
144# define ALGOS "[zlib], none"
146# define ALGOS "[none]"
148 const QString &algoDescription =
171 generatorOption.setValueName(
QStringLiteral(
"cpp|python|python2"));
187 QStringLiteral(
"Only output a mapping of resource paths to file system paths defined in the .qrc file, do not generate code."));
209 if (parser.
isSet(formatVersionOption)) {
211 formatVersion = parser.
value(formatVersionOption).
toUInt(&
ok);
213 errorMsg =
"Invalid format version specified"_L1;
214 }
else if (formatVersion < 1 || formatVersion > 3) {
215 errorMsg =
"Unsupported format version specified"_L1;
220 if (parser.
isSet(nameOption))
222 if (parser.
isSet(rootOption)) {
225 errorMsg =
"Root must start with a /"_L1;
228 if (parser.
isSet(compressionAlgoOption))
230 if (parser.
isSet(noZstdOption))
233 if (formatVersion < 3)
234 errorMsg =
"Zstandard compression requires format version 3 or higher"_L1;
236 errorMsg =
"--compression-algo=zstd and --no-zstd both specified."_L1;
238 if (parser.
isSet(nocompressOption))
240 if (parser.
isSet(compressOption) && errorMsg.
isEmpty()) {
244 if (parser.
isSet(thresholdOption))
246 if (parser.
isSet(binaryOption))
248 if (parser.
isSet(generatorOption)) {
250 if (
value ==
"cpp"_L1) {
252 }
else if (
value ==
"python"_L1) {
254 }
else if (
value ==
"python2"_L1) {
255 qWarning(
"Format python2 is no longer supported, defaulting to python.");
258 errorMsg =
"Invalid generator: "_L1 +
value;
262 if (parser.
isSet(passOption)) {
263 if (parser.
value(passOption) ==
"1"_L1)
265 else if (parser.
value(passOption) ==
"2"_L1)
268 errorMsg =
"Pass number must be 1 or 2"_L1;
270 if (parser.
isSet(namespaceOption))
272 if (parser.
isSet(verboseOption))
275 const bool list = parser.
isSet(listOption);
276 const bool map = parser.
isSet(mapOption);
277 const bool projectRequested = parser.
isSet(projectOption);
293 if (projectRequested) {
297 if (filenamesIn.isEmpty())
301 fprintf(stderr,
"%s: %s\n", argv[0],
qPrintable(errorMsg));
309 errorDevice.
write(
"Qt resource compiler\n");
320 switch (library.
format()) {
333 if (outFilename.
isEmpty() || outFilename ==
"-"_L1) {
337 _setmode(_fileno(stdout), _O_BINARY);
346 out.setFileName(outFilename);
349 .
arg(outFilename,
out.errorString());
358 for (
int i = 0;
i <
data.size(); ++
i) {
381 if (outFilename.
isEmpty() || outFilename ==
"-"_L1) {
403 .
arg(tempFilename,
out.errorString());
408 bool success = library.
output(
out, temp, errorDevice);
419int main(
int argc,
char *argv[])
The QCommandLineOption class defines a possible command-line option. \inmodule QtCore.
void setDescription(const QString &description)
Sets the description used for this option to description.
void setValueName(const QString &name)
Sets the name of the expected value, for the documentation, to valueName.
The QCommandLineParser class provides a means for handling the command line options.
QString value(const QString &name) const
Returns the option value found for the given option name optionName, or an empty string if not found.
void addPositionalArgument(const QString &name, const QString &description, const QString &syntax=QString())
Defines an additional argument to the application, for the benefit of the help text.
QStringList positionalArguments() const
Returns a list of positional arguments.
void setSingleDashWordOptionMode(SingleDashWordOptionMode parsingMode)
Sets the parsing mode to singleDashWordOptionMode.
void setApplicationDescription(const QString &description)
Sets the application description shown by helpText().
bool addOption(const QCommandLineOption &commandLineOption)
Adds the option option to look for while parsing.
Q_NORETURN void showHelp(int exitCode=0)
Displays the help information, and exits the application.
bool isSet(const QString &name) const
Checks whether the option name was passed to the application.
void process(const QStringList &arguments)
Processes the command line arguments.
QCommandLineOption addVersionOption()
Adds the {-v} / {–version} option, which displays the version string of the application.
QCommandLineOption addHelpOption()
Adds help options to the command-line parser.
static void setApplicationVersion(const QString &version)
QString dirName() const
Returns the name of the directory; this is not the same as the path, e.g.
static QDir current()
Returns the application's current directory.
static QString cleanPath(const QString &path)
Returns path with directory separators normalized (that is, platform-native separators converted to "...
void close() override
Calls QFileDevice::flush() and closes the file.
\inmodule QtCore \reentrant
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
void setFileName(const QString &name)
Sets the name of the file.
QString fileName() const override
Returns the name set by setFileName() or to the QFile constructors.
bool exists() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore \reentrant
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QString errorString() const
Returns a human-readable description of the last device error that occurred.
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
uint toUInt(bool *ok=nullptr, int base=10) const
Returns the string converted to an {unsigned int} using base base, which is 10 by default and must be...
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString arg(qlonglong a, int fieldwidth=0, int base=10, QChar fillChar=u' ') const
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QByteArray toUtf8() const &
ResourceDataFileMap resourceDataFileMap() const
bool readFiles(bool listMode, QIODevice &errorDevice)
QStringList dataFiles() const
void setResourceRoot(const QString &root)
static int parseCompressionLevel(CompressionAlgorithm algo, const QString &level, QString *errorMsg)
bool useNameSpace() const
bool output(QIODevice &outDevice, QIODevice &tempDevice, QIODevice &errorDevice)
void setInitName(const QString &name)
void setCompressionAlgorithm(CompressionAlgorithm algo)
void setCompressThreshold(int t)
CompressionAlgorithm compressionAlgorithm() const
void setCompressLevel(int c)
QString resourceRoot() const
void setUseNameSpace(bool v)
void setInputFiles(const QStringList &files)
static CompressionAlgorithm parseCompressionAlgorithm(QStringView algo, QString *errorMsg)
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLuint GLint level
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define qPrintable(string)
#define QStringLiteral(str)
void dumpRecursive(const QDir &dir, QTextStream &out)
int runRcc(int argc, char *argv[])
void writeDepFile(QIODevice &iodev, const QStringList &depsList, const QString &targetName)
QString makefileEscape(const QString &filepath)
int createProject(const QString &outFileName)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
QTextStream out(stdout)
[7]
QApplication app(argc, argv)
[0]
static Q_CORE_EXPORT void setDeterministicGlobalSeed()
\threadsafe