main.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "Profile.h"
  2. #include "ProfileTimelineWidget.h"
  3. #include <LibGUI/GApplication.h>
  4. #include <LibGUI/GBoxLayout.h>
  5. #include <LibGUI/GTreeView.h>
  6. #include <LibGUI/GWindow.h>
  7. #include <stdio.h>
  8. int main(int argc, char** argv)
  9. {
  10. if (argc != 2) {
  11. printf("usage: %s <profile-file>\n", argv[0]);
  12. return 0;
  13. }
  14. const char* path = argv[1];
  15. auto profile = Profile::load_from_file(path);
  16. if (!profile) {
  17. fprintf(stderr, "Unable to load profile '%s'\n", path);
  18. return 1;
  19. }
  20. GApplication app(argc, argv);
  21. auto window = GWindow::construct();
  22. window->set_title("ProfileViewer");
  23. window->set_rect(100, 100, 800, 600);
  24. auto main_widget = GWidget::construct();
  25. window->set_main_widget(main_widget);
  26. main_widget->set_fill_with_background_color(true);
  27. main_widget->set_layout(make<GBoxLayout>(Orientation::Vertical));
  28. auto timeline_widget = ProfileTimelineWidget::construct(*profile, main_widget);
  29. auto tree_view = GTreeView::construct(main_widget);
  30. tree_view->set_headers_visible(true);
  31. tree_view->set_size_columns_to_fit_content(true);
  32. tree_view->set_model(profile->model());
  33. window->show();
  34. return app.exec();
  35. }