diff --git a/qt/OpenRGBDialog/OpenRGBDialog.cpp b/qt/OpenRGBDialog/OpenRGBDialog.cpp index d747478c..c534e33b 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.cpp +++ b/qt/OpenRGBDialog/OpenRGBDialog.cpp @@ -150,6 +150,13 @@ static void DeletePluginCallback(void * this_ptr, OpenRGBPluginEntry* plugin) this_obj->RemovePlugin(plugin); } +static void DetectionStartedCallback(void * this_ptr) +{ + OpenRGBDialog * this_obj = (OpenRGBDialog *)this_ptr; + + QMetaObject::invokeMethod(this_obj, "onDetectionStarted", Qt::QueuedConnection); +} + static void DetectionEndedCallback(void * this_ptr) { OpenRGBDialog * this_obj = (OpenRGBDialog *)this_ptr; @@ -165,7 +172,6 @@ static void DialogShowCallback(void * this_ptr, PLogMessage msg) QMetaObject::invokeMethod(this_obj, "onShowDialogMessage", Qt::QueuedConnection); } - bool OpenRGBDialog::IsMinimizeOnClose() { json ui_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("UserInterface"); @@ -306,6 +312,7 @@ OpenRGBDialog::OpenRGBDialog(QWidget *parent) : QMainWindow(parent), ui(new Ui:: \*-----------------------------------------------------*/ ResourceManager::get()->RegisterDetectionProgressCallback(UpdateDetectionProgressCallback, this); ResourceManager::get()->RegisterDeviceListChangeCallback(UpdateDeviceListCallback, this); + ResourceManager::get()->RegisterDetectionStartCallback(DetectionStartedCallback, this); ResourceManager::get()->RegisterDetectionEndCallback(DetectionEndedCallback, this); /*-----------------------------------------------------*\ @@ -1294,6 +1301,26 @@ void OpenRGBDialog::onDetectionProgressUpdated() } } +void OpenRGBDialog::onDetectionStarted() +{ + /*---------------------------------------------------------*\ + | Hide devices view on rescan so it stops handling paint | + | events. | + | Memorize previous value of device_view_showing and | + | restore it. | + \*---------------------------------------------------------*/ + bool device_view_showing_prev = device_view_showing; + + HideLEDView(); + + device_view_showing = device_view_showing_prev; + + /*---------------------------------------------------------*\ + | Show the detection progress bar. | + \*---------------------------------------------------------*/ + SetDetectionViewState(true); +} + void OpenRGBDialog::onDetectionEnded() { /*-------------------------------------------------------*\ @@ -1686,23 +1713,6 @@ void OpenRGBDialog::SaveProfileAs() void OpenRGBDialog::on_ButtonRescan_clicked() { - /*---------------------------------------------------------*\ - | Hide devices view on rescan so it stops handling paint | - | events. | - | Memorize previous value of device_view_showing and | - | restore it. | - \*---------------------------------------------------------*/ - bool device_view_showing_prev = device_view_showing; - - HideLEDView(); - - device_view_showing = device_view_showing_prev; - - /*---------------------------------------------------------*\ - | Show the detection progress bar. | - \*---------------------------------------------------------*/ - SetDetectionViewState(true); - /*---------------------------------------------------------*\ | Show the detection progress bar. | \*---------------------------------------------------------*/ diff --git a/qt/OpenRGBDialog/OpenRGBDialog.h b/qt/OpenRGBDialog/OpenRGBDialog.h index 2dc13e4d..27454d53 100644 --- a/qt/OpenRGBDialog/OpenRGBDialog.h +++ b/qt/OpenRGBDialog/OpenRGBDialog.h @@ -148,6 +148,7 @@ private slots: void on_QuickWhite(); void onDeviceListUpdated(); void onDetectionProgressUpdated(); + void onDetectionStarted(); void onDetectionEnded(); void on_SetAllDevices(unsigned char red, unsigned char green, unsigned char blue); void on_SaveSizeProfile();