2011-02-21 16:30:31 +01:00
|
|
|
/**************************************************************************
|
|
|
|
**
|
|
|
|
** This file is part of Qt SDK**
|
|
|
|
**
|
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
|
|
|
|
**
|
|
|
|
** Contact: Nokia Corporation qt-info@nokia.com**
|
|
|
|
**
|
|
|
|
** No Commercial Usage
|
|
|
|
**
|
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
** this package.
|
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
**
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception version
|
|
|
|
** 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
|
|
|
** If you are unsure which license is appropriate for your use, please contact
|
|
|
|
** (qt-info@nokia.com).
|
|
|
|
**
|
|
|
|
**************************************************************************/
|
|
|
|
#include "init.h"
|
|
|
|
|
|
|
|
#include "createshortcutoperation.h"
|
|
|
|
#include "createdesktopentryoperation.h"
|
|
|
|
#include "extractarchiveoperation.h"
|
|
|
|
#include "globalsettingsoperation.h"
|
|
|
|
#include "environmentvariablesoperation.h"
|
|
|
|
#include "registerfiletypeoperation.h"
|
|
|
|
#include "selfrestartoperation.h"
|
|
|
|
#include "installiconsoperation.h"
|
|
|
|
#include "elevatedexecuteoperation.h"
|
|
|
|
#include "fakestopprocessforupdateoperation.h"
|
|
|
|
|
|
|
|
//added for NDK
|
|
|
|
#include "copydirectoryoperation.h"
|
|
|
|
#include "qtpatchoperation.h"
|
|
|
|
#include "setdemospathonqtoperation.h"
|
|
|
|
#include "setexamplespathonqtoperation.h"
|
|
|
|
#include "setpluginpathonqtcoreoperation.h"
|
|
|
|
#include "setimportspathonqtcoreoperation.h"
|
2011-09-21 12:20:41 +02:00
|
|
|
#include "setpathonqtcoreoperation.h"
|
2011-02-21 16:30:31 +01:00
|
|
|
#include "replaceoperation.h"
|
|
|
|
#include "licenseoperation.h"
|
|
|
|
#include "linereplaceoperation.h"
|
|
|
|
#include "registerdocumentationoperation.h"
|
|
|
|
#include "registerqtoperation.h"
|
2011-05-06 11:26:53 +02:00
|
|
|
#include "registerqtv2operation.h"
|
2011-07-08 15:33:28 +02:00
|
|
|
#include "registerqtv23operation.h"
|
2011-02-21 16:30:31 +01:00
|
|
|
#include "setqtcreatorvalueoperation.h"
|
2011-08-17 16:19:37 +02:00
|
|
|
#include "addqtcreatorarrayvalueoperation.h"
|
2011-02-21 16:30:31 +01:00
|
|
|
#include "simplemovefileoperation.h"
|
2011-03-24 13:58:51 +01:00
|
|
|
#include "registertoolchainoperation.h"
|
2011-05-16 16:31:37 +02:00
|
|
|
#include "registerdefaultdebuggeroperation.h"
|
2011-05-16 17:21:59 +02:00
|
|
|
#include "updatecreatorsettingsfrom21to22operation.h"
|
2011-02-21 16:30:31 +01:00
|
|
|
|
|
|
|
#include "minimumprogressoperation.h"
|
|
|
|
|
|
|
|
#ifdef Q_OS_MAC
|
|
|
|
#include "macreplaceinstallnamesoperation.h"
|
|
|
|
#endif // Q_OS_MAC
|
|
|
|
|
|
|
|
#include "common/utils.h"
|
|
|
|
|
2011-11-19 00:00:52 +01:00
|
|
|
#include <kdupdaterupdateoperation.h>
|
|
|
|
#include <kdupdaterupdateoperationfactory.h>
|
|
|
|
#include <kdupdaterfiledownloader.h>
|
|
|
|
#include <kdupdaterfiledownloaderfactory.h>
|
2011-02-21 16:30:31 +01:00
|
|
|
|
2011-11-19 14:10:31 +01:00
|
|
|
#include <QtPlugin>
|
2011-02-21 16:30:31 +01:00
|
|
|
#include <QNetworkProxyFactory>
|
|
|
|
|
|
|
|
#include <unix/C/7zCrc.h>
|
|
|
|
|
2011-11-17 22:12:18 +01:00
|
|
|
namespace NArchive {
|
|
|
|
namespace NBz2 { void registerArcBZip2(); }
|
|
|
|
namespace NGz { void registerArcGZip(); }
|
|
|
|
namespace NLzma { namespace NLzmaAr { void registerArcLzma(); } }
|
|
|
|
namespace NLzma { namespace NLzma86Ar { void registerArcLzma86(); } }
|
|
|
|
namespace NSplit { void registerArcSplit(); }
|
|
|
|
namespace NXz { void registerArcxz(); }
|
2011-11-19 14:10:31 +01:00
|
|
|
namespace NZ { void registerArcZ(); }
|
2011-02-21 16:30:31 +01:00
|
|
|
}
|
2011-11-17 22:12:18 +01:00
|
|
|
|
2011-02-21 16:30:31 +01:00
|
|
|
void registerArc7z();
|
|
|
|
void registerArcCab();
|
|
|
|
void registerArcTar();
|
|
|
|
void registerArcZip();
|
|
|
|
|
2011-11-19 14:10:31 +01:00
|
|
|
void registerCodecBCJ2();
|
|
|
|
void registerCodecBCJ();
|
|
|
|
void registerCodecBCJ();
|
|
|
|
void registerCodecByteSwap();
|
|
|
|
void registerCodecBZip2();
|
|
|
|
void registerCodecCopy();
|
|
|
|
void registerCodecDeflate64();
|
|
|
|
void registerCodecDeflate();
|
|
|
|
void registerCodecDelta();
|
|
|
|
void registerCodecLZMA2();
|
|
|
|
void registerCodecLZMA();
|
|
|
|
void registerCodecPPMD();
|
|
|
|
void registerCodec7zAES();
|
2011-02-21 16:30:31 +01:00
|
|
|
|
|
|
|
using namespace NArchive;
|
2011-11-19 14:10:31 +01:00
|
|
|
using namespace KDUpdater;
|
|
|
|
using namespace QInstaller;
|
2011-02-21 16:30:31 +01:00
|
|
|
|
|
|
|
static void initArchives()
|
|
|
|
{
|
|
|
|
NBz2::registerArcBZip2();
|
|
|
|
NGz::registerArcGZip();
|
|
|
|
NLzma::NLzmaAr::registerArcLzma();
|
|
|
|
NLzma::NLzma86Ar::registerArcLzma86();
|
2011-11-19 14:10:31 +01:00
|
|
|
NSplit::registerArcSplit();
|
|
|
|
NXz::registerArcxz();
|
|
|
|
NZ::registerArcZ();
|
2011-02-21 16:30:31 +01:00
|
|
|
registerArc7z();
|
|
|
|
registerArcCab();
|
|
|
|
registerArcTar();
|
|
|
|
registerArcZip();
|
|
|
|
|
|
|
|
registerCodecBCJ2();
|
|
|
|
registerCodecBCJ();
|
|
|
|
registerCodecBCJ();
|
|
|
|
registerCodecByteSwap();
|
|
|
|
registerCodecBZip2();
|
|
|
|
registerCodecCopy();
|
|
|
|
registerCodecDeflate64();
|
|
|
|
registerCodecDeflate();
|
|
|
|
registerCodecDelta();
|
|
|
|
registerCodecLZMA2();
|
|
|
|
registerCodecLZMA();
|
|
|
|
registerCodecPPMD();
|
|
|
|
registerCodec7zAES();
|
|
|
|
|
|
|
|
CrcGenerateTable();
|
|
|
|
}
|
|
|
|
|
|
|
|
static void initResources()
|
|
|
|
{
|
2011-11-17 22:12:18 +01:00
|
|
|
Q_INIT_RESOURCE(openssl);
|
|
|
|
Q_INIT_RESOURCE(patch_file_lists);
|
2011-07-11 15:13:12 +02:00
|
|
|
#if defined(USE_STATIC_SQLITE_PLUGIN)
|
2011-11-17 22:12:18 +01:00
|
|
|
Q_IMPORT_PLUGIN(qsqlite); // RegisterDocumentationOperation needs this
|
2011-02-21 16:30:31 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2011-11-17 22:12:18 +01:00
|
|
|
static void messageHandler(QtMsgType type, const char *msg)
|
2011-02-21 16:30:31 +01:00
|
|
|
{
|
2011-11-19 14:10:31 +01:00
|
|
|
verbose() << msg << std::endl;
|
2011-02-21 16:30:31 +01:00
|
|
|
if (type != QtFatalMsg && QString::fromLatin1(msg).contains(QLatin1String("Object::connect: "))) {
|
|
|
|
//qFatal(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void QInstaller::init()
|
|
|
|
{
|
|
|
|
::initResources();
|
2011-11-19 14:10:31 +01:00
|
|
|
|
|
|
|
UpdateOperationFactory &factory = UpdateOperationFactory::instance();
|
|
|
|
factory.registerUpdateOperation<CreateShortcutOperation>(QLatin1String("CreateShortcut"));
|
|
|
|
factory.registerUpdateOperation<CreateDesktopEntryOperation>(QLatin1String("CreateDesktopEntry"));
|
|
|
|
factory.registerUpdateOperation<ExtractArchiveOperation>(QLatin1String("Extract"));
|
|
|
|
factory.registerUpdateOperation<GlobalSettingsOperation>(QLatin1String("GlobalConfig"));
|
|
|
|
factory.registerUpdateOperation<EnvironmentVariableOperation>(QLatin1String( "EnvironmentVariable"));
|
|
|
|
factory.registerUpdateOperation<RegisterFileTypeOperation>(QLatin1String("RegisterFileType"));
|
|
|
|
factory.registerUpdateOperation<SelfRestartOperation>(QLatin1String("SelfRestart"));
|
|
|
|
factory.registerUpdateOperation<InstallIconsOperation>(QLatin1String("InstallIcons"));
|
|
|
|
factory.registerUpdateOperation<ElevatedExecuteOperation>(QLatin1String("Execute"));
|
|
|
|
factory.registerUpdateOperation<FakeStopProcessForUpdateOperation>(QLatin1String("FakeStopProcessForUpdate"));
|
2011-11-17 22:12:18 +01:00
|
|
|
|
|
|
|
// added for NDK
|
2011-11-19 14:10:31 +01:00
|
|
|
factory.registerUpdateOperation<SimpleMoveFileOperation>(QLatin1String("SimpleMoveFile"));
|
|
|
|
factory.registerUpdateOperation<CopyDirectoryOperation>(QLatin1String("CopyDirectory"));
|
|
|
|
factory.registerUpdateOperation<RegisterDocumentationOperation>(QLatin1String("RegisterDocumentation"));
|
|
|
|
factory.registerUpdateOperation<RegisterQtInCreatorOperation>(QLatin1String("RegisterQtInCreator"));
|
|
|
|
factory.registerUpdateOperation<RegisterQtInCreatorV2Operation>(QLatin1String("RegisterQtInCreatorV2"));
|
|
|
|
factory.registerUpdateOperation<RegisterQtInCreatorV23Operation>(QLatin1String("RegisterQtInCreatorV23"));
|
|
|
|
factory.registerUpdateOperation<RegisterToolChainOperation>(QLatin1String("RegisterToolChain") );
|
|
|
|
factory.registerUpdateOperation<RegisterDefaultDebuggerOperation>(QLatin1String( "RegisterDefaultDebugger"));
|
|
|
|
factory.registerUpdateOperation<SetDemosPathOnQtOperation>(QLatin1String("SetDemosPathOnQt"));
|
|
|
|
factory.registerUpdateOperation<SetExamplesPathOnQtOperation>(QLatin1String("SetExamplesPathOnQt"));
|
|
|
|
factory.registerUpdateOperation<SetPluginPathOnQtCoreOperation>(QLatin1String("SetPluginPathOnQtCore"));
|
|
|
|
factory.registerUpdateOperation<SetImportsPathOnQtCoreOperation>(QLatin1String("SetImportsPathOnQtCore"));
|
|
|
|
factory.registerUpdateOperation<SetPathOnQtCoreOperation>(QLatin1String("SetPathOnQtCore"));
|
|
|
|
factory.registerUpdateOperation<SetQtCreatorValueOperation>(QLatin1String("SetQtCreatorValue"));
|
|
|
|
factory.registerUpdateOperation<AddQtCreatorArrayValueOperation>(QLatin1String("AddQtCreatorArrayValue"));
|
|
|
|
factory.registerUpdateOperation<QtPatchOperation>(QLatin1String("QtPatch"));
|
|
|
|
factory.registerUpdateOperation<ReplaceOperation>(QLatin1String("Replace"));
|
|
|
|
factory.registerUpdateOperation<LineReplaceOperation>(QLatin1String( "LineReplace" ) );
|
|
|
|
factory.registerUpdateOperation<UpdateCreatorSettingsFrom21To22Operation>(QLatin1String("UpdateCreatorSettingsFrom21To22"));
|
|
|
|
|
|
|
|
factory.registerUpdateOperation<MinimumProgressOperation>(QLatin1String("MinimumProgress"));
|
|
|
|
factory.registerUpdateOperation<LicenseOperation>(QLatin1String("License"));
|
|
|
|
|
|
|
|
FileDownloaderFactory::setFollowRedirects(true);
|
2011-02-21 16:30:31 +01:00
|
|
|
|
|
|
|
#ifdef Q_OS_MAC
|
2011-11-19 14:10:31 +01:00
|
|
|
factoryregisterUpdateOperation<MacReplaceInstallNamesOperation>(QLatin1String("ReplaceInstallNames"));
|
2011-02-21 16:30:31 +01:00
|
|
|
#endif // Q_OS_MAC
|
|
|
|
|
|
|
|
// load 7z stuff, if we're a static lib
|
|
|
|
::initArchives();
|
|
|
|
|
|
|
|
// proxy settings
|
|
|
|
//QNetworkProxyFactory::setUseSystemConfiguration( true );
|
|
|
|
|
|
|
|
// qDebug -> verbose()
|
2011-11-17 22:12:18 +01:00
|
|
|
qInstallMsgHandler(messageHandler);
|
2011-02-21 16:30:31 +01:00
|
|
|
}
|