forked from Ivasoft/DSView
fix: Popup a message when there is no data to export
This commit is contained in:
@@ -69,6 +69,7 @@ DecoderStack::DecoderStack(pv::SigSession *session,
|
||||
_snapshot = NULL;
|
||||
_progress = 0;
|
||||
_is_decoding = false;
|
||||
_result_count = 0;
|
||||
|
||||
_stack.push_back(new decode::Decoder(dec));
|
||||
|
||||
@@ -375,6 +376,7 @@ void DecoderStack::init()
|
||||
_error_message = QString();
|
||||
_no_memory = false;
|
||||
_snapshot = NULL;
|
||||
_result_count = 0;
|
||||
|
||||
for (auto i = _rows.begin();i != _rows.end(); i++) {
|
||||
(*i).second->clear();
|
||||
@@ -802,6 +804,7 @@ void DecoderStack::annotation_callback(srd_proto_data *pdata, void *self)
|
||||
d->_no_memory = true;
|
||||
return;
|
||||
}
|
||||
d->_result_count++;
|
||||
|
||||
// Find the row
|
||||
assert(pdata->pdo);
|
||||
|
||||
@@ -183,6 +183,10 @@ public:
|
||||
|
||||
bool check_required_probes();
|
||||
|
||||
inline uint64_t get_result_count(){
|
||||
return _result_count;
|
||||
}
|
||||
|
||||
private:
|
||||
void decode_data(const uint64_t decode_start, const uint64_t decode_end, srd_session *const session);
|
||||
void execute_decode_stack();
|
||||
@@ -218,6 +222,7 @@ private:
|
||||
bool _is_capture_end;
|
||||
int _progress;
|
||||
bool _is_decoding;
|
||||
uint64_t _result_count;
|
||||
|
||||
friend class DecoderStackTest::TwoDecoderStack;
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "../utility/path.h"
|
||||
#include "../log.h"
|
||||
#include "../ui/langresource.h"
|
||||
#include "../ui/msgbox.h"
|
||||
|
||||
#define EXPORT_DEC_ROW_COUNT_MAX 20
|
||||
|
||||
@@ -108,7 +109,14 @@ ProtocolExp::ProtocolExp(QWidget *parent, SigSession *session) :
|
||||
}
|
||||
|
||||
void ProtocolExp::accept()
|
||||
{
|
||||
{
|
||||
if (_session->have_decoded_result() == false)
|
||||
{
|
||||
QString errMsg = L_S(STR_PAGE_MSG, S_ID(IDS_MSG_NO_DECODED_RESULT), "No data to export");
|
||||
MsgBox::Show(errMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
QDialog::accept();
|
||||
|
||||
if (_row_sel_list.empty()){
|
||||
|
||||
@@ -2556,4 +2556,15 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
bool SigSession::have_decoded_result()
|
||||
{
|
||||
for (auto trace : _decode_traces){
|
||||
if (trace->decoder()->get_result_count() > 0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -449,6 +449,8 @@ public:
|
||||
|
||||
void update_lang_text();
|
||||
|
||||
bool have_decoded_result();
|
||||
|
||||
private:
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||
|
||||
Reference in New Issue
Block a user