mirror of
https://github.com/Poikilos/SAM-Viewer.git
synced 2023-10-03 07:58:48 -07:00
Add open_url to dialog namespace
This commit is contained in:
parent
1a38abcde4
commit
dabf4448b5
@ -22,16 +22,8 @@ namespace dialog
|
||||
bool has_event = false;
|
||||
const char *filename = nullptr;
|
||||
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, 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)
|
||||
static inline 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);
|
||||
window->setVisible(false);
|
||||
@ -64,11 +56,19 @@ namespace dialog
|
||||
std::cout << except.what() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void open_url(std::string url)
|
||||
{
|
||||
system((std::string("xdg-open \"") + url + std::string("\"")).c_str());
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
const char **filters, const int filter_count)
|
||||
{
|
||||
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,
|
||||
@ -108,7 +108,7 @@ bool HyperlinkCtrl::OnEvent(const SEvent &event)
|
||||
else if (is_active && event.EventType == EET_MOUSE_INPUT_EVENT &&
|
||||
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
|
||||
{
|
||||
open_url(url);
|
||||
dialog::openBrowser(url);
|
||||
}
|
||||
return IGUIElement::OnEvent(event);
|
||||
}
|
||||
|
@ -64,9 +64,6 @@ namespace dialog
|
||||
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user