Skip to content

Commit

Permalink
gui: create action for terminal inspection
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurckoucher@gmail.com>
  • Loading branch information
AcKoucher committed Jun 19, 2024
1 parent dbad70b commit 9d44904
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 9 deletions.
39 changes: 30 additions & 9 deletions src/gui/src/timingWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ TimingWidget::TimingWidget(QWidget* parent)
delay_detail_splitter_(new QSplitter(Qt::Vertical, this)),
delay_widget_(new QTabWidget(this)),
detail_widget_(new QTabWidget(this)),
focus_view_(nullptr)
focus_view_(nullptr),
focus_detail_view_(nullptr)
{
setObjectName("timing_report"); // for settings

Expand Down Expand Up @@ -357,8 +358,29 @@ void TimingWidget::addDetailPathPinMenuActions()
{
QMenu* go_to_menu = detail_path_pin_menu_->addMenu("Go to");

connect(go_to_menu->addAction("Terminal Inspection"),
&QAction::triggered,
[this] { selectAndEmitDetailPathTerm(); });

go_to_menu->addAction("Verilog Line");
go_to_menu->addAction("Instance");
}

void TimingWidget::selectAndEmitDetailPathTerm()
{
TimingPathDetailModel* focus_detail_model
= static_cast<TimingPathDetailModel*>(focus_detail_view_->model());
const TimingPathNode* selected_node
= focus_detail_model->getNodeAt(detail_path_table_index_);

Gui* gui = Gui::get();
odb::dbITerm* iterm = selected_node->getPinAsITerm();
if (iterm) {
emit inspect(gui->makeSelected(iterm));
return;
}

odb::dbBTerm* bterm = selected_node->getPinAsBTerm();
emit inspect(gui->makeSelected(bterm));
}

void TimingWidget::showDetailPathPinMenu(const QPoint& pos)
Expand All @@ -368,22 +390,21 @@ void TimingWidget::showDetailPathPinMenu(const QPoint& pos)
return;
}

QTableView* current_table = nullptr;

const int data_path_tab_index = 0;
if (detail_widget_->isTabVisible(data_path_tab_index)) {
current_table = path_details_table_view_;
focus_detail_view_ = path_details_table_view_;
} else {
current_table = capture_details_table_view_;
focus_detail_view_ = capture_details_table_view_;
}

const int pin_column = 0;
if (current_table->columnAt(pos.x()) != pin_column) {
if (focus_detail_view_->columnAt(pos.x()) != pin_column) {
return;
}

detail_path_table_index_ = current_table->indexAt(pos);
detail_path_pin_menu_->popup(current_table->viewport()->mapToGlobal(pos));
detail_path_table_index_ = focus_detail_view_->indexAt(pos);
detail_path_pin_menu_->popup(
focus_detail_view_->viewport()->mapToGlobal(pos));
}

void TimingWidget::showCommandsMenu(const QPoint& pos)
Expand Down
2 changes: 2 additions & 0 deletions src/gui/src/timingWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class TimingWidget : public QDockWidget

private slots:
void hideColumn(int index, bool checked);
void selectAndEmitDetailPathTerm();

protected:
void keyPressEvent(QKeyEvent* key_event) override;
Expand Down Expand Up @@ -176,6 +177,7 @@ class TimingWidget : public QDockWidget
QTabWidget* detail_widget_;

QTableView* focus_view_;
QTableView* focus_detail_view_;

QVector<bool> initial_columns_visibility_; // from settings
};
Expand Down

0 comments on commit 9d44904

Please sign in to comment.