mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 22:24:01 -06:00
Calling destructor of notifications manager and hint database
Ensures to translate hints after change of language
This commit is contained in:
parent
5f7a4982f6
commit
42f4de94df
5 changed files with 17 additions and 0 deletions
|
@ -242,6 +242,13 @@ HintDatabase::~HintDatabase()
|
||||||
write_used_binary(m_used_ids);
|
write_used_binary(m_used_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void HintDatabase::uninit()
|
||||||
|
{
|
||||||
|
if (m_initialized) {
|
||||||
|
write_used_binary(m_used_ids);
|
||||||
|
}
|
||||||
|
m_initialized = false;
|
||||||
|
}
|
||||||
void HintDatabase::init()
|
void HintDatabase::init()
|
||||||
{
|
{
|
||||||
load_hints_from_file(std::move(boost::filesystem::path(resources_dir()) / "data" / "hints.ini"));
|
load_hints_from_file(std::move(boost::filesystem::path(resources_dir()) / "data" / "hints.ini"));
|
||||||
|
|
|
@ -47,6 +47,9 @@ public:
|
||||||
return 0;
|
return 0;
|
||||||
return m_loaded_hints.size();
|
return m_loaded_hints.size();
|
||||||
}
|
}
|
||||||
|
// resets m_initiailized to false and writes used if was initialized
|
||||||
|
// used when reloading in runtime - like change language
|
||||||
|
void uninit();
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void load_hints_from_file(const boost::filesystem::path& path);
|
void load_hints_from_file(const boost::filesystem::path& path);
|
||||||
|
|
|
@ -1107,6 +1107,10 @@ NotificationManager::NotificationManager(wxEvtHandler* evt_handler) :
|
||||||
m_evt_handler(evt_handler)
|
m_evt_handler(evt_handler)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
NotificationManager::~NotificationManager()
|
||||||
|
{
|
||||||
|
HintDatabase::get_instance().uninit();
|
||||||
|
}
|
||||||
void NotificationManager::push_notification(const NotificationType type, int timestamp)
|
void NotificationManager::push_notification(const NotificationType type, int timestamp)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(std::begin(basic_notifications), std::end(basic_notifications),
|
auto it = std::find_if(std::begin(basic_notifications), std::end(basic_notifications),
|
||||||
|
|
|
@ -121,6 +121,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
NotificationManager(wxEvtHandler* evt_handler);
|
NotificationManager(wxEvtHandler* evt_handler);
|
||||||
|
~NotificationManager();
|
||||||
|
|
||||||
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
|
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
|
||||||
void push_notification(const NotificationType type, int timestamp = 0);
|
void push_notification(const NotificationType type, int timestamp = 0);
|
||||||
|
|
|
@ -2073,6 +2073,8 @@ Plater::priv::~priv()
|
||||||
{
|
{
|
||||||
if (config != nullptr)
|
if (config != nullptr)
|
||||||
delete config;
|
delete config;
|
||||||
|
if (notification_manager != nullptr)
|
||||||
|
delete notification_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::update(unsigned int flags)
|
void Plater::priv::update(unsigned int flags)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue