core: switch to single-project implementation

This has never worked right, it's caused a number of complexities within the code, and I think there are better ways to do this.
This commit is contained in:
itsmattkc
2023-02-08 12:15:05 -08:00
parent c322bb6463
commit 70d34c674b
6 changed files with 129 additions and 391 deletions
+9 -63
View File
@@ -219,7 +219,6 @@ public:
* The active Project file, or nullptr if the heuristic couldn't find one.
*/
Project* GetActiveProject() const;
ProjectViewModel* GetActiveProjectModel() const;
Folder* GetSelectedFolderInActiveProject() const;
/**
@@ -265,23 +264,10 @@ public:
*/
void OpenProjectFromRecentList(int index);
enum CloseProjectBehavior {
kCloseProjectOnlyOne,
kCloseProjectAsk,
kCloseProjectSave,
kCloseProjectDontSave
};
/**
* @brief Closes a project
*/
bool CloseProject(Project* p, bool auto_open_new, CloseProjectBehavior& confirm_behavior);
bool CloseProject(Project* p, bool auto_open_new);
/**
* @brief Closes all open projects
*/
bool CloseAllProjects(bool auto_open_new);
bool CloseProject(bool auto_open_new, bool ignore_modified = false);
/**
* @brief Runs a modal cache task on the currently active sequence
@@ -298,11 +284,6 @@ public:
*/
bool SetLanguage(const QString& locale);
/**
* @brief Saves a specific project
*/
bool SaveProject(Project *p);
/**
* @brief Show message in main window's status bar
*
@@ -327,46 +308,16 @@ public slots:
void OpenProject();
/**
* @brief Save the currently active project
*
* If the project hasn't been saved before, this will be equivalent to calling SaveActiveProjectAs().
* @brief Saves the current project
*/
bool SaveActiveProject();
bool SaveProject();
/**
* @brief Save the currently active project with a new filename
* @brief Performs a "save as" on the current project
*/
bool SaveActiveProjectAs();
bool SaveProjectAs();
/**
* @brief Save all currently open projects
*/
bool SaveAllProjects();
/**
* @brief Revert project to last saved state (basically close and open it)
*/
void RevertActiveProject();
/**
* @brief Closes the active project
*
* If no other projects are open, a new one is created automatically.
*/
bool CloseActiveProject();
/**
* @brief Closes all projects except the active project
*/
bool CloseAllExceptActiveProject();
/**
* @brief Closes all open projects
*
* Equivalent to `CloseAllProjects(true)`, but useful for the signal/slot system where you may not be able to specify
* parameters.
*/
bool CloseAllProjects();
void RevertProject();
/**
* @brief Set the current application-wide tool
@@ -523,11 +474,6 @@ private:
*/
void SetStartupLocale();
/**
* @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)
*/
@@ -552,7 +498,7 @@ private:
/**
* @brief Internal function for saving a project to a file
*/
void SaveProjectInternal(Project *project, const QString &override_filename = QString());
void SaveProjectInternal(const QString &override_filename = QString());
/**
* @brief Retrieves the currently most active sequence for exporting
@@ -563,7 +509,7 @@ private:
void SaveUnrecoveredList();
bool RevertProjectInternal(Project *p, bool by_opening_existing);
bool RevertProjectInternal(bool by_opening_existing);
void SaveRecentProjectsList();
@@ -582,7 +528,7 @@ private:
/**
* @brief List of currently open projects
*/
QList<Project*> open_projects_;
Project *open_project_;
/**
* @brief Currently active tool