33 lines
843 B
C++
33 lines
843 B
C++
#include "gui/MainWindow.h"
|
|
#include "gui/LoginWindow.h"
|
|
#include "services/Settings.h"
|
|
#include "gtkpp/Application.h"
|
|
#include "gtkpp/Window.h"
|
|
|
|
#include <memory>
|
|
#include <iostream>
|
|
|
|
std::shared_ptr<gtkpp::Window> createMainWindow(std::shared_ptr<gtkpp::Application> app) {
|
|
auto settings = Settings::instance();
|
|
if(settings.user().token.empty()) {
|
|
return std::make_shared<LoginWindow>(app);
|
|
} else {
|
|
return std::make_shared<MainWindow>(app);
|
|
}
|
|
}
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
g_resources_register(g_resource_load("resources.gresource", nullptr));
|
|
|
|
auto app = std::make_shared<gtkpp::Application>("pro.aliencat.autocat");
|
|
|
|
app->onActivate([&](){
|
|
auto window = createMainWindow(app);
|
|
app->addWindow(window);
|
|
window->show();
|
|
});
|
|
|
|
return app->run(argc, argv);
|
|
}
|