diff options
author | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-02-11 22:51:53 -0800 |
---|---|---|
committer | Rachel Powers <508861+Ryex@users.noreply.github.com> | 2023-03-20 14:56:32 -0700 |
commit | 9f441a9678f56c5fb5efbc415b3faff176609b9c (patch) | |
tree | b7ec39927ea5b48073822d0ba85c0fceee884087 | |
parent | 7870cf28e55c090543591304b05a7ef5031e1157 (diff) | |
download | PrismLauncher-9f441a9678f56c5fb5efbc415b3faff176609b9c.tar.gz PrismLauncher-9f441a9678f56c5fb5efbc415b3faff176609b9c.tar.bz2 PrismLauncher-9f441a9678f56c5fb5efbc415b3faff176609b9c.zip |
feat: Add UAC icon when symlinking on windows.
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r-- | launcher/CMakeLists.txt | 8 | ||||
-rw-r--r-- | launcher/ui/dialogs/CopyInstanceDialog.cpp | 23 | ||||
-rw-r--r-- | launcher/ui/dialogs/CopyInstanceDialog.ui | 5 |
3 files changed, 22 insertions, 14 deletions
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index dd62893c..b47f5746 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -1149,14 +1149,6 @@ if(WIN32) SET_TARGET_PROPERTIES("${Launcher_Name}_filelink" PROPERTIES INSTALL_RPATH "${Launcher_BINARY_RPATH}") endif() - # may be unnessacery with manifest - if(CMAKE_GENERATOR MATCHES "Visual Studio") - SET_TARGET_PROPERTIES("${Launcher_Name}_filelink" PROPERTIES LINK_FLAGS "/level='requireAdministrator' /uiAccess='false' /SUBSYSTEM:CONSOLE") - # else() # link arg /MANIFESTUAC only works with MSVC - # SET_TARGET_PROPERTIES("${Launcher_Name}_filelink" PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:CONSOLE") - endif() - - install(TARGETS "${Launcher_Name}_filelink" BUNDLE DESTINATION "." COMPONENT Runtime LIBRARY DESTINATION ${LIBRARY_DEST_DIR} COMPONENT Runtime diff --git a/launcher/ui/dialogs/CopyInstanceDialog.cpp b/launcher/ui/dialogs/CopyInstanceDialog.cpp index 9fe129f1..495e98e9 100644 --- a/launcher/ui/dialogs/CopyInstanceDialog.cpp +++ b/launcher/ui/dialogs/CopyInstanceDialog.cpp @@ -93,17 +93,25 @@ CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget *parent) ui->recursiveLinkCheckbox->setChecked(m_selectedOptions.isLinkRecursivelyEnabled()); ui->dontLinkSavesCheckbox->setChecked(m_selectedOptions.isDontLinkSavesEnabled()); - auto detectedOS = FS::statFS(m_original->instanceRoot()).fsType; + auto detectedFS = FS::statFS(m_original->instanceRoot()).fsType; - m_cloneSupported = FS::canCloneOnFS(detectedOS); - m_linkSupported = FS::canLinkOnFS(detectedOS); + m_cloneSupported = FS::canCloneOnFS(detectedFS); + m_linkSupported = FS::canLinkOnFS(detectedFS); if (m_cloneSupported) { - ui->cloneSupportedLabel->setText(tr("Reflinks are supported on %1").arg(FS::getFilesystemTypeName(detectedOS))); + ui->cloneSupportedLabel->setText(tr("Reflinks are supported on %1").arg(FS::getFilesystemTypeName(detectedFS))); } else { - ui->cloneSupportedLabel->setText(tr("Reflinks aren't supported on %1").arg(FS::getFilesystemTypeName(detectedOS))); + ui->cloneSupportedLabel->setText(tr("Reflinks aren't supported on %1").arg(FS::getFilesystemTypeName(detectedFS))); } +#if defined(Q_OS_WIN) + ui->symbolicLinksCheckbox->setIcon(style()->standardIcon(QStyle::SP_VistaShield)); + ui->symbolicLinksCheckbox->setToolTip( + tr("Use symbolic links instead of copying files.") + + tr("\nOn windows symbolic links may require admin permision to create.") + ); +#endif + updateLinkOptions(); updateUseCloneCheckbox(); @@ -189,6 +197,11 @@ void CopyInstanceDialog::updateLinkOptions() ui->dontLinkSavesCheckbox->setEnabled(m_linkSupported && linksInUse); ui->recursiveLinkCheckbox->setChecked(m_linkSupported && linksInUse && m_selectedOptions.isLinkRecursivelyEnabled()); ui->dontLinkSavesCheckbox->setChecked(m_linkSupported && linksInUse && m_selectedOptions.isDontLinkSavesEnabled()); + +#if defined(Q_OS_WIN) + auto OkButton = ui->buttonBox->button(QDialogButtonBox::Ok); + OkButton->setIcon(m_selectedOptions.isUseSymLinksEnabled() ? style()->standardIcon(QStyle::SP_VistaShield) : QIcon()); +#endif } void CopyInstanceDialog::on_iconButton_clicked() diff --git a/launcher/ui/dialogs/CopyInstanceDialog.ui b/launcher/ui/dialogs/CopyInstanceDialog.ui index 7bf75c2d..58442f73 100644 --- a/launcher/ui/dialogs/CopyInstanceDialog.ui +++ b/launcher/ui/dialogs/CopyInstanceDialog.ui @@ -269,7 +269,7 @@ <bool>true</bool> </property> <property name="toolTip"> - <string>Use hard links instead of symbolic links</string> + <string>Use hard links instead of symbolic links.</string> </property> <property name="text"> <string>Use hard links</string> @@ -307,6 +307,9 @@ <property name="text"> <string>Use symbloic links</string> </property> + <property name="toolTip"> + <string>Use symbolic links instead of copying files.</string> + </property> </widget> </item> </layout> |