VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/globals/UIVersion.h@ 103793

Last change on this file since 103793 was 103793, checked in by vboxsync, 7 months ago

FE/Qt: UICommon: Move versioning related functionality to UIVersion / UIVersionInfo; Rework user cases accordingly.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 KB
Line 
1/* $Id: UIVersion.h 103793 2024-03-11 19:17:31Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIVersion class declaration.
4 */
5
6/*
7 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_globals_UIVersion_h
29#define FEQT_INCLUDED_SRC_globals_UIVersion_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QString>
36
37/* GUI includes: */
38#include "UILibraryDefs.h"
39
40/** Represents VirtualBox version wrapper. */
41class UIVersion
42{
43public:
44
45 /** Constructs default object. */
46 UIVersion();
47 /** Constructs object based on parsed @a strFullVersionInfo. */
48 UIVersion(const QString &strFullVersionInfo);
49
50 /** Returns whether this object is valid. */
51 bool isValid() const;
52
53 /** Returns whether this object is equal to @a other. */
54 bool equal(const UIVersion &other) const;
55 /** Checks whether this object is equal to @a other. */
56 bool operator==(const UIVersion &other) const { return equal(other); }
57 /** Checks whether this object is NOT equal to @a other. */
58 bool operator!=(const UIVersion &other) const { return !equal(other); }
59
60 /** Checks whether this object is less than @a other. */
61 bool operator<(const UIVersion &other) const;
62 /** Checks whether this object is less or equal than @a other. */
63 bool operator<=(const UIVersion &other) const;
64 /** Checks whether this object is greater than @a other. */
65 bool operator>(const UIVersion &other) const;
66 /** Checks whether this object is greater or equal than @a other. */
67 bool operator>=(const UIVersion &other) const;
68
69 /** Returns object string representation. */
70 QString toString() const;
71
72 /** Returns the object X value. */
73 int x() const { return m_x; }
74 /** Returns the object Y value. */
75 int y() const { return m_y; }
76 /** Returns the object Z value. */
77 int z() const { return m_z; }
78 /** Returns the object postfix. */
79 QString postfix() const { return m_strPostfix; }
80
81 /** Defines the object @a x value. */
82 void setX(int x) { m_x = x; }
83 /** Defines the object @a y value. */
84 void setY(int y) { m_y = y; }
85 /** Defines the object @a z value. */
86 void setZ(int z) { m_z = z; }
87 /** Defines the object @a strPostfix. */
88 void setPostfix(const QString &strPostfix) { m_strPostfix = strPostfix; }
89
90 /** Returns effective released version guessed or hardcoded for this one version.
91 * This can be even the version itself. */
92 UIVersion effectiveReleasedVersion() const;
93
94private:
95
96 /** Holds the object X value. */
97 int m_x;
98 /** Holds the object Y value. */
99 int m_y;
100 /** Holds the object Z value. */
101 int m_z;
102
103 /** Holds the object postfix. */
104 QString m_strPostfix;
105};
106
107/** Represents VirtualBox version info interface. */
108class SHARED_LIBRARY_STUFF UIVersionInfo
109{
110public:
111
112 /** Returns Qt runtime version string. */
113 static QString qtRTVersionString();
114 /** Returns Qt runtime version. */
115 static uint qtRTVersion();
116 /** Returns Qt runtime major version. */
117 static uint qtRTMajorVersion();
118 /** Returns Qt runtime minor version. */
119 static uint qtRTMinorVersion();
120 /** Returns Qt runtime revision number. */
121 static uint qtRTRevisionNumber();
122
123 /** Returns Qt compiled version string. */
124 static QString qtCTVersionString();
125 /** Returns Qt compiled version. */
126 static uint qtCTVersion();
127
128 /** Returns VBox version string. */
129 static QString vboxVersionString();
130 /** Returns normalized VBox version string. */
131 static QString vboxVersionStringNormalized();
132 /** Returns whether VBox version string contains BETA word. */
133 static bool isBeta();
134 /** Returns whether BETA label should be shown. */
135 static bool showBetaLabel();
136
137 /** Returns whether branding is active. */
138 static bool brandingIsActive(bool fForce = false);
139 /** Returns value for certain branding @a strKey from custom.ini file. */
140 static QString brandingGetKey(QString strKey);
141
142private:
143
144 /** Constructs version info: */
145 UIVersionInfo();
146
147 /** Holds the VBox branding config file path. */
148 static QString s_strBrandingConfigFilePath;
149};
150
151#endif /* !FEQT_INCLUDED_SRC_globals_UIVersion_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette