From cfaea1ea6d5d59eac1d376a31c6f75fd8868b9a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quang=20Ng=C3=B4?= Date: Sat, 11 Jan 2025 03:59:19 +0700 Subject: [PATCH] qt_gui: Fix shortcut's name got cut off in some cases (#2116) Example: P.T. -> P --- src/qt_gui/gui_context_menus.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt_gui/gui_context_menus.h b/src/qt_gui/gui_context_menus.h index bbc84c4f..0e8675c0 100644 --- a/src/qt_gui/gui_context_menus.h +++ b/src/qt_gui/gui_context_menus.h @@ -283,7 +283,7 @@ public: #ifdef Q_OS_WIN if (createShortcutWin(linkPath, ebootPath, icoPath, exePath)) { #else - if (createShortcutLinux(linkPath, ebootPath, iconPath)) { + if (createShortcutLinux(linkPath, m_games[itemID].name, ebootPath, iconPath)) { #endif QMessageBox::information( nullptr, tr("Shortcut creation"), @@ -301,7 +301,7 @@ public: #ifdef Q_OS_WIN if (createShortcutWin(linkPath, ebootPath, iconPath, exePath)) { #else - if (createShortcutLinux(linkPath, ebootPath, iconPath)) { + if (createShortcutLinux(linkPath, m_games[itemID].name, ebootPath, iconPath)) { #endif QMessageBox::information( nullptr, tr("Shortcut creation"), @@ -510,8 +510,8 @@ private: return SUCCEEDED(hres); } #else - bool createShortcutLinux(const QString& linkPath, const QString& targetPath, - const QString& iconPath) { + bool createShortcutLinux(const QString& linkPath, const std::string& name, + const QString& targetPath, const QString& iconPath) { QFile shortcutFile(linkPath); if (!shortcutFile.open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox::critical(nullptr, "Error", @@ -522,7 +522,7 @@ private: QTextStream out(&shortcutFile); out << "[Desktop Entry]\n"; out << "Version=1.0\n"; - out << "Name=" << QFileInfo(linkPath).baseName() << "\n"; + out << "Name=" << QString::fromStdString(name) << "\n"; out << "Exec=" << QCoreApplication::applicationFilePath() << " \"" << targetPath << "\"\n"; out << "Icon=" << iconPath << "\n"; out << "Terminal=false\n";