mirror of https://github.com/Poikilos/SAM-Viewer
Add open_url to dialog namespace
parent
1a38abcde4
commit
dabf4448b5
|
@ -22,16 +22,8 @@ namespace dialog
|
||||||
bool has_event = false;
|
bool has_event = false;
|
||||||
const char *filename = nullptr;
|
const char *filename = nullptr;
|
||||||
|
|
||||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
static inline void fileOpen(IGUIEnvironment *env, s32 id,
|
||||||
const char **filters, const int filter_count)
|
const char *caption, const char **filters, const int filter_count)
|
||||||
{
|
|
||||||
std::thread thread(fileOpen, env, id, caption, filters,
|
|
||||||
filter_count);
|
|
||||||
thread.detach();
|
|
||||||
}
|
|
||||||
|
|
||||||
void fileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
|
||||||
const char **filters, const int filter_count)
|
|
||||||
{
|
{
|
||||||
IGUIWindow *window = env->addWindow(rect<s32>(0,0,0,0), true);
|
IGUIWindow *window = env->addWindow(rect<s32>(0,0,0,0), true);
|
||||||
window->setVisible(false);
|
window->setVisible(false);
|
||||||
|
@ -64,11 +56,19 @@ namespace dialog
|
||||||
std::cout << except.what() << std::endl;
|
std::cout << except.what() << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static inline void open_url(std::string url)
|
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||||
{
|
const char **filters, const int filter_count)
|
||||||
system((std::string("xdg-open \"") + url + std::string("\"")).c_str());
|
{
|
||||||
|
std::thread thread(fileOpen, env, id, caption, filters,
|
||||||
|
filter_count);
|
||||||
|
thread.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
void openBrowser(std::string url)
|
||||||
|
{
|
||||||
|
system((std::string("xdg-open \"") + url + std::string("\"")).c_str());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperlinkCtrl::HyperlinkCtrl(IGUIEnvironment *env, IGUIElement *parent, s32 id,
|
HyperlinkCtrl::HyperlinkCtrl(IGUIEnvironment *env, IGUIElement *parent, s32 id,
|
||||||
|
@ -108,7 +108,7 @@ bool HyperlinkCtrl::OnEvent(const SEvent &event)
|
||||||
else if (is_active && event.EventType == EET_MOUSE_INPUT_EVENT &&
|
else if (is_active && event.EventType == EET_MOUSE_INPUT_EVENT &&
|
||||||
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
||||||
{
|
{
|
||||||
open_url(url);
|
dialog::openBrowser(url);
|
||||||
}
|
}
|
||||||
return IGUIElement::OnEvent(event);
|
return IGUIElement::OnEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,9 +64,6 @@ namespace dialog
|
||||||
|
|
||||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||||
const char **filters, const int filter_count);
|
const char **filters, const int filter_count);
|
||||||
|
|
||||||
void fileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
|
||||||
const char **filters, const int filter_count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Config;
|
class Config;
|
||||||
|
|
Loading…
Reference in New Issue