Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-filedetails.h
1#ifndef QX_FILEDETAILS_H
2#define QX_FILEDETAILS_H
3
4// Shared Lib Support
5#include "qx/windows/qx_windows_export.h"
6
7// Qt Includes
8#include <QString>
9#include <QHash>
10#include <QDateTime>
11
12// Intra-component Includes
14
15// Extra-component Includes
16#include "qx/core/qx-versionnumber.h"
17
18using namespace Qt::Literals::StringLiterals;
19
20namespace Qx
21{
22
23class QX_WINDOWS_EXPORT FileDetails
24{
25//-Class Structs---------------------------------------------------------------------------------------------------------
26public:
28 {
31
32 friend QX_WINDOWS_EXPORT bool operator== (const Translation& lhs, const Translation& rhs) noexcept;
33 friend QX_WINDOWS_EXPORT size_t qHash(const Translation& key, size_t seed) noexcept;
34 };
35
53
54//-Class Members----------------------------------------------------------------------------------------------------
55private:
56 static inline const QString LANG_CODE_PAGE_QUERY = u"\\VarFileInfo\\Translation"_s;
57 static inline const QString SUB_BLOCK_BASE_TEMPLATE = u"\\StringFileInfo\\%1%2\\"_s;
58 static inline const QString ST_COMMENTS_QUERY = u"Comments"_s;
59 static inline const QString ST_COMPANY_NAME_QUERY = u"CompanyName"_s;
60 static inline const QString ST_FILE_DESCRIPTION_QUERY = u"FileDescription"_s;
61 static inline const QString ST_FILE_VERSION_QUERY = u"FileVersion"_s;
62 static inline const QString ST_INTERNAL_NAME_QUERY = u"InternalName"_s;
63 static inline const QString ST_LEGAL_COPYRIGHT_QUERY = u"LegalCopyright"_s;
64 static inline const QString ST_LEGAL_TRADEMARKS_QUERY = u"LegalTrademarks"_s;
65 static inline const QString ST_ORIGINAL_FILENAME_QUERY = u"OriginalFilename"_s;
66 static inline const QString ST_PRODUCT_NAME_QUERY = u"ProductName"_s;
67 static inline const QString ST_PRODUCT_VERSION_QUERY = u"ProductVersion"_s;
68 static inline const QString ST_PRIVATE_BUILD_QUERY = u"PrivateBuild"_s;
69 static inline const QString ST_SPECIAL_BUILD_QUERY = u"SpecialBuild"_s;
70
71//-Instance Members-------------------------------------------------------------------------------------------------
72private:
73 VersionNumber mMetaStructVersion;
74 VersionNumber mFileVersion;
75 VersionNumber mProductVersion;
76 DWORD mFileFlags;
77 DWORD mFileOs;
78 DWORD mFileType;
79 DWORD mFileSubtype;
80 QDateTime mFileDate;
81 QList<StringTable> mStringTables;
82 QHash<Translation, int> mLangCodePageMap;
83
84//-Constructor-------------------------------------------------------------------------------------------------------
85public:
87
88//-Class Functions-------------------------------------------------------------------------------------------------
89public:
90 static FileDetails readFileDetails(QString filePath);
91
92//-Instance Functions----------------------------------------------------------------------------------------------
93private:
94 void addStringTable(StringTable stringTable);
95
96public:
97 bool isNull();
98 int stringTableCount();
99 QList<Translation> availableTranslations();
100 bool hasTranslation(Translation translation);
101 VersionNumber metaStructVersion();
102
103 VersionNumber fileVersion();
104 VersionNumber productVersion();
105 DWORD fileFlags();
106 DWORD fileOs();
107 DWORD fileType();
108 DWORD fileSubType();
109 QDateTime fileDate();
110 const StringTable stringTable(int index = 0);
111 const StringTable stringTable(Translation translation);
112};
113
114}
115
116#endif // QX_FILEDETAILS_H
The FileDetails class acts as a user-friendly container for holding a file's Version Info as defined ...
Definition qx-filedetails.h:24
The VersionNumber class extends QVersionNumber to include a dedicated constructor and getter for the ...
Definition qx-versionnumber.h:14
The Qx namespace is the main namespace through which all non-global functionality of the Qx library i...
Definition qx-processwaiter.cpp:5
size_t qHash(const DownloadTask &key, size_t seed) noexcept
Definition qx-downloadtask.cpp:49
The qx-windefs header file provides a subset of Windows data types definitions.
unsigned long DWORD
Definition qx-windefs.h:4
A structure that contains all of the translation dependent optional fields of a file's details.
Definition qx-filedetails.h:37
QString specialBuild
Definition qx-filedetails.h:51
QString legalCopyright
Definition qx-filedetails.h:45
QString internalName
Definition qx-filedetails.h:44
QString fileDescription
Definition qx-filedetails.h:42
QString productName
Definition qx-filedetails.h:48
QString legalTrademarks
Definition qx-filedetails.h:46
QString companyName
Definition qx-filedetails.h:41
QString comments
Definition qx-filedetails.h:40
QString metaLanguageID
Definition qx-filedetails.h:38
QString privateBuild
Definition qx-filedetails.h:50
QString fileVersion
Definition qx-filedetails.h:43
QString metaCodePageID
Definition qx-filedetails.h:39
QString originalFilename
Definition qx-filedetails.h:47
QString productVersion
Definition qx-filedetails.h:49
A structure used to represent a particular translation of the string table section of a file's detail...
Definition qx-filedetails.h:28
QString language
Definition qx-filedetails.h:29
QString codePage
Definition qx-filedetails.h:30