forked from Ivasoft/DSView
Do not load the device until the window is ready
This commit is contained in:
@@ -296,11 +296,9 @@ namespace pv
|
||||
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view, SLOT(set_trig_pos(int)));
|
||||
|
||||
_delay_prop_msg_timer.SetCallback(std::bind(&MainWindow::on_delay_prop_msg, this));
|
||||
|
||||
|
||||
_logo_bar->set_mainform_callback(this);
|
||||
|
||||
bool bLoadFile = false;
|
||||
|
||||
// Try load from file.
|
||||
QString ldFileName(AppControl::Instance()->_open_file_name.c_str());
|
||||
if (ldFileName != "")
|
||||
@@ -311,12 +309,6 @@ namespace pv
|
||||
{
|
||||
dsv_info("Auto load file:%s", file_name.c_str());
|
||||
tmp_file = ldFileName;
|
||||
bLoadFile = true;
|
||||
|
||||
QTimer::singleShot(100, this, [this](){
|
||||
on_load_file(tmp_file);
|
||||
tmp_file = "";
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -325,14 +317,27 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
if (!bLoadFile){
|
||||
QTimer::singleShot(100, this, [this](){
|
||||
_session->set_default_device();
|
||||
});
|
||||
// Load the device after the view is ready.
|
||||
connect(&_load_device_timer, SIGNAL(timeout()), this, SLOT(on_load_device_first()));
|
||||
_load_device_timer.start(100);
|
||||
}
|
||||
|
||||
void MainWindow::on_load_device_first()
|
||||
{
|
||||
if (_view->view_is_ready())
|
||||
{
|
||||
if (tmp_file != ""){
|
||||
on_load_file(tmp_file);
|
||||
tmp_file = "";
|
||||
}
|
||||
else{
|
||||
_session->set_default_device();
|
||||
}
|
||||
|
||||
_load_device_timer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
//*
|
||||
void MainWindow::retranslateUi()
|
||||
{
|
||||
_trigger_dock->setWindowTitle(L_S(STR_PAGE_DLG, S_ID(IDS_DLG_TRIGGER_DOCK_TITLE), "Trigger Setting..."));
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "eventobject.h"
|
||||
#include <QJsonDocument>
|
||||
#include <chrono>
|
||||
#include <QTimer>
|
||||
#include "dstimer.h"
|
||||
|
||||
class QAction;
|
||||
@@ -123,6 +124,7 @@ private slots:
|
||||
void on_cur_snap_samplerate_changed();
|
||||
void on_trigger_message(int msg);
|
||||
void on_delay_prop_msg();
|
||||
void on_load_device_first();
|
||||
|
||||
signals:
|
||||
void prgRate(int progress);
|
||||
@@ -241,7 +243,8 @@ private:
|
||||
QString _title_ext_string;
|
||||
|
||||
int _key_value;
|
||||
bool _key_vaild;
|
||||
bool _key_vaild;
|
||||
QTimer _load_device_timer;
|
||||
};
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -1516,5 +1516,11 @@ void View::UpdateFont()
|
||||
update_font();
|
||||
}
|
||||
|
||||
bool View::view_is_ready()
|
||||
{
|
||||
int w = get_view_width();
|
||||
return w > 0;
|
||||
}
|
||||
|
||||
} // namespace view
|
||||
} // namespace pv
|
||||
|
||||
@@ -333,6 +333,8 @@ public:
|
||||
void UpdateTheme() override;
|
||||
void UpdateFont() override;
|
||||
|
||||
bool view_is_ready();
|
||||
|
||||
signals:
|
||||
void hover_point_changed();
|
||||
void cursor_update();
|
||||
|
||||
Reference in New Issue
Block a user