diff --git a/src/SeerConfigDialog.cpp b/src/SeerConfigDialog.cpp index 413d432..292a34b 100644 --- a/src/SeerConfigDialog.cpp +++ b/src/SeerConfigDialog.cpp @@ -229,6 +229,16 @@ QStringList SeerConfigDialog::sourceAlternateDirectories () const { return _sourceConfigPage->alternateDirectories(); } +void SeerConfigDialog::setSourceIgnoreDirectories (const QStringList& ignoreDirectories) { + + _sourceConfigPage->setIgnoreDirectories(ignoreDirectories); +} + +QStringList SeerConfigDialog::sourceIgnoreDirectories () const { + + return _sourceConfigPage->ignoreDirectories(); +} + void SeerConfigDialog::setAssemblyShowAssemblyTabOnStartup (bool flag) { _assemblyConfigPage->setShowAssemblyTabOnStartup(flag); diff --git a/src/SeerConfigDialog.h b/src/SeerConfigDialog.h index a72f3a0..0ce7502 100644 --- a/src/SeerConfigDialog.h +++ b/src/SeerConfigDialog.h @@ -64,6 +64,9 @@ class SeerConfigDialog : public QDialog, protected Ui::SeerConfigDialogForm { void setSourceAlternateDirectories (const QStringList& alternateDirectories); QStringList sourceAlternateDirectories () const; + void setSourceIgnoreDirectories (const QStringList& ignoreDirectories); + QStringList sourceIgnoreDirectories () const; + // Assembly settings. void setAssemblyShowAssemblyTabOnStartup (bool flag); bool assemblyShowAssemblyTabOnStartup () const; diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index bed757c..17fb608 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -252,6 +252,16 @@ const QStringList& SeerEditorManagerWidget::editorAlternateDirectories () const return _editorAlternateDirectories; } +void SeerEditorManagerWidget::setEditorIgnoreDirectories (const QStringList ignoreDirectories) { + + _editorIgnoreDirectories = ignoreDirectories; +} + +const QStringList& SeerEditorManagerWidget::editorIgnoreDirectories () const { + + return _editorIgnoreDirectories; +} + void SeerEditorManagerWidget::setEditorKeySettings (const SeerKeySettings& settings) { _editorKeySettings = settings; @@ -308,6 +318,11 @@ void SeerEditorManagerWidget::handleText (const QString& text) { editorWidget = createEditorWidgetTab(fullname_text, file_text, text); } + // Can still be null, if the file is ignored. + if (editorWidget == 0) { + return; + } + // Push this tab to the top only if the current one in not the "Assembly" tab. QString tabtext = ""; @@ -553,6 +568,11 @@ void SeerEditorManagerWidget::handleOpenFile (const QString& file, const QString editorWidget = createEditorWidgetTab(fullname, file); } + // Can still be null, if the file is ignored. + if (editorWidget == 0) { + return; + } + // Push this tab to the top only if the current one in not the "Assembly" tab. QString tabtext = ""; @@ -624,6 +644,12 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS //qDebug() << fullname << file << text << tabWidget->count() << tabWidget->tabText(0); + // Are we asked to ignore this file? + if (Seer::matches(editorIgnoreDirectories(), fullname) == true) { + emit showMessage(QString("Ignore opening of: '%1'").arg(fullname), 3000); + return 0; + } + // Remove the place holder tab, if present. if (tabWidget->count() == 1 && tabWidget->tabText(0) == "") { deleteEditorWidgetTab(0); @@ -673,6 +699,12 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS //qDebug() << fullname << file << tabWidget->count() << tabWidget->tabText(0); + // Are we asked to ignore this file? + if (Seer::matches(editorIgnoreDirectories(), fullname) == true) { + emit showMessage(QString("Ignore opening of: '%1'").arg(fullname), 3000); + return 0; + } + // Remove the place holder tab, if present. if (tabWidget->count() == 1 && tabWidget->tabText(0) == "") { deleteEditorWidgetTab(0); diff --git a/src/SeerEditorManagerWidget.h b/src/SeerEditorManagerWidget.h index 60caeaa..409a1d5 100644 --- a/src/SeerEditorManagerWidget.h +++ b/src/SeerEditorManagerWidget.h @@ -46,6 +46,8 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW bool editorHighlighterEnabled () const; void setEditorAlternateDirectories (const QStringList alternateDirectories); const QStringList& editorAlternateDirectories () const; + void setEditorIgnoreDirectories (const QStringList ignoreDirectories); + const QStringList& editorIgnoreDirectories () const; void setEditorKeySettings (const SeerKeySettings& settings); const SeerKeySettings& editorKeySettings () const; @@ -95,6 +97,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW void addArrayVisualize (QString expression); void addStructVisualize (QString expression); void requestAssembly (QString address); + void showMessage (QString message, int time); private: SeerEditorWidgetSource* currentEditorWidgetTab (); @@ -110,6 +113,7 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW bool _editorHighlighterEnabled; QFont _editorFont; QStringList _editorAlternateDirectories; + QStringList _editorIgnoreDirectories; SeerKeySettings _editorKeySettings; SeerEditorWidgetAssembly* _assemblyWidget; int _assemblyIndex; diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 36f6708..82ae7df 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -2019,7 +2019,6 @@ void SeerGdbWidget::writeSettings () { settings.setArrayIndex(i); settings.setValue("command", commands[i]); } - } settings.endArray(); settings.beginWriteArray("sourcealternatedirectories"); { @@ -2030,7 +2029,16 @@ void SeerGdbWidget::writeSettings () { settings.setArrayIndex(i); settings.setValue("directory", directories[i]); } + } settings.endArray(); + settings.beginWriteArray("sourceignoredirectories"); { + + QStringList directories = sourceIgnoreDirectories(); + + for (int i = 0; i < directories.size(); ++i) { + settings.setArrayIndex(i); + settings.setValue("directory", directories[i]); + } } settings.endArray(); settings.beginGroup("assembly"); { @@ -2090,7 +2098,19 @@ void SeerGdbWidget::readSettings () { } setSourceAlternateDirectories(directories); + } settings.endArray(); + size = settings.beginReadArray("sourceignoredirectories"); { + + QStringList directories; + + for (int i = 0; i < size; ++i) { + settings.setArrayIndex(i); + + directories << settings.value("directory").toString(); + } + + setSourceIgnoreDirectories(directories); } settings.endArray(); settings.beginGroup("assembly"); { @@ -2325,6 +2345,16 @@ void SeerGdbWidget::setSourceAlternateDirectories (const QStringList& alternateD editorManager()->setEditorAlternateDirectories(alternateDirectories); } +const QStringList& SeerGdbWidget::sourceIgnoreDirectories() const { + + return editorManager()->editorIgnoreDirectories(); +} + +void SeerGdbWidget::setSourceIgnoreDirectories (const QStringList& ignoreDirectories) { + + editorManager()->setEditorIgnoreDirectories(ignoreDirectories); +} + void SeerGdbWidget::setAssemblyShowAssemblyTabOnStartup (bool flag) { _assemblyShowAssemblyTabOnStartup = flag; diff --git a/src/SeerGdbWidget.h b/src/SeerGdbWidget.h index 447c67c..36fcf7e 100644 --- a/src/SeerGdbWidget.h +++ b/src/SeerGdbWidget.h @@ -108,6 +108,9 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm { void setSourceAlternateDirectories (const QStringList& alternateDirectories); const QStringList& sourceAlternateDirectories () const; + void setSourceIgnoreDirectories (const QStringList& ignoreDirectories); + const QStringList& sourceIgnoreDirectories () const; + void setAssemblyShowAssemblyTabOnStartup (bool flag); bool assemblyShowAssemblyTabOnStartup () const; diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index ec4baf3..e18bac7 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -78,7 +78,7 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { // Set the inital key settings. setKeySettings(SeerKeySettings::populate()); - // Setup hidden Var Visualizer. + // Setup hidden Struct Visualizer. QShortcut* varVisualizerShotcut = new QShortcut(QKeySequence(tr("Alt+V")), this); QObject::connect(varVisualizerShotcut, &QShortcut::activated, this, &SeerMainWindow::handleViewStructVisualizer); @@ -133,11 +133,10 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::astrixTextOutput, runStatus, &SeerRunStatusIndicator::handleText); QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::astrixTextOutput, this, &SeerMainWindow::handleText); QObject::connect(gdbWidget->gdbMonitor(), &GdbMonitor::caretTextOutput, this, &SeerMainWindow::handleText); + QObject::connect(gdbWidget->editorManager(), &SeerEditorManagerWidget::showMessage, this, &SeerMainWindow::handleShowMessage); QObject::connect(runStatus, &SeerRunStatusIndicator::statusChanged, this, &SeerMainWindow::handleRunStatusChanged); - QObject::connect(gdbWidget, &SeerGdbWidget::changeWindowTitle, this, &SeerMainWindow::handleChangeWindowTitle); - QObject::connect(qApp, &QApplication::aboutToQuit, gdbWidget, &SeerGdbWidget::handleGdbShutdown); @@ -150,7 +149,7 @@ SeerMainWindow::SeerMainWindow(QWidget* parent) : QMainWindow(parent) { // // Initialize contents. // - statusBar()->showMessage(tr("Welcome to Seer. The All Knowing..."), 3000); + handleShowMessage("Welcome to Seer. The All Knowing...", 3000); } SeerMainWindow::~SeerMainWindow() { @@ -448,6 +447,7 @@ void SeerMainWindow::handleSettingsConfiguration () { dlg.setEditorHighlighterSettings(gdbWidget->editorManager()->editorHighlighterSettings()); dlg.setEditorHighlighterEnabled(gdbWidget->editorManager()->editorHighlighterEnabled()); dlg.setSourceAlternateDirectories(gdbWidget->sourceAlternateDirectories()); + dlg.setSourceIgnoreDirectories(gdbWidget->sourceIgnoreDirectories()); dlg.setAssemblyShowAssemblyTabOnStartup(gdbWidget->assemblyShowAssemblyTabOnStartup()); dlg.setAssemblyKeepAssemblyTabOnTop(gdbWidget->assemblyKeepAssemblyTabOnTop()); dlg.setAssemblyDisassembyFlavor(gdbWidget->assemblyDisassembyFlavor()); @@ -478,6 +478,7 @@ void SeerMainWindow::handleSettingsConfiguration () { gdbWidget->editorManager()->setEditorHighlighterSettings(dlg.editorHighlighterSettings()); gdbWidget->editorManager()->setEditorHighlighterEnabled(dlg.editorHighlighterEnabled()); gdbWidget->setSourceAlternateDirectories(dlg.sourceAlternateDirectories()); + gdbWidget->setSourceIgnoreDirectories(dlg.sourceIgnoreDirectories()); gdbWidget->setAssemblyShowAssemblyTabOnStartup(dlg.assemblyShowAssemblyTabOnStartup()); gdbWidget->setAssemblyKeepAssemblyTabOnTop(dlg.assemblyKeepAssemblyTabOnTop()); gdbWidget->setAssemblyDisassembyFlavor(dlg.assemblyDisassembyFlavor()); @@ -553,6 +554,11 @@ void SeerMainWindow::handleStyleMenuChanged () { QApplication::setStyle(action->text()); } +void SeerMainWindow::handleShowMessage (QString message, int time) { + + statusBar()->showMessage(message, time); +} + void SeerMainWindow::handleText (const QString& text) { if (text.startsWith("^error,msg=")) { @@ -578,7 +584,7 @@ void SeerMainWindow::handleText (const QString& text) { if (msg_text != "") { - statusBar()->showMessage(Seer::filterBookends(msg_text, '"', '"'), 3000); + handleShowMessage(Seer::filterBookends(msg_text, '"', '"'), 3000); QMessageBox::warning(this, "Error.", Seer::filterEscapes(msg_text)); @@ -587,7 +593,6 @@ void SeerMainWindow::handleText (const QString& text) { }else if (text == "^running") { // Swallow this message. - // statusBar()->showMessage(text.mid(1), 3000); return; }else if (text == "^done") { @@ -672,7 +677,7 @@ void SeerMainWindow::handleText (const QString& text) { QString threadid_text = Seer::parseFirst(text, "thread-id=", '"', '"', false); - statusBar()->showMessage("Program started. Thread id: " + threadid_text, 3000); + handleShowMessage("Program started. Thread id: " + threadid_text, 3000); return; @@ -689,7 +694,7 @@ void SeerMainWindow::handleText (const QString& text) { reason_text = "unknown"; } - statusBar()->showMessage("Program stopped. Reason: " + reason_text, 3000); + handleShowMessage("Program stopped. Reason: " + reason_text, 3000); if (reason_text == "signal-received") { //*stopped,reason="signal-received",signal-name="SIGSEGV",signal-meaning="Segmentation fault", ... @@ -788,7 +793,6 @@ void SeerMainWindow::handleRunStatusChanged (SeerRunStatusIndicator::RunStatus s }else{ _progressIndicator->stop(); } - } void SeerMainWindow::handleChangeWindowTitle (QString title) { @@ -885,7 +889,6 @@ void SeerMainWindow::writeConfigSettings () { } } settings.endArray(); - } void SeerMainWindow::readConfigSettings () { diff --git a/src/SeerMainWindow.h b/src/SeerMainWindow.h index d05e122..9efa78c 100644 --- a/src/SeerMainWindow.h +++ b/src/SeerMainWindow.h @@ -71,6 +71,7 @@ class SeerMainWindow : public QMainWindow, protected Ui::SeerMainWindowForm { void handleRunExecutable (); void handleStartExecutable (); void handleStyleMenuChanged (); + void handleShowMessage (QString message, int time); protected: void writeSettings (); diff --git a/src/SeerSourceConfigPage.cpp b/src/SeerSourceConfigPage.cpp index 5cea3e7..bbdd2bc 100644 --- a/src/SeerSourceConfigPage.cpp +++ b/src/SeerSourceConfigPage.cpp @@ -1,6 +1,7 @@ #include "SeerSourceConfigPage.h" #include #include +#include #include #include @@ -10,16 +11,23 @@ SeerSourceConfigPage::SeerSourceConfigPage(QWidget* parent) : QWidget(parent) { setupUi(this); // Setup the widgets - directoriesTreeWidget->clear(); - directoriesTreeWidget->setSortingEnabled(false); - directoriesTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); - directoriesTreeWidget->resizeColumnToContents(0); // directory + alternateDirectoriesTreeWidget->clear(); + alternateDirectoriesTreeWidget->setSortingEnabled(false); + alternateDirectoriesTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + alternateDirectoriesTreeWidget->resizeColumnToContents(0); // directory + ignoreDirectoriesTreeWidget->clear(); + ignoreDirectoriesTreeWidget->setSortingEnabled(false); + ignoreDirectoriesTreeWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); + ignoreDirectoriesTreeWidget->resizeColumnToContents(0); // directory + // Connect things. - QObject::connect(addDirectoryToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleAddButtonClicked); - QObject::connect(moveUpDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleUpButtonClicked); - QObject::connect(moveDownDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleDownButtonClicked); - QObject::connect(deleteDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleDeleteButtonClicked); + QObject::connect(addAlternateDirectoryToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleAddAlternateButtonClicked); + QObject::connect(moveUpAlternateDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleUpAlternateButtonClicked); + QObject::connect(moveDownAlternateDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleDownAlternateButtonClicked); + QObject::connect(deleteAlternateDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleDeleteAlternateButtonClicked); + QObject::connect(addIgnoreDirectoryToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleAddIgnoreButtonClicked); + QObject::connect(deleteIgnoreDirectoriesToolButton, &QToolButton::clicked, this, &SeerSourceConfigPage::handleDeleteIgnoreButtonClicked); // Setup the defaults. reset(); @@ -30,7 +38,7 @@ SeerSourceConfigPage::~SeerSourceConfigPage() { void SeerSourceConfigPage::setAlternateDirectories (const QStringList& alternateDirectories) { - directoriesTreeWidget->clear(); + alternateDirectoriesTreeWidget->clear(); QStringListIterator iter(alternateDirectories); @@ -39,17 +47,48 @@ void SeerSourceConfigPage::setAlternateDirectories (const QStringList& alternate QTreeWidgetItem* topItem = new QTreeWidgetItem; topItem->setText(0, iter.next()); - directoriesTreeWidget->addTopLevelItem(topItem); + alternateDirectoriesTreeWidget->addTopLevelItem(topItem); } - directoriesTreeWidget->resizeColumnToContents(0); + alternateDirectoriesTreeWidget->resizeColumnToContents(0); } QStringList SeerSourceConfigPage::alternateDirectories () const { QStringList list; - QTreeWidgetItemIterator iter(directoriesTreeWidget); + QTreeWidgetItemIterator iter(alternateDirectoriesTreeWidget); + + while (*iter) { + list << (*iter)->text(0); + ++iter; + } + + return list; +} + +void SeerSourceConfigPage::setIgnoreDirectories (const QStringList& ignoreDirectories) { + + ignoreDirectoriesTreeWidget->clear(); + + QStringListIterator iter(ignoreDirectories); + + while (iter.hasNext()) { + + QTreeWidgetItem* topItem = new QTreeWidgetItem; + topItem->setText(0, iter.next()); + + ignoreDirectoriesTreeWidget->addTopLevelItem(topItem); + } + + ignoreDirectoriesTreeWidget->resizeColumnToContents(0); +} + +QStringList SeerSourceConfigPage::ignoreDirectories () const { + + QStringList list; + + QTreeWidgetItemIterator iter(ignoreDirectoriesTreeWidget); while (*iter) { list << (*iter)->text(0); @@ -66,9 +105,11 @@ void SeerSourceConfigPage::reset () { alternateDirectories << "./"; setAlternateDirectories(alternateDirectories); + setIgnoreDirectories(QStringList()); + } -void SeerSourceConfigPage::handleAddButtonClicked () { +void SeerSourceConfigPage::handleAddAlternateButtonClicked () { // Ask for the alternate directory to add to the list. QString directory = QFileDialog::getExistingDirectory(this, "Seer - Enter an alternate directory", QString(), QFileDialog::ShowDirsOnly|QFileDialog::DontUseNativeDialog); @@ -78,7 +119,7 @@ void SeerSourceConfigPage::handleAddButtonClicked () { } // Get the selected items, if any. - QList matches = directoriesTreeWidget->selectedItems(); + QList matches = alternateDirectoriesTreeWidget->selectedItems(); // Create the new item QTreeWidgetItem* topItem = new QTreeWidgetItem; @@ -87,30 +128,30 @@ void SeerSourceConfigPage::handleAddButtonClicked () { // If there is something selected, add the new item before the first selected item. if (matches.count() > 0) { - int index = directoriesTreeWidget->indexOfTopLevelItem(matches[0]); + int index = alternateDirectoriesTreeWidget->indexOfTopLevelItem(matches[0]); - directoriesTreeWidget->insertTopLevelItem(index, topItem); + alternateDirectoriesTreeWidget->insertTopLevelItem(index, topItem); // Otherwise, just add it to the end of the list. }else{ - directoriesTreeWidget->addTopLevelItem(topItem); + alternateDirectoriesTreeWidget->addTopLevelItem(topItem); } // Resize the columns and select the item we just added. - directoriesTreeWidget->resizeColumnToContents(0); + alternateDirectoriesTreeWidget->resizeColumnToContents(0); - directoriesTreeWidget->setCurrentItem(topItem, 0); + alternateDirectoriesTreeWidget->setCurrentItem(topItem, 0); } -void SeerSourceConfigPage::handleUpButtonClicked () { +void SeerSourceConfigPage::handleUpAlternateButtonClicked () { // Get the selected items. - QList matches = directoriesTreeWidget->selectedItems(); + QList matches = alternateDirectoriesTreeWidget->selectedItems(); // Loop through them from low to high. for (int i=0; iindexOfTopLevelItem(matches[i]); + int index = alternateDirectoriesTreeWidget->indexOfTopLevelItem(matches[i]); // Stop if the item is at the top of the list. if (index <= 0) { @@ -118,57 +159,86 @@ void SeerSourceConfigPage::handleUpButtonClicked () { } // Steel it from the treeWidget. - QTreeWidgetItem* topItem = directoriesTreeWidget->takeTopLevelItem(index); + QTreeWidgetItem* topItem = alternateDirectoriesTreeWidget->takeTopLevelItem(index); // Re-add it to the moved up position. - directoriesTreeWidget->insertTopLevelItem(index-1, topItem); + alternateDirectoriesTreeWidget->insertTopLevelItem(index-1, topItem); } // Re-selected the items. - directoriesTreeWidget->clearSelection(); + alternateDirectoriesTreeWidget->clearSelection(); for (int i=0; isetSelected(true); } // Resize the columns. - directoriesTreeWidget->resizeColumnToContents(0); + alternateDirectoriesTreeWidget->resizeColumnToContents(0); } -void SeerSourceConfigPage::handleDownButtonClicked () { +void SeerSourceConfigPage::handleDownAlternateButtonClicked () { // Get the selected items. - QList matches = directoriesTreeWidget->selectedItems(); + QList matches = alternateDirectoriesTreeWidget->selectedItems(); // Loop through them from high to low. for (int i=matches.count()-1; i>=0; i--) { - int index = directoriesTreeWidget->indexOfTopLevelItem(matches[i]); + int index = alternateDirectoriesTreeWidget->indexOfTopLevelItem(matches[i]); // Stop if the item is at the bottom of the list. - if (index >= directoriesTreeWidget->topLevelItemCount()-1) { + if (index >= alternateDirectoriesTreeWidget->topLevelItemCount()-1) { break; } // Steel it from the treeWidget. - QTreeWidgetItem* topItem = directoriesTreeWidget->takeTopLevelItem(index); + QTreeWidgetItem* topItem = alternateDirectoriesTreeWidget->takeTopLevelItem(index); // Re-add it to the moved down position. - directoriesTreeWidget->insertTopLevelItem(index+1, topItem); + alternateDirectoriesTreeWidget->insertTopLevelItem(index+1, topItem); } // Re-selected the items. - directoriesTreeWidget->clearSelection(); + alternateDirectoriesTreeWidget->clearSelection(); for (int i=0; isetSelected(true); } // Resize the columns. - directoriesTreeWidget->resizeColumnToContents(0); + alternateDirectoriesTreeWidget->resizeColumnToContents(0); } -void SeerSourceConfigPage::handleDeleteButtonClicked () { +void SeerSourceConfigPage::handleDeleteAlternateButtonClicked () { - QList matches = directoriesTreeWidget->selectedItems(); + QList matches = alternateDirectoriesTreeWidget->selectedItems(); + + qDeleteAll(matches); +} + +void SeerSourceConfigPage::handleAddIgnoreButtonClicked () { + + // Ask for the ignore directory to add to the list. + QString directory = QInputDialog::getText(this, "Seer - Enter a directory to ignore", "Ignore directory:"); + + if (directory == "") { + return; + } + + // Create the new item + QTreeWidgetItem* topItem = new QTreeWidgetItem; + topItem->setText(0, directory); + + // Just add it to the end of the list. + ignoreDirectoriesTreeWidget->addTopLevelItem(topItem); + + // Resize the columns and select the item we just added. + ignoreDirectoriesTreeWidget->resizeColumnToContents(0); + + ignoreDirectoriesTreeWidget->setCurrentItem(topItem, 0); +} + +void SeerSourceConfigPage::handleDeleteIgnoreButtonClicked () { + + QList matches = ignoreDirectoriesTreeWidget->selectedItems(); qDeleteAll(matches); } diff --git a/src/SeerSourceConfigPage.h b/src/SeerSourceConfigPage.h index 1d33dc4..7ab136b 100644 --- a/src/SeerSourceConfigPage.h +++ b/src/SeerSourceConfigPage.h @@ -14,16 +14,22 @@ class SeerSourceConfigPage : public QWidget, public Ui::SeerSourceConfigPage { explicit SeerSourceConfigPage (QWidget* parent = 0); ~SeerSourceConfigPage (); - void setAlternateDirectories (const QStringList& alternateDirectories); - QStringList alternateDirectories () const; + void setAlternateDirectories (const QStringList& alternateDirectories); + QStringList alternateDirectories () const; - void reset (); + void setIgnoreDirectories (const QStringList& ignoreDirectories); + QStringList ignoreDirectories () const; + + void reset (); protected slots: - void handleAddButtonClicked (); - void handleUpButtonClicked (); - void handleDownButtonClicked (); - void handleDeleteButtonClicked (); + void handleAddAlternateButtonClicked (); + void handleUpAlternateButtonClicked (); + void handleDownAlternateButtonClicked (); + void handleDeleteAlternateButtonClicked (); + + void handleAddIgnoreButtonClicked (); + void handleDeleteIgnoreButtonClicked (); private: }; diff --git a/src/SeerSourceConfigPage.ui b/src/SeerSourceConfigPage.ui index f9b520c..51bf1cc 100644 --- a/src/SeerSourceConfigPage.ui +++ b/src/SeerSourceConfigPage.ui @@ -6,90 +6,396 @@ 0 0 - 728 - 445 + 804 + 852 SeerSourceConfigPage - - 0 - - - 0 - - - - - Add a new directory. - - - ... - - - - :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + Source Lookup + + + + + + + + 0 + 0 + + + + false + + + + Alternate Directories + + + + + + + + + + Add a new directory. + + + ... + + + + :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + + + + Move up selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/go-up.svg:/seer/resources/RelaxLightIcons/go-up.svg + + + + + + + Move down selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/go-down.svg:/seer/resources/RelaxLightIcons/go-down.svg + + + + + + + Delete selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 0 + 0 + + + + false + + + + Ignore Directories + + + + + + + + + + Add a new directory. + + + ... + + + + :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + + + + Delete selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + - - - - Move up selected directories. - - - ... - - - - :/seer/resources/RelaxLightIcons/go-up.svg:/seer/resources/RelaxLightIcons/go-up.svg + + + + Source Browser Filtering + + + + + + + + 0 + 0 + + + + false + + + + Misc Directories/Files + + + + + + + + + + Add a new directory. + + + ... + + + + :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + + + + Delete selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 0 + 0 + + + + false + + + + Source Directories/Files + + + + + + + + + + Add a new directory. + + + ... + + + + :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + + + + Delete selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + 0 + 0 + + + + false + + + + Header Directories/Files + + + + + + + + + + Add a new directory. + + + ... + + + + :/seer/resources/RelaxLightIcons/document-new.svg:/seer/resources/RelaxLightIcons/document-new.svg + + + + + + + Delete selected directories. + + + ... + + + + :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + - - - - Move down selected directories. - - - ... - - - - :/seer/resources/RelaxLightIcons/go-down.svg:/seer/resources/RelaxLightIcons/go-down.svg - - - - - - - Delete selected directories. - - - ... - - - - :/seer/resources/RelaxLightIcons/edit-delete.svg:/seer/resources/RelaxLightIcons/edit-delete.svg - - - - - - - Qt::Vertical - - - - 20 - 82 - - - - - + @@ -102,34 +408,40 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Specify alternate directories for locating source files.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Source Lookup.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If Seer can't find the source file in the directory that gdb knows of, then Seer will look in these directories in the order they appear.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If Seer can't find the source file in the directory that gdb knows of, then Seer will look in these <span style=" text-decoration: underline;">Alternate</span> directories in the order they appear. If Seer still can't find the source file, it will prompt you to enter the location. If you don't want to be prompted, add the directory path to the list of <span style=" text-decoration: underline;">Ignore</span> directories. Regex wildcarding is allowed.</p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If Seer still can't find the source file, it will prompt you to enter the location.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Source Browser Filtering.</span></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Select single or multiple entries in the list to move up, move down, or delete.</p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These settings affect how Seer sorts all the source and include filenames that a program references. These files appear in the Source Browser in one of three catagegories: <span style=" text-decoration: underline;">Source</span>, <span style=" text-decoration: underline;">Header</span>, or <span style=" text-decoration: underline;">Misc</span>.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">An entry can be a directory path, filename, or filename extension. Regex wildcarding is allowed and is encouraged for fine control.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Seer looks at the debug information for the program to create a list of all files the program references. Some are applicable to the the program, others are not.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The ones that are not, should be sorted into <span style=" text-decoration: underline;">Misc</span>. These can be system header files or system source files. The ones that are, are sorted into <span style=" text-decoration: underline;">Source</span> or <span style=" text-decoration: underline;">Header</span>, depending on the sorting settings.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For each file, it is compared to the sort patterns in the <span style=" text-decoration: underline;">Misc</span> category, then the <span style=" text-decoration: underline;">Source</span>, then the <span style=" text-decoration: underline;">Header</span> category. It it put into the first one that matches. If it doesn't match any, it is put into the <span style=" text-decoration: underline;">Misc</span> category.</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">For example, <span style=" text-decoration: underline;">Source</span> should have entries like:</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> *.cpp</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> *.c</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> *.go</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> *.asm</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Header</span> should have entries like:</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> *.h</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Misc</span> should have entries like:</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> /usr/include/*</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> </p></body></html> - - - - - 0 - 0 - - - - false - - - - Directories - - - - diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index 0cca944..e5b70a0 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -1,5 +1,6 @@ #include "SeerUtl.h" #include +#include #include // @@ -374,6 +375,20 @@ namespace Seer { return parts.join('.'); } + // + // + // + + bool matches (const QStringList& regexpatterns, const QString& string) { + + foreach (const auto& regex, regexpatterns) { + if (string.contains(QRegExp(regex))) { + return true; + } + } + + return false; + } // // diff --git a/src/SeerUtl.h b/src/SeerUtl.h index d693128..b72454d 100644 --- a/src/SeerUtl.h +++ b/src/SeerUtl.h @@ -16,6 +16,7 @@ namespace Seer { QStringList parseCommaList (const QString& str, QChar startBracket, QChar endBracket); QStringPair parseNameValue (const QString& str, QChar separator); QString varObjParent (const QString& str); + bool matches (const QStringList& regexpatterns, const QString& string); int createID (); diff --git a/src/SeerVarVisualizerWidget.cpp b/src/SeerVarVisualizerWidget.cpp index 7ea4327..953dc1b 100644 --- a/src/SeerVarVisualizerWidget.cpp +++ b/src/SeerVarVisualizerWidget.cpp @@ -241,7 +241,7 @@ void SeerVarVisualizerWidget::handleText (const QString& text) { QStringList child_list = Seer::parse(children_text, "child=", '{', '}', false); QString hasmore_text = Seer::parseFirst(text, "has_more=", '"', '"', false); - for ( const auto& child_text : child_list ) { + for (const auto& child_text : child_list) { QString name_text = Seer::parseFirst(child_text, "name=", '"', '"', false); QString exp_text = Seer::parseFirst(child_text, "exp=", '"', '"', false); @@ -354,7 +354,7 @@ void SeerVarVisualizerWidget::handleText (const QString& text) { QString changelist_text = Seer::parseFirst(text, "changelist=", '[', ']', false); QStringList child_list = Seer::parse(changelist_text, "", '{', '}', false); - for ( const auto& child_text : child_list ) { + for (const auto& child_text : child_list) { QString name_text = Seer::parseFirst(child_text, "name=", '"', '"', false); QString value_text = Seer::parseFirst(child_text, "value=", '"', '"', false); diff --git a/tests/helloasm/README.asm b/tests/helloasm/README.asm index afdd580..60d7c15 100644 --- a/tests/helloasm/README.asm +++ b/tests/helloasm/README.asm @@ -3,7 +3,7 @@ Steps to compile an asm program. % nasm -f elf -F stabs helloasm.asm -o helloasm_stabs.o % ld -m elf_i386 helloasm_stabs.o -o helloasm_stabs - % seer -s helloasm_stabs + % seergdb -s --sat yes --bf _start helloasm_stabs Find address to set start breakpoint.