mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-16 19:15:56 +08:00
User Account avatar extension
(Missing support for jpg in ScalableBitmap)
This commit is contained in:
parent
600086df56
commit
d289b11950
@ -77,7 +77,7 @@ std::string UserAccount::get_shared_session_key()
|
|||||||
boost::filesystem::path UserAccount::get_avatar_path(bool logged) const
|
boost::filesystem::path UserAccount::get_avatar_path(bool logged) const
|
||||||
{
|
{
|
||||||
if (logged) {
|
if (logged) {
|
||||||
const std::string filename = "prusaslicer-avatar-" + m_instance_hash + ".png";
|
const std::string filename = "prusaslicer-avatar-" + m_instance_hash + m_avatar_extension;
|
||||||
return boost::filesystem::path(wxStandardPaths::Get().GetTempDir().utf8_str().data()) / filename;
|
return boost::filesystem::path(wxStandardPaths::Get().GetTempDir().utf8_str().data()) / filename;
|
||||||
} else {
|
} else {
|
||||||
return boost::filesystem::path(resources_dir()) / "icons" / "user.svg";
|
return boost::filesystem::path(resources_dir()) / "icons" / "user.svg";
|
||||||
@ -143,6 +143,8 @@ bool UserAccount::on_user_id_success(const std::string data, std::string& out_us
|
|||||||
out_username = public_username;
|
out_username = public_username;
|
||||||
// equeue GET with avatar url
|
// equeue GET with avatar url
|
||||||
if (m_account_user_data.find("avatar") != m_account_user_data.end()) {
|
if (m_account_user_data.find("avatar") != m_account_user_data.end()) {
|
||||||
|
const boost::filesystem::path server_file(m_account_user_data["avatar"]);
|
||||||
|
m_avatar_extension = server_file.extension().string();
|
||||||
enqueue_avatar_action();
|
enqueue_avatar_action();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -86,6 +86,7 @@ private:
|
|||||||
std::map<std::string, std::string> m_account_user_data;
|
std::map<std::string, std::string> m_account_user_data;
|
||||||
std::string m_username;
|
std::string m_username;
|
||||||
size_t m_fail_counter { 0 };
|
size_t m_fail_counter { 0 };
|
||||||
|
std::string m_avatar_extension;
|
||||||
|
|
||||||
// first string is "printer_type" code from Connect edpoints
|
// first string is "printer_type" code from Connect edpoints
|
||||||
const std::map<std::string, std::string> printer_type_and_name_table = {
|
const std::map<std::string, std::string> printer_type_and_name_table = {
|
||||||
|
@ -337,7 +337,7 @@ void UserAccountCommunication::enqueue_test_connection()
|
|||||||
wakeup_session_thread();
|
wakeup_session_thread();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserAccountCommunication::enqueue_avatar_action(const std::string url)
|
void UserAccountCommunication::enqueue_avatar_action(const std::string& url)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_session_mutex);
|
std::lock_guard<std::mutex> lock(m_session_mutex);
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
void enqueue_connect_user_data_action();
|
void enqueue_connect_user_data_action();
|
||||||
#endif
|
#endif
|
||||||
void enqueue_connect_printers_action();
|
void enqueue_connect_printers_action();
|
||||||
void enqueue_avatar_action(const std::string url);
|
void enqueue_avatar_action(const std::string& url);
|
||||||
void enqueue_test_connection();
|
void enqueue_test_connection();
|
||||||
|
|
||||||
// Callbacks - called from UI after receiving Event from Session thread. Some might use Session thread.
|
// Callbacks - called from UI after receiving Event from Session thread. Some might use Session thread.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user