various: implemented multiple project support

This required various changes to various parts of the infrastructure (mostly
using paths to finding the "root project" of any given object throughout).
Now theoretically infinite projects can be opened and accounted for at any
given time.
This commit is contained in:
itsmattkc
2020-04-18 01:50:47 +10:00
parent 77c0db55a5
commit f73c41d3fa
48 changed files with 824 additions and 224 deletions
+36 -22
View File
@@ -134,9 +134,9 @@ public:
*
* The active Project file, or nullptr if the heuristic couldn't find one.
*/
Project* GetActiveProject();
ProjectViewModel* GetActiveProjectModel();
Folder* GetSelectedFolderInActiveProject();
Project* GetActiveProject() const;
ProjectViewModel* GetActiveProjectModel() const;
Folder* GetSelectedFolderInActiveProject() const;
/**
* @brief Gets current timecode display mode
@@ -148,16 +148,6 @@ public:
*/
void SetTimecodeDisplay(Timecode::Display d);
/**
* @brief Sets state to "modified" so that the GUI will prompt the user to save before closing
*
* Call this function whenever a change is made to a currently active project. Saving the project will automatically
* unset this.
*/
void SetProjectModified(bool e);
bool IsProjectModified() const;
/**
* @brief Set how frequently an autorecovery should be saved (if the project has changed, see SetProjectModified())
*/
@@ -216,6 +206,16 @@ public:
*/
void OpenProjectFromRecentList(int index);
/**
* @brief Closes a project
*/
bool CloseProject(Project* p, bool auto_open_new);
/**
* @brief Closes all open projects
*/
bool CloseAllProjects(bool auto_open_new);
public slots:
/**
* @brief Starts an open file dialog to load a project from file
@@ -291,6 +291,11 @@ public slots:
*/
void ClearOpenRecentList();
/**
* @brief Creates a new empty project and opens it
*/
void CreateNewProject();
signals:
/**
* @brief Signal emitted when a project is opened
@@ -301,6 +306,11 @@ signals:
*/
void ProjectOpened(Project* p);
/**
* @brief Signal emitted when a project is closed
*/
void ProjectClosed(Project* p);
/**
* @brief Signal emitted when the tool is changed from somewhere
*/
@@ -327,6 +337,16 @@ private:
*/
static QString GetRecentProjectsFilePath();
/**
* @brief Saves a specific project
*/
bool SaveProject(Project* p);
/**
* @brief Performs a "save as" on a specific project
*/
bool SaveProjectAs(Project* p);
/**
* @brief Adds a filename to the top of the recently opened projects list (or moves it if it already exists)
*/
@@ -391,14 +411,6 @@ private:
*/
bool snapping_;
/**
* @brief Internal value for whether to make an autorecovery next interval
*
* True if the project has changed since the last autorecovery and we should save next time. False if the project has
* not changed and saving another autorecovery would be a waste.
*/
bool queue_autorecovery_;
/**
* @brief Internal timer for saving autorecovery files
*/
@@ -422,7 +434,7 @@ private:
private slots:
void SaveAutorecovery();
void ProjectSaveSucceeded();
void ProjectSaveSucceeded(Project *p);
/**
* @brief Adds a project to the "open projects" list
@@ -433,6 +445,8 @@ private slots:
bool ConfirmImageSequence(const QString &filename);
void ProjectWasModified(bool e);
};
OLIVE_NAMESPACE_EXIT