From b1f223370e59f2fea188bf07f8ea8fec3d04e51e Mon Sep 17 00:00:00 2001 From: kh1 Date: Mon, 25 Mar 2013 13:21:02 +0100 Subject: Export private classes. We need it in some auto tests. Change-Id: I8014b4cfc1b3deff0b815dc8105b969d1a5d2947 Reviewed-by: Tim Jenssen Reviewed-by: Niels Weber --- src/libs/kdtools/kdtools.pri | 3 +- src/libs/kdtools/kdupdaterupdatesinfo.cpp | 44 +++++----------- src/libs/kdtools/kdupdaterupdatesinfo_p.h | 18 +++---- src/libs/kdtools/kdupdaterupdatesinfodata_p.h | 59 ++++++++++++++++++++++ .../componentmodel/tst_componentmodel.cpp | 1 - 5 files changed, 81 insertions(+), 44 deletions(-) create mode 100644 src/libs/kdtools/kdupdaterupdatesinfodata_p.h diff --git a/src/libs/kdtools/kdtools.pri b/src/libs/kdtools/kdtools.pri index cc9fd52fb..2b98089b9 100644 --- a/src/libs/kdtools/kdtools.pri +++ b/src/libs/kdtools/kdtools.pri @@ -36,7 +36,8 @@ HEADERS += $$PWD/kdupdater.h \ $$PWD/kdupdatertask.h \ $$PWD/kdupdaterupdatefinder.h \ $$PWD/kdupdaterupdatesinfo_p.h \ - $$PWD/environment.h + $$PWD/environment.h \ + $$PWD/kdupdaterupdatesinfodata_p.h SOURCES += $$PWD/kdupdaterapplication.cpp \ $$PWD/kdupdaterfiledownloader.cpp \ diff --git a/src/libs/kdtools/kdupdaterupdatesinfo.cpp b/src/libs/kdtools/kdupdaterupdatesinfo.cpp index b0cc8608b..fc4a7a2ce 100644 --- a/src/libs/kdtools/kdupdaterupdatesinfo.cpp +++ b/src/libs/kdtools/kdupdaterupdatesinfo.cpp @@ -22,47 +22,29 @@ #include "kdupdaterupdatesinfo_p.h" -#include -#include -#include #include -#include #include +#include using namespace KDUpdater; -// -// UpdatesInfo::UpdatesInfoData -// -struct UpdatesInfo::UpdatesInfoData : public QSharedData +UpdatesInfoData::UpdatesInfoData() + : error(UpdatesInfo::NotYetReadError) + , compatLevel(-1) { - Q_DECLARE_TR_FUNCTIONS(KDUpdater::UpdatesInfoData) - -public: - UpdatesInfoData() : error(UpdatesInfo::NotYetReadError), compatLevel(-1) { } - - QString errorMessage; - UpdatesInfo::Error error; - QString updateXmlFile; - QString applicationName; - QString applicationVersion; - int compatLevel; - QList updateInfoList; - - void parseFile(const QString &updateXmlFile); - bool parsePackageUpdateElement(const QDomElement &updateE); - bool parseCompatUpdateElement(const QDomElement &updateE); +} - void setInvalidContentError(const QString &detail); -}; +UpdatesInfoData::~UpdatesInfoData() +{ +} -void UpdatesInfo::UpdatesInfoData::setInvalidContentError(const QString &detail) +void UpdatesInfoData::setInvalidContentError(const QString &detail) { error = UpdatesInfo::InvalidContentError; errorMessage = tr("Updates.xml contains invalid content: %1").arg(detail); } -void UpdatesInfo::UpdatesInfoData::parseFile(const QString &updateXmlFile) +void UpdatesInfoData::parseFile(const QString &updateXmlFile) { QFile file(updateXmlFile); if (!file.open(QFile::ReadOnly)) { @@ -133,7 +115,7 @@ void UpdatesInfo::UpdatesInfoData::parseFile(const QString &updateXmlFile) errorMessage.clear(); } -bool UpdatesInfo::UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) +bool UpdatesInfoData::parsePackageUpdateElement(const QDomElement &updateE) { if (updateE.isNull()) return false; @@ -210,7 +192,7 @@ bool UpdatesInfo::UpdatesInfoData::parsePackageUpdateElement(const QDomElement & return true; } -bool UpdatesInfo::UpdatesInfoData::parseCompatUpdateElement(const QDomElement &updateE) +bool UpdatesInfoData::parseCompatUpdateElement(const QDomElement &updateE) { if (updateE.isNull()) return false; @@ -260,7 +242,7 @@ bool UpdatesInfo::UpdatesInfoData::parseCompatUpdateElement(const QDomElement &u // UpdatesInfo // UpdatesInfo::UpdatesInfo() - : d(new UpdatesInfo::UpdatesInfoData) + : d(new UpdatesInfoData) { } diff --git a/src/libs/kdtools/kdupdaterupdatesinfo_p.h b/src/libs/kdtools/kdupdaterupdatesinfo_p.h index 926133eb1..a1851ddf7 100644 --- a/src/libs/kdtools/kdupdaterupdatesinfo_p.h +++ b/src/libs/kdtools/kdupdaterupdatesinfo_p.h @@ -24,22 +24,19 @@ #define KD_UPDATER_UPDATE_INFO_H #include "kdupdater.h" +#include "kdupdaterupdatesinfodata_p.h" -#include -#include -#include -#include -#include -#include #include +#include +#include #include -// Classes and structures in this header file are for internal use only. // They are not a part of the public API +// Classes and structures in this header file are for internal use only but still exported for auto tests. namespace KDUpdater { -struct UpdateFileInfo +struct KDTOOLS_EXPORT UpdateFileInfo { UpdateFileInfo() : compressedSize(0), @@ -52,14 +49,14 @@ struct UpdateFileInfo quint64 uncompressedSize; }; -struct UpdateInfo +struct KDTOOLS_EXPORT UpdateInfo { int type; QHash data; QList updateFiles; }; -class UpdatesInfo +class KDTOOLS_EXPORT UpdatesInfo { public: enum Error @@ -90,7 +87,6 @@ public: QList updatesInfo(int type = AllUpdate, int compatLevel = -1) const; private: - struct UpdatesInfoData; QSharedDataPointer d; }; diff --git a/src/libs/kdtools/kdupdaterupdatesinfodata_p.h b/src/libs/kdtools/kdupdaterupdatesinfodata_p.h new file mode 100644 index 000000000..4b398ee91 --- /dev/null +++ b/src/libs/kdtools/kdupdaterupdatesinfodata_p.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** Copyright (C) 2001-2010 Klaralvdalens Datakonsult AB. All rights reserved. +** +** This file is part of the KD Tools library. +** +** Licensees holding valid commercial KD Tools licenses may use this file in +** accordance with the KD Tools Commercial License Agreement provided with +** the Software. +** +** +** This file may be distributed and/or modified under the terms of the +** GNU Lesser General Public License version 2 and version 3 as published by the +** Free Software Foundation and appearing in the file LICENSE.LGPL included. +** +** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +** +** Contact info@kdab.com if any conditions of this licensing are not +** clear to you. +** +**********************************************************************/ + +#ifndef KD_UPDATER_UPDATE_INFO_DATA_H +#define KD_UPDATER_UPDATE_INFO_DATA_H + +#include +#include +#include + +namespace KDUpdater { + +struct UpdateInfo; + +struct UpdatesInfoData : public QSharedData +{ + Q_DECLARE_TR_FUNCTIONS(KDUpdater::UpdatesInfoData) + +public: + UpdatesInfoData(); + ~UpdatesInfoData(); + + int error; + QString errorMessage; + QString updateXmlFile; + QString applicationName; + QString applicationVersion; + int compatLevel; + QList updateInfoList; + + void parseFile(const QString &updateXmlFile); + bool parsePackageUpdateElement(const QDomElement &updateE); + bool parseCompatUpdateElement(const QDomElement &updateE); + + void setInvalidContentError(const QString &detail); +}; + +} // namespace KDUpdater + +#endif // KD_UPDATER_UPDATE_INFO_DATA_H diff --git a/tests/auto/installer/componentmodel/tst_componentmodel.cpp b/tests/auto/installer/componentmodel/tst_componentmodel.cpp index cfb83a27e..89e6be3d8 100644 --- a/tests/auto/installer/componentmodel/tst_componentmodel.cpp +++ b/tests/auto/installer/componentmodel/tst_componentmodel.cpp @@ -2,7 +2,6 @@ #include "componentmodel.h" #include "kdupdaterupdatesinfo_p.h" -#include "kdupdaterupdatesinfo.cpp" #include "kdupdaterupdatesourcesinfo.h" #include "packagemanagercore.h" -- cgit v1.2.3