mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 13:48:05 -06:00
@@ -52,25 +52,21 @@ namespace
|
||||
{
|
||||
bool isVersionMoreRecent(const QString &remoteVersion)
|
||||
{
|
||||
using Version = Utils::Version<int, 4, 3>;
|
||||
using Version = Utils::Version<4, 3>;
|
||||
|
||||
try
|
||||
{
|
||||
const Version newVersion {remoteVersion};
|
||||
const Version currentVersion {QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD};
|
||||
if (newVersion == currentVersion)
|
||||
{
|
||||
const bool isDevVersion = QStringLiteral(QBT_VERSION_STATUS).contains(
|
||||
QRegularExpression(u"(alpha|beta|rc)"_qs));
|
||||
if (isDevVersion)
|
||||
return true;
|
||||
}
|
||||
return (newVersion > currentVersion);
|
||||
}
|
||||
catch (const RuntimeError &)
|
||||
{
|
||||
const auto newVersion = Version::fromString(remoteVersion);
|
||||
if (!newVersion.isValid())
|
||||
return false;
|
||||
|
||||
const Version currentVersion {QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD};
|
||||
if (newVersion == currentVersion)
|
||||
{
|
||||
const bool isDevVersion = QStringLiteral(QBT_VERSION_STATUS).contains(
|
||||
QRegularExpression(u"(alpha|beta|rc)"_qs));
|
||||
if (isDevVersion)
|
||||
return true;
|
||||
}
|
||||
return (newVersion > currentVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,8 +193,8 @@ void Utils::Gui::openFolderSelect(const Path &path)
|
||||
proc.start(u"nautilus"_qs, {u"--version"_qs});
|
||||
proc.waitForFinished();
|
||||
const auto nautilusVerStr = QString::fromLocal8Bit(proc.readLine()).remove(QRegularExpression(u"[^0-9.]"_qs));
|
||||
using NautilusVersion = Utils::Version<int, 3>;
|
||||
if (NautilusVersion::tryParse(nautilusVerStr, {1, 0, 0}) > NautilusVersion {3, 28, 0})
|
||||
using NautilusVersion = Utils::Version<3>;
|
||||
if (NautilusVersion::fromString(nautilusVerStr, {1, 0, 0}) > NautilusVersion(3, 28, 0))
|
||||
proc.startDetached(u"nautilus"_qs, {(Fs::isDir(path) ? path.parentPath() : path).toString()});
|
||||
else
|
||||
proc.startDetached(u"nautilus"_qs, {u"--no-desktop"_qs, (Fs::isDir(path) ? path.parentPath() : path).toString()});
|
||||
|
||||
Reference in New Issue
Block a user