From d7082194111b394ba1d48a83f64c229756d78bb7 Mon Sep 17 00:00:00 2001 From: Jack Bennett Date: Mon, 15 Apr 2024 12:13:05 +0100 Subject: [PATCH] Add licence text to about dialogue --- frontend/CMakeLists.txt | 1 + frontend/gui/main_frame.cpp | 9 ++----- frontend/gui/prog_info.cpp | 22 +++++++++++++++++ frontend/gui/prog_info.hpp | 49 +++++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 frontend/gui/prog_info.cpp create mode 100644 frontend/gui/prog_info.hpp diff --git a/frontend/CMakeLists.txt b/frontend/CMakeLists.txt index 3baffe1..cd5572e 100644 --- a/frontend/CMakeLists.txt +++ b/frontend/CMakeLists.txt @@ -30,6 +30,7 @@ set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/../deps/") set(SRCS "gui/editor_panel.cpp" "gui/main_frame.cpp" + "gui/prog_info.cpp" "util/log.cpp" "main.cpp" ) diff --git a/frontend/gui/main_frame.cpp b/frontend/gui/main_frame.cpp index 8fe75a5..ca786dc 100644 --- a/frontend/gui/main_frame.cpp +++ b/frontend/gui/main_frame.cpp @@ -11,6 +11,7 @@ #include "util/except.hpp" #include "command_ids.hpp" #include "editor_panel.hpp" +#include "prog_info.hpp" #include #include @@ -70,13 +71,7 @@ namespace te { } void MainFrame::OnMenuAbout(wxCommandEvent &event) { - wxAboutDialogInfo aboutInfo{}; - aboutInfo.SetName("TexEdit"); - aboutInfo.SetVersion(TEXEDIT_VERSION); - aboutInfo.SetDescription("Integrated viewer, compiler and editor for TeX documents"); - aboutInfo.SetCopyright("(c) 2024 Jack Bennett"); - aboutInfo.SetWebSite("https://kosude.github.io/texedit/"); - + wxAboutDialogInfo aboutInfo = ProgInfo::GenerateAboutDialogInfo(); wxAboutBox(aboutInfo); } diff --git a/frontend/gui/prog_info.cpp b/frontend/gui/prog_info.cpp new file mode 100644 index 0000000..8f4fe1b --- /dev/null +++ b/frontend/gui/prog_info.cpp @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2024 Jack Bennett. + * All Rights Reserved. + * + * See the LICENCE file for more information. + */ + +#include "prog_info.hpp" + +namespace te { + wxAboutDialogInfo ProgInfo::GenerateAboutDialogInfo() { + wxAboutDialogInfo info; + info.SetName(name); + info.SetVersion(version); + info.SetDescription(description); + info.SetCopyright(copyright); + info.SetWebSite(website); + info.SetLicence(licence); + + return info; + } +} diff --git a/frontend/gui/prog_info.hpp b/frontend/gui/prog_info.hpp new file mode 100644 index 0000000..52260e6 --- /dev/null +++ b/frontend/gui/prog_info.hpp @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Jack Bennett. + * All Rights Reserved. + * + * See the LICENCE file for more information. + */ + +#pragma once +#ifndef __texedit__about_dialogue_hpp__ +#define __texedit__about_dialogue_hpp__ + +#include + +namespace te { + class ProgInfo { + public: + static constexpr const char *name = "TexEdit"; + static constexpr const char *version = TEXEDIT_VERSION; + static constexpr const char *description = "Integrated viewer, compiler and editor for TeX documents"; + static constexpr const char *copyright = "(c) 2024 Jack Bennett"; + static constexpr const char *website = "https://kosude.github.io/texedit/"; + static constexpr const char *licence = + "MIT License\n" + "\n" + "Copyright (c) 2024 Jack Bennett\n" + "\n" + "Permission is hereby granted, free of charge, to any person obtaining a copy " + "of this software and associated documentation files (the \"Software\"), to deal " + "in the Software without restriction, including without limitation the rights " + "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell " + "copies of the Software, and to permit persons to whom the Software is " + "furnished to do so, subject to the following conditions:\n" + "\n" + "The above copyright notice and this permission notice shall be included in all " + "copies or substantial portions of the Software.\n" + "\n" + "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR " + "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, " + "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " + "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER " + "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, " + "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE " + "SOFTWARE."; + + static wxAboutDialogInfo GenerateAboutDialogInfo(); + }; +} + +#endif