feat: Added font picker to the settings (#1570)

This commit is contained in:
Nik
2024-02-24 22:46:52 +01:00
committed by GitHub
parent 8bf7aa9ceb
commit ec69849749
10 changed files with 179 additions and 21 deletions

View File

@@ -141,7 +141,7 @@ namespace hex {
[[nodiscard]] bool isChecked() const { return m_value; }
private:
protected:
bool m_value;
};
@@ -155,7 +155,7 @@ namespace hex {
[[nodiscard]] i32 getValue() const { return m_value; }
private:
protected:
int m_value;
i32 m_min, m_max;
};
@@ -170,7 +170,7 @@ namespace hex {
[[nodiscard]] float getValue() const { return m_value; }
private:
protected:
float m_value;
float m_min, m_max;
};
@@ -186,7 +186,7 @@ namespace hex {
[[nodiscard]] ImColor getColor() const;
private:
protected:
std::array<float, 4> m_value{};
};
@@ -202,7 +202,7 @@ namespace hex {
[[nodiscard]]
const nlohmann::json& getValue() const;
private:
protected:
std::vector<std::string> m_items;
std::vector<nlohmann::json> m_settingsValues;
nlohmann::json m_defaultItem;
@@ -222,7 +222,7 @@ namespace hex {
[[nodiscard]]
const std::string& getValue() const { return m_value; }
private:
protected:
std::string m_value;
};
@@ -233,12 +233,12 @@ namespace hex {
void load(const nlohmann::json &data) override;
nlohmann::json store() override;
[[nodiscard]] std::fs::path getPath() const {
return m_value;
[[nodiscard]] const std::fs::path& getPath() const {
return m_path;
}
private:
std::string m_value;
protected:
std::fs::path m_path;
};
class Label : public Widget {

View File

@@ -12,6 +12,7 @@
#include <concepts>
#include <functional>
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <string>
@@ -76,6 +77,9 @@ namespace hex {
int executeCommand(const std::string &command);
void openWebpage(std::string url);
extern "C" void registerFont(const char *fontName, const char *fontPath);
const std::map<std::fs::path, std::string>& getFonts();
[[nodiscard]] std::string encodeByteString(const std::vector<u8> &bytes);
[[nodiscard]] std::vector<u8> decodeByteString(const std::string &string);

View File

@@ -14,6 +14,7 @@
void setupMacosWindowStyle(GLFWwindow *window, bool borderlessWindowMode);
void enumerateFontsMacos();
}
#endif