Skip to content

Commit 75a9cfc

Browse files
committed
⬆️✨ Add copyright notices
update FUI to get hyperlink button that I'm using here.
1 parent 2253bf5 commit 75a9cfc

5 files changed

Lines changed: 117 additions & 1 deletion

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025-present Frederick Emmott
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/CMakeLists.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,20 @@ if (MSVC)
9191
"/MANIFESTUAC:level='requireAdministrator'"
9292
)
9393
endif ()
94+
95+
find_package(compressed-embed CONFIG REQUIRED)
96+
include(CompressedEmbed)
97+
add_compressed_embed_library(
98+
licenses
99+
OUTPUT_CPP "${CMAKE_CURRENT_BINARY_DIR}/licenses.cpp"
100+
OUTPUT_HPP "${CMAKE_CURRENT_BINARY_DIR}/include/licenses.hpp"
101+
CLASSNAME Licenses
102+
INPUTS
103+
Self "${PROJECT_SOURCE_DIR}/LICENSE"
104+
CompressedEmbed "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/compressed-embed/copyright"
105+
FUI "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/fredemmott-gui/copyright"
106+
WIL "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/wil/copyright"
107+
Yoga "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/yoga/copyright"
108+
)
109+
target_include_directories(licenses PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
110+
target_link_libraries(main PRIVATE licenses)

src/main.cpp

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "artifacts/ProgramData.hpp"
2121
#include "artifacts/SavedGamesSettings.hpp"
2222
#include "config.hpp"
23+
#include "licenses.hpp"
2324

2425
using namespace FredEmmott::GUI;
2526
using namespace FredEmmott::GUI::Immediate;
@@ -390,21 +391,94 @@ void ShowArtifacts() {
390391
}
391392
}
392393

394+
void ShowLicenses() {
395+
enum class Products { Self, CompressedEmbed, WIL, FUI, Yoga };
396+
constexpr std::array ProductLabels {
397+
std::tuple {Products::Self, "OpenKneeboard Fresh Start"},
398+
std::tuple {Products::CompressedEmbed, "compressed-embed"},
399+
std::tuple {Products::FUI, "FredEmmott::GUI"},
400+
std::tuple {Products::WIL, "Windows Implementation Library"},
401+
std::tuple {Products::Yoga, "Yoga"},
402+
};
403+
static const Licenses licenses {};
404+
static auto key {Products::Self};
405+
406+
const auto layout
407+
= BeginVStackPanel().Styled(Style().FlexGrow(1).Gap(12)).Scoped();
408+
409+
{
410+
const auto card = BeginCard().Scoped();
411+
TextBlock(
412+
"Copyright © 2025-present Frederick Emmott\n"
413+
"All rights reserved.\n"
414+
"\n"
415+
"This product contains third-party software components which are "
416+
"licensed separately.\n"
417+
"\n"
418+
"Select a component below to view copyright and license information.")
419+
.Body();
420+
}
421+
422+
ComboBox(&key, ProductLabels)
423+
.Styled(Style().AlignSelf(YGAlignStretch))
424+
.Caption("Component");
425+
426+
std::string_view license;
427+
switch (key) {
428+
case Products::Self:
429+
license = licenses.SelfAsStringView();
430+
break;
431+
case Products::CompressedEmbed:
432+
license = licenses.CompressedEmbedAsStringView();
433+
break;
434+
case Products::WIL:
435+
license = licenses.WILAsStringView();
436+
break;
437+
case Products::FUI:
438+
license = licenses.FUIAsStringView();
439+
break;
440+
case Products::Yoga:
441+
license = licenses.YogaAsStringView();
442+
break;
443+
}
444+
445+
const auto card = BeginCard().Scoped();
446+
const auto scroll
447+
= BeginVScrollView().Scoped().Styled(Style().Width(800).Height(600));
448+
TextBlock(license);
449+
}
450+
451+
void ShowLicensesButton() {
452+
static bool licensesDialog {false};
453+
if (HyperlinkButton("Show copyright notices")) {
454+
licensesDialog = true;
455+
}
456+
if (auto dialog = BeginContentDialog(&licensesDialog).Scoped()) {
457+
ContentDialogTitle("Copyright notices");
458+
ShowLicenses();
459+
const auto buttons = BeginContentDialogButtons().Scoped();
460+
ContentDialogCloseButton("Close").Accent();
461+
}
462+
}
463+
393464
void ShowContent(Win32Window& window) {
394465
static const Style ContentLayoutStyle
395466
= Style().FlexGrow(1).Gap(12).Margin(12).Padding(8);
396467

397468
if (GetArtifacts().empty()) {
398469
window.SetResizeMode(Window::ResizeMode::Fixed, Window::ResizeMode::Fixed);
470+
const auto layout = BeginVStackPanel().Styled(ContentLayoutStyle).Scoped();
399471
Label("Couldn't find anything from OpenKneeboard on your computer.")
400472
.Styled(ContentLayoutStyle);
473+
ShowLicensesButton();
401474
return;
402475
}
403476

404477
if (gCleanupMode != CleanupMode::Custom) {
405478
window.SetResizeMode(Window::ResizeMode::Fixed, Window::ResizeMode::Fixed);
406479
const auto layout = BeginVStackPanel().Styled(ContentLayoutStyle).Scoped();
407480
ShowModes();
481+
ShowLicensesButton();
408482
return;
409483
}
410484

@@ -415,6 +489,7 @@ void ShowContent(Win32Window& window) {
415489
const auto layout = BeginVStackPanel().Scoped().Styled(ContentLayoutStyle);
416490
ShowModes();
417491
ShowArtifacts();
492+
ShowLicensesButton();
418493
}
419494

420495
void AppTick(Win32Window& window) {

vcpkg-configuration.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
"kind": "git",
55
"baseline": "a4c298f9c7790bfc1323f35687a8eb6b425bc646",
66
"repository": "https://github.com/fredemmott/vcpkg-registry",
7+
"baseline": "2d5a6b93b5f5f1194eda1dbbb8e1d14ab99eb6cd",
78
"packages": [
9+
"compressed-embed",
810
"fredemmott-gui"
911
]
1012
}

vcpkg.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"features": [
1010
"direct2d"
1111
]
12-
}
12+
},
13+
"compressed-embed"
1314
],
1415
"builtin-baseline": "ef7dbf94b9198bc58f45951adcf1f041fcbc5ea0"
1516
}

0 commit comments

Comments
 (0)