change: change code style to Linux style except indent.

This commit is contained in:
Mike Solar
2025-08-03 03:09:40 +08:00
parent 65ab76edc8
commit 74f73ab3be
789 changed files with 77113 additions and 68888 deletions
+256 -255
View File
@@ -35,7 +35,8 @@
#include "undo/undostack.h"
#include "widget/projectexplorer/projectviewmodel.h"
namespace olive {
namespace olive
{
class MainWindow;
@@ -48,132 +49,125 @@ class MainWindow;
* The "public slots" are usually user-triggered actions and can be connected to UI elements (e.g. creating a folder,
* opening the import dialog, etc.)
*/
class Core : public QObject
{
Q_OBJECT
class Core : public QObject {
Q_OBJECT
public:
class CoreParams
{
public:
CoreParams();
class CoreParams {
public:
CoreParams();
enum RunMode {
kRunNormal,
kHeadlessExport,
kHeadlessPreCache
};
enum RunMode { kRunNormal, kHeadlessExport, kHeadlessPreCache };
bool fullscreen() const
{
return run_fullscreen_;
}
bool fullscreen() const
{
return run_fullscreen_;
}
void set_fullscreen(bool e)
{
run_fullscreen_ = e;
}
void set_fullscreen(bool e)
{
run_fullscreen_ = e;
}
RunMode run_mode() const
{
return mode_;
}
RunMode run_mode() const
{
return mode_;
}
void set_run_mode(RunMode m)
{
mode_ = m;
}
void set_run_mode(RunMode m)
{
mode_ = m;
}
const QString startup_project() const
{
return startup_project_;
}
const QString startup_project() const
{
return startup_project_;
}
void set_startup_project(const QString& p)
{
startup_project_ = p;
}
void set_startup_project(const QString &p)
{
startup_project_ = p;
}
const QString& startup_language() const
{
return startup_language_;
}
const QString &startup_language() const
{
return startup_language_;
}
void set_startup_language(const QString& s)
{
startup_language_ = s;
}
void set_startup_language(const QString &s)
{
startup_language_ = s;
}
bool crash_on_startup() const
{
return crash_;
}
bool crash_on_startup() const
{
return crash_;
}
void set_crash_on_startup(bool e)
{
crash_ = true;
}
void set_crash_on_startup(bool e)
{
crash_ = true;
}
private:
RunMode mode_;
private:
RunMode mode_;
QString startup_project_;
QString startup_project_;
QString startup_language_;
QString startup_language_;
bool run_fullscreen_;
bool run_fullscreen_;
bool crash_;
bool crash_;
};
};
/**
/**
* @brief Core Constructor
*
* Currently empty
*/
Core(const CoreParams& params);
Core(const CoreParams &params);
/**
/**
* @brief Core object accessible from anywhere in the code
*
* Use this to access Core functions.
*/
static Core* instance();
static Core *instance();
const CoreParams& core_params() const
{
return core_params_;
}
const CoreParams &core_params() const
{
return core_params_;
}
/**
/**
* @brief Start Olive Core
*
* Main application launcher. Parses command line arguments and constructs main window (if entering a GUI mode).
*/
void Start();
void Start();
/**
/**
* @brief Stop Olive Core
*
* Ends all threads and frees all memory ready for the application to exit.
*/
void Stop();
void Stop();
/**
/**
* @brief Retrieve main window instance
*
* @return
*
* Pointer to the olive::MainWindow object, or nullptr if running in CLI mode.
*/
MainWindow* main_window();
MainWindow *main_window();
/**
/**
* @brief Retrieve UndoStack object
*/
UndoStack* undo_stack();
UndoStack *undo_stack();
/**
/**
* @brief Import a list of files
*
* FIXME: I kind of hate this, it needs a model to update correctly. Is there a way that Items can signal enough to
@@ -181,34 +175,34 @@ public:
*
* @param urls
*/
void ImportFiles(const QStringList& urls, Folder *parent);
void ImportFiles(const QStringList &urls, Folder *parent);
/**
/**
* @brief Get the currently active tool
*/
const Tool::Item& tool() const;
const Tool::Item &tool() const;
/**
/**
* @brief Get the currently selected object that the add tool should make (if the add tool is active)
*/
const Tool::AddableObject& GetSelectedAddableObject() const;
const Tool::AddableObject &GetSelectedAddableObject() const;
/**
/**
* @brief Get the currently selected node that the transition tool should make (if the transition tool is active)
*/
const QString& GetSelectedTransition() const;
const QString &GetSelectedTransition() const;
/**
/**
* @brief Get current snapping value
*/
const bool& snapping() const;
const bool &snapping() const;
/**
/**
* @brief Returns a list of the most recently opened/saved projects
*/
const QStringList& GetRecentProjects() const;
const QStringList &GetRecentProjects() const;
/**
/**
* @brief Get the currently active project
*
* Uses the UI/Panel system to determine which Project was the last focused on and assumes this is the active Project
@@ -218,402 +212,409 @@ public:
*
* The active Project file, or nullptr if the heuristic couldn't find one.
*/
Project* GetActiveProject() const;
Folder* GetSelectedFolderInActiveProject() const;
Project *GetActiveProject() const;
Folder *GetSelectedFolderInActiveProject() const;
/**
/**
* @brief Gets current timecode display mode
*/
Timecode::Display GetTimecodeDisplay() const;
Timecode::Display GetTimecodeDisplay() const;
/**
/**
* @brief Sets current timecode display mode
*/
void SetTimecodeDisplay(Timecode::Display d);
void SetTimecodeDisplay(Timecode::Display d);
/**
/**
* @brief Set how frequently an autorecovery should be saved (if the project has changed, see SetProjectModified())
*/
void SetAutorecoveryInterval(int minutes);
void SetAutorecoveryInterval(int minutes);
static void CopyStringToClipboard(const QString& s);
static void CopyStringToClipboard(const QString &s);
static QString PasteStringFromClipboard();
static QString PasteStringFromClipboard();
/**
/**
* @brief Recursively count files in a file/directory list
*/
static int CountFilesInFileList(const QFileInfoList &filenames);
static int CountFilesInFileList(const QFileInfoList &filenames);
/**
/**
* @brief Show a dialog to the user to rename a set of nodes
*/
bool LabelNodes(const QVector<Node *> &nodes, MultiUndoCommand *parent = nullptr);
bool LabelNodes(const QVector<Node *> &nodes,
MultiUndoCommand *parent = nullptr);
/**
/**
* @brief Create a new sequence named appropriately for the active project
*/
static Sequence* CreateNewSequenceForProject(const QString &format, Project *project);
static Sequence* CreateNewSequenceForProject(Project *project)
{
return CreateNewSequenceForProject(tr("Sequence %1"), project);
}
static Sequence *CreateNewSequenceForProject(const QString &format,
Project *project);
static Sequence *CreateNewSequenceForProject(Project *project)
{
return CreateNewSequenceForProject(tr("Sequence %1"), project);
}
/**
/**
* @brief Opens a project from the recently opened list
*/
void OpenProjectFromRecentList(int index);
void OpenProjectFromRecentList(int index);
/**
/**
* @brief Closes a project
*/
bool CloseProject(bool auto_open_new, bool ignore_modified = false);
bool CloseProject(bool auto_open_new, bool ignore_modified = false);
/**
/**
* @brief Runs a modal cache task on the currently active sequence
*/
void CacheActiveSequence(bool in_out_only);
void CacheActiveSequence(bool in_out_only);
/**
/**
* @brief Check each footage object for whether it still exists or has changed
*/
bool ValidateFootageInLoadedProject(Project* project, const QString &project_saved_url);
bool ValidateFootageInLoadedProject(Project *project,
const QString &project_saved_url);
/**
/**
* @brief Changes the current language
*/
bool SetLanguage(const QString& locale);
bool SetLanguage(const QString &locale);
/**
/**
* @brief Show message in main window's status bar
*
* Shorthand for Core::instance()->main_window()->statusBar()->showMessage();
*/
void ShowStatusBarMessage(const QString& s, int timeout = 0);
void ShowStatusBarMessage(const QString &s, int timeout = 0);
void ClearStatusBarMessage();
void ClearStatusBarMessage();
void OpenRecoveryProject(const QString& filename);
void OpenRecoveryProject(const QString &filename);
void OpenNodeInViewer(ViewerOutput* viewer);
void OpenNodeInViewer(ViewerOutput *viewer);
void OpenExportDialogForViewer(ViewerOutput *viewer, bool start_still_image);
void OpenExportDialogForViewer(ViewerOutput *viewer,
bool start_still_image);
bool IsMagicEnabled() const { return magic_; }
bool IsMagicEnabled() const
{
return magic_;
}
public slots:
/**
/**
* @brief Starts an open file dialog to load a project from file
*/
void OpenProject();
void OpenProject();
/**
/**
* @brief Saves the current project
*/
bool SaveProject();
bool SaveProject();
/**
/**
* @brief Performs a "save as" on the current project
*/
bool SaveProjectAs();
bool SaveProjectAs();
void RevertProject();
void RevertProject();
/**
/**
* @brief Set the current application-wide tool
*
* @param tool
*/
void SetTool(const Tool::Item& tool);
void SetTool(const Tool::Item &tool);
/**
/**
* @brief Set the current snapping setting
*/
void SetSnapping(const bool& b);
void SetSnapping(const bool &b);
/**
/**
* @brief Show an About dialog
*/
void DialogAboutShow();
void DialogAboutShow();
/**
/**
* @brief Open the import footage dialog and import the files selected (runs ImportFiles())
*/
void DialogImportShow();
void DialogImportShow();
/**
/**
* @brief Show Preferences dialog
*/
void DialogPreferencesShow();
void DialogPreferencesShow();
/**
/**
* @brief Show Project Properties dialog
*/
void DialogProjectPropertiesShow();
void DialogProjectPropertiesShow();
/**
/**
* @brief Show Export dialog
*/
void DialogExportShow();
void DialogExportShow();
/**
/**
* @brief Show OTIO import dialog
*/
#ifdef USE_OTIO
bool DialogImportOTIOShow(const QList<Sequence*>& sequences);
bool DialogImportOTIOShow(const QList<Sequence *> &sequences);
#endif
/**
/**
* @brief Create a new folder in the currently active project
*/
void CreateNewFolder();
void CreateNewFolder();
/**
/**
* @brief Create a new sequence in the currently active project
*/
void CreateNewSequence();
void CreateNewSequence();
/**
/**
* @brief Set the currently selected object that the add tool should make
*/
void SetSelectedAddableObject(const Tool::AddableObject& obj);
void SetSelectedAddableObject(const Tool::AddableObject &obj);
/**
/**
* @brief Set the currently selected object that the add tool should make
*/
void SetSelectedTransitionObject(const QString& obj);
void SetSelectedTransitionObject(const QString &obj);
/**
/**
* @brief Clears the list of recently opened/saved projects
*/
void ClearOpenRecentList();
void ClearOpenRecentList();
/**
/**
* @brief Creates a new empty project and opens it
*/
void CreateNewProject();
void CreateNewProject();
void CheckForAutoRecoveries();
void CheckForAutoRecoveries();
void BrowseAutoRecoveries();
void BrowseAutoRecoveries();
void RequestPixelSamplingInViewers(bool e);
void RequestPixelSamplingInViewers(bool e);
void WarnCacheFull();
void WarnCacheFull();
void SetMagic(bool e)
{
magic_ = e;
}
void SetMagic(bool e)
{
magic_ = e;
}
signals:
/**
/**
* @brief Signal emitted when the tool is changed from somewhere
*/
void ToolChanged(const Tool::Item& tool);
void ToolChanged(const Tool::Item &tool);
/**
/**
* @brief Signal emitted when addable object changes through SetSelectedAddableObject
*/
void AddableObjectChanged(Tool::AddableObject o);
void AddableObjectChanged(Tool::AddableObject o);
/**
/**
* @brief Signal emitted when the snapping setting is changed
*/
void SnappingChanged(const bool& b);
void SnappingChanged(const bool &b);
/**
/**
* @brief Signal emitted when the default timecode display mode changed
*/
void TimecodeDisplayChanged(Timecode::Display d);
void TimecodeDisplayChanged(Timecode::Display d);
/**
/**
* @brief Signal emitted when a change is made to the open recent list
*/
void OpenRecentListChanged();
void OpenRecentListChanged();
/**
/**
* @brief Enable mouse color sampling functionality on all viewers
*
* This can be slow, so we only turn it on when we need it.
*/
void ColorPickerEnabled(bool e);
void ColorPickerEnabled(bool e);
/**
/**
* @brief A viewer with color picked enabled has emitted a color
*/
void ColorPickerColorEmitted(const Color &reference, const Color &display);
void ColorPickerColorEmitted(const Color &reference, const Color &display);
private:
/**
/**
* @brief Get the file filter than can be used with QFileDialog to open and save compatible projects
*/
static QString GetProjectFilter(bool include_any_filter);
static QString GetProjectFilter(bool include_any_filter);
/**
/**
* @brief Returns the filename where the recently opened/saved projects should be stored
*/
static QString GetRecentProjectsFilePath();
static QString GetRecentProjectsFilePath();
/**
/**
* @brief Called only on startup to set the locale
*/
void SetStartupLocale();
void SetStartupLocale();
/**
/**
* @brief Adds a filename to the top of the recently opened projects list (or moves it if it already exists)
*/
void PushRecentlyOpenedProject(const QString &s);
void PushRecentlyOpenedProject(const QString &s);
/**
/**
* @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();
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);
void StartGUI(bool full_screen);
/**
/**
* @brief Internal function for saving a project to a file
*/
void SaveProjectInternal(const QString &override_filename = QString());
void SaveProjectInternal(const QString &override_filename = QString());
/**
/**
* @brief Retrieves the currently most active sequence for exporting
*/
ViewerOutput *GetSequenceToExport();
ViewerOutput *GetSequenceToExport();
static QString GetAutoRecoveryIndexFilename();
static QString GetAutoRecoveryIndexFilename();
void SaveUnrecoveredList();
void SaveUnrecoveredList();
bool RevertProjectInternal(bool by_opening_existing);
bool RevertProjectInternal(bool by_opening_existing);
void SaveRecentProjectsList();
void SaveRecentProjectsList();
/**
/**
* @brief Adds a project to the "open projects" list
*/
void AddOpenProject(olive::Project* p, bool add_to_recents = false);
void AddOpenProject(olive::Project *p, bool add_to_recents = false);
bool AddOpenProjectFromTask(Task* task, bool add_to_recents);
bool AddOpenProjectFromTask(Task *task, bool add_to_recents);
void SetActiveProject(Project *p);
void SetActiveProject(Project *p);
/**
/**
* @brief Internal main window object
*/
MainWindow* main_window_;
MainWindow *main_window_;
/**
/**
* @brief List of currently open projects
*/
Project *open_project_;
Project *open_project_;
/**
/**
* @brief Currently active tool
*/
Tool::Item tool_;
Tool::Item tool_;
/**
/**
* @brief Currently active addable object
*/
Tool::AddableObject addable_object_;
Tool::AddableObject addable_object_;
/**
/**
* @brief Currently selected transition
*/
QString selected_transition_;
QString selected_transition_;
/**
/**
* @brief Current snapping setting
*/
bool snapping_;
bool snapping_;
/**
/**
* @brief Internal timer for saving autorecovery files
*/
QTimer autorecovery_timer_;
QTimer autorecovery_timer_;
/**
/**
* @brief Application-wide undo stack instance
*/
UndoStack undo_stack_;
UndoStack undo_stack_;
/**
/**
* @brief List of most recently opened/saved projects
*/
QStringList recent_projects_;
QStringList recent_projects_;
/**
/**
* @brief Parameters set up in main() determining how the program should run
*/
CoreParams core_params_;
CoreParams core_params_;
/**
/**
* @brief Static singleton core instance
*/
static Core* instance_;
static Core *instance_;
/**
/**
* @brief Internal translator
*/
QTranslator* translator_;
QTranslator *translator_;
/**
/**
* @brief List of projects that are unsaved but have autorecovery projects
*/
QVector<QUuid> autorecovered_projects_;
QVector<QUuid> autorecovered_projects_;
/**
/**
* @brief Do something debug related
*/
bool magic_;
bool magic_;
/**
/**
* @brief How many widgets currently need pixel sampling access
*/
int pixel_sampling_users_;
int pixel_sampling_users_;
bool shown_cache_full_warning_;
bool shown_cache_full_warning_;
private slots:
void SaveAutorecovery();
void SaveAutorecovery();
void ProjectSaveSucceeded(Task *task);
void ProjectSaveSucceeded(Task *task);
bool AddOpenProjectFromTaskAndAddToRecents(Task* task)
{
return AddOpenProjectFromTask(task, true);
}
bool AddOpenProjectFromTaskAndAddToRecents(Task *task)
{
return AddOpenProjectFromTask(task, true);
}
void ImportTaskComplete(Task *task);
void ImportTaskComplete(Task *task);
bool ConfirmImageSequence(const QString &filename);
bool ConfirmImageSequence(const QString &filename);
void ProjectWasModified(bool e);
void ProjectWasModified(bool e);
bool StartHeadlessExport();
bool StartHeadlessExport();
void OpenStartupProject();
void OpenStartupProject();
void AddRecoveryProjectFromTask(Task* task);
void AddRecoveryProjectFromTask(Task *task);
/**
/**
* @brief Internal project open
*/
void OpenProjectInternal(const QString& filename, bool recovery_project = false);
void ImportSingleFile(const QString &f);
void OpenProjectInternal(const QString &filename,
bool recovery_project = false);
void ImportSingleFile(const QString &f);
};
}