diff -Nru qtcreator-2.7.1/debian/changelog qtcreator-2.7.1/debian/changelog --- qtcreator-2.7.1/debian/changelog 2013-08-22 04:20:55.000000000 +0000 +++ qtcreator-2.7.1/debian/changelog 2013-08-22 23:35:28.000000000 +0000 @@ -1,6 +1,13 @@ -qtcreator (2.7.1-0ubuntu5~precise1~test1) precise; urgency=low +qtcreator (2.7.1-0ubuntu5~precise1~test4) precise; urgency=low + + * Support manifest format which is compatible with click hooks (LP: #1214623) + * The title is filled with the application name in the manifest (LP: #1214626) + * The description field is added to the manifest file (LP: #1214612) + + -- Zoltán Balogh Fri, 23 Aug 2013 02:18:07 +0300 + +qtcreator (2.7.1-0ubuntu1~raring1~test16) raring; urgency=low - * REBUILD TO MATCH UBUNTU 13.10 VERSION * Separate package for runtime data files * Fixed screenshot feature * Improved testability of the Qt Creator ubuntu plugin diff -Nru qtcreator-2.7.1/debian/control qtcreator-2.7.1/debian/control --- qtcreator-2.7.1/debian/control 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/debian/control 2013-08-22 23:09:54.000000000 +0000 @@ -11,33 +11,33 @@ libx11-dev, pkg-config, libbotan1.10-dev, - libqt5svg5, - libqt5svg5-dev, - libqt5sql5-sqlite, - libqt5designercomponents5, - libqt5designer5, - libqt5clucene5, - qttools5-private-dev, - libqt5v8-5-private-dev, - libqt5help5, - qttools5-dev, - qttools5-dev-tools, - qt5-qmake, - qtbase5-private-dev, - libqt5script5, - libqt5scripttools5, + libqt5svg5 (>= 5.0.2~), + libqt5svg5-dev (>= 5.0.2~), + libqt5sql5-sqlite (>= 5.0.2~), + libqt5designercomponents5 (>= 5.0.2~), + libqt5designer5 (>= 5.0.2~), + libqt5clucene5 (>= 5.0.2~), + qttools5-private-dev (>= 5.0.2~), + libqt5v8-5-private-dev (>= 5.0.2~), + libqt5help5 (>= 5.0.2~), + qttools5-dev (>= 5.0.2~), + qttools5-dev-tools (>= 5.0.2~), + qt5-qmake (>= 5.0.2~), + qtbase5-private-dev (>= 5.0.2~), + libqt5script5 (>= 5.0.2~), + libqt5scripttools5 (>= 5.0.2~), qt5-default, - qtscript5-private-dev, - qtxmlpatterns5-dev-tools, - libqt5widgets5, - qttools5-dev-tools, - qtdeclarative5-private-dev, - qtdeclarative5-dev-tools, - qtquick1-5-dev, - qtquick1-5-dev-tools, - libqt5help5, + qtscript5-private-dev (>= 5.0.2~), + qtxmlpatterns5-dev-tools (>= 5.0.2~), + libqt5widgets5 (>= 5.0.2~), + qttools5-dev-tools (>= 5.0.2~), + qtdeclarative5-private-dev (>= 5.0.2~), + qtdeclarative5-dev-tools (>= 5.0.2~), + qtquick1-5-dev (>= 5.0.2~), + qtquick1-5-dev-tools (>= 5.0.2~), qtlocation5-dev, qtsensors5-dev, + g++-4.7 [armhf], libqt5webkit5-dev, libsqlite3-dev, libxslt1-dev, @@ -45,7 +45,7 @@ libgstreamer-plugins-base0.10-dev, libqt5opengl5-dev, libglib2.0-dev, - libxml2-dev + libxml2-dev, Standards-Version: 3.9.3 Homepage: http://qt-project.org/ Vcs-Browser: http://git.debian.org/?p=collab-maint/qt-creator.git @@ -65,7 +65,7 @@ qtdeclarative5-dev, qmlscene, qtcreator-doc, - xterm | x-terminal-emulator + xterm | x-terminal-emulator, Suggests: cmake, git, kdelibs5-data, subversion, ubuntu-sdk, qtquick1-5-dev, qtquick1-5-dev-tools Description: lightweight integrated development environment (IDE) for Qt Qt Creator is a new, lightweight, cross-platform integrated development @@ -107,7 +107,17 @@ Package: qtcreator-plugin-ubuntu Architecture: any -Depends: qtcreator-plugin-ubuntu-common, ubuntu-ui-toolkit-doc, ubuntu-ui-toolkit-examples, android-tools-adb, dh-make, ubuntu-html5-theme, click, qtcreator (= ${binary:Version}), ${misc:Depends} +Depends: qtcreator (= ${binary:Version}), ${misc:Depends}, + qtcreator-plugin-ubuntu-common, + click, + click-dev, + click-doc, + devscripts, + android-tools-adb, + dh-make, + ubuntu-html5-theme, + ubuntu-ui-toolkit-examples, + ubuntu-ui-toolkit-doc, Provides: ubuntu-qtcreator-plugins Conflicts: ubuntu-qtcreator-plugins Replaces: ubuntu-qtcreator-plugins @@ -123,11 +133,9 @@ Package: qtcreator-plugin-ubuntu-cordova Architecture: any -Depends: qtcreator-plugin-ubuntu-cordova-common, qtcreator-plugin-ubuntu, ${misc:Depends} -Recommends: cordovamobilespec, cordovaqt-runtime -Provides: qtcreator-plugin-cordovaqt -Conflicts: qtcreator-plugin-cordovaqt -Replaces: qtcreator-plugin-cordovaqt +Depends: qtcreator-plugin-ubuntu (= ${binary:Version}), ${misc:Depends}, + qtcreator-plugin-ubuntu-cordova-common, +Recommends: cordovamobilespec, cordova-ubuntu-2.8 Description: Cordova Ubuntu plugin for Qt Creator IDE Qt Creator is a new, lightweight, cross-platform integrated development environment (IDE) designed to make development with the Qt application diff -Nru qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu-buildchanges.patch qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu-buildchanges.patch --- qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu-buildchanges.patch 1970-01-01 00:00:00.000000000 +0000 +++ qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu-buildchanges.patch 2013-08-22 23:09:54.000000000 +0000 @@ -0,0 +1,43 @@ +Description: Add Ubuntu plugin modifications to build files + The Ubuntu plugin adds Ubuntu specific functions and welcome screen. + This patch makes the small changes required to build the plugin, while + the plugin itself in another patch is self-contained (does not modify + upstream sources). + . +Author: Juhapekka Piiroinen +Author: Timo Jyrinki +Origin: vendor +Forwarded: no +Last-Update: 2013-08-06 + +Index: qtcreator-2.7.1/src/plugins/plugins.pro +=================================================================== +--- qtcreator-2.7.1.orig/src/plugins/plugins.pro 2013-07-23 12:02:32.858140897 -0400 ++++ qtcreator-2.7.1/src/plugins/plugins.pro 2013-07-23 12:02:32.854140897 -0400 +@@ -46,7 +46,9 @@ + plugin_madde \ + plugin_valgrind \ + plugin_todo \ +- plugin_qnx ++ plugin_qnx \ ++ plugin_ubuntu \ ++ plugin_cordovaubuntuprojectmanager + + exists(../shared/qbs/qbs.pro):SUBDIRS += plugin_qbsprojectmanager + +@@ -352,3 +354,15 @@ + plugin_clearcase.depends = plugin_vcsbase + plugin_clearcase.depends += plugin_projectexplorer + plugin_clearcase.depends += plugin_coreplugin ++ ++plugin_ubuntu.subdir = ubuntu ++plugin_ubuntu.depends = plugin_coreplugin ++plugin_ubuntu.depends += plugin_projectexplorer ++plugin_ubuntu.depends += plugin_qt4projectmanager ++plugin_ubuntu.depends += plugin_qmlprojectmanager ++ ++plugin_cordovaubuntuprojectmanager.subdir = cordovaubuntuprojectmanager ++plugin_cordovaubuntuprojectmanager.depends = plugin_coreplugin ++plugin_cordovaubuntuprojectmanager.depends += plugin_ubuntu ++plugin_cordovaubuntuprojectmanager.depends += plugin_debugger ++plugin_cordovaubuntuprojectmanager.depends += plugin_projectexplorer diff -Nru qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu.patch qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu.patch --- qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu.patch 1970-01-01 00:00:00.000000000 +0000 +++ qtcreator-2.7.1/debian/patches/qtcreator-plugin-ubuntu.patch 2013-08-22 23:09:54.000000000 +0000 @@ -0,0 +1,8862 @@ +Description: Add Ubuntu plugin + The Ubuntu plugin adds Ubuntu specific functions and welcome screen. + It's a work in progress and not suitable for upstreaming as is since it + offers a new welcome screen. Either parts of it should get upstreamed + eventually or upstream should get a real plugin management system to + switch on/off plugins. + . + Note: The plugin assumes 'phablet' user on the target device always, + and /home/phablet home directory. + . +Author: Juhapekka Piiroinen +Origin: vendor +Forwarded: no +Last-Update: 2013-08-06 +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProject.mimetypes.xml ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProject.mimetypes.xml +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProject.mimetypes.xml 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProject.mimetypes.xml 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ Cordova Ubuntu Project file ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProjectManager.pluginspec.in ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProjectManager.pluginspec.in +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProjectManager.pluginspec.in 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/CordovaUbuntuProjectManager.pluginspec.in 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,10 @@ ++ ++ Canonical ++ (C) Canonical ++ GPLv3 ++ ++ https://launchpad.net/~campo ++ ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/common.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/common.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/common.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/common.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,55 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef COMMON_H ++#define COMMON_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/constants.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/constants.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/constants.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/constants.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CORDOVAUBUNTUPROJECTMANAGERCONSTANTS_H ++#define CORDOVAUBUNTUPROJECTMANAGERCONSTANTS_H ++ ++namespace CordovaUbuntuProjectManager { ++ ++const char CORDOVAUBUNTUPROJECT_MIMETYPE[] = "application/x-cordovaproject"; ++const char PROJECTCONTEXT[] = "CordovaUbuntuProject.ProjectContext"; ++const char RC_ID[] = "CordovaUbuntuProjectManager.CordovaUbuntuRunConfiguration"; ++const char GOOGLE_CHROME_PATH[] = "/opt/google/chrome/chrome"; ++const char CHROMIUM_COMMAND[] = "chromium-browser"; ++ ++} ++ ++#endif // CORDOVAUBUNTUPROJECTMANAGERCONSTANTS_H ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cordovaubuntuproject.qrc ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cordovaubuntuproject.qrc +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cordovaubuntuproject.qrc 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cordovaubuntuproject.qrc 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,5 @@ ++ ++ ++ CordovaUbuntuProject.mimetypes.xml ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cordovaubuntuprojectmanager.pro ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cordovaubuntuprojectmanager.pro +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cordovaubuntuprojectmanager.pro 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cordovaubuntuprojectmanager.pro 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,41 @@ ++TARGET = CordovaUbuntuProjectManager ++TEMPLATE = lib ++ ++DEFINES += CORDOVAUBUNTUPROJECTMANAGER_LIBRARY ++ ++QMAKE_CXXFLAGS += -std=c++0x -Wall -Wextra ++ ++SOURCES += \ ++ plugin.cpp \ ++ cproject.cpp \ ++ cprojectfile.cpp \ ++ cruncontrol.cpp \ ++ cprojectnode.cpp \ ++ crunconfiguration.cpp ++ ++HEADERS += \ ++ constants.h \ ++ global.h \ ++ plugin.h \ ++ common.h \ ++ cprojectmanager.h \ ++ cproject.h \ ++ cprojectfile.h \ ++ cruncontrol.h \ ++ cprojectnode.h \ ++ crunconfiguration.h ++ ++PROVIDER = Canonical ++ ++include(../../qtcreatorplugin.pri) ++include(../coreplugin/coreplugin.pri) ++include(../projectexplorer/projectexplorer.pri) ++include(../debugger/debugger.pri) ++include(../ubuntu/ubuntu.pri) ++ ++LIBS += -L$$IDE_PLUGIN_PATH/QtProject ++ ++OTHER_FILES += CordovaUbuntuProject.mimetypes.xml ++ ++RESOURCES += cordovaubuntuproject.qrc ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cproject.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cproject.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cproject.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cproject.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,85 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "cproject.h" ++#include "cprojectmanager.h" ++#include "cruncontrol.h" ++#include "cprojectnode.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++CProject::CProject(CProjectManager *manager, const QString &fileName) ++ : m_manager(manager), ++ m_fileName(fileName) { ++ setProjectContext(Core::Context(PROJECTCONTEXT)); ++ ++ QFileInfo fileInfo(m_fileName); ++ m_projectName = fileInfo.completeBaseName(); ++ ++ m_file = QSharedPointer(new CProjectFile(this, fileName)); ++ ++ Core::DocumentManager::addDocument(m_file.data(), true); ++ ++ m_rootNode = QSharedPointer(new CProjectNode(this, m_file.data())); ++ m_manager->registerProject(this); ++ ++ QList kits = ProjectExplorer::KitManager::instance()->kits(); ++ foreach (ProjectExplorer::Kit *kit, kits) { ++ addTarget(createTarget(kit)); ++ } ++ ++} ++ ++QString CProject::displayName() const { ++ return m_projectName; ++} ++ ++Core::Id CProject::id() const { ++ return Core::Id("CordovaUbuntuProjectManager.CordovaUbuntuProject"); ++} ++ ++Core::IDocument *CProject::document() const { ++ return m_file.data(); ++} ++ ++ProjectExplorer::IProjectManager *CProject::projectManager() const { ++ return m_manager; ++} ++ ++ProjectExplorer::ProjectNode *CProject::rootProjectNode() const { ++ return m_rootNode.data(); ++} ++ ++static void enumChild(const QDir &dir, QStringList &res) { ++ foreach (const QFileInfo &info, dir.entryInfoList(QDir::NoDotAndDotDot|QDir::Dirs|QDir::Files)) { ++ if (info.fileName().indexOf(QLatin1String(".cordovaproject")) != -1) ++ continue; ++ if (info.isFile()) { ++ res.append(info.absoluteFilePath()); ++ } else if (info.isDir()) { ++ enumChild(QDir(info.absoluteFilePath()), res); ++ } ++ } ++} ++ ++QStringList CProject::files(FilesMode) const { ++ QStringList files; ++ enumChild(projectDir(), files); ++ return files; ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cproject.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cproject.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cproject.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cproject.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,62 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CPROJECT_H ++#define CPROJECT_H ++ ++#include "global.h" ++#include "constants.h" ++#include "cprojectfile.h" ++#include "common.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CProjectManager; ++class CProjectFile; ++class CProjectNode; ++class CProject: public ProjectExplorer::Project { ++ Q_OBJECT ++public: ++ CProject(CProjectManager *manager, const QString &fileName); ++ ++ QString displayName() const; ++ Core::Id id() const; ++ Core::IDocument *document() const; ++ ProjectExplorer::IProjectManager *projectManager() const; ++ ++ ProjectExplorer::ProjectNode *rootProjectNode() const; ++ QStringList files(FilesMode fileMode) const; ++ ++ QDir projectDir() const { ++ return QFileInfo(document()->fileName()).dir(); ++ } ++ ++ QString filesFileName() const { ++ return m_fileName; ++ } ++ ++private: ++ CProjectManager *m_manager; ++ QString m_projectName; ++ QSharedPointer m_file; ++ ++ QString m_fileName; ++ QSharedPointer m_rootNode; ++}; ++ ++} ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectfile.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectfile.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectfile.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectfile.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,80 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "cprojectfile.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++CProjectFile::CProjectFile(CProject *parent, QString fileName) ++ : Core::IDocument(parent), ++ m_project(parent), ++ m_fileName(fileName) { ++ QTC_CHECK(m_project); ++ QTC_CHECK(!fileName.isEmpty()); ++} ++ ++bool CProjectFile::save(QString *, const QString &, bool) { ++ return false; ++} ++ ++void CProjectFile::rename(const QString &newName) { ++ // Can't happen... ++ Q_UNUSED(newName); ++ Q_ASSERT(false); ++} ++ ++QString CProjectFile::fileName() const { ++ return m_fileName; ++} ++ ++QString CProjectFile::defaultPath() const { ++ return QString(); ++} ++ ++QString CProjectFile::suggestedFileName() const { ++ return QString(); ++} ++ ++QString CProjectFile::mimeType() const { ++ return QLatin1String(CORDOVAUBUNTUPROJECT_MIMETYPE); ++} ++ ++bool CProjectFile::isModified() const { ++ return false; ++} ++ ++bool CProjectFile::isSaveAsAllowed() const { ++ return false; ++} ++ ++Core::IDocument::ReloadBehavior CProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { ++ Q_UNUSED(state) ++ Q_UNUSED(type) ++ return BehaviorSilent; ++} ++ ++bool CProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType) { ++ Q_UNUSED(errorString) ++ Q_UNUSED(flag) ++ ++ /*if (type == TypeContents) ++ m_project->refreshProjectFile(); ++*/ ++ return true; ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectfile.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectfile.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectfile.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectfile.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CPROJECTFILE_H ++#define CPROJECTFILE_H ++ ++#include "common.h" ++#include "cproject.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CProject; ++class CProjectFile: public Core::IDocument { ++ Q_OBJECT ++public: ++ CProjectFile(CProject *parent, QString fileName); ++ ~CProjectFile() {} ++ ++ bool save(QString *errorString, const QString &fileName, bool autoSave); ++ QString fileName() const; ++ void rename(const QString &newName); ++ ++ QString defaultPath() const; ++ QString suggestedFileName() const; ++ QString mimeType() const; ++ ++ bool isModified() const; ++ bool isSaveAsAllowed() const; ++ ++ ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ++ bool reload(QString *errorString, ReloadFlag flag, ChangeType); ++ ++private: ++ CProject *m_project; ++ QString m_fileName; ++}; ++ ++} ++ ++#endif // CPROJECTFILE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectmanager.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectmanager.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectmanager.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectmanager.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,74 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef PROJECTMANAGER_H ++#define PROJECTMANAGER_H ++ ++#include "common.h" ++#include "cproject.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CProjectManager: public ProjectExplorer::IProjectManager { ++ Q_OBJECT ++public: ++ CProjectManager() {} ++ ++ virtual QString mimeType() const { ++ return QLatin1String(CORDOVAUBUNTUPROJECT_MIMETYPE); ++ } ++ ++ virtual ProjectExplorer::Project *openProject(const QString &fileName, QString *errorString) { ++ QFileInfo fileInfo(fileName); ++ ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ ++ foreach (ProjectExplorer::Project *pi, projectExplorer->session()->projects()) { ++ if (fileName == pi->document()->fileName()) { ++ if (errorString) ++ *errorString = tr("Failed opening project '%1': Project already open") .arg(QDir::toNativeSeparators(fileName)); ++ return 0; ++ } ++ } ++ ++ if (fileInfo.isFile()) ++ return new CProject(this, fileName); ++ ++ *errorString = tr("Failed opening project '%1': Project file is not a file").arg(QDir::toNativeSeparators(fileName)); ++ return 0; ++ } ++/* ++ void notifyChanged(const QString &fileName) { ++ foreach (CProject *project, m_projects) { ++ if (fileName == project->filesFileName()) ++ project->refresh(Project::Files); ++ } ++ } ++*/ ++ void registerProject(CProject *project) { ++ m_projects.append(project); ++ } ++ ++ void unregisterProject(CProject *project) { ++ m_projects.removeAll(project); ++ } ++ ++private: ++ QList m_projects; ++}; ++ ++} ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectnode.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectnode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectnode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectnode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,175 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "cprojectnode.h" ++#include "cproject.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++CProjectNode::CProjectNode(CProject *project, Core::IDocument *projectFile) ++ : ProjectExplorer::ProjectNode(QFileInfo(projectFile->fileName()).absoluteFilePath()), ++ m_project(project), ++ m_projectFile(projectFile) { ++ setDisplayName(QFileInfo(projectFile->fileName()).completeBaseName()); ++ refresh(); ++} ++ ++Core::IDocument *CProjectNode::projectFile() const { ++ return m_projectFile; ++} ++ ++QString CProjectNode::projectFilePath() const { ++ return m_projectFile->fileName(); ++} ++ ++void CProjectNode::refresh() { ++ using namespace ProjectExplorer; ++ ++ removeFileNodes(fileNodes(), this); ++ removeFolderNodes(subFolderNodes(), this); ++ ++ QStringList files = m_project->files(Project::AllFiles); ++ files.removeAll(m_project->filesFileName()); ++ ++ QHash filesInDirectory; ++ ++ foreach (const QString &fileName, files) { ++ QFileInfo fileInfo(fileName); ++ ++ QString absoluteFilePath; ++ QString relativeDirectory; ++ ++ if (fileInfo.isAbsolute()) { ++ absoluteFilePath = fileInfo.filePath(); ++ relativeDirectory = m_project->projectDir().relativeFilePath(fileInfo.path()); ++ } else { ++ absoluteFilePath = m_project->projectDir().absoluteFilePath(fileInfo.filePath()); ++ relativeDirectory = fileInfo.path(); ++ if (relativeDirectory == QLatin1String(".")) ++ relativeDirectory.clear(); ++ } ++ ++ filesInDirectory[relativeDirectory].append(absoluteFilePath); ++ } ++ ++ const QHash::ConstIterator cend = filesInDirectory.constEnd(); ++ for (QHash::ConstIterator it = filesInDirectory.constBegin(); it != cend; ++it) { ++ FolderNode *folder = findOrCreateFolderByName(it.key()); ++ ++ QList fileNodes; ++ foreach (const QString &file, it.value()) { ++ FileType fileType = SourceType; // ### FIXME ++ FileNode *fileNode = new FileNode(file, fileType, false); ++ fileNodes.append(fileNode); ++ } ++ ++ addFileNodes(fileNodes, folder); ++ } ++ ++ m_folderByName.clear(); ++} ++ ++ProjectExplorer::FolderNode *CProjectNode::findOrCreateFolderByName(const QStringList &components, int end) { ++ if (! end) ++ return 0; ++ ++ QString baseDir = QFileInfo(path()).path(); ++ ++ QString folderName; ++ for (int i = 0; i < end; ++i) { ++ folderName.append(components.at(i)); ++ folderName += QLatin1Char('/'); ++ } ++ ++ const QString component = components.at(end - 1); ++ ++ if (component.isEmpty()) ++ return this; ++ ++ else if (FolderNode *folder = m_folderByName.value(folderName)) ++ return folder; ++ ++ FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); ++ folder->setDisplayName(component); ++ ++ m_folderByName.insert(folderName, folder); ++ ++ FolderNode *parent = findOrCreateFolderByName(components, end - 1); ++ if (! parent) ++ parent = this; ++ ++ addFolderNodes(QList() << folder, parent); ++ ++ return folder; ++} ++ ++ProjectExplorer::FolderNode *CProjectNode::findOrCreateFolderByName(const QString &filePath) { ++ QStringList components = filePath.split(QLatin1Char('/')); ++ return findOrCreateFolderByName(components, components.length()); ++} ++ ++bool CProjectNode::hasBuildTargets() const { ++ return true; ++} ++ ++QList CProjectNode::supportedActions(Node *node) const { ++ Q_UNUSED(node); ++ QList actions; ++ actions.append(AddNewFile); ++ actions.append(EraseFile); ++ actions.append(Rename); ++ return actions; ++} ++ ++bool CProjectNode::canAddSubProject(const QString &proFilePath) const { ++ Q_UNUSED(proFilePath) ++ return false; ++} ++ ++bool CProjectNode::addSubProjects(const QStringList &proFilePaths) { ++ Q_UNUSED(proFilePaths) ++ return false; ++} ++ ++bool CProjectNode::removeSubProjects(const QStringList &proFilePaths) { ++ Q_UNUSED(proFilePaths) ++ return false; ++} ++ ++bool CProjectNode::addFiles(const ProjectExplorer::FileType, const QStringList &, QStringList *) { ++ //return m_project->addFiles(filePaths); ++ return false; ++} ++ ++bool CProjectNode::removeFiles(const ProjectExplorer::FileType, const QStringList &, QStringList *) { ++ return false; ++} ++ ++bool CProjectNode::deleteFiles(const ProjectExplorer::FileType, const QStringList &) { ++ return true; ++} ++ ++bool CProjectNode::renameFile(const ProjectExplorer::FileType, const QString &, const QString &) { ++ return true; ++} ++ ++QList CProjectNode::runConfigurationsFor(Node *node) { ++ Q_UNUSED(node) ++ return QList(); ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectnode.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectnode.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cprojectnode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cprojectnode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,73 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CPROJECTNODE_H ++#define CPROJECTNODE_H ++ ++#include "common.h" ++ ++namespace CordovaUbuntuProjectManager { ++class CProject; ++ ++class CProjectNode : public ProjectExplorer::ProjectNode { ++public: ++ CProjectNode(CProject *project, Core::IDocument *projectFile); ++ ++ Core::IDocument *projectFile() const; ++ QString projectFilePath() const; ++ ++ virtual bool hasBuildTargets() const; ++ ++ virtual QList supportedActions(Node *node) const; ++ ++ virtual bool canAddSubProject(const QString &proFilePath) const; ++ ++ virtual bool addSubProjects(const QStringList &proFilePaths); ++ virtual bool removeSubProjects(const QStringList &proFilePaths); ++ ++ virtual bool addFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths, ++ QStringList *notAdded = 0); ++ ++ virtual bool removeFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths, ++ QStringList *notRemoved = 0); ++ ++ virtual bool deleteFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths); ++ ++ virtual bool renameFile(const ProjectExplorer::FileType fileType, ++ const QString &filePath, ++ const QString &newFilePath); ++ virtual QList runConfigurationsFor(Node *node); ++ ++ ++ void refresh(); ++ ++private: ++ FolderNode *findOrCreateFolderByName(const QString &filePath); ++ FolderNode *findOrCreateFolderByName(const QStringList &components, int end); ++ ++private: ++ CProject *m_project; ++ Core::IDocument *m_projectFile; ++ QHash m_folderByName; ++}; ++ ++} ++ ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/crunconfiguration.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/crunconfiguration.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/crunconfiguration.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/crunconfiguration.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,92 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "crunconfiguration.h" ++#include "constants.h" ++#include "cproject.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++QList CRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const { ++ if (!canHandle(parent)) ++ return QList(); ++ ++ QList list; ++ list << Core::Id(RC_ID); ++ ++ return list; ++} ++ ++QString CRunConfigurationFactory::displayNameForId(const Core::Id id) const { ++ if (id == RC_ID) ++ return tr("CordovaUbuntu"); ++ return QString(); ++} ++ ++bool CRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, ++ const Core::Id id) const { ++ if (!canHandle(parent)) ++ return false; ++ ++ if (id == RC_ID) ++ return true; ++ ++ return false; ++} ++ ++ProjectExplorer::RunConfiguration *CRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) { ++ if (!canCreate(parent, id)) ++ return nullptr; ++ return new CRunConfiguration(parent, id); ++} ++ ++bool CRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const { ++ return parent && canCreate(parent, ProjectExplorer::idFromMap(map)); ++} ++ ++ProjectExplorer::RunConfiguration *CRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) { ++ if (!canRestore(parent, map)) ++ return nullptr; ++ ++ /* Core::Id id = ProjectExplorer::idFromMap(map); ++ QmlProjectRunConfiguration *rc = new QmlProjectRunConfiguration(parent, id); ++ if (rc->fromMap(map)) ++ return rc; ++ delete rc;*/ ++ return nullptr; ++} ++ ++bool CRunConfigurationFactory::canClone(ProjectExplorer::Target *, ProjectExplorer::RunConfiguration *) const { ++ return nullptr; ++ // return canCreate(parent, source->id()); ++} ++ ++ProjectExplorer::RunConfiguration *CRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ++ ProjectExplorer::RunConfiguration *source) { ++ if (!canClone(parent, source)) ++ return nullptr; ++ // return new ProjectExplorer::RunConfiguration(parent, qobject_cast(source)); ++ return nullptr; ++} ++ ++bool CRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const { ++ if (!qobject_cast(parent->project())) ++ return false; ++ return true; ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/crunconfiguration.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/crunconfiguration.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/crunconfiguration.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/crunconfiguration.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,72 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CRUNCONFIGURATION_H ++#define CRUNCONFIGURATION_H ++ ++#include "common.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CRunConfiguration : public ProjectExplorer::RunConfiguration { ++ Q_OBJECT ++public: ++ CRunConfiguration(ProjectExplorer::Target *parent, Core::Id id) : ProjectExplorer::RunConfiguration(parent, id) {} ++ ++ QWidget *createConfigurationWidget() { ++ return NULL; ++ } ++ ++ bool isEnabled() const { ++ return true; ++ } ++ ++ ProjectExplorer::Abi Qabi() const { ++ ProjectExplorer::Abi hostAbi = ProjectExplorer::Abi::hostAbi(); ++ return ProjectExplorer::Abi(hostAbi.architecture(), hostAbi.os(), hostAbi.osFlavor(), ++ ProjectExplorer::Abi::RuntimeQmlFormat, hostAbi.wordWidth()); ++ } ++ ++ ~CRunConfiguration() {} ++}; ++ ++class CRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory { ++ Q_OBJECT ++ ++public: ++ explicit CRunConfigurationFactory() { ++ setObjectName(QLatin1String("CRunConfigurationFactory")); ++ } ++ ++ QList availableCreationIds(ProjectExplorer::Target *parent) const; ++ QString displayNameForId(const Core::Id id) const; ++ ++ bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; ++ ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id); ++ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; ++ ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ++ bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; ++ ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ++ ++private: ++ bool canHandle(ProjectExplorer::Target *parent) const; ++}; ++ ++ ++} ++ ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cruncontrol.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cruncontrol.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cruncontrol.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cruncontrol.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,126 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "cruncontrol.h" ++#include "cproject.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++CRunControl::CRunControl(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode, bool debug) ++ : RunControl(runConfiguration, mode) ++{ ++ Utils::Environment env = Utils::Environment::systemEnvironment(); ++ if (debug) { ++ env.appendOrSet(QLatin1String("QTWEBKIT_INSPECTOR_SERVER"),QLatin1String("9222")); ++ } ++ m_applicationLauncher.setEnvironment(env); ++ ++ m_applicationLauncher.setWorkingDirectory(qobject_cast(runConfiguration->target()->project())->projectDir().absolutePath()); ++ ++ m_executable = QLatin1String("/usr/bin/cordova-ubuntu-2.8"); ++ m_commandLineArguments = QLatin1String("."); ++ ++ connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), ++ this, SLOT(slotAppendMessage(QString,Utils::OutputFormat))); ++ connect(&m_applicationLauncher, SIGNAL(processExited(int)), ++ this, SLOT(processExited(int))); ++ connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), ++ this, SLOT(slotBringApplicationToForeground(qint64))); ++ if (debug) { ++ const char *command = CHROMIUM_COMMAND; ++ if (QFile(QLatin1String(GOOGLE_CHROME_PATH)).exists()) ++ command = GOOGLE_CHROME_PATH; ++ m_browser = QSharedPointer(new QProcess()); ++ m_browser->start(QLatin1String(command), QStringList() << QLatin1String("http://localhost:9222/")); ++ } ++} ++ ++CRunControl::~CRunControl() { ++ stop(); ++} ++ ++void CRunControl::start() { ++ m_applicationLauncher.start(ProjectExplorer::ApplicationLauncher::Gui, m_executable, ++ m_commandLineArguments); ++ setApplicationProcessHandle(ProjectExplorer::ProcessHandle(m_applicationLauncher.applicationPID())); ++ emit started(); ++ QString msg = tr("Starting %1 %2\n") ++ .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments); ++ appendMessage(msg, Utils::NormalMessageFormat); ++} ++ ++ProjectExplorer::RunControl::StopResult CRunControl::stop() { ++ m_applicationLauncher.stop(); ++ return StoppedSynchronously; ++} ++ ++bool CRunControl::isRunning() const { ++ return m_applicationLauncher.isRunning(); ++} ++ ++QIcon CRunControl::icon() const { ++ return QIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL)); ++} ++ ++void CRunControl::slotBringApplicationToForeground(qint64 pid) { ++ bringApplicationToForeground(pid); ++} ++ ++void CRunControl::slotAppendMessage(const QString &line, Utils::OutputFormat format) { ++ appendMessage(line, format); ++} ++ ++void CRunControl::processExited(int exitCode) { ++ QString msg = tr("%1 exited with code %2\n") ++ .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); ++ appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat); ++ emit finished(); ++} ++ ++bool CRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode) const { ++ if (!qobject_cast(runConfiguration->target()->project())) ++ return false; ++ if (mode == ProjectExplorer::NormalRunMode || mode == ProjectExplorer::DebugRunMode) ++ return true; ++ return false; ++} ++ ++ProjectExplorer::RunControl *CRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, QString *) { ++ QList runcontrols = ++ ProjectExplorer::ProjectExplorerPlugin::instance()->runControls(); ++ foreach (ProjectExplorer::RunControl *rc, runcontrols) { ++ if (CRunControl *qrc = qobject_cast(rc)) { ++ //TODO: if (qrc->mainQmlFile() == config->mainScript()) ++ qrc->stop(); ++ } ++ } ++ ++ ProjectExplorer::RunControl *runControl = 0; ++ if (mode == ProjectExplorer::NormalRunMode) ++ runControl = new CRunControl(runConfiguration, mode, false); ++ else if (mode == ProjectExplorer::DebugRunMode) ++ runControl = new CRunControl(runConfiguration, mode, true); ++ return runControl; ++} ++ ++QString CRunControlFactory::displayName() const { ++ return tr("Run"); ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cruncontrol.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cruncontrol.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/cruncontrol.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/cruncontrol.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,63 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CRUNCONTROL_H ++#define CRUNCONTROL_H ++ ++#include "common.h" ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CRunControl: public ProjectExplorer::RunControl { ++ Q_OBJECT ++public: ++ CRunControl(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, bool debug = false); ++ virtual ~CRunControl(); ++ ++ void start(); ++ StopResult stop(); ++ bool isRunning() const; ++ QIcon icon() const; ++ ++private slots: ++ void processExited(int exitCode); ++ void slotBringApplicationToForeground(qint64 pid); ++ void slotAppendMessage(const QString &line, Utils::OutputFormat); ++ ++private: ++ ProjectExplorer::ApplicationLauncher m_applicationLauncher; ++ ++ QString m_executable; ++ QString m_commandLineArguments; ++ QSharedPointer m_browser; ++}; ++ ++class CRunControlFactory : public ProjectExplorer::IRunControlFactory { ++ Q_OBJECT ++public: ++ explicit CRunControlFactory() = default; ++ virtual ~CRunControlFactory() {} ++ ++ bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const; ++ ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, QString *); ++ QString displayName() const; ++}; ++} ++ ++#endif +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/global.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/global.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/global.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/global.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,30 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CORDOVAUBUNTUPROJECTMANAGER_GLOBAL_H ++#define CORDOVAUBUNTUPROJECTMANAGER_GLOBAL_H ++ ++#include ++ ++#if defined(CORDOVAUBUNTUPROJECTMANAGER_LIBRARY) ++# define CORDOVAUBUNTUPROJECTMANAGERSHARED_EXPORT Q_DECL_EXPORT ++#else ++# define CORDOVAUBUNTUPROJECTMANAGERSHARED_EXPORT Q_DECL_IMPORT ++#endif ++ ++#endif // CORDOVAUBUNTUPROJECTMANAGER_GLOBAL_H ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/plugin.cpp ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/plugin.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/plugin.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/plugin.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,125 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#include "plugin.h" ++#include "constants.h" ++#include "cprojectmanager.h" ++#include "cruncontrol.h" ++#include "crunconfiguration.h" ++ ++#include ++ ++namespace CordovaUbuntuProjectManager { ++ ++const char FOLDERNAME[] = "%FOLDERNAME%"; ++const char *RUN_ON_DEVICE[] = {"tar -cjf ../%FOLDERNAME%.tar.bz2 ../%FOLDERNAME%", ++ "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P2222 ../%FOLDERNAME%.tar.bz2 phablet@127.0.0.1:~", ++ "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2222 phablet@127.0.0.1 tar -xvf %FOLDERNAME%.tar.bz2", ++ "bash -ic \"echo '[Desktop Entry]\nName=PhoneGap Demo\nType=Application\nExec=cordova-ubuntu-2.8\nIcon=\n' > /tmp/%FOLDERNAME%.desktop\"", ++ "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P2222 /tmp/%FOLDERNAME%.desktop phablet@127.0.0.1:~/%FOLDERNAME%", ++ "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p2222 phablet@127.0.0.1 \"bash -ic \'cordova-ubuntu-2.8 --desktop_file_hint=/home/phablet/%FOLDERNAME%/%FOLDERNAME%.desktop /home/phablet/%FOLDERNAME%\'\"", ++ NULL }; ++ ++static void printToOutputPane(QString msg) { ++ QString timestamp = QDateTime::currentDateTime().toString(QString::fromLatin1("HH:mm:ss")); ++ Core::ICore::instance()->messageManager()->printToOutputPane(QString(QLatin1String("[%0] %1")).arg(timestamp).arg(msg),true); ++} ++ ++bool CordovaUbuntuProjectManagerPlugin::initialize(const QStringList &arguments, QString *errorMessage) { ++ Q_UNUSED(arguments) ++ ++ Core::MimeDatabase *mimeDB = Core::ICore::mimeDatabase(); ++ ++ const QLatin1String mimetypesXml(":/cordovaubuntuproject/CordovaUbuntuProject.mimetypes.xml"); ++ ++ if (!mimeDB->addMimeTypes(mimetypesXml, errorMessage)) ++ return false; ++ ++ addAutoReleasedObject(new CProjectManager); ++ addAutoReleasedObject(new CRunConfigurationFactory); ++ addAutoReleasedObject(new CRunControlFactory); ++ ++ m_actionMenu = new QAction(QLatin1String("Run CordovaUbuntu app on Ubuntu Phone"), this); ++ Core::Command *cmd = Core::ActionManager::registerAction(m_actionMenu, Core::Id("CordovaUbuntu.TOTTTT"), Core::Context(Core::Constants::C_GLOBAL)); ++ connect(m_actionMenu, SIGNAL(triggered()), this, SLOT(menuItemTriggered())); ++ connect(ProjectExplorer::ProjectExplorerPlugin::instance(),SIGNAL(updateRunActions()),this,SLOT(slotUpdateActions())); ++ ++ Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT)->addAction(cmd,Core::Id(ProjectExplorer::Constants::G_BUILD_RUN)); ++ ++ connect(&m_ubuntuProcess,SIGNAL(message(QString)),this,SLOT(onMessage(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(finished(QString,int)),this,SLOT(onFinished(QString,int))); ++ connect(&m_ubuntuProcess,SIGNAL(started(QString)),this,SLOT(onStarted(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(error(QString)),this,SLOT(onError(QString))); ++ ++ return true; ++} ++ ++void CordovaUbuntuProjectManagerPlugin::slotUpdateActions() { ++ ProjectExplorer::ProjectExplorerPlugin* projectExplorerInstance = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ ProjectExplorer::Project* currentProject = projectExplorerInstance->currentProject(); ++ if (currentProject == NULL || !qobject_cast(currentProject)) { ++ m_actionMenu->setEnabled(false); ++ return; ++ } ++ ++ m_actionMenu->setEnabled(currentProject->projectManager()->mimeType() == QLatin1String(CORDOVAUBUNTUPROJECT_MIMETYPE)); ++} ++ ++void CordovaUbuntuProjectManagerPlugin::onStarted(QString cmd) { ++ printToOutputPane(QString::fromLatin1("Started %0").arg(cmd)); ++} ++ ++void CordovaUbuntuProjectManagerPlugin::onMessage(QString msg) { ++ printToOutputPane(msg); ++} ++ ++void CordovaUbuntuProjectManagerPlugin::onError(QString msg) { ++ printToOutputPane(QString::fromLatin1("%0").arg(msg)); ++} ++ ++void CordovaUbuntuProjectManagerPlugin::onFinished(QString cmd, int code) { ++ printToOutputPane(QString::fromLatin1("%0 finished with code %1").arg(cmd).arg(code)); ++} ++ ++void CordovaUbuntuProjectManagerPlugin::menuItemTriggered() { ++ if (m_ubuntuProcess.state() != QProcess::NotRunning) { ++ m_ubuntuProcess.stop(); ++ } ++ ++ ProjectExplorer::Project* project = NULL; ++ ++ project = ProjectExplorer::ProjectExplorerPlugin::instance()->currentProject(); ++ if (project == NULL || !qobject_cast(project)) { ++ QMessageBox::information(Core::ICore::mainWindow(),QLatin1String(Ubuntu::Constants::UBUNTU_DIALOG_NO_PROJECTOPEN_TITLE), ++ QLatin1String(Ubuntu::Constants::UBUNTU_DIALOG_NO_PROJECTOPEN_TEXT)); ++ return; ++ } ++ ++ QString projectDirectory = project->projectDirectory(); ++ QString folderName = QFileInfo(projectDirectory).baseName(); ++ ++ for (int i = 0; RUN_ON_DEVICE[i]; i++) { ++ QStringList cmdList; ++ QString command = QString(QLatin1String(RUN_ON_DEVICE[i])).replace(QLatin1String(FOLDERNAME),folderName); ++ cmdList << command << projectDirectory; ++ m_ubuntuProcess.append(cmdList); ++ } ++ ++ m_ubuntuProcess.start(QLatin1String("Run CordovaUbuntu on Device")); ++} ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/plugin.h ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/plugin.h +--- ubuntu-qtcreator-plugins/empty/plugins/cordovaubuntuprojectmanager/plugin.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/cordovaubuntuprojectmanager/plugin.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,56 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ */ ++ ++#ifndef CORDOVAUBUNTUPROJECTMANAGER_H ++#define CORDOVAUBUNTUPROJECTMANAGER_H ++ ++#include "global.h" ++#include "constants.h" ++#include "common.h" ++ ++#include ++ ++namespace CordovaUbuntuProjectManager { ++ ++class CORDOVAUBUNTUPROJECTMANAGERSHARED_EXPORT CordovaUbuntuProjectManagerPlugin : public ExtensionSystem::IPlugin { ++ Q_OBJECT ++ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "CordovaUbuntuProjectManager.json") ++ ++public: ++ CordovaUbuntuProjectManagerPlugin() {} ++ ~CordovaUbuntuProjectManagerPlugin() {} ++ ++ bool initialize(const QStringList &arguments, QString *errorString); ++ void extensionsInitialized() {} ++ ++private slots: ++ void menuItemTriggered(void); ++ void onStarted(QString); ++ void onMessage(QString); ++ void onError(QString); ++ void onFinished(QString cmd, int code); ++ void slotUpdateActions(); ++ ++private: ++ Ubuntu::Internal::UbuntuProcess m_ubuntuProcess; ++ QAction* m_actionMenu; ++}; ++ ++} ++ ++#endif ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/Ubuntu.pluginspec.in ubuntu-qtcreator-plugins/src/plugins/ubuntu/Ubuntu.pluginspec.in +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/Ubuntu.pluginspec.in 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/Ubuntu.pluginspec.in 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,12 @@ ++ ++ Canonical ++ (C) Canonical Ltd. ++ LGPL ++ Ubuntu support library ++ http://www.ubuntu.com ++ ++ ++ ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/UbuntuProject.mimetypes.xml ubuntu-qtcreator-plugins/src/plugins/ubuntu/UbuntuProject.mimetypes.xml +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/UbuntuProject.mimetypes.xml 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/UbuntuProject.mimetypes.xml 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,9 @@ ++ ++ ++ ++ ++ ++ Ubuntu Project file ++ ++ ++ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/coreapps.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/coreapps.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/device.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/device.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/irc.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/irc.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/launchpad.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/launchpad.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/packaging.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/packaging.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/ubuntu-128.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/ubuntu-128.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/ubuntu-32.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/ubuntu-32.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/ubuntu-48.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/ubuntu-48.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/ubuntu-64.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/ubuntu-64.png differ +Binary files ubuntu-qtcreator-plugins/empty/plugins/ubuntu/images/ubuntu-qtcreator.png and ubuntu-qtcreator-plugins/src/plugins/ubuntu/images/ubuntu-qtcreator.png differ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/manifest.json.template ubuntu-qtcreator-plugins/src/plugins/ubuntu/manifest.json.template +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/manifest.json.template 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/manifest.json.template 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,17 @@ ++{ ++ "name": "com.ubuntu.developer.username.myapp", ++ "version": "0.1", ++ "maintainer": "Your Name ", ++ "title": "My Cool App", ++ "framework": "ubuntu-sdk-13.10", ++ "security": { ++ "profiles": { ++ "myapp": { ++ "policy_groups": [ ++ "networking" ++ ], ++ "policy_version": 1.0 ++ } ++ } ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/manifestlib.js ubuntu-qtcreator-plugins/src/plugins/ubuntu/manifestlib.js +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/manifestlib.js 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/manifestlib.js 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,53 @@ ++var jsonData = undefined; ++ ++function fromJSON($data) { ++ jsonData = JSON.parse($data); ++ return (jsonData !== undefined) ++} ++ ++function toJSON() { ++ return JSON.stringify(jsonData); ++} ++ ++function getName() { ++ return jsonData.name; ++} ++ ++function setName($name) { ++ jsonData.name = $name; ++} ++ ++function setMaintainer($maintainer) { ++ jsonData.maintainer = $maintainer; ++} ++ ++function getMaintainer() { ++ return jsonData.maintainer; ++} ++ ++function setTitle($title) { ++ jsonData.title = $title; ++} ++ ++function getTitle() { ++ return jsonData.title; ++} ++ ++function getPolicyGroups($appname) { ++ var appProfile = jsonData.security.profiles[$appname]; ++ if (appProfile===undefined) { ++ jsonData.security.profiles.push( { $appname: { policy_groups: "" } } ); ++ } ++ return appProfile.policy_groups; ++} ++ ++function setPolicyGroups($appname,$groups) { ++ var $parsed_groups = $groups.split(" "); ++ ++ var $appProfile = jsonData.security.profiles[$appname]; ++ if ($appProfile===undefined) { ++ jsonData.security.profiles.push( { $appname: { policy_groups: $parsed_groups } } ); ++ } else { ++ $appProfile["policy_groups"] = $parsed_groups; ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/resources.qrc ubuntu-qtcreator-plugins/src/plugins/ubuntu/resources.qrc +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/resources.qrc 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/resources.qrc 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,17 @@ ++ ++ ++ images/ubuntu-64.png ++ images/ubuntu-128.png ++ images/ubuntu-qtcreator.png ++ images/ubuntu-48.png ++ images/device.png ++ UbuntuProject.mimetypes.xml ++ images/irc.png ++ images/ubuntu-32.png ++ images/launchpad.png ++ images/coreapps.png ++ images/packaging.png ++ manifest.json.template ++ manifestlib.js ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu.pri ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu.pri +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu.pri 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu.pri 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1 @@ ++LIBS *= -l$$qtLibraryName(Ubuntu) +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu.pro ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu.pro +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu.pro 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu.pro 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,107 @@ ++TEMPLATE = lib ++TARGET = Ubuntu ++DEFINES += UBUNTU_LIBRARY ++ ++QT += network qml quick webkitwidgets script scripttools ++ ++PROVIDER = Canonical ++ ++include($$PWD/../../qtcreatorplugin.pri) ++include($$PWD/../coreplugin/coreplugin.pri) ++include($$PWD/../projectexplorer/projectexplorer.pri) ++include($$PWD/../qmlprojectmanager/qmlprojectmanager.pri) ++include($$PWD/../qt4projectmanager/qt4projectmanager.pri) ++ ++LIBS += -L$$IDE_PLUGIN_PATH/QtProject ++ ++##################################### ++## Project files ++SOURCES += ubuntuplugin.cpp \ ++ ubuntuwelcomemode.cpp \ ++ ubuntuprojectapplicationwizard.cpp \ ++ ubuntumenu.cpp \ ++ ubuntuprojectmanager.cpp \ ++ ubuntuproject.cpp \ ++ ubuntuprojectfile.cpp \ ++ ubuntuprojectnode.cpp \ ++ ubunturunconfiguration.cpp \ ++ ubunturunconfigurationfactory.cpp \ ++ ubunturuncontrol.cpp \ ++ ubunturuncontrolfactory.cpp \ ++ ubuntuprojectapp.cpp \ ++ ubuntuversion.cpp \ ++ ubuntufeatureprovider.cpp \ ++ ubuntuversionmanager.cpp \ ++ ubuntuircmode.cpp \ ++ ubuntuapimode.cpp \ ++ ubuntucoreappsmode.cpp \ ++ ubuntuwikimode.cpp \ ++ ubuntupackagingmode.cpp \ ++ ubuntupackagingwidget.cpp \ ++ ubuntubzr.cpp \ ++ ubuntuclickmanifest.cpp \ ++ ubuntuwebmode.cpp \ ++ ubuntupastebinmode.cpp ++ ++HEADERS += ubuntuplugin.h \ ++ ubuntu_global.h \ ++ ubuntuconstants.h \ ++ ubuntuwelcomemode.h \ ++ ubuntuprojectapplicationwizard.h \ ++ ubuntumenu.h \ ++ ubuntushared.h \ ++ ubuntuprojectmanager.h \ ++ ubuntuproject.h \ ++ ubuntuprojectfile.h \ ++ ubuntuprojectnode.h \ ++ ubunturunconfiguration.h \ ++ ubunturunconfigurationfactory.h \ ++ ubunturuncontrol.h \ ++ ubunturuncontrolfactory.h \ ++ ubuntuprojectapp.h \ ++ ubuntuversion.h \ ++ ubuntufeatureprovider.h \ ++ ubuntuversionmanager.h \ ++ ubuntuircmode.h \ ++ ubuntuapimode.h \ ++ ubuntucoreappsmode.h \ ++ ubuntuwikimode.h \ ++ ubuntupackagingmode.h \ ++ ubuntupackagingwidget.h \ ++ ubuntubzr.h \ ++ ubuntuclickmanifest.h \ ++ ubuntuwebmode.h \ ++ ubuntupastebinmode.h ++ ++RESOURCES += resources.qrc ++ ++HEADERS += \ ++ ubuntudevicemode.h ++ ++SOURCES += \ ++ ubuntudevicemode.cpp ++ ++HEADERS += \ ++ ubuntudeviceswidget.h ++ ++SOURCES += \ ++ ubuntudeviceswidget.cpp ++ ++FORMS += \ ++ ubuntudeviceswidget.ui \ ++ ubuntupackagingwidget.ui ++ ++HEADERS += \ ++ ubuntuprocess.h ++ ++SOURCES += \ ++ ubuntuprocess.cpp ++ ++################################### ++# make sure that the required scripts under share/ubuntu/scripts are executable ++system( chmod +x ../../../share/qtcreator/ubuntu/scripts/* ) ++ ++OTHER_FILES += \ ++ UbuntuProject.mimetypes.xml \ ++ manifest.json.template \ ++ manifestlib.js +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu_global.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu_global.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntu_global.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntu_global.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTU_GLOBAL_H ++#define UBUNTU_GLOBAL_H ++ ++#include ++ ++#if defined(UBUNTU_LIBRARY) ++# define UBUNTUSHARED_EXPORT Q_DECL_EXPORT ++#else ++# define UBUNTUSHARED_EXPORT Q_DECL_IMPORT ++#endif ++ ++ ++#endif // UBUNTU_GLOBAL_H ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuapimode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuapimode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuapimode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuapimode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,39 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuapimode.h" ++#include "ubuntuconstants.h" ++ ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuAPIMode::UbuntuAPIMode(QObject *parent) : ++ UbuntuWebMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_API_DISPLAYNAME)); ++ setId(Ubuntu::Constants::UBUNTU_MODE_API); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_API)); ++ ++ QFile offlineDocs(QLatin1String(Ubuntu::Constants::UBUNTU_API_OFFLINE)); ++ if (offlineDocs.exists()) { ++ setUrl(QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_API_OFFLINE))); ++ } else { ++ setUrl(QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_API_ONLINE))); ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuapimode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuapimode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuapimode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuapimode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,41 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUAPIMODE_H ++#define UBUNTUAPIMODE_H ++ ++#include ++ ++#include "ubuntuwebmode.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuAPIMode : public UbuntuWebMode ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuAPIMode(QObject *parent = 0); ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUAPIMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntubzr.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntubzr.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntubzr.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntubzr.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,48 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntubzr.h" ++#include "ubuntuconstants.h" ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuBzr::UbuntuBzr(QObject *parent) : ++ QObject(parent), m_bInitialized(false) ++{ ++ connect(&m_cmd,SIGNAL(finished(int)),this,SLOT(scriptExecuted(int))); ++ m_cmd.setWorkingDirectory(QCoreApplication::applicationDirPath()); ++} ++ ++void UbuntuBzr::initialize() { ++ m_cmd.start(QString(QLatin1String("%0/qtc_bzr_info")).arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)); ++} ++ ++void UbuntuBzr::scriptExecuted(int sta) { ++ QStringList data = QString(QString::fromLatin1(m_cmd.readAllStandardOutput())).trimmed().split(QLatin1String("\n")); ++ ++ if (data.length()!=2) { ++ return; ++ } ++ ++ this->m_whoami = data.takeFirst(); ++ this->m_launchpadId = data.takeFirst(); ++ ++ m_bInitialized = true; ++ emit initializedChanged(); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntubzr.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntubzr.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntubzr.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntubzr.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,57 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUBZR_H ++#define UBUNTUBZR_H ++ ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuBzr : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuBzr(QObject *parent = 0); ++ ++signals: ++ void initializedChanged(); ++ ++public slots: ++ bool isInitialized() { return m_bInitialized; } ++ QString whoami() { return m_whoami; } ++ QString launchpadId() { return m_launchpadId; } ++ void initialize(); ++ ++protected slots: ++ void scriptExecuted(int); ++ ++protected: ++ bool m_bInitialized; ++ QString m_whoami; ++ QString m_launchpadId; ++ ++ QProcess m_cmd; ++}; ++ ++} ++} ++#endif // UBUNTUBZR_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuclickmanifest.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuclickmanifest.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuclickmanifest.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuclickmanifest.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,210 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuclickmanifest.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuClickManifest::UbuntuClickManifest(QObject *parent) : ++ QObject(parent), m_bInitialized(false) ++ ++{ ++ QScriptEngineDebugger debugger; ++ debugger.attachTo(&engine); ++ debugger.setAutoShowStandardWindow(true); ++ ++ QFile manifestAppFile(QLatin1String(":/ubuntu/manifestlib.js")); ++ if (!manifestAppFile.open(QIODevice::ReadOnly)) { qDebug() << QLatin1String("unable to open js app"); return; } ++ QString manifestApp = QString::fromLatin1(manifestAppFile.readAll()); ++ manifestAppFile.close(); ++ ++ QScriptProgram program(manifestApp); ++ QScriptValue val = engine.evaluate(program); ++ if (val.isNull()) { qWarning() << QLatin1String("unable to process app"); return; } ++ ++ //load(QLatin1String(":/ubuntu/manifest.json.template")); ++ ++} ++ ++void UbuntuClickManifest::setName(QString name) { ++ if (!isInitialized()) { return; } ++ callSetStringFunction(QLatin1String("setName"),name); ++ emit nameChanged(); ++} ++ ++QString UbuntuClickManifest::name() { ++ return callGetStringFunction(QLatin1String("getName")); ++} ++ ++void UbuntuClickManifest::setMaintainer(QString maintainer) { ++ if (!isInitialized()) { return; } ++ ++ callSetStringFunction(QLatin1String("setMaintainer"),maintainer); ++ emit maintainerChanged(); ++} ++ ++QString UbuntuClickManifest::maintainer() { ++ if (!isInitialized()) { return QString(); } ++ return callGetStringFunction(QLatin1String("getMaintainer")); ++} ++ ++void UbuntuClickManifest::setTitle(QString title) { ++ if (!isInitialized()) { return; } ++ callSetStringFunction(QLatin1String("setTitle"),title); ++ emit titleChanged(); ++} ++ ++QString UbuntuClickManifest::title() { ++ if (!isInitialized()) { return QString(); } ++ return callGetStringFunction(QLatin1String("getTitle")); ++} ++ ++void UbuntuClickManifest::setPolicyGroups(QString appName, QStringList groups) { ++ if (!isInitialized()) { return; } ++ ++ QStringList args; ++ args << appName << groups.join(QLatin1String(" ")); ++ callSetStringListFunction(QLatin1String("setPolicyGroups"),args); ++ emit policyGroupsChanged(); ++ ++} ++ ++QStringList UbuntuClickManifest::policyGroups(QString appName) { ++ if (!isInitialized()) { return QStringList(); } ++ QStringList retval = callGetStringListFunction(QLatin1String("getPolicyGroups"),appName); ++ return retval; ++} ++ ++void UbuntuClickManifest::save(QString fileName) { ++ if (!isInitialized()) { return; } ++ ++ setFileName(fileName); ++ ++ QFile file(fileName); ++ ++ if (!file.open(QIODevice::WriteOnly)) { ++ emit error(); ++ qDebug() << QLatin1String("unable to open file for writing"); ++ return; ++ } ++ ++ QJsonDocument jsonDoc = QJsonDocument::fromJson(callGetStringFunction(QLatin1String("toJSON")).toLatin1()); ++ file.write(jsonDoc.toJson()); ++ ++ file.close(); ++ ++ emit saved(); ++} ++ ++void UbuntuClickManifest::reload() { ++ load(m_fileName,m_projectName); ++} ++ ++QString UbuntuClickManifest::raw() { ++ if (!isInitialized()) { return QString(); } ++ return QString::fromLatin1(QJsonDocument::fromJson(callGetStringFunction(QLatin1String("toJSON")).toLatin1()).toJson()); ++} ++ ++void UbuntuClickManifest::setRaw(QString data) { ++ if (!isInitialized()) { return; } ++ callSetStringFunction(QLatin1String("fromJSON"),data); ++ emit loaded(); ++} ++ ++void UbuntuClickManifest::load(QString fileName, QString projectName) { ++ setFileName(fileName); ++ m_projectName = projectName; ++ ++ QFile file(fileName); ++ ++ if (!file.exists()) { ++ emit error(); ++ qDebug() << QLatin1String("file does not exist"); ++ return; ++ } ++ ++ if (!file.open(QIODevice::ReadOnly)) { ++ emit error(); ++ qDebug() << QLatin1String("unable to open file for reading"); ++ return; ++ } ++ ++ QString data = QString::fromLatin1(file.readAll()); ++ file.close(); ++ ++ if (fileName == QLatin1String(":/ubuntu/manifest.json.template")) { ++ data.replace(QLatin1String("myapp"),projectName); ++ } ++ ++ callSetStringFunction(QLatin1String("fromJSON"),data); ++ ++ m_bInitialized = true; ++ emit loaded(); ++} ++ ++QScriptValue UbuntuClickManifest::callFunction(QString functionName, QScriptValueList args) { ++ QScriptValue global = engine.globalObject(); ++ QScriptValue cmd = global.property(functionName); ++ return cmd.call(QScriptValue(),args); ++} ++ ++void UbuntuClickManifest::callSetFunction(QString functionName, QScriptValueList args) { ++ callFunction(functionName,args); ++} ++ ++QScriptValue UbuntuClickManifest::callGetFunction(QString functionName, QScriptValueList args) { ++ return callFunction(functionName,args); ++} ++ ++QStringList UbuntuClickManifest::callGetStringListFunction(QString functionName) { ++ QScriptValue retval = callFunction(functionName,QScriptValueList()); ++ return retval.toVariant().toStringList(); ++} ++ ++QString UbuntuClickManifest::callGetStringFunction(QString functionName) { ++ QScriptValue retval = callFunction(functionName,QScriptValueList()); ++ return retval.toVariant().toString(); ++} ++ ++void UbuntuClickManifest::callSetStringListFunction(QString functionName, QStringList args) { ++ QScriptValueList vargs; ++ foreach (QString arg, args) ++ vargs << QScriptValue(arg); ++ callSetFunction(functionName,vargs); ++} ++ ++void UbuntuClickManifest::callSetStringFunction(QString functionName, QString args) { ++ QScriptValueList vargs; ++ vargs << QScriptValue(args); ++ callSetFunction(functionName,vargs); ++} ++ ++QStringList UbuntuClickManifest::callGetStringListFunction(QString functionName, QString args) { ++ QScriptValueList vargs; ++ vargs << QScriptValue(args); ++ QScriptValue retval = callFunction(functionName,vargs); ++ return retval.toVariant().toStringList(); ++} ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuclickmanifest.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuclickmanifest.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuclickmanifest.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuclickmanifest.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,100 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUCLICKMANIFEST_H ++#define UBUNTUCLICKMANIFEST_H ++ ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuClickManifest : public QObject ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuClickManifest(QObject *parent = 0); ++ ++signals: ++ void nameChanged(); ++ void maintainerChanged(); ++ void titleChanged(); ++ void policyGroupsChanged(); ++ void saved(); ++ void loaded(); ++ void error(); ++ void fileNameChanged(QString); ++ ++public slots: ++ void setName(QString name); ++ QString name(); ++ ++ void setMaintainer(QString maintainer); ++ QString maintainer(); ++ ++ void setTitle(QString title); ++ QString title(); ++ ++ void setPolicyGroups(QString appName, QStringList groups); ++ QStringList policyGroups(QString appName); ++ ++ void save() { save(m_fileName); } ++ void save(QString fileName); ++ void load(QString fileName, QString projectName); ++ void reload(); ++ ++ QString raw(); ++ void setRaw(QString); ++ ++ QString fileName() { return m_fileName; } ++ void setFileName(QString fileName) { m_fileName = fileName; emit fileNameChanged(fileName); } ++ ++ bool isInitialized() { return m_bInitialized; } ++ ++protected: ++ void callSetFunction(QString functionName, QScriptValueList args); ++ void callSetStringListFunction(QString functionName, QStringList args); ++ void callSetStringFunction(QString functionName, QString args); ++ void callSetFunction(QString functionName, QString arg, QStringList args); ++ ++ QScriptValue callGetFunction(QString functionName, QScriptValueList args); ++ QStringList callGetStringListFunction(QString functionName); ++ QStringList callGetStringListFunction(QString functionName, QString args); ++ QString callGetStringFunction(QString functionName); ++ ++ QScriptValue callFunction(QString functionName, QScriptValueList args); ++ ++ QScriptProgram m_manifestJsApp; ++ QScriptEngine engine; ++ ++ QString m_userName; ++ ++ QString m_fileName; ++ QString m_projectName; ++ ++ bool m_bInitialized; ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUCLICKMANIFEST_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuconstants.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuconstants.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuconstants.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuconstants.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,185 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUCONSTANTS_H ++#define UBUNTUCONSTANTS_H ++ ++#include ++#include ++ ++namespace Ubuntu { ++namespace Constants { ++ ++const char UBUNTUPROJECT_MIMETYPE[] = "application/x-ubuntuproject"; ++const char UBUNTUPROJECT_ID[] = "UbuntuProjectManager.UbuntuProject"; ++const char UBUNTUPROJECT_PROJECTCONTEXT[] = "UbuntuProject.ProjectContext"; ++const char UBUNTUPROJECT_SUFFIX[] = ".ubuntuproject"; ++const char UBUNTU_PROJECT_WIZARD_CATEGORY[] = "A.UbuntuProjects"; ++const char UBUNTUPROJECT_DISPLAYNAME[] = "Ubuntu Project"; ++const char UBUNTUPROJECT_RUNCONTROL_ID[] = "UbuntuProjectManager.UbuntuRunConfiguration"; ++ ++const char UBUNTU_PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Ubuntu"); ++ ++const char UBUNTU_UBUNTUPROJECT_TYPE[] = "ubuntuproject"; ++const char UBUNTU_HTMLPROJECT_TYPE[] = "htmlproject"; ++const char UBUNTU_AUTOPILOTPROJECT_TYPE[] = "autopilotproject"; ++const char UBUNTU_QMLPROJECT_TYPE[] = "qmlproject"; ++const char UBUNTU_CORDOVAUBUNTU_TYPE[] = "cordovaproject"; ++const char UBUNTU_QTPROJECT_TYPE[] = "pro"; ++const char UBUNTU_QML_TYPE[] = "qml"; ++const char UBUNTU_HAS_TESTS[] = "hasTests"; ++ ++const QString UBUNTU_WELCOMESCREEN_QML = Core::ICore::resourcePath() + QLatin1String("/ubuntu/welcome/welcome.qml"); ++const QString UBUNTU_TEMPLATESPATH = Core::ICore::resourcePath() + QLatin1String("/templates/wizards/ubuntu/"); ++const QString UBUNTU_MENUPATH = Core::ICore::resourcePath() + QLatin1String("/ubuntu/"); ++const QString UBUNTU_SHAREPATH = Core::ICore::resourcePath() + QLatin1String("/ubuntu/"); ++const QString UBUNTU_SCRIPTPATH = Core::ICore::resourcePath() + QLatin1String("/ubuntu/scripts"); ++ ++const char UBUNTU_MENUJSON[] = "menu.json"; ++const char UBUNTU_MENUJSON_NAME[] = "name"; ++const char UBUNTU_MENUJSON_ID[] = "id"; ++const char UBUNTU_MENUJSON_ACTIONS[] = "actions"; ++const char UBUNTU_MENUJSON_SUBMENU[] = "submenu"; ++const char UBUNTU_MENUJSON_KEYSEQUENCE[] = "keysequence"; ++const char UBUNTU_MENUJSON_QUERYDIALOG[] = "queryDialog"; ++const char UBUNTU_MENUJSON_TITLE[] = "title"; ++const char UBUNTU_MENUJSON_MESSAGE[] = "message"; ++const char UBUNTU_MENUJSON_VALUE[] = "value"; ++const char UBUNTU_MENUJSON_PARENT[] = "parent"; ++const char UBUNTU_MENUJSON_GROUP[] = "group"; ++const char UBUNTU_MENUJSON_WORKINGDIRECTORY[] = "workingDirectory"; ++const char UBUNTU_MENUJSON_PROJECTREQUIRED[] = "projectRequired"; ++const char UBUNTU_MENUJSON_DEVICEREQUIRED[] = "deviceRequired"; ++const char UBUNTU_MENUJSON_QMLPROJECTREQUIRED[] = "qmlProjectRequired"; ++const char UBUNTU_MENUJSON_QMAKEPROJECTREQUIRED[] = "qmakeProjectRequired"; ++const char UBUNTU_MENUJSON_UBUNTUPROJECTREQUIRED[] = "ubuntuProjectRequired"; ++const char UBUNTU_MENUJSON_SAVEREQUIRED[] = "saveRequired"; ++const char UBUNTU_MENUJSON_MESSAGEDIALOG[] = "messageDialog"; ++ ++const char UBUNTU_MENUJSON_PARENT_TOOLS[] = "Tools"; ++const char UBUNTU_MENUJSON_PARENT_WINDOW[] = "Window"; ++const char UBUNTU_MENUJSON_PARENT_HELP[] = "Help"; ++const char UBUNTU_MENUJSON_PARENT_BUILD[] = "Build"; ++const char UBUNTU_MENUJSON_PARENT_FILE[] = "File"; ++const char UBUNTU_MENUJSON_PARENT_EDIT[] = "Edit"; ++const char UBUNTU_MENUJSON_PARENT_TOP[] = "TOP"; ++ ++const char UBUNTU_PROJECTJSON[] = "projectypes.json"; ++const char UBUNTU_PROJECTJSON_DISPLAYNAME[] = "displayName"; ++const char UBUNTU_PROJECTJSON_ID[] = "id"; ++const char UBUNTU_PROJECTJSON_DESCRIPTION[] = "description"; ++const char UBUNTU_PROJECTJSON_FOLDER[] = "folder"; ++const char UBUNTU_PROJECTJSON_TYPE[] = "type"; ++const char UBUNTU_PROJECTJSON_MAINFILE[] = "mainFile"; ++const char UBUNTU_PROJECTJSON_PROJECTFILE[] = "projectFile"; ++const char UBUNTU_PROJECTJSON_FILENAME[] = "fileName"; ++const char UBUNTU_PROJECTJSON_FILES[] = "files"; ++const char UBUNTU_PROJECTJSON_CATEGORY_DISPLAY[] = "categoryDisplay"; ++const char UBUNTU_PROJECTJSON_CATEGORY[] = "category"; ++const char UBUNTU_PROJECTJSON_REQUIRED_FEATURE[] = "requiredFeature"; ++ ++const char UBUNTU_DIALOG_NO_PROJECTOPEN_TITLE[] = "No project open"; ++const char UBUNTU_DIALOG_NO_PROJECTOPEN_TEXT[] = "Open a project or create a new one."; ++ ++const char UBUNTU_PROCESS_COMMAND[] = "command"; ++ ++const char UBUNTU_ACTION_FOLDERNAME[] = "%FOLDERNAME%"; ++const char UBUNTU_ACTION_PROJECTDIRECTORY[] = "%PROJECTDIRECTORY%"; ++const char UBUNTU_ACTION_DISPLAYNAME[] = "%DISPLAYNAME%"; ++const char UBUNTU_ACTION_DISPLAYNAME_UPPER[] = "%DISPLAYNAME_UPPER%"; ++const char UBUNTU_ACTION_DISPLAYNAME_LOWER[] = "%DISPLAYNAME_LOWER%"; ++const char UBUNTU_ACTION_DISPLAYNAME_CAPITAL[] = "%DISPLAYNAME_CAPITAL%"; ++const char UBUNTU_ACTION_PROJECTFILES[] = "%PROJECTFILES%"; ++const char UBUNTU_ACTION_SCRIPTDIRECTORY[] = "%SCRIPTDIRECTORY%"; ++const char UBUNTU_ACTION_SHAREDIRECTORY[] = "%SHAREDIRECTORY%"; ++const char UBUNTU_ACTION_SERIALNUMBER[] = "%SERIALNUMBER%"; ++ ++const char UBUNTU_FILENAME_DISPLAYNAME[] = "displayName"; ++const char UBUNTU_FILENAME_DISPLAYNAME_LOWER[] = "displayName_lower"; ++const char UBUNTU_FILENAME_DISPLAYNAME_UPPER[] = "displayName_upper"; ++const char UBUNTU_FILENAME_DISPLAYNAME_CAPITAL[] = "displayName_capital"; ++ ++const char UBUNTU_MODE_WELCOME[] = "UbuntuWelcome"; ++const char UBUNTU_MODE_WELCOME_DISPLAYNAME[] = "Touch"; ++const char UBUNTU_MODE_WELCOME_ICON[] = ":/ubuntu/images/ubuntu-qtcreator.png"; ++const int UBUNTU_MODE_WELCOME_PRIORITY = 1; ++ ++const char UBUNTU_MODE_PACKAGING[] = "UbuntuPackaging"; ++const char UBUNTU_MODE_PACKAGING_DISPLAYNAME[] = "Packaging"; ++const char UBUNTU_MODE_PACKAGING_ICON[] = ":/ubuntu/images/packaging.png"; ++const int UBUNTU_MODE_PACKAGING_PRIORITY = 80; ++ ++const char UBUNTU_MODE_DEVICES[] = "UbuntuDevices"; ++const char UBUNTU_MODE_DEVICES_DISPLAYNAME[] = "Devices"; ++const char UBUNTU_MODE_DEVICES_ICON[] = ":/ubuntu/images/device.png"; ++const int UBUNTU_MODE_DEVICES_PRIORITY = 11; ++ ++const char UBUNTU_MODE_WEB[] = "UbuntuWeb"; ++const char UBUNTU_MODE_WEB_DISPLAYNAME[] = "WEB"; ++const char UBUNTU_MODE_WEB_ICON[] = ":/ubuntu/images/ubuntu-32.png"; ++const int UBUNTU_MODE_WEB_PRIORITY = 10; ++ ++const char UBUNTU_MODE_PASTEBIN[] = "UbuntuPasteBin"; ++const char UBUNTU_MODE_PASTEBIN_DISPLAYNAME[] = "Pastebin"; ++ ++const char UBUNTU_MODE_IRC[] = "UbuntuIRC"; ++const char UBUNTU_MODE_IRC_DISPLAYNAME[] = "IRC"; ++ ++const char UBUNTU_MODE_API[] = "UbuntuAPI"; ++const char UBUNTU_MODE_API_DISPLAYNAME[] = "API"; ++ ++const char UBUNTU_MODE_COREAPPS[] = "UbuntuCoreApps"; ++const char UBUNTU_MODE_COREAPPS_DISPLAYNAME[] = "Core Apps"; ++ ++const char UBUNTU_MODE_WIKI[] = "UbuntuWiki"; ++const char UBUNTU_MODE_WIKI_DISPLAYNAME[] = "Wiki"; ++ ++const char UBUNTU_IRC[] = "http://webchat.freenode.net/?channels=ubuntu-app-devel"; ++const char UBUNTU_API_ONLINE[] = "http://developer.ubuntu.com/api/devel/ubuntu-13.10/qml/ui-toolkit/overview-ubuntu-sdk.html"; ++const char UBUNTU_API_OFFLINE[] = "/usr/share/ubuntu-ui-toolkit/doc/html/overview-ubuntu-sdk.html"; ++const char UBUNTU_COREAPPS[] = "https://launchpad.net/ubuntu-phone-coreapps/"; ++const char UBUNTU_WIKI[] = "https://wiki.ubuntu.com/Touch"; ++const char UBUNTU_PASTEBIN[] = "http://pastebin.ubuntu.com"; ++ ++const char FEATURE_UNITY_SCOPE[] = "Ubuntu.Wizards.FeatureUnityScope"; ++const char FEATURE_UBUNTU_PRECISE[] = "Ubuntu.Wizards.FeatureUbuntuPrecise"; ++const char FEATURE_UBUNTU_QUANTAL[] = "Ubuntu.Wizards.FeatureUbuntuQuantal"; ++const char FEATURE_UBUNTU_RARING[] = "Ubuntu.Wizards.FeatureUbuntuRaring"; ++const char FEATURE_UBUNTU_SAUCY[] = "Ubuntu.Wizards.FeatureUbuntuSaucy"; ++ ++const char DISTRIB_ID[] = "DISTRIB_ID="; ++const char DISTRIB_CODENAME[] = "DISTRIB_CODENAME="; ++const char DISTRIB_RELEASE[] = "DISTRIB_RELEASE="; ++const char DISTRIB_DESCRIPTION[] = "DISTRIB_DESCRIPTION="; ++const char LSB_RELEASE[] = "/etc/lsb-release"; ++ ++const char PRECISE[] = "precise"; ++const char QUANTAL[] = "quantal"; ++const char RARING[] = "raring"; ++const char SAUCY[] = "saucy"; ++ ++const char PLATFORM_DESKTOP[] = "Desktop"; ++const char PLATFORM_DESKTOP_DISPLAYNAME[] = "Ubuntu %0"; ++ ++const char TASK_DEVICE_SCRIPT[] = "Ubuntu.Task.DeviceScript"; ++ ++} // namespace Ubuntu ++} // namespace Constants ++ ++#endif // UBUNTUCONSTANTS_H ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntucoreappsmode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntucoreappsmode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntucoreappsmode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntucoreappsmode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntucoreappsmode.h" ++#include "ubuntuconstants.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuCoreAppsMode::UbuntuCoreAppsMode(QObject *parent) : ++ UbuntuWebMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_COREAPPS_DISPLAYNAME)); ++ setId(Ubuntu::Constants::UBUNTU_MODE_COREAPPS); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_COREAPPS)); ++ ++ setUrl(QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_COREAPPS))); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntucoreappsmode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntucoreappsmode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntucoreappsmode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntucoreappsmode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUCOREAPPSMODE_H ++#define UBUNTUCOREAPPSMODE_H ++ ++#include "ubuntuwebmode.h" ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuCoreAppsMode : public UbuntuWebMode ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuCoreAppsMode(QObject *parent = 0); ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUCOREAPPSMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudevicemode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudevicemode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudevicemode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudevicemode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,70 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntudevicemode.h" ++#include "ubuntuconstants.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuDeviceMode::UbuntuDeviceMode(QObject *parent) : ++ Core::IMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_DEVICES_DISPLAYNAME)); ++ setIcon(QIcon(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_DEVICES_ICON))); ++ setPriority(Ubuntu::Constants::UBUNTU_MODE_DEVICES_PRIORITY); ++ setId(Ubuntu::Constants::UBUNTU_MODE_DEVICES); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_DEVICES)); ++ ++ m_modeWidget = new QWidget; ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setMargin(0); ++ layout->setSpacing(0); ++ m_modeWidget->setLayout(layout); ++ ++ Utils::StyledBar* styledBar = new Utils::StyledBar(m_modeWidget); ++ layout->addWidget(styledBar); ++ QScrollArea *scrollArea = new QScrollArea(m_modeWidget); ++ scrollArea->setFrameShape(QFrame::NoFrame); ++ layout->addWidget(scrollArea); ++ scrollArea->setWidget(&m_ubuntuDevicesWidget); ++ scrollArea->setWidgetResizable(true); ++ ++ connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), SLOT(modeChanged(Core::IMode*))); ++ ++ setWidget(m_modeWidget); ++} ++ ++void UbuntuDeviceMode::modeChanged(Core::IMode *mode) { ++ ++} ++ ++void UbuntuDeviceMode::initialize() { ++ ++ ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudevicemode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudevicemode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudevicemode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudevicemode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,49 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUDEVICEMODE_H ++#define UBUNTUDEVICEMODE_H ++ ++#include ++#include "ubuntudeviceswidget.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuDeviceMode : public Core::IMode ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuDeviceMode(QObject *parent = 0); ++ void initialize(); ++ ++protected slots: ++ void modeChanged(Core::IMode*); ++ ++protected: ++ QWidget* m_modeWidget; ++ UbuntuDevicesWidget m_ubuntuDevicesWidget; ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++ ++#endif // UBUNTUDEVICEMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,356 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntudeviceswidget.h" ++#include "ui_ubuntudeviceswidget.h" ++ ++#include "ubuntuconstants.h" ++ ++#include ++#include ++ ++ ++UbuntuDevicesWidget *UbuntuDevicesWidget::m_instance = 0; ++ ++UbuntuDevicesWidget *UbuntuDevicesWidget::instance() ++{ ++ return m_instance; ++} ++ ++UbuntuDevicesWidget::UbuntuDevicesWidget(QWidget *parent) : ++ QWidget(parent), ++ ui(new Ui::UbuntuDevicesWidget) ++{ ++ ui->setupUi(this); ++ ++ m_instance = this; ++ m_deviceDetected = false; ++ m_aboutToClose = false; ++ //ui->widgetDeviceInfo->hide(); ++ ui->widgetSshProperties->hide(); ++ ui->pushButtonSshInstall->hide(); ++ ui->pushButtonSshRemove->hide(); ++ ui->widgetDeviceSerial->hide(); ++ //ui->pushButtonCancel->hide(); ++ ui->frameNoDevices->hide(); ++ ui->lblLoading->hide(); ++ ui->frameNoNetwork->hide(); ++ ++ ui->progressBar->setMinimum(0); ++ ui->progressBar->setMaximum(0); ++ ++ connect(&m_ubuntuProcess,SIGNAL(started(QString)),this,SLOT(onStarted(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(message(QString)),this,SLOT(onMessage(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(finished(QString,int)),this,SLOT(onFinished(QString, int))); ++ connect(&m_ubuntuProcess,SIGNAL(error(QString)),this,SLOT(onError(QString))); ++ detectDevices(); ++} ++ ++void UbuntuDevicesWidget::onMessage(QString msg) { ++ m_reply.append(msg); ++ ui->plainTextEdit->appendPlainText(msg.trimmed()); ++} ++ ++void UbuntuDevicesWidget::onStarted(QString cmd) { ++ ui->stackedWidgetConnectedDevice->setCurrentIndex(1); ++ ui->lblDeviceProcessInfo->setText(QFileInfo(cmd).baseName()); ++ //ui->widgetDeviceInfo->hide(); ++ //ui->pushButtonCancel->show(); ++ ui->lblLoading->show(); ++} ++ ++void UbuntuDevicesWidget::onFinished(QString cmd, int code) { ++ ui->stackedWidgetConnectedDevice->setCurrentIndex(0); ++ if (m_aboutToClose) { return; } ++ ++ bool bOk = true; ++ bool bHasNetwork = true; ++ ++ if (cmd == QString::fromLatin1("%0/device_search").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ QStringList lines = m_reply.trimmed().split(QLatin1String("\n")); ++ lines.takeFirst(); ++ foreach(QString line, lines) { ++ QStringList lineData = line.split(QLatin1String(" ")); ++ if (lineData.count() == 2) { ++ QString sSerialNumber = lineData.takeFirst(); ++ QString sDeviceInfo = lineData.takeFirst(); ++ //QString sDeviceName = lineData.takeFirst(); ++ ++ //ui->lblDeviceName->setText(sDeviceName.trimmed()); ++ ui->comboBoxSerialNumber->addItem(sSerialNumber.trimmed(),sDeviceInfo); ++ //ui->lblSerialnumber->setText(sSerialNumber.trimmed()); ++ m_deviceSerialNumber = sSerialNumber.trimmed(); ++ ++ } else { ++ //qDebug() << lineData.count() << lineData; ++ } ++ } ++ ++ // if there are no devices, or if there is no permission ++ if (lines.count() == 0 || ui->comboBoxSerialNumber->currentText().startsWith(QLatin1String("???"))) { ++ ui->frameNoDevices->show(); ++ //ui->widgetDeviceInfo->hide(); ++ ui->widgetDeviceSerial->hide(); ++ ui->comboBoxSerialNumber->clear(); ++ bOk = false; ++ m_deviceDetected = false; ++ ++ ui->stackedWidgetDeviceConnected->setCurrentIndex(0); ++ endAction(QString::fromLatin1(" * there is no device connected.")); ++ } ++ if (lines.count() > 0) { ++ ui->frameNoDevices->hide(); ++ ui->widgetDeviceSerial->show(); ++ ++ m_deviceDetected = true; ++ ui->stackedWidgetDeviceConnected->setCurrentIndex(1); ++ endAction(QString::fromLatin1(" * found %0 devices.").arg(lines.count())); ++ ++ detectDeviceVersion(); ++ } ++ emit updateDeviceActions(); ++ ++ } else if (cmd == QString::fromLatin1("%0/device_version").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..device version detected.")); ++ detectHasNetworkConnection(); ++ } else if (cmd == QString::fromLatin1("%0/openssh_version").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ if (m_reply.trimmed() != QLatin1String("(none)") && m_reply.trimmed() != QLatin1String("")) { ++ endAction(QString::fromLatin1("..openssh-server (%0) is installed.").arg(m_reply.trimmed())); ++ ui->widgetSshProperties->show(); ++ ui->pushButtonSshInstall->hide(); ++ ui->pushButtonSshRemove->show(); ++ ui->stackedWidgetDeveloperMode->setCurrentIndex(1); ++ on_pushButtonPortForward_clicked(); ++ } else { ++ endAction(QString::fromLatin1("..openssh-server was not installed.")); ++ ui->pushButtonSshInstall->show(); ++ ui->pushButtonSshRemove->hide(); ++ ui->widgetSshProperties->hide(); ++ ui->stackedWidgetDeveloperMode->setCurrentIndex(0); ++ } ++ } else if (cmd == QString::fromLatin1("%0/openssh_remove").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..openssh-server was removed.")); ++ detectOpenSsh(); ++ } else if (cmd == QString::fromLatin1("%0/openssh_install").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..openssh-server was installed.")); ++ detectOpenSsh(); ++ } else if (cmd == QString::fromLatin1("%0/device_portforward").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..ports forwarded.")); ++ on_pushButtonSshSetupPublicKey_clicked(); ++ } else if (cmd == QString::fromLatin1("%0/openssh_publickey").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..public key authentication is now set.")); ++ } else if (cmd == QString::fromLatin1("%0/device_network_clone").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..network configuration copied.")); ++ detectHasNetworkConnection(); ++ } else if (cmd == QString::fromLatin1("%0/device_time_clone").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ endAction(QString::fromLatin1("..time configuration copied.")); ++ } else if (cmd == QString::fromLatin1("%0/device_hasnetwork").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH)) { ++ if (m_reply.trimmed() == QString::fromLatin1("1")) { ++ // we have network ++ ui->frameNoNetwork->hide(); ++ ++ detectOpenSsh(); ++ } else { ++ // not set ++ bHasNetwork = false; ++ ui->frameNoNetwork->show(); ++ ui->stackedWidgetDeveloperMode->setCurrentIndex(2); ++ } ++ } else { ++ // left empty ++ } ++ ++ //if (bOk && bHasNetwork) { ++ // ui->widgetDeviceInfo->show(); ++ //} ++ // ui->pushButtonCancel->hide(); ++ ui->lblLoading->hide(); ++ m_reply.clear(); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonReboot_clicked() { ++ beginAction(QString::fromLatin1("Reboot device..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_reboot %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Reboot device..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonShutdown_clicked() { ++ beginAction(QString::fromLatin1("Shutdown device..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_shutdown %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Shutdown device..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonRebootToBootloader_clicked() { ++ beginAction(QString::fromLatin1("Reboot to bootloader..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_reboot2bootloader %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Reboot to bootloader..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonRebootToRecovery_clicked() { ++ beginAction(QString::fromLatin1("Reboot to recovery..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_reboot2recovery %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Reboot to recovery..")); ++} ++ ++void UbuntuDevicesWidget::detectOpenSsh() { ++ beginAction(QString::fromLatin1("Detecting if openssh-server is installed..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/openssh_version %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Detecting openssh-server")); ++} ++ ++void UbuntuDevicesWidget::detectDevices() { ++ beginAction(QString::fromLatin1("Detecting device..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_search").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Searching Ubuntu Touch device")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonSshConnect_clicked() { ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/openssh_connect %1 %2 %3").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()).arg(ui->spinBoxSshPort->value()).arg(ui->lineEditUserName->text()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Opening ssh connection to device")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonCloneNetworkConfig_clicked() { ++ beginAction(QString::fromLatin1("Clone network configuration from host to device..")); ++ ui->frameNoNetwork->hide(); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_network_clone %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Clone network configuration from host to device..")); ++} ++ ++void UbuntuDevicesWidget::on_comboBoxSerialNumber_currentIndexChanged( const QString & text ) { ++ m_deviceSerialNumber = text; ++ if (!text.isEmpty()) { ++ ui->lblDeviceInfo->setText(ui->comboBoxSerialNumber->itemData(ui->comboBoxSerialNumber->currentIndex()).toString()); ++ // FIXME this call should not be called on init ++ detectDeviceVersion(); ++ } ++} ++ ++void UbuntuDevicesWidget::onError(QString msg) { ++ ui->plainTextEdit->appendHtml(QString::fromLatin1("

%0

").arg(msg)); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonRefresh_clicked() { ++ m_deviceDetected = false; ++ m_ubuntuProcess.stop(); ++ ++ ui->plainTextEdit->clear(); ++ ++ m_reply.clear(); ++ ++ ui->frameNoDevices->hide(); ++ ++ //ui->widgetDeviceInfo->hide(); ++ ui->lblLoading->show(); ++ // ui->pushButtonCancel->show(); ++ ++ //ui->lblDeviceName->setText(QLatin1String("")); ++ ui->comboBoxSerialNumber->clear(); ++ // ui->lblSerialnumber->setText(QLatin1String("")); ++ ++ detectDevices(); ++} ++ ++void UbuntuDevicesWidget::beginAction(QString msg) { ++ ui->plainTextEdit->appendHtml(QString::fromLatin1("

%0

").arg(msg)); ++} ++ ++void UbuntuDevicesWidget::endAction(QString msg) { ++ ui->plainTextEdit->appendHtml(QString::fromLatin1("

%0

").arg(msg)); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonPortForward_clicked() { ++ beginAction(QString::fromLatin1("Enabling port forward..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_portforward %1 %2 %3").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()).arg(ui->spinBoxSshPort->value()).arg(ui->spinBoxQmlPort->value()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Enabling port forward..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonSshSetupPublicKey_clicked() { ++ beginAction(QString::fromLatin1("Setting up public key authentication..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/openssh_publickey %1 %2").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()).arg(ui->lineEditUserName->text()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Setting up public key authentication..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonUpgradeToDailyImage_clicked() { ++ beginAction(QString::fromLatin1("Upgrade device to daily..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_flashdaily %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Upgrade device to daily..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonUpgradeToDailyImageWithBootstrap_clicked() { ++ beginAction(QString::fromLatin1("Upgrade device to daily with a full bootstrap..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_flashdaily_bootstrap %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Upgrade device to daily with a full bootstrap..")); ++} ++ ++void UbuntuDevicesWidget::detectHasNetworkConnection() { ++ beginAction(QString::fromLatin1("Check if the device is connected to a network..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_hasnetwork %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Check if the device is connected to a network")); ++} ++ ++QString UbuntuDevicesWidget::serialNumber() { ++ return ui->comboBoxSerialNumber->currentText(); ++} ++ ++void UbuntuDevicesWidget::detectDeviceVersion() { ++ beginAction(QString::fromLatin1("Check device image version..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_version %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Check device image version..")); ++} ++ ++UbuntuDevicesWidget::~UbuntuDevicesWidget() ++{ ++ m_aboutToClose = true; ++ m_ubuntuProcess.stop(); ++ delete ui; ++} ++ ++void UbuntuDevicesWidget::on_pushButtonSshInstall_clicked() { ++ beginAction(QString::fromLatin1("Installing openssh-server..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/openssh_install %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Installing openssh-server..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonCloneTimeConfig_clicked() { ++ beginAction(QString::fromLatin1("Cloning time configuration from host to device..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/device_time_clone %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Cloning time configuration from host to device..")); ++} ++ ++void UbuntuDevicesWidget::on_pushButtonSshRemove_clicked() { ++ beginAction(QString::fromLatin1("Removing openssh-server..")); ++ m_ubuntuProcess.stop(); ++ m_ubuntuProcess.append(QStringList() << QString::fromLatin1("%0/openssh_remove %1").arg(Ubuntu::Constants::UBUNTU_SCRIPTPATH).arg(serialNumber()) << QApplication::applicationDirPath()); ++ m_ubuntuProcess.start(QString::fromLatin1("Removing openssh-server..")); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,92 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUDEVICESWIDGET_H ++#define UBUNTUDEVICESWIDGET_H ++ ++#include ++#include "ubuntuprocess.h" ++ ++namespace Ui { ++class UbuntuDevicesWidget; ++} ++ ++class UbuntuDevicesWidget : public QWidget ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuDevicesWidget(QWidget *parent = 0); ++ ~UbuntuDevicesWidget(); ++ ++ static UbuntuDevicesWidget* instance(); ++ ++ bool deviceDetected() { return m_deviceDetected; } ++ QString serialNumber(); ++ ++ ++signals: ++ void updateDeviceActions(); ++ ++protected slots: ++ void onMessage(QString msg); ++ void onFinished(QString cmd, int code); ++ void onError(QString msg); ++ void onStarted(QString cmd); ++ ++ void on_pushButtonRefresh_clicked(); ++ void on_pushButtonRefresh_2_clicked() { on_pushButtonRefresh_clicked(); } ++ void on_pushButtonSshInstall_clicked(); ++ void on_pushButtonSshRemove_clicked(); ++ void on_pushButtonSshSetupPublicKey_clicked(); ++ void on_pushButtonPortForward_clicked(); ++ void on_pushButtonSshConnect_clicked(); ++ void on_pushButtonReboot_clicked(); ++ void on_pushButtonShutdown_clicked(); ++ void on_pushButtonRebootToBootloader_clicked(); ++ void on_pushButtonRebootToRecovery_clicked(); ++ void on_pushButtonUpgradeToDailyImage_clicked(); ++ void on_pushButtonUpgradeToDailyImageWithBootstrap_clicked(); ++ void on_pushButtonCloneNetworkConfig_clicked(); ++ void on_pushButtonCloneTimeConfig_clicked(); ++ void on_pushButtonCloneNetworkConfig_2_clicked() { on_pushButtonCloneNetworkConfig_clicked(); } ++ void on_comboBoxSerialNumber_currentIndexChanged( const QString & text ); ++ ++ void detectDevices(); ++ void detectOpenSsh(); ++ void detectHasNetworkConnection(); ++ void detectDeviceVersion(); ++ ++private: ++ void beginAction(QString); ++ void endAction(QString); ++ ++ Ui::UbuntuDevicesWidget *ui; ++ ++ Ubuntu::Internal::UbuntuProcess m_ubuntuProcess; ++ QString m_reply; ++ ++ bool m_aboutToClose; ++ bool m_deviceDetected; ++ QString m_deviceSerialNumber; ++ ++ static UbuntuDevicesWidget *m_instance; ++}; ++ ++ ++#endif // UBUNTUDEVICESWIDGET_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.ui ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.ui +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntudeviceswidget.ui 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntudeviceswidget.ui 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,1016 @@ ++ ++ ++ UbuntuDevicesWidget ++ ++ ++ ++ 0 ++ 0 ++ 1148 ++ 741 ++ ++ ++ ++ Form ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #DD4818 ++ ++ ++ QFrame::Plain ++ ++ ++ 3 ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ ++ ++ ++ 9 ++ ++ ++ 9 ++ ++ ++ ++ ++ ++ 0 ++ 50 ++ ++ ++ ++ ++ Ubuntu ++ 26 ++ ++ ++ ++ Ubuntu Device ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 20 ++ ++ ++ ++ false ++ ++ ++ color: rgba(0,0,0,0.2) ++ ++ ++ QFrame::Plain ++ ++ ++ 20 ++ ++ ++ 0 ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ 20 ++ ++ ++ 5 ++ ++ ++ 20 ++ ++ ++ 5 ++ ++ ++ ++ ++ ++ Ubuntu ++ ++ ++ ++ Serial number ++ ++ ++ ++ ++ ++ ++ ++ 200 ++ 0 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ Redetect Devices ++ ++ ++ false ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ QFrame::NoFrame ++ ++ ++ true ++ ++ ++ ++ ++ 0 ++ 0 ++ 1148 ++ 629 ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ QTabWidget::tab-bar { ++alignment: center; ++} ++QTabWidget { ++border: 0; ++} ++ ++ ++ QTabWidget::South ++ ++ ++ 0 ++ ++ ++ false ++ ++ ++ false ++ ++ ++ ++ Device Actions ++ ++ ++ ++ 0 ++ ++ ++ ++ ++ 1 ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ QSizePolicy::MinimumExpanding ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ QFrame::NoFrame ++ ++ ++ QFrame::Raised ++ ++ ++ ++ ++ ++ ++ Ubuntu ++ 12 ++ 50 ++ false ++ false ++ ++ ++ ++ No devices detected. ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ Redetect devices ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ QFrame::NoFrame ++ ++ ++ QFrame::Raised ++ ++ ++ ++ ++ ++ ++ Ubuntu ++ 12 ++ ++ ++ ++ Device has no network connection. ++Connect to a wlan or to a wwan and try again. ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ Clone network config from host to device ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <html><head/><body><p><span style=" font-size:16pt; font-weight:600;">Please wait</span></p><p><br/></p><p>See more details by changing to <span style=" font-style:italic;">Log</span> tab below.</p></body></html> ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ QSizePolicy::MinimumExpanding ++ ++ ++ ++ 365 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ ++ 2 ++ ++ ++ ++ ++ ++ ++ <html><head/><body><p><span style=" font-size:16pt;">Your device has been detected.</span></p><p>Next<span style=" font-weight:600; font-style:italic;"> you </span><span style=" font-weight:600; font-style:italic;">will need to Enable Developer Mode </span>from the right side.</p></body></html> ++ ++ ++ Qt::RichText ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <html><head/><body><p><span style=" font-size:16pt;">Your device has been enabled for developer use!</span></p><p>You will find Ubuntu UI templates from <span style=" font-weight:600;">File &gt; New File or Project</span>. </p><p>After which you can deploy your app to the device using <span style=" font-weight:600; font-style:italic;">CTRL+F12</span> or<br/>by browsing <span style=" font-weight:600; font-style:italic;">Build &gt; Ubuntu Touch &gt; Run Application on Device.</span></p><p>You can also find screenshot feature from <span style=" font-weight:600; font-style:italic;">Tools &gt; Ubuntu Touch</span> and<br/>links from <span style=" font-weight:600; font-style:italic;">Help &gt; Ubuntu Touch</span>.</p><p><br/></p></body></html> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ <html><head/><body><p><span style=" font-size:16pt;">No network connection on your device!</span></p><p>You will need to connect your device to a network with connection to the Internet. </p><p>You can <span style=" font-weight:600; font-style:italic;">clone network config from host to device</span> by clicking a button on the right.</p><p><br/></p></body></html> ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ QTabWidget::West ++ ++ ++ 0 ++ ++ ++ true ++ ++ ++ ++ Simple ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ Clone network config from host to device ++ ++ ++ ++ ++ ++ ++ Clone time config from host to device ++ ++ ++ ++ ++ ++ ++ ++ Ubuntu ++ 12 ++ 50 ++ false ++ false ++ ++ ++ ++ padding: 10; color: #333 ++ ++ ++ Enable developer mode ++ ++ ++ false ++ ++ ++ ++ ++ ++ ++ ++ Ubuntu ++ 12 ++ ++ ++ ++ padding: 10; color: #333 ++ ++ ++ Disable developer mode ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Advanced ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ color: #333 ++ ++ ++ Enable port forward from device to localhost ++ ++ ++ ++ ++ ++ ++ true ++ ++ ++ color: #333 ++ ++ ++ Setup public key authentication ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ Username ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ phablet ++ ++ ++ ++ ++ ++ ++ Ssh Port ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ 1300 ++ ++ ++ 32000 ++ ++ ++ 2222 ++ ++ ++ ++ ++ ++ ++ QML Port ++ ++ ++ ++ ++ ++ ++ false ++ ++ ++ 1300 ++ ++ ++ 32000 ++ ++ ++ 3768 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ color: #333 ++ ++ ++ Open ssh connection to device ++ ++ ++ ++ ++ ++ ++ Flash the device ++ ++ ++ ++ 9 ++ ++ ++ 0 ++ ++ ++ ++ ++ color: #333 ++ ++ ++ Upgrade to daily image ++ ++ ++ ++ ++ ++ ++ color: #333 ++ ++ ++ Upgrade to daily image (with full bootstrap) ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ Device Mode ++ ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #333 ++ ++ ++ Reboot ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #333 ++ ++ ++ Shutdown ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #333 ++ ++ ++ Reboot to ++Bootloader ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #333 ++ ++ ++ Reboot to ++Recovery ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ Executing following script in the background.. ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ ++ 20 ++ ++ ++ ++ TextLabel ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ 24 ++ ++ ++ ++ ++ ++ ++ Please wait.. if you like you can follow the progress on the <i>Log</i> tab at the bottom. ++ ++ ++ Qt::AlignCenter ++ ++ ++ ++ ++ ++ ++ Qt::Vertical ++ ++ ++ ++ 20 ++ 40 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Log ++ ++ ++ ++ ++ ++ QFrame::NoFrame ++ ++ ++ QFrame::Raised ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ Ubuntu ++ ++ ++ ++ background: rgba(238,238,238,0.1) ++ ++ ++ QFrame::Plain ++ ++ ++ Qt::ScrollBarAlwaysOn ++ ++ ++ Qt::ScrollBarAlwaysOff ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntufeatureprovider.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntufeatureprovider.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntufeatureprovider.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntufeatureprovider.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,36 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntufeatureprovider.h" ++ ++using namespace Ubuntu::Internal; ++ ++Core::FeatureSet UbuntuFeatureProvider::availableFeatures(const QString &platformName) const ++{ ++ return UbuntuVersionManager::instance()->availableFeatures(platformName); ++} ++ ++QStringList UbuntuFeatureProvider::availablePlatforms() const ++{ ++ return UbuntuVersionManager::instance()->availablePlatforms(); ++} ++ ++QString UbuntuFeatureProvider::displayNameForPlatform(const QString &string) const ++{ ++ return UbuntuVersionManager::instance()->displayNameForPlatform(string); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntufeatureprovider.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntufeatureprovider.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntufeatureprovider.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntufeatureprovider.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,42 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUFEATUREPROVIDER_H ++#define UBUNTUFEATUREPROVIDER_H ++ ++#include ++#include "ubuntuversionmanager.h" ++ ++namespace Ubuntu { ++namespace Internal { ++class UbuntuFeatureProvider : public Core::IFeatureProvider ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuFeatureProvider() {} ++ ++ Core::FeatureSet availableFeatures(const QString &platformName) const; ++ QStringList availablePlatforms() const; ++ QString displayNameForPlatform(const QString &string) const; ++ ++}; ++} ++} ++ ++#endif // UBUNTUFEATUREPROVIDER_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuircmode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuircmode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuircmode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuircmode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuircmode.h" ++#include "ubuntuconstants.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuIRCMode::UbuntuIRCMode(QObject *parent) : ++ UbuntuWebMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_IRC_DISPLAYNAME)); ++ setId(Ubuntu::Constants::UBUNTU_MODE_IRC); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_IRC)); ++ ++ setUrl(QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_IRC))); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuircmode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuircmode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuircmode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuircmode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUIRCMODE_H ++#define UBUNTUIRCMODE_H ++ ++#include "ubuntuwebmode.h" ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuIRCMode : public UbuntuWebMode ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuIRCMode(QObject *parent = 0); ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUIRCMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntumenu.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntumenu.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntumenu.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntumenu.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,425 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntumenu.h" ++#include "ubuntushared.h" ++#include "ubuntuconstants.h" ++#include "ubuntudeviceswidget.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++UbuntuMenu::UbuntuMenu(QObject *parent) : ++ QObject(parent) ++{ ++ m_obj = getMenuJSON(); ++ ++ connect(&m_ubuntuProcess,SIGNAL(message(QString)),this,SLOT(onMessage(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(finished(QString,int)),this,SLOT(onFinished(QString,int))); ++ connect(&m_ubuntuProcess,SIGNAL(started(QString)),this,SLOT(onStarted(QString))); ++ connect(&m_ubuntuProcess,SIGNAL(error(QString)),this,SLOT(onError(QString))); ++ ++ connect(ProjectExplorer::ProjectExplorerPlugin::instance(),SIGNAL(updateRunActions()),this,SLOT(slotUpdateActions())); ++ connect(UbuntuDevicesWidget::instance(),SIGNAL(updateDeviceActions()),this,SLOT(slotUpdateActions())); ++} ++ ++ ++void UbuntuMenu::slotUpdateActions() { ++ ProjectExplorer::ProjectExplorerPlugin* projectExplorerInstance = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ ProjectExplorer::Project* startupProject = projectExplorerInstance->startupProject(); ++ bool isQmlProject = false; ++ bool isQmakeProject = false; ++ bool isUbuntuProject = false; ++ ++ if (startupProject) { ++ isQmlProject = (startupProject->projectManager()->mimeType() == QLatin1String("application/x-qmlproject")); ++ isQmakeProject = (startupProject->projectManager()->mimeType() == QLatin1String("application/vnd.nokia.qt.qmakeprofile")); ++ isUbuntuProject = (startupProject->projectManager()->mimeType() == QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE)); ++ } ++ ++ //bool canRun = projectExplorerInstance->canRun(startupProject,ProjectExplorer::NormalRunMode); ++ bool projectOpen = (startupProject!=NULL); ++ bool deviceDetected = UbuntuDevicesWidget::instance()->deviceDetected(); ++ ++ foreach(QAction* act, m_actions) { ++ bool requiresDevice = act->property(Constants::UBUNTU_MENUJSON_DEVICEREQUIRED).toBool(); ++ bool requiresProject = act->property(Constants::UBUNTU_MENUJSON_PROJECTREQUIRED).toBool(); ++ bool requiresQmlProject = act->property(Constants::UBUNTU_MENUJSON_QMLPROJECTREQUIRED).toBool(); ++ bool requiresQmakeProject = act->property(Constants::UBUNTU_MENUJSON_QMAKEPROJECTREQUIRED).toBool(); ++ bool requiresUbuntuProject = act->property(Constants::UBUNTU_MENUJSON_UBUNTUPROJECTREQUIRED).toBool(); ++ bool actionEnabled = ( (requiresQmakeProject ? isQmakeProject : true) && (requiresQmlProject ? isQmlProject : true) && (requiresDevice ? deviceDetected : true) && (requiresProject ? projectOpen : true) && (requiresUbuntuProject ? isUbuntuProject : true)); ++ ++ act->setEnabled( actionEnabled ); ++ } ++} ++ ++void UbuntuMenu::onStarted(QString cmd) { ++ printToOutputPane(QString::fromLatin1("Started %0").arg(cmd)); ++} ++ ++void UbuntuMenu::onMessage(QString msg) { ++ printToOutputPane(msg); ++} ++ ++void UbuntuMenu::onError(QString msg) { ++ printToOutputPane(QString::fromLatin1("%0").arg(msg)); ++} ++ ++void UbuntuMenu::onFinished(QString cmd, int code) { ++ printToOutputPane(QString::fromLatin1("%0 finished with code %1").arg(cmd).arg(code)); ++} ++ ++QString UbuntuMenu::menuPath(QString fileName) { ++ return Constants::UBUNTU_MENUPATH + fileName; ++} ++ ++QJsonDocument UbuntuMenu::getMenuJSON() { ++ QByteArray contents; ++ QString errorMsg; ++ if (readFile(menuPath(QLatin1String(Constants::UBUNTU_MENUJSON)),&contents, &errorMsg) == false) { ++ qDebug() << __PRETTY_FUNCTION__ << errorMsg; ++ } ++ QJsonParseError error; ++ QJsonDocument retval = QJsonDocument::fromJson(contents,&error); ++ if (error.error != QJsonParseError::NoError) { ++ qDebug() << error.errorString(); ++ } ++ return retval; ++} ++ ++void UbuntuMenu::parseMenu(QJsonObject obj, Core::ActionContainer*& parent, const Core::Id &group) { ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_SUBMENU))) { ++ QString menuName, menuId; ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_NAME))) { ++ menuName = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_NAME)).toString(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_ID))) { ++ menuId = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_ID)).toString(); ++ } ++ Core::ActionContainer *actionContainer = Core::ActionManager::createMenu(Core::Id(menuId)); ++ actionContainer->menu()->setTitle(menuName); ++ actionContainer->menu()->setObjectName(menuId); ++ ++ QJsonValue submenu = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_SUBMENU)); ++ if (submenu.isArray()) { ++ QJsonArray submenuArray = submenu.toArray(); ++ for (int idx=0; idxaddMenu(actionContainer,group); ++ } ++ } else if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_ACTIONS))) { ++ QString actionName; ++ QString actionId; ++ QString actionKeySequence; ++ QString actionWorkingDirectory; ++ bool actionProjectRequired = false; ++ bool actionDeviceRequired = false; ++ bool actionQmlProjectRequired = false; ++ bool actionQmakeProjectRequired = false; ++ bool actionUbuntuProjectRequired = false; ++ bool actionSaveRequired = false; ++ ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_NAME))) { ++ actionName = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_NAME)).toString(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_ID))) { ++ actionId = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_ID)).toString(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_KEYSEQUENCE))) { ++ actionKeySequence = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_KEYSEQUENCE)).toString(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_WORKINGDIRECTORY))) { ++ actionWorkingDirectory = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_WORKINGDIRECTORY)).toString(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_PROJECTREQUIRED))) { ++ actionProjectRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_PROJECTREQUIRED)).toBool(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_DEVICEREQUIRED))) { ++ actionDeviceRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_DEVICEREQUIRED)).toBool(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_QMLPROJECTREQUIRED))) { ++ actionQmlProjectRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_QMLPROJECTREQUIRED)).toBool(); ++ } ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_QMAKEPROJECTREQUIRED))) { ++ actionQmakeProjectRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_QMAKEPROJECTREQUIRED)).toBool(); ++ } ++ ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_UBUNTUPROJECTREQUIRED))) { ++ actionUbuntuProjectRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_UBUNTUPROJECTREQUIRED)).toBool(); ++ } ++ ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_SAVEREQUIRED))) { ++ actionSaveRequired = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_SAVEREQUIRED)).toBool(); ++ } ++ ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_ACTIONS)) && obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_ACTIONS)).isArray()) { ++ ++ QJsonValue actions = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_ACTIONS)); ++ if (actions.isArray()) { ++ QJsonArray actionsArray = actions.toArray(); ++ QJsonValueList actionsList; ++ for (int idx=0; idxsetObjectName(actionId); ++ ++ Core::Command *cmd = Core::ActionManager::registerAction(act, Core::Id(actionId), Core::Context(Core::Constants::C_GLOBAL)); ++ if (actionKeySequence.isEmpty() == false) { ++ cmd->setDefaultKeySequence(QKeySequence(actionKeySequence)); ++ } ++ if (actionWorkingDirectory.isEmpty() == false) { ++ act->setProperty(Constants::UBUNTU_MENUJSON_WORKINGDIRECTORY,actionWorkingDirectory); ++ } ++ ++ act->setProperty(Constants::UBUNTU_MENUJSON_PROJECTREQUIRED,actionProjectRequired); ++ act->setProperty(Constants::UBUNTU_MENUJSON_DEVICEREQUIRED,actionDeviceRequired); ++ act->setProperty(Constants::UBUNTU_MENUJSON_QMAKEPROJECTREQUIRED,actionQmakeProjectRequired); ++ act->setProperty(Constants::UBUNTU_MENUJSON_QMLPROJECTREQUIRED,actionQmlProjectRequired); ++ act->setProperty(Constants::UBUNTU_MENUJSON_UBUNTUPROJECTREQUIRED,actionUbuntuProjectRequired); ++ act->setProperty(Constants::UBUNTU_MENUJSON_SAVEREQUIRED,actionSaveRequired); ++ ++ connect(act, SIGNAL(triggered()), this, SLOT(menuItemTriggered())); ++ m_actions.append(act); ++ ++ if (parent == NULL) { ++ qWarning() << "No menu defined"; ++ } else { ++ parent->addAction(cmd,group); ++ } ++ } ++ ++} ++ ++void UbuntuMenu::menuItemTriggered() { ++ QAction* act = qobject_cast(sender()); ++ if (act) { ++ ++ // if we are executing something now, then kill it! ++ if (m_ubuntuProcess.state() != QProcess::NotRunning) { ++ m_ubuntuProcess.stop(); ++ } ++ ++ QVariant projectRequired = act->property(Constants::UBUNTU_MENUJSON_PROJECTREQUIRED); ++ ProjectExplorer::Project* project = NULL; ++ ++ if (projectRequired.isValid() && projectRequired.toBool() == true) { ++ project = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject(); ++ ++ if (project == NULL) { ++ QMessageBox::information(Core::ICore::mainWindow(),QLatin1String(Constants::UBUNTU_DIALOG_NO_PROJECTOPEN_TITLE),QLatin1String(Constants::UBUNTU_DIALOG_NO_PROJECTOPEN_TEXT)); ++ return; ++ } ++ } ++ ++ QVariant saveModifiedFilesRequired = act->property(Constants::UBUNTU_MENUJSON_SAVEREQUIRED); ++ if (saveModifiedFilesRequired.isValid() && saveModifiedFilesRequired.toBool()==true) { ++ ProjectExplorer::ProjectExplorerPlugin::instance()->saveModifiedFiles(); ++ } ++ ++ if (m_commandMap.contains(act->text())) { ++ QJsonValueList actions = m_commandMap.value(act->text()); ++ ++ QString queryData; ++ bool bQueryOk = false; ++ bool bQuery = false; ++ ++ for (int idx=0; idx < actions.size(); idx++) { ++ QJsonValue value = actions.at(idx); ++ if (value.isObject()) { ++ QJsonObject obj = value.toObject(); ++ ++ // check if the object is a querydialog ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_QUERYDIALOG))) { ++ QJsonValue queryDialog = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_QUERYDIALOG)); ++ if (queryDialog.isObject()) { ++ QJsonObject queryDialogObj = queryDialog.toObject(); ++ QString queryDialogTitle; ++ QString queryDialogMessage; ++ QString queryDialogValue; ++ ++ if (queryDialogObj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_TITLE))) { ++ queryDialogTitle = queryDialogObj.value(QLatin1String(Constants::UBUNTU_MENUJSON_TITLE)).toString(); ++ } ++ ++ if (queryDialogObj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGE))) { ++ queryDialogMessage = queryDialogObj.value(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGE)).toString(); ++ } ++ ++ if (queryDialogObj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_VALUE))) { ++ queryDialogValue = queryDialogObj.value(QLatin1String(Constants::UBUNTU_MENUJSON_VALUE)).toString(); ++ } ++ ++ queryData = QInputDialog::getText(Core::ICore::mainWindow(), queryDialogTitle, ++ queryDialogMessage, QLineEdit::Normal, ++ queryDialogValue, &bQueryOk); ++ ++ // raise a flag that there is query data available for future actions ++ bQuery = true; ++ ++ // if user has cancelled ++ if (bQueryOk == false) { ++ // clear queue ++ m_ubuntuProcess.clear(); ++ return; ++ } ++ } ++ // check if messageDialog ++ } else if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGEDIALOG))) { ++ QJsonValue messageDialog = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGEDIALOG)); ++ if (messageDialog.isObject()) { ++ QJsonObject messageDialogObj = messageDialog.toObject(); ++ QString messageDialogTitle; ++ QString messageDialogMessage; ++ ++ if (messageDialogObj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_TITLE))) { ++ messageDialogTitle = messageDialogObj.value(QLatin1String(Constants::UBUNTU_MENUJSON_TITLE)).toString(); ++ } ++ ++ if (messageDialogObj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGE))) { ++ messageDialogMessage = messageDialogObj.value(QLatin1String(Constants::UBUNTU_MENUJSON_MESSAGE)).toString(); ++ } ++ ++ QMessageBox::information(Core::ICore::mainWindow(), messageDialogTitle, ++ messageDialogMessage); ++ } ++ } ++ // check if command ++ } else if (value.isString()) { ++ QString command = value.toString(); ++ QString workingDirectory; ++ ++ if (project) { ++ ++ QString projectDirectory = project->projectDirectory(); ++ QString displayName = project->displayName(); ++ QString folderName = QFileInfo(projectDirectory).baseName(); ++ QStringList projectFiles = project->files(ProjectExplorer::Project::AllFiles); ++ ++ QString workingDirectoryData = act->property(Constants::UBUNTU_MENUJSON_WORKINGDIRECTORY).toString(); ++ if (workingDirectoryData.isEmpty() == false) { ++ workingDirectory = workingDirectoryData.arg(projectDirectory); ++ } else { ++ workingDirectory = projectDirectory; ++ } ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_PROJECTDIRECTORY),projectDirectory); ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_FOLDERNAME),folderName); ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_DISPLAYNAME),displayName); ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_PROJECTFILES),projectFiles.join(QLatin1String(" "))); ++ } ++ ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_SHAREDIRECTORY),Constants::UBUNTU_SHAREPATH); ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_SCRIPTDIRECTORY),Constants::UBUNTU_SCRIPTPATH); ++ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_SERIALNUMBER),UbuntuDevicesWidget::instance()->serialNumber()); ++ ++ if (bQuery && bQueryOk) { ++ command = QString(command).arg(queryData); ++ } ++ ++ QStringList cmdList; ++ cmdList << command << workingDirectory; ++ m_ubuntuProcess.append(cmdList); ++ } ++ } ++ m_ubuntuProcess.start(act->text()); ++ } else { ++ qWarning() << __PRETTY_FUNCTION__ << "No actions defined in map"; ++ } ++ } else { ++ qWarning() << __PRETTY_FUNCTION__ << "Could not cast to action"; ++ } ++} ++ ++void UbuntuMenu::initialize() { ++ if (m_obj.isObject()) { ++ QJsonObject tmp = m_obj.object(); ++ ++ foreach (QString key, tmp.keys()) { ++ if (tmp.contains(key)) { ++ QJsonObject obj = tmp.value(key).toObject(); ++ ++ Core::ActionContainer *actionContainer = NULL; ++ ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_PARENT))) { ++ QString parentValue = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_PARENT)).toString(); ++ if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_TOOLS)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_EDIT)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_EDIT); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_HELP)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_HELP); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_WINDOW)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_WINDOW); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_FILE)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_FILE); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_BUILD)) actionContainer = Core::ActionManager::actionContainer(ProjectExplorer::Constants::M_BUILDPROJECT); ++ else if (parentValue == QLatin1String(Constants::UBUNTU_MENUJSON_PARENT_TOP)) actionContainer = Core::ActionManager::actionContainer(Core::Constants::MENU_BAR); ++ else actionContainer = Core::ActionManager::actionContainer(Core::Id(parentValue)); ++ } else { ++ actionContainer = Core::ActionManager::actionContainer(Core::Constants::M_TOOLS); ++ } ++ ++ QString group; ++ if (obj.contains(QLatin1String(Constants::UBUNTU_MENUJSON_GROUP))) { ++ group = obj.value(QLatin1String(Constants::UBUNTU_MENUJSON_GROUP)).toString(); ++ } ++ ++ Core::Id groupId; ++ if (!group.isEmpty()) { ++ groupId = Core::Id(group); ++ } ++ parseMenu(obj,actionContainer,groupId); ++ } ++ } ++ } else { ++ qDebug() << "json is not valid"; ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntumenu.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntumenu.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntumenu.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntumenu.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,77 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUMENU_H ++#define UBUNTUMENU_H ++ ++#include ++ ++ ++#include "ubuntuprocess.h" ++#include "ubuntuconstants.h" ++ ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++ ++class UbuntuMenu : public QObject ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuMenu(QObject *parent = 0); ++ ++ void initialize(); ++ ++ void parseMenu(QJsonObject obj, Core::ActionContainer*& parent, const Core::Id &group = Core::Id()); ++ ++ QString menuPath(QString fileName); ++ QJsonDocument getMenuJSON(); ++ ++public slots: ++ void slotUpdateActions(); ++ ++protected slots: ++ void menuItemTriggered(); ++ void onStarted(QString); ++ void onMessage(QString); ++ void onError(QString); ++ void onFinished(QString cmd, int code); ++ ++protected: ++ typedef QList QJsonValueList; ++ ++ QJsonDocument m_obj; ++ QMap m_commandMap; ++ ++ UbuntuProcess m_ubuntuProcess; ++ ++ QList m_actions; ++ ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++ ++#endif // UBUNTUMENU_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingmode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingmode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingmode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingmode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,116 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntupackagingmode.h" ++#include "ubuntuconstants.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuPackagingMode::UbuntuPackagingMode(QObject *parent) : ++ Core::IMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_PACKAGING_DISPLAYNAME)); ++ setIcon(QIcon(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_PACKAGING_ICON))); ++ setPriority(Ubuntu::Constants::UBUNTU_MODE_PACKAGING_PRIORITY); ++ setId(Ubuntu::Constants::UBUNTU_MODE_PACKAGING); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_PACKAGING)); ++ ++ //TODO: enable only when there is a qml project open. Otherwise this tab should remain disabled. ++ ++ m_modeWidget = new QWidget; ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setMargin(0); ++ layout->setSpacing(0); ++ m_modeWidget->setLayout(layout); ++ ++ ++ Utils::StyledBar* styledBar = new Utils::StyledBar(m_modeWidget); ++ layout->addWidget(styledBar); ++ QScrollArea *scrollArea = new QScrollArea(m_modeWidget); ++ scrollArea->setFrameShape(QFrame::NoFrame); ++ layout->addWidget(scrollArea); ++ scrollArea->setWidget(&m_ubuntuPackagingWidget); ++ scrollArea->setWidgetResizable(true); ++ ++ connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), SLOT(modeChanged(Core::IMode*))); ++ ++ ProjectExplorer::SessionManager* sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session(); ++ connect(sessionManager,SIGNAL(projectAdded(ProjectExplorer::Project*)),SLOT(on_projectAdded(ProjectExplorer::Project*))); ++ connect(sessionManager,SIGNAL(projectRemoved(ProjectExplorer::Project*)),SLOT(on_projectRemoved(ProjectExplorer::Project*))); ++ ++ setWidget(m_modeWidget); ++ setEnabled(false); ++} ++ ++void UbuntuPackagingMode::initialize() { ++ ++} ++ ++void UbuntuPackagingMode::modeChanged(Core::IMode* currentMode) { ++ if (currentMode->id() == id()) { ++ ProjectExplorer::ProjectExplorerPlugin* projectExplorerInstance = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ ProjectExplorer::Project* startupProject = projectExplorerInstance->startupProject(); ++ ++ bool isQmlProject = false; ++ bool isQmakeProject = false; ++ bool isUbuntuProject = false; ++ ++ if (startupProject) { ++ isQmlProject = (startupProject->projectManager()->mimeType() == QLatin1String("application/x-qmlproject")); ++ isQmakeProject = (startupProject->projectManager()->mimeType() == QLatin1String("application/vnd.nokia.qt.qmakeprofile")); ++ isUbuntuProject = (startupProject->projectManager()->mimeType() == QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE)); ++ } ++ ++ if (isQmlProject || isUbuntuProject) { ++ m_ubuntuPackagingWidget.openManifestForProject(); ++ m_ubuntuPackagingWidget.setAvailable(true); ++ } else { ++ m_ubuntuPackagingWidget.setAvailable(false); ++ } ++ ++ } else if (previousMode == id()) { ++ m_ubuntuPackagingWidget.save(); ++ } ++ ++ previousMode = currentMode->id(); ++} ++ ++ ++void UbuntuPackagingMode::on_projectAdded(ProjectExplorer::Project *project) { ++ ProjectExplorer::SessionManager* sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session(); ++ this->setEnabled(sessionManager->projects().count()>0); ++} ++ ++void UbuntuPackagingMode::on_projectRemoved(ProjectExplorer::Project *project) { ++ ProjectExplorer::SessionManager* sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session(); ++ this->setEnabled(sessionManager->projects().count()>0); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingmode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingmode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingmode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingmode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,53 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPACKAGINGMODE_H ++#define UBUNTUPACKAGINGMODE_H ++ ++#include ++#include "ubuntupackagingwidget.h" ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuPackagingMode : public Core::IMode ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuPackagingMode(QObject *parent = 0); ++ void initialize(); ++ ++protected slots: ++ void modeChanged(Core::IMode*); ++ ++ void on_projectAdded(ProjectExplorer::Project *project); ++ void on_projectRemoved(ProjectExplorer::Project *project); ++ ++protected: ++ QWidget* m_modeWidget; ++ UbuntuPackagingWidget m_ubuntuPackagingWidget; ++ ++ Core::Id previousMode; ++}; ++ ++} ++} ++ ++#endif // UBUNTUPACKAGINGMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,189 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntupackagingwidget.h" ++#include "ui_ubuntupackagingwidget.h" ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuPackagingWidget::UbuntuPackagingWidget(QWidget *parent) : ++ QWidget(parent), ++ ui(new Ui::UbuntuPackagingWidget) ++{ ++ ui->setupUi(this); ++ ++ ui->tabWidget->setCurrentIndex(0); ++ ui->stackedWidget->setCurrentIndex(1); ++ ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu); ++ ++ connect(&m_bzr,SIGNAL(initializedChanged()),SLOT(bzrChanged())); ++ connect(&m_manifest,SIGNAL(loaded()),SLOT(reload())); ++ ++ m_bzr.initialize(); ++} ++ ++void UbuntuPackagingWidget::setAvailable(bool available) { ++ if (available) { ++ ui->stackedWidget_2->setCurrentWidget(ui->pageAvailable); ++ } else { ++ ui->stackedWidget_2->setCurrentWidget(ui->pageNotAvailable); ++ } ++} ++ ++UbuntuPackagingWidget::~UbuntuPackagingWidget() ++{ ++ save((ui->tabWidget->currentWidget() == ui->tabSimple)); ++ ++ delete ui; ++} ++ ++void UbuntuPackagingWidget::openManifestForProject() { ++ ++ ProjectExplorer::ProjectExplorerPlugin* projectExplorerInstance = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ //ProjectExplorer::SessionManager* sessionManager = projectExplorerInstance->session(); ++ ProjectExplorer::Project* startupProject = projectExplorerInstance->startupProject(); ++ ++ if (startupProject) { ++ m_projectName = startupProject->displayName(); ++ QString fileName = QString(QLatin1String("%0/manifest.json")).arg(startupProject->projectDirectory()); ++ if (QFile(fileName).exists()==false) { ++ m_manifest.setFileName(fileName); ++ on_pushButtonReset_clicked(); ++ } else { ++ load(fileName); ++ } ++ ui->stackedWidget->setCurrentIndex(0); ++ } else { ++ m_projectName.clear(); ++ ui->stackedWidget->setCurrentIndex(1); ++ } ++} ++ ++void UbuntuPackagingWidget::bzrChanged() { ++ // left empty on purpose ++ m_manifest.setMaintainer(m_bzr.whoami()); ++ QString userName = m_bzr.launchpadId(); ++ if (userName.isEmpty()) userName = QLatin1String("username"); ++ m_manifest.setName(QString(QLatin1String("com.ubuntu.developer.%0.%1")).arg(userName).arg(m_projectName)); ++ reload(); ++} ++ ++void UbuntuPackagingWidget::on_pushButtonReset_clicked() { ++ QString fileName = m_manifest.fileName(); ++ load(QLatin1String(":/ubuntu/manifest.json.template")); ++ m_manifest.setFileName(fileName); ++ m_manifest.setMaintainer(m_bzr.whoami()); ++ QString userName = m_bzr.launchpadId(); ++ if (userName.isEmpty()) userName = QLatin1String("username"); ++ m_manifest.setName(QString(QLatin1String("com.ubuntu.developer.%0.%1")).arg(userName).arg(m_projectName)); ++ reload(); ++} ++ ++void UbuntuPackagingWidget::save(bool bSaveSimple) { ++ if (bSaveSimple) { ++ m_manifest.setName(ui->lineEdit_name->text()); ++ m_manifest.setMaintainer(ui->lineEdit_maintainer->text()); ++ m_manifest.setTitle(ui->lineEdit_title->text()); ++ QStringList items; ++ for (int i=0; ilistWidget->count(); i++) { ++ items.append(ui->listWidget->item(i)->text()); ++ } ++ ++ m_manifest.setPolicyGroups(m_projectName,items); ++ } else { ++ m_manifest.setRaw(ui->plainTextEditJson->toPlainText()); ++ } ++ ++ m_manifest.save(); ++} ++ ++void UbuntuPackagingWidget::load(QString fileName) { ++ m_manifest.load(fileName,m_projectName); ++ m_manifest.setMaintainer(m_bzr.whoami()); ++ QString userName = m_bzr.launchpadId(); ++ if (userName.isEmpty()) userName = QLatin1String("username"); ++ m_manifest.setName(QString(QLatin1String("com.ubuntu.developer.%0.%1")).arg(userName).arg(m_projectName)); ++} ++ ++void UbuntuPackagingWidget::reload() { ++ ui->lineEdit_maintainer->setText(m_manifest.maintainer()); ++ ui->lineEdit_name->setText(m_manifest.name()); ++ ui->lineEdit_title->setText(m_manifest.title()); ++ ++ QStringList policyGroups = m_manifest.policyGroups(m_projectName); ++ ++ ui->listWidget->clear(); ++ foreach( QString policy, policyGroups) { ++ QListWidgetItem* item = new QListWidgetItem(policy); ++ item->setFlags(item->flags() | Qt::ItemIsEditable); ++ ui->listWidget->addItem(item); ++ } ++ ++ ui->plainTextEditJson->setPlainText(m_manifest.raw()); ++} ++ ++void UbuntuPackagingWidget::on_tabWidget_currentChanged(int) { ++ save((ui->tabWidget->currentWidget() != ui->tabSimple)); ++ reload(); ++} ++ ++void UbuntuPackagingWidget::on_pushButtonReload_clicked() { ++ m_manifest.reload(); ++} ++ ++void UbuntuPackagingWidget::on_listWidget_customContextMenuRequested(QPoint p) { ++ if (ui->listWidget->selectedItems().count()==0) { return; } ++ ++ QMenu contextMenu; ++ contextMenu.addAction(QLatin1String("Remove")); ++ QAction* selectedItem = contextMenu.exec(ui->listWidget->mapToGlobal(p)); ++ if (selectedItem) { ++ delete ui->listWidget->currentItem(); ++ } ++} ++ ++void UbuntuPackagingWidget::on_pushButton_addpolicy_clicked() { ++ QListWidgetItem* item = new QListWidgetItem(ui->lineEdit_policy->text()); ++ item->setFlags(item->flags() | Qt::ItemIsEditable); ++ ui->listWidget->addItem(item); ++ ui->lineEdit_policy->clear(); ++} ++ ++void UbuntuPackagingWidget::on_pushButtonClickPackage_clicked() { ++ ++ save((ui->tabWidget->currentWidget() == ui->tabSimple)); ++ ++ Core::Command *cmd = Core::ActionManager::instance()->command(Core::Id("Ubuntu.Build.click.build")); ++ if (cmd) { ++ cmd->action()->trigger(); ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,51 @@ ++#ifndef UBUNTUPACKAGINGWIDGET_H ++#define UBUNTUPACKAGINGWIDGET_H ++ ++#include ++#include ++#include "ubuntubzr.h" ++#include "ubuntuclickmanifest.h" ++ ++namespace Ui { ++class UbuntuPackagingWidget; ++} ++ ++using namespace Ubuntu::Internal; ++ ++class UbuntuPackagingWidget : public QWidget ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuPackagingWidget(QWidget *parent = 0); ++ ~UbuntuPackagingWidget(); ++ ++public slots: ++ void reload(); ++ void load(QString fileName); ++ void save(bool bSaveSimple = true); ++ void openManifestForProject(); ++ void setAvailable(bool); ++ ++protected slots: ++ void on_pushButton_addpolicy_clicked(); ++ void on_pushButtonClickPackage_clicked(); ++ void on_pushButtonReset_clicked(); ++ ++ void on_pushButtonReload_clicked(); ++ ++ void on_tabWidget_currentChanged(int); ++ ++ void on_listWidget_customContextMenuRequested(QPoint); ++ void bzrChanged(); ++ ++private: ++ UbuntuClickManifest m_manifest; ++ QProcess m_click; ++ UbuntuBzr m_bzr; ++ QString m_projectName; ++ ++ Ui::UbuntuPackagingWidget *ui; ++}; ++ ++#endif // UBUNTUPACKAGINGWIDGET_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.ui ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.ui +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupackagingwidget.ui 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupackagingwidget.ui 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,427 @@ ++ ++ ++ UbuntuPackagingWidget ++ ++ ++ ++ 0 ++ 0 ++ 827 ++ 683 ++ ++ ++ ++ Form ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ color: #DD4818 ++ ++ ++ QFrame::Plain ++ ++ ++ 3 ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ ++ ++ ++ 9 ++ ++ ++ 9 ++ ++ ++ ++ ++ ++ 0 ++ 50 ++ ++ ++ ++ ++ Ubuntu ++ 26 ++ ++ ++ ++ Ubuntu Packaging ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 20 ++ ++ ++ ++ false ++ ++ ++ color: rgba(0,0,0,0.2) ++ ++ ++ QFrame::Plain ++ ++ ++ 20 ++ ++ ++ 0 ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ ++ ++ ++ 1 ++ ++ ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ 0 ++ ++ ++ ++ ++ 6 ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ Reload ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ Reset to defaults ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ 0 ++ ++ ++ ++ ++ 500 ++ 0 ++ ++ ++ ++ Click ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ ++ Simple ++ ++ ++ ++ ++ ++ Name ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Maintainer ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Title ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Security Policy Groups ++ ++ ++ ++ ++ ++ true ++ ++ ++ ++ ++ ++ ++ ++ ++ + ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Advanced ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Create Package ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 40 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ 0 ++ ++ ++ -1 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 227 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ Click packaging is only available for QML projects. ++ ++ ++ ++ ++ ++ ++ Qt::Horizontal ++ ++ ++ ++ 227 ++ 20 ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupastebinmode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupastebinmode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupastebinmode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupastebinmode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,14 @@ ++#include "ubuntupastebinmode.h" ++#include "ubuntuconstants.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuPastebinMode::UbuntuPastebinMode(QObject *parent) : ++ UbuntuWebMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_PASTEBIN_DISPLAYNAME)); ++ setId(Ubuntu::Constants::UBUNTU_MODE_PASTEBIN); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_PASTEBIN)); ++ ++ setUrl(QUrl(QLatin1String(Ubuntu::Constants::UBUNTU_PASTEBIN))); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupastebinmode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupastebinmode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntupastebinmode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntupastebinmode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,39 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPASTEBINMODE_H ++#define UBUNTUPASTEBINMODE_H ++ ++#include "ubuntuwebmode.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuPastebinMode : public UbuntuWebMode ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuPastebinMode(QObject *parent = 0); ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUPASTEBINMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuplugin.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuplugin.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuplugin.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuplugin.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,120 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuplugin.h" ++#include "ubuntuconstants.h" ++#include "ubuntuprojectapplicationwizard.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuPlugin::UbuntuPlugin() ++{ ++ ++} ++ ++UbuntuPlugin::~UbuntuPlugin() ++{ ++ ++} ++ ++bool UbuntuPlugin::initialize(const QStringList &arguments, QString *errorString) ++{ ++ Q_UNUSED(arguments) ++ Q_UNUSED(errorString) ++ ++ Core::MimeDatabase *mimeDB = Core::ICore::mimeDatabase(); ++ ++ const QLatin1String mimetypesXml(":/ubuntu/UbuntuProject.mimetypes.xml"); ++ ++ if (!mimeDB->addMimeTypes(mimetypesXml, errorString)) ++ return false; ++ ++ QJsonDocument jsonDoc = QJsonDocument::fromJson(Internal::UbuntuProjectApplicationWizard::getProjectTypesJSON()); ++ if (jsonDoc.isArray()) { ++ QJsonArray array = jsonDoc.array(); ++ for (int idx = 0; idx < array.size(); idx++) { ++ if (array.at(idx).isObject()) { ++ QJsonObject obj = array.at(idx).toObject(); ++ QString folder; ++ QJsonValue tmp_folder = obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_FOLDER)); ++ if (tmp_folder.isUndefined() == false) { ++ folder = tmp_folder.toString(); ++ if (QFileInfo(UbuntuProjectApplicationWizard::templatesPath(folder)).exists()) { ++ addAutoReleasedObject(new Internal::UbuntuProjectApplicationWizard(obj)); ++ } ++ } ++ } ++ } ++ } else { ++ qWarning() << __PRETTY_FUNCTION__ << "failed to read from JSON."; ++ } ++ ++ m_ubuntuWelcomeMode = new UbuntuWelcomeMode; ++ m_ubuntuDeviceMode = new UbuntuDeviceMode; ++ m_ubuntuMenu = new UbuntuMenu; ++ m_ubuntuIRCMode = new UbuntuIRCMode; ++ m_ubuntuAPIMode = new UbuntuAPIMode; ++ m_ubuntuCoreAppsMode = new UbuntuCoreAppsMode; ++ m_ubuntuWikiMode = new UbuntuWikiMode; ++ m_ubuntuPackagingMode = new UbuntuPackagingMode; ++ m_ubuntuPastebinMode = new UbuntuPastebinMode; ++ ++ addAutoReleasedObject(m_ubuntuWelcomeMode); ++ addAutoReleasedObject(m_ubuntuDeviceMode); ++ addAutoReleasedObject(m_ubuntuMenu); ++ addAutoReleasedObject(m_ubuntuIRCMode); ++ addAutoReleasedObject(m_ubuntuAPIMode); ++ addAutoReleasedObject(m_ubuntuCoreAppsMode); ++ addAutoReleasedObject(m_ubuntuWikiMode); ++ addAutoReleasedObject(m_ubuntuPackagingMode); ++ addAutoReleasedObject(m_ubuntuPastebinMode); ++ ++ addAutoReleasedObject(new UbuntuVersionManager); ++ addAutoReleasedObject(new UbuntuFeatureProvider); ++ ++ //addAutoReleasedObject(new UbuntuProjectManager); ++ //addAutoReleasedObject(new UbuntuRunConfigurationFactory); ++ //addAutoReleasedObject(new UbuntuRunControlFactory); ++ ++ return true; ++} ++ ++void UbuntuPlugin::extensionsInitialized() ++{ ++ m_ubuntuMenu->initialize(); ++ m_ubuntuWelcomeMode->initialize(); ++ m_ubuntuDeviceMode->initialize(); ++ m_ubuntuIRCMode->initialize(); ++ m_ubuntuAPIMode->initialize(); ++ m_ubuntuCoreAppsMode->initialize(); ++ m_ubuntuWikiMode->initialize(); ++ m_ubuntuPackagingMode->initialize(); ++ Core::ModeManager::activateMode(m_ubuntuWelcomeMode->id()); ++} ++ ++Q_EXPORT_PLUGIN2(Ubuntu, UbuntuPlugin) ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuplugin.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuplugin.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuplugin.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuplugin.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,75 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTU_H ++#define UBUNTU_H ++ ++#include "ubuntu_global.h" ++#include "ubuntuwelcomemode.h" ++#include "ubuntudevicemode.h" ++#include "ubuntumenu.h" ++#include "ubuntuprojectmanager.h" ++#include "ubunturunconfiguration.h" ++#include "ubunturunconfigurationfactory.h" ++#include "ubunturuncontrolfactory.h" ++#include "ubuntufeatureprovider.h" ++#include "ubuntuversionmanager.h" ++#include "ubuntuircmode.h" ++#include "ubuntuapimode.h" ++#include "ubuntucoreappsmode.h" ++#include "ubuntuwikimode.h" ++#include "ubuntupackagingmode.h" ++#include "ubuntupastebinmode.h" ++ ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UBUNTUSHARED_EXPORT UbuntuPlugin: public ExtensionSystem::IPlugin ++{ ++ Q_OBJECT ++ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "Ubuntu.json") ++ ++public: ++ UbuntuPlugin(); ++ ~UbuntuPlugin(); ++ ++ virtual bool initialize(const QStringList &arguments, QString *errorString); ++ virtual void extensionsInitialized(); ++ ++protected: ++ UbuntuWelcomeMode* m_ubuntuWelcomeMode; ++ UbuntuDeviceMode* m_ubuntuDeviceMode; ++ UbuntuMenu* m_ubuntuMenu; ++ UbuntuIRCMode* m_ubuntuIRCMode; ++ UbuntuAPIMode* m_ubuntuAPIMode; ++ UbuntuCoreAppsMode* m_ubuntuCoreAppsMode; ++ UbuntuWikiMode* m_ubuntuWikiMode; ++ UbuntuPackagingMode* m_ubuntuPackagingMode; ++ UbuntuPastebinMode* m_ubuntuPastebinMode; ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++#endif // UBUNTU_H ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprocess.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprocess.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprocess.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprocess.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,171 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuprocess.h" ++ ++#include ++#include ++#include ++#include ++#include "ubuntuconstants.h" ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++UbuntuProcess::UbuntuProcess(QObject *parent) : ++ QObject(parent), ++ m_futureInterface(0) ++{ ++ connect(&m_currentProcess,SIGNAL(readyReadStandardError()),this,SLOT(processReadyRead())); ++ connect(&m_currentProcess,SIGNAL(started()),this,SLOT(processStarted())); ++ connect(&m_currentProcess,SIGNAL(finished(int)),this,SLOT(processFinished(int))); ++ connect(&m_currentProcess,SIGNAL(readyRead()),this,SLOT(processReadyRead())); ++ connect(&m_currentProcess,SIGNAL(error(QProcess::ProcessError)),this,SLOT(processError(QProcess::ProcessError))); ++} ++ ++void UbuntuProcess::initializeProgressBar(QString title, int max) { ++ if (m_futureInterface) { ++ m_futureInterface->reportCanceled(); ++ delete m_futureInterface; ++ m_futureInterface = 0; ++ } ++ ++ m_futureInterface = new QFutureInterface(); ++ ++ m_futureInterface->setProgressRange(0,max); ++ ++ Core::FutureProgress* futureProgress = Core::ICore::progressManager()->addTask(m_futureInterface->future(),title,QLatin1String(Constants::TASK_DEVICE_SCRIPT)); ++ ++ connect(futureProgress,SIGNAL(clicked()),this,SLOT(stop())); ++} ++ ++void UbuntuProcess::setProgressBarStarted() { ++ m_futureInterface->reportStarted(); ++} ++ ++void UbuntuProcess::setProgressBarFinished() { ++ m_futureInterface->reportFinished(); ++} ++ ++void UbuntuProcess::increaseProgress(QString msg) { ++ int currentValue = m_futureInterface->progressValue(); ++ m_futureInterface->setProgressValueAndText(currentValue++,msg); ++} ++ ++void UbuntuProcess::setProgressBarCancelled() { ++ m_futureInterface->reportCanceled(); ++ m_futureInterface->reportFinished(); ++} ++ ++void UbuntuProcess::close() { ++ m_currentProcess.close(); ++ m_currentProcess.waitForFinished(); ++} ++ ++void UbuntuProcess::stop() { ++ kill(); ++} ++ ++void UbuntuProcess::processStarted() { ++ increaseProgress(m_currentProcess.program()); ++ emit started(m_currentProcess.program()); ++} ++ ++void UbuntuProcess::kill() { ++ this->clear(); ++ m_currentProcess.kill(); ++ m_currentProcess.waitForFinished(); ++} ++ ++void UbuntuProcess::processError(QProcess::ProcessError err) { ++ Q_UNUSED(err); ++ if (m_currentProcess.exitCode() == 0) { return; } ++ emit error(QString(QLatin1String("ERROR: (%0) %1")).arg(m_currentProcess.program()).arg(m_currentProcess.errorString())); ++ ++ // lets clear the remaining actions ++ m_pendingProcesses.clear(); ++ ++ setProgressBarCancelled(); ++} ++ ++void UbuntuProcess::start(QString taskTitle) { ++ initializeProgressBar(taskTitle,m_pendingProcesses.length()); ++ processCmdQueue(); ++} ++ ++void UbuntuProcess::processFinished(int code) { ++ if (code != 0) { ++ emit error(QString(QLatin1String(m_currentProcess.readAllStandardError()))); ++ m_pendingProcesses.clear(); ++ setProgressBarCancelled(); ++ return; ++ } ++ QString errorMsg = QString::fromLatin1(m_currentProcess.readAllStandardError()); ++ if (errorMsg.trimmed().length()>0) emit error(errorMsg); ++ QString msg = QString::fromLatin1(m_currentProcess.readAllStandardOutput()); ++ if (msg.trimmed().length()>0) emit message(msg); ++ ++ emit finished(m_currentProcess.program(), code); ++ processCmdQueue(); ++} ++ ++void UbuntuProcess::processReadyRead() { ++ QString stderr = QString::fromLatin1(m_currentProcess.readAllStandardError()); ++ QString stdout = QString::fromLatin1(m_currentProcess.readAllStandardOutput()); ++ if (!stderr.isEmpty()) { ++ emit message(stderr); ++ } ++ if (!stdout.isEmpty()) { ++ emit message(stdout); ++ } ++} ++ ++void UbuntuProcess::processCmdQueue() { ++ if (m_pendingProcesses.length() == 0) { ++ setProgressBarFinished(); ++ return; ++ } ++ ++ QStringList cmdList = m_pendingProcesses.takeFirst(); ++ ++ QString cmd = cmdList.takeFirst(); ++ ++ QStringList args; ++ QString workingDirectory; ++ if (cmdList.length()>0) { ++ workingDirectory = cmdList.takeLast(); ++ } ++ ++ if (cmdList.length()>0) { ++ args << cmdList; ++ } ++ ++ if (!workingDirectory.isEmpty()) { ++ m_currentProcess.setWorkingDirectory(workingDirectory); ++ } ++ ++ QString msg(QString(QLatin1String("%0 %1")).arg(cmd).arg(args.join(QLatin1String(" ")))); ++ emit message(msg); ++ m_currentProcess.setProperty("command",cmd); ++ ++ if (args.length()>0) { ++ m_currentProcess.start(cmd,args); ++ } else { ++ m_currentProcess.start(cmd); ++ } ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprocess.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprocess.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprocess.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprocess.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,82 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROCESS_H ++#define UBUNTUPROCESS_H ++ ++#include ++#include ++#include ++ ++#include "ubuntu_global.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UBUNTUSHARED_EXPORT UbuntuProcess : public QObject ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuProcess(QObject *parent = 0); ++ ++ void clear() { m_pendingProcesses.clear(); } ++ ++ void append(QStringList cmds) { m_pendingProcesses << cmds; } ++ ++ QProcess::ProcessState state() { return m_currentProcess.state(); } ++ ++public slots: ++ void stop(); ++ void start(QString taskTitle); ++ ++signals: ++ void message(QString); ++ void error(QString); ++ void finished(QString,int); ++ void started(QString); ++ ++protected slots: ++ void processStarted(); ++ void processReadyRead(); ++ void processFinished(int code); ++ void processError(QProcess::ProcessError error); ++ void processCmdQueue(); ++ ++protected: ++ void close(); ++ void kill(); ++ ++ QList m_pendingProcesses; ++ QProcess m_currentProcess; ++ QFutureInterface *m_futureInterface; ++ ++ void initializeProgressBar(QString title, int max); ++ void setProgressBarFinished(); ++ void increaseProgress(QString msg); ++ void setProgressBarCancelled(); ++ void setProgressBarStarted(); ++ ++ bool m_bForceStop; ++ ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++#endif // UBUNTUPROCESS_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuproject.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuproject.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuproject.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuproject.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,88 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuproject.h" ++#include ++#include ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++UbuntuProject::UbuntuProject(UbuntuProjectManager *manager, const QString &fileName) ++ : m_manager(manager), ++ m_fileName(fileName) { ++ ++ setProjectContext(Core::Context(Constants::UBUNTUPROJECT_PROJECTCONTEXT)); ++ ++ QFileInfo fileInfo(m_fileName); ++ m_projectName = fileInfo.completeBaseName(); ++ ++ m_file = QSharedPointer(new UbuntuProjectFile(this, fileName)); ++ ++ Core::DocumentManager::addDocument(m_file.data(), true); ++ ++ m_rootNode = QSharedPointer(new UbuntuProjectNode(this, m_file.data())); ++ m_manager->registerProject(this); ++ ++ QList kits = ProjectExplorer::KitManager::instance()->kits(); ++ foreach (ProjectExplorer::Kit *kit, kits) { ++ addTarget(createTarget(kit)); ++ } ++ ++ if (needsConfiguration()) { ++ Core::ModeManager::activateMode(ProjectExplorer::Constants::MODE_SESSION); ++ } ++} ++ ++QString UbuntuProject::displayName() const { ++ return m_projectName; ++} ++ ++Core::Id UbuntuProject::id() const { ++ return Core::Id(Constants::UBUNTUPROJECT_ID); ++} ++ ++Core::IDocument *UbuntuProject::document() const { ++ return m_file.data(); ++} ++ ++ProjectExplorer::IProjectManager *UbuntuProject::projectManager() const { ++ return m_manager; ++} ++ ++ProjectExplorer::ProjectNode *UbuntuProject::rootProjectNode() const { ++ return m_rootNode.data(); ++} ++ ++static void enumChild(const QDir &dir, QStringList &res) { ++ foreach (const QFileInfo &info, dir.entryInfoList(QDir::NoDotAndDotDot|QDir::Dirs|QDir::Files)) { ++ if (info.fileName().indexOf(QLatin1String(Constants::UBUNTUPROJECT_SUFFIX)) != -1) ++ continue; ++ if (info.isFile()) { ++ res.append(info.absoluteFilePath()); ++ } else if (info.isDir()) { ++ enumChild(QDir(info.absoluteFilePath()), res); ++ } ++ } ++} ++ ++QStringList UbuntuProject::files(FilesMode) const { ++ QStringList files; ++ enumChild(projectDir(), files); ++ return files; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuproject.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuproject.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuproject.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuproject.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,88 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECT_H ++#define UBUNTUPROJECT_H ++ ++#include "ubuntuprojectmanager.h" ++#include "ubuntuprojectfile.h" ++#include "ubuntuprojectnode.h" ++#include "ubuntuconstants.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuProjectManager; ++class UbuntuProjectFile; ++class UbuntuProjectNode; ++class UbuntuProject : public ProjectExplorer::Project ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuProject(UbuntuProjectManager *manager, const QString &fileName); ++ ++ QString displayName() const; ++ Core::Id id() const; ++ Core::IDocument *document() const; ++ ProjectExplorer::IProjectManager *projectManager() const; ++ ++ ProjectExplorer::ProjectNode *rootProjectNode() const; ++ QStringList files(FilesMode fileMode) const; ++ ++ QDir projectDir() const { ++ return QFileInfo(document()->fileName()).dir(); ++ } ++ ++ QString filesFileName() const { ++ return m_fileName; ++ } ++ ++private: ++ UbuntuProjectManager *m_manager; ++ QString m_projectName; ++ QSharedPointer m_file; ++ ++ QString m_fileName; ++ QSharedPointer m_rootNode; ++ ++}; ++} ++} ++ ++#endif // UBUNTUPROJECT_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapp.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapp.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapp.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapp.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,345 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuprojectapp.h" ++ ++#include "ubuntushared.h" ++#include "ubuntuprojectapplicationwizard.h" ++#include "ubuntuconstants.h" ++#include "ubuntuproject.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++UbuntuProjectApp::UbuntuProjectApp(QObject *parent) : ++ QObject(parent) ++{ ++} ++ ++Core::GeneratedFiles UbuntuProjectApp::generateFiles(const QWizard *w, QString *errorMessage) { ++ Q_UNUSED(errorMessage); ++ ++ QByteArray contents; ++ Core::GeneratedFiles files; ++ ++ QJsonValue tmp_type = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_TYPE)); ++ QString projectType = QLatin1String(Constants::UBUNTU_QMLPROJECT_TYPE); ++ if (tmp_type.isUndefined() == false) { ++ projectType = tmp_type.toString(); ++ } ++ ++ setProjectType(projectType); ++ ++ QJsonValue tmp_hasTests = m_obj.value(QLatin1String(Constants::UBUNTU_HAS_TESTS)); ++ bool hasTests = false; ++ if (tmp_hasTests.isUndefined() == false) { ++ hasTests = tmp_hasTests.toBool(); ++ } ++ ++ const UbuntuProjectApplicationWizardDialog *wizard = qobject_cast(w); ++ const QString projectName = wizard->projectName(); ++ const QString projectPath = wizard->path() + QLatin1Char('/') + projectName; ++ ++ ++ QString folder; ++ QJsonValue tmp_folder = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_FOLDER)); ++ if (tmp_folder.isUndefined() == false) { ++ folder = tmp_folder.toString(); ++ } ++ ++ if (m_projectType == QLatin1String(Constants::UBUNTU_QMLPROJECT_TYPE) ++ || m_projectType == QLatin1String(Constants::UBUNTU_AUTOPILOTPROJECT_TYPE) ++ || m_projectType == QLatin1String(Constants::UBUNTU_HTMLPROJECT_TYPE) ++ || m_projectType == QLatin1String(Constants::UBUNTU_UBUNTUPROJECT_TYPE) ++ || m_projectType == QLatin1String(Constants::UBUNTU_CORDOVAUBUNTU_TYPE)) { ++ ++ const QString creatorFileName = Core::BaseFileWizard::buildFileName(projectPath, ++ projectName, ++ projectType); ++ ++ QString mainFileName; ++ ++ // load the mainFile ++ if (m_projectType == QLatin1String(Constants::UBUNTU_CORDOVAUBUNTU_TYPE)) { ++ mainFileName = Core::BaseFileWizard::buildFileName(projectPath, ++ QLatin1String("index"), ++ QLatin1String("html")); ++ } else { ++ mainFileName = Core::BaseFileWizard::buildFileName(projectPath, ++ projectName, ++ QLatin1String(Constants::UBUNTU_QML_TYPE)); ++ } ++ QJsonValue tmp_mainFile = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_MAINFILE)); ++ ++ if (tmp_mainFile.isUndefined() == false && tmp_folder.isUndefined() == false) { ++ QString errorMsg; ++ QString fileName = tmp_mainFile.toString(); ++ ++ if (readFile(QString(QLatin1String("%0/%1")).arg(UbuntuProjectApplicationWizard::templatesPath(folder)).arg(fileName),&contents, &errorMsg) == false) { ++ contents = errorMsg.toAscii(); ++ qDebug() << __PRETTY_FUNCTION__ << contents; ++ } ++ } ++ ++ contents = processReservedWords(contents,projectPath,projectName); ++ mainFileName = processReservedWordsInFileName(mainFileName,projectName); ++ ++ Core::GeneratedFile generatedMainFile(mainFileName); ++ generatedMainFile.setContents(QString::fromLatin1(contents)); ++ generatedMainFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute); ++ ++ // create the project file ++ QByteArray projectContents; ++ { ++ QTextStream out(&projectContents); ++ ++ QDeclarativeEngine engine; // QQmlEngine engine; ++ ++ out << "/* File generated by Qt Creator (with Ubuntu Plugin), version " << Core::Constants::IDE_VERSION_LONG << " */" << endl ++ << endl ++ << "import QmlProject 1.1" << endl ++ << endl ++ << "Project {" << endl ++ << " mainFile: \"" << QDir(projectPath).relativeFilePath(mainFileName) << '"' << endl ++ << endl ++ << " /* Include .qml, .js, and image files from current directory and subdirectories */" << endl ++ << " QmlFiles {" << endl ++ << " directory: \".\"" << endl ++ << " }" << endl ++ << " JavaScriptFiles {" << endl ++ << " directory: \".\"" << endl ++ << " }" << endl ++ << " ImageFiles {" << endl ++ << " directory: \".\"" << endl ++ << " }" << endl ++ << " Files {" << endl ++ << " filter: \"*.desktop\"" << endl ++ << " }" << endl ++ << " Files {" << endl ++ << " filter: \"Makefile\"" << endl ++ << " }" << endl; ++ ++ out << " Files {" << endl ++ << " directory: \"html\"" << endl ++ << " filter: \"*\"" << endl ++ << " }" << endl; ++ ++ out << " Files {" << endl ++ << " directory: \"img/\"" << endl ++ << " filter: \"*\"" << endl ++ << " }" << endl; ++ ++ out << " Files {" << endl ++ << " directory: \"css/\"" << endl ++ << " filter: \"*\"" << endl ++ << " }" << endl; ++ ++ out << " Files {" << endl ++ << " directory: \"tests/\"" << endl ++ << " filter: \"*\"" << endl ++ << " }" << endl; ++ // } ++ out << " Files {" << endl ++ << " directory: \"debian\"" << endl ++ << " filter: \"*\"" << endl ++ << " }" << endl ++ << " /* List of plugin directories passed to QML runtime */" << endl ++ << " importPaths: [ \".\" ,\"" ++ ++ // FIX ME: use QQmlEngine instead of QDeclarativeEngine. Then remove the replace. ++ << engine.importPathList().join(QLatin1String("\",\"")).replace(QLatin1String("imports"),QLatin1String("qml")) ++ ++ << "\" ]" << endl ++ ++ << "}" << endl; ++ } ++ ++ setProjectFileName(creatorFileName); ++ Core::GeneratedFile generatedCreatorFile(creatorFileName); ++ generatedCreatorFile.setContents(QLatin1String(projectContents)); ++ generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute); ++ ++ // add created files ++ files.append(generatedMainFile); ++ files.append(generatedCreatorFile); ++ } else { ++ QString errorMsg; ++ QJsonValue tmp_mainFile = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_MAINFILE)); ++ if (tmp_mainFile.isUndefined() == false) { ++ QString fileName_target = Core::BaseFileWizard::buildFileName(projectPath, tmp_mainFile.toString(),QString()); ++ QString fileName_source = tmp_mainFile.toString(); ++ if (readFile(QString(QLatin1String("%0/%1")).arg(UbuntuProjectApplicationWizard::templatesPath(folder)).arg(fileName_source),&contents, &errorMsg) == false) { ++ contents = errorMsg.toAscii(); ++ qDebug() << __PRETTY_FUNCTION__ << contents; ++ } ++ ++ contents = processReservedWords(contents,projectPath,projectName); ++ ++ fileName_target = processReservedWordsInFileName(fileName_target,projectName); ++ ++ ++ Core::GeneratedFile generatedMainFile(fileName_target); ++ generatedMainFile.setContents(QLatin1String(contents)); ++ generatedMainFile.setAttributes(Core::GeneratedFile::OpenEditorAttribute); ++ files.append(generatedMainFile); ++ } ++ ++ QJsonValue tmp_projectFile = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_PROJECTFILE)); ++ if (tmp_projectFile.isUndefined() == false) { ++ QString fileName_target = Core::BaseFileWizard::buildFileName(projectPath, QString(QLatin1String("%0.%1")).arg(projectName).arg(QLatin1String(Constants::UBUNTU_QTPROJECT_TYPE)),QString()); ++ QString fileName_source = tmp_projectFile.toString(); ++ if (readFile(QString(QLatin1String("%0/%1")).arg(UbuntuProjectApplicationWizard::templatesPath(folder)).arg(fileName_source),&contents, &errorMsg) == false) { ++ contents = errorMsg.toAscii(); ++ qDebug() << __PRETTY_FUNCTION__ << contents; ++ } ++ ++ contents = processReservedWords(contents,projectPath,projectName); ++ ++ fileName_target = processReservedWordsInFileName(fileName_target,projectName); ++ ++ setProjectFileName(fileName_target); ++ ++ Core::GeneratedFile generatedCreatorFile(fileName_target); ++ generatedCreatorFile.setContents(QLatin1String(contents)); ++ generatedCreatorFile.setAttributes(Core::GeneratedFile::OpenProjectAttribute); ++ files.append(generatedCreatorFile); ++ } ++ } ++ ++ // create and add the other files ++ QJsonValue tmp = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_FILES)); ++ if (tmp.isUndefined() == false && tmp.isArray() ) { ++ QJsonArray jsonFiles = tmp.toArray(); ++ for (int idx = 0; idx < jsonFiles.size(); idx++) { ++ QJsonValue tmp_value = jsonFiles.at(idx); ++ if (tmp_value.isObject()) { ++ QJsonValue tmp_fileName = tmp_value.toObject().value(QLatin1String(Constants::UBUNTU_PROJECTJSON_FILENAME)); ++ if (tmp_fileName.isUndefined() == false) { ++ QString fileName = tmp_fileName.toString(); ++ QString errorMsg; ++ QByteArray contents; ++ if (readFile(QString(QLatin1String("%0/%1")).arg(UbuntuProjectApplicationWizard::templatesPath(folder)).arg(fileName),&contents, &errorMsg) == false) { ++ contents = errorMsg.toAscii(); ++ qDebug() << __PRETTY_FUNCTION__ << contents; ++ } else { ++ contents = processReservedWords(contents,projectPath,projectName); ++ ++ fileName = processReservedWordsInFileName(fileName,projectName); ++ ++ Core::GeneratedFile generatedFile(Core::BaseFileWizard::buildFileName(projectPath,fileName,QString())); ++ generatedFile.setBinaryContents(contents); ++ files.append(generatedFile); ++ } ++ } ++ } ++ } ++ } ++ return files; ++} ++ ++QByteArray UbuntuProjectApp::processReservedWordsInFileName(QByteArray data, QString projectName) { ++ data = data.replace(Constants::UBUNTU_FILENAME_DISPLAYNAME_UPPER,projectName.toUpper().toLatin1()); ++ data = data.replace(Constants::UBUNTU_FILENAME_DISPLAYNAME_LOWER,projectName.toLower().toLatin1()); ++ data = data.replace(Constants::UBUNTU_FILENAME_DISPLAYNAME_CAPITAL,Utils::matchCaseReplacement(QLatin1String("Capitalize"),projectName).toLatin1()); ++ data = data.replace(Constants::UBUNTU_FILENAME_DISPLAYNAME,projectName.toLatin1()); ++ return data; ++} ++ ++QByteArray UbuntuProjectApp::processReservedWords(QByteArray data, QString projectPath, QString projectName) { ++ QString folderName = QFileInfo(projectPath).baseName(); ++ data = data.replace(Constants::UBUNTU_ACTION_FOLDERNAME,folderName.toLatin1()); ++ data = data.replace(Constants::UBUNTU_ACTION_DISPLAYNAME_LOWER,projectName.toLower().toLatin1()); ++ data = data.replace(Constants::UBUNTU_ACTION_DISPLAYNAME_UPPER,projectName.toUpper().toLatin1()); ++ data = data.replace(Constants::UBUNTU_ACTION_DISPLAYNAME_CAPITAL,Utils::matchCaseReplacement(QLatin1String("Capitalize"),projectName).toLatin1()); ++ data = data.replace(Constants::UBUNTU_ACTION_DISPLAYNAME,projectName.toLatin1()); ++ data = data.replace(Constants::UBUNTU_ACTION_SHAREDIRECTORY,Constants::UBUNTU_SHAREPATH.toLatin1()); ++ return data; ++} ++ ++Core::BaseFileWizardParameters UbuntuProjectApp::parameters(QJsonObject params) { ++ QString displayName, id, description, category, displayCategory; ++ category = QLatin1String(Ubuntu::Constants::UBUNTU_PROJECT_WIZARD_CATEGORY); ++ displayCategory = QLatin1String(Ubuntu::Constants::UBUNTU_PROJECT_WIZARD_CATEGORY_DISPLAY); ++ ++ QJsonValue tmp = params.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_DISPLAYNAME)); ++ if (tmp.isUndefined() == false) { ++ displayName = tmp.toString(); ++ } ++ ++ tmp = params.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_ID)); ++ if (tmp.isUndefined() == false) { ++ id = tmp.toString(); ++ } ++ ++ tmp = params.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_DESCRIPTION)); ++ if (tmp.isUndefined() == false) { ++ description = tmp.toString(); ++ } ++ ++ tmp = params.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_CATEGORY)); ++ if (tmp.isUndefined() == false) { ++ category = tmp.toString(); ++ } ++ ++ tmp = params.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_CATEGORY_DISPLAY)); ++ if (tmp.isUndefined() == false) { ++ displayCategory = tmp.toString(); ++ } ++ ++ Core::BaseFileWizardParameters parameters; ++ parameters.setIcon(QIcon(QLatin1String(QtSupport::Constants::QML_WIZARD_ICON))); ++ parameters.setDisplayName(displayName); ++ parameters.setId(id); ++ parameters.setKind(Core::IWizard::ProjectWizard); ++ parameters.setFlags(Core::IWizard::PlatformIndependent); ++ parameters.setDescription(description); ++ parameters.setCategory(category); ++ parameters.setDisplayCategory(displayCategory); ++ return parameters; ++} ++ ++Core::Feature UbuntuProjectApp::requiredFeature() { ++ QJsonValue tmp_feature = m_obj.value(QLatin1String(Constants::UBUNTU_PROJECTJSON_REQUIRED_FEATURE)); ++ QString feature; ++ if (tmp_feature.isUndefined() == false) { ++ feature = tmp_feature.toString(); ++ } ++ if (!feature.isEmpty()) { ++ return Core::Feature(feature.toLatin1().constData()); ++ } ++ return Core::Feature(0); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapp.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapp.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapp.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapp.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,67 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECTAPP_H ++#define UBUNTUPROJECTAPP_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "ubuntuconstants.h" ++ ++namespace Ubuntu { ++namespace Internal { ++class UbuntuProjectApp : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuProjectApp(QObject *parent = 0); ++ Core::GeneratedFiles generateFiles(const QWizard *w, QString *errorMessage); ++ ++ QString projectType() { return m_projectType; } ++ void setProjectType(QString projectType) { m_projectType = projectType; } ++ ++ QString projectFileName() { return m_projectFileName; } ++ void setProjectFileName(QString projectFileName) { m_projectFileName = projectFileName; } ++ ++ void setData(QJsonObject obj) { m_obj = obj; } ++ Core::BaseFileWizardParameters parameters(QJsonObject params); ++ ++ QByteArray processReservedWords(QByteArray data, QString projectPath, QString projectName); ++ QString processReservedWordsInFileName(QString data, QString projectName) { return QString::fromLatin1(processReservedWordsInFileName(data.toLatin1(),projectName)); } ++ QByteArray processReservedWordsInFileName(QByteArray data, QString projectName); ++ ++ Core::Feature requiredFeature(); ++ ++protected: ++ QString m_projectType; ++ QString m_projectFileName; ++ ++ QJsonObject m_obj; ++}; ++ ++} ++} ++ ++#endif // UBUNTUPROJECTAPP_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapplicationwizard.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapplicationwizard.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapplicationwizard.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapplicationwizard.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,131 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntushared.h" ++#include "ubuntuprojectapplicationwizard.h" ++#include "ubuntuconstants.h" ++#include "ubuntuproject.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include // Utils::matchCaseReplacement ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuProjectApplicationWizardDialog::UbuntuProjectApplicationWizardDialog(QWidget *parent, ++ const Core::WizardDialogParameters ¶meters) : ++ ProjectExplorer::BaseProjectWizardDialog(parent, parameters) ++{ ++ setWindowTitle(tr("New Ubuntu QML Project")); ++ setIntroDescription(tr("This wizard generates a Ubuntu QML project based on Ubuntu Components.")); ++} ++ ++UbuntuProjectApplicationWizard::UbuntuProjectApplicationWizard(QJsonObject obj) ++ : Core::BaseFileWizard(parameters(obj)), ++ m_app(new UbuntuProjectApp()) ++{ ++ m_app->setData(obj); ++} ++ ++UbuntuProjectApplicationWizard::~UbuntuProjectApplicationWizard() ++{ } ++ ++Core::FeatureSet UbuntuProjectApplicationWizard::requiredFeatures() const ++{ ++#ifdef Q_PROCESSOR_ARM ++ return Core::Feature(m_app->requiredFeature()); ++#else ++ return Core::Feature(QtSupport::Constants::FEATURE_QMLPROJECT) ++ | Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2) ++ | Core::Feature(m_app->requiredFeature()); ++#endif ++} ++ ++Core::BaseFileWizardParameters UbuntuProjectApplicationWizard::parameters(QJsonObject params) ++{ ++ return m_app->parameters(params); ++} ++ ++ ++QWizard *UbuntuProjectApplicationWizard::createWizardDialog(QWidget *parent, ++ const Core::WizardDialogParameters &wizardDialogParameters) const ++{ ++ UbuntuProjectApplicationWizardDialog *wizard = new UbuntuProjectApplicationWizardDialog(parent, wizardDialogParameters); ++ wizard->setProjectName(UbuntuProjectApplicationWizardDialog::uniqueProjectName(wizardDialogParameters.defaultPath())); ++ wizard->addExtensionPages(wizardDialogParameters.extensionPages()); ++ return wizard; ++} ++ ++ ++Core::GeneratedFiles UbuntuProjectApplicationWizard::generateFiles(const QWizard *w, ++ QString *errorMessage) const ++{ ++ return m_app->generateFiles(w,errorMessage); ++} ++ ++bool UbuntuProjectApplicationWizard::postGenerateFiles(const QWizard *, const Core::GeneratedFiles &l, QString *errorMessage) ++{ ++ ++ bool retval = true; ++ // make sure that the project gets configured properly ++ if (m_app->projectType() == QLatin1String(Constants::UBUNTU_QTPROJECT_TYPE)) { ++ Qt4ProjectManager::Qt4Manager *manager = ExtensionSystem::PluginManager::getObject(); ++ ProjectExplorer::Project* project = new Qt4ProjectManager::Qt4Project(manager, m_app->projectFileName()); ++ retval = BaseFileWizard::postGenerateOpenEditors(l,errorMessage); ++ ProjectExplorer::ProjectExplorerPlugin::instance()->openProject(m_app->projectFileName(), errorMessage); ++ if (project->needsConfiguration()) { ++ Core::ModeManager::activateMode(ProjectExplorer::Constants::MODE_SESSION); ++ } ++ delete project; ++ } else { ++ retval = ProjectExplorer::CustomProjectWizard::postGenerateOpen(l,errorMessage); ++ } ++ ++ return retval; ++} ++ ++/**** statics ****/ ++QString UbuntuProjectApplicationWizard::templatesPath(QString fileName) { ++ return Constants::UBUNTU_TEMPLATESPATH + fileName; ++} ++ ++QByteArray UbuntuProjectApplicationWizard::getProjectTypesJSON() { ++ QByteArray contents; ++ QString errorMsg; ++ if (readFile(templatesPath(QLatin1String(Constants::UBUNTU_PROJECTJSON)),&contents, &errorMsg) == false) { ++ contents = errorMsg.toAscii(); ++ qDebug() << __PRETTY_FUNCTION__ << contents; ++ } ++ return contents; ++} ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapplicationwizard.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapplicationwizard.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectapplicationwizard.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectapplicationwizard.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,74 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECTAPPLICATIONWIZARD_H ++#define UBUNTUPROJECTAPPLICATIONWIZARD_H ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include "ubuntuprojectapp.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuProjectApplicationWizardDialog : public ProjectExplorer::BaseProjectWizardDialog ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuProjectApplicationWizardDialog(QWidget *parent, ++ const Core::WizardDialogParameters ¶meters); ++}; ++ ++class UbuntuProjectApplicationWizard : public Core::BaseFileWizard ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuProjectApplicationWizard(QJsonObject); ++ virtual ~UbuntuProjectApplicationWizard(); ++ virtual Core::FeatureSet requiredFeatures() const; ++ ++ Core::BaseFileWizardParameters parameters(QJsonObject); ++ ++ static QByteArray getProjectTypesJSON(); ++ ++ static QString templatesPath(QString fileName); ++ ++protected: ++ virtual QWizard *createWizardDialog(QWidget *parent, ++ const Core::WizardDialogParameters &wizardDialogParameters) const; ++ ++ virtual Core::GeneratedFiles generateFiles(const QWizard *w, ++ QString *errorMessage) const; ++ ++ virtual bool postGenerateFiles(const QWizard *w, const Core::GeneratedFiles &l, QString *errorMessage); ++ ++private: ++ UbuntuProjectApp* m_app; ++}; ++ ++} // Internal ++} // Ubuntu ++ ++ ++#endif // UBUNTUPROJECTAPPLICATIONWIZARD_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectfile.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectfile.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectfile.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectfile.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,76 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuprojectfile.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuProjectFile::UbuntuProjectFile(UbuntuProject *parent, QString fileName) ++ : Core::IDocument(parent), ++ m_project(parent), ++ m_fileName(fileName) { ++ QTC_CHECK(m_project); ++ QTC_CHECK(!fileName.isEmpty()); ++} ++ ++bool UbuntuProjectFile::save(QString *, const QString &, bool) { ++ return false; ++} ++ ++void UbuntuProjectFile::rename(const QString &newName) { ++ // Can't happen... ++ Q_UNUSED(newName); ++ Q_ASSERT(false); ++} ++ ++QString UbuntuProjectFile::fileName() const { ++ return m_fileName; ++} ++ ++QString UbuntuProjectFile::defaultPath() const { ++ return QString(); ++} ++ ++QString UbuntuProjectFile::suggestedFileName() const { ++ return QString(); ++} ++ ++QString UbuntuProjectFile::mimeType() const { ++ return QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE); ++} ++ ++bool UbuntuProjectFile::isModified() const { ++ return false; ++} ++ ++bool UbuntuProjectFile::isSaveAsAllowed() const { ++ return false; ++} ++ ++Core::IDocument::ReloadBehavior UbuntuProjectFile::reloadBehavior(ChangeTrigger state, ChangeType type) const { ++ Q_UNUSED(state) ++ Q_UNUSED(type) ++ return BehaviorSilent; ++} ++ ++bool UbuntuProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType) { ++ Q_UNUSED(errorString) ++ Q_UNUSED(flag) ++ ++ return true; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectfile.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectfile.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectfile.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectfile.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,72 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECTFILE_H ++#define UBUNTUPROJECTFILE_H ++ ++#include ++#include "ubuntuconstants.h" ++#include "ubuntuproject.h" ++#include "ubuntuprojectmanager.h" ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++namespace Ubuntu { ++namespace Internal { ++class UbuntuProject; ++class UbuntuProjectFile : public Core::IDocument ++{ ++ Q_OBJECT ++public: ++ UbuntuProjectFile(UbuntuProject *parent, QString fileName); ++ ~UbuntuProjectFile() {} ++ ++ bool save(QString *errorString, const QString &fileName, bool autoSave); ++ QString fileName() const; ++ void rename(const QString &newName); ++ ++ QString defaultPath() const; ++ QString suggestedFileName() const; ++ QString mimeType() const; ++ ++ bool isModified() const; ++ bool isSaveAsAllowed() const; ++ ++ ReloadBehavior reloadBehavior(ChangeTrigger state, ChangeType type) const; ++ bool reload(QString *errorString, ReloadFlag flag, ChangeType); ++ ++private: ++ UbuntuProject *m_project; ++ QString m_fileName; ++ ++}; ++} ++} ++ ++#endif // UBUNTUPROJECTFILE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectmanager.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectmanager.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectmanager.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectmanager.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,66 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuprojectmanager.h" ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuProjectManager::UbuntuProjectManager() { ++ ProjectExplorer::SessionManager* sessionManager = ProjectExplorer::ProjectExplorerPlugin::instance()->session(); ++ ++ connect(sessionManager,SIGNAL(projectAdded(ProjectExplorer::Project*)),SLOT(onProjectAdded(ProjectExplorer::Project*))); ++} ++ ++ProjectExplorer::Project* UbuntuProjectManager::openProject(const QString &fileName, QString *errorString) { ++ QFileInfo fileInfo(fileName); ++ ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance(); ++ ++ foreach (ProjectExplorer::Project *pi, projectExplorer->session()->projects()) { ++ if (fileName == pi->document()->fileName()) { ++ if (errorString) ++ *errorString = tr("Failed opening project '%1': Project already open") .arg(QDir::toNativeSeparators(fileName)); ++ return 0; ++ } ++ } ++ ++ if (fileInfo.isFile()) ++ return new UbuntuProject(this, fileName); ++ ++ *errorString = tr("Failed opening project '%1': Project file is not a file").arg(QDir::toNativeSeparators(fileName)); ++ return 0; ++} ++ ++void UbuntuProjectManager::registerProject(UbuntuProject *project) { ++ m_projects.append(project); ++} ++ ++void UbuntuProjectManager::unregisterProject(UbuntuProject *project) { ++ m_projects.removeAll(project); ++} ++ ++QString UbuntuProjectManager::mimeType() const { ++ return QLatin1String(Constants::UBUNTUPROJECT_MIMETYPE); ++} ++ ++void UbuntuProjectManager::onProjectAdded(ProjectExplorer::Project* addedProject) { ++ qDebug() << "project added" << addedProject->displayName(); ++ QString mimeType = addedProject->projectManager()->mimeType(); ++ qDebug() << mimeType; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectmanager.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectmanager.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectmanager.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectmanager.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,75 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECTMANAGER_H ++#define UBUNTUPROJECTMANAGER_H ++ ++#include ++#include "ubuntuconstants.h" ++#include "ubuntuproject.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuProject; ++class UbuntuProjectManager : public ProjectExplorer::IProjectManager ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuProjectManager(); ++ virtual QString mimeType() const; ++ ++ ProjectExplorer::Project* openProject(const QString &fileName, QString *errorString); ++ void registerProject(UbuntuProject *project); ++ void unregisterProject(UbuntuProject *project); ++ ++protected slots: ++ void onProjectAdded(ProjectExplorer::Project*); ++ ++private: ++ QList m_projects; ++ ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++#endif // UBUNTUPROJECTMANAGER_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectnode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectnode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectnode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectnode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,172 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuprojectnode.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuProjectNode::UbuntuProjectNode(UbuntuProject *project, Core::IDocument *projectFile) ++ : ProjectExplorer::ProjectNode(QFileInfo(projectFile->fileName()).absoluteFilePath()), ++ m_project(project), ++ m_projectFile(projectFile) { ++ setDisplayName(QFileInfo(projectFile->fileName()).completeBaseName()); ++ refresh(); ++} ++ ++Core::IDocument *UbuntuProjectNode::projectFile() const { ++ return m_projectFile; ++} ++ ++QString UbuntuProjectNode::projectFilePath() const { ++ return m_projectFile->fileName(); ++} ++ ++void UbuntuProjectNode::refresh() { ++ using namespace ProjectExplorer; ++ ++ removeFileNodes(fileNodes(), this); ++ removeFolderNodes(subFolderNodes(), this); ++ ++ QStringList files = m_project->files(Project::AllFiles); ++ files.removeAll(m_project->filesFileName()); ++ ++ QHash filesInDirectory; ++ ++ foreach (const QString &fileName, files) { ++ QFileInfo fileInfo(fileName); ++ ++ QString absoluteFilePath; ++ QString relativeDirectory; ++ ++ if (fileInfo.isAbsolute()) { ++ absoluteFilePath = fileInfo.filePath(); ++ relativeDirectory = m_project->projectDir().relativeFilePath(fileInfo.path()); ++ } else { ++ absoluteFilePath = m_project->projectDir().absoluteFilePath(fileInfo.filePath()); ++ relativeDirectory = fileInfo.path(); ++ if (relativeDirectory == QLatin1String(".")) ++ relativeDirectory.clear(); ++ } ++ ++ filesInDirectory[relativeDirectory].append(absoluteFilePath); ++ } ++ ++ const QHash::ConstIterator cend = filesInDirectory.constEnd(); ++ for (QHash::ConstIterator it = filesInDirectory.constBegin(); it != cend; ++it) { ++ FolderNode *folder = findOrCreateFolderByName(it.key()); ++ ++ QList fileNodes; ++ foreach (const QString &file, it.value()) { ++ FileType fileType = SourceType; // ### FIXME ++ FileNode *fileNode = new FileNode(file, fileType, false); ++ fileNodes.append(fileNode); ++ } ++ ++ addFileNodes(fileNodes, folder); ++ } ++ ++ m_folderByName.clear(); ++} ++ ++ProjectExplorer::FolderNode *UbuntuProjectNode::findOrCreateFolderByName(const QStringList &components, int end) { ++ if (! end) ++ return 0; ++ ++ QString baseDir = QFileInfo(path()).path(); ++ ++ QString folderName; ++ for (int i = 0; i < end; ++i) { ++ folderName.append(components.at(i)); ++ folderName += QLatin1Char('/'); ++ } ++ ++ const QString component = components.at(end - 1); ++ ++ if (component.isEmpty()) ++ return this; ++ ++ else if (FolderNode *folder = m_folderByName.value(folderName)) ++ return folder; ++ ++ FolderNode *folder = new FolderNode(baseDir + QLatin1Char('/') + folderName); ++ folder->setDisplayName(component); ++ ++ m_folderByName.insert(folderName, folder); ++ ++ FolderNode *parent = findOrCreateFolderByName(components, end - 1); ++ if (! parent) ++ parent = this; ++ ++ addFolderNodes(QList() << folder, parent); ++ ++ return folder; ++} ++ ++ProjectExplorer::FolderNode *UbuntuProjectNode::findOrCreateFolderByName(const QString &filePath) { ++ QStringList components = filePath.split(QLatin1Char('/')); ++ return findOrCreateFolderByName(components, components.length()); ++} ++ ++bool UbuntuProjectNode::hasBuildTargets() const { ++ return true; ++} ++ ++QList UbuntuProjectNode::supportedActions(Node *node) const { ++ Q_UNUSED(node); ++ QList actions; ++ actions.append(AddNewFile); ++ actions.append(EraseFile); ++ actions.append(Rename); ++ return actions; ++} ++ ++bool UbuntuProjectNode::canAddSubProject(const QString &proFilePath) const { ++ Q_UNUSED(proFilePath) ++ return false; ++} ++ ++bool UbuntuProjectNode::addSubProjects(const QStringList &proFilePaths) { ++ Q_UNUSED(proFilePaths) ++ return false; ++} ++ ++bool UbuntuProjectNode::removeSubProjects(const QStringList &proFilePaths) { ++ Q_UNUSED(proFilePaths) ++ return false; ++} ++ ++bool UbuntuProjectNode::addFiles(const ProjectExplorer::FileType, const QStringList &, QStringList *) { ++ return false; ++} ++ ++bool UbuntuProjectNode::removeFiles(const ProjectExplorer::FileType, const QStringList &, QStringList *) { ++ return false; ++} ++ ++bool UbuntuProjectNode::deleteFiles(const ProjectExplorer::FileType, const QStringList &) { ++ return true; ++} ++ ++bool UbuntuProjectNode::renameFile(const ProjectExplorer::FileType, const QString &, const QString &) { ++ return true; ++} ++ ++QList UbuntuProjectNode::runConfigurationsFor(Node *node) { ++ Q_UNUSED(node) ++ return QList(); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectnode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectnode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuprojectnode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuprojectnode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,103 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUPROJECTNODE_H ++#define UBUNTUPROJECTNODE_H ++ ++#include ++ ++#include "ubuntuproject.h" ++#include "ubuntuprojectmanager.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuProject; ++class UbuntuProjectNode : public ProjectExplorer::ProjectNode ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuProjectNode(UbuntuProject *project, Core::IDocument *projectFile); ++ ++ Core::IDocument *projectFile() const; ++ QString projectFilePath() const; ++ ++ virtual bool hasBuildTargets() const; ++ ++ virtual QList supportedActions(Node *node) const; ++ ++ virtual bool canAddSubProject(const QString &proFilePath) const; ++ ++ virtual bool addSubProjects(const QStringList &proFilePaths); ++ virtual bool removeSubProjects(const QStringList &proFilePaths); ++ ++ virtual bool addFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths, ++ QStringList *notAdded = 0); ++ ++ virtual bool removeFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths, ++ QStringList *notRemoved = 0); ++ ++ virtual bool deleteFiles(const ProjectExplorer::FileType fileType, ++ const QStringList &filePaths); ++ ++ virtual bool renameFile(const ProjectExplorer::FileType fileType, ++ const QString &filePath, ++ const QString &newFilePath); ++ virtual QList runConfigurationsFor(Node *node); ++ ++ ++ void refresh(); ++ ++private: ++ FolderNode *findOrCreateFolderByName(const QString &filePath); ++ FolderNode *findOrCreateFolderByName(const QStringList &components, int end); ++ ++private: ++ UbuntuProject *m_project; ++ Core::IDocument *m_projectFile; ++ QHash m_folderByName; ++ ++}; ++} ++} ++ ++#endif // UBUNTUPROJECTNODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfiguration.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfiguration.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfiguration.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfiguration.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,27 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubunturunconfiguration.h" ++ ++using namespace Ubuntu::Internal; ++ ++ProjectExplorer::Abi UbuntuRunConfiguration::Qabi() const { ++ ProjectExplorer::Abi hostAbi = ProjectExplorer::Abi::hostAbi(); ++ return ProjectExplorer::Abi(hostAbi.architecture(), hostAbi.os(), hostAbi.osFlavor(), ++ ProjectExplorer::Abi::RuntimeQmlFormat, hostAbi.wordWidth()); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfiguration.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfiguration.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfiguration.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfiguration.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,74 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTURUNCONFIGURATION_H ++#define UBUNTURUNCONFIGURATION_H ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuRunConfiguration : public ProjectExplorer::RunConfiguration ++{ ++ Q_OBJECT ++public: ++ UbuntuRunConfiguration(ProjectExplorer::Target *parent, Core::Id id) : ProjectExplorer::RunConfiguration(parent, id) {} ++ ++ QWidget *createConfigurationWidget() { ++ return NULL; ++ } ++ ++ bool isEnabled() const { ++ return true; ++ } ++ ++ ProjectExplorer::Abi Qabi() const; ++}; ++ ++} ++} ++ ++#endif // UBUNTURUNCONFIGURATION_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfigurationfactory.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfigurationfactory.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfigurationfactory.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfigurationfactory.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,83 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubunturunconfigurationfactory.h" ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++QList UbuntuRunConfigurationFactory::availableCreationIds(ProjectExplorer::Target *parent) const { ++ if (!canHandle(parent)) ++ return QList(); ++ ++ QList list; ++ list << Core::Id(Constants::UBUNTUPROJECT_RUNCONTROL_ID); ++ ++ return list; ++} ++ ++QString UbuntuRunConfigurationFactory::displayNameForId(const Core::Id id) const { ++ if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID) ++ return tr(Constants::UBUNTUPROJECT_DISPLAYNAME); ++ return QString(); ++} ++ ++bool UbuntuRunConfigurationFactory::canCreate(ProjectExplorer::Target *parent, ++ const Core::Id id) const { ++ if (!canHandle(parent)) ++ return false; ++ ++ if (id == Constants::UBUNTUPROJECT_RUNCONTROL_ID) ++ return true; ++ ++ return false; ++} ++ ++ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::create(ProjectExplorer::Target *parent, const Core::Id id) { ++ if (!canCreate(parent, id)) ++ return NULL; ++ return new UbuntuRunConfiguration(parent, id); ++} ++ ++bool UbuntuRunConfigurationFactory::canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const { ++ return parent && canCreate(parent, ProjectExplorer::idFromMap(map)); ++} ++ ++ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::restore(ProjectExplorer::Target *parent, const QVariantMap &map) { ++ if (!canRestore(parent, map)) ++ return NULL; ++ ++ return NULL; ++} ++ ++bool UbuntuRunConfigurationFactory::canClone(ProjectExplorer::Target *, ProjectExplorer::RunConfiguration *) const { ++ return NULL; ++} ++ ++ProjectExplorer::RunConfiguration *UbuntuRunConfigurationFactory::clone(ProjectExplorer::Target *parent, ++ ProjectExplorer::RunConfiguration *source) { ++ if (!canClone(parent, source)) ++ return NULL; ++ return NULL; ++} ++ ++bool UbuntuRunConfigurationFactory::canHandle(ProjectExplorer::Target *parent) const { ++ if (!qobject_cast(parent->project())) ++ return false; ++ return true; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfigurationfactory.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfigurationfactory.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturunconfigurationfactory.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturunconfigurationfactory.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,77 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTURUNCONFIGURATIONFACTORY_H ++#define UBUNTURUNCONFIGURATIONFACTORY_H ++ ++#include ++#include ++#include "ubuntuproject.h" ++#include "ubuntuconstants.h" ++#include "ubunturunconfiguration.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuRunConfigurationFactory : public ProjectExplorer::IRunConfigurationFactory ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuRunConfigurationFactory() { ++ setObjectName(QLatin1String("UbuntuRunConfigurationFactory")); ++ } ++ ++ QList availableCreationIds(ProjectExplorer::Target *parent) const; ++ QString displayNameForId(const Core::Id id) const; ++ ++ bool canCreate(ProjectExplorer::Target *parent, const Core::Id id) const; ++ ProjectExplorer::RunConfiguration *create(ProjectExplorer::Target *parent, const Core::Id id); ++ bool canRestore(ProjectExplorer::Target *parent, const QVariantMap &map) const; ++ ProjectExplorer::RunConfiguration *restore(ProjectExplorer::Target *parent, const QVariantMap &map); ++ bool canClone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source) const; ++ ProjectExplorer::RunConfiguration *clone(ProjectExplorer::Target *parent, ProjectExplorer::RunConfiguration *source); ++ ++private: ++ bool canHandle(ProjectExplorer::Target *parent) const; ++ ++}; ++ ++} ++} ++#endif // UBUNTURUNCONFIGURATIONFACTORY_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrol.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrol.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrol.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrol.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,91 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubunturuncontrol.h" ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++ ++UbuntuRunControl::UbuntuRunControl(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode, bool debug) ++ : RunControl(runConfiguration, mode) ++{ ++ Utils::Environment env = Utils::Environment::systemEnvironment(); ++ ++ m_applicationLauncher.setEnvironment(env); ++ UbuntuProject* ubuntuProject = qobject_cast(runConfiguration->target()->project()); ++ ++ m_applicationLauncher.setWorkingDirectory(ubuntuProject->projectDir().absolutePath()); ++ ++ m_executable = QtSupport::QtKitInformation::qtVersion(runConfiguration->target()->kit())->qmlsceneCommand(); ++ m_commandLineArguments = QString(QLatin1String("%0.qml")).arg(ubuntuProject->displayName()); ++ ++ connect(&m_applicationLauncher, SIGNAL(appendMessage(QString,Utils::OutputFormat)), ++ this, SLOT(slotAppendMessage(QString,Utils::OutputFormat))); ++ connect(&m_applicationLauncher, SIGNAL(processExited(int)), ++ this, SLOT(processExited(int))); ++ connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)), ++ this, SLOT(slotBringApplicationToForeground(qint64))); ++} ++ ++UbuntuRunControl::~UbuntuRunControl() { ++ stop(); ++} ++ ++void UbuntuRunControl::start() { ++ qDebug() << __PRETTY_FUNCTION__; ++ m_applicationLauncher.start(ProjectExplorer::ApplicationLauncher::Gui, m_executable, ++ m_commandLineArguments); ++ setApplicationProcessHandle(ProjectExplorer::ProcessHandle(m_applicationLauncher.applicationPID())); ++ emit started(); ++ QString msg = tr("Starting %1 %2\n") ++ .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments); ++ appendMessage(msg, Utils::NormalMessageFormat); ++} ++ ++ProjectExplorer::RunControl::StopResult UbuntuRunControl::stop() { ++ m_applicationLauncher.stop(); ++ return StoppedSynchronously; ++} ++ ++bool UbuntuRunControl::isRunning() const { ++ return m_applicationLauncher.isRunning(); ++} ++ ++QIcon UbuntuRunControl::icon() const { ++ return QIcon(QLatin1String(ProjectExplorer::Constants::ICON_RUN_SMALL)); ++} ++ ++void UbuntuRunControl::slotBringApplicationToForeground(qint64 pid) { ++ bringApplicationToForeground(pid); ++} ++ ++void UbuntuRunControl::slotAppendMessage(const QString &line, Utils::OutputFormat format) { ++ appendMessage(line, format); ++} ++ ++void UbuntuRunControl::processExited(int exitCode) { ++ QString msg = tr("%1 exited with code %2\n") ++ .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); ++ appendMessage(msg, exitCode ? Utils::ErrorMessageFormat : Utils::NormalMessageFormat); ++ emit finished(); ++} ++ ++ ++ ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrol.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrol.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrol.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrol.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,88 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTURUNCONTROL_H ++#define UBUNTURUNCONTROL_H ++ ++#include ++#include ++#include ++ ++#include "ubuntuproject.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuRunControl : public ProjectExplorer::RunControl ++{ ++ Q_OBJECT ++public: ++ ++ UbuntuRunControl(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, bool debug = false); ++ virtual ~UbuntuRunControl(); ++ ++ void start(); ++ StopResult stop(); ++ bool isRunning() const; ++ QIcon icon() const; ++ ++private slots: ++ void processExited(int exitCode); ++ void slotBringApplicationToForeground(qint64 pid); ++ void slotAppendMessage(const QString &line, Utils::OutputFormat); ++ ++private: ++ ProjectExplorer::ApplicationLauncher m_applicationLauncher; ++ ++ QString m_executable; ++ QString m_commandLineArguments; ++ QSharedPointer m_browser; ++ ++}; ++ ++ ++} ++} ++ ++#endif // UBUNTURUNCONTROL_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrolfactory.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrolfactory.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrolfactory.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrolfactory.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,52 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubunturuncontrolfactory.h" ++ ++using namespace Ubuntu::Internal; ++ ++bool UbuntuRunControlFactory::canRun(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode) const { ++ if (!qobject_cast(runConfiguration->target()->project())) ++ return false; ++ if (mode == ProjectExplorer::NormalRunMode || mode == ProjectExplorer::DebugRunMode) ++ return true; ++ return false; ++} ++ ++ProjectExplorer::RunControl *UbuntuRunControlFactory::create(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, QString *) { ++ QList runcontrols = ++ ProjectExplorer::ProjectExplorerPlugin::instance()->runControls(); ++ foreach (ProjectExplorer::RunControl *rc, runcontrols) { ++ if (UbuntuRunControl *qrc = qobject_cast(rc)) { ++ qrc->stop(); ++ } ++ } ++ ++ ProjectExplorer::RunControl *runControl = 0; ++ if (mode == ProjectExplorer::NormalRunMode) ++ runControl = new UbuntuRunControl(runConfiguration, mode, false); ++ else if (mode == ProjectExplorer::DebugRunMode) ++ runControl = new UbuntuRunControl(runConfiguration, mode, true); ++ return runControl; ++} ++ ++QString UbuntuRunControlFactory::displayName() const { ++ return tr("Run on Ubuntu Touch Device"); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrolfactory.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrolfactory.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubunturuncontrolfactory.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubunturuncontrolfactory.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,66 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTURUNCONTROLFACTORY_H ++#define UBUNTURUNCONTROLFACTORY_H ++ ++#include ++#include "ubunturuncontrol.h" ++#include "ubuntuproject.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuRunControlFactory : public ProjectExplorer::IRunControlFactory ++{ ++ Q_OBJECT ++public: ++ explicit UbuntuRunControlFactory() = default; ++ virtual ~UbuntuRunControlFactory() {} ++ ++ bool canRun(ProjectExplorer::RunConfiguration *runConfiguration, ProjectExplorer::RunMode mode) const; ++ ProjectExplorer::RunControl *create(ProjectExplorer::RunConfiguration *runConfiguration, ++ ProjectExplorer::RunMode mode, QString *); ++ QString displayName() const; ++ ++}; ++ ++} ++} ++#endif // UBUNTURUNCONTROLFACTORY_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntushared.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntushared.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntushared.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntushared.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUSHARED_H ++#define UBUNTUSHARED_H ++ ++#include ++#include ++#include ++ ++#include ++ ++static bool readFile(QString fileName, QByteArray *data, QString *errorMessage) { ++ Utils::FileReader reader; ++ if (!reader.fetch(fileName, errorMessage)) return false; ++ *data = reader.data(); ++ return true; ++} ++ ++static void printToOutputPane(QString msg) { ++ QString timestamp = QDateTime::currentDateTime().toString(QString::fromLatin1("HH:mm:ss")); ++ Core::ICore::instance()->messageManager()->printToOutputPane(QString(QLatin1String("[%0] %1")).arg(timestamp).arg(msg),true); ++} ++ ++#endif // UBUNTUSHARED_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversion.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversion.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversion.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversion.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,66 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuversion.h" ++ ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuVersion::UbuntuVersion() ++{ ++ QFile lsbRelease(QLatin1String(Constants::LSB_RELEASE)); ++ if (lsbRelease.open(QIODevice::ReadOnly)) { ++ QByteArray data = lsbRelease.readAll(); ++ lsbRelease.close(); ++ ++ foreach(QString line, QString::fromLatin1(data).split(QLatin1String("\n"))) { ++ if (line.startsWith(QLatin1String(Constants::DISTRIB_ID))) { ++ m_id = line.replace(QLatin1String(Constants::DISTRIB_ID),QLatin1String("")); ++ ++ } else if (line.startsWith(QLatin1String(Constants::DISTRIB_RELEASE))) { ++ m_release = line.replace(QLatin1String(Constants::DISTRIB_RELEASE),QLatin1String("")); ++ ++ } else if (line.startsWith(QLatin1String(Constants::DISTRIB_CODENAME))) { ++ m_codename = line.replace(QLatin1String(Constants::DISTRIB_CODENAME),QLatin1String("")); ++ ++ } else if (line.startsWith(QLatin1String(Constants::DISTRIB_DESCRIPTION))) { ++ m_description = line.replace(QLatin1String(Constants::DISTRIB_DESCRIPTION),QLatin1String("")); ++ } ++ } ++ } ++} ++ ++Core::FeatureSet UbuntuVersion::features() { ++ Core::FeatureSet retval; ++ if (codename()==QLatin1String(Constants::PRECISE)) { ++ retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_PRECISE); ++ } else ++ if (codename()==QLatin1String(Constants::QUANTAL)) { ++ retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_QUANTAL); ++ } else ++ if (codename()==QLatin1String(Constants::RARING)) { ++ retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_RARING); ++ } else ++ if (codename()==QLatin1String(Constants::SAUCY)) { ++ retval |= Core::FeatureSet(Constants::FEATURE_UBUNTU_SAUCY); ++ retval |= Core::FeatureSet(Constants::FEATURE_UNITY_SCOPE); ++ } ++ return retval; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversion.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversion.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversion.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversion.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUVERSION_H ++#define UBUNTUVERSION_H ++ ++#include ++#include ++#include "ubuntuconstants.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++ ++class UbuntuVersion : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuVersion(); ++ ++public slots: ++ QString id() { return m_id; } ++ QString release() { return m_release; } ++ QString codename() { return m_codename; } ++ QString description() { return m_description; } ++ ++ Core::FeatureSet features(); ++ ++protected: ++ QString m_id; ++ QString m_release; ++ QString m_codename; ++ QString m_description; ++}; ++} ++} ++ ++#endif // UBUNTUVERSION_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversionmanager.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversionmanager.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversionmanager.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversionmanager.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,58 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuversionmanager.h" ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuVersionManager *UbuntuVersionManager::m_self = 0; ++ ++UbuntuVersionManager::UbuntuVersionManager(QObject *parent) : ++ QObject(parent) ++{ ++ m_hostVersion = new UbuntuVersion(); ++ m_self = this; ++} ++ ++void UbuntuVersionManager::detectAvailableVersions() { ++ // no other platforms yet, add support for Touch devices. ++ // now just the desktop platform. ++} ++ ++Core::FeatureSet UbuntuVersionManager::availableFeatures(const QString &platformName) const { ++ Q_UNUSED(platformName); ++ return m_hostVersion->features(); ++} ++ ++QStringList UbuntuVersionManager::availablePlatforms() const { ++ QStringList platforms; ++ platforms << QLatin1String(Constants::PLATFORM_DESKTOP); ++ return platforms; ++} ++ ++QString UbuntuVersionManager::displayNameForPlatform(const QString &string) const { ++ Q_UNUSED(string); ++ return QString(QLatin1String(Constants::PLATFORM_DESKTOP_DISPLAYNAME)).arg(m_hostVersion->release()); ++} ++ ++UbuntuVersionManager *UbuntuVersionManager::instance() ++{ ++ return m_self; ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversionmanager.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversionmanager.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuversionmanager.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuversionmanager.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,55 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUVERSIONMANAGER_H ++#define UBUNTUVERSIONMANAGER_H ++ ++#include ++#include ++#include ++ ++#include "ubuntuversion.h" ++#include "ubuntuconstants.h" ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuVersionManager : public QObject ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuVersionManager(QObject *parent = 0); ++ ++ void detectAvailableVersions(); ++ ++ Core::FeatureSet availableFeatures(const QString &platformName) const; ++ QStringList availablePlatforms() const; ++ QString displayNameForPlatform(const QString &string) const; ++ ++ static UbuntuVersionManager* instance(); ++ ++protected: ++ static UbuntuVersionManager *m_self; ++ ++ UbuntuVersion* m_hostVersion; ++}; ++ ++} ++} ++#endif // UBUNTUVERSIONMANAGER_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwebmode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwebmode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwebmode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwebmode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,85 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuwebmode.h" ++#include "ubuntuconstants.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuWebMode::UbuntuWebMode(QObject *parent) : ++ Core::IMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_WEB_DISPLAYNAME)); ++ setIcon(QIcon(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_WEB_ICON))); ++ setPriority(Ubuntu::Constants::UBUNTU_MODE_WEB_PRIORITY); ++ setId(Ubuntu::Constants::UBUNTU_MODE_WEB); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_WEB)); ++ ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setMargin(0); ++ layout->setSpacing(0); ++ m_modeWidget.setLayout(layout); ++ ++ connect(&m_webView,SIGNAL(urlChanged(QUrl)),SLOT(updateAddress(QUrl))); ++ connect(&m_addressBar,SIGNAL(returnPressed()),SLOT(goToAddress())); ++ ++ ++ Utils::StyledBar* styledBar = new Utils::StyledBar(&m_modeWidget); ++ //layout->addWidget(styledBar); ++ ++ QScrollArea *scrollArea = new QScrollArea(&m_modeWidget); ++ scrollArea->setFrameShape(QFrame::NoFrame); ++ layout->addWidget(scrollArea); ++ layout->addWidget(&m_addressBar); ++ scrollArea->setWidget(&m_webView); ++ scrollArea->setWidgetResizable(true); ++ ++ connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), SLOT(modeChanged(Core::IMode*))); ++ ++ m_webView.setFocus(); ++ setWidget(&m_modeWidget); ++} ++ ++void UbuntuWebMode::updateAddress(QUrl url) { ++ m_addressBar.setText(url.toString()); ++} ++ ++void UbuntuWebMode::goToAddress() { ++ m_webView.setUrl(QUrl::fromUserInput(m_addressBar.text())); ++} ++ ++void UbuntuWebMode::initialize() { ++ ++} ++ ++void UbuntuWebMode::modeChanged(Core::IMode*) { ++ ++} ++ +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwebmode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwebmode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwebmode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwebmode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,54 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++#ifndef UBUNTUWEBMODE_H ++#define UBUNTUWEBMODE_H ++ ++#include ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuWebMode : public Core::IMode ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuWebMode(QObject *parent = 0); ++ void initialize(); ++ ++public slots: ++ void setUrl(QUrl url) { m_webView.setUrl(url); } ++ ++protected slots: ++ void modeChanged(Core::IMode*); ++ void updateAddress(QUrl url); ++ void goToAddress(); ++ ++protected: ++ QWidget m_modeWidget; ++ QWebView m_webView; ++ QLineEdit m_addressBar; ++}; ++ ++} ++} ++ ++#endif // UBUNTUWEBMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwelcomemode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwelcomemode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwelcomemode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwelcomemode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,133 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuwelcomemode.h" ++#include "ubuntuconstants.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++using namespace Ubuntu; ++using namespace Ubuntu::Internal; ++ ++ ++UbuntuWelcomeMode::UbuntuWelcomeMode(QObject *parent) : Core::IMode(parent), ++ m_declarativeView(new QDeclarativeView) { ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_WELCOME_DISPLAYNAME)); ++ setIcon(QIcon(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_WELCOME_ICON))); ++ setPriority(Core::Constants::P_MODE_WELCOME); ++ setId(Ubuntu::Constants::UBUNTU_MODE_WELCOME); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_WELCOME)); ++ ++ QDeclarativeContext *context = m_declarativeView->rootContext(); ++ context->setContextProperty(QLatin1String("welcomeMode"), this); ++ ++ m_declarativeView->setResizeMode(QDeclarativeView::SizeRootObjectToView); ++ m_declarativeView->setMinimumWidth(860); ++ m_declarativeView->setMinimumHeight(548); ++ ++ m_modeWidget = new QWidget; ++ QVBoxLayout *layout = new QVBoxLayout; ++ layout->setMargin(0); ++ layout->setSpacing(0); ++ m_modeWidget->setLayout(layout); ++ ++ Utils::StyledBar* styledBar = new Utils::StyledBar(m_modeWidget); ++ layout->addWidget(styledBar); ++ QScrollArea *scrollArea = new QScrollArea(m_modeWidget); ++ scrollArea->setFrameShape(QFrame::NoFrame); ++ layout->addWidget(scrollArea); ++ scrollArea->setWidget(m_declarativeView); ++ scrollArea->setWidgetResizable(true); ++ m_declarativeView->setMinimumWidth(860); ++ m_declarativeView->setMinimumHeight(548); ++ connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)), SLOT(modeChanged(Core::IMode*))); ++ ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance(); ++ connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(objectAdded(QObject*))); ++ ++ setWidget(m_modeWidget); ++ //qDebug() << __PRETTY_FUNCTION__; ++} ++ ++void UbuntuWelcomeMode::modeChanged(Core::IMode *mode) { ++ Q_UNUSED(mode); ++} ++ ++void UbuntuWelcomeMode::initialize() { ++ ++ //qDebug() << __PRETTY_FUNCTION__; ++ QDeclarativeContext *context = m_declarativeView->rootContext(); ++ context->setContextProperty(QLatin1String("pagesModel"), QVariant::fromValue(m_welcomeTabPluginList)); ++ ++ m_declarativeView->setSource(QUrl::fromLocalFile(Constants::UBUNTU_WELCOMESCREEN_QML)); ++ m_declarativeView->show(); ++ // Load existing welcome screen plugins - start ++ /* QList loadedWelcomeScreenPlugins = ExtensionSystem::PluginManager::getObjects(); ++ ++ QDeclarativeEngine *engine = m_declarativeView->engine(); ++ ++ ++ QStringList importPathList = engine->importPathList(); ++ importPathList << Core::ICore::resourcePath() + QLatin1String("/welcomescreen") ++ << QDir::cleanPath(QCoreApplication::applicationDirPath() + QLatin1String("/../" IDE_LIBRARY_BASENAME "/qtcreator")); ++ engine->setImportPathList(importPathList); ++ qDebug() << engine->importPathList(); ++ qDebug() << "Checking for loaded plugins"; ++ foreach (Utils::IWelcomePage *plugin, loadedWelcomeScreenPlugins) { ++ qDebug() << "Load welcomepage plugin: " << plugin->title(); ++ plugin->facilitateQml(engine); ++ m_welcomeTabPluginList.append(plugin); ++ } ++ context->setContextProperty(QLatin1String("pagesModel"), QVariant::fromValue(m_welcomeTabPluginList)); ++ qDebug() << "check complete";*/ ++ // end ++ ++} ++ ++void UbuntuWelcomeMode::objectAdded(QObject* obj) { ++ Q_UNUSED(obj); ++ //qDebug() << __PRETTY_FUNCTION__; ++} ++ ++ ++void UbuntuWelcomeMode::newProject() { ++ Core::ICore::showNewItemDialog(tr("New Project"), Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard)); ++} ++ ++void UbuntuWelcomeMode::openProject() { ++ ProjectExplorer::ProjectExplorerPlugin::instance()->openOpenProjectDialog(); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwelcomemode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwelcomemode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwelcomemode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwelcomemode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,55 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUWELCOMEMODE_H ++#define UBUNTUWELCOMEMODE_H ++ ++#include ++#include ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuWelcomeMode : public Core::IMode ++{ ++ Q_OBJECT ++ ++public: ++ UbuntuWelcomeMode(QObject *parent = 0); ++ void initialize(); ++ ++public slots: ++ void newProject(); ++ void openProject(); ++ ++protected slots: ++ void modeChanged(Core::IMode*); ++ void objectAdded(QObject* obj); ++ ++protected: ++ QDeclarativeView* m_declarativeView; ++ QWidget* m_modeWidget; ++ QList m_welcomeTabPluginList; ++}; ++ ++ ++} // Internal ++} // Ubuntu ++ ++#endif // UBUNTUWELCOMEMODE_H +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwikimode.cpp ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwikimode.cpp +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwikimode.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwikimode.cpp 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,32 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#include "ubuntuwikimode.h" ++#include "ubuntuconstants.h" ++ ++using namespace Ubuntu::Internal; ++ ++UbuntuWikiMode::UbuntuWikiMode(QObject *parent) : ++ UbuntuWebMode(parent) ++{ ++ setDisplayName(tr(Ubuntu::Constants::UBUNTU_MODE_WIKI_DISPLAYNAME)); ++ setId(Ubuntu::Constants::UBUNTU_MODE_WIKI); ++ setObjectName(QLatin1String(Ubuntu::Constants::UBUNTU_MODE_WIKI)); ++ ++ setUrl(QUrl::fromUserInput(QLatin1String(Ubuntu::Constants::UBUNTU_WIKI))); ++} +diff -urN ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwikimode.h ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwikimode.h +--- ubuntu-qtcreator-plugins/empty/plugins/ubuntu/ubuntuwikimode.h 1970-01-01 00:00:00.000000000 +0000 ++++ ubuntu-qtcreator-plugins/src/plugins/ubuntu/ubuntuwikimode.h 2013-08-06 05:05:56.732698000 +0000 +@@ -0,0 +1,40 @@ ++/* ++ * Copyright 2013 Canonical Ltd. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU Lesser General Public License as published by ++ * the Free Software Foundation; version 2.1. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public License ++ * along with this program. If not, see . ++ * ++ * Author: Juhapekka Piiroinen ++ */ ++ ++#ifndef UBUNTUWIKIMODE_H ++#define UBUNTUWIKIMODE_H ++ ++#include "ubuntuwebmode.h" ++#include ++ ++namespace Ubuntu { ++namespace Internal { ++ ++class UbuntuWikiMode : public UbuntuWebMode ++{ ++ Q_OBJECT ++ ++public: ++ explicit UbuntuWikiMode(QObject *parent = 0); ++ ++}; ++ ++} ++} ++ ++#endif // UBUNTUWIKIMODE_H diff -Nru qtcreator-2.7.1/debian/patches/series qtcreator-2.7.1/debian/patches/series --- qtcreator-2.7.1/debian/patches/series 2013-08-07 07:23:34.000000000 +0000 +++ qtcreator-2.7.1/debian/patches/series 2013-08-22 23:09:54.000000000 +0000 @@ -5,5 +5,7 @@ # Ubuntu patches rpath_nonlinux.diff botan_system_lib.diff +#qtcreator-plugin-ubuntu.patch +#qtcreator-plugin-ubuntu-buildchanges.patch prefer_qmake_to_qmake-qt4.patch workaround_welcome_plugin.patch Binary files /tmp/nIKB71UXBc/qtcreator-2.7.1/debian/qtcreator-plugin-ubuntu-images.tar.gz and /tmp/X_Z6tUoiLk/qtcreator-2.7.1/debian/qtcreator-plugin-ubuntu-images.tar.gz differ diff -Nru qtcreator-2.7.1/debian/rules qtcreator-2.7.1/debian/rules --- qtcreator-2.7.1/debian/rules 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/debian/rules 2013-08-22 23:09:54.000000000 +0000 @@ -3,6 +3,12 @@ # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 +ifneq (,$(filter $(DEB_HOST_ARCH),armhf)) + export GCC47 := "QMAKE_CXX=g++-4.7" +else + export GCC47 := +endif + DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) # Upstream changelog @@ -12,8 +18,9 @@ dh $@ --parallel --list-missing --dbg-package=qtcreator-dbg --buildsystem=qmake --builddirectory=builddir override_dh_auto_configure: + tar xvf debian/qtcreator-plugin-ubuntu-images.tar.gz mkdir -p builddir - dh_auto_configure -- $(CURDIR) IDE_LIBRARY_BASENAME=lib/$(DEB_HOST_MULTIARCH) IDE_PACKAGE_MODE=1 USE_SYSTEM_BOTAN=1 $(extra_configure_opts) + dh_auto_configure -- $(CURDIR) $(GCC47) IDE_LIBRARY_BASENAME=lib/$(DEB_HOST_MULTIARCH) IDE_PACKAGE_MODE=1 USE_SYSTEM_BOTAN=1 $(extra_configure_opts) override_dh_auto_install: ifneq (,$(filter qtcreator-doc, $(shell dh_listpackages))) @@ -37,5 +44,6 @@ override_dh_shlibdeps: dh_shlibdeps -XlibUbuntu.so -XlibCordovaUbuntuProjectManager.so + override_dh_builddeb: dh_builddeb -- -Zxz diff -Nru qtcreator-2.7.1/debian/source/include-binaries qtcreator-2.7.1/debian/source/include-binaries --- qtcreator-2.7.1/debian/source/include-binaries 2013-08-07 07:23:34.000000000 +0000 +++ qtcreator-2.7.1/debian/source/include-binaries 2013-08-22 23:09:54.000000000 +0000 @@ -1,9 +1,2 @@ debian/qtcreator-plugin-ubuntu-images.tar.gz -share/qtcreator/templates/wizards/ubuntu/tabs/toolbarIcon@8.png -share/qtcreator/ubuntu/welcome/images/bg_dotted.png -share/qtcreator/ubuntu/welcome/images/devices.png -src/plugins/ubuntu/images/device.png -src/plugins/ubuntu/images/ubuntu-128.png -src/plugins/ubuntu/images/ubuntu-48.png -src/plugins/ubuntu/images/ubuntu-64.png -src/plugins/ubuntu/images/ubuntu-qtcreator.png +debian/ubuntu-qtcreator.png diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/manifest.json.template qtcreator-2.7.1/src/plugins/ubuntu/manifest.json.template --- qtcreator-2.7.1/src/plugins/ubuntu/manifest.json.template 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/manifest.json.template 2013-08-22 23:20:17.000000000 +0000 @@ -1,17 +1,13 @@ { - "name": "com.ubuntu.developer.username.myapp", - "version": "0.1", - "maintainer": "Your Name ", - "title": "My Cool App", - "framework": "ubuntu-sdk-13.10", - "security": { - "profiles": { - "myapp": { - "policy_groups": [ - "networking" - ], - "policy_version": 1.0 - } - } - } + "name": "com.ubuntu.developer.username.myapp", + "description": "description of myapp", + "framework": "ubuntu-sdk-13.10", + "title": "myapp", + "hooks": { + "myapp": { + "apparmor": "myapp.json", + "desktop": "myapp.desktop" + } + }, + "version": "0.1" } diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/manifestlib.js qtcreator-2.7.1/src/plugins/ubuntu/manifestlib.js --- qtcreator-2.7.1/src/plugins/ubuntu/manifestlib.js 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/manifestlib.js 2013-08-22 23:20:17.000000000 +0000 @@ -34,20 +34,17 @@ } function getPolicyGroups($appname) { - var appProfile = jsonData.security.profiles[$appname]; +/* var appProfile = jsonData.security.profiles[$appname]; if (appProfile===undefined) { jsonData.security.profiles.push( { $appname: { policy_groups: "" } } ); } return appProfile.policy_groups; +*/ + return jsonData.policy_groups; + } function setPolicyGroups($appname,$groups) { var $parsed_groups = $groups.split(" "); - - var $appProfile = jsonData.security.profiles[$appname]; - if ($appProfile===undefined) { - jsonData.security.profiles.push( { $appname: { policy_groups: $parsed_groups } } ); - } else { - $appProfile["policy_groups"] = $parsed_groups; - } + jsonData.policy_groups = $parsed_groups; } diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/myapp.json.template qtcreator-2.7.1/src/plugins/ubuntu/myapp.json.template --- qtcreator-2.7.1/src/plugins/ubuntu/myapp.json.template 1970-01-01 00:00:00.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/myapp.json.template 2013-08-22 23:20:17.000000000 +0000 @@ -0,0 +1,6 @@ +{ + "policy_groups": [ + "networking" + ], + "policy_version": 1.0 +} diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/resources.qrc qtcreator-2.7.1/src/plugins/ubuntu/resources.qrc --- qtcreator-2.7.1/src/plugins/ubuntu/resources.qrc 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/resources.qrc 2013-08-22 23:20:17.000000000 +0000 @@ -12,6 +12,7 @@ images/coreapps.png images/packaging.png manifest.json.template + myapp.json.template manifestlib.js diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/ubuntu.pro qtcreator-2.7.1/src/plugins/ubuntu/ubuntu.pro --- qtcreator-2.7.1/src/plugins/ubuntu/ubuntu.pro 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/ubuntu.pro 2013-08-22 23:20:17.000000000 +0000 @@ -104,4 +104,5 @@ OTHER_FILES += \ UbuntuProject.mimetypes.xml \ manifest.json.template \ + myapp.json.template \ manifestlib.js diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/ubuntuclickmanifest.cpp qtcreator-2.7.1/src/plugins/ubuntu/ubuntuclickmanifest.cpp --- qtcreator-2.7.1/src/plugins/ubuntu/ubuntuclickmanifest.cpp 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/ubuntuclickmanifest.cpp 2013-08-22 23:20:17.000000000 +0000 @@ -106,7 +106,7 @@ if (!file.open(QIODevice::WriteOnly)) { emit error(); - qDebug() << QLatin1String("unable to open file for writing"); + qDebug() << QLatin1String("unable to open file for writing") << fileName; return; } @@ -148,6 +148,7 @@ if (!file.open(QIODevice::ReadOnly)) { emit error(); qDebug() << QLatin1String("unable to open file for reading"); + return; } diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.cpp qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.cpp --- qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.cpp 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.cpp 2013-08-22 23:20:17.000000000 +0000 @@ -47,6 +47,7 @@ connect(&m_bzr,SIGNAL(initializedChanged()),SLOT(bzrChanged())); connect(&m_manifest,SIGNAL(loaded()),SLOT(reload())); + connect(&m_apparmor,SIGNAL(loaded()),SLOT(reload())); m_bzr.initialize(); } @@ -75,11 +76,18 @@ if (startupProject) { m_projectName = startupProject->displayName(); QString fileName = QString(QLatin1String("%0/manifest.json")).arg(startupProject->projectDirectory()); + QString fileAppArmorName = QString(QLatin1String("%0/%1.json")).arg(startupProject->projectDirectory()).arg(startupProject->displayName()); if (QFile(fileName).exists()==false) { m_manifest.setFileName(fileName); on_pushButtonReset_clicked(); } else { - load(fileName); + load_manifest(fileName); + } + if (QFile(fileAppArmorName).exists()==false) { + m_apparmor.setFileName(fileAppArmorName); + on_pushButtonReset_clicked(); + } else { + load_apparmor(fileAppArmorName); } ui->stackedWidget->setCurrentIndex(0); } else { @@ -99,7 +107,10 @@ void UbuntuPackagingWidget::on_pushButtonReset_clicked() { QString fileName = m_manifest.fileName(); - load(QLatin1String(":/ubuntu/manifest.json.template")); + QString fileAppArmorName = m_apparmor.fileName(); + load_manifest(QLatin1String(":/ubuntu/manifest.json.template")); + load_apparmor(QLatin1String(":/ubuntu/myapp.json.template")); + m_apparmor.setFileName(fileAppArmorName); m_manifest.setFileName(fileName); m_manifest.setMaintainer(m_bzr.whoami()); QString userName = m_bzr.launchpadId(); @@ -118,15 +129,16 @@ items.append(ui->listWidget->item(i)->text()); } - m_manifest.setPolicyGroups(m_projectName,items); + m_apparmor.setPolicyGroups(m_projectName,items); } else { m_manifest.setRaw(ui->plainTextEditJson->toPlainText()); + m_apparmor.setRaw(ui->plainTextEditAppArmorJson->toPlainText()); } - m_manifest.save(); + m_apparmor.save(); } -void UbuntuPackagingWidget::load(QString fileName) { +void UbuntuPackagingWidget::load_manifest(QString fileName) { m_manifest.load(fileName,m_projectName); m_manifest.setMaintainer(m_bzr.whoami()); QString userName = m_bzr.launchpadId(); @@ -134,12 +146,18 @@ m_manifest.setName(QString(QLatin1String("com.ubuntu.developer.%0.%1")).arg(userName).arg(m_projectName)); } +void UbuntuPackagingWidget::load_apparmor(QString fileAppArmorName) { + m_apparmor.load(fileAppArmorName,m_projectName); +} + + + void UbuntuPackagingWidget::reload() { ui->lineEdit_maintainer->setText(m_manifest.maintainer()); ui->lineEdit_name->setText(m_manifest.name()); ui->lineEdit_title->setText(m_manifest.title()); - QStringList policyGroups = m_manifest.policyGroups(m_projectName); + QStringList policyGroups = m_apparmor.policyGroups(m_projectName); ui->listWidget->clear(); foreach( QString policy, policyGroups) { @@ -149,6 +167,8 @@ } ui->plainTextEditJson->setPlainText(m_manifest.raw()); + ui->plainTextEditAppArmorJson->setPlainText(m_apparmor.raw()); + } void UbuntuPackagingWidget::on_tabWidget_currentChanged(int) { @@ -158,6 +178,7 @@ void UbuntuPackagingWidget::on_pushButtonReload_clicked() { m_manifest.reload(); + m_apparmor.reload(); } void UbuntuPackagingWidget::on_listWidget_customContextMenuRequested(QPoint p) { diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.h qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.h --- qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.h 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.h 2013-08-22 23:20:17.000000000 +0000 @@ -22,7 +22,8 @@ public slots: void reload(); - void load(QString fileName); + void load_manifest(QString fileName); + void load_apparmor(QString fileAppArmorName); void save(bool bSaveSimple = true); void openManifestForProject(); void setAvailable(bool); @@ -41,6 +42,7 @@ private: UbuntuClickManifest m_manifest; + UbuntuClickManifest m_apparmor; QProcess m_click; UbuntuBzr m_bzr; QString m_projectName; diff -Nru qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.ui qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.ui --- qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.ui 2013-08-07 08:22:42.000000000 +0000 +++ qtcreator-2.7.1/src/plugins/ubuntu/ubuntupackagingwidget.ui 2013-08-22 23:20:17.000000000 +0000 @@ -324,9 +324,9 @@ - + - Advanced + Manifest @@ -334,6 +334,16 @@ + + + AppArmor + + + + + + +