Allow an alternate directory to look for the source file.

It's possible the location of a source file is not in the
location that gdb thinks. Seer now allows to load the source
file from an alternate directory using the Ctrl^O key while
in the code editor.
This commit is contained in:
Ernie Pasveer
2022-01-20 19:11:15 -06:00
parent 1afdf82f91
commit 46df5c8a55
4 changed files with 84 additions and 23 deletions
+23 -5
View File
@@ -38,6 +38,7 @@ SeerEditorWidget::SeerEditorWidget(QWidget *parent) : QWidget(parent) {
QObject::connect(searchCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidget::handleSearchCloseToolButton);
QObject::connect(alternateCloseToolButton, &QToolButton::clicked, this, &SeerEditorWidget::handleAlternateCloseToolButton);
QObject::connect(alternateFileOpenToolButton, &QToolButton::clicked, this, &SeerEditorWidget::handleAlternateFileOpenToolButton);
QObject::connect(alternateAcceptToolButton, &QToolButton::clicked, this, &SeerEditorWidget::handleAlternateAcceptToolButton);
QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showSearchBar, this, &SeerEditorWidget::showSearchBar);
QObject::connect(sourceWidget, &SeerEditorWidgetSourceArea::showAlternateBar, this, &SeerEditorWidget::showAlternateBar);
}
@@ -183,12 +184,29 @@ void SeerEditorWidget::handleAlternateCloseToolButton () {
void SeerEditorWidget::handleAlternateFileOpenToolButton () {
qDebug() << "fullname=" << sourceArea()->fullname();
qDebug() << "file =" << sourceArea()->file();
//qDebug() << "fullname =" << sourceArea()->fullname();
//qDebug() << "file =" << sourceArea()->file();
QString fileName = QFileDialog::getOpenFileName(this, "Locate File", sourceArea()->fullname(), QString("File (%1)").arg(sourceArea()->file()), nullptr, QFileDialog::DontUseNativeDialog);
QString filename = QFileDialog::getOpenFileName(this, "Locate File", sourceArea()->fullname(), QString("File (%1)").arg(sourceArea()->file()), nullptr, QFileDialog::DontUseNativeDialog);
qDebug() << "location=" << fileName;
qDebug() << "path =" << QFileInfo(fileName).absolutePath();
//qDebug() << "location =" << filename;
//qDebug() << "directory=" << QFileInfo(filename).absolutePath();
if (filename != "") {
alternateLineEdit->setText(QFileInfo(filename).absolutePath());
}
}
void SeerEditorWidget::handleAlternateAcceptToolButton () {
showAlternateBar(false);
QString dirname = alternateLineEdit->text();
//qDebug() << "alternate dirname=" << dirname;
if (dirname != "") {
sourceArea()->open(sourceArea()->fullname(), sourceArea()->file(), dirname);
}
}