|
@@ -1,6 +1,7 @@
|
|
|
#include "NotificationManager.hpp"
|
|
|
|
|
|
#include "GUI_App.hpp"
|
|
|
+#include "GUI.hpp"
|
|
|
#include "Plater.hpp"
|
|
|
#include "GLCanvas3D.hpp"
|
|
|
#include "ImGuiWrapper.hpp"
|
|
@@ -33,6 +34,56 @@ namespace Notifications_Internal{
|
|
|
else
|
|
|
ImGui::PushStyleColor(idx, col);
|
|
|
}
|
|
|
+
|
|
|
+ void open_folder(const std::string& path)
|
|
|
+ {
|
|
|
+ // Code taken from desktop_open_datadir_folder()
|
|
|
+
|
|
|
+ // Execute command to open a file explorer, platform dependent.
|
|
|
+ // FIXME: The const_casts aren't needed in wxWidgets 3.1, remove them when we upgrade.
|
|
|
+
|
|
|
+#ifdef _WIN32
|
|
|
+ const wxString widepath = from_u8(path);
|
|
|
+ const wchar_t* argv[] = { L"explorer", widepath.GetData(), nullptr };
|
|
|
+ ::wxExecute(const_cast<wchar_t**>(argv), wxEXEC_ASYNC, nullptr);
|
|
|
+#elif __APPLE__
|
|
|
+ const char* argv[] = { "open", path.data(), nullptr };
|
|
|
+ ::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr);
|
|
|
+#else
|
|
|
+ const char* argv[] = { "xdg-open", path.data(), nullptr };
|
|
|
+
|
|
|
+ // Check if we're running in an AppImage container, if so, we need to remove AppImage's env vars,
|
|
|
+ // because they may mess up the environment expected by the file manager.
|
|
|
+ // Mostly this is about LD_LIBRARY_PATH, but we remove a few more too for good measure.
|
|
|
+ if (wxGetEnv("APPIMAGE", nullptr)) {
|
|
|
+ // We're running from AppImage
|
|
|
+ wxEnvVariableHashMap env_vars;
|
|
|
+ wxGetEnvMap(&env_vars);
|
|
|
+
|
|
|
+ env_vars.erase("APPIMAGE");
|
|
|
+ env_vars.erase("APPDIR");
|
|
|
+ env_vars.erase("LD_LIBRARY_PATH");
|
|
|
+ env_vars.erase("LD_PRELOAD");
|
|
|
+ env_vars.erase("UNION_PRELOAD");
|
|
|
+
|
|
|
+ wxExecuteEnv exec_env;
|
|
|
+ exec_env.env = std::move(env_vars);
|
|
|
+
|
|
|
+ wxString owd;
|
|
|
+ if (wxGetEnv("OWD", &owd)) {
|
|
|
+ // This is the original work directory from which the AppImage image was run,
|
|
|
+ // set it as CWD for the child process:
|
|
|
+ exec_env.cwd = std::move(owd);
|
|
|
+ }
|
|
|
+
|
|
|
+ ::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ // Looks like we're NOT running from AppImage, we'll make no changes to the environment.
|
|
|
+ ::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, nullptr);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
#if 1
|
|
@@ -183,6 +234,7 @@ NotificationManager::PopNotification::RenderResult NotificationManager::PopNotif
|
|
|
render_left_sign(imgui);
|
|
|
render_text(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
|
|
|
render_close_button(imgui, win_size.x, win_size.y, win_pos.x, win_pos.y);
|
|
|
+ m_minimize_b_visible = false;
|
|
|
if (m_multiline && m_lines_count > 3)
|
|
|
render_minimize_button(imgui, win_pos.x, win_pos.y);
|
|
|
} else {
|
|
@@ -205,12 +257,8 @@ NotificationManager::PopNotification::RenderResult NotificationManager::PopNotif
|
|
|
ImGui::PopStyleColor();
|
|
|
return ret_val;
|
|
|
}
|
|
|
-void NotificationManager::PopNotification::init()
|
|
|
+void NotificationManager::PopNotification::count_spaces()
|
|
|
{
|
|
|
- std::string text = m_text1 + " " + m_hypertext;
|
|
|
- int last_end = 0;
|
|
|
- m_lines_count = 0;
|
|
|
-
|
|
|
//determine line width
|
|
|
m_line_height = ImGui::CalcTextSize("A").y;
|
|
|
|
|
@@ -221,8 +269,16 @@ void NotificationManager::PopNotification::init()
|
|
|
float picture_width = ImGui::CalcTextSize(text.c_str()).x;
|
|
|
m_left_indentation = picture_width + m_line_height / 2;
|
|
|
}
|
|
|
- m_window_width_offset = m_left_indentation + m_line_height * 2;
|
|
|
+ m_window_width_offset = m_left_indentation + m_line_height * 3.f;
|
|
|
m_window_width = m_line_height * 25;
|
|
|
+}
|
|
|
+void NotificationManager::PopNotification::init()
|
|
|
+{
|
|
|
+ std::string text = m_text1 + " " + m_hypertext;
|
|
|
+ int last_end = 0;
|
|
|
+ m_lines_count = 0;
|
|
|
+
|
|
|
+ count_spaces();
|
|
|
|
|
|
// count lines
|
|
|
m_endlines.clear();
|
|
@@ -233,10 +289,9 @@ void NotificationManager::PopNotification::init()
|
|
|
//next line is ended by '/n'
|
|
|
m_endlines.push_back(next_hard_end);
|
|
|
last_end = next_hard_end + 1;
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
// find next suitable endline
|
|
|
- if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - 3.5f * m_line_height) {// m_window_width_offset) {
|
|
|
+ if (ImGui::CalcTextSize(text.substr(last_end).c_str()).x >= m_window_width - m_window_width_offset) {
|
|
|
// more than one line till end
|
|
|
int next_space = text.find_first_of(' ', last_end);
|
|
|
if (next_space > 0) {
|
|
@@ -245,8 +300,19 @@ void NotificationManager::PopNotification::init()
|
|
|
next_space = next_space_candidate;
|
|
|
next_space_candidate = text.find_first_of(' ', next_space + 1);
|
|
|
}
|
|
|
- m_endlines.push_back(next_space);
|
|
|
- last_end = next_space + 1;
|
|
|
+ // when one word longer than line.
|
|
|
+ if (ImGui::CalcTextSize(text.substr(last_end, next_space - last_end).c_str()).x > m_window_width - m_window_width_offset) {
|
|
|
+ float width_of_a = ImGui::CalcTextSize("a").x;
|
|
|
+ int letter_count = (int)((m_window_width - m_window_width_offset) / width_of_a);
|
|
|
+ while (last_end + letter_count < text.size() && ImGui::CalcTextSize(text.substr(last_end, letter_count).c_str()).x < m_window_width - m_window_width_offset) {
|
|
|
+ letter_count++;
|
|
|
+ }
|
|
|
+ m_endlines.push_back(last_end + letter_count);
|
|
|
+ last_end += letter_count;
|
|
|
+ } else {
|
|
|
+ m_endlines.push_back(next_space);
|
|
|
+ last_end = next_space + 1;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
@@ -257,6 +323,8 @@ void NotificationManager::PopNotification::init()
|
|
|
}
|
|
|
m_lines_count++;
|
|
|
}
|
|
|
+ if (m_lines_count == 3)
|
|
|
+ m_multiline = true;
|
|
|
m_initialized = true;
|
|
|
}
|
|
|
void NotificationManager::PopNotification::set_next_window_size(ImGuiWrapper& imgui)
|
|
@@ -285,7 +353,8 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons
|
|
|
float shift_y = m_line_height;// -m_line_height / 20;
|
|
|
for (size_t i = 0; i < m_lines_count; i++) {
|
|
|
std::string line = m_text1.substr(last_end , m_endlines[i] - last_end);
|
|
|
- last_end = m_endlines[i] + 1;
|
|
|
+ if(i < m_lines_count - 1)
|
|
|
+ last_end = m_endlines[i] + (m_text1[m_endlines[i]] == '\n' || m_text1[m_endlines[i]] == ' ' ? 1 : 0);
|
|
|
ImGui::SetCursorPosX(x_offset);
|
|
|
ImGui::SetCursorPosY(starting_y + i * shift_y);
|
|
|
imgui.text(line.c_str());
|
|
@@ -303,7 +372,7 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons
|
|
|
ImGui::SetCursorPosY(win_size.y / 2 - win_size.y / 6 - m_line_height / 2);
|
|
|
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
|
|
|
// line2
|
|
|
- std::string line = m_text1.substr(m_endlines[0] + 1, m_endlines[1] - m_endlines[0] - 1);
|
|
|
+ std::string line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0), m_endlines[1] - m_endlines[0] - (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
|
|
|
if (ImGui::CalcTextSize(line.c_str()).x > m_window_width - m_window_width_offset - ImGui::CalcTextSize((".." + _u8L("More")).c_str()).x)
|
|
|
{
|
|
|
line = line.substr(0, line.length() - 6);
|
|
@@ -326,7 +395,7 @@ void NotificationManager::PopNotification::render_text(ImGuiWrapper& imgui, cons
|
|
|
ImGui::SetCursorPosY(win_size.y / 2 - win_size.y / 6 - m_line_height / 2);
|
|
|
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
|
|
|
// line2
|
|
|
- std::string line = m_text1.substr(m_endlines[0] + 1);
|
|
|
+ std::string line = m_text1.substr(m_endlines[0] + (m_text1[m_endlines[0]] == '\n' || m_text1[m_endlines[0]] == ' ' ? 1 : 0));
|
|
|
cursor_y = win_size.y / 2 + win_size.y / 6 - m_line_height / 2;
|
|
|
ImGui::SetCursorPosX(x_offset);
|
|
|
ImGui::SetCursorPosY(cursor_y);
|
|
@@ -375,8 +444,7 @@ void NotificationManager::PopNotification::render_hypertext(ImGuiWrapper& imgui,
|
|
|
set_next_window_size(imgui);
|
|
|
}
|
|
|
else {
|
|
|
- on_text_click();
|
|
|
- m_close_pending = true;
|
|
|
+ m_close_pending = on_text_click();
|
|
|
}
|
|
|
}
|
|
|
ImGui::PopStyleColor();
|
|
@@ -407,7 +475,7 @@ void NotificationManager::PopNotification::render_hypertext(ImGuiWrapper& imgui,
|
|
|
void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
|
|
|
{
|
|
|
ImVec2 win_size(win_size_x, win_size_y);
|
|
|
- ImVec2 win_pos(win_pos_x, win_pos_y);
|
|
|
+ ImVec2 win_pos(win_pos_x, win_pos_y);
|
|
|
ImVec4 orange_color = ImGui::GetStyleColorVec4(ImGuiCol_Button);
|
|
|
orange_color.w = 0.8f;
|
|
|
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
|
|
@@ -422,7 +490,7 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
|
|
|
button_text = ImGui::CloseIconMarker;
|
|
|
|
|
|
if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - win_size.x / 10.f, win_pos.y),
|
|
|
- ImVec2(win_pos.x, win_pos.y + win_size.y - (m_multiline? 2 * m_line_height : 0)),
|
|
|
+ ImVec2(win_pos.x, win_pos.y + win_size.y - ( m_minimize_b_visible ? 2 * m_line_height : 0)),
|
|
|
true))
|
|
|
{
|
|
|
button_text = ImGui::CloseIconHoverMarker;
|
|
@@ -435,11 +503,10 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
|
|
|
{
|
|
|
m_close_pending = true;
|
|
|
}
|
|
|
-
|
|
|
//invisible large button
|
|
|
- ImGui::SetCursorPosX(win_size.x - win_size.x / 10.f);
|
|
|
+ ImGui::SetCursorPosX(win_size.x - m_line_height * 2.125);
|
|
|
ImGui::SetCursorPosY(0);
|
|
|
- if (imgui.button(" ", win_size.x / 10.f, win_size.y - (m_multiline ? 2 * m_line_height : 0)))
|
|
|
+ if (imgui.button(" ", m_line_height * 2.125, win_size.y - ( m_minimize_b_visible ? 2 * m_line_height : 0)))
|
|
|
{
|
|
|
m_close_pending = true;
|
|
|
}
|
|
@@ -540,15 +607,12 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
|
|
|
ImGui::PopStyleColor();
|
|
|
ImGui::PopStyleColor();
|
|
|
ImGui::PopStyleColor();
|
|
|
+ m_minimize_b_visible = true;
|
|
|
}
|
|
|
-void NotificationManager::PopNotification::on_text_click()
|
|
|
+bool NotificationManager::PopNotification::on_text_click()
|
|
|
{
|
|
|
+ bool ret = true;
|
|
|
switch (m_data.type) {
|
|
|
- case NotificationType::ExportToRemovableFinished :
|
|
|
- assert(m_evt_handler != nullptr);
|
|
|
- if (m_evt_handler != nullptr)
|
|
|
- wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED));
|
|
|
- break;
|
|
|
case NotificationType::SlicingComplete :
|
|
|
//wxGetApp().plater()->export_gcode(false);
|
|
|
assert(m_evt_handler != nullptr);
|
|
@@ -567,6 +631,7 @@ void NotificationManager::PopNotification::on_text_click()
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ return ret;
|
|
|
}
|
|
|
void NotificationManager::PopNotification::update(const NotificationData& n)
|
|
|
{
|
|
@@ -633,6 +698,127 @@ void NotificationManager::SlicingCompleteLargeNotification::set_large(bool l)
|
|
|
m_hypertext = l ? _u8L("Export G-Code.") : std::string();
|
|
|
m_hidden = !l;
|
|
|
}
|
|
|
+//---------------ExportFinishedNotification-----------
|
|
|
+void NotificationManager::ExportFinishedNotification::count_spaces()
|
|
|
+{
|
|
|
+ //determine line width
|
|
|
+ m_line_height = ImGui::CalcTextSize("A").y;
|
|
|
+
|
|
|
+ m_left_indentation = m_line_height;
|
|
|
+ if (m_data.level == NotificationLevel::ErrorNotification || m_data.level == NotificationLevel::WarningNotification) {
|
|
|
+ std::string text;
|
|
|
+ text = (m_data.level == NotificationLevel::ErrorNotification ? ImGui::ErrorMarker : ImGui::WarningMarker);
|
|
|
+ float picture_width = ImGui::CalcTextSize(text.c_str()).x;
|
|
|
+ m_left_indentation = picture_width + m_line_height / 2;
|
|
|
+ }
|
|
|
+ //TODO count this properly
|
|
|
+ m_window_width_offset = m_left_indentation + m_line_height * (m_to_removable ? 5.f : 3.f);
|
|
|
+ m_window_width = m_line_height * 25;
|
|
|
+}
|
|
|
+
|
|
|
+void NotificationManager::ExportFinishedNotification::render_text(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
|
|
|
+{
|
|
|
+
|
|
|
+ ImVec2 win_size(win_size_x, win_size_y);
|
|
|
+ ImVec2 win_pos(win_pos_x, win_pos_y);
|
|
|
+ float x_offset = m_left_indentation;
|
|
|
+ std::string fulltext = m_text1 + m_hypertext; //+ m_text2;
|
|
|
+ ImVec2 text_size = ImGui::CalcTextSize(fulltext.c_str());
|
|
|
+ // Lines are always at least two and m_multiline is always true for ExportFinishedNotification.
|
|
|
+ // First line has "Export Finished" text and than hyper text open folder.
|
|
|
+ // Following lines are path to gcode.
|
|
|
+ int last_end = 0;
|
|
|
+ float starting_y = m_line_height / 2;//10;
|
|
|
+ float shift_y = m_line_height;// -m_line_height / 20;
|
|
|
+ for (size_t i = 0; i < m_lines_count; i++) {
|
|
|
+ std::string line = m_text1.substr(last_end, m_endlines[i] - last_end);
|
|
|
+ if (i < m_lines_count - 1)
|
|
|
+ last_end = m_endlines[i] + (m_text1[m_endlines[i]] == '\n' || m_text1[m_endlines[i]] == ' ' ? 1 : 0);
|
|
|
+ ImGui::SetCursorPosX(x_offset);
|
|
|
+ ImGui::SetCursorPosY(starting_y + i * shift_y);
|
|
|
+ imgui.text(line.c_str());
|
|
|
+ //hyperlink text
|
|
|
+ if ( i == 0 ) {
|
|
|
+ render_hypertext(imgui, x_offset + ImGui::CalcTextSize(m_text1.substr(0, last_end).c_str()).x + ImGui::CalcTextSize(" ").x, starting_y, _u8L("Open Folder."));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+void NotificationManager::ExportFinishedNotification::render_close_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
|
|
|
+{
|
|
|
+ PopNotification::render_close_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
|
|
|
+ if(m_to_removable)
|
|
|
+ render_eject_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
|
|
|
+}
|
|
|
+
|
|
|
+void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
|
|
|
+{
|
|
|
+ ImVec2 win_size(win_size_x, win_size_y);
|
|
|
+ ImVec2 win_pos(win_pos_x, win_pos_y);
|
|
|
+ ImVec4 orange_color = ImGui::GetStyleColorVec4(ImGuiCol_Button);
|
|
|
+ orange_color.w = 0.8f;
|
|
|
+ ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(.0f, .0f, .0f, .0f));
|
|
|
+ ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(.0f, .0f, .0f, .0f));
|
|
|
+ Notifications_Internal::push_style_color(ImGuiCol_Text, ImVec4(1.f, 1.f, 1.f, 1.f), m_fading_out, m_current_fade_opacity);
|
|
|
+ Notifications_Internal::push_style_color(ImGuiCol_TextSelectedBg, ImVec4(0, .75f, .75f, 1.f), m_fading_out, m_current_fade_opacity);
|
|
|
+ ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(.0f, .0f, .0f, .0f));
|
|
|
+
|
|
|
+ std::string button_text;
|
|
|
+ button_text = ImGui::EjectMarker;
|
|
|
+
|
|
|
+ if (ImGui::IsMouseHoveringRect(ImVec2(win_pos.x - m_line_height * 4.5f, win_pos.y),
|
|
|
+ ImVec2(win_pos.x - m_line_height * 2.5f, win_pos.y + win_size.y),
|
|
|
+ true))
|
|
|
+ {
|
|
|
+ button_text = ImGui::EjectHoverMarker;
|
|
|
+ // tooltip
|
|
|
+ long time_now = wxGetLocalTime();
|
|
|
+ if (m_hover_time > 0 && m_hover_time < time_now) {
|
|
|
+ ImGui::PushStyleColor(ImGuiCol_PopupBg, ImGuiWrapper::COL_WINDOW_BACKGROUND);
|
|
|
+ ImGui::BeginTooltip();
|
|
|
+ imgui.text(_u8L("Eject drive"));
|
|
|
+ ImGui::EndTooltip();
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+ }
|
|
|
+ if (m_hover_time == 0)
|
|
|
+ m_hover_time = time_now;
|
|
|
+ } else
|
|
|
+ m_hover_time = 0;
|
|
|
+
|
|
|
+ ImVec2 button_pic_size = ImGui::CalcTextSize(button_text.c_str());
|
|
|
+ ImVec2 button_size(button_pic_size.x * 1.25f, button_pic_size.y * 1.25f);
|
|
|
+ ImGui::SetCursorPosX(win_size.x - m_line_height * 4.f);
|
|
|
+ ImGui::SetCursorPosY(win_size.y / 2 - button_size.y / 2);
|
|
|
+ if (imgui.button(button_text.c_str(), button_size.x, button_size.y))
|
|
|
+ {
|
|
|
+ assert(m_evt_handler != nullptr);
|
|
|
+ if (m_evt_handler != nullptr)
|
|
|
+ wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED));
|
|
|
+ m_close_pending = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ //invisible large button
|
|
|
+ ImGui::SetCursorPosX(win_size.x - m_line_height * 4.625f);
|
|
|
+ ImGui::SetCursorPosY(0);
|
|
|
+ if (imgui.button(" ", m_line_height * 2.f, win_size.y))
|
|
|
+ {
|
|
|
+ assert(m_evt_handler != nullptr);
|
|
|
+ if (m_evt_handler != nullptr)
|
|
|
+ wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED));
|
|
|
+ m_close_pending = true;
|
|
|
+ }
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+ ImGui::PopStyleColor();
|
|
|
+}
|
|
|
+bool NotificationManager::ExportFinishedNotification::on_text_click()
|
|
|
+{
|
|
|
+ Notifications_Internal::open_folder(m_export_dir_path);
|
|
|
+ return false;
|
|
|
+}
|
|
|
//------NotificationManager--------
|
|
|
NotificationManager::NotificationManager(wxEvtHandler* evt_handler) :
|
|
|
m_evt_handler(evt_handler)
|
|
@@ -789,6 +975,13 @@ void NotificationManager::remove_slicing_warnings_of_released_objects(const std:
|
|
|
notification->close();
|
|
|
}
|
|
|
}
|
|
|
+void NotificationManager::push_exporting_finished_notification(GLCanvas3D& canvas, std::string path, std::string dir_path, bool on_removable)
|
|
|
+{
|
|
|
+ close_notification_of_type(NotificationType::ExportFinished);
|
|
|
+ NotificationData data{ NotificationType::ExportFinished, NotificationLevel::RegularNotification, 0, _u8L("Exporting finished.") +"\n"+ path };
|
|
|
+ push_notification_data(std::make_unique<NotificationManager::ExportFinishedNotification>(data, m_id_provider, m_evt_handler, on_removable, path, dir_path),
|
|
|
+ canvas, 0);
|
|
|
+}
|
|
|
bool NotificationManager::push_notification_data(const NotificationData ¬ification_data, GLCanvas3D& canvas, int timestamp)
|
|
|
{
|
|
|
return push_notification_data(std::make_unique<PopNotification>(notification_data, m_id_provider, m_evt_handler), canvas, timestamp);
|
|
@@ -822,7 +1015,7 @@ void NotificationManager::render_notifications(GLCanvas3D& canvas, float overlay
|
|
|
bool hovered = false;
|
|
|
sort_notifications();
|
|
|
// iterate thru notifications and render them / erease them
|
|
|
- for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) {
|
|
|
+ for (auto it = m_pop_notifications.begin(); it != m_pop_notifications.end();) {
|
|
|
if ((*it)->get_finished()) {
|
|
|
it = m_pop_notifications.erase(it);
|
|
|
} else {
|
|
@@ -931,5 +1124,31 @@ bool NotificationManager::has_slicing_error_notification()
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+void NotificationManager::new_export_began(bool on_removable)
|
|
|
+{
|
|
|
+ close_notification_of_type(NotificationType::ExportFinished);
|
|
|
+ // If we want to hold information of ejecting removable on later export finished notifications
|
|
|
+ /*
|
|
|
+ for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
|
|
|
+ if (notification->get_type() == NotificationType::ExportToRemovableFinished) {
|
|
|
+ if (!on_removable) {
|
|
|
+ const NotificationData old_data = notification->get_data();
|
|
|
+ notification->update( {old_data.type, old_data.level ,old_data.duration, std::string(), old_data.hypertext} );
|
|
|
+ } else {
|
|
|
+ notification->close();
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
+}
|
|
|
+void NotificationManager::device_ejected()
|
|
|
+{
|
|
|
+ for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
|
|
|
+ if (notification->get_type() == NotificationType::ExportFinished && dynamic_cast<ExportFinishedNotification*>(notification.get())->m_to_removable)
|
|
|
+ notification->close();
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
}//namespace GUI
|
|
|
}//namespace Slic3r
|