summaryrefslogtreecommitdiffstats
path: root/installerbuilder
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@nokia.com>2011-05-16 16:31:37 +0200
committerTim Jenssen <tim.jenssen@nokia.com>2011-05-16 17:23:04 +0200
commitf0e0fef6847367d2628d93b5460d1170e11e9f63 (patch)
treeb8d4ce77b1c6ff33ef1ff54be139502fde1cf83b /installerbuilder
parentc570c8612a0ffa57e0b6f991c692c6fe9097dd66 (diff)
added new registerdefaultdebuggeroperation
Diffstat (limited to 'installerbuilder')
-rw-r--r--installerbuilder/libinstaller/init.cpp2
-rw-r--r--installerbuilder/libinstaller/libinstaller.pro6
-rw-r--r--installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp154
-rw-r--r--installerbuilder/libinstaller/registerdefaultdebuggeroperation.h65
4 files changed, 225 insertions, 2 deletions
diff --git a/installerbuilder/libinstaller/init.cpp b/installerbuilder/libinstaller/init.cpp
index 150a0bd65..45ac071fc 100644
--- a/installerbuilder/libinstaller/init.cpp
+++ b/installerbuilder/libinstaller/init.cpp
@@ -59,6 +59,7 @@
#include "setqtcreatorvalueoperation.h"
#include "simplemovefileoperation.h"
#include "registertoolchainoperation.h"
+#include "registerdefaultdebuggeroperation.h"
#include "minimumprogressoperation.h"
@@ -179,6 +180,7 @@ void QInstaller::init()
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterQtInCreatorOperation>( QLatin1String( "RegisterQtInCreator") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterQtInCreatorV2Operation>( QLatin1String( "RegisterQtInCreatorV2") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterToolChainOperation>( QLatin1String( "RegisterToolChain") );
+ KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::RegisterDefaultDebuggerOperation>( QLatin1String( "RegisterDefaultDebugger") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::SetDemosPathOnQtOperation>( QLatin1String( "SetDemosPathOnQt") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::SetExamplesPathOnQtOperation>( QLatin1String( "SetExamplesPathOnQt") );
KDUpdater::UpdateOperationFactory::instance().registerUpdateOperation< QInstaller::SetPluginPathOnQtCoreOperation>( QLatin1String( "SetPluginPathOnQtCore") );
diff --git a/installerbuilder/libinstaller/libinstaller.pro b/installerbuilder/libinstaller/libinstaller.pro
index c92664829..02890f393 100644
--- a/installerbuilder/libinstaller/libinstaller.pro
+++ b/installerbuilder/libinstaller/libinstaller.pro
@@ -96,7 +96,8 @@ HEADERS += $$PWD/qinstaller.h \
getrepositoriesmetainfojob.h \
licenseoperation.h \
qtcreator_constants.h \
- qtcreatorpersistentsettings.h
+ qtcreatorpersistentsettings.h \
+ registerdefaultdebuggeroperation.h
SOURCES += $$PWD/qinstaller.cpp \
$$PWD/qinstallergui.cpp \
@@ -159,7 +160,8 @@ SOURCES += $$PWD/qinstaller.cpp \
messageboxhandler.cpp \
getrepositoriesmetainfojob.cpp \
licenseoperation.cpp \
- qtcreatorpersistentsettings.cpp
+ qtcreatorpersistentsettings.cpp \
+ registerdefaultdebuggeroperation.cpp
macx {
diff --git a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp
new file mode 100644
index 000000000..11af4f2a9
--- /dev/null
+++ b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.cpp
@@ -0,0 +1,154 @@
+/**************************************************************************
+**
+** 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 "registerdefaultdebuggeroperation.h"
+#include "persistentsettings.h"
+//#include "qinstaller.h"
+#include "qtcreator_constants.h"
+#include "qtcreatorpersistentsettings.h"
+
+#include <QString>
+#include <QFileInfo>
+#include <QDir>
+#include <QSettings>
+#include <QDebug>
+
+using namespace QInstaller;
+
+using namespace ProjectExplorer;
+
+RegisterDefaultDebuggerOperation::RegisterDefaultDebuggerOperation()
+{
+ setName(QLatin1String("RegisterToolChain"));
+}
+
+RegisterDefaultDebuggerOperation::~RegisterDefaultDebuggerOperation()
+{
+}
+
+void RegisterDefaultDebuggerOperation::backup()
+{
+}
+
+/** application binary interface - this is an internal creator typ as a String CPU-OS-OS_FLAVOR-BINARY_FORMAT-WORD_WIDTH
+ * CPU: arm x86 mips ppc itanium
+ * OS: linux macos symbian unix windows
+ * OS_FLAVOR: generic maemo meego generic device emulator generic msvc2005 msvc2008 msvc2010 msys ce
+ * BINARY_FORMAT: elf pe mach_o qml_rt
+ * WORD_WIDTH: 8 16 32 64
+ */
+
+bool RegisterDefaultDebuggerOperation::performOperation()
+{
+ const QStringList args = arguments();
+
+ if (args.count() != 2) {
+ setError(InvalidArguments);
+ setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.")
+ .arg(name()).arg(args.count()));
+ return false;
+ }
+
+ QString toolChainsXmlFilePath;
+
+// const Installer* const installer = qVariantValue<Installer*>(value(QLatin1String("installer")));
+// if (!installer) {
+// setError(UserDefinedError);
+// setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name()));
+// return false;
+// }
+// const QString &rootInstallPath = installer->value(QLatin1String("TargetDir"));
+// toolChainsXmlFilePath = rootInstallPath + QLatin1String(ToolChainSettingsSuffixPath);
+ toolChainsXmlFilePath = "d:\\toolchains.xml_debugger";
+
+ int argCounter = 0;
+ const QString &abiString = args.at(argCounter++); //for example x86-windows-msys-pe-32bit
+ const QString &debuggerPath = QDir::toNativeSeparators(args.at(argCounter++));
+
+ QtCreatorPersistentSettings creatorToolChainSettings;
+
+ if (!creatorToolChainSettings.init(toolChainsXmlFilePath)) {
+ setError(UserDefinedError);
+ setErrorString(tr("Can't read from tool chains xml file(%1) correctly.")
+ .arg(toolChainsXmlFilePath));
+ return false;
+ }
+
+
+ creatorToolChainSettings.addDefaultDebugger(abiString, debuggerPath);
+ return creatorToolChainSettings.save();
+}
+
+bool RegisterDefaultDebuggerOperation::undoOperation()
+{
+ const QStringList args = arguments();
+
+ if (args.count() == 2) {
+ setError(InvalidArguments);
+ setErrorString(tr("Invalid arguments in %0: %1 arguments given, 2 expected.")
+ .arg(name()).arg(args.count()));
+ return false;
+ }
+
+ QString toolChainsXmlFilePath;
+
+// const Installer* const installer = qVariantValue<Installer*>(value(QLatin1String("installer")));
+// if (!installer) {
+// setError(UserDefinedError);
+// setErrorString(tr("Needed installer object in \"%1\" operation is empty.").arg(name()));
+// return false;
+// }
+// const QString &rootInstallPath = installer->value(QLatin1String("TargetDir"));
+// toolChainsXmlFilePath = rootInstallPath + QLatin1String(ToolChainSettingsSuffixPath);
+ toolChainsXmlFilePath = "d:\\toolchains.xml_debugger";
+
+ int argCounter = 0;
+ const QString &abiString = args.at(argCounter++); //for example x86-windows-msys-pe-32bit
+ const QString &debuggerPath = QDir::toNativeSeparators(args.at(argCounter++));
+ Q_UNUSED(debuggerPath)
+
+ QtCreatorPersistentSettings creatorToolChainSettings;
+
+ creatorToolChainSettings.init(toolChainsXmlFilePath);
+ creatorToolChainSettings.removeDefaultDebugger(abiString);
+ return creatorToolChainSettings.save();
+}
+
+bool RegisterDefaultDebuggerOperation::testOperation()
+{
+ return true;
+}
+
+KDUpdaterUpdateOperation* RegisterDefaultDebuggerOperation::clone() const
+{
+ return new RegisterDefaultDebuggerOperation();
+}
diff --git a/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h
new file mode 100644
index 000000000..6cf971573
--- /dev/null
+++ b/installerbuilder/libinstaller/registerdefaultdebuggeroperation.h
@@ -0,0 +1,65 @@
+/**************************************************************************
+**
+** This file is part of Qt SDK**
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).*
+**
+** Contact: Nokia Corporation qt-info@nokia.com**
+**
+** 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).
+**
+**************************************************************************/
+#ifndef REGISTERDEFAULTDEBUGGEROPERATION_H
+#define REGISTERDEFAULTDEBUGGEROPERATION_H
+
+//#include <KDUpdater/UpdateOperation>
+
+#include <QObject>
+#include <QStringList>
+typedef QObject KDUpdaterUpdateOperation;
+
+namespace QInstaller {
+
+class RegisterDefaultDebuggerOperation : public KDUpdaterUpdateOperation
+{
+public:
+ RegisterDefaultDebuggerOperation();
+ ~RegisterDefaultDebuggerOperation();
+ enum error {
+ UserDefinedError,
+ InvalidArguments
+ };
+
+ void setName(const QString &) {}
+ QString name() {return "something";}
+ void setError(error) {}
+ void setErrorString(const QString &) {}
+
+ void setArguments(const QStringList &arguments) {m_arguments = arguments;}
+ QStringList arguments() {return m_arguments;}
+ QStringList m_arguments;
+
+ void backup();
+ bool performOperation();
+ bool undoOperation();
+ bool testOperation();
+ KDUpdaterUpdateOperation* clone() const;
+};
+
+} // namespace
+
+#endif // REGISTERDEFAULTDEBUGGEROPERATION_H