2024-11-12 14:53:44 -08:00
|
|
|
#include "main.h"
|
|
|
|
#include "main_window.h"
|
|
|
|
#include <chrono>
|
|
|
|
using namespace std::chrono_literals;
|
|
|
|
bool quitting = false;
|
|
|
|
std::string HaikuUIBackend::get_id() {
|
|
|
|
return "haiku";
|
|
|
|
}
|
|
|
|
std::string HaikuUIBackend::get_name() {
|
|
|
|
return "Haiku Native";
|
|
|
|
}
|
|
|
|
void HaikuUIBackend::QuitHandler() {
|
2024-11-21 10:43:50 -08:00
|
|
|
HaikuLooperWindow *app = (HaikuLooperWindow*)main_loop;
|
2024-11-12 14:53:44 -08:00
|
|
|
app->Hide();
|
|
|
|
}
|
|
|
|
static bool about_window_shown = false;
|
|
|
|
static bool prefs_window_shown = false;
|
|
|
|
int HaikuUIBackend::run(std::vector<std::string> realArgs, int argc, char **argv) {
|
|
|
|
int ret = UIBackend::run(realArgs, argc, argv);
|
|
|
|
if (ret != 0) return ret;
|
2024-11-21 10:43:50 -08:00
|
|
|
HaikuLooperWindow *app = new HaikuLooperWindow(playback);
|
2024-11-12 14:53:44 -08:00
|
|
|
main_loop = (void*)app;
|
|
|
|
app->Show();
|
|
|
|
while (!app->IsHidden()) {
|
|
|
|
for (auto *subwindow : Subwindow::windows) {
|
|
|
|
if (subwindow->Showing.exchange(false)) {
|
|
|
|
subwindow->window->Show();
|
|
|
|
subwindow->ShownEver.store(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::this_thread::sleep_for(100ms);
|
|
|
|
}
|
|
|
|
quitting = true;
|
|
|
|
for (auto *subwindow : Subwindow::windows) {
|
|
|
|
if (!subwindow->ShownEver) subwindow->window->Run();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|