Add tool configuration management and enhance UI functionality
Introduce `ToolConfigStore` for managing tool configuration files, enabling retrieval and updates. Refactor window handling to support Lua timeout settings and dynamic tool-specific configurations. Improve HTML UI with Lua timeout adjustments and centralized styling updates.
This commit is contained in:
@@ -5,12 +5,20 @@
|
||||
#include <saucer/embedded/all.hpp>
|
||||
#include <sol/sol.hpp>
|
||||
#include <saucer/webview.hpp>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
class optionWindow {
|
||||
|
||||
public:
|
||||
// Konstruktor erhält das Application-Objekt als Parameter
|
||||
explicit optionWindow(std::shared_ptr<saucer::application>& app);
|
||||
optionWindow(std::shared_ptr<saucer::application>& app,
|
||||
std::function<int()> getLuaTimeoutSeconds,
|
||||
std::function<void(int)> setLuaTimeoutSeconds,
|
||||
std::function<std::string()> getActiveToolName,
|
||||
std::function<std::string()> getToolConfigIni,
|
||||
std::function<void(const std::string &)> setToolConfigIni,
|
||||
std::function<void()> openIndex);
|
||||
|
||||
// Methode zum Anzeigen des Fensters
|
||||
void show();
|
||||
@@ -18,13 +26,22 @@ public:
|
||||
// Für die Fensterinitialisierung
|
||||
void initialize();
|
||||
void setHWND(HWND hwnd);
|
||||
void toggleDevTools();
|
||||
|
||||
private:
|
||||
std::shared_ptr<saucer::application> m_app;
|
||||
saucer::smartview<saucer::default_serializer> m_webview;
|
||||
saucer::smartview m_webview;
|
||||
std::unique_ptr<hwnd_module> m_hwnd_module;
|
||||
HWND m_hwnd;
|
||||
std::function<int()> m_getLuaTimeoutSeconds;
|
||||
std::function<void(int)> m_setLuaTimeoutSeconds;
|
||||
std::function<std::string()> m_getActiveToolName;
|
||||
std::function<std::string()> m_getToolConfigIni;
|
||||
std::function<void(const std::string &)> m_setToolConfigIni;
|
||||
std::function<void()> m_openIndex;
|
||||
|
||||
void configureWindow();
|
||||
void loadResources();
|
||||
void runLuaScript();
|
||||
void exposeToJs();
|
||||
};
|
||||
|
||||
13
inc/toolConfig.h
Normal file
13
inc/toolConfig.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <string>
|
||||
|
||||
class ToolConfigStore {
|
||||
public:
|
||||
bool ensureExists(const std::filesystem::path &path) const;
|
||||
int getInt(const std::filesystem::path &path, const std::string &key, int fallback) const;
|
||||
void setInt(const std::filesystem::path &path, const std::string &key, int value) const;
|
||||
std::string readAll(const std::filesystem::path &path) const;
|
||||
void writeAll(const std::filesystem::path &path, const std::string &content) const;
|
||||
};
|
||||
Reference in New Issue
Block a user