diff options
author | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-04-21 14:18:07 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@theqtcompany.com> | 2015-04-21 14:18:07 +0200 |
commit | ffed7d2b6d212e67946d4fa9c6ff7e84ea25e460 (patch) | |
tree | b2f1701a1e7baa2c1b625e3a6f71cceab8731307 /src | |
parent | da6ed2851f3e18c0b004992ff22d0b4acbf25650 (diff) | |
parent | 57007dc93cf60596238a5586af352abcd20df398 (diff) |
Merge remote-tracking branch 'origin/2.0'
Conflicts:
Changelog
Change-Id: Idd7d569f97fba75b05bfc006c7a5b0b9cf8ccf73
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/component.cpp | 8 | ||||
-rw-r--r-- | src/libs/installer/componentchecker.cpp | 9 | ||||
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 2 | ||||
-rw-r--r-- | src/libs/installer/installer.pro | 3 | ||||
-rw-r--r-- | src/libs/installer/keepaliveobject.cpp | 4 | ||||
-rw-r--r-- | src/libs/installer/localsocket.h | 74 | ||||
-rw-r--r-- | src/libs/installer/packagemanagercore_p.cpp | 9 | ||||
-rw-r--r-- | src/libs/installer/packagemanagergui.cpp | 33 | ||||
-rw-r--r-- | src/libs/installer/performinstallationform.cpp | 16 | ||||
-rw-r--r-- | src/libs/installer/remoteobject.cpp | 3 | ||||
-rw-r--r-- | src/libs/installer/remoteobject.h | 4 | ||||
-rw-r--r-- | src/libs/installer/remoteserverconnection.cpp | 8 | ||||
-rw-r--r-- | src/libs/installer/repository.cpp | 1 | ||||
-rw-r--r-- | src/libs/kdtools/kdupdaterupdateoperation.cpp | 1 | ||||
-rw-r--r-- | src/sdk/updatechecker.cpp | 2 |
15 files changed, 136 insertions, 41 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 57a86748a..048cfeda6 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -557,9 +557,11 @@ void Component::loadTranslations(const QDir &directory, const QStringList &qms) } QScopedPointer<QTranslator> translator(new QTranslator(this)); - if (!translator->load(filename)) - throw Error(tr("Could not open the requested translation file '%1'.").arg(filename)); - qApp->installTranslator(translator.take()); + if (translator->load(filename)) { + // Do not throw if translator returns false as it may just be an intentionally + // empty file. See also QTBUG-31031 + qApp->installTranslator(translator.take()); + } } } diff --git a/src/libs/installer/componentchecker.cpp b/src/libs/installer/componentchecker.cpp index 5ce8641b3..c3bf79cb5 100644 --- a/src/libs/installer/componentchecker.cpp +++ b/src/libs/installer/componentchecker.cpp @@ -42,8 +42,13 @@ namespace QInstaller { QStringList ComponentChecker::checkComponent(Component *component) { - PackageManagerCore *core = component->packageManagerCore(); QStringList checkResult; + if (!component) + return checkResult; + + PackageManagerCore *core = component->packageManagerCore(); + if (!core) + return checkResult; if (component->childCount() && !component->archives().isEmpty()) { checkResult << QString::fromLatin1("Component %1 contains data to be installed " @@ -80,7 +85,7 @@ QStringList ComponentChecker::checkComponent(Component *component) foreach (const QString &dependency, dependencies) { Component *dependencyComponent = PackageManagerCore::componentByName( dependency, allComponents); - if (autoDependencies.contains(dependencyComponent->name())) { + if (dependencyComponent && autoDependencies.contains(dependencyComponent->name())) { checkResult << QString::fromLatin1("Component %1 specifies both dependency " "and auto dependency on component %2. The dependency might be superfluous.") .arg(component->name(), dependencyComponent->name()); diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index 1a368af8d..30213c9a6 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -577,7 +577,7 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone // we can start in descending order to check node and tri-state nodes properly for (int i = sortedNodes.count(); i > 0; i--) { Component * const node = sortedNodes.at(i - 1); - if (!node->isCheckable()) + if (!node->isCheckable() || !node->isEnabled()) continue; Qt::CheckState newState = state; diff --git a/src/libs/installer/installer.pro b/src/libs/installer/installer.pro index ac6354309..87af31f3c 100644 --- a/src/libs/installer/installer.pro +++ b/src/libs/installer/installer.pro @@ -123,7 +123,8 @@ HEADERS += packagemanagercore.h \ proxycredentialsdialog.h \ serverauthenticationdialog.h \ keepaliveobject.h \ - systeminfo.h + systeminfo.h \ + localsocket.h SOURCES += packagemanagercore.cpp \ packagemanagercore_p.cpp \ diff --git a/src/libs/installer/keepaliveobject.cpp b/src/libs/installer/keepaliveobject.cpp index 226181120..15af0d724 100644 --- a/src/libs/installer/keepaliveobject.cpp +++ b/src/libs/installer/keepaliveobject.cpp @@ -34,8 +34,8 @@ #include "keepaliveobject.h" #include "remoteclient.h" +#include "localsocket.h" -#include <QLocalSocket> #include <QTimer> namespace QInstaller { @@ -49,7 +49,7 @@ KeepAliveObject::KeepAliveObject() void KeepAliveObject::start() { m_timer = new QTimer(this); - m_socket = new QLocalSocket(this); + m_socket = new LocalSocket(this); connect(m_timer, &QTimer::timeout, [this]() { if (m_socket->state() != QLocalSocket::UnconnectedState) diff --git a/src/libs/installer/localsocket.h b/src/libs/installer/localsocket.h new file mode 100644 index 000000000..afe6b8cfa --- /dev/null +++ b/src/libs/installer/localsocket.h @@ -0,0 +1,74 @@ +/************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Installer Framework. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** +** $QT_END_LICENSE$ +** +**************************************************************************/ + +#ifndef LOCALSOCKET_H +#define LOCALSOCKET_H + +#include <QLocalSocket> + +#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5,5,0) + +// This is a crude hack to work around QLocalSocket::waitForReadyRead returning instantly +// if there are still bytes left in the buffer. This has been fixed in Qt 5.5.0 ... +class LocalSocket : public QLocalSocket +{ +public: + LocalSocket(QObject *parent = 0) : QLocalSocket(parent), inReadyRead(false) + { + } + + qint64 bytesAvailable() const { + if (inReadyRead) + return 0; + return QLocalSocket::bytesAvailable(); + } + + bool waitForReadyRead(int msecs = 30000) { + inReadyRead = true; + bool result = QLocalSocket::waitForReadyRead(msecs); + inReadyRead = false; + return result; + } + +private: + bool inReadyRead; +}; + +#else + +typedef QLocalSocket LocalSocket; + +#endif + +#endif // LOCALSOCKET_H diff --git a/src/libs/installer/packagemanagercore_p.cpp b/src/libs/installer/packagemanagercore_p.cpp index a97c83226..be7b0317d 100644 --- a/src/libs/installer/packagemanagercore_p.cpp +++ b/src/libs/installer/packagemanagercore_p.cpp @@ -374,10 +374,6 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c else if (component->isInstalled()) component->setCheckState(Qt::Checked); } - - const QStringList warnings = ComponentChecker::checkComponent(component); - foreach (const QString &warning, warnings) - qWarning() << warning; } std::sort(m_rootComponents.begin(), m_rootComponents.end(), Component::SortingPriorityGreaterThan()); @@ -396,6 +392,11 @@ bool PackageManagerCorePrivate::buildComponentTree(QHash<QString, Component*> &c restoreCheckState(); + foreach (QInstaller::Component *component, components) { + const QStringList warnings = ComponentChecker::checkComponent(component); + foreach (const QString &warning, warnings) + qWarning() << warning; + } } catch (const Error &error) { clearAllComponentLists(); emit m_core->finishAllComponentsReset(QList<QInstaller::Component*>()); diff --git a/src/libs/installer/packagemanagergui.cpp b/src/libs/installer/packagemanagergui.cpp index 6c4fcb57e..4e4190fd5 100644 --- a/src/libs/installer/packagemanagergui.cpp +++ b/src/libs/installer/packagemanagergui.cpp @@ -1251,8 +1251,12 @@ IntroductionPage::IntroductionPage(PackageManagerCore *core) m_updateComponents->setEnabled(ProductKeyCheck::instance()->hasValidKey()); #ifdef Q_OS_WIN - m_taskButton = new QWinTaskbarButton(this); - connect(core, SIGNAL(metaJobProgress(int)), m_taskButton->progress(), SLOT(setValue(int))); + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { + m_taskButton = new QWinTaskbarButton(this); + connect(core, SIGNAL(metaJobProgress(int)), m_taskButton->progress(), SLOT(setValue(int))); + } else { + m_taskButton = 0; + } #endif } @@ -1298,14 +1302,16 @@ bool IntroductionPage::validatePage() } #ifdef Q_OS_WIN - if (!m_taskButton->window()) { - if (QWidget *widget = QApplication::activeWindow()) - m_taskButton->setWindow(widget->windowHandle()); - } + if (m_taskButton) { + if (!m_taskButton->window()) { + if (QWidget *widget = QApplication::activeWindow()) + m_taskButton->setWindow(widget->windowHandle()); + } - m_taskButton->progress()->reset(); - m_taskButton->progress()->resume(); - m_taskButton->progress()->setVisible(true); + m_taskButton->progress()->reset(); + m_taskButton->progress()->resume(); + m_taskButton->progress()->setVisible(true); + } #endif // fetch updater packages @@ -1358,7 +1364,8 @@ bool IntroductionPage::validatePage() gui()->setSettingsButtonEnabled(true); #ifdef Q_OS_WIN - m_taskButton->progress()->setVisible(!isComplete()); + if (m_taskButton) + m_taskButton->progress()->setVisible(!isComplete()); #endif return isComplete(); } @@ -1446,8 +1453,10 @@ void IntroductionPage::setErrorMessage(const QString &error) m_errorLabel->setPalette(palette); #ifdef Q_OS_WIN - m_taskButton->progress()->stop(); - m_taskButton->progress()->setValue(100); + if (m_taskButton) { + m_taskButton->progress()->stop(); + m_taskButton->progress()->setValue(100); + } #endif } diff --git a/src/libs/installer/performinstallationform.cpp b/src/libs/installer/performinstallationform.cpp index 24d06d59f..459e94591 100644 --- a/src/libs/installer/performinstallationform.cpp +++ b/src/libs/installer/performinstallationform.cpp @@ -89,8 +89,12 @@ PerformInstallationForm::PerformInstallationForm(QObject *parent) , m_updateTimer(0) { #ifdef Q_OS_WIN - m_taskButton = new QWinTaskbarButton(this); - m_taskButton->progress()->setVisible(true); + if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) { + m_taskButton = new QWinTaskbarButton(this); + m_taskButton->progress()->setVisible(true); + } else { + m_taskButton = 0; + } #endif } @@ -177,9 +181,11 @@ void PerformInstallationForm::updateProgress() m_progressBar->setValue(progressPercentage); #ifdef Q_OS_WIN - if (!m_taskButton->window()) - m_taskButton->setWindow(QApplication::activeWindow()->windowHandle()); - m_taskButton->progress()->setValue(progressPercentage); + if (m_taskButton) { + if (!m_taskButton->window()) + m_taskButton->setWindow(QApplication::activeWindow()->windowHandle()); + m_taskButton->progress()->setValue(progressPercentage); + } #endif static QString lastLabelText; diff --git a/src/libs/installer/remoteobject.cpp b/src/libs/installer/remoteobject.cpp index 581085ab3..add11fa68 100644 --- a/src/libs/installer/remoteobject.cpp +++ b/src/libs/installer/remoteobject.cpp @@ -36,6 +36,7 @@ #include "protocol.h" #include "remoteclient.h" +#include "localsocket.h" #include <QCoreApplication> #include <QElapsedTimer> @@ -73,7 +74,7 @@ bool RemoteObject::authorize() if (m_socket) delete m_socket; - m_socket = new QLocalSocket; + m_socket = new LocalSocket; m_socket->connectToServer(RemoteClient::instance().socketName()); QElapsedTimer stopWatch; diff --git a/src/libs/installer/remoteobject.h b/src/libs/installer/remoteobject.h index f0f8da5fe..57ab0599d 100644 --- a/src/libs/installer/remoteobject.h +++ b/src/libs/installer/remoteobject.h @@ -101,10 +101,6 @@ public: "Bytes expected: %2, Bytes received: %3. Error: %4").arg(name).arg(0) .arg(m_socket->bytesAvailable()).arg(m_socket->errorString())); } -#if defined Q_OS_WIN && QT_VERSION < QT_VERSION_CHECK(5,5,0) - // work around QTBUG-16688 - QCoreApplication::processEvents(); -#endif } Q_ASSERT(command == Protocol::Reply); diff --git a/src/libs/installer/remoteserverconnection.cpp b/src/libs/installer/remoteserverconnection.cpp index 17a90995b..cdaf070fd 100644 --- a/src/libs/installer/remoteserverconnection.cpp +++ b/src/libs/installer/remoteserverconnection.cpp @@ -39,8 +39,10 @@ #include "remoteserverconnection_p.h" #include "utils.h" #include "permissionsettings.h" +#include "localsocket.h" #include <QCoreApplication> +#include <QDataStream> #include <QLocalSocket> namespace QInstaller { @@ -70,7 +72,7 @@ private: void RemoteServerConnection::run() { - QLocalSocket socket; + LocalSocket socket; socket.setSocketDescriptor(m_socketDescriptor); QScopedPointer<PermissionSettings> settings; @@ -81,10 +83,6 @@ void RemoteServerConnection::run() if (!receivePacket(&socket, &cmd, &data)) { socket.waitForReadyRead(250); -#if defined(Q_OS_WIN) && QT_VERSION < QT_VERSION_CHECK(5,5,0) - // work around QTBUG-16688 - QCoreApplication::processEvents(); -#endif continue; } diff --git a/src/libs/installer/repository.cpp b/src/libs/installer/repository.cpp index b3d501b96..8911b3950 100644 --- a/src/libs/installer/repository.cpp +++ b/src/libs/installer/repository.cpp @@ -35,6 +35,7 @@ #include "repository.h" #include "kdupdaterfiledownloaderfactory.h" +#include <QDataStream> #include <QFileInfo> #include <QStringList> diff --git a/src/libs/kdtools/kdupdaterupdateoperation.cpp b/src/libs/kdtools/kdupdaterupdateoperation.cpp index 05c0995ac..007173ec5 100644 --- a/src/libs/kdtools/kdupdaterupdateoperation.cpp +++ b/src/libs/kdtools/kdupdaterupdateoperation.cpp @@ -36,6 +36,7 @@ #include "kdupdaterapplication.h" +#include <QDataStream> #include <QDebug> #include <QDir> #include <QFileInfo> diff --git a/src/sdk/updatechecker.cpp b/src/sdk/updatechecker.cpp index d0b571606..0ecf94ea7 100644 --- a/src/sdk/updatechecker.cpp +++ b/src/sdk/updatechecker.cpp @@ -80,7 +80,7 @@ int UpdateChecker::check() QInstaller::BinaryContent::readBinaryContent(&binary, &operations, &manager, &magicMarker, cookie); - if (magicMarker != QInstaller::BinaryContent::MagicInstallerMarker) + if (magicMarker == QInstaller::BinaryContent::MagicInstallerMarker) throw QInstaller::Error(QLatin1String("Installers cannot check for updates.")); SDKApp::registerMetaResources(manager.collectionByName("QResources")); |