diff options
author | Tobias Markmann <tm@ayena.de> | 2017-02-23 17:04:36 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2017-02-23 17:04:36 (GMT) |
commit | 8803538bc29a3b68d3c69d900f41ddd1b383cec6 (patch) | |
tree | a24165154e85ce3374298a0cb624ee5263499744 /Swift | |
parent | 8a5230c10571f7bb52967d672008ccf603391f2f (diff) | |
download | swift-8803538bc29a3b68d3c69d900f41ddd1b383cec6.zip swift-8803538bc29a3b68d3c69d900f41ddd1b383cec6.tar.bz2 |
Fix crash in Swift about dialog if build w/o auto update support
Test-Information:
Previously Swift crashed on QtAboutWidget.cpp:175 when build
without any auto update support. Now it does not anymore.
Tested on macOS 10.12.3 with Qt 5.5.1.
Change-Id: Ia58ec3679d107cfd6b736e54e90a4167cf1adc47
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtAboutWidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Swift/QtUI/QtAboutWidget.cpp b/Swift/QtUI/QtAboutWidget.cpp index 3bc124a..a2aa65c 100644 --- a/Swift/QtUI/QtAboutWidget.cpp +++ b/Swift/QtUI/QtAboutWidget.cpp @@ -125,61 +125,61 @@ void QtAboutWidget::handleChangelogClicked() { void QtAboutWidget::handleChangeUpdateChannelClicked() { auto feedSelectionDialog = new QtUpdateFeedSelectionDialog(settingsProvider_); feedSelectionDialog->show(); } void QtAboutWidget::openPlainTextWindow(const QString& path) { QTextEdit* text = new QTextEdit(); text->setAttribute(Qt::WA_DeleteOnClose); text->setReadOnly(true); QFile file(path); if (file.open(QIODevice::ReadOnly)) { QTextStream in(&file); in.setCodec("UTF-8"); text->setPlainText(in.readAll()); file.close(); text->resize(500, 600); text->show(); text->activateWindow(); } else { SWIFT_LOG(error) << "Failed to open " << Q2PSTRING(path) << "." << std::endl; } } void QtAboutWidget::updateUpdateInfo() { updateChannelInfoLabel_->hide(); updateStateInfoLabel_->hide(); updateProgressBar_->hide(); // Currently auto updating is only supported on macOS. #ifdef SWIFTEN_PLATFORM_MACOSX - if (settingsProvider_->getSetting(QtUISettingConstants::ENABLE_SOFTWARE_UPDATES)) { + if (autoUpdater_ && settingsProvider_->getSetting(QtUISettingConstants::ENABLE_SOFTWARE_UPDATES)) { if (!settingsProvider_->getSetting(QtUISettingConstants::SOFTWARE_UPDATE_CHANNEL).empty()) { QString updateFeedDescription; auto addUpdateFeedDialogLink = false; if (settingsProvider_->getSetting(QtUISettingConstants::SOFTWARE_UPDATE_CHANNEL) == UpdateFeeds::StableChannel) { updateFeedDescription = tr("You are receiving updates from the Stable update channel."); addUpdateFeedDialogLink = true; } else if (settingsProvider_->getSetting(QtUISettingConstants::SOFTWARE_UPDATE_CHANNEL) == UpdateFeeds::DevelopmentChannel) { updateFeedDescription = tr("You are receiving updates from the Development update channel."); addUpdateFeedDialogLink = true; } else if (settingsProvider_->getSetting(QtUISettingConstants::SOFTWARE_UPDATE_CHANNEL) == UpdateFeeds::TestingChannel) { updateFeedDescription = tr("You are receiving updates from the Testing update channel."); addUpdateFeedDialogLink = true; } auto updateFeedDialogLink = QString( addUpdateFeedDialogLink ? "<a href=\"#\">%1</a>" : "" ).arg(tr("Change the update channel.")); updateChannelInfoLabel_->setText(QString("<center><font size='-1'>%1<br/>%2</font></center>").arg(updateFeedDescription, updateFeedDialogLink)); updateChannelInfoLabel_->show(); auto currentState = autoUpdater_->getCurrentState(); auto currentStateStringPattern = QString("<center><font size='-1'>%1</font></center>"); switch (currentState) { case AutoUpdater::State::NotCheckedForUpdatesYet: // Simply not showing any current state info. break; case AutoUpdater::State::CheckingForUpdate: updateStateInfoLabel_->setText(currentStateStringPattern.arg(tr("Checking for updates…"))); updateStateInfoLabel_->show(); updateProgressBar_->show(); break; |