feat: Add UAC icon when symlinking on windows.

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2023-02-11 22:51:53 -08:00
parent 7870cf28e5
commit 9f441a9678
3 changed files with 22 additions and 14 deletions

View File

@ -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

View File

@ -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()

View File

@ -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>