Merge branch 'dk_notifications'

This commit is contained in:
David Kocik 2021-10-06 13:08:12 +02:00
commit 6f3c8e16ad
3 changed files with 18 additions and 14 deletions

View file

@ -4140,7 +4140,7 @@ void ObjectList::fix_through_netfabb()
// Close the progress dialog
progress_dlg.Update(100, "");
// Show info message
// Show info notification
wxString msg;
wxString bullet_suf = "\n - ";
if (!succes_models.empty()) {
@ -4156,9 +4156,7 @@ void ObjectList::fix_through_netfabb()
}
if (msg.IsEmpty())
msg = _L("Repairing was canceled");
// !!! Use wxMessageDialog instead of MessageDialog here
// It will not be "dark moded" but the Application will not lose a focus after model repairing
wxMessageDialog(nullptr, msg, _L("Model Repair by the Netfabb service"), wxICON_INFORMATION | wxOK).ShowModal();
plater->get_notification_manager()->push_notification(NotificationType::NetfabbFinished, NotificationManager::NotificationLevel::PrintInfoShortNotificationLevel, boost::nowide::narrow(msg));
}
void ObjectList::simplify()

View file

@ -278,7 +278,8 @@ void NotificationManager::PopNotification::count_spaces()
m_left_indentation = m_line_height;
if (m_data.level == NotificationLevel::ErrorNotificationLevel
|| m_data.level == NotificationLevel::WarningNotificationLevel
|| m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
|| m_data.level == NotificationLevel::PrintInfoNotificationLevel
|| m_data.level == NotificationLevel::PrintInfoShortNotificationLevel) {
std::string text;
text = (m_data.level == NotificationLevel::ErrorNotificationLevel ? ImGui::ErrorMarker : ImGui::WarningMarker);
float picture_width = ImGui::CalcTextSize(text.c_str()).x;
@ -513,7 +514,7 @@ void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui)
ImGui::SetCursorPosX(m_line_height / 3);
ImGui::SetCursorPosY(m_window_height / 2 - m_line_height);
imgui.text(text.c_str());
} else if (m_data.level == NotificationLevel::PrintInfoNotificationLevel) {
} else if (m_data.level == NotificationLevel::PrintInfoNotificationLevel || m_data.level == NotificationLevel::PrintInfoShortNotificationLevel) {
std::wstring text;
text = ImGui::InfoMarker;
ImGui::SetCursorPosX(m_line_height / 3);

View file

@ -105,7 +105,9 @@ enum class NotificationType
ProgressIndicator,
// Give user advice to simplify object with big amount of triangles
// Contains ObjectID for closing when object is deleted
SimplifySuggestion
SimplifySuggestion,
// information about netfabb is finished repairing model (blocking proccess)
NetfabbFinished
};
class NotificationManager
@ -123,6 +125,8 @@ public:
RegularNotificationLevel,
// Regular level notifiaction containing info about objects or print. Has Icon.
PrintInfoNotificationLevel,
// PrintInfoNotificationLevel with shorter time
PrintInfoShortNotificationLevel,
// Information notification without a fade-out or with a longer fade-out.
ImportantNotificationLevel,
// Warning, no fade-out.
@ -706,13 +710,14 @@ private:
{
switch (level) {
case NotificationLevel::ErrorNotificationLevel: return 0;
case NotificationLevel::WarningNotificationLevel: return 0;
case NotificationLevel::ImportantNotificationLevel: return 0;
case NotificationLevel::ProgressBarNotificationLevel: return 2;
case NotificationLevel::RegularNotificationLevel: return 10;
case NotificationLevel::PrintInfoNotificationLevel: return 10;
case NotificationLevel::HintNotificationLevel: return 300;
case NotificationLevel::ErrorNotificationLevel: return 0;
case NotificationLevel::WarningNotificationLevel: return 0;
case NotificationLevel::ImportantNotificationLevel: return 0;
case NotificationLevel::ProgressBarNotificationLevel: return 2;
case NotificationLevel::PrintInfoShortNotificationLevel: return 5;
case NotificationLevel::RegularNotificationLevel: return 10;
case NotificationLevel::PrintInfoNotificationLevel: return 10;
case NotificationLevel::HintNotificationLevel: return 300;
default: return 10;
}
}