mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 00:17:23 -06:00
Implement stringable interface for Version type
This commit is contained in:
@@ -232,7 +232,7 @@ void SearchPluginManager::installPlugin_impl(const QString &name, const Path &pa
|
||||
const PluginInfo *plugin = pluginInfo(name);
|
||||
if (plugin && !(plugin->version < newVersion))
|
||||
{
|
||||
LogMsg(tr("Plugin already at version %1, which is greater than %2").arg(plugin->version, newVersion), Log::INFO);
|
||||
LogMsg(tr("Plugin already at version %1, which is greater than %2").arg(plugin->version.toString(), newVersion.toString()), Log::INFO);
|
||||
emit pluginUpdateFailed(name, tr("A more recent version of this plugin is already installed."));
|
||||
return;
|
||||
}
|
||||
@@ -536,7 +536,7 @@ void SearchPluginManager::parseVersionInfo(const QByteArray &info)
|
||||
++numCorrectData;
|
||||
if (isUpdateNeeded(pluginName, version))
|
||||
{
|
||||
LogMsg(tr("Plugin \"%1\" is outdated, updating to version %2").arg(pluginName, version), Log::INFO);
|
||||
LogMsg(tr("Plugin \"%1\" is outdated, updating to version %2").arg(pluginName, version.toString()), Log::INFO);
|
||||
updateInfo[pluginName] = version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace
|
||||
}
|
||||
|
||||
LogMsg(QCoreApplication::translate("Utils::ForeignApps", "Python detected, executable name: '%1', version: %2")
|
||||
.arg(info.executableName, info.version), Log::INFO);
|
||||
.arg(info.executableName, info.version.toString()), Log::INFO);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,12 @@
|
||||
|
||||
#include "base/exceptions.h"
|
||||
#include "base/global.h"
|
||||
#include "base/interfaces/istringable.h"
|
||||
|
||||
namespace Utils
|
||||
{
|
||||
template <typename T, std::size_t N, std::size_t Mandatory = N>
|
||||
class Version
|
||||
class Version final : public IStringable
|
||||
{
|
||||
static_assert(N > 0, "The number of version components may not be smaller than 1");
|
||||
static_assert(N >= Mandatory,
|
||||
@@ -108,7 +109,7 @@ namespace Utils
|
||||
return m_components.at(i);
|
||||
}
|
||||
|
||||
operator QString() const
|
||||
QString toString() const override
|
||||
{
|
||||
// find the last one non-zero component
|
||||
std::size_t lastSignificantIndex = N - 1;
|
||||
|
||||
Reference in New Issue
Block a user