forked from qt-creator/qt-creator
QtSupport: Warn if Link With Qt failed
When installing Qt Creator via https://download.qt.io/official_releases/qtcreator/9.0/9.0.0/ qt-creator-opensource-mac-x86_64-9.0.0.dmg The bundle is not writable / no folders can be created in it. therefor "Link With Qt" would silently fail, as the button is not disabled, even if the "canLinkWithQt()" returns false. This also adds a message box to let the user known if the linking failed. Change-Id: Ifbc5d170cf81e898eec3ab8b9f53e1a939652b42 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -872,7 +872,8 @@ static bool canLinkWithQt(QString *toolTip)
|
|||||||
void QtOptionsPageWidget::setupLinkWithQtButton()
|
void QtOptionsPageWidget::setupLinkWithQtButton()
|
||||||
{
|
{
|
||||||
QString tip;
|
QString tip;
|
||||||
canLinkWithQt(&tip);
|
const bool canLink = canLinkWithQt(&tip);
|
||||||
|
m_linkWithQtButton->setEnabled(canLink);
|
||||||
m_linkWithQtButton->setToolTip(tip);
|
m_linkWithQtButton->setToolTip(tip);
|
||||||
connect(m_linkWithQtButton, &QPushButton::clicked, this, &QtOptionsPage::linkWithQt);
|
connect(m_linkWithQtButton, &QPushButton::clicked, this, &QtOptionsPage::linkWithQt);
|
||||||
}
|
}
|
||||||
@@ -1030,8 +1031,17 @@ void QtOptionsPageWidget::linkWithQt()
|
|||||||
if (dialog.result() == QDialog::Accepted) {
|
if (dialog.result() == QDialog::Accepted) {
|
||||||
const std::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawFilePath().toString());
|
const std::optional<QString> settingsDir = settingsDirForQtDir(pathInput->rawFilePath().toString());
|
||||||
if (QTC_GUARD(settingsDir)) {
|
if (QTC_GUARD(settingsDir)) {
|
||||||
QSettings(settingsFile(Core::ICore::resourcePath().toString()), QSettings::IniFormat)
|
const QString settingsFilePath = settingsFile(Core::ICore::resourcePath().toString());
|
||||||
.setValue(kInstallSettingsKey, *settingsDir);
|
QSettings settings(settingsFilePath, QSettings::IniFormat);
|
||||||
|
settings.setValue(kInstallSettingsKey, *settingsDir);
|
||||||
|
settings.sync();
|
||||||
|
if (settings.status() == QSettings::AccessError) {
|
||||||
|
QMessageBox::critical(Core::ICore::dialogParent(),
|
||||||
|
Tr::tr("Error Linking With Qt"),
|
||||||
|
Tr::tr("Could not write to \"%1\".").arg(settingsFilePath));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
askForRestart = true;
|
askForRestart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user