Utils: Add convenience function for generating a unique Id

Change-Id: I74516ef5077009ebcf1d47c724ca63e502729ede
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2024-07-12 11:32:14 +02:00
parent 6d4e901e5e
commit fec896e712
20 changed files with 25 additions and 36 deletions

View File

@@ -6,8 +6,6 @@
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
#include <QUuid>
namespace {
template<typename First>
void impl_option_cat(QStringList &list, const First &first)

View File

@@ -8,7 +8,6 @@
#include <utils/utilsicons.h>
#include <QFileInfo>
#include <QUuid>
namespace MesonProjectManager {
namespace Internal {
@@ -16,7 +15,7 @@ namespace Internal {
ToolTreeItem::ToolTreeItem(const QString &name)
: m_name{name}
, m_autoDetected{false}
, m_id(Utils::Id::fromString(QUuid::createUuid().toString()))
, m_id(Utils::Id::generate())
, m_unsavedChanges{true}
{
self_check();
@@ -37,7 +36,7 @@ ToolTreeItem::ToolTreeItem(const ToolTreeItem &other)
: m_name{Tr::tr("Clone of %1").arg(other.m_name)}
, m_executable{other.m_executable}
, m_autoDetected{false}
, m_id{Utils::Id::fromString(QUuid::createUuid().toString())}
, m_id{Utils::Id::generate()}
, m_unsavedChanges{true}
{
self_check();

View File

@@ -5,8 +5,6 @@
#include <utils/qtcprocess.h>
#include <QUuid>
namespace MesonProjectManager {
namespace Internal {
@@ -14,7 +12,7 @@ ToolWrapper::ToolWrapper(const QString &name, const Utils::FilePath &path, bool
: m_version(read_version(path))
, m_isValid{path.exists() && m_version.isValid}
, m_autoDetected{autoDetected}
, m_id{Utils::Id::fromString(QUuid::createUuid().toString())}
, m_id{Utils::Id::generate()}
, m_exe{path}
, m_name{name}
{}
@@ -30,7 +28,7 @@ ToolWrapper::ToolWrapper(const QString &name,
, m_exe{path}
, m_name{name}
{
QTC_ASSERT(m_id.isValid(), m_id = Utils::Id::fromString(QUuid::createUuid().toString()));
QTC_ASSERT(m_id.isValid(), m_id = Utils::Id::generate());
}
void ToolWrapper::setExe(const Utils::FilePath &newExe)