From 6983b5c1dd82d159236ebd06cf17f071cc9c1ee9 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jan 2024 23:08:38 +0800 Subject: refactor: remove boost and use QString instead of std::filesystem::path --- src/core/module/GlobalModuleContext.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'src/core/module/GlobalModuleContext.cpp') diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index cac3dfbb..16650c96 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -28,8 +28,6 @@ #include "GlobalModuleContext.h" -#include -#include #include #include #include @@ -46,11 +44,7 @@ namespace GpgFrontend::Module { class GlobalModuleContext::Impl { public: - explicit Impl() - : random_gen_( - (boost::posix_time::microsec_clock::universal_time() - - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))) - .total_milliseconds()) { + explicit Impl() { // Initialize acquired channels with default values. acquired_channel_.insert(kGpgFrontendDefaultChannel); acquired_channel_.insert(kGpgFrontendNonAsciiChannel); @@ -299,16 +293,13 @@ class GlobalModuleContext::Impl { module_events_table_; std::set acquired_channel_; - boost::random::mt19937 random_gen_; TaskRunnerPtr default_task_runner_; auto acquire_new_unique_channel() -> int { - boost::random::uniform_int_distribution<> dist(1, 65535); - - int random_channel = dist(random_gen_); + int random_channel = QRandomGenerator::global()->bounded(65535); // Ensure the acquired channel is unique. while (acquired_channel_.find(random_channel) != acquired_channel_.end()) { - random_channel = dist(random_gen_); + random_channel = QRandomGenerator::global()->bounded(65535); } // Add the acquired channel to the set. -- cgit v1.2.3