Skip to content

Commit 2264cc8

Browse files
committed
Make documentation buttons etc. open docs.opensimcreator.com (#1048).
1 parent fab7b65 commit 2264cc8

File tree

10 files changed

+36
-26
lines changed

10 files changed

+36
-26
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
## [Upcoming Release]
77

8+
- The documentation link shown on the splash screen or help menu is now
9+
set at compile time to be equal to `docs.opensimcreator.com` (#1048).
810
- Attempting to import an incorrect `.osim` file into the mesh importer now
911
results in a log error message rather than a crashing exception
1012
(thanks @davidpagnon, #1050).

libopensimcreator/Platform/OpenSimCreatorApp.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,3 @@ TabRegistry& osc::OpenSimCreatorApp::upd_tab_registry()
179179
{
180180
return *singleton<TabRegistry>();
181181
}
182-
183-
std::string osc::OpenSimCreatorApp::docs_url() const
184-
{
185-
if (const auto runtime_url = settings().find_value("docs_url")) {
186-
return to<std::string>(*runtime_url);
187-
}
188-
else {
189-
return "https://docs.opensimcreator.com";
190-
}
191-
}

libopensimcreator/Platform/OpenSimCreatorApp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,5 @@ namespace osc
4141
using App::show;
4242

4343
TabRegistry& upd_tab_registry();
44-
45-
std::string docs_url() const;
4644
};
4745
}

libopensimcreator/UI/Shared/MainMenu.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -436,16 +436,19 @@ void osc::MainMenuAboutTab::onDraw()
436436
{
437437
ui::set_num_columns(2);
438438

439-
ui::draw_text("OpenSim Creator Documentation");
440-
ui::next_column();
441-
ui::push_id(id++);
442-
if (ui::draw_button(OSC_ICON_LINK " open"))
439+
if (auto docsURL = App::get().metadata().documentation_url())
443440
{
444-
open_url_in_os_default_web_browser(OpenSimCreatorApp::get().docs_url());
441+
ui::draw_text("OpenSim Creator Documentation");
442+
ui::next_column();
443+
ui::push_id(id++);
444+
if (ui::draw_button(OSC_ICON_LINK " open"))
445+
{
446+
open_url_in_os_default_web_browser(*docsURL);
447+
}
448+
ui::draw_tooltip_body_only_if_item_hovered("this will open the documentation in a separate browser window");
449+
ui::pop_id();
450+
ui::next_column();
445451
}
446-
ui::draw_tooltip_body_only_if_item_hovered("this will open the (locally installed) documentation in a separate browser window");
447-
ui::pop_id();
448-
ui::next_column();
449452

450453
if (auto repoURL = App::get().metadata().repository_url())
451454
{

libopensimcreator/UI/SplashTab.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,10 @@ class osc::SplashTab::Impl final : public TabPrivate {
262262
App::post_event<OpenTabEvent>(*parent(), std::move(tab));
263263
}
264264
ui::add_screenshot_annotation_to_last_drawn_item("SplashTab/ImportMeshesMenuItem");
265-
if (ui::draw_menu_item(OSC_ICON_BOOK " Open Documentation")) {
266-
open_url_in_os_default_web_browser(OpenSimCreatorApp::get().docs_url());
265+
if (const auto docsURL = App::get().metadata().documentation_url()) {
266+
if (ui::draw_menu_item(OSC_ICON_BOOK " Open Documentation")) {
267+
open_url_in_os_default_web_browser(*docsURL);
268+
}
267269
}
268270
}
269271

liboscar/Platform/AppMetadata.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ namespace osc
3333
std::optional<CStringView> repository_url() const { return repository_url_; }
3434
void set_repository_url(std::string_view new_repository_url) { repository_url_ = new_repository_url; }
3535

36+
std::optional<CStringView> documentation_url() const { return documentation_url_; }
37+
void set_documentation_url(std::string_view new_documentation_url) { documentation_url_ = new_documentation_url; }
38+
3639
std::optional<CStringView> help_url() const { return help_url_; }
3740
void set_help_url(std::string_view new_help_url) { help_url_ = new_help_url; }
3841

@@ -51,6 +54,7 @@ namespace osc
5154
std::optional<std::string> version_string_;
5255
std::optional<std::string> build_id_;
5356
std::optional<std::string> repository_url_;
57+
std::optional<std::string> documentation_url_;
5458
std::optional<std::string> help_url_;
5559
};
5660
}

osc/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ set(
66
"the internet location of the software's repo - used by in-app links, installers, etc."
77
)
88
mark_as_advanced(OSC_REPO_URL)
9+
set(
10+
OSC_DOCS_URL "https://docs.opensimcreator.com"
11+
CACHE STRING
12+
"a url for the software's documentation - used by in-app links, installers, etc."
13+
)
14+
mark_as_advanced(OSC_DOCS_URL)
915
set(
1016
OSC_HELP_URL "https://github.com/ComputationalBiomechanicsLab/opensim-creator/discussions"
1117
CACHE STRING

osc/osc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace
3535
metadata.set_build_id(OSC_BUILD_ID);
3636
metadata.set_repository_url(OSC_REPO_URL);
3737
metadata.set_help_url(OSC_HELP_URL);
38+
metadata.set_documentation_url(OSC_DOCS_URL);
3839
return metadata;
3940
}
4041
}

osc/osc_config.h.in

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@
2828

2929
// char[]
3030
//
31-
// the internet location of the OSC repo. Used by in-app links, shortcuts, etc.
32-
// to the repo so that users can just click and go, rather than having to separately
33-
// browse to the repo
31+
// a URL for OSC's source code repo. Used by in-app links, shortcuts, etc. so that
32+
// users can just click and go, rather than having to separately browse to it.
3433
#define OSC_REPO_URL "@OSC_REPO_URL@"
3534

35+
// char[]
36+
//
37+
// a URL for the OSC's documentation Used by in-app links, shortcuts, etc. so that
38+
// users can just click and go, rather than having to separately browse to it.
39+
#define OSC_DOCS_URL "@OSC_DOCS_URL@"
40+
3641
// char[]
3742
//
3843
// the internet location for a "help site", which is loosely defined as somewhere the user

osc/osc_dev_config.toml.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# INSTALL configuration file.
1313

1414
resources = "@CMAKE_CURRENT_SOURCE_DIR@/../resources"
15-
docs_url = "file://@CMAKE_CURRENT_SOURCE_DIR@/../docs/build/index.html"
1615

1716
# change this if you need OSC to print more information to the log
1817
# log_level = "trace" # trace < debug < info < warn < err < critical

0 commit comments

Comments
 (0)