mirror of
https://github.com/ModOrganizer2/modorganizer.git
synced 2025-12-28 06:34:38 +00:00
Switch VersionInfo -> Version for ModOrganizer2. (#2063)
Some checks are pending
Lint ModOrganizer 2 / lint (push) Waiting to run
Some checks are pending
Lint ModOrganizer 2 / lint (push) Waiting to run
This commit is contained in:
parent
d15a9db4aa
commit
b7e30e20d8
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -24,8 +24,8 @@ jobs:
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: 6.7.0
|
||||
modules:
|
||||
version: 6.7.1
|
||||
modules: qtpositioning qtwebchannel qtwebengine qtwebsockets
|
||||
cache: true
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -1081,7 +1081,7 @@ std::wstring safeVersion()
|
||||
{
|
||||
try {
|
||||
// this can throw
|
||||
return MOShared::createVersionInfo().displayString(3).toStdWString() + L"-";
|
||||
return MOShared::createVersionInfo().string().toStdWString() + L"-";
|
||||
} catch (...) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -639,9 +639,10 @@ MainWindow::~MainWindow()
|
||||
void MainWindow::updateWindowTitle(const APIUserAccount& user)
|
||||
{
|
||||
//"\xe2\x80\x93" is an "em dash", a longer "-"
|
||||
QString title = QString("%1 \xe2\x80\x93 Mod Organizer v%2")
|
||||
.arg(m_OrganizerCore.managedGame()->displayGameName(),
|
||||
m_OrganizerCore.getVersion().displayString(3));
|
||||
QString title =
|
||||
QString("%1 \xe2\x80\x93 Mod Organizer v%2")
|
||||
.arg(m_OrganizerCore.managedGame()->displayGameName(),
|
||||
m_OrganizerCore.getVersion().string(Version::FormatCondensed));
|
||||
|
||||
if (!user.name().isEmpty()) {
|
||||
const QString premium = (user.type() == APIUserAccountTypes::Premium ? "*" : "");
|
||||
@ -1039,7 +1040,8 @@ void MainWindow::checkForProblemsImpl()
|
||||
|
||||
void MainWindow::about()
|
||||
{
|
||||
AboutDialog(m_OrganizerCore.getVersion().displayString(3), this).exec();
|
||||
AboutDialog(m_OrganizerCore.getVersion().string(Version::FormatCondensed), this)
|
||||
.exec();
|
||||
}
|
||||
|
||||
void MainWindow::createEndorseMenu()
|
||||
@ -2163,8 +2165,9 @@ void MainWindow::processUpdates()
|
||||
auto& settings = m_OrganizerCore.settings();
|
||||
const auto earliest = QVersionNumber::fromString("2.1.2").normalized();
|
||||
|
||||
const auto lastVersion = settings.version().value_or(earliest);
|
||||
const auto currentVersion = m_OrganizerCore.getVersion().asQVersionNumber();
|
||||
const auto lastVersion = settings.version().value_or(earliest);
|
||||
const auto currentVersion =
|
||||
QVersionNumber::fromString(m_OrganizerCore.getVersion().string()).normalized();
|
||||
|
||||
m_LastVersion = lastVersion;
|
||||
|
||||
@ -2967,8 +2970,7 @@ void MainWindow::actionEndorseMO()
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
NexusInterface::instance().requestToggleEndorsement(
|
||||
game->gameShortName(), game->nexusModOrganizerID(),
|
||||
m_OrganizerCore.getVersion().canonicalString(), true, this, QVariant(),
|
||||
QString());
|
||||
m_OrganizerCore.getVersion().string(), true, this, QVariant(), QString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2989,8 +2991,7 @@ void MainWindow::actionWontEndorseMO()
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
NexusInterface::instance().requestToggleEndorsement(
|
||||
game->gameShortName(), game->nexusModOrganizerID(),
|
||||
m_OrganizerCore.getVersion().canonicalString(), false, this, QVariant(),
|
||||
QString());
|
||||
m_OrganizerCore.getVersion().string(), false, this, QVariant(), QString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -203,8 +203,8 @@ int MOApplication::setup(MOMultiProcess& multiProcess, bool forceSelect)
|
||||
log::debug("command line: '{}'", QString::fromWCharArray(GetCommandLineW()));
|
||||
|
||||
log::info("starting Mod Organizer version {} revision {} in {}, usvfs: {}",
|
||||
createVersionInfo().displayString(3), GITID,
|
||||
QCoreApplication::applicationDirPath(), MOShared::getUsvfsVersionString());
|
||||
createVersionInfo().string(), GITID, QCoreApplication::applicationDirPath(),
|
||||
MOShared::getUsvfsVersionString());
|
||||
|
||||
if (multiProcess.secondary()) {
|
||||
log::debug("another instance of MO is running but --multiple was given");
|
||||
|
||||
@ -732,7 +732,7 @@ public: // Methods after this do not come from IModInterface:
|
||||
*
|
||||
* @note Currently, this changes the color of the cell under the "Notes" column.
|
||||
*/
|
||||
virtual void setColor(QColor color) {}
|
||||
virtual void setColor([[maybe_unused]] QColor color) {}
|
||||
|
||||
/**
|
||||
* @brief Adds the information that a file has been installed into this mod.
|
||||
|
||||
@ -274,9 +274,8 @@ NexusInterface::NexusInterface(Settings* s) : m_PluginContainer(nullptr)
|
||||
g_instance = this;
|
||||
|
||||
m_User.limits(defaultAPILimits());
|
||||
m_MOVersion = createVersionInfo();
|
||||
|
||||
m_AccessManager = new NXMAccessManager(this, s, m_MOVersion.displayString(3));
|
||||
m_AccessManager = new NXMAccessManager(this, s, createVersionInfo().string());
|
||||
|
||||
m_DiskCache = new QNetworkDiskCache(this);
|
||||
|
||||
|
||||
@ -681,7 +681,6 @@ private:
|
||||
NXMAccessManager* m_AccessManager;
|
||||
std::list<NXMRequestInfo> m_ActiveRequest;
|
||||
QQueue<NXMRequestInfo> m_RequestQueue;
|
||||
MOBase::VersionInfo m_MOVersion;
|
||||
PluginContainer* m_PluginContainer;
|
||||
APIUserAccount m_User;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -646,7 +646,7 @@ QString OrganizerCore::modsPath() const
|
||||
return QDir::fromNativeSeparators(m_Settings.paths().mods());
|
||||
}
|
||||
|
||||
MOBase::VersionInfo OrganizerCore::appVersion() const
|
||||
MOBase::Version OrganizerCore::version() const
|
||||
{
|
||||
return m_Updater.getVersion();
|
||||
}
|
||||
|
||||
@ -1,30 +1,6 @@
|
||||
#ifndef ORGANIZERCORE_H
|
||||
#define ORGANIZERCORE_H
|
||||
|
||||
#include "downloadmanager.h"
|
||||
#include "envdump.h"
|
||||
#include "executableinfo.h"
|
||||
#include "executableslist.h"
|
||||
#include "guessedvalue.h"
|
||||
#include "installationmanager.h"
|
||||
#include "memoizedlock.h"
|
||||
#include "moddatacontent.h"
|
||||
#include "modinfo.h"
|
||||
#include "modlist.h"
|
||||
#include "moshortcut.h"
|
||||
#include "pluginlist.h"
|
||||
#include "processrunner.h"
|
||||
#include "selfupdater.h"
|
||||
#include "settings.h"
|
||||
#include "uilocker.h"
|
||||
#include "usvfsconnector.h"
|
||||
#include <boost/signals2.hpp>
|
||||
#include <delayedfilewriter.h>
|
||||
#include <imoinfo.h>
|
||||
#include <iplugindiagnose.h>
|
||||
#include <log.h>
|
||||
#include <versioninfo.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QList>
|
||||
@ -35,6 +11,32 @@
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
#include <uibase/delayedfilewriter.h>
|
||||
#include <uibase/executableinfo.h>
|
||||
#include <uibase/game_features/moddatacontent.h>
|
||||
#include <uibase/guessedvalue.h>
|
||||
#include <uibase/imoinfo.h>
|
||||
#include <uibase/iplugindiagnose.h>
|
||||
#include <uibase/log.h>
|
||||
#include <uibase/memoizedlock.h>
|
||||
#include <uibase/versioning.h>
|
||||
|
||||
#include "downloadmanager.h"
|
||||
#include "envdump.h"
|
||||
#include "executableslist.h"
|
||||
#include "installationmanager.h"
|
||||
#include "modinfo.h"
|
||||
#include "modlist.h"
|
||||
#include "moshortcut.h"
|
||||
#include "pluginlist.h"
|
||||
#include "processrunner.h"
|
||||
#include "selfupdater.h"
|
||||
#include "settings.h"
|
||||
#include "uilocker.h"
|
||||
#include "usvfsconnector.h"
|
||||
|
||||
class ModListSortProxy;
|
||||
class PluginListSortProxy;
|
||||
class Profile;
|
||||
@ -270,7 +272,7 @@ public:
|
||||
|
||||
std::vector<QString> enabledArchives();
|
||||
|
||||
MOBase::VersionInfo getVersion() const { return m_Updater.getVersion(); }
|
||||
MOBase::Version getVersion() const { return m_Updater.getVersion(); }
|
||||
|
||||
// return the plugin container
|
||||
//
|
||||
@ -358,7 +360,7 @@ public:
|
||||
QString overwritePath() const;
|
||||
QString basePath() const;
|
||||
QString modsPath() const;
|
||||
MOBase::VersionInfo appVersion() const;
|
||||
MOBase::Version version() const;
|
||||
MOBase::IPluginGame* getGame(const QString& gameName) const;
|
||||
MOBase::IModInterface* createMod(MOBase::GuessedValue<QString>& name);
|
||||
void modDataChanged(MOBase::IModInterface* mod);
|
||||
|
||||
@ -114,9 +114,53 @@ QString OrganizerProxy::modsPath() const
|
||||
return m_Proxied->modsPath();
|
||||
}
|
||||
|
||||
Version OrganizerProxy::version() const
|
||||
{
|
||||
return m_Proxied->version();
|
||||
}
|
||||
|
||||
VersionInfo OrganizerProxy::appVersion() const
|
||||
{
|
||||
return m_Proxied->appVersion();
|
||||
const auto version = m_Proxied->version();
|
||||
const int major = version.major(), minor = version.minor(),
|
||||
subminor = version.patch();
|
||||
int subsubminor = 0;
|
||||
VersionInfo::ReleaseType infoReleaseType = VersionInfo::RELEASE_FINAL;
|
||||
|
||||
// make a copy
|
||||
auto prereleases = version.preReleases();
|
||||
|
||||
if (!prereleases.empty()) {
|
||||
// check if the first pre-release entry is a number
|
||||
if (prereleases.front().index() == 0) {
|
||||
subsubminor = std::get<int>(prereleases.front());
|
||||
prereleases.erase(prereleases.begin());
|
||||
}
|
||||
|
||||
if (!prereleases.empty()) {
|
||||
const auto releaseType = std::get<Version::ReleaseType>(prereleases.front());
|
||||
switch (releaseType) {
|
||||
case Version::Development:
|
||||
infoReleaseType = VersionInfo::RELEASE_PREALPHA;
|
||||
break;
|
||||
case Version::Alpha:
|
||||
infoReleaseType = VersionInfo::RELEASE_ALPHA;
|
||||
break;
|
||||
case Version::Beta:
|
||||
infoReleaseType = VersionInfo::RELEASE_BETA;
|
||||
break;
|
||||
case Version::ReleaseCandidate:
|
||||
infoReleaseType = VersionInfo::RELEASE_CANDIDATE;
|
||||
break;
|
||||
default:
|
||||
infoReleaseType = VersionInfo::RELEASE_PREALPHA;
|
||||
}
|
||||
}
|
||||
|
||||
// there is no way to differentiate two pre-releases?
|
||||
}
|
||||
|
||||
return VersionInfo(major, minor, subminor, subsubminor, infoReleaseType);
|
||||
}
|
||||
|
||||
IPluginGame* OrganizerProxy::getGame(const QString& gameName) const
|
||||
|
||||
@ -29,69 +29,67 @@ public:
|
||||
MOBase::IPlugin* plugin() const { return m_Plugin; }
|
||||
|
||||
public: // IOrganizer interface
|
||||
virtual MOBase::IModRepositoryBridge* createNexusBridge() const;
|
||||
virtual QString profileName() const;
|
||||
virtual QString profilePath() const;
|
||||
virtual QString downloadsPath() const;
|
||||
virtual QString overwritePath() const;
|
||||
virtual QString basePath() const;
|
||||
virtual QString modsPath() const;
|
||||
virtual MOBase::VersionInfo appVersion() const;
|
||||
virtual MOBase::IPluginGame* getGame(const QString& gameName) const;
|
||||
virtual MOBase::IModInterface* createMod(MOBase::GuessedValue<QString>& name);
|
||||
virtual void modDataChanged(MOBase::IModInterface* mod);
|
||||
virtual QVariant persistent(const QString& pluginName, const QString& key,
|
||||
const QVariant& def = QVariant()) const;
|
||||
virtual void setPersistent(const QString& pluginName, const QString& key,
|
||||
const QVariant& value, bool sync = true);
|
||||
virtual QString pluginDataPath() const;
|
||||
virtual MOBase::IModInterface* installMod(const QString& fileName,
|
||||
const QString& nameSuggestion = QString());
|
||||
virtual QString resolvePath(const QString& fileName) const;
|
||||
virtual QStringList listDirectories(const QString& directoryName) const;
|
||||
virtual QStringList
|
||||
MOBase::IModRepositoryBridge* createNexusBridge() const override;
|
||||
QString profileName() const override;
|
||||
QString profilePath() const override;
|
||||
QString downloadsPath() const override;
|
||||
QString overwritePath() const override;
|
||||
QString basePath() const override;
|
||||
QString modsPath() const override;
|
||||
MOBase::Version version() const override;
|
||||
MOBase::VersionInfo appVersion() const override;
|
||||
MOBase::IPluginGame* getGame(const QString& gameName) const override;
|
||||
MOBase::IModInterface* createMod(MOBase::GuessedValue<QString>& name) override;
|
||||
void modDataChanged(MOBase::IModInterface* mod) override;
|
||||
QVariant persistent(const QString& pluginName, const QString& key,
|
||||
const QVariant& def = QVariant()) const override;
|
||||
void setPersistent(const QString& pluginName, const QString& key,
|
||||
const QVariant& value, bool sync = true) override;
|
||||
QString pluginDataPath() const override;
|
||||
MOBase::IModInterface* installMod(const QString& fileName,
|
||||
const QString& nameSuggestion = QString());
|
||||
QString resolvePath(const QString& fileName) const override;
|
||||
QStringList listDirectories(const QString& directoryName) const override;
|
||||
QStringList
|
||||
findFiles(const QString& path,
|
||||
const std::function<bool(const QString&)>& filter) const override;
|
||||
virtual QStringList findFiles(const QString& path,
|
||||
const QStringList& globFilters) const override;
|
||||
virtual QStringList getFileOrigins(const QString& fileName) const override;
|
||||
virtual QList<FileInfo>
|
||||
QStringList findFiles(const QString& path,
|
||||
const QStringList& globFilters) const override;
|
||||
QStringList getFileOrigins(const QString& fileName) const override;
|
||||
QList<FileInfo>
|
||||
findFileInfos(const QString& path,
|
||||
const std::function<bool(const FileInfo&)>& filter) const override;
|
||||
virtual std::shared_ptr<const MOBase::IFileTree> virtualFileTree() const override;
|
||||
std::shared_ptr<const MOBase::IFileTree> virtualFileTree() const override;
|
||||
|
||||
virtual MOBase::IDownloadManager* downloadManager() const override;
|
||||
virtual MOBase::IPluginList* pluginList() const override;
|
||||
virtual MOBase::IModList* modList() const override;
|
||||
virtual MOBase::IProfile* profile() const override;
|
||||
virtual MOBase::IGameFeatures* gameFeatures() const override;
|
||||
MOBase::IDownloadManager* downloadManager() const override;
|
||||
MOBase::IPluginList* pluginList() const override;
|
||||
MOBase::IModList* modList() const override;
|
||||
MOBase::IProfile* profile() const override;
|
||||
MOBase::IGameFeatures* gameFeatures() const override;
|
||||
|
||||
virtual HANDLE startApplication(const QString& executable,
|
||||
const QStringList& args = QStringList(),
|
||||
const QString& cwd = "", const QString& profile = "",
|
||||
const QString& forcedCustomOverwrite = "",
|
||||
bool ignoreCustomOverwrite = false);
|
||||
virtual bool waitForApplication(HANDLE handle, bool refresh = true,
|
||||
LPDWORD exitCode = nullptr) const;
|
||||
virtual void refresh(bool saveChanges);
|
||||
HANDLE startApplication(const QString& executable,
|
||||
const QStringList& args = QStringList(),
|
||||
const QString& cwd = "", const QString& profile = "",
|
||||
const QString& forcedCustomOverwrite = "",
|
||||
bool ignoreCustomOverwrite = false) override;
|
||||
bool waitForApplication(HANDLE handle, bool refresh = true,
|
||||
LPDWORD exitCode = nullptr) const override;
|
||||
void refresh(bool saveChanges) override;
|
||||
|
||||
virtual bool onAboutToRun(const std::function<bool(const QString&)>& func) override;
|
||||
virtual bool onAboutToRun(const std::function<bool(const QString&, const QDir&,
|
||||
const QString&)>& func) override;
|
||||
virtual bool
|
||||
bool onAboutToRun(const std::function<bool(const QString&)>& func) override;
|
||||
bool onAboutToRun(const std::function<bool(const QString&, const QDir&,
|
||||
const QString&)>& func) override;
|
||||
bool
|
||||
onFinishedRun(const std::function<void(const QString&, unsigned int)>& func) override;
|
||||
virtual bool
|
||||
bool
|
||||
onUserInterfaceInitialized(std::function<void(QMainWindow*)> const& func) override;
|
||||
virtual bool onNextRefresh(const std::function<void()>& func,
|
||||
bool immediateIfPossible) override;
|
||||
virtual bool
|
||||
onProfileCreated(std::function<void(MOBase::IProfile*)> const& func) override;
|
||||
virtual bool onProfileRenamed(
|
||||
std::function<void(MOBase::IProfile*, QString const&, QString const&)> const&
|
||||
func) override;
|
||||
virtual bool
|
||||
onProfileRemoved(std::function<void(QString const&)> const& func) override;
|
||||
virtual bool onProfileChanged(
|
||||
bool onNextRefresh(const std::function<void()>& func,
|
||||
bool immediateIfPossible) override;
|
||||
bool onProfileCreated(std::function<void(MOBase::IProfile*)> const& func) override;
|
||||
bool onProfileRenamed(std::function<void(MOBase::IProfile*, QString const&,
|
||||
QString const&)> const& func) override;
|
||||
bool onProfileRemoved(std::function<void(QString const&)> const& func) override;
|
||||
bool onProfileChanged(
|
||||
std::function<void(MOBase::IProfile*, MOBase::IProfile*)> const& func) override;
|
||||
|
||||
// Plugin related:
|
||||
|
||||
@ -69,10 +69,9 @@ using namespace MOBase;
|
||||
using namespace MOShared;
|
||||
|
||||
SelfUpdater::SelfUpdater(NexusInterface* nexusInterface)
|
||||
: m_Parent(nullptr), m_Interface(nexusInterface), m_Reply(nullptr), m_Attempts(3)
|
||||
{
|
||||
m_MOVersion = createVersionInfo();
|
||||
}
|
||||
: m_Parent(nullptr), m_MOVersion(createVersionInfo()), m_Interface(nexusInterface),
|
||||
m_Reply(nullptr), m_Attempts(3)
|
||||
{}
|
||||
|
||||
SelfUpdater::~SelfUpdater() {}
|
||||
|
||||
@ -115,7 +114,8 @@ void SelfUpdater::testForUpdate(const Settings& settings)
|
||||
QJsonObject release = releaseVal.toObject();
|
||||
if (!release["draft"].toBool() && (Settings::instance().usePrereleases() ||
|
||||
!release["prerelease"].toBool())) {
|
||||
auto version = VersionInfo(release["tag_name"].toString());
|
||||
auto version = Version::parse(release["tag_name"].toString(),
|
||||
Version::ParseMode::MO2);
|
||||
mreleases[version] = release;
|
||||
}
|
||||
}
|
||||
@ -132,14 +132,13 @@ void SelfUpdater::testForUpdate(const Settings& settings)
|
||||
m_UpdateCandidates.insert(p);
|
||||
}
|
||||
}
|
||||
log::info("update available: {} -> {}",
|
||||
this->m_MOVersion.displayString(3), lastKey.displayString(3));
|
||||
log::info("update available: {} -> {}", this->m_MOVersion, lastKey);
|
||||
emit updateAvailable();
|
||||
} else if (lastKey < this->m_MOVersion) {
|
||||
// this could happen if the user switches from using prereleases to
|
||||
// stable builds. Should we downgrade?
|
||||
log::debug("This version is newer than the latest released one: {} -> {}",
|
||||
this->m_MOVersion.displayString(3), lastKey.displayString(3));
|
||||
this->m_MOVersion, lastKey);
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -158,7 +157,7 @@ void SelfUpdater::startUpdate()
|
||||
auto latestRelease = m_UpdateCandidates.begin()->second;
|
||||
|
||||
UpdateDialog dialog(m_Parent);
|
||||
dialog.setVersions(MOShared::createVersionInfo().displayString(3),
|
||||
dialog.setVersions(MOShared::createVersionInfo().string(),
|
||||
latestRelease["tag_name"].toString());
|
||||
|
||||
// We concatenate release details. We only include pre-release if those are
|
||||
|
||||
@ -22,8 +22,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <uibase/versioninfo.h>
|
||||
|
||||
class Archive;
|
||||
class NexusInterface;
|
||||
class PluginContainer;
|
||||
@ -42,6 +40,8 @@ class QNetworkReply;
|
||||
class QProgressDialog;
|
||||
class Settings;
|
||||
|
||||
#include <uibase/versioning.h>
|
||||
|
||||
#include "github.h"
|
||||
|
||||
/**
|
||||
@ -99,7 +99,7 @@ public:
|
||||
/**
|
||||
* @return current version of Mod Organizer
|
||||
**/
|
||||
MOBase::VersionInfo getVersion() const { return m_MOVersion; }
|
||||
MOBase::Version getVersion() const { return m_MOVersion; }
|
||||
|
||||
signals:
|
||||
|
||||
@ -135,7 +135,7 @@ private slots:
|
||||
|
||||
private:
|
||||
QWidget* m_Parent;
|
||||
MOBase::VersionInfo m_MOVersion;
|
||||
MOBase::Version m_MOVersion;
|
||||
NexusInterface* m_Interface;
|
||||
QFile m_UpdateFile;
|
||||
QNetworkReply* m_Reply;
|
||||
@ -147,7 +147,7 @@ private:
|
||||
|
||||
// Map from version to release, in decreasing order (first element is the latest
|
||||
// release):
|
||||
using CandidatesMap = std::map<MOBase::VersionInfo, QJsonObject, std::greater<>>;
|
||||
using CandidatesMap = std::map<MOBase::Version, QJsonObject, std::greater<>>;
|
||||
CandidatesMap m_UpdateCandidates;
|
||||
};
|
||||
|
||||
|
||||
@ -111,7 +111,7 @@ void GeneralSettingsTab::addLanguages()
|
||||
|
||||
QString languageString = QString("%1 (%2)")
|
||||
.arg(locale.nativeLanguageName())
|
||||
.arg(locale.nativeCountryName());
|
||||
.arg(locale.nativeTerritoryName());
|
||||
|
||||
if (locale.language() == QLocale::Chinese) {
|
||||
if (languageCode == "zh_TW") {
|
||||
|
||||
@ -208,10 +208,12 @@ std::wstring GetFileVersionString(const std::wstring& fileName)
|
||||
}
|
||||
}
|
||||
|
||||
VersionInfo createVersionInfo()
|
||||
Version createVersionInfo()
|
||||
{
|
||||
VS_FIXEDFILEINFO version = GetFileVersion(env::thisProcessPath().native());
|
||||
|
||||
std::optional<Version::ReleaseType> releaseType;
|
||||
|
||||
if (version.dwFileFlags & VS_FF_PRERELEASE) {
|
||||
// Pre-release builds need annotating
|
||||
QString versionString =
|
||||
@ -227,21 +229,29 @@ VersionInfo createVersionInfo()
|
||||
}
|
||||
}
|
||||
|
||||
if (noLetters) {
|
||||
// Default to pre-alpha when release type is unspecified
|
||||
return VersionInfo(
|
||||
version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF,
|
||||
version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF,
|
||||
VersionInfo::RELEASE_PREALPHA);
|
||||
} else {
|
||||
// Trust the string to make sense
|
||||
return VersionInfo(versionString);
|
||||
if (!noLetters) {
|
||||
// trust the string to make sense
|
||||
return Version::parse(versionString, Version::ParseMode::MO2);
|
||||
}
|
||||
|
||||
if (noLetters) {
|
||||
// default to development when release type is unspecified
|
||||
releaseType = Version::Development;
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
// Non-pre-release builds just need their version numbers reading
|
||||
return VersionInfo(version.dwFileVersionMS >> 16, version.dwFileVersionMS & 0xFFFF,
|
||||
version.dwFileVersionLS >> 16, version.dwFileVersionLS & 0xFFFF);
|
||||
}
|
||||
|
||||
const int major = version.dwFileVersionMS >> 16,
|
||||
minor = version.dwFileVersionMS & 0xFFFF,
|
||||
patch = version.dwFileVersionLS >> 16,
|
||||
subpatch = version.dwFileVersionLS & 0xFFFF;
|
||||
|
||||
std::vector<std::variant<int, Version::ReleaseType>> prereleases;
|
||||
if (releaseType) {
|
||||
prereleases.push_back(*releaseType);
|
||||
}
|
||||
|
||||
return Version(major, minor, patch, subpatch, std::move(prereleases));
|
||||
}
|
||||
|
||||
QString getUsvfsDLLVersion()
|
||||
|
||||
@ -21,9 +21,10 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define UTIL_H
|
||||
|
||||
#include <filesystem>
|
||||
#include <log.h>
|
||||
#include <string>
|
||||
#include <versioninfo.h>
|
||||
|
||||
#include <uibase/log.h>
|
||||
#include <uibase/versioning.h>
|
||||
|
||||
class Executable;
|
||||
|
||||
@ -48,7 +49,7 @@ std::wstring ToLowerCopy(std::wstring_view text);
|
||||
|
||||
bool CaseInsensitiveEqual(const std::wstring& lhs, const std::wstring& rhs);
|
||||
|
||||
MOBase::VersionInfo createVersionInfo();
|
||||
MOBase::Version createVersionInfo();
|
||||
QString getUsvfsVersionString();
|
||||
|
||||
void SetThisThreadName(const QString& s);
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
{
|
||||
"kind": "git",
|
||||
"repository": "https://github.com/ModOrganizer2/vcpkg-registry",
|
||||
"baseline": "210f6e8f6eaefd6abfdf685f7deeb6dabdc78512",
|
||||
"baseline": "a1cd2ddbf1afb836419a5f1a9f70d6378fc41df2",
|
||||
"packages": ["mo2-*", "7zip", "usvfs"]
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user