forked from qt-creator/qt-creator
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
This commit is contained in:
@@ -1674,7 +1674,10 @@ static void qDumpQObjectSignal(QDumper &d)
|
|||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "] slot");
|
P(d, "name", "[" << i << "] slot");
|
||||||
P(d, "type", "");
|
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");
|
P(d, "numchild", "0");
|
||||||
d.endHash();
|
d.endHash();
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
@@ -1861,17 +1864,25 @@ static void qDumpQSet(QDumper &d)
|
|||||||
n = 100;
|
n = 100;
|
||||||
d << ",children=[";
|
d << ",children=[";
|
||||||
int i = 0;
|
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) {
|
for (node = hd->buckets[bucket]; node->next; node = node->next) {
|
||||||
d.beginHash();
|
d.beginHash();
|
||||||
P(d, "name", "[" << i << "]");
|
P(d, "name", "[" << i << "]");
|
||||||
P(d, "type", d.innertype);
|
P(d, "type", d.innertype);
|
||||||
P(d, "exp", "(('QHashNode<" << d.innertype
|
P(d, "exp", "(('"NS"QHashNode<" << d.innertype
|
||||||
<< ",QHashDummyValue>'*)"
|
<< ","NS"QHashDummyValue>'*)"
|
||||||
<< static_cast<const void*>(node) << ")->key"
|
<< static_cast<const void*>(node) << ")->key"
|
||||||
);
|
);
|
||||||
d.endHash();
|
d.endHash();
|
||||||
++i;
|
++i;
|
||||||
|
if (i > 10000) {
|
||||||
|
d.beginHash();
|
||||||
|
P(d, "name", "Warning:");
|
||||||
|
P(d, "value", "<incomplete>");
|
||||||
|
P(d, "type", "");
|
||||||
|
d.endHash();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d << "]";
|
d << "]";
|
||||||
|
@@ -950,24 +950,23 @@
|
|||||||
You can start Qt Creator from a command prompt with an existing session or
|
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.
|
\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
|
You can show and hide the the sidebar in \gui Edit and \gui Debug mode by
|
||||||
by clicking on the corresponding icon on the left bottom.
|
clicking on the corresponding icon, or by pressing \key{Alt+0}.
|
||||||
Keyboard shortcut is \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
|
If you have an instance of a class that is derived from QObject, and you
|
||||||
want to find all other objects connected to one of its
|
you would like to find all other objects connected to one of your object's
|
||||||
slots by Qt's signals-and-slots mechanism, enable
|
slots using Qt's signals and slots mechanism -- you can enable
|
||||||
\gui{Debug} and \gui{Use Custom Display for Qt Objects}.
|
\gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu.
|
||||||
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.
|
|
||||||
|
|
||||||
\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
|
If the special debugging of Qt objects fails due to data
|
||||||
corruption within the debugged objects, you can switch the
|
corruption within the debugged objects, you can switch the
|
||||||
@@ -983,33 +982,38 @@
|
|||||||
|
|
||||||
\title Glossary
|
\title Glossary
|
||||||
|
|
||||||
\bold{System Qt}
|
\table
|
||||||
|
\header
|
||||||
|
\o Term
|
||||||
|
\o Meaning
|
||||||
|
|
||||||
\target glossary-system-qt
|
\row
|
||||||
The version of Qt installed on your system.
|
\o System Qt \target glossary-system-qt
|
||||||
This is the one whose \c qmake command is found in the \c PATH.
|
\o The version of Qt installed on your system. This is the Qt
|
||||||
|
version for the \c qmake command found in your \c PATH.
|
||||||
|
|
||||||
\bold{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.
|
||||||
|
|
||||||
\target glossary-default-qt
|
\row
|
||||||
The version of Qt configured in \gui{Tools
|
\o Project Qt \target glossary-project-qt
|
||||||
-> Options -> Qt 4 -> Default Qt Version}. This is the version
|
\o The version of Qt configured in \gui{Build&Run -> Build
|
||||||
used by new projects. It defaults to the System Qt.
|
Settings -> Build Configurations}. This is the Qt version that
|
||||||
|
is actually used by a particular project. It defaults to
|
||||||
|
Default Qt.
|
||||||
|
|
||||||
\bold{Project Qt}
|
\row
|
||||||
|
\o Shadow Build \target glossary-shadow-build
|
||||||
\target glossary-project-qt
|
\o Shadow building means building a project in a separate
|
||||||
The version of Qt configured in \gui{Build&Run
|
directory, the \e{build directory}. The build directory is
|
||||||
-> Build Settings -> Build Configurations}. This is the version
|
different from the source directory. One of the benefits of
|
||||||
actually used by the project. It defaults to the Default Qt.
|
shadow building is that it keeps your source directory clean.
|
||||||
|
Shadow building is the best practice if you need many build
|
||||||
\bold{Shadow Build}
|
configurations for a single set of source.
|
||||||
|
\endtable
|
||||||
\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.
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@@ -95,8 +95,10 @@ private:
|
|||||||
QSortFilterProxyModel *proxyModel;
|
QSortFilterProxyModel *proxyModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TreeView : public QTreeView {
|
class TreeView : public QTreeView
|
||||||
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TreeView(QWidget* parent = 0) : QTreeView(parent) {}
|
TreeView(QWidget* parent = 0) : QTreeView(parent) {}
|
||||||
void subclassKeyPressEvent(QKeyEvent* event)
|
void subclassKeyPressEvent(QKeyEvent* event)
|
||||||
@@ -159,18 +161,18 @@ class BookmarkManager : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BookmarkManager(QHelpEngineCore* helpEngine);
|
BookmarkManager(QHelpEngineCore *helpEngine);
|
||||||
~BookmarkManager();
|
~BookmarkManager();
|
||||||
|
|
||||||
BookmarkModel* treeBookmarkModel();
|
BookmarkModel *treeBookmarkModel();
|
||||||
BookmarkModel* listBookmarkModel();
|
BookmarkModel *listBookmarkModel();
|
||||||
|
|
||||||
void saveBookmarks();
|
void saveBookmarks();
|
||||||
QStringList bookmarkFolders() const;
|
QStringList bookmarkFolders() const;
|
||||||
QModelIndex addNewFolder(const QModelIndex& index);
|
QModelIndex addNewFolder(const QModelIndex &index);
|
||||||
void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index);
|
void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index);
|
||||||
void showBookmarkDialog(QWidget* parent, 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 addNewBookmark(const QModelIndex &index, const QString &name, const QString &url);
|
||||||
void setupBookmarkModels();
|
void setupBookmarkModels();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
@@ -212,9 +212,9 @@ int main(int argc, char **argv)
|
|||||||
pluginManager.setPluginPaths(pluginPaths);
|
pluginManager.setPluginPaths(pluginPaths);
|
||||||
|
|
||||||
const QStringList arguments = app.arguments();
|
const QStringList arguments = app.arguments();
|
||||||
QMap<QString,QString> foundAppOptions;
|
QMap<QString, QString> foundAppOptions;
|
||||||
if (arguments.size() > 1) {
|
if (arguments.size() > 1) {
|
||||||
QMap<QString,bool> appOptions;
|
QMap<QString, bool> appOptions;
|
||||||
appOptions.insert(QLatin1String(HELP_OPTION1), false);
|
appOptions.insert(QLatin1String(HELP_OPTION1), false);
|
||||||
appOptions.insert(QLatin1String(HELP_OPTION2), false);
|
appOptions.insert(QLatin1String(HELP_OPTION2), false);
|
||||||
appOptions.insert(QLatin1String(HELP_OPTION3), false);
|
appOptions.insert(QLatin1String(HELP_OPTION3), false);
|
||||||
|
@@ -21,7 +21,16 @@ HEADERS += \
|
|||||||
TypeOfExpression.h \
|
TypeOfExpression.h \
|
||||||
TypePrettyPrinter.h \
|
TypePrettyPrinter.h \
|
||||||
ResolveExpression.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 += \
|
SOURCES += \
|
||||||
SimpleLexer.cpp \
|
SimpleLexer.cpp \
|
||||||
@@ -35,6 +44,9 @@ SOURCES += \
|
|||||||
TypeOfExpression.cpp \
|
TypeOfExpression.cpp \
|
||||||
TypePrettyPrinter.cpp \
|
TypePrettyPrinter.cpp \
|
||||||
ResolveExpression.cpp \
|
ResolveExpression.cpp \
|
||||||
LookupContext.cpp
|
LookupContext.cpp \
|
||||||
|
pp-engine.cpp \
|
||||||
|
pp-environment.cpp \
|
||||||
|
pp-macro-expander.cpp
|
||||||
|
|
||||||
RESOURCES += cplusplus.qrc
|
RESOURCES += cplusplus.qrc
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
inline bool pp_isalpha (int __ch)
|
inline bool pp_isalpha (int __ch)
|
||||||
{ return std::isalpha ((unsigned char) __ch) != 0; }
|
{ return std::isalpha ((unsigned char) __ch) != 0; }
|
||||||
@@ -69,6 +69,6 @@ inline bool pp_isdigit (int __ch)
|
|||||||
inline bool pp_isspace (int __ch)
|
inline bool pp_isspace (int __ch)
|
||||||
{ return std::isspace ((unsigned char) __ch) != 0; }
|
{ return std::isspace ((unsigned char) __ch) != 0; }
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_CCTYPE_H
|
#endif // PP_CCTYPE_H
|
@@ -38,7 +38,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
class Macro;
|
class Macro;
|
||||||
|
|
||||||
@@ -74,6 +74,6 @@ public:
|
|||||||
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_CLIENT_H
|
#endif // PP_CLIENT_H
|
@@ -57,7 +57,6 @@
|
|||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace rpp;
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
@@ -62,7 +62,7 @@ namespace CPlusPlus {
|
|||||||
class Token;
|
class Token;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Value
|
struct Value
|
||||||
{
|
{
|
||||||
@@ -200,7 +200,7 @@ namespace rpp {
|
|||||||
|
|
||||||
Value evalExpression(TokenIterator firstToken,
|
Value evalExpression(TokenIterator firstToken,
|
||||||
TokenIterator lastToken,
|
TokenIterator lastToken,
|
||||||
const QByteArray &source) const;
|
const QByteArray &source) const;
|
||||||
|
|
||||||
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
|
QVector<CPlusPlus::Token> tokenize(const QByteArray &text) const;
|
||||||
|
|
||||||
@@ -226,6 +226,6 @@ namespace rpp {
|
|||||||
bool isQtReservedWord(const QByteArray &name) const;
|
bool isQtReservedWord(const QByteArray &name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_ENGINE_H
|
#endif // PP_ENGINE_H
|
@@ -54,7 +54,7 @@
|
|||||||
#include "pp.h"
|
#include "pp.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace rpp;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
Environment::Environment ()
|
Environment::Environment ()
|
||||||
: currentLine(0),
|
: currentLine(0),
|
@@ -56,7 +56,7 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Macro;
|
struct Macro;
|
||||||
|
|
||||||
@@ -104,6 +104,6 @@ private:
|
|||||||
int _hash_count;
|
int _hash_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_ENVIRONMENT_H
|
#endif // PP_ENVIRONMENT_H
|
0
src/libs/cplusplus/pp-fwd.h
Normal file
0
src/libs/cplusplus/pp-fwd.h
Normal file
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
namespace _PP_internal {
|
namespace _PP_internal {
|
||||||
|
|
||||||
inline bool comment_p (const char *__first, const char *__last)
|
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
|
} // _PP_internal
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_INTERNAL_H
|
#endif // PP_INTERNAL_H
|
@@ -35,7 +35,7 @@
|
|||||||
#include "pp-macro-expander.h"
|
#include "pp-macro-expander.h"
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
using namespace rpp;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
|
MacroExpander::MacroExpander (Environment &env, pp_frame *frame)
|
||||||
: env(env), frame(frame),
|
: env(env), frame(frame),
|
@@ -53,7 +53,7 @@
|
|||||||
#ifndef PP_MACRO_EXPANDER_H
|
#ifndef PP_MACRO_EXPANDER_H
|
||||||
#define PP_MACRO_EXPANDER_H
|
#define PP_MACRO_EXPANDER_H
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct pp_frame
|
struct pp_frame
|
||||||
{
|
{
|
||||||
@@ -97,7 +97,7 @@ namespace rpp {
|
|||||||
int generated_lines;
|
int generated_lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_MACRO_EXPANDER_H
|
#endif // PP_MACRO_EXPANDER_H
|
||||||
|
|
@@ -56,7 +56,7 @@
|
|||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct Macro
|
struct Macro
|
||||||
{
|
{
|
||||||
@@ -90,6 +90,6 @@ namespace rpp {
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_MACRO_H
|
#endif // PP_MACRO_H
|
@@ -53,7 +53,7 @@
|
|||||||
#ifndef PP_SCANNER_H
|
#ifndef PP_SCANNER_H
|
||||||
#define PP_SCANNER_H
|
#define PP_SCANNER_H
|
||||||
|
|
||||||
namespace rpp {
|
namespace CPlusPlus {
|
||||||
|
|
||||||
struct pp_skip_blanks
|
struct pp_skip_blanks
|
||||||
{
|
{
|
||||||
@@ -373,7 +373,7 @@ struct pp_skip_argument
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace rpp
|
} // namespace CPlusPlus
|
||||||
|
|
||||||
#endif // PP_SCANNER_H
|
#endif // PP_SCANNER_H
|
||||||
|
|
@@ -48,40 +48,54 @@
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
|
|
||||||
|
#ifdef Q_OS_OSX
|
||||||
|
/*static*/ const char * const PathChooser::browseButtonLabel = "Choose...";
|
||||||
|
#else
|
||||||
|
/*static*/ const char * const PathChooser::browseButtonLabel = "Browse...";
|
||||||
|
#endif
|
||||||
|
|
||||||
// ------------------ PathValidatingLineEdit
|
// ------------------ PathValidatingLineEdit
|
||||||
class PathValidatingLineEdit : public BaseValidatingLineEdit {
|
class PathValidatingLineEdit : public BaseValidatingLineEdit {
|
||||||
public:
|
public:
|
||||||
explicit PathValidatingLineEdit(QWidget *parent = 0);
|
explicit PathValidatingLineEdit(PathChooser *chooser, QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool validate(const QString &value, QString *errorMessage) const;
|
virtual bool validate(const QString &value, QString *errorMessage) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
PathChooser *m_chooser;
|
||||||
};
|
};
|
||||||
|
|
||||||
PathValidatingLineEdit::PathValidatingLineEdit(QWidget *parent) :
|
PathValidatingLineEdit::PathValidatingLineEdit(PathChooser *chooser, QWidget *parent) :
|
||||||
BaseValidatingLineEdit(parent)
|
BaseValidatingLineEdit(parent),
|
||||||
|
m_chooser(chooser)
|
||||||
{
|
{
|
||||||
|
Q_ASSERT(chooser != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
|
bool PathValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
|
||||||
{
|
{
|
||||||
return PathChooser::validatePath(value, errorMessage);
|
return m_chooser->validatePath(value, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------ PathChooserPrivate
|
// ------------------ PathChooserPrivate
|
||||||
struct PathChooserPrivate {
|
struct PathChooserPrivate {
|
||||||
PathChooserPrivate();
|
PathChooserPrivate(PathChooser *chooser);
|
||||||
|
|
||||||
PathValidatingLineEdit *m_lineEdit;
|
PathValidatingLineEdit *m_lineEdit;
|
||||||
|
PathChooser::Kind m_acceptingKind;
|
||||||
|
QString m_dialogTitleOverride;
|
||||||
};
|
};
|
||||||
|
|
||||||
PathChooserPrivate::PathChooserPrivate() :
|
PathChooserPrivate::PathChooserPrivate(PathChooser *chooser) :
|
||||||
m_lineEdit(new PathValidatingLineEdit)
|
m_lineEdit(new PathValidatingLineEdit(chooser)),
|
||||||
|
m_acceptingKind(PathChooser::Directory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PathChooser::PathChooser(QWidget *parent) :
|
PathChooser::PathChooser(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_d(new PathChooserPrivate)
|
m_d(new PathChooserPrivate(this))
|
||||||
{
|
{
|
||||||
QHBoxLayout *hLayout = new QHBoxLayout;
|
QHBoxLayout *hLayout = new QHBoxLayout;
|
||||||
hLayout->setContentsMargins(0, 0, 0, 0);
|
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(textChanged(QString)), this, SIGNAL(changed()));
|
||||||
connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
|
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->addWidget(m_d->m_lineEdit);
|
||||||
|
hLayout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||||
|
|
||||||
QToolButton *browseButton = new QToolButton;
|
QToolButton *browseButton = new QToolButton;
|
||||||
browseButton->setText(tr("..."));
|
browseButton->setText(tr(browseButtonLabel));
|
||||||
connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
|
connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));
|
||||||
|
|
||||||
hLayout->addWidget(browseButton);
|
hLayout->addWidget(browseButton);
|
||||||
@@ -123,8 +138,28 @@ void PathChooser::slotBrowse()
|
|||||||
QString predefined = path();
|
QString predefined = path();
|
||||||
if (!predefined.isEmpty() && !QFileInfo(predefined).isDir())
|
if (!predefined.isEmpty() && !QFileInfo(predefined).isDir())
|
||||||
predefined.clear();
|
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 .isEmpty()) {
|
||||||
if (newPath .size() > 1 && newPath .endsWith(QDir::separator()))
|
if (newPath .size() > 1 && newPath .endsWith(QDir::separator()))
|
||||||
newPath .truncate(newPath .size() - 1);
|
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.");
|
*errorMessage = tr("The path must not be empty.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Must be a directory?
|
|
||||||
const QFileInfo fi(path);
|
|
||||||
if (fi.isDir())
|
|
||||||
return true; // Happy!
|
|
||||||
|
|
||||||
if (!fi.exists()) {
|
const QFileInfo fi(path);
|
||||||
if (errorMessage)
|
const bool isDir = fi.isDir();
|
||||||
*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:
|
||||||
|
;
|
||||||
}
|
}
|
||||||
// Must be something weird
|
|
||||||
if (errorMessage)
|
// Check expected kind
|
||||||
*errorMessage = tr("The path '%1' is not a directory.").arg(path);
|
switch (m_d->m_acceptingKind) {
|
||||||
return false;
|
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:
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PathChooser::label()
|
QString PathChooser::label()
|
||||||
@@ -182,5 +249,23 @@ QString PathChooser::homePath()
|
|||||||
#endif
|
#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 Utils
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
@@ -54,9 +54,23 @@ class QWORKBENCH_UTILS_EXPORT PathChooser : public QWidget
|
|||||||
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
static const char * const browseButtonLabel;
|
||||||
|
|
||||||
explicit PathChooser(QWidget *parent = 0);
|
explicit PathChooser(QWidget *parent = 0);
|
||||||
virtual ~PathChooser();
|
virtual ~PathChooser();
|
||||||
|
|
||||||
|
enum Kind {
|
||||||
|
Directory,
|
||||||
|
File,
|
||||||
|
Command,
|
||||||
|
// ,Any
|
||||||
|
};
|
||||||
|
|
||||||
|
// Default is <Directory>
|
||||||
|
void setExpectedKind(Kind expected);
|
||||||
|
|
||||||
|
void setPromptDialogTitle(const QString &title);
|
||||||
|
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
QString errorMessage() const;
|
QString errorMessage() const;
|
||||||
|
|
||||||
@@ -65,11 +79,15 @@ public:
|
|||||||
// Returns the suggested label title when used in a form layout
|
// Returns the suggested label title when used in a form layout
|
||||||
static QString label();
|
static QString label();
|
||||||
|
|
||||||
static bool validatePath(const QString &path, QString *errorMessage = 0);
|
bool validatePath(const QString &path, QString *errorMessage = 0);
|
||||||
|
|
||||||
// Return the home directory, which needs some fixing under Windows.
|
// Return the home directory, which needs some fixing under Windows.
|
||||||
static QString homePath();
|
static QString homePath();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Returns overridden title or the one from <title>
|
||||||
|
QString makeDialogTitle(const QString &title);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void validChanged();
|
void validChanged();
|
||||||
void changed();
|
void changed();
|
||||||
|
@@ -396,11 +396,16 @@ void BookmarkManager::toggleBookmark()
|
|||||||
if (!editor)
|
if (!editor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const QFileInfo fi(editor->file()->fileName());
|
toggleBookmark(editor->file()->fileName(), editor->currentLine());
|
||||||
const int editorLine = editor->currentLine();
|
}
|
||||||
|
|
||||||
|
void BookmarkManager::toggleBookmark(const QString &fileName, int lineNumber)
|
||||||
|
{
|
||||||
|
const QFileInfo fi(fileName);
|
||||||
|
const int editorLine = lineNumber;
|
||||||
|
|
||||||
// Remove any existing bookmark on this line
|
// Remove any existing bookmark on this line
|
||||||
if (Bookmark *mark = findBookmark(fi.path(), fi.fileName(), editorLine)) {
|
if (Bookmark *mark = findBookmark(fi.path(), fi.fileName(), lineNumber)) {
|
||||||
// TODO check if the bookmark is really on the same markable Interface
|
// TODO check if the bookmark is really on the same markable Interface
|
||||||
removeBookmark(mark);
|
removeBookmark(mark);
|
||||||
return;
|
return;
|
||||||
|
@@ -34,15 +34,15 @@
|
|||||||
#ifndef BOOKMARKMANAGER_H
|
#ifndef BOOKMARKMANAGER_H
|
||||||
#define BOOKMARKMANAGER_H
|
#define BOOKMARKMANAGER_H
|
||||||
|
|
||||||
#include <QtCore/QAbstractItemModel>
|
|
||||||
#include <QtGui/QListView>
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtGui/QPixmap>
|
|
||||||
#include <QtGui/QStyledItemDelegate>
|
|
||||||
|
|
||||||
#include <coreplugin/icontext.h>
|
#include <coreplugin/icontext.h>
|
||||||
#include <coreplugin/inavigationwidgetfactory.h>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
|
|
||||||
|
#include <QtCore/QAbstractItemModel>
|
||||||
|
#include <QtCore/QList>
|
||||||
|
#include <QtGui/QListView>
|
||||||
|
#include <QtGui/QPixmap>
|
||||||
|
#include <QtGui/QStyledItemDelegate>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class SessionManager;
|
class SessionManager;
|
||||||
}
|
}
|
||||||
@@ -89,10 +89,16 @@ public:
|
|||||||
// this QItemSelectionModel is shared by all views
|
// this QItemSelectionModel is shared by all views
|
||||||
QItemSelectionModel *selectionModel() const;
|
QItemSelectionModel *selectionModel() const;
|
||||||
|
|
||||||
enum Roles {Filename = Qt::UserRole, LineNumber = Qt::UserRole + 1, Directory = Qt::UserRole + 2, LineText = Qt::UserRole + 3};
|
enum Roles {
|
||||||
|
Filename = Qt::UserRole,
|
||||||
|
LineNumber = Qt::UserRole + 1,
|
||||||
|
Directory = Qt::UserRole + 2,
|
||||||
|
LineText = Qt::UserRole + 3
|
||||||
|
};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void toggleBookmark();
|
void toggleBookmark();
|
||||||
|
void toggleBookmark(const QString &fileName, int lineNumber);
|
||||||
void nextInDocument();
|
void nextInDocument();
|
||||||
void prevInDocument();
|
void prevInDocument();
|
||||||
void next();
|
void next();
|
||||||
@@ -108,6 +114,7 @@ private slots:
|
|||||||
void updateActionStatus();
|
void updateActionStatus();
|
||||||
void gotoBookmark(Bookmark *bookmark);
|
void gotoBookmark(Bookmark *bookmark);
|
||||||
void loadBookmarks();
|
void loadBookmarks();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::ITextEditor *currentTextEditor() const;
|
TextEditor::ITextEditor *currentTextEditor() const;
|
||||||
ProjectExplorer::SessionManager* sessionManager() const;
|
ProjectExplorer::SessionManager* sessionManager() const;
|
||||||
@@ -120,8 +127,8 @@ private:
|
|||||||
static QString bookmarkToString(const Bookmark *b);
|
static QString bookmarkToString(const Bookmark *b);
|
||||||
void saveBookmarks();
|
void saveBookmarks();
|
||||||
|
|
||||||
typedef QMultiMap<QString, Bookmark*> FileNameBookmarksMap;
|
typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap;
|
||||||
typedef QMap<QString, FileNameBookmarksMap*> DirectoryFileBookmarksMap;
|
typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap;
|
||||||
|
|
||||||
DirectoryFileBookmarksMap m_bookmarksMap;
|
DirectoryFileBookmarksMap m_bookmarksMap;
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
@@ -138,7 +145,7 @@ class BookmarkView : public QListView
|
|||||||
public:
|
public:
|
||||||
BookmarkView(QWidget *parent = 0);
|
BookmarkView(QWidget *parent = 0);
|
||||||
~BookmarkView();
|
~BookmarkView();
|
||||||
void setModel(QAbstractItemModel * model);
|
void setModel(QAbstractItemModel *model);
|
||||||
public slots:
|
public slots:
|
||||||
void gotoBookmark(const QModelIndex &index);
|
void gotoBookmark(const QModelIndex &index);
|
||||||
protected slots:
|
protected slots:
|
||||||
@@ -146,7 +153,7 @@ protected slots:
|
|||||||
void removeAll();
|
void removeAll();
|
||||||
protected:
|
protected:
|
||||||
void contextMenuEvent(QContextMenuEvent *event);
|
void contextMenuEvent(QContextMenuEvent *event);
|
||||||
void removeBookmark(const QModelIndex& index);
|
void removeBookmark(const QModelIndex &index);
|
||||||
private:
|
private:
|
||||||
BookmarkContext *m_bookmarkContext;
|
BookmarkContext *m_bookmarkContext;
|
||||||
QModelIndex m_contextMenuIndex;
|
QModelIndex m_contextMenuIndex;
|
||||||
|
@@ -36,17 +36,22 @@
|
|||||||
#include "bookmarks_global.h"
|
#include "bookmarks_global.h"
|
||||||
|
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
#include <texteditor/itexteditor.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/editormanager/ieditor.h>
|
||||||
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||||
|
|
||||||
#include <QtCore/qplugin.h>
|
#include <QtCore/qplugin.h>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
using namespace Bookmarks::Constants;
|
using namespace Bookmarks::Constants;
|
||||||
using namespace Bookmarks::Internal;
|
using namespace Bookmarks::Internal;
|
||||||
|
using namespace TextEditor;
|
||||||
|
|
||||||
BookmarksPlugin *BookmarksPlugin::m_instance = 0;
|
BookmarksPlugin *BookmarksPlugin::m_instance = 0;
|
||||||
|
|
||||||
@@ -159,6 +164,19 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
|||||||
updateActions(m_bookmarkManager->state());
|
updateActions(m_bookmarkManager->state());
|
||||||
addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager));
|
addAutoReleasedObject(new BookmarkViewFactory(m_bookmarkManager));
|
||||||
|
|
||||||
|
m_bookmarkMarginAction = new QAction(this);
|
||||||
|
m_bookmarkMarginAction->setText("Toggle Bookmark");
|
||||||
|
//m_bookmarkAction->setIcon(QIcon(":/gdbdebugger/images/breakpoint.svg"));
|
||||||
|
connect(m_bookmarkMarginAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(bookmarkMarginActionTriggered()));
|
||||||
|
|
||||||
|
// EditorManager
|
||||||
|
QObject *editorManager = m_core->editorManager();
|
||||||
|
connect(editorManager, SIGNAL(editorAboutToClose(Core::IEditor*)),
|
||||||
|
this, SLOT(editorAboutToClose(Core::IEditor*)));
|
||||||
|
connect(editorManager, SIGNAL(editorOpened(Core::IEditor*)),
|
||||||
|
this, SLOT(editorOpened(Core::IEditor*)));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,7 +187,6 @@ BookmarksPlugin::~BookmarksPlugin()
|
|||||||
|
|
||||||
void BookmarksPlugin::updateActions(int state)
|
void BookmarksPlugin::updateActions(int state)
|
||||||
{
|
{
|
||||||
|
|
||||||
const bool hasbm = state >= BookmarkManager::HasBookMarks;
|
const bool hasbm = state >= BookmarkManager::HasBookMarks;
|
||||||
const bool hasdocbm = state == BookmarkManager::HasBookmarksInDocument;
|
const bool hasdocbm = state == BookmarkManager::HasBookmarksInDocument;
|
||||||
|
|
||||||
@@ -182,4 +199,32 @@ void BookmarksPlugin::updateActions(int state)
|
|||||||
m_moveDownAction->setEnabled(hasbm);
|
m_moveDownAction->setEnabled(hasbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarksPlugin::editorOpened(Core::IEditor *editor)
|
||||||
|
{
|
||||||
|
connect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||||
|
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarksPlugin::editorAboutToClose(Core::IEditor *editor)
|
||||||
|
{
|
||||||
|
disconnect(editor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||||
|
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarksPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
|
||||||
|
int lineNumber, QMenu *menu)
|
||||||
|
{
|
||||||
|
m_bookmarkMarginActionLineNumber = lineNumber;
|
||||||
|
m_bookmarkMarginActionFileName = editor->file()->fileName();
|
||||||
|
menu->addAction(m_bookmarkMarginAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarksPlugin::bookmarkMarginActionTriggered()
|
||||||
|
{
|
||||||
|
m_bookmarkManager->toggleBookmark(
|
||||||
|
m_bookmarkMarginActionFileName,
|
||||||
|
m_bookmarkMarginActionLineNumber
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN(BookmarksPlugin)
|
Q_EXPORT_PLUGIN(BookmarksPlugin)
|
||||||
|
@@ -31,18 +31,26 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef BOOKMARKS_H
|
#ifndef BOOKMARKSPLUGIN_H
|
||||||
#define BOOKMARKS_H
|
#define BOOKMARKSPLUGIN_H
|
||||||
|
|
||||||
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QMultiMap>
|
#include <QtCore/QMultiMap>
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QAction;
|
||||||
QT_FORWARD_DECLARE_CLASS(QAction)
|
class QMenu;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ICore;
|
class ICore;
|
||||||
|
class IEditor;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
class ITextEditor;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Bookmarks {
|
namespace Bookmarks {
|
||||||
@@ -67,6 +75,13 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
void updateActions(int stateMask);
|
void updateActions(int stateMask);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void editorOpened(Core::IEditor *editor);
|
||||||
|
void editorAboutToClose(Core::IEditor *editor);
|
||||||
|
void requestContextMenu(TextEditor::ITextEditor *editor,
|
||||||
|
int lineNumber, QMenu *menu);
|
||||||
|
void bookmarkMarginActionTriggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static BookmarksPlugin *m_instance;
|
static BookmarksPlugin *m_instance;
|
||||||
BookmarkManager *m_bookmarkManager;
|
BookmarkManager *m_bookmarkManager;
|
||||||
@@ -79,6 +94,10 @@ private:
|
|||||||
QAction *m_docNextAction;
|
QAction *m_docNextAction;
|
||||||
QAction *m_moveUpAction;
|
QAction *m_moveUpAction;
|
||||||
QAction *m_moveDownAction;
|
QAction *m_moveDownAction;
|
||||||
|
|
||||||
|
QAction *m_bookmarkMarginAction;
|
||||||
|
int m_bookmarkMarginActionLineNumber;
|
||||||
|
QString m_bookmarkMarginActionFileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -64,11 +64,12 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
|
|
||||||
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||||
if (modelmanager) {
|
if (modelmanager) {
|
||||||
CppTools::CppModelManagerInterface::ProjectInfo *pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
pinfo->includePaths = cbpparser.includeFiles();
|
pinfo.includePaths = cbpparser.includeFiles();
|
||||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||||
pinfo->sourceFiles = m_files;
|
pinfo.sourceFiles = m_files;
|
||||||
// TODO defines
|
// TODO defines
|
||||||
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO report error
|
// TODO report error
|
||||||
|
@@ -100,4 +100,4 @@ signals:
|
|||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
#endif //IEDITOR_H
|
#endif // IEDITOR_H
|
||||||
|
@@ -63,7 +63,7 @@ ViewManager::ViewManager(MainWindow *mainWnd) :
|
|||||||
ViewManagerInterface(mainWnd),
|
ViewManagerInterface(mainWnd),
|
||||||
m_mainWnd(mainWnd)
|
m_mainWnd(mainWnd)
|
||||||
{
|
{
|
||||||
for(int i = 0; i< 3; ++i) {
|
for (int i = 0; i < 3; ++i) {
|
||||||
QWidget *w = new QWidget();
|
QWidget *w = new QWidget();
|
||||||
m_mainWnd->statusBar()->insertPermanentWidget(i, w);
|
m_mainWnd->statusBar()->insertPermanentWidget(i, w);
|
||||||
w->setLayout(new QHBoxLayout);
|
w->setLayout(new QHBoxLayout);
|
||||||
@@ -89,7 +89,7 @@ void ViewManager::init()
|
|||||||
|
|
||||||
void ViewManager::objectAdded(QObject *obj)
|
void ViewManager::objectAdded(QObject *obj)
|
||||||
{
|
{
|
||||||
IView * view = Aggregation::query<IView>(obj);
|
IView *view = Aggregation::query<IView>(obj);
|
||||||
if (!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -104,8 +104,8 @@ void ViewManager::objectAdded(QObject *obj)
|
|||||||
|
|
||||||
void ViewManager::aboutToRemoveObject(QObject *obj)
|
void ViewManager::aboutToRemoveObject(QObject *obj)
|
||||||
{
|
{
|
||||||
IView * view = Aggregation::query<IView>(obj);
|
IView *view = Aggregation::query<IView>(obj);
|
||||||
if(!view)
|
if (!view)
|
||||||
return;
|
return;
|
||||||
m_mainWnd->removeContextObject(view);
|
m_mainWnd->removeContextObject(view);
|
||||||
}
|
}
|
||||||
@@ -121,10 +121,10 @@ void ViewManager::saveSettings(QSettings *settings)
|
|||||||
settings->setValue(QLatin1String("ViewGroup_Default"), m_mainWnd->saveState());
|
settings->setValue(QLatin1String("ViewGroup_Default"), m_mainWnd->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
IView * ViewManager::view(const QString & id)
|
IView *ViewManager::view(const QString &id)
|
||||||
{
|
{
|
||||||
QList<IView *> list = m_mainWnd->pluginManager()->getObjects<IView>();
|
QList<IView *> list = m_mainWnd->pluginManager()->getObjects<IView>();
|
||||||
foreach (IView * view, list) {
|
foreach (IView *view, list) {
|
||||||
if (view->uniqueViewName() == id)
|
if (view->uniqueViewName() == id)
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<plugin name="CodePaster" version="0.1" compatVersion="0.1">
|
<plugin name="CodePaster" version="0.9.1" compatVersion="0.9.1">
|
||||||
<vendor>Nokia Corporation</vendor>
|
<vendor>Nokia Corporation</vendor>
|
||||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||||
<license>Nokia Technology Preview License Agreement</license>
|
<license>Nokia Technology Preview License Agreement</license>
|
||||||
|
@@ -79,6 +79,7 @@
|
|||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QTreeView>
|
#include <QtGui/QTreeView>
|
||||||
#include <QtGui/QHeaderView>
|
#include <QtGui/QHeaderView>
|
||||||
|
#include <QtGui/QStringListModel>
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
@@ -202,7 +203,9 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
|
|||||||
m_methodCombo->setMaxVisibleItems(20);
|
m_methodCombo->setMaxVisibleItems(20);
|
||||||
|
|
||||||
m_overviewModel = new OverviewModel(this);
|
m_overviewModel = new OverviewModel(this);
|
||||||
m_methodCombo->setModel(m_overviewModel);
|
m_noSymbolsModel = new QStringListModel(this);
|
||||||
|
m_noSymbolsModel->setStringList(QStringList() << tr("<no symbols>"));
|
||||||
|
m_methodCombo->setModel(m_noSymbolsModel);
|
||||||
|
|
||||||
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
|
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
|
||||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
|
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
|
||||||
@@ -315,9 +318,16 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_overviewModel->rebuild(doc);
|
m_overviewModel->rebuild(doc);
|
||||||
OverviewTreeView *treeView = static_cast<OverviewTreeView *>(m_methodCombo->view());
|
if (m_overviewModel->rowCount() > 0) {
|
||||||
treeView->sync();
|
if (m_methodCombo->model() != m_overviewModel)
|
||||||
updateMethodBoxIndex();
|
m_methodCombo->setModel(m_overviewModel);
|
||||||
|
OverviewTreeView *treeView = static_cast<OverviewTreeView *>(m_methodCombo->view());
|
||||||
|
treeView->sync();
|
||||||
|
updateMethodBoxIndex();
|
||||||
|
} else {
|
||||||
|
if (m_methodCombo->model() != m_noSymbolsModel)
|
||||||
|
m_methodCombo->setModel(m_noSymbolsModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::updateFileName()
|
void CPPEditor::updateFileName()
|
||||||
@@ -325,6 +335,8 @@ void CPPEditor::updateFileName()
|
|||||||
|
|
||||||
void CPPEditor::jumpToMethod(int)
|
void CPPEditor::jumpToMethod(int)
|
||||||
{
|
{
|
||||||
|
if (m_methodCombo->model() != m_overviewModel)
|
||||||
|
return;
|
||||||
QModelIndex index = m_methodCombo->view()->currentIndex();
|
QModelIndex index = m_methodCombo->view()->currentIndex();
|
||||||
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
||||||
if (! symbol)
|
if (! symbol)
|
||||||
@@ -339,12 +351,14 @@ void CPPEditor::jumpToMethod(int)
|
|||||||
|
|
||||||
void CPPEditor::updateMethodBoxIndex()
|
void CPPEditor::updateMethodBoxIndex()
|
||||||
{
|
{
|
||||||
|
if (m_methodCombo->model() != m_overviewModel)
|
||||||
|
return;
|
||||||
int line = 0, column = 0;
|
int line = 0, column = 0;
|
||||||
convertPosition(position(), &line, &column);
|
convertPosition(position(), &line, &column);
|
||||||
|
|
||||||
QModelIndex lastIndex;
|
QModelIndex lastIndex;
|
||||||
|
|
||||||
const int rc = m_overviewModel->rowCount(QModelIndex());
|
const int rc = m_overviewModel->rowCount();
|
||||||
for (int row = 0; row < rc; ++row) {
|
for (int row = 0; row < rc; ++row) {
|
||||||
const QModelIndex index = m_overviewModel->index(row, 0, QModelIndex());
|
const QModelIndex index = m_overviewModel->index(row, 0, QModelIndex());
|
||||||
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QAction;
|
class QAction;
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
class QStringListModel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -138,6 +139,7 @@ private:
|
|||||||
QList<int> m_contexts;
|
QList<int> m_contexts;
|
||||||
QComboBox *m_methodCombo;
|
QComboBox *m_methodCombo;
|
||||||
CPlusPlus::OverviewModel *m_overviewModel;
|
CPlusPlus::OverviewModel *m_overviewModel;
|
||||||
|
QStringListModel *m_noSymbolsModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -31,7 +31,6 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#define _SCL_SECURE_NO_WARNINGS 1
|
|
||||||
#include "pp.h"
|
#include "pp.h"
|
||||||
|
|
||||||
#include "cppmodelmanager.h"
|
#include "cppmodelmanager.h"
|
||||||
@@ -66,14 +65,14 @@
|
|||||||
#include <Token.h>
|
#include <Token.h>
|
||||||
|
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
#include <QMutexLocker>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
|
using namespace CppTools;
|
||||||
|
using namespace CppTools::Internal;
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
|
|
||||||
namespace CppTools {
|
|
||||||
namespace Internal {
|
|
||||||
|
|
||||||
static const char pp_configuration_file[] = "<configuration>";
|
static const char pp_configuration_file[] = "<configuration>";
|
||||||
|
|
||||||
static const char pp_configuration[] =
|
static const char pp_configuration[] =
|
||||||
@@ -105,299 +104,328 @@ static const char pp_configuration[] =
|
|||||||
"#define __declspec(a)\n"
|
"#define __declspec(a)\n"
|
||||||
"#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method\n";
|
"#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method\n";
|
||||||
|
|
||||||
class CppPreprocessor: public rpp::Client
|
namespace CppTools {
|
||||||
|
namespace Internal {
|
||||||
|
|
||||||
|
class CppPreprocessor: public CPlusPlus::Client
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CppPreprocessor(QPointer<CppModelManager> modelManager)
|
CppPreprocessor(QPointer<CppModelManager> modelManager);
|
||||||
: m_modelManager(modelManager),
|
|
||||||
m_documents(modelManager->documents()),
|
|
||||||
m_proc(this, env)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
void setWorkingCopy(const QMap<QString, QByteArray> &workingCopy)
|
void setWorkingCopy(const QMap<QString, QByteArray> &workingCopy);
|
||||||
{ m_workingCopy = workingCopy; }
|
void setIncludePaths(const QStringList &includePaths);
|
||||||
|
void setFrameworkPaths(const QStringList &frameworkPaths);
|
||||||
void setIncludePaths(const QStringList &includePaths)
|
void addIncludePath(const QString &path);
|
||||||
{ m_includePaths = includePaths; }
|
void setProjectFiles(const QStringList &files);
|
||||||
|
void run(QString &fileName);
|
||||||
void setFrameworkPaths(const QStringList &frameworkPaths)
|
void operator()(QString &fileName);
|
||||||
{ m_frameworkPaths = frameworkPaths; }
|
|
||||||
|
|
||||||
void addIncludePath(const QString &path)
|
|
||||||
{ m_includePaths.append(path); }
|
|
||||||
|
|
||||||
void setProjectFiles(const QStringList &files)
|
|
||||||
{ m_projectFiles = files; }
|
|
||||||
|
|
||||||
void run(QString &fileName)
|
|
||||||
{ sourceNeeded(fileName, IncludeGlobal); }
|
|
||||||
|
|
||||||
void operator()(QString &fileName)
|
|
||||||
{ run(fileName); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool includeFile(const QString &absoluteFilePath, QByteArray *result)
|
CPlusPlus::Document::Ptr switchDocument(CPlusPlus::Document::Ptr doc);
|
||||||
{
|
|
||||||
if (absoluteFilePath.isEmpty() || m_included.contains(absoluteFilePath)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_workingCopy.contains(absoluteFilePath)) {
|
bool includeFile(const QString &absoluteFilePath, QByteArray *result);
|
||||||
m_included.insert(absoluteFilePath);
|
QByteArray tryIncludeFile(QString &fileName, IncludeType type);
|
||||||
*result = m_workingCopy.value(absoluteFilePath);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFileInfo fileInfo(absoluteFilePath);
|
void mergeEnvironment(CPlusPlus::Document::Ptr doc);
|
||||||
if (! fileInfo.isFile())
|
void mergeEnvironment(CPlusPlus::Document::Ptr doc, QSet<QString> *processed);
|
||||||
return false;
|
|
||||||
|
|
||||||
QFile file(absoluteFilePath);
|
|
||||||
if (file.open(QFile::ReadOnly)) {
|
|
||||||
m_included.insert(absoluteFilePath);
|
|
||||||
QTextStream stream(&file);
|
|
||||||
const QString contents = stream.readAll();
|
|
||||||
*result = contents.toUtf8();
|
|
||||||
file.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray tryIncludeFile(QString &fileName, IncludeType type)
|
|
||||||
{
|
|
||||||
QFileInfo fileInfo(fileName);
|
|
||||||
if (fileName == QLatin1String(pp_configuration_file) || fileInfo.isAbsolute()) {
|
|
||||||
QByteArray contents;
|
|
||||||
includeFile(fileName, &contents);
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == IncludeLocal && m_currentDoc) {
|
|
||||||
QFileInfo currentFileInfo(m_currentDoc->fileName());
|
|
||||||
QString path = currentFileInfo.absolutePath();
|
|
||||||
path += QLatin1Char('/');
|
|
||||||
path += fileName;
|
|
||||||
path = QDir::cleanPath(path);
|
|
||||||
QByteArray contents;
|
|
||||||
if (includeFile(path, &contents)) {
|
|
||||||
fileName = path;
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QString &includePath, m_includePaths) {
|
|
||||||
QString path = includePath;
|
|
||||||
path += QLatin1Char('/');
|
|
||||||
path += fileName;
|
|
||||||
path = QDir::cleanPath(path);
|
|
||||||
QByteArray contents;
|
|
||||||
if (includeFile(path, &contents)) {
|
|
||||||
fileName = path;
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// look in the system include paths
|
|
||||||
foreach (const QString &includePath, m_systemIncludePaths) {
|
|
||||||
QString path = includePath;
|
|
||||||
path += QLatin1Char('/');
|
|
||||||
path += fileName;
|
|
||||||
path = QDir::cleanPath(path);
|
|
||||||
QByteArray contents;
|
|
||||||
if (includeFile(path, &contents)) {
|
|
||||||
fileName = path;
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int index = fileName.indexOf(QLatin1Char('/'));
|
|
||||||
if (index != -1) {
|
|
||||||
QString frameworkName = fileName.left(index);
|
|
||||||
QString name = fileName.mid(index + 1);
|
|
||||||
|
|
||||||
foreach (const QString &frameworkPath, m_frameworkPaths) {
|
|
||||||
QString path = frameworkPath;
|
|
||||||
path += QLatin1Char('/');
|
|
||||||
path += frameworkName;
|
|
||||||
path += QLatin1String(".framework/Headers/");
|
|
||||||
path += name;
|
|
||||||
QByteArray contents;
|
|
||||||
if (includeFile(path, &contents)) {
|
|
||||||
fileName = path;
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString path = fileName;
|
|
||||||
if (path.at(0) != QLatin1Char('/'))
|
|
||||||
path.prepend(QLatin1Char('/'));
|
|
||||||
|
|
||||||
foreach (const QString &projectFile, m_projectFiles) {
|
|
||||||
if (projectFile.endsWith(path)) {
|
|
||||||
fileName = projectFile;
|
|
||||||
QByteArray contents;
|
|
||||||
includeFile(fileName, &contents);
|
|
||||||
return contents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//qDebug() << "**** file" << fileName << "not found!";
|
|
||||||
return QByteArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void macroAdded(const QByteArray ¯oName, const QByteArray ¯oText)
|
|
||||||
{
|
|
||||||
if (! m_currentDoc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_currentDoc->appendMacro(macroName, macroText);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
virtual void macroAdded(const QByteArray ¯oName,
|
||||||
|
const QByteArray ¯oText);
|
||||||
virtual void startExpandingMacro(unsigned offset,
|
virtual void startExpandingMacro(unsigned offset,
|
||||||
const rpp::Macro &,
|
const Macro ¯o,
|
||||||
const QByteArray &originalText)
|
const QByteArray &originalText);
|
||||||
{
|
virtual void stopExpandingMacro(unsigned offset, const Macro ¯o);
|
||||||
if (! m_currentDoc)
|
virtual void startSkippingBlocks(unsigned offset);
|
||||||
return;
|
virtual void stopSkippingBlocks(unsigned offset);
|
||||||
|
virtual void sourceNeeded(QString &fileName, IncludeType type);
|
||||||
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
|
||||||
m_currentDoc->addMacroUse(offset, originalText.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void stopExpandingMacro(unsigned, const rpp::Macro &)
|
|
||||||
{
|
|
||||||
if (! m_currentDoc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
//qDebug() << "stop expanding:" << macro.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mergeEnvironment(Document::Ptr doc)
|
|
||||||
{
|
|
||||||
QSet<QString> processed;
|
|
||||||
mergeEnvironment(doc, &processed);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mergeEnvironment(Document::Ptr doc, QSet<QString> *processed)
|
|
||||||
{
|
|
||||||
if (! doc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const QString fn = doc->fileName();
|
|
||||||
|
|
||||||
if (processed->contains(fn))
|
|
||||||
return;
|
|
||||||
|
|
||||||
processed->insert(fn);
|
|
||||||
|
|
||||||
foreach (QString includedFile, doc->includedFiles())
|
|
||||||
mergeEnvironment(m_documents.value(includedFile), processed);
|
|
||||||
|
|
||||||
const QByteArray macros = doc->definedMacros();
|
|
||||||
QByteArray localFileName = doc->fileName().toUtf8();
|
|
||||||
|
|
||||||
QByteArray dummy;
|
|
||||||
m_proc(localFileName, macros, &dummy);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void startSkippingBlocks(unsigned offset)
|
|
||||||
{
|
|
||||||
//qDebug() << "start skipping blocks:" << offset;
|
|
||||||
if (m_currentDoc)
|
|
||||||
m_currentDoc->startSkippingBlocks(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void stopSkippingBlocks(unsigned offset)
|
|
||||||
{
|
|
||||||
//qDebug() << "stop skipping blocks:" << offset;
|
|
||||||
if (m_currentDoc)
|
|
||||||
m_currentDoc->stopSkippingBlocks(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void sourceNeeded(QString &fileName, IncludeType type)
|
|
||||||
{
|
|
||||||
if (fileName.isEmpty())
|
|
||||||
return;
|
|
||||||
|
|
||||||
QByteArray contents = tryIncludeFile(fileName, type);
|
|
||||||
|
|
||||||
if (m_currentDoc) {
|
|
||||||
m_currentDoc->addIncludeFile(fileName);
|
|
||||||
if (contents.isEmpty() && ! QFileInfo(fileName).isAbsolute()) {
|
|
||||||
QString msg;
|
|
||||||
msg += fileName;
|
|
||||||
msg += QLatin1String(": No such file or directory");
|
|
||||||
Document::DiagnosticMessage d(Document::DiagnosticMessage::Warning,
|
|
||||||
m_currentDoc->fileName(),
|
|
||||||
env.currentLine, /*column = */ 0,
|
|
||||||
msg);
|
|
||||||
m_currentDoc->addDiagnosticMessage(d);
|
|
||||||
//qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! contents.isEmpty()) {
|
|
||||||
Document::Ptr cachedDoc = m_documents.value(fileName);
|
|
||||||
if (cachedDoc && m_currentDoc) {
|
|
||||||
mergeEnvironment(cachedDoc);
|
|
||||||
} else {
|
|
||||||
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
|
||||||
|
|
||||||
const QByteArray previousFile = env.current_file;
|
|
||||||
const unsigned previousLine = env.currentLine;
|
|
||||||
|
|
||||||
env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
|
||||||
m_currentDoc->translationUnit()->fileNameLength());
|
|
||||||
|
|
||||||
QByteArray preprocessedCode;
|
|
||||||
m_proc(contents, &preprocessedCode);
|
|
||||||
//qDebug() << preprocessedCode;
|
|
||||||
|
|
||||||
env.current_file = previousFile;
|
|
||||||
env.currentLine = previousLine;
|
|
||||||
|
|
||||||
m_currentDoc->setSource(preprocessedCode);
|
|
||||||
m_currentDoc->parse();
|
|
||||||
m_currentDoc->check();
|
|
||||||
m_currentDoc->releaseTranslationUnit(); // release the AST and the token stream.
|
|
||||||
|
|
||||||
if (m_modelManager)
|
|
||||||
m_modelManager->emitDocumentUpdated(m_currentDoc);
|
|
||||||
(void) switchDocument(previousDoc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Document::Ptr switchDocument(Document::Ptr doc)
|
|
||||||
{
|
|
||||||
Document::Ptr previousDoc = m_currentDoc;
|
|
||||||
m_currentDoc = doc;
|
|
||||||
return previousDoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer<CppModelManager> m_modelManager;
|
QPointer<CppModelManager> m_modelManager;
|
||||||
CppModelManager::DocumentTable m_documents;
|
CppModelManager::DocumentTable m_documents;
|
||||||
rpp::Environment env;
|
Environment env;
|
||||||
rpp::pp m_proc;
|
pp m_proc;
|
||||||
QStringList m_includePaths;
|
QStringList m_includePaths;
|
||||||
QStringList m_systemIncludePaths;
|
QStringList m_systemIncludePaths;
|
||||||
QMap<QString, QByteArray> m_workingCopy;
|
QMap<QString, QByteArray> m_workingCopy;
|
||||||
QStringList m_projectFiles;
|
QStringList m_projectFiles;
|
||||||
QStringList m_frameworkPaths;
|
QStringList m_frameworkPaths;
|
||||||
QSet<QString> m_included;
|
QSet<QString> m_included;
|
||||||
Document::Ptr m_currentDoc;
|
CPlusPlus::Document::Ptr m_currentDoc;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
|
||||||
|
CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
|
||||||
|
: m_modelManager(modelManager),
|
||||||
|
m_documents(modelManager->documents()),
|
||||||
|
m_proc(this, env)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
void CppPreprocessor::setWorkingCopy(const QMap<QString, QByteArray> &workingCopy)
|
||||||
|
{ m_workingCopy = workingCopy; }
|
||||||
|
|
||||||
|
void CppPreprocessor::setIncludePaths(const QStringList &includePaths)
|
||||||
|
{ m_includePaths = includePaths; }
|
||||||
|
|
||||||
|
void CppPreprocessor::setFrameworkPaths(const QStringList &frameworkPaths)
|
||||||
|
{ m_frameworkPaths = frameworkPaths; }
|
||||||
|
|
||||||
|
void CppPreprocessor::addIncludePath(const QString &path)
|
||||||
|
{ m_includePaths.append(path); }
|
||||||
|
|
||||||
|
void CppPreprocessor::setProjectFiles(const QStringList &files)
|
||||||
|
{ m_projectFiles = files; }
|
||||||
|
|
||||||
|
void CppPreprocessor::run(QString &fileName)
|
||||||
|
{ sourceNeeded(fileName, IncludeGlobal); }
|
||||||
|
|
||||||
|
void CppPreprocessor::operator()(QString &fileName)
|
||||||
|
{ run(fileName); }
|
||||||
|
|
||||||
|
bool CppPreprocessor::includeFile(const QString &absoluteFilePath, QByteArray *result)
|
||||||
|
{
|
||||||
|
if (absoluteFilePath.isEmpty() || m_included.contains(absoluteFilePath)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_workingCopy.contains(absoluteFilePath)) {
|
||||||
|
m_included.insert(absoluteFilePath);
|
||||||
|
*result = m_workingCopy.value(absoluteFilePath);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QFileInfo fileInfo(absoluteFilePath);
|
||||||
|
if (! fileInfo.isFile())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QFile file(absoluteFilePath);
|
||||||
|
if (file.open(QFile::ReadOnly)) {
|
||||||
|
m_included.insert(absoluteFilePath);
|
||||||
|
QTextStream stream(&file);
|
||||||
|
const QString contents = stream.readAll();
|
||||||
|
*result = contents.toUtf8();
|
||||||
|
file.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CppPreprocessor::tryIncludeFile(QString &fileName, IncludeType type)
|
||||||
|
{
|
||||||
|
QFileInfo fileInfo(fileName);
|
||||||
|
if (fileName == QLatin1String(pp_configuration_file) || fileInfo.isAbsolute()) {
|
||||||
|
QByteArray contents;
|
||||||
|
includeFile(fileName, &contents);
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == IncludeLocal && m_currentDoc) {
|
||||||
|
QFileInfo currentFileInfo(m_currentDoc->fileName());
|
||||||
|
QString path = currentFileInfo.absolutePath();
|
||||||
|
path += QLatin1Char('/');
|
||||||
|
path += fileName;
|
||||||
|
path = QDir::cleanPath(path);
|
||||||
|
QByteArray contents;
|
||||||
|
if (includeFile(path, &contents)) {
|
||||||
|
fileName = path;
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const QString &includePath, m_includePaths) {
|
||||||
|
QString path = includePath;
|
||||||
|
path += QLatin1Char('/');
|
||||||
|
path += fileName;
|
||||||
|
path = QDir::cleanPath(path);
|
||||||
|
QByteArray contents;
|
||||||
|
if (includeFile(path, &contents)) {
|
||||||
|
fileName = path;
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// look in the system include paths
|
||||||
|
foreach (const QString &includePath, m_systemIncludePaths) {
|
||||||
|
QString path = includePath;
|
||||||
|
path += QLatin1Char('/');
|
||||||
|
path += fileName;
|
||||||
|
path = QDir::cleanPath(path);
|
||||||
|
QByteArray contents;
|
||||||
|
if (includeFile(path, &contents)) {
|
||||||
|
fileName = path;
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = fileName.indexOf(QLatin1Char('/'));
|
||||||
|
if (index != -1) {
|
||||||
|
QString frameworkName = fileName.left(index);
|
||||||
|
QString name = fileName.mid(index + 1);
|
||||||
|
|
||||||
|
foreach (const QString &frameworkPath, m_frameworkPaths) {
|
||||||
|
QString path = frameworkPath;
|
||||||
|
path += QLatin1Char('/');
|
||||||
|
path += frameworkName;
|
||||||
|
path += QLatin1String(".framework/Headers/");
|
||||||
|
path += name;
|
||||||
|
QByteArray contents;
|
||||||
|
if (includeFile(path, &contents)) {
|
||||||
|
fileName = path;
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QString path = fileName;
|
||||||
|
if (path.at(0) != QLatin1Char('/'))
|
||||||
|
path.prepend(QLatin1Char('/'));
|
||||||
|
|
||||||
|
foreach (const QString &projectFile, m_projectFiles) {
|
||||||
|
if (projectFile.endsWith(path)) {
|
||||||
|
fileName = projectFile;
|
||||||
|
QByteArray contents;
|
||||||
|
includeFile(fileName, &contents);
|
||||||
|
return contents;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//qDebug() << "**** file" << fileName << "not found!";
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::macroAdded(const QByteArray ¯oName, const QByteArray ¯oText)
|
||||||
|
{
|
||||||
|
if (! m_currentDoc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_currentDoc->appendMacro(macroName, macroText);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
||||||
|
const Macro &,
|
||||||
|
const QByteArray &originalText)
|
||||||
|
{
|
||||||
|
if (! m_currentDoc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
||||||
|
m_currentDoc->addMacroUse(offset, originalText.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||||
|
{
|
||||||
|
if (! m_currentDoc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//qDebug() << "stop expanding:" << macro.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::mergeEnvironment(Document::Ptr doc)
|
||||||
|
{
|
||||||
|
QSet<QString> processed;
|
||||||
|
mergeEnvironment(doc, &processed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::mergeEnvironment(Document::Ptr doc, QSet<QString> *processed)
|
||||||
|
{
|
||||||
|
if (! doc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const QString fn = doc->fileName();
|
||||||
|
|
||||||
|
if (processed->contains(fn))
|
||||||
|
return;
|
||||||
|
|
||||||
|
processed->insert(fn);
|
||||||
|
|
||||||
|
foreach (QString includedFile, doc->includedFiles())
|
||||||
|
mergeEnvironment(m_documents.value(includedFile), processed);
|
||||||
|
|
||||||
|
const QByteArray macros = doc->definedMacros();
|
||||||
|
QByteArray localFileName = doc->fileName().toUtf8();
|
||||||
|
|
||||||
|
QByteArray dummy;
|
||||||
|
m_proc(localFileName, macros, &dummy);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::startSkippingBlocks(unsigned offset)
|
||||||
|
{
|
||||||
|
//qDebug() << "start skipping blocks:" << offset;
|
||||||
|
if (m_currentDoc)
|
||||||
|
m_currentDoc->startSkippingBlocks(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::stopSkippingBlocks(unsigned offset)
|
||||||
|
{
|
||||||
|
//qDebug() << "stop skipping blocks:" << offset;
|
||||||
|
if (m_currentDoc)
|
||||||
|
m_currentDoc->stopSkippingBlocks(offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
|
||||||
|
{
|
||||||
|
if (fileName.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
QByteArray contents = tryIncludeFile(fileName, type);
|
||||||
|
|
||||||
|
if (m_currentDoc) {
|
||||||
|
m_currentDoc->addIncludeFile(fileName);
|
||||||
|
if (contents.isEmpty() && ! QFileInfo(fileName).isAbsolute()) {
|
||||||
|
QString msg;
|
||||||
|
msg += fileName;
|
||||||
|
msg += QLatin1String(": No such file or directory");
|
||||||
|
Document::DiagnosticMessage d(Document::DiagnosticMessage::Warning,
|
||||||
|
m_currentDoc->fileName(),
|
||||||
|
env.currentLine, /*column = */ 0,
|
||||||
|
msg);
|
||||||
|
m_currentDoc->addDiagnosticMessage(d);
|
||||||
|
//qWarning() << "file not found:" << fileName << m_currentDoc->fileName() << env.current_line;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! contents.isEmpty()) {
|
||||||
|
Document::Ptr cachedDoc = m_documents.value(fileName);
|
||||||
|
if (cachedDoc && m_currentDoc) {
|
||||||
|
mergeEnvironment(cachedDoc);
|
||||||
|
} else {
|
||||||
|
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
||||||
|
|
||||||
|
const QByteArray previousFile = env.current_file;
|
||||||
|
const unsigned previousLine = env.currentLine;
|
||||||
|
|
||||||
|
env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
||||||
|
m_currentDoc->translationUnit()->fileNameLength());
|
||||||
|
|
||||||
|
QByteArray preprocessedCode;
|
||||||
|
m_proc(contents, &preprocessedCode);
|
||||||
|
//qDebug() << preprocessedCode;
|
||||||
|
|
||||||
|
env.current_file = previousFile;
|
||||||
|
env.currentLine = previousLine;
|
||||||
|
|
||||||
|
m_currentDoc->setSource(preprocessedCode);
|
||||||
|
m_currentDoc->parse();
|
||||||
|
m_currentDoc->check();
|
||||||
|
m_currentDoc->releaseTranslationUnit(); // release the AST and the token stream.
|
||||||
|
|
||||||
|
if (m_modelManager)
|
||||||
|
m_modelManager->emitDocumentUpdated(m_currentDoc);
|
||||||
|
(void) switchDocument(previousDoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
|
||||||
|
{
|
||||||
|
Document::Ptr previousDoc = m_currentDoc;
|
||||||
|
m_currentDoc = doc;
|
||||||
|
return previousDoc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
using namespace CppTools;
|
|
||||||
using namespace CppTools::Internal;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class CppTools::CppModelManager
|
\class CppTools::CppModelManager
|
||||||
@@ -450,12 +478,25 @@ CppModelManager::CppModelManager(QObject *parent) :
|
|||||||
CppModelManager::~CppModelManager()
|
CppModelManager::~CppModelManager()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Document::Ptr CppModelManager::document(const QString &fileName)
|
Document::Ptr CppModelManager::document(const QString &fileName) const
|
||||||
{ return m_documents.value(fileName); }
|
{ return m_documents.value(fileName); }
|
||||||
|
|
||||||
CppModelManager::DocumentTable CppModelManager::documents()
|
CppModelManager::DocumentTable CppModelManager::documents() const
|
||||||
{ return m_documents; }
|
{ return m_documents; }
|
||||||
|
|
||||||
|
void CppModelManager::ensureUpdated()
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
if (! m_dirty)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_projectFiles = updateProjectFiles();
|
||||||
|
m_includePaths = updateIncludePaths();
|
||||||
|
m_frameworkPaths = updateFrameworkPaths();
|
||||||
|
m_definedMacros = updateDefinedMacros();
|
||||||
|
m_dirty = false;
|
||||||
|
}
|
||||||
|
|
||||||
QStringList CppModelManager::updateProjectFiles() const
|
QStringList CppModelManager::updateProjectFiles() const
|
||||||
{
|
{
|
||||||
QStringList files;
|
QStringList files;
|
||||||
@@ -527,8 +568,29 @@ QMap<QString, QByteArray> CppModelManager::buildWorkingCopyList()
|
|||||||
void CppModelManager::updateSourceFiles(const QStringList &sourceFiles)
|
void CppModelManager::updateSourceFiles(const QStringList &sourceFiles)
|
||||||
{ (void) refreshSourceFiles(sourceFiles); }
|
{ (void) refreshSourceFiles(sourceFiles); }
|
||||||
|
|
||||||
CppModelManager::ProjectInfo *CppModelManager::projectInfo(ProjectExplorer::Project *project)
|
QList<CppModelManager::ProjectInfo> CppModelManager::projectInfos() const
|
||||||
{ return &m_projects[project]; }
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
|
return m_projects.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
CppModelManager::ProjectInfo CppModelManager::projectInfo(ProjectExplorer::Project *project) const
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
|
return m_projects.value(project, ProjectInfo(project));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppModelManager::updateProjectInfo(const ProjectInfo &pinfo)
|
||||||
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
|
if (! pinfo.isValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_projects.insert(pinfo.project, pinfo);
|
||||||
|
}
|
||||||
|
|
||||||
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles)
|
||||||
{
|
{
|
||||||
@@ -691,13 +753,18 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
|
|||||||
|
|
||||||
void CppModelManager::onProjectAdded(ProjectExplorer::Project *)
|
void CppModelManager::onProjectAdded(ProjectExplorer::Project *)
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
|
void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project)
|
||||||
{
|
{
|
||||||
m_dirty = true;
|
do {
|
||||||
m_projects.remove(project);
|
QMutexLocker locker(&mutex);
|
||||||
|
m_dirty = true;
|
||||||
|
m_projects.remove(project);
|
||||||
|
} while (0);
|
||||||
|
|
||||||
GC();
|
GC();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -705,8 +772,15 @@ void CppModelManager::onSessionUnloaded()
|
|||||||
{
|
{
|
||||||
if (m_core->progressManager()) {
|
if (m_core->progressManager()) {
|
||||||
m_core->progressManager()->cancelTasks(CppTools::Constants::TASK_INDEX);
|
m_core->progressManager()->cancelTasks(CppTools::Constants::TASK_INDEX);
|
||||||
m_dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
QMutexLocker locker(&mutex);
|
||||||
|
m_projects.clear();
|
||||||
|
m_dirty = true;
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
GC();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppModelManager::parse(QFutureInterface<void> &future,
|
void CppModelManager::parse(QFutureInterface<void> &future,
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QFutureInterface>
|
#include <QFutureInterface>
|
||||||
|
#include <QMutex>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
class ICore;
|
class ICore;
|
||||||
@@ -70,9 +71,13 @@ public:
|
|||||||
virtual ~CppModelManager();
|
virtual ~CppModelManager();
|
||||||
|
|
||||||
virtual void updateSourceFiles(const QStringList &sourceFiles);
|
virtual void updateSourceFiles(const QStringList &sourceFiles);
|
||||||
virtual ProjectInfo *projectInfo(ProjectExplorer::Project *project);
|
|
||||||
virtual CPlusPlus::Document::Ptr document(const QString &fileName);
|
virtual QList<ProjectInfo> projectInfos() const;
|
||||||
virtual DocumentTable documents();
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const;
|
||||||
|
virtual void updateProjectInfo(const ProjectInfo &pinfo);
|
||||||
|
|
||||||
|
virtual CPlusPlus::Document::Ptr document(const QString &fileName) const;
|
||||||
|
virtual DocumentTable documents() const;
|
||||||
virtual void GC();
|
virtual void GC();
|
||||||
|
|
||||||
QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
|
QFuture<void> refreshSourceFiles(const QStringList &sourceFiles);
|
||||||
@@ -127,22 +132,12 @@ private:
|
|||||||
return m_definedMacros;
|
return m_definedMacros;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ensureUpdated();
|
||||||
QStringList updateProjectFiles() const;
|
QStringList updateProjectFiles() const;
|
||||||
QStringList updateIncludePaths() const;
|
QStringList updateIncludePaths() const;
|
||||||
QStringList updateFrameworkPaths() const;
|
QStringList updateFrameworkPaths() const;
|
||||||
QByteArray updateDefinedMacros() const;
|
QByteArray updateDefinedMacros() const;
|
||||||
|
|
||||||
void ensureUpdated() {
|
|
||||||
if (! m_dirty)
|
|
||||||
return;
|
|
||||||
|
|
||||||
m_projectFiles = updateProjectFiles();
|
|
||||||
m_includePaths = updateIncludePaths();
|
|
||||||
m_frameworkPaths = updateFrameworkPaths();
|
|
||||||
m_definedMacros = updateDefinedMacros();
|
|
||||||
m_dirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void parse(QFutureInterface<void> &future,
|
static void parse(QFutureInterface<void> &future,
|
||||||
CppPreprocessor *preproc,
|
CppPreprocessor *preproc,
|
||||||
QStringList files);
|
QStringList files);
|
||||||
@@ -166,6 +161,8 @@ private:
|
|||||||
// project integration
|
// project integration
|
||||||
QMap<ProjectExplorer::Project *, ProjectInfo> m_projects;
|
QMap<ProjectExplorer::Project *, ProjectInfo> m_projects;
|
||||||
|
|
||||||
|
mutable QMutex mutex;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MAX_SELECTION_COUNT = 5
|
MAX_SELECTION_COUNT = 5
|
||||||
};
|
};
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#include <cplusplus/CppDocument.h>
|
#include <cplusplus/CppDocument.h>
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
class Project;
|
class Project;
|
||||||
@@ -51,10 +52,29 @@ class CPPTOOLS_EXPORT CppModelManagerInterface
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QMap<QString, CPlusPlus::Document::Ptr> DocumentTable;
|
typedef QMap<QString, CPlusPlus::Document::Ptr> DocumentTable; // ### remove me
|
||||||
|
|
||||||
struct ProjectInfo
|
class ProjectInfo
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
ProjectInfo()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
ProjectInfo(QPointer<ProjectExplorer::Project> project)
|
||||||
|
: project(project)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
operator bool() const
|
||||||
|
{ return ! project.isNull(); }
|
||||||
|
|
||||||
|
bool isValid() const
|
||||||
|
{ return ! project.isNull(); }
|
||||||
|
|
||||||
|
bool isNull() const
|
||||||
|
{ return project.isNull(); }
|
||||||
|
|
||||||
|
public: // attributes
|
||||||
|
QPointer<ProjectExplorer::Project> project;
|
||||||
QString projectPath;
|
QString projectPath;
|
||||||
QByteArray defines;
|
QByteArray defines;
|
||||||
QStringList sourceFiles;
|
QStringList sourceFiles;
|
||||||
@@ -69,10 +89,12 @@ public:
|
|||||||
virtual void GC() = 0;
|
virtual void GC() = 0;
|
||||||
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
|
virtual void updateSourceFiles(const QStringList &sourceFiles) = 0;
|
||||||
|
|
||||||
virtual CPlusPlus::Document::Ptr document(const QString &fileName) = 0;
|
virtual CPlusPlus::Document::Ptr document(const QString &fileName) const = 0;
|
||||||
virtual DocumentTable documents() = 0;
|
virtual DocumentTable documents() const = 0;
|
||||||
|
|
||||||
virtual ProjectInfo *projectInfo(ProjectExplorer::Project *project) = 0;
|
virtual QList<ProjectInfo> projectInfos() const = 0;
|
||||||
|
virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0;
|
||||||
|
virtual void updateProjectInfo(const ProjectInfo &pinfo) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
@@ -10,7 +10,7 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
|||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
DEFINES += CPPTOOLS_LIBRARY
|
DEFINES += CPPTOOLS_LIBRARY
|
||||||
CONFIG += help
|
CONFIG += help
|
||||||
include(rpp/rpp.pri)|error("Can't find RPP")
|
|
||||||
HEADERS += cpptools_global.h \
|
HEADERS += cpptools_global.h \
|
||||||
cppquickopenfilter.h \
|
cppquickopenfilter.h \
|
||||||
cppclassesfilter.h \
|
cppclassesfilter.h \
|
||||||
|
@@ -1,18 +0,0 @@
|
|||||||
DEPENDPATH += $$PWD
|
|
||||||
INCLUDEPATH += $$PWD
|
|
||||||
|
|
||||||
HEADERS += $$PWD/pp-cctype.h \
|
|
||||||
$$PWD/pp-engine.h \
|
|
||||||
$$PWD/pp-environment.h \
|
|
||||||
$$PWD/pp-internal.h \
|
|
||||||
$$PWD/pp-macro-expander.h \
|
|
||||||
$$PWD/pp-macro.h \
|
|
||||||
$$PWD/pp-scanner.h \
|
|
||||||
$$PWD/pp.h \
|
|
||||||
$$PWD/pp-client.h
|
|
||||||
|
|
||||||
SOURCES += $$PWD/pp-engine.cpp \
|
|
||||||
$$PWD/pp-environment.cpp \
|
|
||||||
$$PWD/pp-macro-expander.cpp
|
|
||||||
|
|
||||||
|
|
@@ -44,6 +44,8 @@
|
|||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
@@ -285,6 +285,7 @@ void DebuggerOutputWindow::showOutput(const QString &prefix, const QString &outp
|
|||||||
|
|
||||||
void DebuggerOutputWindow::showInput(const QString &prefix, const QString &input)
|
void DebuggerOutputWindow::showInput(const QString &prefix, const QString &input)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(prefix);
|
||||||
m_inputText->append(input);
|
m_inputText->append(input);
|
||||||
QTextCursor cursor = m_inputText->textCursor();
|
QTextCursor cursor = m_inputText->textCursor();
|
||||||
cursor.movePosition(QTextCursor::End);
|
cursor.movePosition(QTextCursor::End);
|
||||||
|
@@ -250,6 +250,12 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
|
|
||||||
m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING);
|
m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING);
|
||||||
|
|
||||||
|
m_breakpointMarginAction = new QAction(this);
|
||||||
|
m_breakpointMarginAction->setText("Toggle Breakpoint");
|
||||||
|
//m_breakpointMarginAction->setIcon(QIcon(":/gdbdebugger/images/breakpoint.svg"));
|
||||||
|
connect(m_breakpointMarginAction, SIGNAL(triggered()),
|
||||||
|
this, SLOT(breakpointMarginActionTriggered()));
|
||||||
|
|
||||||
//Core::IActionContainer *mcppcontext =
|
//Core::IActionContainer *mcppcontext =
|
||||||
// actionManager->actionContainer(CppEditor::Constants::M_CONTEXT);
|
// actionManager->actionContainer(CppEditor::Constants::M_CONTEXT);
|
||||||
|
|
||||||
@@ -502,6 +508,8 @@ void DebuggerPlugin::editorOpened(Core::IEditor *editor)
|
|||||||
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
||||||
connect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
connect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
||||||
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
||||||
|
connect(textEditor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||||
|
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,9 +520,27 @@ void DebuggerPlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
this, SLOT(requestMark(TextEditor::ITextEditor*,int)));
|
||||||
disconnect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
disconnect(editor, SIGNAL(tooltipRequested(TextEditor::ITextEditor*,QPoint,int)),
|
||||||
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
this, SLOT(showToolTip(TextEditor::ITextEditor*,QPoint,int)));
|
||||||
|
disconnect(textEditor, SIGNAL(markContextMenuRequested(TextEditor::ITextEditor*,int,QMenu*)),
|
||||||
|
this, SLOT(requestContextMenu(TextEditor::ITextEditor*,int,QMenu*)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerPlugin::requestContextMenu(TextEditor::ITextEditor *editor,
|
||||||
|
int lineNumber, QMenu *menu)
|
||||||
|
{
|
||||||
|
m_breakpointMarginActionLineNumber = lineNumber;
|
||||||
|
m_breakpointMarginActionFileName = editor->file()->fileName();
|
||||||
|
menu->addAction(m_breakpointMarginAction);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerPlugin::breakpointMarginActionTriggered()
|
||||||
|
{
|
||||||
|
m_manager->toggleBreakpoint(
|
||||||
|
m_breakpointMarginActionFileName,
|
||||||
|
m_breakpointMarginActionLineNumber
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber)
|
void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber)
|
||||||
{
|
{
|
||||||
m_manager->toggleBreakpoint(editor->file()->fileName(), lineNumber);
|
m_manager->toggleBreakpoint(editor->file()->fileName(), lineNumber);
|
||||||
|
@@ -84,10 +84,14 @@ private slots:
|
|||||||
void setSessionValue(const QString &name, const QVariant &value);
|
void setSessionValue(const QString &name, const QVariant &value);
|
||||||
void queryConfigValue(const QString &name, QVariant *value);
|
void queryConfigValue(const QString &name, QVariant *value);
|
||||||
void setConfigValue(const QString &name, const QVariant &value);
|
void setConfigValue(const QString &name, const QVariant &value);
|
||||||
|
void requestContextMenu(TextEditor::ITextEditor *editor,
|
||||||
|
int lineNumber, QMenu *menu);
|
||||||
|
|
||||||
void resetLocation();
|
void resetLocation();
|
||||||
void gotoLocation(const QString &fileName, int line, bool setMarker);
|
void gotoLocation(const QString &fileName, int line, bool setMarker);
|
||||||
|
|
||||||
|
void breakpointMarginActionTriggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class DebuggerManager;
|
friend class DebuggerManager;
|
||||||
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
||||||
@@ -104,6 +108,10 @@ private:
|
|||||||
QString m_previousMode;
|
QString m_previousMode;
|
||||||
LocationMark *m_locationMark;
|
LocationMark *m_locationMark;
|
||||||
int m_gdbRunningContext;
|
int m_gdbRunningContext;
|
||||||
|
|
||||||
|
QAction *m_breakpointMarginAction;
|
||||||
|
int m_breakpointMarginActionLineNumber;
|
||||||
|
QString m_breakpointMarginActionFileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -1271,6 +1271,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
if (isStoppedReason(reason) || reason.isEmpty()) {
|
if (isStoppedReason(reason) || reason.isEmpty()) {
|
||||||
// Need another round trip
|
// Need another round trip
|
||||||
if (reason == "breakpoint-hit") {
|
if (reason == "breakpoint-hit") {
|
||||||
|
q->showStatusMessage(tr("Stopped at breakpoint."), -1);
|
||||||
GdbMi frame = data.findChild("frame");
|
GdbMi frame = data.findChild("frame");
|
||||||
//qDebug() << frame.toString();
|
//qDebug() << frame.toString();
|
||||||
m_currentFrame = frame.findChild("addr").data() + '%' +
|
m_currentFrame = frame.findChild("addr").data() + '%' +
|
||||||
@@ -1282,6 +1283,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data)
|
|||||||
QVariant var = QVariant::fromValue<GdbMi>(data);
|
QVariant var = QVariant::fromValue<GdbMi>(data);
|
||||||
sendCommand("p 0", GdbAsyncOutput2, var); // dummy
|
sendCommand("p 0", GdbAsyncOutput2, var); // dummy
|
||||||
} else {
|
} else {
|
||||||
|
q->showStatusMessage(tr("Stopped. %1").arg(reason), -1);
|
||||||
handleAsyncOutput2(data);
|
handleAsyncOutput2(data);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@@ -320,6 +320,51 @@ static WatchData take(const QString &iname, QList<WatchData> *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static QList<WatchData> initialSet()
|
||||||
|
{
|
||||||
|
QList<WatchData> result;
|
||||||
|
|
||||||
|
WatchData root;
|
||||||
|
root.state = 0;
|
||||||
|
root.level = 0;
|
||||||
|
root.row = 0;
|
||||||
|
root.name = "Root";
|
||||||
|
root.parentIndex = -1;
|
||||||
|
root.childIndex.append(1);
|
||||||
|
root.childIndex.append(2);
|
||||||
|
root.childIndex.append(3);
|
||||||
|
result.append(root);
|
||||||
|
|
||||||
|
WatchData local;
|
||||||
|
local.iname = "local";
|
||||||
|
local.name = "Locals";
|
||||||
|
local.state = 0;
|
||||||
|
local.level = 1;
|
||||||
|
local.row = 0;
|
||||||
|
local.parentIndex = 0;
|
||||||
|
result.append(local);
|
||||||
|
|
||||||
|
WatchData tooltip;
|
||||||
|
tooltip.iname = "tooltip";
|
||||||
|
tooltip.name = "Tooltip";
|
||||||
|
tooltip.state = 0;
|
||||||
|
tooltip.level = 1;
|
||||||
|
tooltip.row = 1;
|
||||||
|
tooltip.parentIndex = 0;
|
||||||
|
result.append(tooltip);
|
||||||
|
|
||||||
|
WatchData watch;
|
||||||
|
watch.iname = "watch";
|
||||||
|
watch.name = "Watchers";
|
||||||
|
watch.state = 0;
|
||||||
|
watch.level = 1;
|
||||||
|
watch.row = 2;
|
||||||
|
watch.parentIndex = 0;
|
||||||
|
result.append(watch);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// WatchHandler
|
// WatchHandler
|
||||||
@@ -332,7 +377,8 @@ WatchHandler::WatchHandler()
|
|||||||
m_inFetchMore = false;
|
m_inFetchMore = false;
|
||||||
m_inChange = false;
|
m_inChange = false;
|
||||||
|
|
||||||
cleanModel();
|
m_completeSet = initialSet();
|
||||||
|
m_incompleteSet.clear();
|
||||||
m_displaySet = m_completeSet;
|
m_displaySet = m_completeSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +426,7 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
|
|||||||
int node = idx.internalId();
|
int node = idx.internalId();
|
||||||
if (node < 0)
|
if (node < 0)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
QWB_ASSERT(node < m_displaySet.size(), return QVariant());
|
||||||
|
|
||||||
const WatchData &data = m_displaySet.at(node);
|
const WatchData &data = m_displaySet.at(node);
|
||||||
|
|
||||||
@@ -441,6 +488,13 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
|
|||||||
case VisualRole:
|
case VisualRole:
|
||||||
return m_displayedINames.contains(data.iname);
|
return m_displayedINames.contains(data.iname);
|
||||||
|
|
||||||
|
case ExpandedRole:
|
||||||
|
//qDebug() << " FETCHING: " << data.iname
|
||||||
|
// << m_expandedINames.contains(data.iname)
|
||||||
|
// << m_expandedINames;
|
||||||
|
// Level 0 and 1 are always expanded
|
||||||
|
return node < 4 || m_expandedINames.contains(data.iname);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -558,10 +612,13 @@ void WatchHandler::rebuildModel()
|
|||||||
MODEL_DEBUG("RECREATE MODEL, CURRENT SET:\n" << toString());
|
MODEL_DEBUG("RECREATE MODEL, CURRENT SET:\n" << toString());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QHash<QString, int> oldTopINames;
|
||||||
QHash<QString, QString> oldValues;
|
QHash<QString, QString> oldValues;
|
||||||
for (int i = 0, n = m_oldSet.size(); i != n; ++i) {
|
for (int i = 0, n = m_oldSet.size(); i != n; ++i) {
|
||||||
WatchData &data = m_oldSet[i];
|
WatchData &data = m_oldSet[i];
|
||||||
oldValues[data.iname] = data.value;
|
oldValues[data.iname] = data.value;
|
||||||
|
if (data.level == 2)
|
||||||
|
++oldTopINames[data.iname];
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_PENDING
|
#ifdef DEBUG_PENDING
|
||||||
MODEL_DEBUG("OLD VALUES: " << oldValues);
|
MODEL_DEBUG("OLD VALUES: " << oldValues);
|
||||||
@@ -575,6 +632,9 @@ void WatchHandler::rebuildModel()
|
|||||||
|
|
||||||
qSort(m_completeSet.begin(), m_completeSet.end(), &iNameSorter);
|
qSort(m_completeSet.begin(), m_completeSet.end(), &iNameSorter);
|
||||||
|
|
||||||
|
// This helps to decide whether the view has completely changed or not.
|
||||||
|
QHash<QString, int> topINames;
|
||||||
|
|
||||||
QHash<QString, int> iname2idx;
|
QHash<QString, int> iname2idx;
|
||||||
|
|
||||||
for (int i = m_completeSet.size(); --i > 0; ) {
|
for (int i = m_completeSet.size(); --i > 0; ) {
|
||||||
@@ -582,7 +642,10 @@ void WatchHandler::rebuildModel()
|
|||||||
data.parentIndex = 0;
|
data.parentIndex = 0;
|
||||||
data.childIndex.clear();
|
data.childIndex.clear();
|
||||||
iname2idx[data.iname] = i;
|
iname2idx[data.iname] = i;
|
||||||
|
if (data.level == 2)
|
||||||
|
++topINames[data.iname];
|
||||||
}
|
}
|
||||||
|
//qDebug() << "TOPINAMES: " << topINames << "\nOLD: " << oldTopINames;
|
||||||
|
|
||||||
for (int i = 1; i < m_completeSet.size(); ++i) {
|
for (int i = 1; i < m_completeSet.size(); ++i) {
|
||||||
WatchData &data = m_completeSet[i];
|
WatchData &data = m_completeSet[i];
|
||||||
@@ -603,7 +666,13 @@ void WatchHandler::rebuildModel()
|
|||||||
&& data.value != strNotInScope;
|
&& data.value != strNotInScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
//emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
|
|
||||||
|
if (oldTopINames != topINames) {
|
||||||
|
m_displaySet = initialSet();
|
||||||
|
m_expandedINames.clear();
|
||||||
|
emit reset();
|
||||||
|
}
|
||||||
|
|
||||||
m_displaySet = m_completeSet;
|
m_displaySet = m_completeSet;
|
||||||
|
|
||||||
@@ -668,11 +737,6 @@ void WatchHandler::rebuildModel()
|
|||||||
emit reset();
|
emit reset();
|
||||||
//qDebug() << "WATCHHANDLER: RESET EMITTED";
|
//qDebug() << "WATCHHANDLER: RESET EMITTED";
|
||||||
m_inChange = false;
|
m_inChange = false;
|
||||||
//emit layoutChanged();
|
|
||||||
//QSet<QString> einames = m_expandedINames;
|
|
||||||
//einames.insert("local");
|
|
||||||
//einames.insert("watch");
|
|
||||||
//emit expandedItems(einames);
|
|
||||||
|
|
||||||
#if DEBUG_MODEL
|
#if DEBUG_MODEL
|
||||||
#if USE_MODEL_TEST
|
#if USE_MODEL_TEST
|
||||||
@@ -691,8 +755,11 @@ void WatchHandler::cleanup()
|
|||||||
m_oldSet.clear();
|
m_oldSet.clear();
|
||||||
m_expandedINames.clear();
|
m_expandedINames.clear();
|
||||||
m_displayedINames.clear();
|
m_displayedINames.clear();
|
||||||
cleanModel();
|
|
||||||
|
m_incompleteSet.clear();
|
||||||
|
m_completeSet = initialSet();
|
||||||
m_displaySet = m_completeSet;
|
m_displaySet = m_completeSet;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
for (EditWindows::ConstIterator it = m_editWindows.begin();
|
for (EditWindows::ConstIterator it = m_editWindows.begin();
|
||||||
it != m_editWindows.end(); ++it) {
|
it != m_editWindows.end(); ++it) {
|
||||||
@@ -707,7 +774,7 @@ void WatchHandler::cleanup()
|
|||||||
void WatchHandler::collapseChildren(const QModelIndex &idx)
|
void WatchHandler::collapseChildren(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
if (m_inChange || m_completeSet.isEmpty()) {
|
if (m_inChange || m_completeSet.isEmpty()) {
|
||||||
//qDebug() << "WATCHHANDLER: COLLAPSE IGNORED" << idx;
|
qDebug() << "WATCHHANDLER: COLLAPSE IGNORED" << idx;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QWB_ASSERT(checkIndex(idx.internalId()), return);
|
QWB_ASSERT(checkIndex(idx.internalId()), return);
|
||||||
@@ -879,56 +946,10 @@ void WatchHandler::removeWatchExpression(const QString &iname)
|
|||||||
emit watchModelUpdateRequested();
|
emit watchModelUpdateRequested();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::cleanModel()
|
|
||||||
{
|
|
||||||
// This uses data stored in m_oldSet to re-create a new set
|
|
||||||
// one-by-one
|
|
||||||
m_completeSet.clear();
|
|
||||||
m_incompleteSet.clear();
|
|
||||||
|
|
||||||
WatchData root;
|
|
||||||
root.state = 0;
|
|
||||||
root.level = 0;
|
|
||||||
root.row = 0;
|
|
||||||
root.name = "Root";
|
|
||||||
root.parentIndex = -1;
|
|
||||||
root.childIndex.append(1);
|
|
||||||
root.childIndex.append(2);
|
|
||||||
root.childIndex.append(3);
|
|
||||||
m_completeSet.append(root);
|
|
||||||
|
|
||||||
WatchData local;
|
|
||||||
local.iname = "local";
|
|
||||||
local.name = "Locals";
|
|
||||||
local.state = 0;
|
|
||||||
local.level = 1;
|
|
||||||
local.row = 0;
|
|
||||||
local.parentIndex = 0;
|
|
||||||
m_completeSet.append(local);
|
|
||||||
|
|
||||||
WatchData tooltip;
|
|
||||||
tooltip.iname = "tooltip";
|
|
||||||
tooltip.name = "Tooltip";
|
|
||||||
tooltip.state = 0;
|
|
||||||
tooltip.level = 1;
|
|
||||||
tooltip.row = 1;
|
|
||||||
tooltip.parentIndex = 0;
|
|
||||||
m_completeSet.append(tooltip);
|
|
||||||
|
|
||||||
WatchData watch;
|
|
||||||
watch.iname = "watch";
|
|
||||||
watch.name = "Watchers";
|
|
||||||
watch.state = 0;
|
|
||||||
watch.level = 1;
|
|
||||||
watch.row = 2;
|
|
||||||
watch.parentIndex = 0;
|
|
||||||
m_completeSet.append(watch);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void WatchHandler::reinitializeWatchers()
|
void WatchHandler::reinitializeWatchers()
|
||||||
{
|
{
|
||||||
cleanModel();
|
m_completeSet = initialSet();
|
||||||
|
m_incompleteSet.clear();
|
||||||
|
|
||||||
// copy over all watchers and mark all watchers as incomplete
|
// copy over all watchers and mark all watchers as incomplete
|
||||||
for (int i = 0, n = m_oldSet.size(); i < n; ++i) {
|
for (int i = 0, n = m_oldSet.size(); i < n; ++i) {
|
||||||
|
@@ -135,7 +135,7 @@ public:
|
|||||||
bool changed;
|
bool changed;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum { INameRole = Qt::UserRole, VisualRole };
|
enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
|
||||||
|
|
||||||
|
|
||||||
class WatchHandler : public QAbstractItemModel
|
class WatchHandler : public QAbstractItemModel
|
||||||
@@ -192,7 +192,6 @@ signals:
|
|||||||
private:
|
private:
|
||||||
WatchData takeData(const QString &iname);
|
WatchData takeData(const QString &iname);
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
void cleanModel();
|
|
||||||
|
|
||||||
bool m_expandPointers;
|
bool m_expandPointers;
|
||||||
bool m_inChange;
|
bool m_inChange;
|
||||||
|
@@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
using namespace Debugger::Internal;
|
using namespace Debugger::Internal;
|
||||||
|
|
||||||
enum { INameRole = Qt::UserRole, VisualRole };
|
enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
@@ -57,7 +57,6 @@ enum { INameRole = Qt::UserRole, VisualRole };
|
|||||||
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
WatchWindow::WatchWindow(Type type, QWidget *parent)
|
||||||
: QTreeView(parent), m_type(type)
|
: QTreeView(parent), m_type(type)
|
||||||
{
|
{
|
||||||
m_blocked = false;
|
|
||||||
setWindowTitle(tr("Locals and Watchers"));
|
setWindowTitle(tr("Locals and Watchers"));
|
||||||
setAlternatingRowColors(true);
|
setAlternatingRowColors(true);
|
||||||
setIndentation(indentation() * 9/10);
|
setIndentation(indentation() * 9/10);
|
||||||
@@ -76,12 +75,6 @@ void WatchWindow::expandNode(const QModelIndex &idx)
|
|||||||
//QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
//QModelIndex mi0 = idx.sibling(idx.row(), 0);
|
||||||
//QString iname = model()->data(mi0, INameRole).toString();
|
//QString iname = model()->data(mi0, INameRole).toString();
|
||||||
//QString name = model()->data(mi0, Qt::DisplayRole).toString();
|
//QString name = model()->data(mi0, Qt::DisplayRole).toString();
|
||||||
//qDebug() << "\n\nEXPAND NODE " // << iname << name
|
|
||||||
// << idx << (m_blocked ? "blocked" : "passed");
|
|
||||||
//if (isExpanded(idx))
|
|
||||||
// return;
|
|
||||||
//if (m_blocked)
|
|
||||||
// return;
|
|
||||||
emit requestExpandChildren(idx);
|
emit requestExpandChildren(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,8 +84,6 @@ void WatchWindow::collapseNode(const QModelIndex &idx)
|
|||||||
//QString iname = model()->data(mi0, INameRole).toString();
|
//QString iname = model()->data(mi0, INameRole).toString();
|
||||||
//QString name = model()->data(mi0, Qt::DisplayRole).toString();
|
//QString name = model()->data(mi0, Qt::DisplayRole).toString();
|
||||||
//qDebug() << "COLLAPSE NODE " << idx;
|
//qDebug() << "COLLAPSE NODE " << idx;
|
||||||
if (m_blocked)
|
|
||||||
return;
|
|
||||||
emit requestCollapseChildren(idx);
|
emit requestCollapseChildren(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,6 +172,7 @@ void WatchWindow::reset()
|
|||||||
QTreeView::reset();
|
QTreeView::reset();
|
||||||
setRootIndex(model()->index(row, 0, model()->index(0, 0)));
|
setRootIndex(model()->index(row, 0, model()->index(0, 0)));
|
||||||
//setRootIndex(model()->index(0, 0));
|
//setRootIndex(model()->index(0, 0));
|
||||||
|
resetHelper(model()->index(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::setModel(QAbstractItemModel *model)
|
void WatchWindow::setModel(QAbstractItemModel *model)
|
||||||
@@ -192,55 +184,15 @@ void WatchWindow::setModel(QAbstractItemModel *model)
|
|||||||
header()->setResizeMode(QHeaderView::ResizeToContents);
|
header()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
if (m_type != LocalsType)
|
if (m_type != LocalsType)
|
||||||
header()->hide();
|
header()->hide();
|
||||||
|
|
||||||
connect(model, SIGNAL(modelAboutToBeReset()),
|
|
||||||
this, SLOT(modelAboutToBeReset()));
|
|
||||||
connect(model, SIGNAL(modelReset()),
|
|
||||||
this, SLOT(modelReset()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchWindow::modelAboutToBeReset()
|
void WatchWindow::resetHelper(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
m_blocked = true;
|
if (model()->data(idx, ExpandedRole).toBool()) {
|
||||||
//qDebug() << "Model about to be reset";
|
|
||||||
m_expandedItems.clear();
|
|
||||||
m_expandedItems.insert("local");
|
|
||||||
m_expandedItems.insert("watch");
|
|
||||||
modelAboutToBeResetHelper(model()->index(0, 0));
|
|
||||||
//qDebug() << " expanded: " << m_expandedItems;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WatchWindow::modelAboutToBeResetHelper(const QModelIndex &idx)
|
|
||||||
{
|
|
||||||
QString iname = model()->data(idx, INameRole).toString();
|
|
||||||
//qDebug() << "Model about to be reset helper" << iname << idx
|
|
||||||
// << isExpanded(idx);
|
|
||||||
if (isExpanded(idx))
|
|
||||||
m_expandedItems.insert(iname);
|
|
||||||
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
|
||||||
QModelIndex idx1 = model()->index(i, 0, idx);
|
|
||||||
modelAboutToBeResetHelper(idx1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void WatchWindow::modelReset()
|
|
||||||
{
|
|
||||||
//qDebug() << "Model reset";
|
|
||||||
expand(model()->index(0, 0));
|
|
||||||
modelResetHelper(model()->index(0, 0));
|
|
||||||
m_blocked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WatchWindow::modelResetHelper(const QModelIndex &idx)
|
|
||||||
{
|
|
||||||
QString name = model()->data(idx, Qt::DisplayRole).toString();
|
|
||||||
QString iname = model()->data(idx, INameRole).toString();
|
|
||||||
//qDebug() << "Model reset helper" << iname << name;
|
|
||||||
if (m_expandedItems.contains(iname)) {
|
|
||||||
expand(idx);
|
expand(idx);
|
||||||
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
for (int i = 0, n = model()->rowCount(idx); i != n; ++i) {
|
||||||
QModelIndex idx1 = model()->index(i, 0, idx);
|
QModelIndex idx1 = model()->index(i, 0, idx);
|
||||||
modelResetHelper(idx1);
|
resetHelper(idx1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -72,21 +72,16 @@ private slots:
|
|||||||
void handleChangedItem(QWidget *);
|
void handleChangedItem(QWidget *);
|
||||||
void expandNode(const QModelIndex &index);
|
void expandNode(const QModelIndex &index);
|
||||||
void collapseNode(const QModelIndex &index);
|
void collapseNode(const QModelIndex &index);
|
||||||
void modelAboutToBeReset();
|
|
||||||
void modelReset();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
void editItem(const QModelIndex &idx);
|
void editItem(const QModelIndex &idx);
|
||||||
void reset(); /* reimpl */
|
void reset(); /* reimpl */
|
||||||
|
|
||||||
void modelAboutToBeResetHelper(const QModelIndex &idx);
|
void resetHelper(const QModelIndex &idx);
|
||||||
void modelResetHelper(const QModelIndex &idx);
|
|
||||||
|
|
||||||
bool m_alwaysResizeColumnsToContents;
|
bool m_alwaysResizeColumnsToContents;
|
||||||
Type m_type;
|
Type m_type;
|
||||||
bool m_blocked;
|
|
||||||
QSet<QString> m_expandedItems;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
<plugin name="ScmGit" version="0.1" compatVersion="0.1">
|
<plugin name="ScmGit" version="0.9.1" compatVersion="0.9.1">
|
||||||
<vendor>Nokia Corporation</vendor>
|
<vendor>Nokia Corporation</vendor>
|
||||||
<copyright>(C) 2008 Nokia Corporation</copyright>
|
<copyright>(C) 2008 Nokia Corporation</copyright>
|
||||||
<license>Nokia Technology Preview License Agreement</license>
|
<license>Nokia Technology Preview License Agreement</license>
|
||||||
|
@@ -39,18 +39,20 @@
|
|||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
|
||||||
using namespace Perforce::Internal;
|
using namespace Perforce::Internal;
|
||||||
|
using namespace Core::Utils;
|
||||||
|
|
||||||
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
connect(m_ui.browseButton, SIGNAL(clicked()), this, SLOT(browseForCommand()));
|
m_ui.pathChooser->setPromptDialogTitle(tr("Perforce Command"));
|
||||||
|
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforceSettings SettingsPageWidget::settings() const
|
PerforceSettings SettingsPageWidget::settings() const
|
||||||
{
|
{
|
||||||
PerforceSettings rc;
|
PerforceSettings rc;
|
||||||
rc.p4Command = m_ui.p4CmdLineEdit->text();
|
rc.p4Command = m_ui.pathChooser->path();
|
||||||
rc.defaultEnv = m_ui.defaultCheckBox->isChecked();
|
rc.defaultEnv = m_ui.defaultCheckBox->isChecked();
|
||||||
rc.p4Port = m_ui.portLineEdit->text();
|
rc.p4Port = m_ui.portLineEdit->text();
|
||||||
rc.p4Client = m_ui.clientLineEdit->text();
|
rc.p4Client = m_ui.clientLineEdit->text();
|
||||||
@@ -60,21 +62,13 @@ PerforceSettings SettingsPageWidget::settings() const
|
|||||||
|
|
||||||
void SettingsPageWidget::setSettings(const PerforceSettings &s)
|
void SettingsPageWidget::setSettings(const PerforceSettings &s)
|
||||||
{
|
{
|
||||||
m_ui.p4CmdLineEdit->setText(s.p4Command);
|
m_ui.pathChooser->setPath(s.p4Command);
|
||||||
m_ui.defaultCheckBox->setChecked(s.defaultEnv);
|
m_ui.defaultCheckBox->setChecked(s.defaultEnv);
|
||||||
m_ui.portLineEdit->setText(s.p4Port);
|
m_ui.portLineEdit->setText(s.p4Port);
|
||||||
m_ui.clientLineEdit->setText(s.p4Client);
|
m_ui.clientLineEdit->setText(s.p4Client);
|
||||||
m_ui.userLineEdit->setText(s.p4User);
|
m_ui.userLineEdit->setText(s.p4User);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageWidget::browseForCommand()
|
|
||||||
{
|
|
||||||
const QString cmd = QFileDialog::getOpenFileName(window(), tr("Perforce Command"));
|
|
||||||
if (!cmd.isEmpty())
|
|
||||||
m_ui.p4CmdLineEdit->setText(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SettingsPage::SettingsPage()
|
SettingsPage::SettingsPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -54,9 +54,6 @@ public:
|
|||||||
PerforceSettings settings() const;
|
PerforceSettings settings() const;
|
||||||
void setSettings(const PerforceSettings &);
|
void setSettings(const PerforceSettings &);
|
||||||
|
|
||||||
private slots:;
|
|
||||||
void browseForCommand();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsPage m_ui;
|
Ui::SettingsPage m_ui;
|
||||||
};
|
};
|
||||||
|
@@ -36,14 +36,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="p4CmdLineEdit"/>
|
<widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="browseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -120,11 +113,18 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>Core::Utils::PathChooser</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">utils/pathchooser.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>portLineEdit</tabstop>
|
<tabstop>portLineEdit</tabstop>
|
||||||
<tabstop>clientLineEdit</tabstop>
|
<tabstop>clientLineEdit</tabstop>
|
||||||
<tabstop>userLineEdit</tabstop>
|
<tabstop>userLineEdit</tabstop>
|
||||||
<tabstop>p4CmdLineEdit</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
@@ -483,23 +483,27 @@ void Qt4Project::updateCodeModel()
|
|||||||
files += m_projectFiles->files[SourceType];
|
files += m_projectFiles->files[SourceType];
|
||||||
files += m_projectFiles->generatedFiles[SourceType];
|
files += m_projectFiles->generatedFiles[SourceType];
|
||||||
|
|
||||||
CppTools::CppModelManagerInterface::ProjectInfo *pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
|
|
||||||
if (pinfo->defines == predefinedMacros &&
|
if (pinfo.defines == predefinedMacros &&
|
||||||
pinfo->includePaths == allIncludePaths &&
|
pinfo.includePaths == allIncludePaths &&
|
||||||
pinfo->frameworkPaths == allFrameworkPaths &&
|
pinfo.frameworkPaths == allFrameworkPaths &&
|
||||||
pinfo->sourceFiles == files) {
|
pinfo.sourceFiles == files) {
|
||||||
// Nothing to update...
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
} else {
|
} else {
|
||||||
pinfo->defines = predefinedMacros;
|
pinfo.defines = predefinedMacros;
|
||||||
// pinfo->defines += definedMacros; // ### FIXME: me
|
// pinfo->defines += definedMacros; // ### FIXME: me
|
||||||
pinfo->includePaths = allIncludePaths;
|
pinfo.includePaths = allIncludePaths;
|
||||||
pinfo->frameworkPaths = allFrameworkPaths;
|
pinfo.frameworkPaths = allFrameworkPaths;
|
||||||
pinfo->sourceFiles = files;
|
pinfo.sourceFiles = files;
|
||||||
|
|
||||||
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
|
|
||||||
modelmanager->GC();
|
modelmanager->GC();
|
||||||
modelmanager->updateSourceFiles(pinfo->sourceFiles);
|
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update info
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -969,7 +969,7 @@ void QtVersion::updateVersionInfo() const
|
|||||||
QString line = stream.readLine();
|
QString line = stream.readLine();
|
||||||
int index = line.indexOf(":");
|
int index = line.indexOf(":");
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
m_versionInfo.insert(line.left(index), line.mid(index+1));
|
m_versionInfo.insert(line.left(index), QDir::fromNativeSeparators(line.mid(index+1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,6 +1041,7 @@ void QtVersion::updateMkSpec() const
|
|||||||
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
|
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
|
||||||
// else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
|
// else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
|
||||||
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
|
// mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
|
||||||
|
// mkspec = QDir::fromNativeSeparators(mkspec);
|
||||||
// }
|
// }
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
@@ -1107,7 +1108,8 @@ void QtVersion::updateMkSpec() const
|
|||||||
int index = mkspec.lastIndexOf('/');
|
int index = mkspec.lastIndexOf('/');
|
||||||
if(index == -1)
|
if(index == -1)
|
||||||
index = mkspec.lastIndexOf('\\');
|
index = mkspec.lastIndexOf('\\');
|
||||||
if (index >= 0 && QDir(mkspec.left(index)).canonicalPath() == QDir(m_path + "/mkspecs/").canonicalPath())
|
QString mkspecDir = QDir(m_path + "/mkspecs/").canonicalPath();
|
||||||
|
if (index >= 0 && QDir(mkspec.left(index)).canonicalPath() == mkspecDir)
|
||||||
mkspec = mkspec.mid(index+1).trimmed();
|
mkspec = mkspec.mid(index+1).trimmed();
|
||||||
|
|
||||||
m_mkspec = mkspec;
|
m_mkspec = mkspec;
|
||||||
@@ -1119,7 +1121,7 @@ QString QtVersion::makeCommand() const
|
|||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
const QString &spec = mkspec();
|
const QString &spec = mkspec();
|
||||||
if (spec.startsWith("win32-msvc") || spec == QLatin1String("win32-icc"))
|
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
||||||
return "nmake.exe";
|
return "nmake.exe";
|
||||||
else if(spec.startsWith("wince"))
|
else if(spec.startsWith("wince"))
|
||||||
return "nmake.exe";
|
return "nmake.exe";
|
||||||
@@ -1156,7 +1158,7 @@ QtVersion::ToolchainType QtVersion::toolchainType() const
|
|||||||
if (!isValid())
|
if (!isValid())
|
||||||
return INVALID;
|
return INVALID;
|
||||||
const QString &spec = mkspec();
|
const QString &spec = mkspec();
|
||||||
if(spec.startsWith("win32-msvc") || spec == QLatin1String("win32-icc"))
|
if(spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
||||||
return MSVC;
|
return MSVC;
|
||||||
else if(spec == "win32-g++")
|
else if(spec == "win32-g++")
|
||||||
return MinGW;
|
return MinGW;
|
||||||
|
@@ -39,20 +39,24 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
using namespace Subversion::Internal;
|
using namespace Subversion::Internal;
|
||||||
|
using namespace Core::Utils;
|
||||||
|
|
||||||
|
|
||||||
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
connect(m_ui.browseButton, SIGNAL(clicked()), this, SLOT(browseForCommand()));
|
m_ui.pathChooser->setExpectedKind(PathChooser::Command);
|
||||||
|
m_ui.pathChooser->setPromptDialogTitle(tr("Subversion Command"));
|
||||||
}
|
}
|
||||||
|
|
||||||
SubversionSettings SettingsPageWidget::settings() const
|
SubversionSettings SettingsPageWidget::settings() const
|
||||||
{
|
{
|
||||||
SubversionSettings rc;
|
SubversionSettings rc;
|
||||||
rc.svnCommand = m_ui.svnCmdLineEdit->text();
|
rc.svnCommand = m_ui.pathChooser->path();
|
||||||
rc.useAuthentication = m_ui.userGroupBox->isChecked();
|
rc.useAuthentication = m_ui.userGroupBox->isChecked();
|
||||||
rc.user = m_ui.usernameLineEdit->text();
|
rc.user = m_ui.usernameLineEdit->text();
|
||||||
rc.password = m_ui.passwordLineEdit->text();
|
rc.password = m_ui.passwordLineEdit->text();
|
||||||
@@ -63,19 +67,12 @@ SubversionSettings SettingsPageWidget::settings() const
|
|||||||
|
|
||||||
void SettingsPageWidget::setSettings(const SubversionSettings &s)
|
void SettingsPageWidget::setSettings(const SubversionSettings &s)
|
||||||
{
|
{
|
||||||
m_ui.svnCmdLineEdit->setText(s.svnCommand);
|
m_ui.pathChooser->setPath(s.svnCommand);
|
||||||
m_ui.usernameLineEdit->setText(s.user);
|
m_ui.usernameLineEdit->setText(s.user);
|
||||||
m_ui.passwordLineEdit->setText(s.password);
|
m_ui.passwordLineEdit->setText(s.password);
|
||||||
m_ui.userGroupBox->setChecked(s.useAuthentication);
|
m_ui.userGroupBox->setChecked(s.useAuthentication);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsPageWidget::browseForCommand()
|
|
||||||
{
|
|
||||||
QString cmd = QFileDialog::getOpenFileName(window(), tr("Subversion Command"));
|
|
||||||
if (!cmd.isEmpty())
|
|
||||||
m_ui.svnCmdLineEdit->setText(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
SettingsPage::SettingsPage()
|
SettingsPage::SettingsPage()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -59,9 +59,6 @@ public:
|
|||||||
SubversionSettings settings() const;
|
SubversionSettings settings() const;
|
||||||
void setSettings(const SubversionSettings &);
|
void setSettings(const SubversionSettings &);
|
||||||
|
|
||||||
private slots:;
|
|
||||||
void browseForCommand();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SettingsPage m_ui;
|
Ui::SettingsPage m_ui;
|
||||||
};
|
};
|
||||||
|
@@ -32,14 +32,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="svnCmdLineEdit"/>
|
<widget class="Core::Utils::PathChooser" name="pathChooser" native="true"/>
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="browseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -109,9 +102,14 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<customwidgets>
|
||||||
<tabstop>svnCmdLineEdit</tabstop>
|
<customwidget>
|
||||||
</tabstops>
|
<class>Core::Utils::PathChooser</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">utils/pathchooser.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
@@ -602,29 +602,44 @@ void BaseTextEditor::slotSelectionChanged()
|
|||||||
void BaseTextEditor::gotoBlockStart()
|
void BaseTextEditor::gotoBlockStart()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false))
|
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, false)) {
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
|
_q_matchParentheses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::gotoBlockEnd()
|
void BaseTextEditor::gotoBlockEnd()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (TextBlockUserData::findNextClosingParenthesis(&cursor, false))
|
if (TextBlockUserData::findNextClosingParenthesis(&cursor, false)) {
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
|
_q_matchParentheses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::gotoBlockStartWithSelection()
|
void BaseTextEditor::gotoBlockStartWithSelection()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, true))
|
if (TextBlockUserData::findPreviousOpenParenthesis(&cursor, true)) {
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
|
_q_matchParentheses();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::gotoBlockEndWithSelection()
|
void BaseTextEditor::gotoBlockEndWithSelection()
|
||||||
{
|
{
|
||||||
QTextCursor cursor = textCursor();
|
QTextCursor cursor = textCursor();
|
||||||
if (TextBlockUserData::findNextClosingParenthesis(&cursor, true))
|
if (TextBlockUserData::findNextClosingParenthesis(&cursor, true)) {
|
||||||
setTextCursor(cursor);
|
setTextCursor(cursor);
|
||||||
|
_q_matchParentheses();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static QTextCursor flippedCursor(const QTextCursor &cursor) {
|
||||||
|
QTextCursor flipped = cursor;
|
||||||
|
flipped.clearSelection();
|
||||||
|
flipped.setPosition(cursor.anchor(), QTextCursor::KeepAnchor);
|
||||||
|
return flipped;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::selectBlockUp()
|
void BaseTextEditor::selectBlockUp()
|
||||||
@@ -640,7 +655,8 @@ void BaseTextEditor::selectBlockUp()
|
|||||||
return;
|
return;
|
||||||
if (!TextBlockUserData::findNextClosingParenthesis(&cursor, true))
|
if (!TextBlockUserData::findNextClosingParenthesis(&cursor, true))
|
||||||
return;
|
return;
|
||||||
setTextCursor(cursor);
|
setTextCursor(flippedCursor(cursor));
|
||||||
|
_q_matchParentheses();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::selectBlockDown()
|
void BaseTextEditor::selectBlockDown()
|
||||||
@@ -663,7 +679,8 @@ void BaseTextEditor::selectBlockDown()
|
|||||||
if ( cursor != d->m_selectBlockAnchor)
|
if ( cursor != d->m_selectBlockAnchor)
|
||||||
TextBlockUserData::findNextClosingParenthesis(&cursor, true);
|
TextBlockUserData::findNextClosingParenthesis(&cursor, true);
|
||||||
|
|
||||||
setTextCursor(cursor);
|
setTextCursor(flippedCursor(cursor));
|
||||||
|
_q_matchParentheses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -351,6 +351,23 @@ void testPlugin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testSet()
|
||||||
|
{
|
||||||
|
QSet<int> hgg0;
|
||||||
|
hgg0.insert(11);
|
||||||
|
hgg0.insert(22);
|
||||||
|
|
||||||
|
QSet<QString> hgg1;
|
||||||
|
hgg1.insert("22.0");
|
||||||
|
|
||||||
|
QObject ob;
|
||||||
|
QSet<QPointer<QObject> > hash;
|
||||||
|
QPointer<QObject> ptr(&ob);
|
||||||
|
//hash.insert(ptr);
|
||||||
|
//hash.insert(ptr);
|
||||||
|
//hash.insert(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
void stringRefTest(const QString &refstring)
|
void stringRefTest(const QString &refstring)
|
||||||
{
|
{
|
||||||
Q_UNUSED(refstring);
|
Q_UNUSED(refstring);
|
||||||
@@ -759,6 +776,7 @@ int main(int argc, char *argv[])
|
|||||||
testImage();
|
testImage();
|
||||||
testMap();
|
testMap();
|
||||||
testString();
|
testString();
|
||||||
|
testSet();
|
||||||
testStringList();
|
testStringList();
|
||||||
testStruct();
|
testStruct();
|
||||||
//testThreads();
|
//testThreads();
|
||||||
@@ -767,8 +785,13 @@ int main(int argc, char *argv[])
|
|||||||
testVariant3();
|
testVariant3();
|
||||||
testVector();
|
testVector();
|
||||||
testVectorOfList();
|
testVectorOfList();
|
||||||
|
|
||||||
|
|
||||||
|
*(int *)0 = 0;
|
||||||
|
|
||||||
testObject(argc, argv);
|
testObject(argc, argv);
|
||||||
|
|
||||||
|
|
||||||
//QColor color(255,128,10);
|
//QColor color(255,128,10);
|
||||||
//QFont font;
|
//QFont font;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user