From b7c634fd72edcb542fa3257e6a3b228e1a5c3bf0 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 19 Jun 2016 21:07:51 +0200 Subject: [PATCH] Changed: Use ID instead of index for profile and server --- .../ryzom_installer/src/operationdialog.cpp | 35 ++++++++++++------- .../ryzom_installer/src/operationdialog.h | 6 ++-- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp index 69ea6bdc2..d3626fdd5 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.cpp @@ -865,11 +865,11 @@ bool COperationDialog::createDefaultProfile() return true; } -bool COperationDialog::createClientDesktopShortcut(int profileIndex) +bool COperationDialog::createClientDesktopShortcut(const QString &profileId) { CConfigFile *config = CConfigFile::getInstance(); - const CProfile &profile = config->getProfile(profileIndex); + const CProfile &profile = config->getProfile(profileId); const CServer &server = config->getServer(profile.server); m_currentOperation = tr("Create desktop shortcut for profile %1").arg(profile.id); @@ -877,8 +877,16 @@ bool COperationDialog::createClientDesktopShortcut(int profileIndex) #ifdef Q_OS_WIN32 if (profile.desktopShortcut) { - QString shortcut = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation) + "/Ryzom.lnk"; - CreateLink(config->getProfileClientFullPath(), shortcut, QString("--profile %1 %2").arg(profile.id).arg(profile.arguments), server.getDirectory(), "Default Ryzom client"); + QString executable = profile.getClientFullPath(); + QString shortcut = profile.getClientDesktopLinkFullPath(); + QString workingDir = server.getDirectory(); + + QString arguments = QString("--profile %1").arg(profile.id); + + // append custom arguments + if (!profile.arguments.isEmpty()) arguments += QString(" %1").arg(profile.arguments); + + createLink(executable, shortcut, arguments, workingDir, profile.comments); } #endif @@ -887,11 +895,11 @@ bool COperationDialog::createClientDesktopShortcut(int profileIndex) return true; } -bool COperationDialog::createClientMenuShortcut(int profileIndex) +bool COperationDialog::createClientMenuShortcut(const QString &profileId) { CConfigFile *config = CConfigFile::getInstance(); - const CProfile &profile = config->getProfile(profileIndex); + const CProfile &profile = config->getProfile(profileId); const CServer &server = config->getServer(profile.server); m_currentOperation = tr("Create menu shortcut for profile %1").arg(profile.id); @@ -899,15 +907,16 @@ bool COperationDialog::createClientMenuShortcut(int profileIndex) #ifdef Q_OS_WIN32 if (profile.menuShortcut) { - QString path = QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation) + "/Ryzom"; + QString executable = profile.getClientFullPath(); + QString shortcut = profile.getClientMenuLinkFullPath(); + QString workingDir = server.getDirectory(); - QDir dir; + QString arguments = QString("--profile %1").arg(profile.id); - if (dir.mkpath(path)) - { - QString shortcut = path + "/Ryzom.lnk"; - CreateLink(config->getProfileClientFullPath(), shortcut, QString("--profile %1 %2").arg(profile.id).arg(profile.arguments), server.getDirectory(), "Default Ryzom client"); - } + // append custom arguments + if (!profile.arguments.isEmpty()) arguments += QString(" %1").arg(profile.arguments); + + createLink(executable, shortcut, arguments, workingDir, profile.comments); } #endif diff --git a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h index f8152718e..34a322fff 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/operationdialog.h @@ -102,8 +102,10 @@ protected: void copyInstaller(); void uninstallOldClient(); bool createDefaultProfile(); - bool createClientDesktopShortcut(int profileIndex); - bool createClientMenuShortcut(int profileIndex); + + bool createClientDesktopShortcut(const QString &profileId); + bool createClientMenuShortcut(const QString &profileId); + bool createAddRemoveEntry(); bool deleteAddRemoveEntry();