| 1 | // Copyright (C) 2016 The Qt Company Ltd. |
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
| 3 | |
| 4 | #ifndef OPTION_H |
| 5 | #define OPTION_H |
| 6 | |
| 7 | #include <qstring.h> |
| 8 | #include <qdir.h> |
| 9 | |
| 10 | QT_BEGIN_NAMESPACE |
| 11 | |
| 12 | struct Option |
| 13 | { |
| 14 | enum class PythonResourceImport { |
| 15 | Default, // "import rc_file" |
| 16 | FromDot, // "from . import rc_file" |
| 17 | Absolute // "import path.rc_file" |
| 18 | }; |
| 19 | |
| 20 | unsigned int : 1; |
| 21 | unsigned int : 1; |
| 22 | unsigned int generateImplemetation : 1; |
| 23 | unsigned int generateNamespace : 1; |
| 24 | unsigned int autoConnection : 1; |
| 25 | unsigned int dependencies : 1; |
| 26 | unsigned int limitXPM_LineLength : 1; |
| 27 | unsigned int implicitIncludes: 1; |
| 28 | unsigned int idBased: 1; |
| 29 | unsigned int forceMemberFnPtrConnectionSyntax: 1; |
| 30 | unsigned int forceStringConnectionSyntax: 1; |
| 31 | unsigned int useStarImports: 1; |
| 32 | unsigned int rcPrefix: 1; // Python: Generate "rc_file" instead of "file_rc" import |
| 33 | unsigned int qtNamespace: 1; |
| 34 | |
| 35 | QString inputFile; |
| 36 | QString outputFile; |
| 37 | QString qrcOutputFile; |
| 38 | QString indent; |
| 39 | QString prefix; |
| 40 | QString postfix; |
| 41 | QString translateFunction; |
| 42 | QString includeFile; |
| 43 | QString pythonRoot; |
| 44 | |
| 45 | PythonResourceImport pythonResourceImport = PythonResourceImport::Default; |
| 46 | |
| 47 | Option() |
| 48 | : headerProtection(1), |
| 49 | copyrightHeader(1), |
| 50 | generateImplemetation(0), |
| 51 | generateNamespace(1), |
| 52 | autoConnection(1), |
| 53 | dependencies(0), |
| 54 | limitXPM_LineLength(0), |
| 55 | implicitIncludes(1), |
| 56 | idBased(0), |
| 57 | forceMemberFnPtrConnectionSyntax(0), |
| 58 | forceStringConnectionSyntax(0), |
| 59 | useStarImports(0), |
| 60 | rcPrefix(0), |
| 61 | qtNamespace(1), |
| 62 | prefix(QLatin1StringView("Ui_" )) |
| 63 | { indent.fill(c: u' ', size: 4); } |
| 64 | |
| 65 | QString messagePrefix() const |
| 66 | { |
| 67 | return inputFile.isEmpty() ? |
| 68 | QString(QLatin1StringView("stdin" )) : |
| 69 | QDir::toNativeSeparators(pathName: inputFile); |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | QT_END_NAMESPACE |
| 74 | |
| 75 | #endif // OPTION_H |
| 76 | |