Files
Toolbox/main.cpp
Yadciel 543e2bae9c Add installer GUI and file system access feature
This commit introduces a new Tkinter-based GUI installer script (`installer/main.py`) that manages file extraction and shortcut creation. Additionally, a new file system access feature was added to the `ToolboxWindow` class, allowing users to open directories with platform-specific commands. Improvements also include platform-specific adjustments for Windows executables in the CMake configuration.
2024-12-09 11:08:40 +01:00

74 lines
1.7 KiB
C++

#include <saucer/app.hpp>
#include "toolboxWindow.h"
#include "tray.h"
#include "resource.h"
ToolboxWindow* g_toolboxWindow = nullptr;
void on_quit(struct tray_menu *item) {
tray_exit();
}
void on_click(struct tray_menu *item) {
if (g_toolboxWindow->m_bShow)
g_toolboxWindow->hide();
else
g_toolboxWindow->show();
}
int start(){
// Neue Anwendung erstellen
auto app = saucer::application::acquire({
.id = "toolbox",
});
// Toolbox-Fenster erstellen und initialisieren
ToolboxWindow toolboxWindow(app);
toolboxWindow.initialize();
g_toolboxWindow = &toolboxWindow;
//toolboxWindow.show();
HICON hIcon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
struct tray_menu tray_menu_items[] = {
{"Öffnen", 0, 0, NULL, on_click, 0},
{"-", 0, 0, NULL, nullptr, 0},
{"Beenden", 0, 0, NULL, on_quit, 0},
{nullptr, 0, 0, NULL, nullptr, 0}
};
struct tray tray = {
.icon = (char*)"toolbox.ico",
.menu = tray_menu_items
};
if (tray_init(&tray) != 0) {
fprintf(stderr, "Fehler beim Initialisieren des Tray-Icons\n");
return 1;
}
//toolboxWindow.show();
/* while (tray_loop(1) == 0) {
}*/
// Anwendung ausführen
app->run();
return 0;
}
#ifdef _DEBUG
int main(int argc, char** argv) {
return start(); // Konsole bleibt aktiv im Debug-Modus
}
#else
#include <Windows.h>
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
return start(); // Keine Konsole im Release-Modus
}
#endif