77#include " Aliases.hpp"
88#include " Constants.hpp"
99#include " Enums.hpp"
10- #include " Logger.hpp"
1110
11+ #include < QDebug>
12+ #include < QObject>
1213#include < windows.h>
1314
1415constexpr wstring_view DEFAULT_KEY ;
@@ -59,9 +60,9 @@ inline auto setRegistryValue(
5960 );
6061
6162 if (result != ERROR_SUCCESS ) {
62- LOG_ERROR ( u " Failed to open/create registry entry: %1. Error: %2" _s
63- .arg (entry)
64- .arg (result) );
63+ qCritical () << " Failed to open/create registry entry: %1. Error: %2" _L1
64+ .arg (entry)
65+ .arg (result);
6566 return false ;
6667 }
6768
@@ -77,8 +78,9 @@ inline auto setRegistryValue(
7778 RegCloseKey (hkey);
7879
7980 if (result != ERROR_SUCCESS ) {
80- LOG_ERROR (u" Failed to set value for entry: %1. Error: %2" _s.arg (entry)
81- .arg (result));
81+ qCritical () << " Failed to set value for entry: %1. Error: %2" _L1
82+ .arg (entry)
83+ .arg (result);
8284 return false ;
8385 }
8486
@@ -90,8 +92,9 @@ inline auto removeRegistryEntry(const HKEY root, const wstring_view entry)
9092 const i32 result = RegDeleteTreeW (root, entry.data ());
9193
9294 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND ) {
93- LOG_ERROR (u" Failed to delete registry key: %1. Error: %2" _s.arg (entry)
94- .arg (result));
95+ qCritical () << " Failed to delete registry key: %1. Error: %2" _L1
96+ .arg (entry)
97+ .arg (result);
9598 return false ;
9699 }
97100
@@ -111,7 +114,9 @@ inline void updateFileAssociationsOS(
111114
112115 for (const auto [idx, ext] :
113116 views::enumerate (SUPPORTED_PLAYABLE_EXTENSIONS )) {
114- const wstring_view wextension = { ras<wcstr>(ext.utf16 ()),
117+ const QString utf16Ext = QString (ext);
118+
119+ const wstring_view wextension = { ras<wcstr>(utf16Ext.utf16 ()),
115120 usize (ext.size ()) };
116121
117122 if ((associations & Associations (1 << idx)) != Associations::None) {
@@ -267,7 +272,9 @@ inline void updateFileAssociationsPathOS(
267272
268273 for (const auto [idx, ext] :
269274 views::enumerate (SUPPORTED_PLAYABLE_EXTENSIONS )) {
270- const wstring_view wextension = { ras<wcstr>(ext.utf16 ()),
275+ const QString utf16Ext = QString (ext);
276+
277+ const wstring_view wextension = { ras<wcstr>(utf16Ext.utf16 ()),
271278 usize (ext.size ()) };
272279
273280 const wstring iconEntry = std::format (ICON_ENTRY_TEMPLATE , wextension);
@@ -338,11 +345,13 @@ inline void removeContextMenuEntryOS() {
338345
339346 for (const auto [idx, ext] :
340347 views::enumerate (SUPPORTED_PLAYABLE_EXTENSIONS )) {
348+ const QString utf16Ext = QString (ext);
349+
341350 const u32 result = RegOpenKeyExW (
342351 HKEY_CURRENT_USER ,
343352 std::format (
344353 PROG_ID_ENTRY_TEMPLATE ,
345- wstring_view (ras<wcstr>(ext .utf16 ()), ext.size ())
354+ wstring_view (ras<wcstr>(utf16Ext .utf16 ()), ext.size ())
346355 )
347356 .c_str (),
348357 0 ,
0 commit comments