diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:16:04 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 20:16:18 +0200 |
commit | bc4cef92d8efbf97a9215122abc2d7247c287f12 (patch) | |
tree | a5ca307281c4f143b5f172428c9fd2b629d6b426 /c/ext.cpp | |
parent | 5c1c2ce2bdbf9735ad8a4d162609a8c22a4f0954 (diff) | |
download | EpisodeBrowser-bc4cef92d8efbf97a9215122abc2d7247c287f12.tar.gz |
Improve Window object.
Diffstat (limited to 'c/ext.cpp')
-rw-r--r-- | c/ext.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -3,14 +3,12 @@ #include <string_view> #include "data.h" -#include "main.h" +#include "window.h" -extern Window* g_window; - -bool OpenOnline(int iEp) +bool OpenOnline(const CfgA& cfg, int iEp) { - wchar_t url[sizeof(g_window->cfg.url)+4]; - Swprintf(url, L"%s%d", g_window->cfg.url, iEp); + wchar_t url[sizeof(cfg.url)+4]; + Swprintf(url, L"%s%d", cfg.url, iEp); INT_PTR r = reinterpret_cast<INT_PTR>( ShellExecuteW(nullptr, L"open", url, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) @@ -18,9 +16,8 @@ bool OpenOnline(int iEp) return true; } -bool OpenWiki(int iEp) +bool OpenWiki(const DlvDataA& d) { - const DlvDataA& d = g_window->fvDlv.At(iEp-1); wchar_t url[sizeof(d.wiki)+35]; Swprintf(url, L"https://www.detectiveconanworld.com%s", d.wiki); INT_PTR r = reinterpret_cast<INT_PTR>( @@ -110,10 +107,10 @@ static bool FindMatchingFile(wchar_t (&file)[MAX_PATH], const wchar_t* const roo return false; } -bool OpenLocally(int iEp) +bool OpenLocally(CfgA& cfg, const ElvDataA& e) { wchar_t file[MAX_PATH]; - if (FindMatchingFile(file, g_window->cfg.root, g_window->fvElv.At(iEp-1).siEp)) { + if (FindMatchingFile(file, cfg.root, e.siEp)) { INT_PTR r = reinterpret_cast<INT_PTR>( ShellExecuteW(nullptr, L"open", file, nullptr, nullptr, SW_SHOWNORMAL)); if (r <= 32) |