| 52 | #include "icons/IconList.h" |
| 53 | |
| 54 | CopyInstanceDialog::CopyInstanceDialog(InstancePtr original, QWidget* parent) |
| 55 | : QDialog(parent), ui(new Ui::CopyInstanceDialog), m_original(original) |
| 56 | { |
| 57 | ui->setupUi(this); |
| 58 | resize(minimumSizeHint()); |
| 59 | layout()->setSizeConstraint(QLayout::SetFixedSize); |
| 60 | |
| 61 | InstIconKey = original->iconKey(); |
| 62 | ui->iconButton->setIcon(APPLICATION->icons()->getIcon(InstIconKey)); |
| 63 | ui->instNameTextBox->setText(original->name()); |
| 64 | ui->instNameTextBox->setFocus(); |
| 65 | |
| 66 | QStringList groups = APPLICATION->instances()->getGroups(); |
| 67 | groups.prepend(""); |
| 68 | ui->groupBox->addItems(groups); |
| 69 | int index = groups.indexOf(APPLICATION->instances()->getInstanceGroup(m_original->id())); |
| 70 | if (index == -1) |
| 71 | index = 0; |
| 72 | |
| 73 | ui->groupBox->setCurrentIndex(index); |
| 74 | ui->groupBox->lineEdit()->setPlaceholderText(tr("No group")); |
| 75 | ui->copySavesCheckbox->setChecked(m_selectedOptions.isCopySavesEnabled()); |
| 76 | ui->keepPlaytimeCheckbox->setChecked(m_selectedOptions.isKeepPlaytimeEnabled()); |
| 77 | ui->copyGameOptionsCheckbox->setChecked(m_selectedOptions.isCopyGameOptionsEnabled()); |
| 78 | ui->copyResPacksCheckbox->setChecked(m_selectedOptions.isCopyResourcePacksEnabled()); |
| 79 | ui->copyShaderPacksCheckbox->setChecked(m_selectedOptions.isCopyShaderPacksEnabled()); |
| 80 | ui->copyServersCheckbox->setChecked(m_selectedOptions.isCopyServersEnabled()); |
| 81 | ui->copyModsCheckbox->setChecked(m_selectedOptions.isCopyModsEnabled()); |
| 82 | ui->copyScreenshotsCheckbox->setChecked(m_selectedOptions.isCopyScreenshotsEnabled()); |
| 83 | |
| 84 | ui->symbolicLinksCheckbox->setChecked(m_selectedOptions.isUseSymLinksEnabled()); |
| 85 | ui->hardLinksCheckbox->setChecked(m_selectedOptions.isUseHardLinksEnabled()); |
| 86 | |
| 87 | ui->recursiveLinkCheckbox->setChecked(m_selectedOptions.isLinkRecursivelyEnabled()); |
| 88 | ui->dontLinkSavesCheckbox->setChecked(m_selectedOptions.isDontLinkSavesEnabled()); |
| 89 | |
| 90 | auto detectedFS = FS::statFS(m_original->instanceRoot()).fsType; |
| 91 | |
| 92 | m_cloneSupported = FS::canCloneOnFS(detectedFS); |
| 93 | m_linkSupported = FS::canLinkOnFS(detectedFS); |
| 94 | |
| 95 | if (m_cloneSupported) { |
| 96 | ui->cloneSupportedLabel->setText(tr("Reflinks are supported on %1").arg(FS::getFilesystemTypeName(detectedFS))); |
| 97 | } else { |
| 98 | ui->cloneSupportedLabel->setText(tr("Reflinks aren't supported on %1").arg(FS::getFilesystemTypeName(detectedFS))); |
| 99 | } |
| 100 | |
| 101 | #if defined(Q_OS_WIN) |
| 102 | ui->symbolicLinksCheckbox->setIcon(style()->standardIcon(QStyle::SP_VistaShield)); |
| 103 | ui->symbolicLinksCheckbox->setToolTip(tr("Use symbolic links instead of copying files.") + "\n" + |
| 104 | tr("On Windows, symbolic links may require admin permission to create.")); |
| 105 | #endif |
| 106 | |
| 107 | updateLinkOptions(); |
| 108 | updateUseCloneCheckbox(); |
| 109 | |
| 110 | auto HelpButton = ui->buttonBox->button(QDialogButtonBox::Help); |
| 111 | connect(HelpButton, &QPushButton::clicked, this, &CopyInstanceDialog::help); |
nothing calls this directly
no test coverage detected