Commit 94236391 authored by dt's avatar dt
Browse files

Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta

Conflicts:
	src/plugins/qt4projectmanager/qtversionmanager.cpp
parents 83d5461c f6fbb274
......@@ -1674,7 +1674,10 @@ static void qDumpQObjectSignal(QDumper &d)
d.beginHash();
P(d, "name", "[" << i << "] slot");
P(d, "type", "");
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
if (conn.receiver)
P(d, "value", conn.receiver->metaObject()->method(conn.method).signature());
else
P(d, "value", "<invalid receiver>");
P(d, "numchild", "0");
d.endHash();
d.beginHash();
......@@ -1861,17 +1864,25 @@ static void qDumpQSet(QDumper &d)
n = 100;
d << ",children=[";
int i = 0;
for (int bucket = 0; bucket != hd->numBuckets; ++bucket) {
for (int bucket = 0; bucket != hd->numBuckets && i <= 10000; ++bucket) {
for (node = hd->buckets[bucket]; node->next; node = node->next) {
d.beginHash();
P(d, "name", "[" << i << "]");
P(d, "type", d.innertype);
P(d, "exp", "(('QHashNode<" << d.innertype
<< ",QHashDummyValue>'*)"
P(d, "exp", "(('"NS"QHashNode<" << d.innertype
<< ","NS"QHashDummyValue>'*)"
<< static_cast<const void*>(node) << ")->key"
);
d.endHash();
++i;
if (i > 10000) {
d.beginHash();
P(d, "name", "Warning:");
P(d, "value", "<incomplete>");
P(d, "type", "");
d.endHash();
break;
}
}
}
d << "]";
......
......@@ -950,24 +950,23 @@
You can start Qt Creator from a command prompt with an existing session or
\c{.pro} file by giving the name as argument on the command line.
\bold{Sidebar}
\bold{Show and Hide the Sidebar}
You can hide/unhide the sidebar in the edit and debug mode
by clicking on the corresponding icon on the left bottom.
Keyboard shortcut is \key{Alt+0}.
You can show and hide the the sidebar in \gui Edit and \gui Debug mode by
clicking on the corresponding icon, or by pressing \key{Alt+0}.
\bold{Display signals and slots}
\bold{Display Signals and Slots}
If you have an instance of a class derived from QObject and
want to find all other objects connected to one of its
slots by Qt's signals-and-slots mechanism, enable
\gui{Debug} and \gui{Use Custom Display for Qt Objects}.
In the \gui{Locals and Watchers View}, expand the object's
entry and open the wanted slot in the "slots" subitem. The
objects connect to this slot are exposed as children of
this slot. The same works with signals.
If you have an instance of a class that is derived from QObject, and you
you would like to find all other objects connected to one of your object's
slots using Qt's signals and slots mechanism -- you can enable
\gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu.
\bold{Low level display}
In the \gui{Locals and Watchers} view, expand the object's entry and open
the slot in the \e slots subitem. The objects connected to this slot are
exposed as children of the slot. This method works with signals too.
\bold{Display Low Level Data}
If the special debugging of Qt objects fails due to data
corruption within the debugged objects, you can switch the
......@@ -983,33 +982,38 @@
\title Glossary
\bold{System Qt}
\target glossary-system-qt
The version of Qt installed on your system.
This is the one whose \c qmake command is found in the \c PATH.
\bold{Default Qt}
\target glossary-default-qt
The version of Qt configured in \gui{Tools
-> Options -> Qt 4 -> Default Qt Version}. This is the version
used by new projects. It defaults to the System Qt.
\table
\header
\o Term
\o Meaning
\bold{Project Qt}
\row
\o System Qt \target glossary-system-qt
\o The version of Qt installed on your system. This is the Qt
version for the \c qmake command found in your \c PATH.
\target glossary-project-qt
The version of Qt configured in \gui{Build&Run
-> Build Settings -> Build Configurations}. This is the version
actually used by the project. It defaults to the Default Qt.
\row
\o Default Qt \target glossary-default-qt
\o The version of Qt configured in \gui{Tools -> Options -> Qt 4
-> Default Qt Version}. This is the Qt version used by your
new projects. It defaults to System Qt.
\bold{Shadow Build}
\row
\o Project Qt \target glossary-project-qt
\o The version of Qt configured in \gui{Build&Run -> Build
Settings -> Build Configurations}. This is the Qt version that
is actually used by a particular project. It defaults to
Default Qt.
\target glossary-shadow-build
Shadow building means building the project not in the source directory,
but in a seperate \bold{build directory}. This has the benefit of keeping
the source directory clean. It is also considered "best practice" if
you need many build configurations for a single set of sources.
\row
\o Shadow Build \target glossary-shadow-build
\o Shadow building means building a project in a separate
directory, the \e{build directory}. The build directory is
different from the source directory. One of the benefits of
shadow building is that it keeps your source directory clean.
Shadow building is the best practice if you need many build
configurations for a single set of source.
\endtable
*/
......
......@@ -95,8 +95,10 @@ private:
QSortFilterProxyModel *proxyModel;
};
class TreeView : public QTreeView {
class TreeView : public QTreeView
{
Q_OBJECT
public:
TreeView(QWidget* parent = 0) : QTreeView(parent) {}
void subclassKeyPressEvent(QKeyEvent* event)
......@@ -159,18 +161,18 @@ class BookmarkManager : public QObject
Q_OBJECT
public:
BookmarkManager(QHelpEngineCore* helpEngine);
BookmarkManager(QHelpEngineCore *helpEngine);
~BookmarkManager();
BookmarkModel* treeBookmarkModel();
BookmarkModel* listBookmarkModel();
BookmarkModel *treeBookmarkModel();
BookmarkModel *listBookmarkModel();
void saveBookmarks();
QStringList bookmarkFolders() const;
QModelIndex addNewFolder(const QModelIndex& index);
QModelIndex addNewFolder(const QModelIndex &index);
void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index);
void showBookmarkDialog(QWidget* parent, const QString &name, const QString &url);
void addNewBookmark(const QModelIndex& index, const QString &name, const QString &url);
void showBookmarkDialog(QWidget *parent, const QString &name, const QString &url);
void addNewBookmark(const QModelIndex &index, const QString &name, const QString &url);
void setupBookmarkModels();
private slots:
......
......@@ -212,9 +212,9 @@ int main(int argc, char **argv)
pluginManager.setPluginPaths(pluginPaths);
const QStringList arguments = app.arguments();
QMap<QString,QString> foundAppOptions;
QMap<QString, QString> foundAppOptions;
if (arguments.size() > 1) {
QMap<QString,bool> appOptions;
QMap<QString, bool> appOptions;
appOptions.insert(QLatin1String(HELP_OPTION1), false);
appOptions.insert(QLatin1String(HELP_OPTION2), false);
appOptions.insert(QLatin1String(HELP_OPTION3), false);
......
......@@ -21,7 +21,16 @@ HEADERS += \
TypeOfExpression.h \
TypePrettyPrinter.h \
ResolveExpression.h \
LookupContext.h
LookupContext.h \
pp-cctype.h \
pp-engine.h \
pp-fwd.h \
pp-macro-expander.h \
pp-scanner.h \
pp-client.h \
pp-environment.h \
pp-internal.h \
pp-macro.h
SOURCES += \
SimpleLexer.cpp \
......@@ -35,6 +44,9 @@ SOURCES += \
TypeOfExpression.cpp \
TypePrettyPrinter.cpp \
ResolveExpression.cpp \
LookupContext.cpp
LookupContext.cpp \
pp-engine.cpp \
pp-environment.cpp \
pp-macro-expander.cpp
RESOURCES += cplusplus.qrc
......@@ -55,7 +55,7 @@
#include <cctype>
namespace rpp {
namespace CPlusPlus {
inline bool pp_isalpha (int __ch)
{ return std::isalpha ((unsigned char) __ch) != 0; }
......@@ -69,6 +69,6 @@ inline bool pp_isdigit (int __ch)
inline bool pp_isspace (int __ch)
{ return std::isspace ((unsigned char) __ch) != 0; }
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_CCTYPE_H
......@@ -38,7 +38,7 @@
#include <QString>
#include <QFile>
namespace rpp {
namespace CPlusPlus {
class Macro;
......@@ -74,6 +74,6 @@ public:
virtual void stopSkippingBlocks(unsigned offset) = 0;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_CLIENT_H
......@@ -57,7 +57,6 @@
#include <QtDebug>
#include <algorithm>
using namespace rpp;
using namespace CPlusPlus;
namespace {
......
......@@ -62,7 +62,7 @@ namespace CPlusPlus {
class Token;
}
namespace rpp {
namespace CPlusPlus {
struct Value
{
......@@ -200,7 +200,7 @@ namespace rpp {
Value evalExpression(TokenIterator firstToken,
TokenIterator lastToken,
const QByteArray &source) const;
const QByteArray &source) const;
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
......@@ -226,6 +226,6 @@ namespace rpp {
bool isQtReservedWord(const QByteArray &name) const;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_ENGINE_H
......@@ -54,7 +54,7 @@
#include "pp.h"
#include <cstring>
using namespace rpp;
using namespace CPlusPlus;
Environment::Environment ()
: currentLine(0),
......
......@@ -56,7 +56,7 @@
#include <QVector>
#include <QByteArray>
namespace rpp {
namespace CPlusPlus {
struct Macro;
......@@ -104,6 +104,6 @@ private:
int _hash_count;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_ENVIRONMENT_H
......@@ -55,7 +55,7 @@
#include <QByteArray>
namespace rpp {
namespace CPlusPlus {
namespace _PP_internal {
inline bool comment_p (const char *__first, const char *__last)
......@@ -73,6 +73,6 @@ inline bool comment_p (const char *__first, const char *__last)
}
} // _PP_internal
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_INTERNAL_H
......@@ -35,7 +35,7 @@
#include "pp-macro-expander.h"
#include <QDateTime>
using namespace rpp;
using namespace CPlusPlus;
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
: env(env), frame(frame),
......
......@@ -53,7 +53,7 @@
#ifndef PP_MACRO_EXPANDER_H
#define PP_MACRO_EXPANDER_H
namespace rpp {
namespace CPlusPlus {
struct pp_frame
{
......@@ -97,7 +97,7 @@ namespace rpp {
int generated_lines;
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_MACRO_EXPANDER_H
......@@ -56,7 +56,7 @@
#include <QByteArray>
#include <QVector>
namespace rpp {
namespace CPlusPlus {
struct Macro
{
......@@ -90,6 +90,6 @@ namespace rpp {
{ }
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_MACRO_H
......@@ -53,7 +53,7 @@
#ifndef PP_SCANNER_H
#define PP_SCANNER_H
namespace rpp {
namespace CPlusPlus {
struct pp_skip_blanks
{
......@@ -373,7 +373,7 @@ struct pp_skip_argument
}
};
} // namespace rpp
} // namespace CPlusPlus
#endif // PP_SCANNER_H
......
......@@ -48,40 +48,54 @@
namespace Core {
namespace Utils {
#ifdef Q_OS_OSX
/*static*/ const char * const PathChooser::browseButtonLabel = "Choose...";
#else
/*static*/ const char * const PathChooser::browseButtonLabel = "Browse...";
#endif
// ------------------ PathValidatingLineEdit
class PathValidatingLineEdit : public BaseValidatingLineEdit {
public:
explicit PathValidatingLineEdit(QWidget *parent = 0);
explicit PathValidatingLineEdit(PathChooser *chooser, QWidget *parent = 0);
protected:
virtual bool validate(const QString &value, QString *errorMessage) const;
private:
PathChooser *m_chooser;
};
PathValidatingLineEdit::PathValidatingLineEdit(QWidget *parent) :
BaseValidatingLineEdit(parent)
PathValidatingLineEdit::PathValidatingLineEdit(PathChooser *chooser, QWidget *parent) :
BaseValidatingLineEdit(parent),
m_chooser(chooser)
{
Q_ASSERT(chooser != NULL);
}
bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
{
return PathChooser::validatePath(value, errorMessage);
return m_chooser->validatePath(value, errorMessage);
}
// ------------------ PathChooserPrivate
struct PathChooserPrivate {
PathChooserPrivate();
PathChooserPrivate(PathChooser *chooser);
PathValidatingLineEdit *m_lineEdit;
PathChooser::Kind m_acceptingKind;
QString m_dialogTitleOverride;
};
PathChooserPrivate::PathChooserPrivate() :
m_lineEdit(new PathValidatingLineEdit)
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
m_lineEdit(new PathValidatingLineEdit(chooser)),
m_acceptingKind(PathChooser::Directory)
{
}
PathChooser::PathChooser(QWidget *parent) :
QWidget(parent),
m_d(new PathChooserPrivate)
m_d(new PathChooserPrivate(this))
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setContentsMargins(0, 0, 0, 0);
......@@ -90,11 +104,12 @@ PathChooser::PathChooser(QWidget *parent) :
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
m_d->m_lineEdit->setMinimumWidth(300);
m_d->m_lineEdit->setMinimumWidth(260);
hLayout->addWidget(m_d->m_lineEdit);
hLayout->setSizeConstraint(QLayout::SetMinimumSize);
QToolButton *browseButton = new QToolButton;
browseButton->setText(tr("..."));
browseButton->setText(tr(browseButtonLabel));
connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
hLayout->addWidget(browseButton);
......@@ -123,8 +138,28 @@ void PathChooser::slotBrowse()
QString predefined = path();
if (!predefined.isEmpty() && !QFileInfo(predefined).isDir())
predefined.clear();
// Prompt for a directory, delete trailing slashes unless it is "/", only
QString newPath = QFileDialog::getExistingDirectory(this, tr("Choose a path"), predefined);
// Prompt for a file/dir
QString dialogTitle;
QString newPath;
switch (m_d->m_acceptingKind) {
case PathChooser::Directory:
newPath = QFileDialog::getExistingDirectory(this,
makeDialogTitle(tr("Choose a directory")), predefined);
break;
case PathChooser::File: // fall through
case PathChooser::Command:
newPath = QFileDialog::getOpenFileName(this,
makeDialogTitle(tr("Choose a file")), predefined);
break;
default:
;
}
// TODO make cross-platform
// Delete trailing slashes unless it is "/", only
if (!newPath .isEmpty()) {
if (newPath .size() > 1 && newPath .endsWith(QDir::separator()))
newPath .truncate(newPath .size() - 1);
......@@ -149,20 +184,52 @@ bool PathChooser::validatePath(const QString &path, QString *errorMessage)
*errorMessage = tr("The path must not be empty.");
return false;
}
// Must be a directory?
const QFileInfo fi(path);
if (fi.isDir())
return true; // Happy!
const bool isDir = fi.isDir();
if (!fi.exists()) {
if (errorMessage)
*errorMessage = tr("The path '%1' does not exist.").arg(path);
return false;
// Check if existing
switch (m_d->m_acceptingKind) {
case PathChooser::Directory: // fall through
case PathChooser::File:
if (!fi.exists()) {
if (errorMessage)
*errorMessage = tr("The path '%1' does not exist.").arg(path);
return false;
}
break;
case PathChooser::Command: // fall through
default:
;
}
// Check expected kind
switch (m_d->m_acceptingKind) {
case PathChooser::Directory:
if (!isDir)
if (errorMessage)
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
return false;
break;
case PathChooser::File:
if (isDir)
if (errorMessage)
*errorMessage = tr("The path '%1' is not a file.").arg(path);
return false;
break;
case PathChooser::Command:
// TODO do proper command validation
// i.e. search $PATH for a matching file
break;
default:
;
}
// Must be something weird
if (errorMessage)
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
return false;
return true;
}
QString PathChooser::label()
......@@ -182,5 +249,23 @@ QString PathChooser::homePath()
#endif
}
void PathChooser::setExpectedKind(Kind expected)
{
m_d->m_acceptingKind = expected;
}
void PathChooser::setPromptDialogTitle(const QString &title)
{
m_d->m_dialogTitleOverride = title;
}
QString PathChooser::makeDialogTitle(const QString &title)
{
if (m_d->m_dialogTitleOverride.isNull())
return title;
else
return m_d->m_dialogTitleOverride;
}
} // namespace Utils
} // namespace Core
......@@ -54,9 +54,23 @@ class QWORKBENCH_UTILS_EXPORT PathChooser : public QWidget
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
public:
static const char * const browseButtonLabel;
explicit PathChooser(QWidget *parent = 0);
virtual ~PathChooser();
enum Kind {
Directory,
File,
Command,
// ,Any
};
// Default is <Directory>
void setExpectedKind(Kind expected);