From 8a1d19a5ec838298f361497d3713b905df625e4e Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Mon, 9 Mar 2026 09:17:34 -0500 Subject: [PATCH] Made tweaks to this PR. --- src/SeerEditorManagerWidget.cpp | 61 ++++++++++++++--------------- src/SeerEditorManagerWidget.h | 11 ++++-- src/SeerEditorWidgetSource.cpp | 56 ++++++++++++++------------ src/SeerEditorWidgetSource.h | 3 +- src/SeerEditorWidgetSourceAreas.cpp | 15 +++---- src/SeerGdbWidget.cpp | 12 +++--- src/SeerKeySettings.cpp | 1 + src/SeerSourceBrowserWidget.cpp | 12 +++--- src/SeerSourceBrowserWidget.h | 2 +- 9 files changed, 92 insertions(+), 81 deletions(-) diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index 9b83039..ca34cc8 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -40,6 +40,9 @@ SeerEditorManagerWidget::SeerEditorManagerWidget (QWidget* parent) : QWidget(par _showOpcodeColumn = false; _showSourceLines = false; _notifyAssemblyTabShown = true; + _idFunctionDefinition = Seer::createID(); + _idVariableDefinition = Seer::createID(); + _idTypeDefinition = Seer::createID(); // Setup UI setupUi(this); @@ -805,11 +808,13 @@ void SeerEditorManagerWidget::handleText (const QString& text) { i->widget->sourceArea()->eraseColorCurrentLine(line_text.toInt()); } } - }else if ( text.contains(QRegularExpression("^([0-9]+)\\^done,symbols={"))) - { - if (text.startsWith(_idTypeDefinition + "^done,symbols={") || text.startsWith(_idFunctionDefinition + "^done,symbols={") || - text.startsWith(_idVariableDefinition + "^done,symbols={")) // Handle Go to Definition - { + + }else if ( text.contains(QRegularExpression("^([0-9]+)\\^done,symbols={"))) { + + if (text.startsWith(QString::number(_idTypeDefinition) + "^done,symbols={") || + text.startsWith(QString::number(_idFunctionDefinition) + "^done,symbols={") || + text.startsWith(QString::number(_idVariableDefinition) + "^done,symbols={")) { // Handle Go to Definition + //^10done,symbols={debug=[{filename=" ",fullname=" ", // symbols=[{line=" ",name="uwTick",type="volatile uint32_t",description="volatile uint32_t uwTick;"},}]}] QString debug_text = Seer::parseFirst(text, "debug=", '[', ']', false); @@ -821,8 +826,11 @@ void SeerEditorManagerWidget::handleText (const QString& text) { QString fullname_text = Seer::parseFirst(filename_entry, "fullname=", '"', '"', false); // If that file is not in source browser, skip it - if (_sourceBrowserWidget->findFileWithRegrex(fullname_text).isEmpty()) - continue; + if (_sourceBrowserWidget != nullptr) { + if (_sourceBrowserWidget->findFileWithRegrex(fullname_text).isEmpty()) { + continue; + } + } QString symbols_text = Seer::parseFirst(filename_entry, "symbols=", '[', ']', false); QStringList symbols_list = Seer::parse(symbols_text, "", '{', '}', false); @@ -831,17 +839,17 @@ void SeerEditorManagerWidget::handleText (const QString& text) { QString line_text = Seer::parseFirst(symbol_entry, "line=", '"', '"', false); QString name_text = Seer::parseFirst(symbol_entry, "name=", '"', '"', false); + // name_text may be st like: function_name(params...) , so only extract function_name part name_text = name_text.section('(', 0, 0).trimmed(); - if (name_text == _gotoDefIdentifier) // you found it! Open file - { + + if (name_text == _gotoDefIdentifier) { // you found it! Open file handleOpenFile(filename_text, fullname_text, line_text.toInt()); } } } } - } - else{ + }else{ // Ignore others. return; } @@ -1588,7 +1596,7 @@ void SeerEditorManagerWidget::handleAddToMouseNavigation(const SeerEditorWidgetS return; } } - + // if _forwardFilesIndex is at the end of the list, just append if (_forwardFilesIndex >= _listForwardFiles.size() - 1) { @@ -1610,13 +1618,13 @@ void SeerEditorManagerWidget::handleAddToMouseNavigation(const SeerEditorWidgetS _listForwardFiles.append(currentFile); _forwardFilesIndex = _listForwardFiles.size() -1; } - } + } } void SeerEditorManagerWidget::handleOpenForwardBackward(const SeerEditorWidgetSourceArea::SeerCurrentFile& fileInfo) { // Get the EditorWidget for the file. Create one if needed. SeerEditorWidgetSource* editorWidget = editorWidgetTab(fileInfo.fullname); - + if (editorWidget == 0) { editorWidget = createEditorWidgetTab(fileInfo.fullname, fileInfo.file); } @@ -1670,7 +1678,7 @@ void SeerEditorManagerWidget::mousePressEvent(QMouseEvent *event) const SeerEditorWidgetSourceArea::SeerCurrentFile &info = _listForwardFiles.at(_forwardFilesIndex); handleOpenForwardBackward(info); } - else + else { QWidget::mousePressEvent(event); } @@ -1679,22 +1687,13 @@ void SeerEditorManagerWidget::mousePressEvent(QMouseEvent *event) /*********************************************************************************************************************** * Functions for handling tracing identifier * **********************************************************************************************************************/ -void SeerEditorManagerWidget::gotoDefinitionForwarder(const QString& identifier) -{ +void SeerEditorManagerWidget::gotoDefinitionForwarder(const QString& identifier) { + _gotoDefIdentifier = identifier; - // Create a unique ID for the function definition request and send the command to gdb - _idFunctionDefinition = QString::number(Seer::createID()); - QString gdbCommand = _idFunctionDefinition + "-symbol-info-functions --name " + _gotoDefIdentifier; - emit gotoDefinitionForward(gdbCommand); - - // Create a unique ID for the variable definition request and send the command to gdb - _idVariableDefinition = QString::number(Seer::createID()); - gdbCommand = _idVariableDefinition + "-symbol-info-variables --name " + _gotoDefIdentifier; - emit gotoDefinitionForward(gdbCommand); - - // Create a unique ID for the type definition request and send the command to gdb - _idTypeDefinition = QString::number(Seer::createID()); - gdbCommand = _idTypeDefinition + "-symbol-info-types --name " + _gotoDefIdentifier; - emit gotoDefinitionForward(gdbCommand); + // Ask for identifier matches for Functions, Variables, and Types. + emit refreshFunctionList(_idFunctionDefinition, _gotoDefIdentifier); + emit refreshVariableList(_idVariableDefinition, _gotoDefIdentifier, ""); + emit refreshTypeList(_idTypeDefinition, _gotoDefIdentifier); } + diff --git a/src/SeerEditorManagerWidget.h b/src/SeerEditorManagerWidget.h index 4f392b9..f343e2f 100644 --- a/src/SeerEditorManagerWidget.h +++ b/src/SeerEditorManagerWidget.h @@ -145,6 +145,9 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW void showMessage (QString message, int time); void assemblyTabShown (bool shown); void gotoDefinitionForward (const QString& identifier, bool ignoreErrors = false); + void refreshFunctionList (int id, const QString& functionRegex); + void refreshVariableList (int id, const QString& staticNameRegex, const QString& staticTypeRegex); + void refreshTypeList (int id, const QString& typeRegex); private: SeerEditorWidgetSource* currentEditorWidgetTab (); @@ -186,9 +189,9 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW int _forwardFilesIndex = -1; // _id of identifier for Go to definition - QString _idFunctionDefinition; - QString _idVariableDefinition; - QString _idTypeDefinition; - QString _gotoDefIdentifier; + int _idFunctionDefinition; + int _idVariableDefinition; + int _idTypeDefinition; + QString _gotoDefIdentifier; }; diff --git a/src/SeerEditorWidgetSource.cpp b/src/SeerEditorWidgetSource.cpp index 24da778..684a2ab 100644 --- a/src/SeerEditorWidgetSource.cpp +++ b/src/SeerEditorWidgetSource.cpp @@ -44,39 +44,41 @@ SeerEditorWidgetSource::SeerEditorWidgetSource(QWidget* parent) : QWidget(parent _lineSearchShortcut = new QShortcut(QKeySequence(tr("Ctrl+L")), this); _alternateDirShortcut = new QShortcut(QKeySequence(tr("Ctrl+O")), this); _toggleBreakpointShortcut = new QShortcut(QKeySequence(tr("Ctrl+B")), this); + _gotoDefinitionShortcut = new QShortcut(QKeySequence(tr("F12")), this); setKeySettings(SeerKeySettings::populate()); // Connect things. - QObject::connect(searchTextLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); - QObject::connect(searchTextLineEdit, &QHistoryLineEdit::escapePressed, this, &SeerEditorWidgetSource::handleEscapePressed); + QObject::connect(searchTextLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); + QObject::connect(searchTextLineEdit, &QHistoryLineEdit::escapePressed, this, &SeerEditorWidgetSource::handleEscapePressed); #if QT_VERSION >= 0x060900 - QObject::connect(matchCaseCheckBox, &QCheckBox::checkStateChanged, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); + QObject::connect(matchCaseCheckBox, &QCheckBox::checkStateChanged, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); #else - QObject::connect(matchCaseCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); + QObject::connect(matchCaseCheckBox, &QCheckBox::stateChanged, this, &SeerEditorWidgetSource::handleSearchTextLineEdit); #endif - QObject::connect(searchDownToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchDownToolButton); - QObject::connect(searchUpToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchUpToolButton); - QObject::connect(searchLineNumberLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleSearchLineNumberLineEdit); - QObject::connect(searchLineNumberLineEdit, &QHistoryLineEdit::escapePressed, this, &SeerEditorWidgetSource::handleEscapePressed); - QObject::connect(searchReloadToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadToolButton); - QObject::connect(searchCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchCloseToolButton); - QObject::connect(alternateCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleAlternateCloseToolButton); - QObject::connect(alternateFileOpenToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleAlternateFileOpenToolButton); - QObject::connect(alternateLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleAlternateLineEdit); - QObject::connect(reloadToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadToolButton); - QObject::connect(reloadCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadCloseToolButton); - QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showSearchBar, this, qOverload(&SeerEditorWidgetSource::showSearchBar)); - QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showAlternateBar, this, &SeerEditorWidgetSource::showAlternateBar); - QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showReloadBar, this, &SeerEditorWidgetSource::showReloadBar); + QObject::connect(searchDownToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchDownToolButton); + QObject::connect(searchUpToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchUpToolButton); + QObject::connect(searchLineNumberLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleSearchLineNumberLineEdit); + QObject::connect(searchLineNumberLineEdit, &QHistoryLineEdit::escapePressed, this, &SeerEditorWidgetSource::handleEscapePressed); + QObject::connect(searchReloadToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadToolButton); + QObject::connect(searchCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleSearchCloseToolButton); + QObject::connect(alternateCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleAlternateCloseToolButton); + QObject::connect(alternateFileOpenToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleAlternateFileOpenToolButton); + QObject::connect(alternateLineEdit, &QHistoryLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleAlternateLineEdit); + QObject::connect(reloadToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadToolButton); + QObject::connect(reloadCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleReloadCloseToolButton); + QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showSearchBar, this, qOverload(&SeerEditorWidgetSource::showSearchBar)); + QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showAlternateBar, this, &SeerEditorWidgetSource::showAlternateBar); + QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showReloadBar, this, &SeerEditorWidgetSource::showReloadBar); - QObject::connect(_textSearchShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleTextSearchShortcut); - QObject::connect(_textSearchNextShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleSearchDownToolButton); - QObject::connect(_textSearchPrevShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleSearchUpToolButton); - QObject::connect(_textSearchReloadShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleReloadToolButton); - QObject::connect(_lineSearchShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleLineSearchShortcut); - QObject::connect(_alternateDirShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleAlternateDirectoryShortcut); - QObject::connect(_toggleBreakpointShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleToggleBreakpointShortcut); + QObject::connect(_textSearchShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleTextSearchShortcut); + QObject::connect(_textSearchNextShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleSearchDownToolButton); + QObject::connect(_textSearchPrevShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleSearchUpToolButton); + QObject::connect(_textSearchReloadShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleReloadToolButton); + QObject::connect(_lineSearchShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleLineSearchShortcut); + QObject::connect(_alternateDirShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleAlternateDirectoryShortcut); + QObject::connect(_toggleBreakpointShortcut, &QShortcut::activated, this, &SeerEditorWidgetSource::handleToggleBreakpointShortcut); + QObject::connect(_gotoDefinitionShortcut, &QShortcut::activated, sourceArea(), &SeerEditorWidgetSourceArea::handleGotoDefinition); } SeerEditorWidgetSource::~SeerEditorWidgetSource () { @@ -125,6 +127,10 @@ void SeerEditorWidgetSource::setKeySettings (const SeerKeySettings& settings) { if (_keySettings.has("ToggleBreakpoint") == true) { _toggleBreakpointShortcut->setKey(_keySettings.get("ToggleBreakpoint")._sequence); } + + if (_keySettings.has("GoToDefinition") == true) { + _gotoDefinitionShortcut->setKey(_keySettings.get("GoToDefinition")._sequence); + } } const SeerKeySettings& SeerEditorWidgetSource::keySettings () const { diff --git a/src/SeerEditorWidgetSource.h b/src/SeerEditorWidgetSource.h index f47c4a5..3540aca 100644 --- a/src/SeerEditorWidgetSource.h +++ b/src/SeerEditorWidgetSource.h @@ -152,7 +152,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit { void handleHighlighterSettingsChanged (); void handleWatchFileModified (const QString& path); void handleBreakpointToolTip (QPoint pos, const QString& text); - void handleGotoDefinitionF12 (); + void handleGotoDefinition (); protected: void resizeEvent (QResizeEvent* event); @@ -303,5 +303,6 @@ class SeerEditorWidgetSource : public QWidget, protected Ui::SeerEditorWidgetSou QShortcut* _lineSearchShortcut; QShortcut* _alternateDirShortcut; QShortcut* _toggleBreakpointShortcut; + QShortcut* _gotoDefinitionShortcut; }; diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 9984c07..d738d45 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -70,11 +70,7 @@ SeerEditorWidgetSourceArea::SeerEditorWidgetSourceArea(QWidget* parent) : SeerPl QObject::connect(this, &SeerEditorWidgetSourceArea::highlighterSettingsChanged, this, &SeerEditorWidgetSourceArea::handleHighlighterSettingsChanged); // Connect cursor position changed signal. - QObject::connect(this, &QPlainTextEdit::cursorPositionChanged, this, &SeerEditorWidgetSourceArea::handleCursorPositionChanged); - - // Add F12 shortcut. F12 -> SeerEditorWidgetSourceArea::handleGotoDefinitionF12 -> emit gotoDefinition(wordUnderCursor) - QShortcut *shortcutF12 = new QShortcut(QKeySequence("F12"), this); - QObject::connect(shortcutF12, &QShortcut::activated, this, &SeerEditorWidgetSourceArea::handleGotoDefinitionF12); + QObject::connect(this, &QPlainTextEdit::cursorPositionChanged, this, &SeerEditorWidgetSourceArea::handleCursorPositionChanged); setCurrentLine(0); @@ -2136,13 +2132,14 @@ bool SeerEditorWidgetSourceArea::isValidIdentifier(const QString& text) } // When F12 is pressed, try to look for the word under cursor, if it's a valid identifier then emit signalGotoDefinition -void SeerEditorWidgetSourceArea::handleGotoDefinitionF12() -{ +void SeerEditorWidgetSourceArea::handleGotoDefinition() { + QTextCursor cursor = textCursor(); cursor.select(QTextCursor::WordUnderCursor); QString wordUnderCursor = cursor.selectedText(); - if (isValidIdentifier(wordUnderCursor)) - { + + if (isValidIdentifier(wordUnderCursor)) { emit signalGotoDefinition(wordUnderCursor); } } + diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index fce79df..ad4893c 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -322,10 +322,10 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(this, &SeerGdbWidget::stoppingPointReached, variableManagerWidget->registerValuesBrowserWidget(), &SeerRegisterValuesBrowserWidget::handleStoppingPointReached); QObject::connect(this, &SeerGdbWidget::stoppingPointReached, variableManagerWidget->signalValuesBrowserWidget(), &SeerSignalValuesBrowserWidget::handleStoppingPointReached); QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->breakpointsBrowser(), &SeerBreakpointsBrowserWidget::handleStoppingPointReached); - QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->watchpointsBrowser(), &SeerWatchpointsBrowserWidget::handleStoppingPointReached); - QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->catchpointsBrowser(), &SeerCatchpointsBrowserWidget::handleStoppingPointReached); - QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->printpointsBrowser(), &SeerPrintpointsBrowserWidget::handleStoppingPointReached); - QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->checkpointsBrowser(), &SeerCheckpointsBrowserWidget::handleStoppingPointReached); + QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->watchpointsBrowser(), &SeerWatchpointsBrowserWidget::handleStoppingPointReached); + QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->catchpointsBrowser(), &SeerCatchpointsBrowserWidget::handleStoppingPointReached); + QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->printpointsBrowser(), &SeerPrintpointsBrowserWidget::handleStoppingPointReached); + QObject::connect(this, &SeerGdbWidget::stoppingPointReached, commandLogsWidget->checkpointsBrowser(), &SeerCheckpointsBrowserWidget::handleStoppingPointReached); QObject::connect(this, &SeerGdbWidget::sessionTerminated, editorManagerWidget, &SeerEditorManagerWidget::handleSessionTerminated); QObject::connect(this, &SeerGdbWidget::sessionTerminated, sourceLibraryManagerWidget->sourceBrowserWidget(), &SeerSourceBrowserWidget::handleSessionTerminated); @@ -358,7 +358,9 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(sourceCommandLogsSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved); QObject::connect(stackThreadManagerSplitter, &QSplitter::splitterMoved, this, &SeerGdbWidget::handleSplitterMoved); QObject::connect(commandLogsWidget->gdbOutputLog(), &SeerGdbLogWidget::refreshBreakpointsList, this, &SeerGdbWidget::handleGdbGenericpointList); - QObject::connect(editorManagerWidget, &SeerEditorManagerWidget::gotoDefinitionForward, this, &SeerGdbWidget::handleGdbCommand); + QObject::connect(editorManagerWidget, &SeerEditorManagerWidget::refreshFunctionList, this, &SeerGdbWidget::handleGdbExecutableFunctions); + QObject::connect(editorManagerWidget, &SeerEditorManagerWidget::refreshVariableList, this, &SeerGdbWidget::handleGdbExecutableVariables); + QObject::connect(editorManagerWidget, &SeerEditorManagerWidget::refreshTypeList, this, &SeerGdbWidget::handleGdbExecutableTypes); #if SEER_GDB_LOGOUT == 1 // Direct all GdbWidget and GdbMonitor log to GDB Log, for debugging diff --git a/src/SeerKeySettings.cpp b/src/SeerKeySettings.cpp index 5811f53..74c37ed 100644 --- a/src/SeerKeySettings.cpp +++ b/src/SeerKeySettings.cpp @@ -88,6 +88,7 @@ SeerKeySettings SeerKeySettings::populate () { keySettings.add("ReverseStepi", SeerKeySetting("ReverseStepi", QKeySequence::fromString("Shift+Ctrl+F6"), "Execute the previous instruction. Step into functions.")); keySettings.add("ReverseFinish", SeerKeySetting("ReverseFinish", QKeySequence::fromString("Shift+F7"), "Finish the current function in reverse.")); keySettings.add("RunToLine", SeerKeySetting("RunToLine", QKeySequence::fromString("F9"), "Run to the currently selected line.")); + keySettings.add("GoToDefinition", SeerKeySetting("GoToDefinition", QKeySequence::fromString("F12"), "Go to source file for symbol under cursor.")); return keySettings; } diff --git a/src/SeerSourceBrowserWidget.cpp b/src/SeerSourceBrowserWidget.cpp index 70d8741..750609b 100644 --- a/src/SeerSourceBrowserWidget.cpp +++ b/src/SeerSourceBrowserWidget.cpp @@ -116,7 +116,7 @@ void SeerSourceBrowserWidget::handleText (const QString& text) { QString fullname_text = Seer::parseFirst(entry_text, "fullname=", '"', '"', false); //qDebug() << file_text << fullname_text; - + // Skip duplicates if (_files.contains(fullname_text)) { continue; @@ -296,14 +296,16 @@ void SeerSourceBrowserWidget::deleteChildItems () { } } -const QString& SeerSourceBrowserWidget::findFileWithRegrex(const QString& expression) -{ +QString SeerSourceBrowserWidget::findFileWithRegrex(const QString& expression) const { + QMap::const_iterator it; + for (it = _files.constBegin(); it != _files.constEnd(); ++it) { if (it.key().contains(expression)) { return it.key(); } } - static const QString empty; - return empty; + + return QString(); } + diff --git a/src/SeerSourceBrowserWidget.h b/src/SeerSourceBrowserWidget.h index 08435ad..22249f7 100644 --- a/src/SeerSourceBrowserWidget.h +++ b/src/SeerSourceBrowserWidget.h @@ -29,7 +29,7 @@ class SeerSourceBrowserWidget : public QWidget, protected Ui::SeerSourceBrowserW void setIgnoreFilePatterns (const QStringList& patterns); const QStringList& ignoreFilePatterns () const; - const QString& findFileWithRegrex (const QString& expression); + QString findFileWithRegrex (const QString& expression) const; public slots: void handleText (const QString& text);