From 17c0556dca10dda901f9332a6705d48713cdbc83 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Mon, 1 Jul 2019 18:35:47 -0700 Subject: [PATCH] minor reorg and documentation --- app/core.cpp | 63 +++++++++++++++++++---------------- app/core.h | 23 +++++++++---- app/panel/project/project.cpp | 3 ++ 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index deb7b0dcb..62e94b9c8 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -82,34 +82,7 @@ void Core::Start() // Start GUI (TODO CLI mode) // - // Load all icons - olive::icon::LoadAll(); - - // Set UI style - olive::style::AppSetDefault(); - - // Set up shared menus - olive::menu_shared.Initialize(); - - // Since we're starting GUI mode, create a PanelFocusManager (auto-deletes with QObject) - olive::panel_focus_manager = new PanelFocusManager(this); - - // Connect the PanelFocusManager to the application's focus change signal - connect(app, - SIGNAL(focusChanged(QWidget*, QWidget*)), - olive::panel_focus_manager, - SLOT(FocusChanged(QWidget*, QWidget*))); - - // Create main window and open it - main_window_ = new olive::MainWindow(); - if (parser.isSet(fullscreen_option)) { - main_window_->showFullScreen(); - } else { - main_window_->showMaximized(); - } - - // When a new project is opened, update the mainwindow - connect(this, SIGNAL(ProjectOpened(Project*)), main_window_, SLOT(ProjectOpen(Project*))); + StartGUI(parser.isSet(fullscreen_option)); // Create new project on startup // TODO: Load project from startup_project_ instead if not empty @@ -181,3 +154,37 @@ void Core::DeclareTypesForQt() { qRegisterMetaType("Task::Status"); } + +void Core::StartGUI(bool full_screen) +{ + // Load all icons + olive::icon::LoadAll(); + + // Set UI style + olive::style::AppSetDefault(); + + // Set up shared menus + olive::menu_shared.Initialize(); + + // Since we're starting GUI mode, create a PanelFocusManager (auto-deletes with QObject) + olive::panel_focus_manager = new PanelFocusManager(this); + + // Connect the PanelFocusManager to the application's focus change signal + connect(qApp, + SIGNAL(focusChanged(QWidget*, QWidget*)), + olive::panel_focus_manager, + SLOT(FocusChanged(QWidget*, QWidget*))); + + // Create main window and open it + main_window_ = new olive::MainWindow(); + if (full_screen) { + main_window_->showFullScreen(); + } else { + main_window_->showMaximized(); + } + + // When a new project is opened, update the mainwindow + connect(this, SIGNAL(ProjectOpened(Project*)), main_window_, SLOT(ProjectOpen(Project*))); + + +} diff --git a/app/core.h b/app/core.h index 9b1f77626..1513a5698 100644 --- a/app/core.h +++ b/app/core.h @@ -110,6 +110,22 @@ private: */ void AddOpenProject(ProjectPtr p); + /** + * @brief Declare custom types/classes for Qt's signal/slot system + * + * Qt's signal/slot system requires types to be declared. In the interest of doing this only at startup, we contain + * them all in a function here. + */ + void DeclareTypesForQt(); + + /** + * @brief Start GUI portion of Olive + * + * Starts services and objects required for the GUI of Olive. It's guaranteed that running without this function will + * create an application instance that is completely valid minus the UI (e.g. for CLI modes). + */ + void StartGUI(bool full_screen); + /** * @brief Internal main window object */ @@ -133,13 +149,6 @@ private: */ olive::tool::Tool tool_; - /** - * @brief Declare custom types/classes for Qt's signal/slot system - * - * Qt's signal/slot system requires types to be declared. In the interest of doing this only at startup, we contain - * them all in a function here. - */ - void DeclareTypesForQt(); }; namespace olive { diff --git a/app/panel/project/project.cpp b/app/panel/project/project.cpp index 03d1f1254..1748ccc4d 100644 --- a/app/panel/project/project.cpp +++ b/app/panel/project/project.cpp @@ -91,6 +91,9 @@ void ProjectPanel::Retranslate() void ProjectPanel::ItemDoubleClickSlot(Item *item) { if (item == nullptr) { + // If the user double clicks on empty space, show the import dialog olive::core.StartImportFootage(); } + + // FIXME: Double click Item should do something }