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