forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/2.6'
Conflicts: src/plugins/qt4projectmanager/wizards/qtquickapp.cpp Change-Id: I6ece61c73bc32e93912ad1b489871c597ab60d5b
This commit is contained in:
24
share/qtcreator/templates/qtquick2app/app.pro
Normal file
24
share/qtcreator/templates/qtquick2app/app.pro
Normal file
@@ -0,0 +1,24 @@
|
||||
# Add more folders to ship with the application, here
|
||||
# DEPLOYMENTFOLDERS #
|
||||
folder_01.source = qml/app
|
||||
folder_01.target = qml
|
||||
DEPLOYMENTFOLDERS = folder_01
|
||||
# DEPLOYMENTFOLDERS_END #
|
||||
|
||||
# Additional import path used to resolve QML modules in Creator's code model
|
||||
# QML_IMPORT_PATH #
|
||||
QML_IMPORT_PATH =
|
||||
|
||||
# If your application uses the Qt Mobility libraries, uncomment the following
|
||||
# lines and add the respective components to the MOBILITY variable.
|
||||
# CONFIG += mobility
|
||||
# MOBILITY +=
|
||||
|
||||
# The .cpp file which was generated for your project. Feel free to hack it.
|
||||
SOURCES += main.cpp
|
||||
|
||||
# Please do not modify the following two lines. Required for deployment.
|
||||
include(qtquick2applicationviewer/qtquick2applicationviewer.pri)
|
||||
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
|
||||
include(../shared/deployment.pri)
|
||||
qtcAddDeployment()
|
13
share/qtcreator/templates/qtquick2app/main.cpp
Normal file
13
share/qtcreator/templates/qtquick2app/main.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include "qtquick2applicationviewer.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QtQuick2ApplicationViewer viewer;
|
||||
viewer.setMainQmlFile(QStringLiteral("qml/app/qtquick20/main.qml")); // MAINQML
|
||||
viewer.showExpanded();
|
||||
|
||||
return app.exec();
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
width: 360
|
||||
height: 360
|
||||
Text {
|
||||
text: qsTr("Hello World")
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
QtQuick2ApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#include "qtquick2applicationviewer.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtQml/QQmlEngine>
|
||||
|
||||
class QtQuick2ApplicationViewerPrivate
|
||||
{
|
||||
QString mainQmlFile;
|
||||
friend class QtQuick2ApplicationViewer;
|
||||
static QString adjustPath(const QString &path);
|
||||
};
|
||||
|
||||
QString QtQuick2ApplicationViewerPrivate::adjustPath(const QString &path)
|
||||
{
|
||||
#ifdef Q_OS_UNIX
|
||||
#ifdef Q_OS_MAC
|
||||
if (!QDir::isAbsolutePath(path))
|
||||
return QString::fromLatin1("%1/../Resources/%2")
|
||||
.arg(QCoreApplication::applicationDirPath(), path);
|
||||
#elif !defined(Q_OS_ANDROID)
|
||||
const QString pathInInstallDir =
|
||||
QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
|
||||
if (QFileInfo(pathInInstallDir).exists())
|
||||
return pathInInstallDir;
|
||||
#endif
|
||||
#endif
|
||||
return path;
|
||||
}
|
||||
|
||||
QtQuick2ApplicationViewer::QtQuick2ApplicationViewer(QWindow *parent)
|
||||
: QQuickView(parent)
|
||||
, d(new QtQuick2ApplicationViewerPrivate())
|
||||
{
|
||||
connect(engine(), SIGNAL(quit()), SLOT(close()));
|
||||
setResizeMode(QQuickView::SizeRootObjectToView);
|
||||
|
||||
#ifdef Q_OS_ANDROID
|
||||
engine()->setBaseUrl(QUrl::fromLocalFile("/"));
|
||||
#endif
|
||||
}
|
||||
|
||||
QtQuick2ApplicationViewer::~QtQuick2ApplicationViewer()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::setMainQmlFile(const QString &file)
|
||||
{
|
||||
d->mainQmlFile = QtQuick2ApplicationViewerPrivate::adjustPath(file);
|
||||
setSource(QUrl::fromLocalFile(d->mainQmlFile));
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::addImportPath(const QString &path)
|
||||
{
|
||||
engine()->addImportPath(QtQuick2ApplicationViewerPrivate::adjustPath(path));
|
||||
}
|
||||
|
||||
void QtQuick2ApplicationViewer::showExpanded()
|
||||
{
|
||||
#if defined(Q_WS_SIMULATOR)
|
||||
showFullScreen();
|
||||
#else
|
||||
show();
|
||||
#endif
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
QtQuick2ApplicationViewer is a convenience class containing mobile device specific
|
||||
code such as screen orientation handling. Also QML paths and debugging are
|
||||
handled here.
|
||||
It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
may offer an updated version of it.
|
||||
*/
|
||||
|
||||
#ifndef QTQUICK2APPLICATIONVIEWER_H
|
||||
#define QTQUICK2APPLICATIONVIEWER_H
|
||||
|
||||
#include <QtQuick/QQuickView>
|
||||
|
||||
class QtQuick2ApplicationViewer : public QQuickView
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QtQuick2ApplicationViewer(QWindow *parent = 0);
|
||||
virtual ~QtQuick2ApplicationViewer();
|
||||
|
||||
void setMainQmlFile(const QString &file);
|
||||
void addImportPath(const QString &path);
|
||||
|
||||
void showExpanded();
|
||||
|
||||
private:
|
||||
class QtQuick2ApplicationViewerPrivate *d;
|
||||
};
|
||||
|
||||
#endif // QTQUICK2APPLICATIONVIEWER_H
|
@@ -0,0 +1,11 @@
|
||||
# This file was generated by the Qt Quick 2 Application wizard of Qt Creator.
|
||||
# The code below adds the QtQuick2ApplicationViewer to the project and handles
|
||||
# the activation of QML debugging.
|
||||
# It is recommended not to modify this file, since newer versions of Qt Creator
|
||||
# may offer an updated version of it.
|
||||
|
||||
QT += qml quick
|
||||
|
||||
SOURCES += $$PWD/qtquick2applicationviewer.cpp
|
||||
HEADERS += $$PWD/qtquick2applicationviewer.h
|
||||
INCLUDEPATH += $$PWD
|
@@ -1,26 +1,18 @@
|
||||
#include <QWindow>
|
||||
#include <QtDeclarative>
|
||||
#include <QGuiApplication>
|
||||
#include <QQuickView>
|
||||
#include <QQmlEngine>
|
||||
|
||||
int main( int argc, char** argv )
|
||||
{
|
||||
QGuiApplication app( argc, argv );
|
||||
|
||||
QWindow *window = 0;
|
||||
int exitCode = 0;
|
||||
QQuickView view;
|
||||
view.setResizeMode( QQuickView::SizeRootObjectToView );
|
||||
view.setSource( QUrl( "app/native/qml/main.qml" ) );
|
||||
|
||||
QQuickView* view = new QQuickView();
|
||||
view->setResizeMode( QQuickView::SizeRootObjectToView );
|
||||
view->setSource( QUrl( "app/native/qml/main.qml" ) );
|
||||
|
||||
QDeclarativeEngine* engine = view->engine();
|
||||
QObject::connect( engine, SIGNAL(quit()),
|
||||
QObject::connect( view.engine(), SIGNAL( quit() ),
|
||||
QCoreApplication::instance(), SLOT( quit() ) );
|
||||
window = view;
|
||||
window->showMaximized();
|
||||
view.show();
|
||||
|
||||
exitCode = app.exec();
|
||||
|
||||
delete window;
|
||||
return exitCode;
|
||||
return app.exec();
|
||||
}
|
||||
|
@@ -418,9 +418,10 @@ void AutotoolsProject::updateCppCodeModel()
|
||||
QByteArray macros;
|
||||
|
||||
if (activeTarget()) {
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(activeTarget()->kit());
|
||||
ProjectExplorer::Kit *k = activeTarget()->kit();
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (tc) {
|
||||
const QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths();
|
||||
const QList<HeaderPath> allHeaderPaths = tc->systemHeaderPaths(SysRootKitInformation::sysRoot(k));
|
||||
foreach (const HeaderPath &headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
|
@@ -425,7 +425,7 @@ void CMakeRunPage::initializePage()
|
||||
} else if (targetAbi.osFlavor() == ProjectExplorer::Abi::WindowsMSysFlavor) {
|
||||
#ifdef Q_OS_WIN
|
||||
if (cachedGenerator.isEmpty() || cachedGenerator == "MinGW Makefiles")
|
||||
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(p->displayName()), kitVariant);
|
||||
m_generatorComboBox->addItem(tr("MinGW Generator (%1)").arg(k->displayName()), kitVariant);
|
||||
#else
|
||||
if (cachedGenerator.isEmpty() || cachedGenerator == "Unix Makefiles")
|
||||
m_generatorComboBox->addItem(tr("Unix Generator (%1)").arg(k->displayName()), kitVariant);
|
||||
|
@@ -286,7 +286,8 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
createUiCodeModelSupport();
|
||||
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(activeTarget()->kit());
|
||||
Kit *k = activeTarget()->kit();
|
||||
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(k);
|
||||
if (!tc) {
|
||||
emit buildTargetsChanged();
|
||||
emit fileListChanged();
|
||||
@@ -304,7 +305,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
QStringList allFrameworkPaths;
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths;
|
||||
allHeaderPaths = tc->systemHeaderPaths();
|
||||
allHeaderPaths = tc->systemHeaderPaths(SysRootKitInformation::sysRoot(k));
|
||||
foreach (const ProjectExplorer::HeaderPath &headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
|
@@ -249,13 +249,13 @@ void GenericProject::refresh(RefreshOptions options)
|
||||
CPlusPlus::CppModelManagerInterface::ProjectPart::Ptr part(
|
||||
new CPlusPlus::CppModelManagerInterface::ProjectPart);
|
||||
|
||||
ToolChain *tc = activeTarget() ?
|
||||
ToolChainKitInformation::toolChain(activeTarget()->kit()) : 0;
|
||||
Kit *k = activeTarget() ? activeTarget()->kit() : KitManager::instance()->defaultKit();
|
||||
ToolChain *tc = k ? ToolChainKitInformation::toolChain(k) : 0;
|
||||
if (tc) {
|
||||
part->defines = tc->predefinedMacros(QStringList());
|
||||
part->defines += '\n';
|
||||
|
||||
foreach (const HeaderPath &headerPath, tc->systemHeaderPaths()) {
|
||||
foreach (const HeaderPath &headerPath, tc->systemHeaderPaths(SysRootKitInformation::sysRoot(k))) {
|
||||
if (headerPath.kind() == HeaderPath::FrameworkHeaderPath)
|
||||
part->frameworkPaths.append(headerPath.path());
|
||||
else
|
||||
|
@@ -98,11 +98,19 @@ QByteArray AbstractMsvcToolChain::predefinedMacros(const QStringList &cxxflags)
|
||||
ToolChain::CompilerFlags AbstractMsvcToolChain::compilerFlags(const QStringList &cxxflags) const
|
||||
{
|
||||
Q_UNUSED(cxxflags);
|
||||
|
||||
switch (m_abi.osFlavor()) {
|
||||
case ProjectExplorer::Abi::WindowsMsvc2010Flavor:
|
||||
case ProjectExplorer::Abi::WindowsMsvc2012Flavor:
|
||||
return STD_CXX11;
|
||||
default:
|
||||
return NO_FLAGS;
|
||||
}
|
||||
}
|
||||
|
||||
QList<HeaderPath> AbstractMsvcToolChain::systemHeaderPaths() const
|
||||
QList<HeaderPath> AbstractMsvcToolChain::systemHeaderPaths(const Utils::FileName &sysRoot) const
|
||||
{
|
||||
Q_UNUSED(sysRoot);
|
||||
if (m_headerPaths.isEmpty()) {
|
||||
Utils::Environment env(m_lastEnvironment);
|
||||
addToEnvironment(env);
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
|
||||
QByteArray predefinedMacros(const QStringList &cxxflags) const;
|
||||
CompilerFlags compilerFlags(const QStringList &cxxflags) const;
|
||||
QList<HeaderPath> systemHeaderPaths() const;
|
||||
QList<HeaderPath> systemHeaderPaths(const Utils::FileName &sysRoot) const;
|
||||
void addToEnvironment(Utils::Environment &env) const;
|
||||
|
||||
QString makeCommand() const;
|
||||
|
@@ -149,12 +149,12 @@ static QByteArray gccPredefinedMacros(const FileName &gcc, const QStringList &ar
|
||||
return predefinedMacros;
|
||||
}
|
||||
|
||||
QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStringList &env, const QString &sysrootPath)
|
||||
QList<HeaderPath> GccToolChain::gccHeaderPaths(const FileName &gcc, const QStringList &env, const FileName &sysrootPath)
|
||||
{
|
||||
QList<HeaderPath> systemHeaderPaths;
|
||||
QStringList arguments;
|
||||
if (!sysrootPath.isEmpty())
|
||||
arguments.append(QString::fromLatin1("--sysroot=%1").arg(sysrootPath));
|
||||
arguments.append(QString::fromLatin1("--sysroot=%1").arg(sysrootPath.toString()));
|
||||
arguments << QLatin1String("-xc++")
|
||||
<< QLatin1String("-E")
|
||||
<< QLatin1String("-v")
|
||||
@@ -388,18 +388,19 @@ QByteArray GccToolChain::predefinedMacros(const QStringList &cxxflags) const
|
||||
|
||||
ToolChain::CompilerFlags GccToolChain::compilerFlags(const QStringList &cxxflags) const
|
||||
{
|
||||
if (cxxflags.contains("-std=c++0x") || cxxflags.contains("-std=gnu++0x"))
|
||||
if (cxxflags.contains("-std=c++0x") || cxxflags.contains("-std=gnu++0x") ||
|
||||
cxxflags.contains("-std=c++11") || cxxflags.contains("-std=gnu++11"))
|
||||
return STD_CXX11;
|
||||
return NO_FLAGS;
|
||||
}
|
||||
|
||||
QList<HeaderPath> GccToolChain::systemHeaderPaths() const
|
||||
QList<HeaderPath> GccToolChain::systemHeaderPaths(const Utils::FileName &sysRoot) const
|
||||
{
|
||||
if (m_headerPaths.isEmpty()) {
|
||||
// Using a clean environment breaks ccache/distcc/etc.
|
||||
Environment env = Environment::systemEnvironment();
|
||||
addToEnvironment(env);
|
||||
m_headerPaths = gccHeaderPaths(m_compilerCommand, env.toStringList());
|
||||
m_headerPaths = gccHeaderPaths(m_compilerCommand, env.toStringList(), sysRoot);
|
||||
}
|
||||
return m_headerPaths;
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
QByteArray predefinedMacros(const QStringList &cxxflags) const;
|
||||
CompilerFlags compilerFlags(const QStringList &cxxflags) const;
|
||||
|
||||
QList<HeaderPath> systemHeaderPaths() const;
|
||||
QList<HeaderPath> systemHeaderPaths(const Utils::FileName &sysRoot) const;
|
||||
void addToEnvironment(Utils::Environment &env) const;
|
||||
QString makeCommand() const;
|
||||
QList<Utils::FileName> suggestedMkspecList() const;
|
||||
@@ -91,7 +91,7 @@ protected:
|
||||
virtual QList<Abi> detectSupportedAbis() const;
|
||||
virtual QString detectVersion() const;
|
||||
|
||||
static QList<HeaderPath> gccHeaderPaths(const Utils::FileName &gcc, const QStringList &env, const QString &sysrootPath = QString());
|
||||
static QList<HeaderPath> gccHeaderPaths(const Utils::FileName &gcc, const QStringList &env, const Utils::FileName &sysrootPath);
|
||||
|
||||
mutable QByteArray m_predefinedMacros;
|
||||
|
||||
|
@@ -124,7 +124,7 @@ QString ToolChain::id() const
|
||||
return d->m_id;
|
||||
}
|
||||
|
||||
Utils::FileName ToolChain::suggestedDebugger()
|
||||
Utils::FileName ToolChain::suggestedDebugger() const
|
||||
{
|
||||
return ToolChainManager::instance()->defaultDebugger(targetAbi());
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ public:
|
||||
QString id() const;
|
||||
|
||||
virtual QList<Utils::FileName> suggestedMkspecList() const { return QList<Utils::FileName>(); }
|
||||
virtual Utils::FileName suggestedDebugger();
|
||||
virtual Utils::FileName suggestedDebugger() const;
|
||||
|
||||
virtual QString type() const = 0;
|
||||
virtual QString typeDisplayName() const = 0;
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
STD_CXX11 = 1
|
||||
};
|
||||
virtual CompilerFlags compilerFlags(const QStringList &cxxflags) const = 0;
|
||||
virtual QList<HeaderPath> systemHeaderPaths() const = 0;
|
||||
virtual QList<HeaderPath> systemHeaderPaths(const Utils::FileName &sysRoot) const = 0;
|
||||
virtual void addToEnvironment(Utils::Environment &env) const = 0;
|
||||
virtual QString makeCommand() const = 0;
|
||||
|
||||
|
@@ -527,7 +527,7 @@ void Qt4Project::updateCppCodeModel()
|
||||
|
||||
QList<HeaderPath> headers;
|
||||
if (tc)
|
||||
headers = tc->systemHeaderPaths(); // todo pass cxxflags?
|
||||
headers = tc->systemHeaderPaths(SysRootKitInformation::sysRoot(k)); // todo pass cxxflags?
|
||||
if (qtVersion) {
|
||||
headers.append(qtVersion->systemHeaderPathes(k));
|
||||
}
|
||||
|
@@ -265,7 +265,9 @@ ProjectExplorer::Project *Qt4Manager::openProject(const QString &fileName, QStri
|
||||
}
|
||||
}
|
||||
|
||||
const QtQuickApp qtQuickApp;
|
||||
QtQuickApp qtQuickApp;
|
||||
updateBoilerPlateCodeFiles(&qtQuickApp, canonicalFilePath);
|
||||
qtQuickApp.setComponentSet(QtQuickApp::QtQuick20Components);
|
||||
updateBoilerPlateCodeFiles(&qtQuickApp, canonicalFilePath);
|
||||
const Html5App html5App;
|
||||
updateBoilerPlateCodeFiles(&html5App, canonicalFilePath);
|
||||
|
@@ -43,12 +43,6 @@
|
||||
namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
const QString appViewerBaseName(QLatin1String("qmlapplicationviewer"));
|
||||
const QString appViewerPriFileName(appViewerBaseName + QLatin1String(".pri"));
|
||||
const QString appViewerCppFileName(appViewerBaseName + QLatin1String(".cpp"));
|
||||
const QString appViewerHFileName(appViewerBaseName + QLatin1String(".h"));
|
||||
const QString appViewerOriginsSubDir(appViewerBaseName + QLatin1Char('/'));
|
||||
|
||||
QtQuickApp::QtQuickApp()
|
||||
: AbstractMobileApp()
|
||||
, m_mainQmlMode(ModeGenerate)
|
||||
@@ -85,7 +79,7 @@ QString QtQuickApp::pathExtended(int fileType) const
|
||||
const QString qmlSubDir = QLatin1String("qml/")
|
||||
+ (importQmlFile ? m_mainQmlFile.dir().dirName() : projectName())
|
||||
+ QLatin1Char('/');
|
||||
const QString appViewerTargetSubDir = appViewerOriginsSubDir;
|
||||
const QString appViewerTargetSubDir = appViewerOriginSubDir();
|
||||
|
||||
const QString mainQmlFile = QLatin1String("main.qml");
|
||||
const QString mainPageQmlFile = QLatin1String("MainPage.qml");
|
||||
@@ -104,12 +98,12 @@ QString QtQuickApp::pathExtended(int fileType) const
|
||||
case MainQmlOrigin: return qmlOriginDir + mainQmlFile;
|
||||
case MainPageQml: return pathBase + qmlSubDir + mainPageQmlFile;
|
||||
case MainPageQmlOrigin: return qmlOriginDir + mainPageQmlFile;
|
||||
case AppViewerPri: return pathBase + appViewerTargetSubDir + appViewerPriFileName;
|
||||
case AppViewerPriOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerPriFileName;
|
||||
case AppViewerCpp: return pathBase + appViewerTargetSubDir + appViewerCppFileName;
|
||||
case AppViewerCppOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerCppFileName;
|
||||
case AppViewerH: return pathBase + appViewerTargetSubDir + appViewerHFileName;
|
||||
case AppViewerHOrigin: return originsRoot() + appViewerOriginsSubDir + appViewerHFileName;
|
||||
case AppViewerPri: return pathBase + appViewerTargetSubDir + fileName(AppViewerPri);
|
||||
case AppViewerPriOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerPri);
|
||||
case AppViewerCpp: return pathBase + appViewerTargetSubDir + fileName(AppViewerCpp);
|
||||
case AppViewerCppOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerCpp);
|
||||
case AppViewerH: return pathBase + appViewerTargetSubDir + fileName(AppViewerH);
|
||||
case AppViewerHOrigin: return originsRoot() + appViewerOriginSubDir() + fileName(AppViewerH);
|
||||
case QmlDir: return pathBase + qmlSubDir;
|
||||
case QmlDirProFileRelative: return importQmlFile ? appProFilePath.relativeFilePath(m_mainQmlFile.canonicalPath())
|
||||
: QString(qmlSubDir).remove(qmlSubDir.length() - 1, 1);
|
||||
@@ -120,7 +114,8 @@ QString QtQuickApp::pathExtended(int fileType) const
|
||||
|
||||
QString QtQuickApp::originsRoot() const
|
||||
{
|
||||
return templatesRoot() + QLatin1String("qtquickapp/");
|
||||
const bool isQtQuick2 = m_componentSet == QtQuick20Components;
|
||||
return templatesRoot() + QLatin1String(isQtQuick2 ? "qtquick2app/" : "qtquickapp/");
|
||||
}
|
||||
|
||||
QString QtQuickApp::mainWindowClassName() const
|
||||
@@ -180,6 +175,27 @@ bool QtQuickApp::useExistingMainQml() const
|
||||
return !m_mainQmlFile.filePath().isEmpty();
|
||||
}
|
||||
|
||||
QString QtQuickApp::appViewerBaseName() const
|
||||
{
|
||||
return QLatin1String(m_componentSet == QtQuick20Components ?
|
||||
"qtquick2applicationviewer" : "qmlapplicationviewer");
|
||||
}
|
||||
|
||||
QString QtQuickApp::fileName(QtQuickApp::ExtendedFileType type) const
|
||||
{
|
||||
switch (type) {
|
||||
case AppViewerPri: return appViewerBaseName() + QLatin1String(".pri");
|
||||
case AppViewerH: return appViewerBaseName() + QLatin1String(".h");
|
||||
case AppViewerCpp: return appViewerBaseName() + QLatin1String(".cpp");
|
||||
default: return QString();
|
||||
}
|
||||
}
|
||||
|
||||
QString QtQuickApp::appViewerOriginSubDir() const
|
||||
{
|
||||
return appViewerBaseName() + QLatin1Char('/');
|
||||
}
|
||||
|
||||
QByteArray QtQuickApp::generateFileExtended(int fileType,
|
||||
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const
|
||||
{
|
||||
@@ -212,7 +228,7 @@ QByteArray QtQuickApp::generateFileExtended(int fileType,
|
||||
|
||||
int QtQuickApp::stubVersionMinor() const
|
||||
{
|
||||
return StubVersion;
|
||||
return m_componentSet == QtQuick20Components ? 1 : 22;
|
||||
}
|
||||
|
||||
QList<AbstractGeneratedFileInfo> QtQuickApp::updateableFiles(const QString &mainProFile) const
|
||||
@@ -222,21 +238,21 @@ QList<AbstractGeneratedFileInfo> QtQuickApp::updateableFiles(const QString &main
|
||||
int fileType;
|
||||
QString fileName;
|
||||
} files[] = {
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerPriFile, appViewerPriFileName},
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerHFile, appViewerHFileName},
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerCppFile, appViewerCppFileName}
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerPriFile, fileName(AppViewerPri)},
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerHFile, fileName(AppViewerH)},
|
||||
{QtQuickAppGeneratedFileInfo::AppViewerCppFile, fileName(AppViewerCpp)}
|
||||
};
|
||||
const QFileInfo mainProFileInfo(mainProFile);
|
||||
const int size = sizeof(files) / sizeof(files[0]);
|
||||
for (int i = 0; i < size; ++i) {
|
||||
const QString fileName = mainProFileInfo.dir().absolutePath()
|
||||
+ QLatin1Char('/') + appViewerOriginsSubDir + files[i].fileName;
|
||||
+ QLatin1Char('/') + appViewerOriginSubDir() + files[i].fileName;
|
||||
if (!QFile::exists(fileName))
|
||||
continue;
|
||||
QtQuickAppGeneratedFileInfo file;
|
||||
file.fileType = files[i].fileType;
|
||||
file.fileInfo = QFileInfo(fileName);
|
||||
file.currentVersion = AbstractMobileApp::makeStubVersion(QtQuickApp::StubVersion);
|
||||
file.currentVersion = AbstractMobileApp::makeStubVersion(stubVersionMinor());
|
||||
result.append(file);
|
||||
}
|
||||
if (result.count() != size)
|
||||
@@ -256,13 +272,13 @@ QString QtQuickApp::componentSetDir(ComponentSet componentSet) const
|
||||
switch (componentSet) {
|
||||
case Meego10Components:
|
||||
return QLatin1String("meego10");
|
||||
case QtQuick20Components:
|
||||
return QLatin1String("qtquick20");
|
||||
case QtQuick10Components:
|
||||
default:
|
||||
return QLatin1String("qtquick10");
|
||||
}
|
||||
}
|
||||
|
||||
const int QtQuickApp::StubVersion = 22;
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
@@ -78,7 +78,8 @@ public:
|
||||
|
||||
enum ComponentSet {
|
||||
QtQuick10Components,
|
||||
Meego10Components
|
||||
Meego10Components,
|
||||
QtQuick20Components
|
||||
};
|
||||
|
||||
QtQuickApp();
|
||||
@@ -98,6 +99,11 @@ public:
|
||||
|
||||
static const int StubVersion;
|
||||
|
||||
protected:
|
||||
virtual QString appViewerBaseName() const;
|
||||
QString fileName(ExtendedFileType type) const;
|
||||
QString appViewerOriginSubDir() const;
|
||||
|
||||
private:
|
||||
virtual QByteArray generateFileExtended(int fileType,
|
||||
bool *versionAndCheckSum, QString *comment, QString *errorMessage) const;
|
||||
|
@@ -72,7 +72,7 @@ QtQuickAppWizardDialog::QtQuickAppWizardDialog(QWidget *parent,
|
||||
QtQuickAppWizard::Kind kind)
|
||||
: AbstractMobileAppWizardDialog(parent,
|
||||
QtSupport::QtVersionNumber(4, 7, 0),
|
||||
QtSupport::QtVersionNumber(4, INT_MAX, INT_MAX), parameters)
|
||||
QtSupport::QtVersionNumber(5, INT_MAX, INT_MAX), parameters)
|
||||
{
|
||||
setWindowTitle(tr("New Qt Quick Application"));
|
||||
setIntroDescription(tr("This wizard generates a Qt Quick application project."));
|
||||
@@ -143,13 +143,23 @@ void QtQuickAppWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
basicFeatures = Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_1);
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick Application (Built-in Elements)"));
|
||||
parameter.setDescription(basicDescription + tr("The built-in elements in the QtQuick namespace allow "
|
||||
parameter.setDisplayName(tr("Qt Quick 1 Application (Built-in Elements)"));
|
||||
parameter.setDescription(basicDescription + tr("The built-in elements in the QtQuick 1 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 4.7.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(basicFeatures);
|
||||
list << parameter;
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick 2 Application (Built-in Elements)"));
|
||||
parameter.setDescription(tr("Creates a Qt Quick application project that can contain "
|
||||
"both QML and C++ code and includes a QQuickView.\n\n"
|
||||
"The built-in elements in the QtQuick 2 namespace allow "
|
||||
"you to write cross-platform applications with "
|
||||
"a custom look and feel.\n\nRequires <b>Qt 5.0</b> or newer."));
|
||||
parameter.setRequiredFeatures(Core::Feature(QtSupport::Constants::FEATURE_QT_QUICK_2));
|
||||
list << parameter;
|
||||
|
||||
parameter = base;
|
||||
parameter.setDisplayName(tr("Qt Quick Application for MeeGo Harmattan"));
|
||||
parameter.setDescription(basicDescription + tr("The Qt Quick Components for MeeGo Harmattan are "
|
||||
@@ -173,7 +183,7 @@ void QtQuickAppWizard::createInstances(ExtensionSystem::IPlugin *plugin)
|
||||
|
||||
QList<QtQuickAppWizard*> wizardList = Core::createMultipleBaseFileWizardInstances<QtQuickAppWizard>(list, plugin);
|
||||
|
||||
Q_ASSERT(wizardList.count() == 3);
|
||||
Q_ASSERT(wizardList.count() == 4);
|
||||
|
||||
for (int i = 0; i < wizardList.count(); i++) {
|
||||
wizardList.at(i)->setQtQuickKind(Kind(i));
|
||||
@@ -209,6 +219,10 @@ AbstractMobileAppWizardDialog *QtQuickAppWizard::createWizardDialogInternal(QWid
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick10Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeImport);
|
||||
break;
|
||||
case QtQuick2_0:
|
||||
d->app->setComponentSet(QtQuickApp::QtQuick20Components);
|
||||
d->app->setMainQml(QtQuickApp::ModeGenerate);
|
||||
break;
|
||||
default:
|
||||
qWarning() << "QtQuickAppWizard illegal subOption:" << qtQuickKind();
|
||||
break;
|
||||
|
@@ -43,8 +43,9 @@ public:
|
||||
|
||||
enum Kind {
|
||||
QtQuick1_1 = 0,
|
||||
MeegoComponents = 1,
|
||||
ImportQml = 2
|
||||
QtQuick2_0 = 1,
|
||||
MeegoComponents = 2,
|
||||
ImportQml = 3
|
||||
};
|
||||
|
||||
QtQuickAppWizard();
|
||||
|
@@ -50,6 +50,15 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
QtQuickApp sAppNew;
|
||||
sAppNew.setProjectPath(projectPath);
|
||||
sAppNew.setComponentSet(QtQuickApp::ComponentSetQtQuick2_0);
|
||||
sAppNew.setProjectName(QLatin1String("new_qtquick2_app"));
|
||||
if (!sAppNew.generateFiles(&errorMessage))
|
||||
return 1;
|
||||
}
|
||||
|
||||
{
|
||||
QtQuickApp sAppImport01;
|
||||
sAppImport01.setProjectPath(projectPath);
|
||||
|
Reference in New Issue
Block a user