From ca0d73fcf4c96249ae87ee3654e366c0807572ee Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 11 Jun 2016 17:00:09 +0200 Subject: [PATCH] Changed: Open directory containing the profile --- .../ryzom_installer/src/profilesdialog.cpp | 26 ++++++++++++++++++- .../ryzom_installer/src/profilesdialog.h | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp index e56eb0b96..8f9cbbe2d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.cpp @@ -32,6 +32,7 @@ CProfilesDialog::CProfilesDialog(QWidget *parent):QDialog(parent), m_currentProf connect(deleteButton, SIGNAL(clicked()), SLOT(onDeleteProfile())); connect(profilesListView, SIGNAL(clicked(QModelIndex)), SLOT(onProfileClicked(QModelIndex))); connect(executableBrowseButton, SIGNAL(clicked()), SLOT(onExecutableBrowseClicked())); + connect(directoryButton, SIGNAL(clicked()), SLOT(onProfileDirectoryClicked())); m_model = new CProfilesModel(this); m_serversModel = new CServersModel(this); @@ -97,6 +98,15 @@ void CProfilesDialog::displayProfile(int index) const CProfile &profile = m_model->getProfiles()[index]; + QString executable = profile.executable; + + if (executable.isEmpty()) + { + executable = CConfigFile::getInstance()->getServerClientFullPath(profile.server); + } + + QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id; + // update all widgets with content of profile profileIdLabel->setText(profile.id); nameEdit->setText(profile.name); @@ -104,10 +114,13 @@ void CProfilesDialog::displayProfile(int index) executablePathLabel->setText(QFileInfo(profile.executable).fileName()); argumentsEdit->setText(profile.arguments); commentsEdit->setPlainText(profile.comments); - directoryPathLabel->setText(CConfigFile::getInstance()->getProfileDirectory()); + directoryPathLabel->setText(profileDirectory); desktopShortcutCheckBox->setChecked(profile.desktopShortcut); menuShortcutCheckBox->setChecked(profile.menuShortcut); + // disable click on button if directory doesn't exist + directoryButton->setEnabled(QFile::exists(profileDirectory)); + updateExecutableVersion(index); m_currentProfileIndex = index; @@ -249,3 +262,14 @@ void CProfilesDialog::onExecutableBrowseClicked() updateExecutableVersion(m_currentProfileIndex); } + +void CProfilesDialog::onProfileDirectoryClicked() +{ + if (m_currentProfileIndex < 0) return; + + const CProfile &profile = m_model->getProfiles()[m_currentProfileIndex]; + + QString profileDirectory = CConfigFile::getInstance()->getProfileDirectory() + "/" + profile.id; + + QDesktopServices::openUrl(QUrl::fromLocalFile(profileDirectory)); +} diff --git a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h index 5116d0b7b..5a8c6516d 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h +++ b/code/ryzom/tools/client/ryzom_installer/src/profilesdialog.h @@ -42,6 +42,7 @@ private slots: void onAddProfile(); void onDeleteProfile(); void onProfileClicked(const QModelIndex &index); + void onProfileDirectoryClicked(); void displayProfile(int index); void saveProfile(int index);