From 83c331a7146781f07166e50d6985fcf26d8a5389 Mon Sep 17 00:00:00 2001 From: mae Date: Mon, 23 Mar 2009 18:44:07 +0100 Subject: [PATCH 01/10] track modification changes for restored editors (in the open editors model) --- src/plugins/coreplugin/editormanager/editorview.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index a201e5c9bae..1399269c6a6 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -132,8 +132,7 @@ void EditorModel::addEntry(const Entry &entry) if (previousIndex >= 0) { if (entry.editor && m_editors.at(previousIndex).editor == 0) { m_editors[previousIndex] = entry; - QModelIndex mindex = index(previousIndex, 0); - emit dataChanged(mindex, mindex); + connect(entry.editor, SIGNAL(changed()), this, SLOT(itemChanged())); } return; } From 3dda9cdd0825b042ebbb5f6b9b9b0bb7518b3c54 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 24 Mar 2009 09:41:44 +0100 Subject: [PATCH 02/10] Fix compilation with WebKit disabled. --- src/plugins/coreplugin/welcomemode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index 588bfcb827b..a31e1965b10 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -92,7 +92,9 @@ WelcomeModePrivate::WelcomeModePrivate() : m_projectHtmlTemplate(readFile(QLatin1String(":/core/html/recent_projects.html"))), m_baseUrl(QUrl(QLatin1String("qrc:/core/html/welcome.html"))) { +#if !defined(QT_NO_WEBKIT) m_webview->setContextMenuPolicy(Qt::NoContextMenu); +#endif } #if defined(QT_NO_WEBKIT) From 8344cc68ef21d0056ff199a8957c580f89ec428b Mon Sep 17 00:00:00 2001 From: con Date: Tue, 24 Mar 2009 10:54:05 +0100 Subject: [PATCH 03/10] Correct 64 bit library location for non-g++. Reviewed-by: hjk --- src/qworkbench.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qworkbench.pri b/src/qworkbench.pri index 762713bbb15..2c824c55917 100644 --- a/src/qworkbench.pri +++ b/src/qworkbench.pri @@ -6,7 +6,7 @@ isEmpty(TEST):CONFIG(debug, debug|release) { } } -linux-g++-64 { +linux-*-64 { IDE_LIBRARY_BASENAME = lib64 } else { IDE_LIBRARY_BASENAME = lib From c08405fed4c69fe672bf9a53875eba629a7d4c30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Mon, 23 Mar 2009 17:20:19 +0100 Subject: [PATCH 04/10] Turn code into links when holding Ctrl Allows navigating the code using the mouse when pressing Ctrl. Suggested a few times and also seen in other IDEs. --- src/plugins/cppeditor/cppeditor.cpp | 144 ++++++++++++++++++-------- src/plugins/cppeditor/cppeditor.h | 24 ++++- src/plugins/vcsbase/vcsbaseeditor.cpp | 1 - 3 files changed, 125 insertions(+), 44 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 5b363e291db..1976195c91f 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -370,7 +370,7 @@ void CPPEditor::jumpToMethod(int) if (! symbol) return; - openEditorAt(symbol); + openCppEditorAt(locationForSymbol(symbol)); } void CPPEditor::updateMethodBoxIndex() @@ -579,50 +579,51 @@ void CPPEditor::switchDeclarationDefinition() declaration = symbols.first(); if (declaration) - openEditorAt(declaration); + openCppEditorAt(locationForSymbol(declaration)); } else if (lastSymbol->type()->isFunctionType()) { if (Symbol *def = findDefinition(lastSymbol)) - openEditorAt(def); + openCppEditorAt(locationForSymbol(def)); } } -void CPPEditor::jumpToDefinition() +CPPEditor::Location CPPEditor::findDestinationFor(const QTextCursor &cursor) { + Location dest; + if (!m_modelManager) - return; + return dest; const Snapshot snapshot = m_modelManager->snapshot(); - - // Find the last symbol up to the cursor position int line = 0, column = 0; - convertPosition(position(), &line, &column); + convertPosition(cursor.position(), &line, &column); Document::Ptr doc = snapshot.value(file()->fileName()); if (!doc) - return; + return dest; - QTextCursor tc = textCursor(); - unsigned lineno = tc.blockNumber() + 1; + // Handle include directives + const unsigned lineno = cursor.blockNumber() + 1; foreach (const Document::Include &incl, doc->includes()) { if (incl.line() == lineno) { - if (openCppEditorAt(incl.fileName(), 0, 0)) - return; // done - break; + dest.fileName = incl.fileName(); + return dest; } } + // Find the last symbol up to the cursor position Symbol *lastSymbol = doc->findSymbolAt(line, column); if (!lastSymbol) - return; + return dest; // Get the expression under the cursor - const int endOfName = endOfNameUnderCursor(); + const int endOfName = endOfNameAtPosition(cursor.position()); + QTextCursor tc = cursor; tc.setPosition(endOfName); ExpressionUnderCursor expressionUnderCursor; const QString expression = expressionUnderCursor(tc); // Evaluate the type of the expression TypeOfExpression typeOfExpression; - typeOfExpression.setSnapshot(m_modelManager->snapshot()); + typeOfExpression.setSnapshot(snapshot); QList resolvedSymbols = typeOfExpression(expression, doc, lastSymbol); @@ -633,10 +634,7 @@ void CPPEditor::jumpToDefinition() if (!lastSymbol->isFunction()) def = findDefinition(symbol); - if (def) - openEditorAt(def); - else - openEditorAt(symbol); + return locationForSymbol(def ? def : symbol); // This would jump to the type of a name #if 0 @@ -649,15 +647,23 @@ void CPPEditor::jumpToDefinition() #endif } } else { + // Handle macro uses foreach (const Document::MacroUse use, doc->macroUses()) { if (use.contains(endOfName - 1)) { const Macro ¯o = use.macro(); - const QString fileName = QString::fromUtf8(macro.fileName()); - if (openCppEditorAt(fileName, macro.line(), 0)) - return; // done + dest.fileName = QString::fromUtf8(macro.fileName()); + dest.line = macro.line(); + return dest; } } } + + return dest; +} + +void CPPEditor::jumpToDefinition() +{ + openCppEditorAt(findDestinationFor(textCursor())); } Symbol *CPPEditor::findDefinition(Symbol *symbol) @@ -777,6 +783,55 @@ void CPPEditor::contextMenuEvent(QContextMenuEvent *e) delete menu; } +void CPPEditor::mouseMoveEvent(QMouseEvent *e) +{ + bool hasDestination = false; + Qt::CursorShape cursorShape; + + if (e->modifiers() & Qt::ControlModifier) { + // Link emulation behaviour for 'go to definition' + const QTextCursor cursor = cursorForPosition(e->pos()); + const Location loc = findDestinationFor(cursor); + + if (!loc.fileName.isEmpty()) { + QTextEdit::ExtraSelection sel; + sel.cursor = cursor; + sel.cursor.select(QTextCursor::WordUnderCursor); + sel.format.setFontUnderline(true); + sel.format.setForeground(Qt::blue); + setExtraSelections(OtherSelection, QList() << sel); + hasDestination = true; + cursorShape = Qt::PointingHandCursor; + } + } + + if (!hasDestination) { + setExtraSelections(OtherSelection, QList()); + cursorShape = Qt::IBeamCursor; + } + + TextEditor::BaseTextEditor::mouseMoveEvent(e); + + viewport()->setCursor(cursorShape); +} + +void CPPEditor::mouseReleaseEvent(QMouseEvent *e) +{ + if (e->modifiers() & Qt::ControlModifier && !(e->modifiers() & Qt::ShiftModifier) + && e->button() == Qt::LeftButton) { + + const QTextCursor cursor = cursorForPosition(e->pos()); + if (openCppEditorAt(findDestinationFor(cursor))) { + setExtraSelections(OtherSelection, QList()); + viewport()->setCursor(Qt::IBeamCursor); + e->accept(); + return; + } + } + + TextEditor::BaseTextEditor::mouseReleaseEvent(e); +} + QList CPPEditorEditable::context() const { return m_context; @@ -946,9 +1001,11 @@ void CPPEditor::unCommentSelection() cursor.endEditBlock(); } -int CPPEditor::endOfNameUnderCursor() +int CPPEditor::endOfNameAtPosition(int pos) { - int pos = position(); + if (pos == -1) + pos = position(); + QChar chr = characterAt(pos); // Skip to the start of a name @@ -958,32 +1015,37 @@ int CPPEditor::endOfNameUnderCursor() return pos; } -TextEditor::ITextEditor *CPPEditor::openCppEditorAt(const QString &fileName, - int line, int column) +CPPEditor::Location CPPEditor::locationForSymbol(CPlusPlus::Symbol *symbol) { - return TextEditor::BaseTextEditor::openEditorAt(fileName, line, column, - Constants::C_CPPEDITOR); -} - -bool CPPEditor::openEditorAt(Symbol *s) -{ - const QString fileName = QString::fromUtf8(s->fileName(), s->fileNameLength()); - unsigned line = s->line(); - unsigned column = s->column(); + const QString fileName = QString::fromUtf8(symbol->fileName(), + symbol->fileNameLength()); + unsigned line = symbol->line(); + unsigned column = symbol->column(); if (column) --column; - if (s->isGenerated()) + if (symbol->isGenerated()) column = 0; - if (baseTextDocument()->fileName() == fileName) { + return Location(fileName, line, column); +} + +bool CPPEditor::openCppEditorAt(const Location &loc) +{ + if (loc.fileName.isEmpty()) + return false; + + if (baseTextDocument()->fileName() == loc.fileName) { Core::EditorManager *editorManager = Core::EditorManager::instance(); editorManager->addCurrentPositionToNavigationHistory(); - gotoLine(line, column); + gotoLine(loc.line, loc.column); setFocus(); return true; } - return openCppEditorAt(fileName, line, column); + return TextEditor::BaseTextEditor::openEditorAt(loc.fileName, + loc.line, + loc.column, + Constants::C_CPPEDITOR); } diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 7a91faebf3c..c54b33a0cb0 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -97,6 +97,9 @@ public slots: protected: void contextMenuEvent(QContextMenuEvent *e); + void mouseMoveEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); + TextEditor::BaseTextEditorEditable *createEditableInterface(); // Rertuns true if key triggers anindent. @@ -122,9 +125,26 @@ private: void createToolBar(CPPEditorEditable *editable); - int endOfNameUnderCursor(); + int endOfNameAtPosition(int pos); - bool openEditorAt(CPlusPlus::Symbol *symbol); + struct Location + { + Location(const QString &fileName = QString(), + int line = 0, + int column = 0) + : fileName(fileName) + , line(line) + , column(column) + {} + + QString fileName; + int line; + int column; + }; + + Location findDestinationFor(const QTextCursor &); + static Location locationForSymbol(CPlusPlus::Symbol *symbol); + bool openCppEditorAt(const Location &); CppTools::CppModelManagerInterface *m_modelManager; diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index d185efa9b0a..3675999266e 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -335,7 +335,6 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e) sel.cursor = cursor; sel.cursor.select(QTextCursor::WordUnderCursor); sel.format.setFontUnderline(true); - change = changeUnderCursor(cursor); sel.format.setProperty(QTextFormat::UserProperty, change); setExtraSelections(OtherSelection, QList() << sel); overrideCursor = true; From eebe9e2fc839308554cbdd7681f8fe41935e2947 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 24 Mar 2009 11:12:24 +0100 Subject: [PATCH 05/10] Clear link emulation when Ctrl is released --- src/plugins/cppeditor/cppeditor.cpp | 9 +++++++++ src/plugins/cppeditor/cppeditor.h | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 1976195c91f..9f1e7a8bef5 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -832,6 +832,15 @@ void CPPEditor::mouseReleaseEvent(QMouseEvent *e) TextEditor::BaseTextEditor::mouseReleaseEvent(e); } +void CPPEditor::keyReleaseEvent(QKeyEvent *e) +{ + // Clear link emulation when Ctrl is released + if (e->key() == Qt::Key_Control) { + setExtraSelections(OtherSelection, QList()); + viewport()->setCursor(Qt::IBeamCursor); + } +} + QList CPPEditorEditable::context() const { return m_context; diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index c54b33a0cb0..3414d79f1c6 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -96,9 +96,10 @@ public slots: void deleteEndOfToken(); protected: - void contextMenuEvent(QContextMenuEvent *e); - void mouseMoveEvent(QMouseEvent *e); - void mouseReleaseEvent(QMouseEvent *e); + void contextMenuEvent(QContextMenuEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void keyReleaseEvent(QKeyEvent *); TextEditor::BaseTextEditorEditable *createEditableInterface(); From 1682a41869fd090b4ee1d3f7fc4747225e7368fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 24 Mar 2009 11:13:37 +0100 Subject: [PATCH 06/10] Include position information in the link Allowed customizing the link for includes and macro uses and fix it for highlighting the name. --- src/plugins/cppeditor/cppeditor.cpp | 97 +++++++++++++++++++---------- src/plugins/cppeditor/cppeditor.h | 27 ++++---- 2 files changed, 81 insertions(+), 43 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 9f1e7a8bef5..9990547838a 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -370,7 +370,7 @@ void CPPEditor::jumpToMethod(int) if (! symbol) return; - openCppEditorAt(locationForSymbol(symbol)); + openCppEditorAt(linkToSymbol(symbol)); } void CPPEditor::updateMethodBoxIndex() @@ -579,49 +579,63 @@ void CPPEditor::switchDeclarationDefinition() declaration = symbols.first(); if (declaration) - openCppEditorAt(locationForSymbol(declaration)); + openCppEditorAt(linkToSymbol(declaration)); } else if (lastSymbol->type()->isFunctionType()) { if (Symbol *def = findDefinition(lastSymbol)) - openCppEditorAt(locationForSymbol(def)); + openCppEditorAt(linkToSymbol(def)); } } -CPPEditor::Location CPPEditor::findDestinationFor(const QTextCursor &cursor) +CPPEditor::Link CPPEditor::findLinkAt(const QTextCursor &cursor) { - Location dest; + Link link; if (!m_modelManager) - return dest; + return link; const Snapshot snapshot = m_modelManager->snapshot(); int line = 0, column = 0; convertPosition(cursor.position(), &line, &column); Document::Ptr doc = snapshot.value(file()->fileName()); if (!doc) - return dest; + return link; // Handle include directives const unsigned lineno = cursor.blockNumber() + 1; foreach (const Document::Include &incl, doc->includes()) { if (incl.line() == lineno) { - dest.fileName = incl.fileName(); - return dest; + link.fileName = incl.fileName(); + link.pos = cursor.block().position(); + link.length = cursor.block().length(); + return link; } } // Find the last symbol up to the cursor position Symbol *lastSymbol = doc->findSymbolAt(line, column); if (!lastSymbol) - return dest; + return link; - // Get the expression under the cursor + // Check whether we're at a name const int endOfName = endOfNameAtPosition(cursor.position()); + if (!characterAt(endOfName - 1).isLetterOrNumber()) + return link; + + // Remember the position and length of the name QTextCursor tc = cursor; tc.setPosition(endOfName); + tc.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor); + const int nameStart = tc.position(); + const int nameLength = tc.anchor() - tc.position(); + + // Drop out if we're at a number + if (characterAt(nameStart).isNumber()) + return link; + + // Evaluate the type of the expression under the cursor + tc.setPosition(endOfName); ExpressionUnderCursor expressionUnderCursor; const QString expression = expressionUnderCursor(tc); - - // Evaluate the type of the expression TypeOfExpression typeOfExpression; typeOfExpression.setSnapshot(snapshot); QList resolvedSymbols = @@ -634,7 +648,10 @@ CPPEditor::Location CPPEditor::findDestinationFor(const QTextCursor &cursor) if (!lastSymbol->isFunction()) def = findDefinition(symbol); - return locationForSymbol(def ? def : symbol); + link = linkToSymbol(def ? def : symbol); + link.pos = nameStart; + link.length = nameLength; + return link; // This would jump to the type of a name #if 0 @@ -651,19 +668,21 @@ CPPEditor::Location CPPEditor::findDestinationFor(const QTextCursor &cursor) foreach (const Document::MacroUse use, doc->macroUses()) { if (use.contains(endOfName - 1)) { const Macro ¯o = use.macro(); - dest.fileName = QString::fromUtf8(macro.fileName()); - dest.line = macro.line(); - return dest; + link.fileName = QString::fromUtf8(macro.fileName()); + link.line = macro.line(); + link.pos = use.begin(); + link.length = use.end() - use.begin(); + return link; } } } - return dest; + return link; } void CPPEditor::jumpToDefinition() { - openCppEditorAt(findDestinationFor(textCursor())); + openCppEditorAt(findLinkAt(textCursor())); } Symbol *CPPEditor::findDefinition(Symbol *symbol) @@ -791,12 +810,26 @@ void CPPEditor::mouseMoveEvent(QMouseEvent *e) if (e->modifiers() & Qt::ControlModifier) { // Link emulation behaviour for 'go to definition' const QTextCursor cursor = cursorForPosition(e->pos()); - const Location loc = findDestinationFor(cursor); - if (!loc.fileName.isEmpty()) { + // Check that the mouse was actually on the text somewhere + bool onText = cursorRect(cursor).right() >= e->x(); + if (!onText) { + QTextCursor nextPos = cursor; + nextPos.movePosition(QTextCursor::Right); + onText = cursorRect(nextPos).right() >= e->x(); + } + + const Link link = findLinkAt(cursor); + + if (onText && !link.fileName.isEmpty()) { QTextEdit::ExtraSelection sel; sel.cursor = cursor; - sel.cursor.select(QTextCursor::WordUnderCursor); + if (link.pos >= 0) { + sel.cursor.setPosition(link.pos); + sel.cursor.setPosition(link.pos + link.length, QTextCursor::KeepAnchor); + } else { + sel.cursor.select(QTextCursor::WordUnderCursor); + } sel.format.setFontUnderline(true); sel.format.setForeground(Qt::blue); setExtraSelections(OtherSelection, QList() << sel); @@ -821,7 +854,7 @@ void CPPEditor::mouseReleaseEvent(QMouseEvent *e) && e->button() == Qt::LeftButton) { const QTextCursor cursor = cursorForPosition(e->pos()); - if (openCppEditorAt(findDestinationFor(cursor))) { + if (openCppEditorAt(findLinkAt(cursor))) { setExtraSelections(OtherSelection, QList()); viewport()->setCursor(Qt::IBeamCursor); e->accept(); @@ -1024,7 +1057,7 @@ int CPPEditor::endOfNameAtPosition(int pos) return pos; } -CPPEditor::Location CPPEditor::locationForSymbol(CPlusPlus::Symbol *symbol) +CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol) { const QString fileName = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()); @@ -1037,24 +1070,24 @@ CPPEditor::Location CPPEditor::locationForSymbol(CPlusPlus::Symbol *symbol) if (symbol->isGenerated()) column = 0; - return Location(fileName, line, column); + return Link(fileName, line, column); } -bool CPPEditor::openCppEditorAt(const Location &loc) +bool CPPEditor::openCppEditorAt(const Link &link) { - if (loc.fileName.isEmpty()) + if (link.fileName.isEmpty()) return false; - if (baseTextDocument()->fileName() == loc.fileName) { + if (baseTextDocument()->fileName() == link.fileName) { Core::EditorManager *editorManager = Core::EditorManager::instance(); editorManager->addCurrentPositionToNavigationHistory(); - gotoLine(loc.line, loc.column); + gotoLine(link.line, link.column); setFocus(); return true; } - return TextEditor::BaseTextEditor::openEditorAt(loc.fileName, - loc.line, - loc.column, + return TextEditor::BaseTextEditor::openEditorAt(link.fileName, + link.line, + link.column, Constants::C_CPPEDITOR); } diff --git a/src/plugins/cppeditor/cppeditor.h b/src/plugins/cppeditor/cppeditor.h index 3414d79f1c6..35a46cb0c72 100644 --- a/src/plugins/cppeditor/cppeditor.h +++ b/src/plugins/cppeditor/cppeditor.h @@ -128,24 +128,29 @@ private: int endOfNameAtPosition(int pos); - struct Location + struct Link { - Location(const QString &fileName = QString(), - int line = 0, - int column = 0) - : fileName(fileName) + Link(const QString &fileName = QString(), + int line = 0, + int column = 0) + : pos(-1) + , length(-1) + , fileName(fileName) , line(line) , column(column) {} - QString fileName; - int line; - int column; + int pos; // Link position + int length; // Link length + + QString fileName; // Target file + int line; // Target line + int column; // Target column }; - Location findDestinationFor(const QTextCursor &); - static Location locationForSymbol(CPlusPlus::Symbol *symbol); - bool openCppEditorAt(const Location &); + Link findLinkAt(const QTextCursor &); + static Link linkToSymbol(CPlusPlus::Symbol *symbol); + bool openCppEditorAt(const Link &); CppTools::CppModelManagerInterface *m_modelManager; From 60bb3616208f26d93170c709d4ecd55e31ba9b95 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 24 Mar 2009 12:50:08 +0100 Subject: [PATCH 07/10] debugger: make position of debugger lib configurable --- src/plugins/debugger/debuggeractions.cpp | 35 ++++++------ src/plugins/debugger/debuggeractions.h | 4 +- src/plugins/debugger/gdbengine.cpp | 73 ++++++++++++------------ 3 files changed, 55 insertions(+), 57 deletions(-) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index d1aa6ff33cb..f7edac224f7 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -54,6 +54,7 @@ namespace Internal { DebuggerAction::DebuggerAction(QObject *parent) : QAction(parent) { + m_widget = 0; connect(this, SIGNAL(triggered(bool)), this, SLOT(actionTriggered(bool))); } @@ -126,8 +127,7 @@ QString DebuggerAction::toString() const { return "value: " + m_value.toString() + " defaultvalue: " + m_defaultValue.toString() - + " settingskey: " + m_settingsGroup + '/' + m_settingsKey - + " deferedValue: " + m_deferedValue.toString(); + + " settingskey: " + m_settingsGroup + '/' + m_settingsKey; } QAction *DebuggerAction::updatedAction(const QString &text0) @@ -173,9 +173,9 @@ void DebuggerAction::writeSettings(QSettings *settings) void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode) { using namespace Core::Utils; - //qDebug() << "CONNECT WIDGET " << widget << " TO " << m_settingsKey; - m_applyModes[widget] = applyMode; - m_deferedValue = m_value; + m_widget = widget; + m_applyMode = applyMode; + if (QAbstractButton *button = qobject_cast(widget)) { if (button->isCheckable()) { button->setChecked(m_value.toBool()); @@ -203,9 +203,16 @@ void DebuggerAction::connectWidget(QWidget *widget, ApplyMode applyMode) void DebuggerAction::apply(QSettings *s) { - setValue(m_deferedValue); + using namespace Core::Utils; + if (QAbstractButton *button = qobject_cast(m_widget)) + setValue(button->isChecked()); + else if (QLineEdit *lineEdit = qobject_cast(m_widget)) + setValue(lineEdit->text()); + else if (PathChooser *pathChooser = qobject_cast(m_widget)) + setValue(pathChooser->path()); + m_widget = 0; if (s) - writeSettings(s); + writeSettings(s); } void DebuggerAction::uncheckableButtonClicked() @@ -221,9 +228,7 @@ void DebuggerAction::checkableButtonClicked(bool) QAbstractButton *button = qobject_cast(sender()); QTC_ASSERT(button, return); //qDebug() << "CHECKABLE BUTTON: " << sender(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = button->isChecked(); - else + if (m_applyMode == ImmediateApply) setValue(button->isChecked()); } @@ -232,9 +237,7 @@ void DebuggerAction::lineEditEditingFinished() QLineEdit *lineEdit = qobject_cast(sender()); QTC_ASSERT(lineEdit, return); //qDebug() << "LINEEDIT: " << sender() << lineEdit->text(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = lineEdit->text(); - else + if (m_applyMode == ImmediateApply) setValue(lineEdit->text()); } @@ -244,9 +247,7 @@ void DebuggerAction::pathChooserEditingFinished() PathChooser *pathChooser = qobject_cast(sender()); QTC_ASSERT(pathChooser, return); //qDebug() << "PATHCHOOSER: " << sender() << pathChooser->path(); - if (m_applyModes[sender()] == DeferedApply) - m_deferedValue = pathChooser->path(); - else + if (m_applyMode == ImmediateApply) setValue(pathChooser->path()); } @@ -262,13 +263,13 @@ void DebuggerAction::trigger(const QVariant &data) QAction::trigger(); } + ////////////////////////////////////////////////////////////////////////// // // DebuggerSettings // ////////////////////////////////////////////////////////////////////////// - DebuggerSettings::DebuggerSettings(QObject *parent) : QObject(parent) {} diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index b635840df06..47ccfa96386 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -96,12 +96,12 @@ private: QVariant m_value; QVariant m_defaultValue; - QVariant m_deferedValue; // basically a temporary copy of m_value QString m_settingsKey; QString m_settingsGroup; QString m_textPattern; QString m_textData; - QHash m_applyModes; + QWidget *m_widget; + ApplyMode m_applyMode; }; class DebuggerSettings : public QObject diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c2c18dec377..535276b326c 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -4232,7 +4232,7 @@ void GdbEngine::assignValueInDebugger(const QString &expression, const QString & QString GdbEngine::dumperLibraryName() const { - if (theDebuggerAction(UsePrebuiltDumpers)) + if (theDebuggerAction(UsePrebuiltDumpers)->value().toBool()) return theDebuggerAction(PrebuiltDumpersLocation)->value().toString(); #if defined(Q_OS_WIN) return q->m_buildDir + "/qtc-gdbmacros/debug/gdbmacros.dll"; @@ -4252,48 +4252,45 @@ void GdbEngine::tryLoadCustomDumpers() m_dataDumperState = DataDumperUnavailable; QString lib = dumperLibraryName(); - if (QFileInfo(lib).exists()) { -#if defined(Q_OS_WIN) - m_dataDumperState = DataDumperLoadTried; - sendCommand("sharedlibrary .*"); // for LoadLibraryA - //sendCommand("handle SIGSEGV pass stop print"); - //sendCommand("set unwindonsignal off"); - sendCommand("call LoadLibraryA(\"" + lib + "\")", - WatchDumpCustomSetup); - sendCommand("sharedlibrary " + dotEscape(lib)); -#elif defined(Q_OS_MAC) - m_dataDumperState = DataDumperLoadTried; - //sendCommand("sharedlibrary libc"); // for malloc - //sendCommand("sharedlibrary libdl"); // for dlopen - QString flag = QString::number(RTLD_NOW); - sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); - //sendCommand("sharedlibrary " + dotEscape(lib)); - m_dataDumperState = DataDumperLoadTried; -#else - //sendCommand("p dlopen"); - QString flag = QString::number(RTLD_NOW); - sendCommand("sharedlibrary libc"); // for malloc - sendCommand("sharedlibrary libdl"); // for dlopen - sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); - // some older systems like CentOS 4.6 prefer this: - sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", - WatchDumpCustomSetup); - sendCommand("sharedlibrary " + dotEscape(lib)); -#endif - } - - if (m_dataDumperState == DataDumperLoadTried) { - // retreive list of dumpable classes - sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); - sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); - } else { + if (!QFileInfo(lib).exists()) { debugMessage(QString("DEBUG HELPER LIBRARY IS NOT USABLE: " " %1 EXISTS: %2, EXECUTABLE: %3").arg(lib) .arg(QFileInfo(lib).exists()) .arg(QFileInfo(lib).isExecutable())); + return; } + + m_dataDumperState = DataDumperLoadTried; +#if defined(Q_OS_WIN) + sendCommand("sharedlibrary .*"); // for LoadLibraryA + //sendCommand("handle SIGSEGV pass stop print"); + //sendCommand("set unwindonsignal off"); + sendCommand("call LoadLibraryA(\"" + lib + "\")", + WatchDumpCustomSetup); + sendCommand("sharedlibrary " + dotEscape(lib)); +#elif defined(Q_OS_MAC) + //sendCommand("sharedlibrary libc"); // for malloc + //sendCommand("sharedlibrary libdl"); // for dlopen + QString flag = QString::number(RTLD_NOW); + sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", + WatchDumpCustomSetup); + //sendCommand("sharedlibrary " + dotEscape(lib)); + m_dataDumperState = DataDumperLoadTried; +#else + //sendCommand("p dlopen"); + QString flag = QString::number(RTLD_NOW); + sendCommand("sharedlibrary libc"); // for malloc + sendCommand("sharedlibrary libdl"); // for dlopen + sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", + WatchDumpCustomSetup); + // some older systems like CentOS 4.6 prefer this: + sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", + WatchDumpCustomSetup); + sendCommand("sharedlibrary " + dotEscape(lib)); +#endif + // retreive list of dumpable classes + sendCommand("call qDumpObjectData440(1,%1+1,0,0,0,0,0,0)"); + sendCommand("p (char*)qDumpOutBuffer", GdbQueryDataDumper); } void GdbEngine::recheckCustomDumperAvailability() From 87fdacba5c75ef1d979a2e9854018e1789626010 Mon Sep 17 00:00:00 2001 From: con Date: Tue, 24 Mar 2009 12:27:58 +0100 Subject: [PATCH 08/10] Simpler "Save modified files" dialog. --- .../coreplugin/dialogs/saveitemsdialog.cpp | 166 +++++------------- .../coreplugin/dialogs/saveitemsdialog.h | 27 +-- .../coreplugin/dialogs/saveitemsdialog.ui | 71 +++++--- src/plugins/coreplugin/filemanager.cpp | 2 +- .../projectexplorer/projectexplorer.cpp | 3 +- 5 files changed, 100 insertions(+), 169 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp index f4c7455e017..31cc36ee976 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp @@ -40,123 +40,47 @@ #include #include +Q_DECLARE_METATYPE(Core::IFile*); + using namespace Core; using namespace Core::Internal; -FileItem::FileItem(QTreeWidget *tree, bool supportOpen, bool open, const QString &text) - : QTreeWidgetItem(tree) -{ - m_saveCheckBox = createCheckBox(tree, 0); - m_saveCheckBox->setChecked(true); - - QFileInfo fi(text); - QString name = fi.fileName(); - if (open) - name.append(tr(" [ReadOnly]")); - - if (supportOpen) { - m_sccCheckBox = createCheckBox(tree, 1); - m_sccCheckBox->setEnabled(open); - m_sccCheckBox->setChecked(open); - connect(m_saveCheckBox, SIGNAL(stateChanged(int)), - this, SLOT(updateSCCCheckBox())); - setText(2, name); - setToolTip(2, text); - } else { - m_sccCheckBox = 0; - setText(2, name); - setToolTip(2, text); - } -} - -QCheckBox *FileItem::createCheckBox(QTreeWidget *tree, int column) -{ - QWidget *w = new QWidget(); - QHBoxLayout *l = new QHBoxLayout(w); - l->setMargin(0); - l->setSpacing(0); - QCheckBox *box = new QCheckBox(w); - l->addWidget(box); - l->setAlignment(box, Qt::AlignCenter); - w->setLayout(l); - tree->setItemWidget(this, column, w); - return box; -} - -void FileItem::updateSCCCheckBox() -{ - if (!m_saveCheckBox->isChecked()) { - m_sccCheckBox->setEnabled(false); - m_sccCheckBox->setChecked(false); - } else { - m_sccCheckBox->setEnabled(true); - } -} - -bool FileItem::shouldBeSaved() const -{ - return m_saveCheckBox->isChecked(); -} - -void FileItem::setShouldBeSaved(bool s) -{ - m_saveCheckBox->setChecked(s); -} - -bool FileItem::shouldBeOpened() const -{ - if (m_sccCheckBox) - return m_sccCheckBox->isChecked(); - return false; -} - - - -SaveItemsDialog::SaveItemsDialog(MainWindow *mainWindow, +SaveItemsDialog::SaveItemsDialog(QWidget *parent, QMap items) - : QDialog(mainWindow) + : QDialog(parent) { m_ui.setupUi(this); - QPushButton *uncheckButton = m_ui.buttonBox->addButton(tr("Uncheck All"), - QDialogButtonBox::ActionRole); - QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Discard All"), - QDialogButtonBox::DestructiveRole); - m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - m_ui.buttonBox->button(QDialogButtonBox::Ok)->setFocus(Qt::TabFocusReason); + QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Don't Save"), QDialogButtonBox::DestructiveRole); + m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true); + m_ui.buttonBox->button(QDialogButtonBox::Save)->setFocus(Qt::TabFocusReason); + m_ui.buttonBox->button(QDialogButtonBox::Save)->setMinimumWidth(130); // bad magic number to avoid resizing of button - m_ui.treeWidget->header()->setMovable(false); - m_ui.treeWidget->setRootIsDecorated(false); - m_ui.treeWidget->setColumnCount(2); - - QStringList headers; - headers << tr("Save") << tr("File Name"); - - const bool hasVersionControl = true; - if (hasVersionControl) { - m_ui.treeWidget->setColumnCount(3); - headers.insert(1, tr("Open with SCC")); - } - m_ui.treeWidget->setHeaderLabels(headers); - - FileItem *itm; QMap::const_iterator it = items.constBegin(); while (it != items.constEnd()) { - QString directory = QFileInfo(it.key()->fileName()).absolutePath(); - bool fileHasVersionControl = mainWindow->vcsManager()->findVersionControlForDirectory(directory) != 0; - itm = new FileItem(m_ui.treeWidget, fileHasVersionControl, - it.key()->isReadOnly(), it.value()); - m_itemMap.insert(itm, it.key()); + QString visibleName; + QString directory; + QString fileName = it.key()->fileName(); + if (fileName.isEmpty()) { + visibleName = it.key()->suggestedFileName(); + } else { + QFileInfo info = QFileInfo(fileName); + directory = info.absolutePath(); + visibleName = info.fileName(); + } + QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() + << visibleName << directory); + item->setData(0, Qt::UserRole, qVariantFromValue(it.key())); ++it; } m_ui.treeWidget->resizeColumnToContents(0); - if (hasVersionControl) - m_ui.treeWidget->resizeColumnToContents(1); + m_ui.treeWidget->selectAll(); + updateSaveButton(); - connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), + connect(m_ui.buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(collectItemsToSave())); - connect(uncheckButton, SIGNAL(clicked()), this, SLOT(uncheckAll())); connect(discardButton, SIGNAL(clicked()), this, SLOT(discardAll())); + connect(m_ui.treeWidget, SIGNAL(itemSelectionChanged()), this, SLOT(updateSaveButton())); } void SaveItemsDialog::setMessage(const QString &msg) @@ -164,24 +88,34 @@ void SaveItemsDialog::setMessage(const QString &msg) m_ui.msgLabel->setText(msg); } +void SaveItemsDialog::updateSaveButton() +{ + int count = m_ui.treeWidget->selectedItems().count(); + QPushButton *button = m_ui.buttonBox->button(QDialogButtonBox::Save); + if (count == m_ui.treeWidget->topLevelItemCount()) { + button->setEnabled(true); + button->setText(tr("Save All")); + } else if (count == 0) { + button->setEnabled(false); + button->setText(tr("Save")); + } else { + button->setEnabled(true); + button->setText(tr("Save Selected")); + } +} + void SaveItemsDialog::collectItemsToSave() { m_itemsToSave.clear(); - m_itemsToOpen.clear(); - QMap::const_iterator it = m_itemMap.constBegin(); - while (it != m_itemMap.constEnd()) { - if (it.key()->shouldBeSaved()) - m_itemsToSave << it.value(); - if (it.key()->shouldBeOpened()) - m_itemsToOpen.insert(it.value()); - ++it; + foreach (QTreeWidgetItem *item, m_ui.treeWidget->selectedItems()) { + m_itemsToSave.append(item->data(0, Qt::UserRole).value()); } accept(); } void SaveItemsDialog::discardAll() { - uncheckAll(); + m_ui.treeWidget->clearSelection(); collectItemsToSave(); } @@ -190,15 +124,7 @@ QList SaveItemsDialog::itemsToSave() const return m_itemsToSave; } -QSet SaveItemsDialog::itemsToOpen() const +QSet SaveItemsDialog::itemsToOpenWithVCS() const { - return m_itemsToOpen; -} - -void SaveItemsDialog::uncheckAll() -{ - for (int i=0; itopLevelItemCount(); ++i) { - FileItem *item = static_cast(m_ui.treeWidget->topLevelItem(i)); - item->setShouldBeSaved(false); - } + return m_itemsToSave.toSet(); } diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.h b/src/plugins/coreplugin/dialogs/saveitemsdialog.h index d6ceb414a8b..7c41f2efedd 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.h +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.h @@ -48,47 +48,26 @@ namespace Internal { class MainWindow; -class FileItem : public QObject, public QTreeWidgetItem -{ - Q_OBJECT - -public: - FileItem(QTreeWidget *tree, bool supportOpen, - bool open, const QString &text); - bool shouldBeSaved() const; - void setShouldBeSaved(bool s); - bool shouldBeOpened() const; - -private slots: - void updateSCCCheckBox(); - -private: - QCheckBox *createCheckBox(QTreeWidget *tree, int column); - QCheckBox *m_saveCheckBox; - QCheckBox *m_sccCheckBox; -}; - class SaveItemsDialog : public QDialog { Q_OBJECT public: - SaveItemsDialog(MainWindow *mainWindow, + SaveItemsDialog(QWidget *parent, QMap items); void setMessage(const QString &msg); QList itemsToSave() const; - QSet itemsToOpen() const; + QSet itemsToOpenWithVCS() const; private slots: void collectItemsToSave(); - void uncheckAll(); void discardAll(); + void updateSaveButton(); private: Ui::SaveItemsDialog m_ui; - QMap m_itemMap; QList m_itemsToSave; QSet m_itemsToOpen; }; diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.ui b/src/plugins/coreplugin/dialogs/saveitemsdialog.ui index 85931a1daba..966be8f4f30 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.ui +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.ui @@ -1,41 +1,68 @@ - + + SaveItemsDialog - - + + 0 0 - 400 + 457 200 - + Save Changes - - - 9 - - - 6 - + - - - Save the changes of the following items: + + + The following files have unsaved changes: - + + + QAbstractItemView::ExtendedSelection + + + Qt::ElideLeft + + + 0 + + + false + + + true + + + true + + + 2 + + + + 1 + + + + + 2 + + + - - + + Qt::Horizontal - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + QDialogButtonBox::Cancel|QDialogButtonBox::Save @@ -52,11 +79,11 @@ SaveItemsDialog reject() - + 199 174 - + 199 99 diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index 5fd9fe3fdd5..e5c33c18dd0 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -346,7 +346,7 @@ QList FileManager::saveModifiedFiles(const QList &files, return notSaved; } filesToSave = dia.itemsToSave(); - filesToOpen = dia.itemsToOpen(); + filesToOpen = dia.itemsToOpenWithVCS(); } bool yestoall = false; diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b4481b7773d..a975c2bcecd 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -1273,8 +1273,7 @@ bool ProjectExplorerPlugin::saveModifiedFiles(const QList & projects) if (!filesToSave.isEmpty()) { bool cancelled; - Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave, &cancelled, - tr("The following dependencies are modified, do you want to save them?")); + Core::ICore::instance()->fileManager()->saveModifiedFiles(filesToSave, &cancelled); if (cancelled) { return false; } From bd2a163f7834a1be5379ee9357309fdf717497de Mon Sep 17 00:00:00 2001 From: con Date: Tue, 24 Mar 2009 12:51:44 +0100 Subject: [PATCH 09/10] Simplify 'Save modified files' internals. --- .../coreplugin/dialogs/saveitemsdialog.cpp | 17 +++++------------ .../coreplugin/dialogs/saveitemsdialog.h | 6 ++---- .../coreplugin/editormanager/editormanager.cpp | 1 - src/plugins/coreplugin/filemanager.cpp | 17 ++++++++--------- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp index 31cc36ee976..80b15b4c94b 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.cpp @@ -46,7 +46,7 @@ using namespace Core; using namespace Core::Internal; SaveItemsDialog::SaveItemsDialog(QWidget *parent, - QMap items) + QList items) : QDialog(parent) { m_ui.setupUi(this); @@ -55,13 +55,12 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent, m_ui.buttonBox->button(QDialogButtonBox::Save)->setFocus(Qt::TabFocusReason); m_ui.buttonBox->button(QDialogButtonBox::Save)->setMinimumWidth(130); // bad magic number to avoid resizing of button - QMap::const_iterator it = items.constBegin(); - while (it != items.constEnd()) { + foreach (IFile *file, items) { QString visibleName; QString directory; - QString fileName = it.key()->fileName(); + QString fileName = file->fileName(); if (fileName.isEmpty()) { - visibleName = it.key()->suggestedFileName(); + visibleName = file->suggestedFileName(); } else { QFileInfo info = QFileInfo(fileName); directory = info.absolutePath(); @@ -69,8 +68,7 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent, } QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() << visibleName << directory); - item->setData(0, Qt::UserRole, qVariantFromValue(it.key())); - ++it; + item->setData(0, Qt::UserRole, qVariantFromValue(file)); } m_ui.treeWidget->resizeColumnToContents(0); @@ -123,8 +121,3 @@ QList SaveItemsDialog::itemsToSave() const { return m_itemsToSave; } - -QSet SaveItemsDialog::itemsToOpenWithVCS() const -{ - return m_itemsToSave.toSet(); -} diff --git a/src/plugins/coreplugin/dialogs/saveitemsdialog.h b/src/plugins/coreplugin/dialogs/saveitemsdialog.h index 7c41f2efedd..ff22baa1f66 100644 --- a/src/plugins/coreplugin/dialogs/saveitemsdialog.h +++ b/src/plugins/coreplugin/dialogs/saveitemsdialog.h @@ -54,12 +54,11 @@ class SaveItemsDialog : public QDialog public: SaveItemsDialog(QWidget *parent, - QMap items); + QList items); void setMessage(const QString &msg); - QList itemsToSave() const; - QSet itemsToOpenWithVCS() const; + QList itemsToSave() const; private slots: void collectItemsToSave(); @@ -69,7 +68,6 @@ private slots: private: Ui::SaveItemsDialog m_ui; QList m_itemsToSave; - QSet m_itemsToOpen; }; } // namespace Internal diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 8badefeb9a8..722f925b263 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -36,7 +36,6 @@ #include "icore.h" #include "iversioncontrol.h" #include "mimedatabase.h" -#include "saveitemsdialog.h" #include "tabpositionindicator.h" #include "vcsmanager.h" diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index e5c33c18dd0..b996ed50407 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -314,7 +314,8 @@ QList FileManager::saveModifiedFiles(const QList &files, (*cancelled) = false; QList notSaved; - QMap modifiedFiles; + QMap modifiedFilesMap; + QList modifiedFiles; foreach (IFile *file, files) { if (file->isModified()) { @@ -324,17 +325,16 @@ QList FileManager::saveModifiedFiles(const QList &files, // There can be several FileInterfaces pointing to the same file // Select one that is not readonly. - if (!(modifiedFiles.values().contains(name) + if (!(modifiedFilesMap.values().contains(name) && file->isReadOnly())) - modifiedFiles.insert(file, name); + modifiedFilesMap.insert(file, name); } } - + modifiedFiles = modifiedFilesMap.keys(); if (!modifiedFiles.isEmpty()) { QList filesToSave; - QSet filesToOpen; if (silently) { - filesToSave = modifiedFiles.keys(); + filesToSave = modifiedFiles; } else { SaveItemsDialog dia(m_mainWindow, modifiedFiles); if (!message.isEmpty()) @@ -342,16 +342,15 @@ QList FileManager::saveModifiedFiles(const QList &files, if (dia.exec() != QDialog::Accepted) { if (cancelled) (*cancelled) = true; - notSaved = modifiedFiles.keys(); + notSaved = modifiedFiles; return notSaved; } filesToSave = dia.itemsToSave(); - filesToOpen = dia.itemsToOpenWithVCS(); } bool yestoall = false; foreach (IFile *file, filesToSave) { - if (file->isReadOnly() && filesToOpen.contains(file)) { + if (file->isReadOnly()) { QString directory = QFileInfo(file->fileName()).absolutePath(); IVersionControl *versionControl = m_mainWindow->vcsManager()->findVersionControlForDirectory(directory); if (versionControl) From d5d7911f42c1f6b7efadd8084bfaa272eb55946f Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 24 Mar 2009 12:55:26 +0100 Subject: [PATCH 10/10] debugger: use less "reset" in the locals view --- src/plugins/debugger/watchhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index ab96217b1e8..cfe0eb5338c 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -682,7 +682,7 @@ void WatchHandler::rebuildModel() emit layoutAboutToBeChanged(); - if (oldTopINames != topINames) { + if (0 && oldTopINames != topINames) { m_displaySet = initialSet(); m_expandedINames.clear(); emit reset();