Commit 397bd2ed authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

parents 86a7b26f 4d88d702
......@@ -113,35 +113,47 @@
\image addressbook-tutorial-part1-screenshot.png
We begin by launching Qt Creator and use it to generate a new project. To
do this, select \gui New from the \gui File menu. In the
\gui{New...} dialog, select \gui{Projects|Qt4 Gui Application}. For a step
by step guide on how to create a \gui Project with Qt Creator, refer to the
\l{Creating a Project in Qt Creator}. Ensure that you select QWidget as
your subclass and name it \c AddressBook.
do this, select \gui{New File or Project...} from the \gui File menu. In
the \gui{New...} dialog, select \gui{Projects -> Qt4 Gui Application} and
click \gui OK. Set your project name to \bold part1 with the QtCore and
QtGui modules checked. Ensure that you select QWidget as your base class
and name it \c AddressBook.
Five files will be generated in this \gui{Project}:
When you click \gui Next, \e five files will be generated in this
\gui{Project}:
\list
\o \c{addressbook.pro} - the project file,
\o \c{addressbook.h} - the definition file for the \c AddressBook
class,
\o \c{main.cpp} - the file containing a \c main() function, with an
instance of \c AddressBook,
\o \c{addressbook.cpp} - the implementation file for the
\c AddressBook class,
\o \c{main.cpp} - the file containing a \c main() function, with an
instance of \c AddressBook, and
\o \c{addressbook.ui} - the user interface file created with \QD.
\o \c{addressbook.h} - the definition file for the \c AddressBook
class,
\o \c{addressbook.ui} - the user interface file created with \QD,
and
\o \c{part1.pro} - the project file.
\endlist
Now that we have all the files we need, let's move on to designing the user
interface.
Now that we have all the files we need, click \gui Finish so can start
designing the user interface.
\table
\row
\o \bold{Note:} For more details on how to create a \gui Project
with Qt Creator, refer to \l{Creating a Project in Qt Creator}.
\endtable
\section1 Placing Widgets on The Form
In the \gui{Project Sidebar}, double-click on the \c{addressbook.ui} file.
\image addressbook-tutorial-part1-creator-screenshot.png
In the \gui{Projects} sidebar, double-click on the \c{addressbook.ui} file.
The \QD plugin will be launched, allowing you to design your program's user
interface.
\image addressbook-tutorial-part1-designer-screenshot.png
We require two \l{QLabel}s to label the input fields as well as a QLineEdit
and a QTextEdit for the input fields. So, drag those widgets from the
\gui{Widget Box} to your form. In the \gui{Property Editor}, set their
......@@ -154,8 +166,8 @@
structured manner. QGridLayout divides the available space into a grid and
places widgets in the cells we specify with row and column numbers. The
diagram below shows the layout cells and the position of our widgets. Place
your widgets accordingly and save the form by choosing
\gui{File | Save} or using the \key{Ctrl+S} shortcut.
your widgets accordingly and save the form by choosing \gui{File -> Save}
or using the \key{Ctrl+S} shortcut.
\image addressbook-tutorial-part1-labeled-screenshot.png
......@@ -169,6 +181,14 @@
\gui{Lay out Vertically}. The output will be the same. Now your widgets
will resize correctly.
\table
\row
\o \bold{Note:} Refer to the \l{Layout Classes} document for more
details on Qt's layout management classes. In addition, the
\l{Getting to Know Qt Designer} document explains how to use
layouts with \QD.
\endtable
\section1 The AddressBook Class
......@@ -475,8 +495,6 @@
default. This is because navigation is only enabled when there is more than
one contact in the address book.
\snippet examples/addressbook-sdk/part3/addressbook.cpp extract objects
Next, we connect the buttons to their respective slots:
\snippet examples/addressbook-sdk/part3/addressbook.cpp signal slot
......@@ -591,7 +609,7 @@
In order to switch between modes, we introduce the \c updateInterface()
function to control the enabling and disabling of all push buttons.
\snippet examples/addressbook-sdk/part4/adressbook.h updateInterface
\snippet examples/addressbook-sdk/part4/addressbook.h updateInterface
Lastly, we declare \c currentMode to keep track of the enum's current mode.
......@@ -776,7 +794,7 @@
public, classes instantiating and using \c FindDialog can always access the
search string that the user has entered and accepted.
\snippet examples/addressbook-sdk/part5/finddialog.cpp getFindText
\snippet examples/addressbook-sdk/part5/finddialog.cpp findText
\section1 The AddressBook Class
......@@ -791,23 +809,13 @@
\c findButton and \c findContact().
\snippet examples/addressbook-sdk/part5/addressbook.h slot definition
\dots
\snippet examples/addressbook-sdk/part5/addressbook.h private members
Lastly, we declare the private variable, \c dialog, which we will use to
refer to an instance of \c FindDialog.
Once we have instantiated a dialog, we might want to use it more than once;
using a private variable allows us to refer to it from more than one place
in the class.
Within the \c AddressBook class's constructor, we insantiate our private
objects, \c findButton and \c dialog:
\snippet examples/addressbook-sdk/part5/addressbook.cpp private members
Next, we connect the \c{findButton}'s \l{QPushButton::}{clicked()} signal
to \c findContact().
Within the \c AddressBook class's constructor, we connect the
\c{findButton}'s \l{QPushButton::}{clicked()} signal to \c findContact().
\snippet examples/addressbook-sdk/part5/addressbook.cpp signal slot
......
......@@ -1551,7 +1551,7 @@
directory. This file contains all project subdirectories which Qt Creator
could find relevant headers for. Simply add your include pathes here.
In \guiGeneric Project} mode, Qt Creator will not modify any project
In \gui{Generic Project} mode, Qt Creator will not modify any project
settings, so the above is merely a hint for code completion and syntax
highlighting.
*/
......
......@@ -1041,7 +1041,7 @@ static void qDumpQAbstractItem(QDumper &d)
.put(child.internalPointer()).put(",").put(child.model());
d.endItem();
d.putItem("type", NS"QAbstractItem");
d.putItem("value", m->data(mi, Qt::DisplayRole).toString());
d.putItem("value", m->data(child, Qt::DisplayRole).toString());
d.putItem("valueencoded", "2");
d.endHash();
}
......
......@@ -857,7 +857,9 @@ void SplitterOrView::split(Qt::Orientation orientation)
m_layout->setCurrentWidget(m_splitter);
view->view()->copyNavigationHistoryFrom(m_view);
view->view()->setCurrentEditor(view->view()->currentEditor());
otherView->view()->copyNavigationHistoryFrom(m_view);
otherView->view()->setCurrentEditor(otherView->view()->currentEditor());
if (m_view && !m_isRoot) {
em->emptyView(m_view);
......
......@@ -72,6 +72,9 @@ QList<IEditor *> OpenEditorsModel::editors() const
void OpenEditorsModel::addEditor(IEditor *editor, bool isDuplicate)
{
if (!editor)
return;
if (isDuplicate) {
m_duplicateEditors.append(editor);
return;
......@@ -195,7 +198,7 @@ int OpenEditorsModel::restoredEditorCount() const
bool OpenEditorsModel::isDuplicate(IEditor *editor) const
{
return m_duplicateEditors.contains(editor);
return editor && m_duplicateEditors.contains(editor);
}
IEditor *OpenEditorsModel::originalForDuplicate(IEditor *duplicate) const
......@@ -219,13 +222,15 @@ QList<IEditor *> OpenEditorsModel::duplicatesFor(IEditor *editor) const
void OpenEditorsModel::makeOriginal(IEditor *duplicate)
{
Q_ASSERT(isDuplicate(duplicate));
Q_ASSERT(duplicate && isDuplicate(duplicate));
IEditor *original = originalForDuplicate(duplicate);
Q_ASSERT(original);
int i = findEditor(original);
m_editors[i].editor = duplicate;
m_duplicateEditors.removeOne(duplicate);
m_duplicateEditors.append(original);
disconnect(original, SIGNAL(changed()), this, SLOT(itemChanged()));
connect(duplicate, SIGNAL(changed()), this, SLOT(itemChanged()));
}
void OpenEditorsModel::emitDataChanged(IEditor *editor)
......
......@@ -199,14 +199,14 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
QSet<IFile*> filesDone;
foreach (const EditLocation &hi, view->editorHistory()) {
if (hi.file == 0 || filesDone.contains(hi.file))
if (hi.file.isNull() || filesDone.contains(hi.file))
continue;
filesDone.insert(hi.file.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
QString title = model->displayNameForFile(hi.file);
if (hi.file && hi.file->isModified())
if (hi.file->isModified())
title += tr("*");
item->setIcon(0, hi.file->isReadOnly() ? lockedIcon : emptyIcon);
item->setText(0, title);
......@@ -226,20 +226,21 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
// add missing editors from the main view
if (mainView != view) {
foreach (const EditLocation &hi, mainView->editorHistory()) {
if (hi.file == 0 || filesDone.contains(hi.file))
if (hi.file.isNull() || filesDone.contains(hi.file))
continue;
filesDone.insert(hi.file.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
QString title = model->displayNameForFile(hi.file);
if (hi.file && hi.file->isModified())
if (hi.file->isModified())
title += tr("*");
item->setIcon(0, hi.file->isReadOnly() ? lockedIcon : emptyIcon);
item->setText(0, title);
item->setToolTip(0, hi.file->fileName());
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data()));
item->setData(0, Qt::UserRole+1, QVariant::fromValue(view));
item->setData(0, Qt::UserRole+2, QVariant::fromValue(hi.kind));
item->setTextAlignment(0, Qt::AlignLeft);
m_editorList->addTopLevelItem(item);
......
......@@ -77,6 +77,8 @@ public:
#ifdef QTCREATOR_WITH_S60
WINSCW = 5,
GCCE = 6,
RVCT_ARMV5 = 7,
RVCT_ARMV6 = 8,
#endif
OTHER = 200,
UNKNOWN = 201,
......
......@@ -30,8 +30,6 @@
#include "gccetoolchain.h"
#include "qt4project.h"
#include <coreplugin/icore.h>
#include <QtCore/QDir>
#include <QtDebug>
......@@ -58,11 +56,13 @@ ToolChain::ToolChainType GCCEToolChain::type() const
QList<HeaderPath> GCCEToolChain::systemHeaderPaths()
{
GccToolChain::systemHeaderPaths();
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis\\sys").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\variant").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
if (m_systemHeaderPaths.isEmpty()) {
GccToolChain::systemHeaderPaths();
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis\\sys").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\variant").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
}
return m_systemHeaderPaths;
}
......
SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
!isEmpty(SUPPORT_QT_S60) {
!isEmpty(SUPPORT_QT_S60) {
message("Adding experimental support for Qt/S60 applications.")
DEFINES += QTCREATOR_WITH_S60
SOURCES += $$PWD/s60devices.cpp \
......@@ -9,7 +9,8 @@ SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
$$PWD/gccetoolchain.cpp \
$$PWD/s60emulatorrunconfiguration.cpp \
$$PWD/s60devicerunconfiguration.cpp \
$$PWD/serialdevicelister.cpp
$$PWD/serialdevicelister.cpp \
$$PWD/rvcttoolchain.cpp
HEADERS += $$PWD/s60devices.h \
$$PWD/s60devicespreferencepane.h \
$$PWD/s60manager.h \
......@@ -17,10 +18,9 @@ SUPPORT_QT_S60 = $$(QTCREATOR_WITH_S60)
$$PWD/gccetoolchain.h \
$$PWD/s60emulatorrunconfiguration.h \
$$PWD/s60devicerunconfiguration.h \
$$PWD/serialdevicelister.h
$$PWD/serialdevicelister.h \
$$PWD/rvcttoolchain.h
FORMS += $$PWD/s60devicespreferencepane.ui
OTHER_FILES += $$PWD/qt-s60-todo.txt
include($$PWD/../../../../tests/manual/trk/trklauncher.pri) || error("could not include trklauncher.pri")
# LIBS += -lUser32 -lSetupApi
include($$PWD/../../../../tests/manual/trk/trklauncher.pri)||error("could not include trklauncher.pri")
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "rvcttoolchain.h"
#include "qt4project.h"
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
RVCTToolChain::RVCTToolChain(S60Devices::Device device, ToolChain::ToolChainType type,
const QString &makeTargetBase)
: m_deviceId(device.id),
m_deviceName(device.name),
m_deviceRoot(device.epocRoot),
m_type(type),
m_makeTargetBase(makeTargetBase)
{
}
ToolChain::ToolChainType RVCTToolChain::type() const
{
return m_type;
}
QByteArray RVCTToolChain::predefinedMacros()
{
//TODO
return QByteArray();
}
QList<HeaderPath> RVCTToolChain::systemHeaderPaths()
{
if (m_systemHeaderPaths.isEmpty()) {
//TODO system header paths (from environment variables?)
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\stdapis\\sys").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
m_systemHeaderPaths.append(HeaderPath(QString("%1\\epoc32\\include\\variant").arg(m_deviceRoot), HeaderPath::GlobalHeaderPath));
}
return m_systemHeaderPaths;
}
void RVCTToolChain::addToEnvironment(ProjectExplorer::Environment &env)
{
env.prependOrSetPath(QString("%1\\epoc32\\tools").arg(m_deviceRoot)); // e.g. make.exe
env.prependOrSetPath(QString("%1\\epoc32\\gcc\\bin").arg(m_deviceRoot)); // e.g. gcc.exe
env.set("EPOCDEVICE", QString("%1:%2").arg(m_deviceId, m_deviceName));
env.set("EPOCROOT", S60Devices::cleanedRootPath(m_deviceRoot));
}
QString RVCTToolChain::makeCommand() const
{
return "make";
}
QString RVCTToolChain::defaultMakeTarget() const
{
const Qt4Project *qt4project = qobject_cast<const Qt4Project *>(m_project);
if (qt4project) {
if (!(QtVersion::QmakeBuildConfig(qt4project->value(
qt4project->activeBuildConfiguration(),
"buildConfiguration").toInt()) & QtVersion::DebugBuild)) {
return QString::fromLocal8Bit("release-%1").arg(m_makeTargetBase);
}
}
return QString::fromLocal8Bit("debug-%1").arg(m_makeTargetBase);
}
bool RVCTToolChain::equals(ToolChain *other) const
{
return (other->type() == type()
&& m_deviceId == static_cast<RVCTToolChain *>(other)->m_deviceId
&& m_deviceName == static_cast<RVCTToolChain *>(other)->m_deviceName);
}
void RVCTToolChain::setProject(const ProjectExplorer::Project *project)
{
m_project = project;
}
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef RVCTTOOLCHAIN_H
#define RVCTTOOLCHAIN_H
#include "s60devices.h"
#include <projectexplorer/toolchain.h>
namespace Qt4ProjectManager {
namespace Internal {
class RVCTToolChain : public ProjectExplorer::ToolChain
{
public:
RVCTToolChain(S60Devices::Device device, ProjectExplorer::ToolChain::ToolChainType type,
const QString &makeTargetBase);
virtual QByteArray predefinedMacros();
QList<ProjectExplorer::HeaderPath> systemHeaderPaths();
void addToEnvironment(ProjectExplorer::Environment &env);
ProjectExplorer::ToolChain::ToolChainType type() const;
QString makeCommand() const;
QString defaultMakeTarget() const;
void setProject(const ProjectExplorer::Project *project);
protected:
bool equals(ToolChain *other) const;
private:
QString m_deviceId;
QString m_deviceName;
QString m_deviceRoot;
const ProjectExplorer::Project *m_project;
ProjectExplorer::ToolChain::ToolChainType m_type;
QString m_makeTargetBase;
QByteArray m_predefinedMacros;
QList<ProjectExplorer::HeaderPath> m_systemHeaderPaths;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // RVCTTOOLCHAIN_H
......@@ -82,7 +82,7 @@ bool S60DeviceRunConfiguration::isEnabled() const
Qt4Project *pro = qobject_cast<Qt4Project*>(project());
QTC_ASSERT(pro, return false);
ToolChain::ToolChainType type = pro->toolChainType(pro->activeBuildConfiguration());
return type == ToolChain::GCCE; //TODO || type == ToolChain::ARMV5
return type == ToolChain::GCCE || type == ToolChain::RVCT_ARMV5 || type == ToolChain::RVCT_ARMV6;
}
QWidget *S60DeviceRunConfiguration::configurationWidget()
......
......@@ -33,6 +33,7 @@
#include "s60devicespreferencepane.h"
#include "winscwtoolchain.h"
#include "gccetoolchain.h"
#include "rvcttoolchain.h"
#include "s60emulatorrunconfiguration.h"
#include "s60Devicerunconfiguration.h"
......@@ -156,6 +157,23 @@ ProjectExplorer::ToolChain *S60Manager::createGCCEToolChain(const Qt4ProjectMana
return new GCCEToolChain(deviceForQtVersion(version));
}
ProjectExplorer::ToolChain *S60Manager::createRVCTToolChain(const Qt4ProjectManager::QtVersion *version,
ProjectExplorer::ToolChain::ToolChainType type) const
{
QString makeTargetBase;
switch (type) {
case ProjectExplorer::ToolChain::RVCT_ARMV5:
makeTargetBase = "armv5";
break;
case ProjectExplorer::ToolChain::RVCT_ARMV6:
makeTargetBase = "armv6";
break;
default:
makeTargetBase = "InternalError";
}
return new RVCTToolChain(deviceForQtVersion(version), type, makeTargetBase);
}
S60Devices::Device S60Manager::deviceForQtVersion(const Qt4ProjectManager::QtVersion *version) const
{
S60Devices::Device device;
......
......@@ -58,6 +58,8 @@ public:
ProjectExplorer::ToolChain *createWINSCWToolChain(const Qt4ProjectManager::QtVersion *version) const;
ProjectExplorer::ToolChain *createGCCEToolChain(const Qt4ProjectManager::QtVersion *version) const;
ProjectExplorer::ToolChain *createRVCTToolChain(const Qt4ProjectManager::QtVersion *version,
ProjectExplorer::ToolChain::ToolChainType type) const;
S60Devices *devices() const { return m_devices; }
S60Devices::Device deviceForQtVersion(const Qt4ProjectManager::QtVersion *version) const;
......
......@@ -29,6 +29,8 @@
#include "winscwtoolchain.h"
#include <QtDebug>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager::Internal;
......@@ -64,30 +66,42 @@ QList<HeaderPath> WINSCWToolChain::systemHeaderPaths()
QStringList WINSCWToolChain::systemIncludes() const
{
QStringList symIncludes = QStringList()
<< "\\MSL\\MSL_C\\MSL_Common\\Include"
<< "\\MSL\\MSL_C\\MSL_Win32\\Include"
<< "\\MSL\\MSL_CMSL_X86"
<< "\\MSL\\MSL_C++\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Win32\\Include"
<< "\\Win32-x86 Support\\Headers\\Win32 SDK";
for (int i = 0; i < symIncludes.size(); ++i)
symIncludes[i].prepend(QString("%1\\x86Build\\Symbian_Support").arg(m_carbidePath));
return symIncludes;
if (m_carbidePath.isEmpty()) {
qDebug() << "no carbide path set";
ProjectExplorer::Environment env = ProjectExplorer::Environment::systemEnvironment();
QString symIncludesValue = env.value("MWCSYM2INCLUDES");
qDebug() << "includes:" << symIncludesValue.split(";");
if (!symIncludesValue.isEmpty())
return symIncludesValue.split(";");
} else {
QStringList symIncludes = QStringList()
<< "\\MSL\\MSL_C\\MSL_Common\\Include"
<< "\\MSL\\MSL_C\\MSL_Win32\\Include"
<< "\\MSL\\MSL_CMSL_X86"
<< "\\MSL\\MSL_C++\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Common\\Include"
<< "\\MSL\\MSL_Extras\\MSL_Win32\\Include"
<< "\\Win32-x86 Support\\Headers\\Win32 SDK";