continues to push notification when export gcode

This commit is contained in:
QIDI TECH
2023-08-18 15:10:30 +08:00
parent c8a236e92f
commit a8e0bd3669
2 changed files with 29 additions and 1 deletions

View File

@@ -2841,15 +2841,41 @@ bool NotificationManager::update_notifications(GLCanvas3D& canvas)
}
}
// update state of all notif and erase finished
//Y9
bool export_on_going = false;
bool export_finished = false;
std::string message = "12";
for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) {
std::unique_ptr<PopNotification>& notification = *it;
request_render |= notification->update_state(hover, time_since_render);
next_render = std::min<int64_t>(next_render, notification->next_render());
//Y9
if (notification->get_data().type == NotificationType::ExportFinished)
{
export_finished = true;
export_on_going = false;
}
if (notification->get_state() == PopNotification::EState::Finished)
{
if (!export_finished)
{
if (notification->get_data().type == NotificationType::ExportOngoing)
{
message = notification->get_data().text1;
export_on_going = true;
}
}
it = m_pop_notifications.erase(it);
}
else
++it;
}
//Y9
if (export_on_going)
{
message = message + ".";
push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, message);
}
// delayed notifications
for (auto it = m_waiting_notifications.begin(); it != m_waiting_notifications.end();) {

View File

@@ -3461,7 +3461,9 @@ void Plater::priv::export_gcode(fs::path output_path, bool output_path_on_remova
show_warning_dialog = true;
if (! output_path.empty()) {
background_process.schedule_export(output_path.string(), output_path_on_removable_media);
notification_manager->push_delayed_notification(NotificationType::ExportOngoing, []() {return true; }, 1000, 0);
//Y9
//notification_manager->push_delayed_notification(NotificationType::ExportOngoing, []() {return true; }, 1000, 0);
notification_manager->push_notification(NotificationType::ExportOngoing, NotificationManager::NotificationLevel::ProgressBarNotificationLevel, "aaa");
} else {
background_process.schedule_upload(std::move(upload_job));
}