Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions DSView/pv/dock/protocoldock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
_bot_set_button->setFlat(true);
_bot_save_button = new QPushButton(bot_panel);
_bot_save_button->setFlat(true);
_auto_scroll_button = new QPushButton(bot_panel);
_auto_scroll_button->setFlat(true);
_auto_scroll_button->setCheckable(true);
_dn_nav_button = new QPushButton(bot_panel);
_dn_nav_button->setFlat(true);
_bot_title_label = new QLabel(bot_panel);
Expand All @@ -149,6 +152,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio
bot_title_layout->addWidget(_bot_set_button);
bot_title_layout->addWidget(_bot_save_button);
bot_title_layout->addWidget(_bot_title_label, 1);
bot_title_layout->addWidget(_auto_scroll_button);
bot_title_layout->addWidget(_dn_nav_button);

_pre_button = new QPushButton(bot_panel);
Expand Down Expand Up @@ -206,6 +210,7 @@ ProtocolDock::ProtocolDock(QWidget *parent, view::View &view, SigSession *sessio

retranslateUi();

connect(_auto_scroll_button, SIGNAL(clicked()),this, SLOT(auto_scroll()));
connect(_dn_nav_button, SIGNAL(clicked()),this, SLOT(nav_table_view()));
connect(_bot_save_button, SIGNAL(clicked()),this, SLOT(export_table_view()));
connect(_bot_set_button, SIGNAL(clicked()),this, SLOT(set_model()));
Expand Down Expand Up @@ -260,6 +265,7 @@ void ProtocolDock::reStyle()
_del_all_button->setIcon(QIcon(iconPath+"/del.svg"));
_bot_set_button->setIcon(QIcon(iconPath+"/gear.svg"));
_bot_save_button->setIcon(QIcon(iconPath+"/save.svg"));
_auto_scroll_button->setIcon(QIcon(iconPath+"/loop.svg"));
_dn_nav_button->setIcon(QIcon(iconPath+"/nav.svg"));
_pre_button->setIcon(QIcon(iconPath+"/pre.svg"));
_nxt_button->setIcon(QIcon(iconPath+"/next.svg"));
Expand Down Expand Up @@ -522,6 +528,8 @@ void ProtocolDock::update_model()
_model_proxy.setSourceModel(decoder_model);
search_done();
resize_table_view(decoder_model);

auto_scroll();
}

void ProtocolDock::resize_table_view(data::DecoderModel* decoder_model)
Expand Down Expand Up @@ -620,6 +628,14 @@ void ProtocolDock::export_table_view()
protocolexp_dlg->exec();
}

void ProtocolDock::auto_scroll()
{
if (_auto_scroll_button->isChecked()) {
_table_view->scrollToBottom();
_table_view->clearSelection();
}
}

void ProtocolDock::nav_table_view()
{
uint64_t row_index = 0;
Expand Down
2 changes: 2 additions & 0 deletions DSView/pv/dock/protocoldock.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ private slots:
void set_model();
void export_table_view();
void nav_table_view();
void auto_scroll();
void item_clicked(const QModelIndex &index);
void column_resize(int index, int old_size, int new_size);
void search_pre();
Expand Down Expand Up @@ -164,6 +165,7 @@ private slots:

QPushButton *_bot_set_button;
QPushButton *_bot_save_button;
QPushButton *_auto_scroll_button;
QPushButton *_dn_nav_button;
QPushButton *_ann_search_button;
std::vector<DecoderInfoItem*> _decoderInfoList;
Expand Down