minor reorg and documentation

This commit is contained in:
itsmattkc
2019-07-01 18:35:47 -07:00
parent 3e6bc54f48
commit 17c0556dca
3 changed files with 54 additions and 35 deletions
+35 -28
View File
@@ -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>("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*)));
}
+16 -7
View File
@@ -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 {
+3
View File
@@ -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
}