mirror of
https://git.mirrors.martin98.com/https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-16 11:35:59 +08:00
ENH: [STUDIO-2070] MediaCtrl on macOS: stop on player notify
Change-Id: I9b11a99e8b3f043ff4d8837cda89bc41bfb5eb0e
This commit is contained in:
parent
6ea24dfd89
commit
5666f8fce9
@ -39,6 +39,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
|
void DoSetSize(int x, int y, int width, int height, int sizeFlags) override;
|
||||||
|
|
||||||
|
static void bambu_log(void const * ctx, int level, char const * msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void create_player();
|
void create_player();
|
||||||
void * m_player = nullptr;
|
void * m_player = nullptr;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#define BAMBU_DYNAMIC
|
#define BAMBU_DYNAMIC
|
||||||
|
|
||||||
static void bambu_log(void const * ctx, int level, char const * msg)
|
void wxMediaCtrl2::bambu_log(void const * ctx, int level, char const * msg)
|
||||||
{
|
{
|
||||||
if (level == 1) {
|
if (level == 1) {
|
||||||
wxString msg2(msg);
|
wxString msg2(msg);
|
||||||
@ -26,11 +26,14 @@ static void bambu_log(void const * ctx, int level, char const * msg)
|
|||||||
int n = msg2.find_last_of('[');
|
int n = msg2.find_last_of('[');
|
||||||
if (n != wxString::npos) {
|
if (n != wxString::npos) {
|
||||||
long val = 0;
|
long val = 0;
|
||||||
int * error = (int *) ctx;
|
wxMediaCtrl2 * ctrl = (wxMediaCtrl2 *) ctx;
|
||||||
if (msg2.SubString(n + 1, msg2.Length() - 2).ToLong(&val))
|
if (msg2.SubString(n + 1, msg2.Length() - 2).ToLong(&val))
|
||||||
*error = (int) val;
|
ctrl->m_error = (int) val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (level < 0) {
|
||||||
|
wxMediaCtrl2 * ctrl = (wxMediaCtrl2 *) ctx;
|
||||||
|
ctrl->Stop();
|
||||||
}
|
}
|
||||||
BOOST_LOG_TRIVIAL(info) << msg;
|
BOOST_LOG_TRIVIAL(info) << msg;
|
||||||
}
|
}
|
||||||
@ -69,7 +72,7 @@ void wxMediaCtrl2::create_player()
|
|||||||
NSView * imageView = (NSView *) GetHandle();
|
NSView * imageView = (NSView *) GetHandle();
|
||||||
BambuPlayer * player = [cls alloc];
|
BambuPlayer * player = [cls alloc];
|
||||||
[player initWithImageView: imageView];
|
[player initWithImageView: imageView];
|
||||||
[player setLogger: bambu_log withContext: &m_error];
|
[player setLogger: bambu_log withContext: this];
|
||||||
m_player = player;
|
m_player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user