forked from Ivasoft/DSView
Reload device list when machine awaked
This commit is contained in:
@@ -2221,6 +2221,11 @@ namespace pv
|
||||
QWidget* MainWindow::GetBodyView()
|
||||
{
|
||||
return _view;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::OnWindowsPowerEvent(bool bEnterSleep)
|
||||
{
|
||||
_session->ProcessPowerEvent(bEnterSleep);
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -134,6 +134,8 @@ public:
|
||||
void switchLanguage(int language) override;
|
||||
bool able_to_close();
|
||||
QWidget* GetBodyView();
|
||||
|
||||
void OnWindowsPowerEvent(bool bEnterSleep);
|
||||
|
||||
private:
|
||||
void setup_ui();
|
||||
|
||||
@@ -2586,4 +2586,16 @@ namespace pv
|
||||
on_load_config_end();
|
||||
}
|
||||
|
||||
void SigSession::ProcessPowerEvent(bool bEnterSleep)
|
||||
{
|
||||
if (bEnterSleep){
|
||||
if (_is_working && _device_agent.is_hardware()){
|
||||
stop_capture();
|
||||
}
|
||||
}
|
||||
else{
|
||||
ds_reload_device_list();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace pv
|
||||
|
||||
@@ -453,6 +453,8 @@ public:
|
||||
|
||||
void apply_samplerate();
|
||||
|
||||
void ProcessPowerEvent(bool bEnterSleep);
|
||||
|
||||
private:
|
||||
void set_cur_samplelimits(uint64_t samplelimits);
|
||||
void set_cur_snap_samplerate(uint64_t samplerate);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "mainframe.h"
|
||||
#include "dsvdef.h"
|
||||
#include "appcontrol.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#define FIXED_WIDTH(widget) (widget->minimumWidth() >= widget->maximumWidth())
|
||||
#define FIXED_HEIGHT(widget) (widget->minimumHeight() >= widget->maximumHeight())
|
||||
@@ -373,6 +374,28 @@ LRESULT CALLBACK WinNativeWidget::WndProc(HWND hWnd, UINT message, WPARAM wParam
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_POWERBROADCAST:
|
||||
{
|
||||
if (self->_childWidget != NULL)
|
||||
{
|
||||
dsv::MainFrame *frame = dynamic_cast<dsv::MainFrame*>(self->_childWidget);
|
||||
dsv::MainWindow *mainWnd = dynamic_cast<dsv::MainWindow*>(frame->GetMainWindow());
|
||||
switch (wParam)
|
||||
{
|
||||
case PBT_APMQUERYSUSPEND:
|
||||
dsv_info("Windows enters sleep.")
|
||||
mainWnd->OnWindowsPowerEvent(true);
|
||||
break;
|
||||
|
||||
case PBT_APMRESUMESUSPEND:
|
||||
case PBT_APMRESUMECRITICAL:
|
||||
dsv_info("Windows be awaked.")
|
||||
mainWnd->OnWindowsPowerEvent(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
|
||||
Reference in New Issue
Block a user