Commit 9b88e0db authored by Kai Koehne's avatar Kai Koehne
Browse files

Update file/directory names for Qt Quick 1 template



Make the names in line with the Qt Quick 2 ones. Also, changing
the directory/filename makes sure the update mechanism of Qt Creator
doesn't update apps generated by the 2.x wizard any more, which
might break stuff.

Change-Id: I4621d5f35eae2102aeba7e77c5cd903511be249f
Reviewed-by: default avatarJarek Kobus <jaroslaw.kobus@digia.com>
parent ac6aa54f
......@@ -25,7 +25,7 @@ SOURCES += main.cpp
# target.path =
# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qmlapplicationviewer.pri, instead) #
include(qtquick1applicationviewer/qtquick1applicationviewer.pri)
# REMOVE_NEXT_LINE (wizard will remove the include and append deployment.pri to qtquick1applicationviewer.pri, instead) #
include(../shared/deployment.pri)
qtcAddDeployment()
#include "qmlapplicationviewer.h"
#include "qtquick1applicationviewer.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
QtQuick1ApplicationViewer viewer;
viewer.addImportPath(QLatin1String("modules")); // ADDIMPORTPATH
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); // ORIENTATION
viewer.setOrientation(QtQuick1ApplicationViewer::ScreenOrientationAuto); // ORIENTATION
viewer.setMainQmlFile(QLatin1String("qml/app/qtquick10/main.qml")); // MAINQML
viewer.showExpanded();
......
/*
This file was generated by the Qt Quick Application wizard of Qt Creator.
QmlApplicationViewer is a convenience class containing mobile device specific
code such as screen orientation handling. Also QML paths and debugging are
This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
QtQuick1ApplicationViewer is a convenience class containing mobile device
specific code such as screen orientation handling. Also QML paths 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 "qmlapplicationviewer.h"
#include "qtquick1applicationviewer.h"
#include <QDir>
#include <QFileInfo>
......@@ -18,14 +18,14 @@
#include <qplatformdefs.h> // MEEGO_EDITION_HARMATTAN
class QmlApplicationViewerPrivate
class QtQuick1ApplicationViewerPrivate
{
QString mainQmlFile;
friend class QmlApplicationViewer;
friend class QtQuick1ApplicationViewer;
static QString adjustPath(const QString &path);
};
QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
QString QtQuick1ApplicationViewerPrivate::adjustPath(const QString &path)
{
#ifdef Q_OS_MAC
if (!QDir::isAbsolutePath(path))
......@@ -36,38 +36,40 @@ QString QmlApplicationViewerPrivate::adjustPath(const QString &path)
return QString::fromLatin1("app/native/%1").arg(path);
#elif !defined(Q_OS_ANDROID)
QString pathInInstallDir =
QString::fromLatin1("%1/../%2").arg(QCoreApplication::applicationDirPath(), path);
QString::fromLatin1("%1/../%2").arg(
QCoreApplication::applicationDirPath(), path);
if (QFileInfo(pathInInstallDir).exists())
return pathInInstallDir;
pathInInstallDir =
QString::fromLatin1("%1/%2").arg(QCoreApplication::applicationDirPath(), path);
QString::fromLatin1("%1/%2").arg(
QCoreApplication::applicationDirPath(), path);
if (QFileInfo(pathInInstallDir).exists())
return pathInInstallDir;
#endif
return path;
}
QmlApplicationViewer::QmlApplicationViewer(QWidget *parent)
QtQuick1ApplicationViewer::QtQuick1ApplicationViewer(QWidget *parent)
: QDeclarativeView(parent)
, d(new QmlApplicationViewerPrivate())
, d(new QtQuick1ApplicationViewerPrivate())
{
connect(engine(), SIGNAL(quit()), SLOT(close()));
setResizeMode(QDeclarativeView::SizeRootObjectToView);
}
QmlApplicationViewer::~QmlApplicationViewer()
QtQuick1ApplicationViewer::~QtQuick1ApplicationViewer()
{
delete d;
}
QmlApplicationViewer *QmlApplicationViewer::create()
QtQuick1ApplicationViewer *QtQuick1ApplicationViewer::create()
{
return new QmlApplicationViewer();
return new QtQuick1ApplicationViewer();
}
void QmlApplicationViewer::setMainQmlFile(const QString &file)
void QtQuick1ApplicationViewer::setMainQmlFile(const QString &file)
{
d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file);
d->mainQmlFile = QtQuick1ApplicationViewerPrivate::adjustPath(file);
#ifdef Q_OS_ANDROID
setSource(QUrl(QLatin1String("assets:/")+d->mainQmlFile));
#else
......@@ -75,12 +77,12 @@ void QmlApplicationViewer::setMainQmlFile(const QString &file)
#endif
}
void QmlApplicationViewer::addImportPath(const QString &path)
void QtQuick1ApplicationViewer::addImportPath(const QString &path)
{
engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path));
engine()->addImportPath(QtQuick1ApplicationViewerPrivate::adjustPath(path));
}
void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
void QtQuick1ApplicationViewer::setOrientation(ScreenOrientation orientation)
{
#if QT_VERSION < 0x050000
Qt::WidgetAttribute attribute;
......@@ -102,7 +104,7 @@ void QmlApplicationViewer::setOrientation(ScreenOrientation orientation)
#endif // QT_VERSION < 0x050000
}
void QmlApplicationViewer::showExpanded()
void QtQuick1ApplicationViewer::showExpanded()
{
#if defined(Q_WS_SIMULATOR) || defined(Q_OS_QNX)
showFullScreen();
......
/*
This file was generated by the Qt Quick Application wizard of Qt Creator.
QmlApplicationViewer is a convenience class containing mobile device specific
code such as screen orientation handling. Also QML paths and debugging are
This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
QtQuick1ApplicationViewer is a convenience class containing mobile device
specific code such as screen orientation handling. Also QML paths 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 QMLAPPLICATIONVIEWER_H
#define QMLAPPLICATIONVIEWER_H
#ifndef QTQUICK1APPLICATIONVIEWER_H
#define QTQUICK1APPLICATIONVIEWER_H
#include <QDeclarativeView>
class QmlApplicationViewer : public QDeclarativeView
class QtQuick1ApplicationViewer : public QDeclarativeView
{
Q_OBJECT
......@@ -23,10 +23,10 @@ public:
ScreenOrientationAuto
};
explicit QmlApplicationViewer(QWidget *parent = 0);
virtual ~QmlApplicationViewer();
explicit QtQuick1ApplicationViewer(QWidget *parent = 0);
virtual ~QtQuick1ApplicationViewer();
static QmlApplicationViewer *create();
static QtQuick1ApplicationViewer *create();
void setMainQmlFile(const QString &file);
void addImportPath(const QString &path);
......@@ -37,9 +37,7 @@ public:
void showExpanded();
private:
class QmlApplicationViewerPrivate *d;
class QtQuick1ApplicationViewerPrivate *d;
};
QApplication *createApplication(int &argc, char **argv);
#endif // QMLAPPLICATIONVIEWER_H
#endif // QTQUICK1APPLICATIONVIEWER_H
# This file was generated by the Qt Quick Application wizard of Qt Creator.
# The code below adds the QmlApplicationViewer to the project and handles the
# activation of QML debugging.
# This file was generated by the Qt Quick 1 Application wizard of Qt Creator.
# The code below adds the QtQuick1ApplicationViewer to the project.
#
# It is recommended not to modify this file, since newer versions of Qt Creator
# may offer an updated version of it.
QT += declarative
SOURCES += $$PWD/qmlapplicationviewer.cpp
HEADERS += $$PWD/qmlapplicationviewer.h
SOURCES += $$PWD/qtquick1applicationviewer.cpp
HEADERS += $$PWD/qtquick1applicationviewer.h
INCLUDEPATH += $$PWD
......@@ -29,6 +29,9 @@
#include "qtquickapp.h"
#include <utils/qtcassert.h>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QTextStream>
......@@ -113,15 +116,25 @@ QString QtQuickApp::originsRoot() const
switch (m_componentSet) {
case QtQuickControls10: return templatesRoot() + QLatin1String("qtquick2controls/");
case QtQuick20Components: return templatesRoot() + QLatin1String("qtquick2app/");
default: break;
case QtQuick10Components: return templatesRoot() + QLatin1String("qtquick1app/");
}
return templatesRoot() + QLatin1String("qtquickapp/");
qWarning() << "QtQuickApp::originsRoot() - unhandled component set"
<< m_componentSet;
return QString();
}
QString QtQuickApp::mainWindowClassName() const
{
return QLatin1String("QmlApplicationViewer");
switch (m_componentSet) {
case QtQuickControls10: return QLatin1String("QtQuick2ControlsApplicationViewer");
case QtQuick20Components: return QLatin1String("QtQuick2ApplicationViewer");
case QtQuick10Components: return QLatin1String("QtQuick1ApplicationViewer");
}
qWarning() << "QtQuickApp::mainWindowClassName() - unhandled component set"
<< m_componentSet;
return QString();
}
bool QtQuickApp::adaptCurrentMainCppTemplateLine(QString &line) const
......@@ -174,12 +187,15 @@ bool QtQuickApp::useExistingMainQml() const
QString QtQuickApp::appViewerBaseName() const
{
if (m_componentSet == QtQuick20Components) {
return QLatin1String("qtquick2applicationviewer");
} else if (m_componentSet == QtQuickControls10) {
return QLatin1String("qtquick2controlsapplicationviewer");
switch (m_componentSet) {
case QtQuickControls10: return QLatin1String("qtquick2controlsapplicationviewer");
case QtQuick20Components: return QLatin1String("qtquick2applicationviewer");
case QtQuick10Components: return QLatin1String("qtquick1applicationviewer");
}
return QLatin1String("qmlapplicationviewer");
qWarning() << "QtQuickApp::appViewerBaseName() - unhandled component set"
<< m_componentSet;
return QString();
}
QString QtQuickApp::fileName(QtQuickApp::ExtendedFileType type) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment