diff options
author | goro <qtc-committer@nokia.com> | 2008-12-05 18:52:20 +0100 |
---|---|---|
committer | goro <qtc-committer@nokia.com> | 2008-12-05 18:52:20 +0100 |
commit | 8f757bd4d07d9392b9b0eed92d3307f26acc28a7 (patch) | |
tree | 83d2121d1259886deacdd2a85f465cf27ffb7b2e | |
parent | 881610dfd2ee0f8450b3f1aec78c9a5a6ff76b43 (diff) | |
parent | 0d46571eb3b4777abde3921d763551a917955017 (diff) | |
download | qt-creator-8f757bd4d07d9392b9b0eed92d3307f26acc28a7.tar.gz |
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
-rw-r--r-- | bin/gdbmacros/gdbmacros.cpp | 9 | ||||
-rw-r--r-- | shared/help/bookmarkmanager.h | 16 | ||||
-rw-r--r-- | src/app/main.cpp | 4 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.cpp | 11 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarkmanager.h | 25 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarksplugin.cpp | 49 | ||||
-rw-r--r-- | src/plugins/bookmarks/bookmarksplugin.h | 29 | ||||
-rw-r--r-- | src/plugins/coreplugin/editormanager/ieditor.h | 2 | ||||
-rw-r--r-- | src/plugins/cpptools/rpp/pp-fwd.h | 0 | ||||
-rw-r--r-- | src/plugins/cpptools/searchsymbols.h | 2 | ||||
-rw-r--r-- | src/plugins/debugger/debuggeroutputwindow.cpp | 1 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.cpp | 26 | ||||
-rw-r--r-- | src/plugins/debugger/debuggerplugin.h | 8 | ||||
-rw-r--r-- | tests/manual/gdbdebugger/simple/app.cpp | 18 |
14 files changed, 168 insertions, 32 deletions
diff --git a/bin/gdbmacros/gdbmacros.cpp b/bin/gdbmacros/gdbmacros.cpp index 0d6575db5b..05488a8512 100644 --- a/bin/gdbmacros/gdbmacros.cpp +++ b/bin/gdbmacros/gdbmacros.cpp @@ -1674,7 +1674,10 @@ static void qDumpQObjectSignal(QDumper &d) d.beginHash(); P(d, "name", "[" << i << "] slot"); P(d, "type", ""); - P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); + if (conn.receiver) + P(d, "value", conn.receiver->metaObject()->method(conn.method).signature()); + else + P(d, "value", "<invalid receiver>"); P(d, "numchild", "0"); d.endHash(); d.beginHash(); @@ -1866,8 +1869,8 @@ static void qDumpQSet(QDumper &d) d.beginHash(); P(d, "name", "[" << i << "]"); P(d, "type", d.innertype); - P(d, "exp", "(('QHashNode<" << d.innertype - << ",QHashDummyValue>'*)" + P(d, "exp", "(('"NS"QHashNode<" << d.innertype + << ","NS"QHashDummyValue>'*)" << static_cast<const void*>(node) << ")->key" ); d.endHash(); diff --git a/shared/help/bookmarkmanager.h b/shared/help/bookmarkmanager.h index a8afa867e6..c40d8672db 100644 --- a/shared/help/bookmarkmanager.h +++ b/shared/help/bookmarkmanager.h @@ -95,8 +95,10 @@ private: QSortFilterProxyModel *proxyModel; }; -class TreeView : public QTreeView { +class TreeView : public QTreeView +{ Q_OBJECT + public: TreeView(QWidget* parent = 0) : QTreeView(parent) {} void subclassKeyPressEvent(QKeyEvent* event) @@ -159,18 +161,18 @@ class BookmarkManager : public QObject Q_OBJECT public: - BookmarkManager(QHelpEngineCore* helpEngine); + BookmarkManager(QHelpEngineCore *helpEngine); ~BookmarkManager(); - BookmarkModel* treeBookmarkModel(); - BookmarkModel* listBookmarkModel(); + BookmarkModel *treeBookmarkModel(); + BookmarkModel *listBookmarkModel(); void saveBookmarks(); QStringList bookmarkFolders() const; - QModelIndex addNewFolder(const QModelIndex& index); + QModelIndex addNewFolder(const QModelIndex &index); void removeBookmarkItem(QTreeView *treeView, const QModelIndex& index); - void showBookmarkDialog(QWidget* parent, const QString &name, const QString &url); - void addNewBookmark(const QModelIndex& index, const QString &name, const QString &url); + void showBookmarkDialog(QWidget *parent, const QString &name, const QString &url); + void addNewBookmark(const QModelIndex &index, const QString &name, const QString &url); void setupBookmarkModels(); private slots: diff --git a/src/app/main.cpp b/src/app/main.cpp index 68dfa3e3b2..ad61ab0c75 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -212,9 +212,9 @@ int main(int argc, char **argv) pluginManager.setPluginPaths(pluginPaths); const QStringList arguments = app.arguments(); - QMap<QString,QString> foundAppOptions; + QMap<QString, QString> foundAppOptions; if (arguments.size() > 1) { - QMap<QString,bool> appOptions; + QMap<QString, bool> appOptions; appOptions.insert(QLatin1String(HELP_OPTION1), false); appOptions.insert(QLatin1String(HELP_OPTION2), false); appOptions.insert(QLatin1String(HELP_OPTION3), false); diff --git a/src/plugins/bookmarks/bookmarkmanager.cpp b/src/plugins/bookmarks/bookmarkmanager.cpp index 0e8482b6f9..fd4541a01d 100644 --- a/src/plugins/bookmarks/bookmarkmanager.cpp +++ b/src/plugins/bookmarks/bookmarkmanager.cpp @@ -396,11 +396,16 @@ void BookmarkManager::toggleBookmark() if (!editor) return; - const QFileInfo fi(editor->file()->fileName()); - const int editorLine = editor->currentLine(); + toggleBookmark(editor->file()->fileName(), 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 - 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 removeBookmark(mark); return; diff --git a/src/plugins/bookmarks/bookmarkmanager.h b/src/plugins/bookmarks/bookmarkmanager.h index 3b03e32d67..d3a2fc9a32 100644 --- a/src/plugins/bookmarks/bookmarkmanager.h +++ b/src/plugins/bookmarks/bookmarkmanager.h @@ -34,15 +34,15 @@ #ifndef BOOKMARKMANAGER_H #define BOOKMARKMANAGER_H +#include <coreplugin/icontext.h> +#include <coreplugin/inavigationwidgetfactory.h> + #include <QtCore/QAbstractItemModel> -#include <QtGui/QListView> #include <QtCore/QList> +#include <QtGui/QListView> #include <QtGui/QPixmap> #include <QtGui/QStyledItemDelegate> -#include <coreplugin/icontext.h> -#include <coreplugin/inavigationwidgetfactory.h> - namespace ProjectExplorer { class SessionManager; } @@ -89,10 +89,16 @@ public: // this QItemSelectionModel is shared by all views 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: void toggleBookmark(); + void toggleBookmark(const QString &fileName, int lineNumber); void nextInDocument(); void prevInDocument(); void next(); @@ -108,6 +114,7 @@ private slots: void updateActionStatus(); void gotoBookmark(Bookmark *bookmark); void loadBookmarks(); + private: TextEditor::ITextEditor *currentTextEditor() const; ProjectExplorer::SessionManager* sessionManager() const; @@ -120,8 +127,8 @@ private: static QString bookmarkToString(const Bookmark *b); void saveBookmarks(); - typedef QMultiMap<QString, Bookmark*> FileNameBookmarksMap; - typedef QMap<QString, FileNameBookmarksMap*> DirectoryFileBookmarksMap; + typedef QMultiMap<QString, Bookmark *> FileNameBookmarksMap; + typedef QMap<QString, FileNameBookmarksMap *> DirectoryFileBookmarksMap; DirectoryFileBookmarksMap m_bookmarksMap; Core::ICore *m_core; @@ -138,7 +145,7 @@ class BookmarkView : public QListView public: BookmarkView(QWidget *parent = 0); ~BookmarkView(); - void setModel(QAbstractItemModel * model); + void setModel(QAbstractItemModel *model); public slots: void gotoBookmark(const QModelIndex &index); protected slots: @@ -146,7 +153,7 @@ protected slots: void removeAll(); protected: void contextMenuEvent(QContextMenuEvent *event); - void removeBookmark(const QModelIndex& index); + void removeBookmark(const QModelIndex &index); private: BookmarkContext *m_bookmarkContext; QModelIndex m_contextMenuIndex; diff --git a/src/plugins/bookmarks/bookmarksplugin.cpp b/src/plugins/bookmarks/bookmarksplugin.cpp index fa749f7bef..83c8ec397e 100644 --- a/src/plugins/bookmarks/bookmarksplugin.cpp +++ b/src/plugins/bookmarks/bookmarksplugin.cpp @@ -36,17 +36,22 @@ #include "bookmarks_global.h" #include <texteditor/texteditorconstants.h> +#include <texteditor/itexteditor.h> #include <coreplugin/icore.h> +#include <coreplugin/editormanager/ieditor.h> +#include <coreplugin/editormanager/editormanager.h> #include <coreplugin/coreconstants.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/actionmanager/actionmanagerinterface.h> #include <QtCore/qplugin.h> +#include <QtCore/QDebug> + #include <QtGui/QMenu> -#include <QDebug> using namespace Bookmarks::Constants; using namespace Bookmarks::Internal; +using namespace TextEditor; BookmarksPlugin *BookmarksPlugin::m_instance = 0; @@ -159,6 +164,19 @@ bool BookmarksPlugin::initialize(const QStringList & /*arguments*/, QString *) updateActions(m_bookmarkManager->state()); 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; } @@ -169,7 +187,6 @@ BookmarksPlugin::~BookmarksPlugin() void BookmarksPlugin::updateActions(int state) { - const bool hasbm = state >= BookmarkManager::HasBookMarks; const bool hasdocbm = state == BookmarkManager::HasBookmarksInDocument; @@ -182,4 +199,32 @@ void BookmarksPlugin::updateActions(int state) 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) diff --git a/src/plugins/bookmarks/bookmarksplugin.h b/src/plugins/bookmarks/bookmarksplugin.h index a5d919eb97..2a60bb04a3 100644 --- a/src/plugins/bookmarks/bookmarksplugin.h +++ b/src/plugins/bookmarks/bookmarksplugin.h @@ -31,18 +31,26 @@ ** ***************************************************************************/ -#ifndef BOOKMARKS_H -#define BOOKMARKS_H +#ifndef BOOKMARKSPLUGIN_H +#define BOOKMARKSPLUGIN_H + +#include <extensionsystem/iplugin.h> #include <QtCore/QObject> #include <QtCore/QMultiMap> -#include <extensionsystem/iplugin.h> - -QT_FORWARD_DECLARE_CLASS(QAction) +QT_BEGIN_NAMESPACE +class QAction; +class QMenu; +QT_END_NAMESPACE namespace Core { class ICore; +class IEditor; +} + +namespace TextEditor { +class ITextEditor; } namespace Bookmarks { @@ -67,6 +75,13 @@ public: public slots: 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: static BookmarksPlugin *m_instance; BookmarkManager *m_bookmarkManager; @@ -79,6 +94,10 @@ private: QAction *m_docNextAction; QAction *m_moveUpAction; QAction *m_moveDownAction; + + QAction *m_bookmarkMarginAction; + int m_bookmarkMarginActionLineNumber; + QString m_bookmarkMarginActionFileName; }; } // namespace Internal diff --git a/src/plugins/coreplugin/editormanager/ieditor.h b/src/plugins/coreplugin/editormanager/ieditor.h index 7cbac8130f..1f087e67e9 100644 --- a/src/plugins/coreplugin/editormanager/ieditor.h +++ b/src/plugins/coreplugin/editormanager/ieditor.h @@ -100,4 +100,4 @@ signals: } // namespace Core -#endif //IEDITOR_H +#endif // IEDITOR_H diff --git a/src/plugins/cpptools/rpp/pp-fwd.h b/src/plugins/cpptools/rpp/pp-fwd.h new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/src/plugins/cpptools/rpp/pp-fwd.h diff --git a/src/plugins/cpptools/searchsymbols.h b/src/plugins/cpptools/searchsymbols.h index d82f285972..4997e5cf04 100644 --- a/src/plugins/cpptools/searchsymbols.h +++ b/src/plugins/cpptools/searchsymbols.h @@ -44,6 +44,8 @@ #include <QMetaType> #include <QString> +#include <functional> + namespace CppTools { namespace Internal { diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp index 7dc293cf35..cfcd8df36d 100644 --- a/src/plugins/debugger/debuggeroutputwindow.cpp +++ b/src/plugins/debugger/debuggeroutputwindow.cpp @@ -285,6 +285,7 @@ void DebuggerOutputWindow::showOutput(const QString &prefix, const QString &outp void DebuggerOutputWindow::showInput(const QString &prefix, const QString &input) { + Q_UNUSED(prefix); m_inputText->append(input); QTextCursor cursor = m_inputText->textCursor(); cursor.movePosition(QTextCursor::End); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index b11472a524..feb63fa0c3 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -250,6 +250,12 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes 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 = // actionManager->actionContainer(CppEditor::Constants::M_CONTEXT); @@ -502,6 +508,8 @@ void DebuggerPlugin::editorOpened(Core::IEditor *editor) this, SLOT(requestMark(TextEditor::ITextEditor*,int))); connect(editor, SIGNAL(tooltipRequested(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))); disconnect(editor, SIGNAL(tooltipRequested(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) { m_manager->toggleBreakpoint(editor->file()->fileName(), lineNumber); diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 7dfcae1ffe..91ffe4dbf7 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -84,10 +84,14 @@ private slots: void setSessionValue(const QString &name, const QVariant &value); void queryConfigValue(const QString &name, QVariant *value); void setConfigValue(const QString &name, const QVariant &value); + void requestContextMenu(TextEditor::ITextEditor *editor, + int lineNumber, QMenu *menu); void resetLocation(); void gotoLocation(const QString &fileName, int line, bool setMarker); + void breakpointMarginActionTriggered(); + private: friend class DebuggerManager; friend class DebugMode; // FIXME: Just a hack now so that it can access the views @@ -104,6 +108,10 @@ private: QString m_previousMode; LocationMark *m_locationMark; int m_gdbRunningContext; + + QAction *m_breakpointMarginAction; + int m_breakpointMarginActionLineNumber; + QString m_breakpointMarginActionFileName; }; } // namespace Internal diff --git a/tests/manual/gdbdebugger/simple/app.cpp b/tests/manual/gdbdebugger/simple/app.cpp index b00a259457..4a1ec67e7a 100644 --- a/tests/manual/gdbdebugger/simple/app.cpp +++ b/tests/manual/gdbdebugger/simple/app.cpp @@ -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) { Q_UNUSED(refstring); @@ -759,6 +776,7 @@ int main(int argc, char *argv[]) testImage(); testMap(); testString(); + testSet(); testStringList(); testStruct(); //testThreads(); |