test
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/.idea/
|
/.idea/
|
||||||
/cmake-build-debug/
|
/cmake-build-debug/
|
||||||
|
/cmake-build-debug-visual-studio/
|
||||||
|
|||||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "lib/saucer"]
|
||||||
|
path = lib/saucer
|
||||||
|
url = https://github.com/saucer/saucer.git
|
||||||
@@ -2,5 +2,14 @@ cmake_minimum_required(VERSION 3.30)
|
|||||||
project(Toolbox)
|
project(Toolbox)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
set(saucer_no_version_check ON)
|
||||||
|
|
||||||
|
add_subdirectory(lib/saucer)
|
||||||
|
|
||||||
|
include_directories(inc)
|
||||||
|
include_directories(out_embed)
|
||||||
|
file(GLOB_RECURSE SOURCES "src/*.cpp" "inc/*.h")
|
||||||
|
|
||||||
add_executable(Toolbox main.cpp)
|
add_executable(Toolbox main.cpp)
|
||||||
|
|
||||||
|
target_link_libraries(Toolbox PRIVATE saucer::saucer)
|
||||||
|
|||||||
18
README.md
18
README.md
@@ -1 +1,19 @@
|
|||||||
# Toolbox
|
# Toolbox
|
||||||
|
|
||||||
|
## install
|
||||||
|
|
||||||
|
first install node.js
|
||||||
|
|
||||||
|
then run
|
||||||
|
|
||||||
|
npm install -g @saucer-dev/cli
|
||||||
|
|
||||||
|
build embeded files with line
|
||||||
|
|
||||||
|
saucer embed <source> <destination>
|
||||||
|
|
||||||
|
like
|
||||||
|
|
||||||
|
saucer embed D:/Repos/Toolbox/res/html D:/Repos/Toolbox/out_embed
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
55
main.cpp
55
main.cpp
@@ -1,6 +1,55 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <saucer/smartview.hpp>
|
||||||
|
#include <saucer/webview.hpp>
|
||||||
|
#include <saucer/wv2.webview.impl.hpp>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
int main() {
|
#include "all.hpp"
|
||||||
std::cout << "Hello, World!" << std::endl;
|
|
||||||
return 0;
|
int main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
// Initialisiere die Saucer-Anwendung
|
||||||
|
auto app = saucer::application::acquire({
|
||||||
|
.id = "example",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Lade alle eingebetteten Dateien
|
||||||
|
auto resources = saucer::embedded::all();
|
||||||
|
|
||||||
|
// Überprüfen, ob die "index.html"-Ressource verfügbar ist
|
||||||
|
auto it = resources.find("index.html");
|
||||||
|
if (it == resources.end())
|
||||||
|
{
|
||||||
|
std::cerr << "Fehler: 'index.html' wurde nicht gefunden!" << std::endl;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
saucer::smartview webview{{
|
||||||
|
.application = app,
|
||||||
|
}};
|
||||||
|
|
||||||
|
webview.set_size(400, 600);
|
||||||
|
webview.set_force_dark_mode(true);
|
||||||
|
//webview.start_drag(true);
|
||||||
|
//SendMessage(webview.native(), nullptr,2, 2, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
|
||||||
|
|
||||||
|
// Erstelle ein WebView-Fenster
|
||||||
|
webview.expose(
|
||||||
|
"add_random",
|
||||||
|
[&](float number)
|
||||||
|
{
|
||||||
|
auto random = webview.evaluate<float>("Math.random()").get();
|
||||||
|
return number + random;
|
||||||
|
},
|
||||||
|
saucer::launch::async);
|
||||||
|
|
||||||
|
// Lade die eingebettete "index.html" aus den Ressourcen
|
||||||
|
webview.embed(saucer::embedded::all());
|
||||||
|
webview.serve("index.html");
|
||||||
|
|
||||||
|
// Zeige das Fenster an
|
||||||
|
webview.show();
|
||||||
|
|
||||||
|
// Starte die Saucer-Anwendung
|
||||||
|
app->run();
|
||||||
}
|
}
|
||||||
20
out_embed/all.hpp
Normal file
20
out_embed/all.hpp
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include <saucer/webview.hpp>
|
||||||
|
|
||||||
|
#include "index.html.hpp"
|
||||||
|
|
||||||
|
namespace saucer::embedded
|
||||||
|
{
|
||||||
|
inline auto all()
|
||||||
|
{
|
||||||
|
std::unordered_map<std::string, embedded_file> rtn;
|
||||||
|
|
||||||
|
rtn.emplace("index.html", embedded_file{saucer::stash<>::view(f1Dqesn4NxFvpVB4P1U5D6IgLugdGaqMvuMcidTvXLCgieH9Dg), "text/html"});
|
||||||
|
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
} // namespace saucer::embedded
|
||||||
10
out_embed/index.html.hpp
Normal file
10
out_embed/index.html.hpp
Normal file
File diff suppressed because one or more lines are too long
147
res/html/index.html
Normal file
147
res/html/index.html
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Toolbox</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: Arial, sans-serif;
|
||||||
|
background: linear-gradient(to bottom, #1e1e2e, #28293d);
|
||||||
|
color: white;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
.header {
|
||||||
|
background: #1b1b2b;
|
||||||
|
padding: 15px 20px;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
|
.header h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #ff79c6;
|
||||||
|
}
|
||||||
|
.main {
|
||||||
|
flex: 1;
|
||||||
|
padding: 15px;
|
||||||
|
overflow-y: auto;
|
||||||
|
scrollbar-width: thin; /* Firefox */
|
||||||
|
scrollbar-color: #ff79c6 #2b2c3b; /* Thumb and track color */
|
||||||
|
}
|
||||||
|
.main::-webkit-scrollbar {
|
||||||
|
width: 8px;
|
||||||
|
}
|
||||||
|
.main::-webkit-scrollbar-track {
|
||||||
|
background: #2b2c3b;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
.main::-webkit-scrollbar-thumb {
|
||||||
|
background-color: #ff79c6;
|
||||||
|
border-radius: 4px;
|
||||||
|
border: 2px solid #2b2c3b; /* Adds some padding around the thumb */
|
||||||
|
}
|
||||||
|
.tool-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background: #2b2c3b;
|
||||||
|
padding: 15px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
|
||||||
|
transition: transform 0.2s;
|
||||||
|
flex-direction: column; /* Vertikale Ausrichtung */
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.tool-card:hover {
|
||||||
|
transform: scale(1.02);
|
||||||
|
}
|
||||||
|
.tool-card img {
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 5px;
|
||||||
|
}
|
||||||
|
.tool-info {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
.tool-info h3 {
|
||||||
|
margin: 5px 0 5px;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #ff79c6;
|
||||||
|
}
|
||||||
|
.tool-info p {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #bbb;
|
||||||
|
}
|
||||||
|
.tool-action {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.tool-action button {
|
||||||
|
background: #ff79c6;
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.3s;
|
||||||
|
}
|
||||||
|
.tool-action button:hover {
|
||||||
|
background: #ff47b4;
|
||||||
|
}
|
||||||
|
.footer {
|
||||||
|
background: #1b1b2b;
|
||||||
|
padding: 10px 20px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #aaa;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="header">
|
||||||
|
<h1>Toolbox</h1>
|
||||||
|
</div>
|
||||||
|
<div class="main">
|
||||||
|
<div class="tool-card">
|
||||||
|
<img src="https://via.placeholder.com/60" alt="ReSharper Tools">
|
||||||
|
<div class="tool-info">
|
||||||
|
<h3>ReSharper Tools</h3>
|
||||||
|
<p>Version: 2024.3</p>
|
||||||
|
</div>
|
||||||
|
<div class="tool-action">
|
||||||
|
<button>Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-card">
|
||||||
|
<img src="https://via.placeholder.com/60" alt="Visual Studio 2022">
|
||||||
|
<div class="tool-info">
|
||||||
|
<h3>Visual Studio 2022</h3>
|
||||||
|
<p>Professional Edition</p>
|
||||||
|
</div>
|
||||||
|
<div class="tool-action">
|
||||||
|
<button>Open</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-card">
|
||||||
|
<img src="https://via.placeholder.com/60" alt="CLion">
|
||||||
|
<div class="tool-info">
|
||||||
|
<h3>CLion</h3>
|
||||||
|
<p>Version: 2024.3</p>
|
||||||
|
</div>
|
||||||
|
<div class="tool-action">
|
||||||
|
<button>Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- Add more tool cards as needed -->
|
||||||
|
</div>
|
||||||
|
<div class="footer">
|
||||||
|
<!--Schmidti.Digital © 2024-->
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user