From 33c3e15c7bac54fb40bfc38dcf1e1a2cc4984ff2 Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Sat, 22 Oct 2022 11:35:30 -0500 Subject: [PATCH] Improve specifying alternate directory if the source has moved. --- CHANGELOG.md | 4 ++ debian/changelog | 2 +- src/CMakeLists.txt | 2 +- src/SeerEditorManagerWidget.cpp | 12 ++++- src/SeerEditorWidgetSource.cpp | 31 ++++++----- src/SeerEditorWidgetSource.h | 1 - src/SeerEditorWidgetSource.ui | 92 ++++++++++++++++++--------------- src/SeerUtl.cpp | 2 +- 8 files changed, 81 insertions(+), 65 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b8deb2..6c192a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Seer Change Log +## [1.13beta] - 2022-MM-DD + +* Improve specifying an alternate directory if the source has moved. Fewer mouse clicks. + ## [1.12] - 2022-10-22 * Added Gdb's Reverse Debugging mode. diff --git a/debian/changelog b/debian/changelog index 71e90b7..dac92d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -seergdb (1.12) UNRELEASED; urgency=medium +seergdb (1.13beta) UNRELEASED; urgency=medium * Updated release. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c58c942..ed9d29b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1.0) -project(seergdb VERSION 1.12 LANGUAGES CXX) +project(seergdb VERSION 1.13.0 LANGUAGES CXX) set(PROJECT_NAME seergdb) diff --git a/src/SeerEditorManagerWidget.cpp b/src/SeerEditorManagerWidget.cpp index 6573244..a84139a 100644 --- a/src/SeerEditorManagerWidget.cpp +++ b/src/SeerEditorManagerWidget.cpp @@ -83,10 +83,12 @@ void SeerEditorManagerWidget::dumpEntries () const { SeerEditorManagerEntries::const_iterator b = beginEntry(); SeerEditorManagerEntries::const_iterator e = endEntry(); + qDebug() << "Start"; while (b != e) { qDebug() << "\tFullname:" << b->fullname << "File:" << b->file; b++; } + qDebug() << "End"; } bool SeerEditorManagerWidget::hasEntry (const QString& fullname) const { @@ -100,6 +102,8 @@ bool SeerEditorManagerWidget::hasEntry (const QString& fullname) const { SeerEditorManagerEntries::iterator SeerEditorManagerWidget::addEntry (const QString& fullname, const QString& file) { + //qDebug() << "Add entry:" << fullname << file; + SeerEditorManagerEntry entry; entry.fullname = fullname; @@ -711,7 +715,9 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::editorWidgetTab (const QString& SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QString& fullname, const QString& file, const QString& text) { - //qDebug() << fullname << file << text << tabWidget->count() << tabWidget->tabText(0); + //qDebug() << "1:" << fullname << file << tabWidget->count() << tabWidget->tabText(0); + + //dumpEntries(); // Are we asked to ignore this file? if (Seer::matches(editorIgnoreDirectories(), fullname, QRegExp::WildcardUnix) == true) { @@ -766,7 +772,9 @@ SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QS SeerEditorWidgetSource* SeerEditorManagerWidget::createEditorWidgetTab (const QString& fullname, const QString& file) { - //qDebug() << fullname << file << tabWidget->count() << tabWidget->tabText(0); + //qDebug() << "2:" << fullname << file << tabWidget->count() << tabWidget->tabText(0); + + //dumpEntries(); // Are we asked to ignore this file? if (Seer::matches(editorIgnoreDirectories(), fullname, QRegExp::WildcardUnix) == true) { diff --git a/src/SeerEditorWidgetSource.cpp b/src/SeerEditorWidgetSource.cpp index 4aa0141..c5de9fe 100644 --- a/src/SeerEditorWidgetSource.cpp +++ b/src/SeerEditorWidgetSource.cpp @@ -46,7 +46,6 @@ SeerEditorWidgetSource::SeerEditorWidgetSource(QWidget* parent) : QWidget(parent 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(alternateAddToGlobalToolButton, &QToolButton::clicked, this, &SeerEditorWidgetSource::handleAlternateAddToGlobalToolButton); QObject::connect(alternateLineEdit, &QLineEdit::returnPressed, this, &SeerEditorWidgetSource::handleAlternateLineEdit); QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showSearchBar, this, &SeerEditorWidgetSource::showSearchBar); QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showAlternateBar, this, &SeerEditorWidgetSource::showAlternateBar); @@ -123,14 +122,12 @@ void SeerEditorWidgetSource::setSearchMatchCase (bool flag) { void SeerEditorWidgetSource::showAlternateBar (bool flag) { - // Set the label's text. - alternateLabel->setText("Enter directory path for '" + sourceArea()->file() + "'"); - alternateBarWidget->setVisible(flag); - // If 'show', give the alternateLineEdit the focus. if (flag) { - alternateLineEdit->setFocus(Qt::MouseFocusReason); + originalLineEdit->setText(sourceArea()->fullname()); // Set the original text. + rememberAlternateCheckBox->setChecked(true); // Set the default remember setting. + alternateLineEdit->setFocus(Qt::MouseFocusReason); // If 'show', give the alternateLineEdit the focus. } } @@ -212,28 +209,30 @@ void SeerEditorWidgetSource::handleAlternateFileOpenToolButton () { if (filename != "") { alternateLineEdit->setText(QFileInfo(filename).absolutePath()); } + + handleAlternateLineEdit(); } void SeerEditorWidgetSource::handleAlternateLineEdit () { showAlternateBar(false); + // Get the base path. QString dirname = alternateLineEdit->text(); - //qDebug() << "alternate dirname=" << dirname; - - sourceArea()->open(sourceArea()->fullname(), sourceArea()->file(), dirname); -} - -void SeerEditorWidgetSource::handleAlternateAddToGlobalToolButton () { - - if (alternateLineEdit->text() == "") { + if (dirname == "") { return; } - //qDebug() << "alternate dirname=" << alternateLineEdit->text(); + //qDebug() << "alternate dirname=" << dirname; - emit addAlternateDirectory(alternateLineEdit->text()); + // Attempt to open the file. + sourceArea()->open(sourceArea()->fullname(), sourceArea()->file(), dirname); + + // Add to global alternate list. + if (rememberAlternateCheckBox->isChecked()) { + emit addAlternateDirectory(dirname); + } } void SeerEditorWidgetSource::handleTextSearchShortcut () { diff --git a/src/SeerEditorWidgetSource.h b/src/SeerEditorWidgetSource.h index 4b8c775..f76e1f1 100644 --- a/src/SeerEditorWidgetSource.h +++ b/src/SeerEditorWidgetSource.h @@ -246,7 +246,6 @@ class SeerEditorWidgetSource : public QWidget, protected Ui::SeerEditorWidgetSou void handleAlternateCloseToolButton (); void handleAlternateFileOpenToolButton (); void handleAlternateLineEdit (); - void handleAlternateAddToGlobalToolButton (); void handleTextSearchShortcut (); void handleAlternateDirectoryShortcut (); diff --git a/src/SeerEditorWidgetSource.ui b/src/SeerEditorWidgetSource.ui index bbc93b8..8d66330 100644 --- a/src/SeerEditorWidgetSource.ui +++ b/src/SeerEditorWidgetSource.ui @@ -16,7 +16,7 @@ - + 0 @@ -29,24 +29,64 @@ 0 - - + + + + Looking for: + + + + + - Add path to global list of alternate directories. + Original path location. + + + true + + + + + + + Alternate path: + + + + + + + Enter path for alternate location. + + + Enter /path/to/alternate/location + + + true + + + + + + + Open file dialog for alternate location. ... - :/seer/resources/RelaxLightIcons/list-add.svg:/seer/resources/RelaxLightIcons/list-add.svg + :/seer/resources/RelaxLightIcons/document-open.svg:/seer/resources/RelaxLightIcons/document-open.svg - - + + + + Add path to global list of alternate directories. + - + Remember @@ -64,40 +104,6 @@ - - - - Qt::Vertical - - - - - - - Enter path for alternate location. - - - Enter /path/to/alternate/location - - - true - - - - - - - Open file dialog for alternate location. - - - ... - - - - :/seer/resources/RelaxLightIcons/document-open.svg:/seer/resources/RelaxLightIcons/document-open.svg - - - @@ -252,7 +258,7 @@ alternateLineEdit alternateFileOpenToolButton - alternateAddToGlobalToolButton + rememberAlternateCheckBox alternateCloseToolButton searchTextLineEdit matchCaseCheckBox diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index 1cc15e4..0e2d8a6 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -6,7 +6,7 @@ // Increment this with every release on GitHub. // See scripts/change_versionnumber // -#define SEER_VERSION "1.12" +#define SEER_VERSION "1.13beta" namespace Seer {