fixed faulty project closing code
This commit is contained in:
+35
-35
@@ -166,18 +166,11 @@ void OliveGlobal::SetNativeStyling(QWidget *w)
|
||||
#endif
|
||||
}
|
||||
|
||||
void OliveGlobal::LoadProject(const QString &fn, bool autorecovery, bool clear)
|
||||
void OliveGlobal::LoadProject(const QString &fn, bool autorecovery)
|
||||
{
|
||||
// Normally, the user will be closing the previous project to load a new one, but just in case the user
|
||||
// is importing a new project
|
||||
|
||||
if (clear) {
|
||||
new_project();
|
||||
}
|
||||
|
||||
LoadDialog ld(olive::MainWindow);
|
||||
|
||||
LoadThread* lt = new LoadThread(fn, autorecovery, clear);
|
||||
LoadThread* lt = new LoadThread(fn, autorecovery);
|
||||
connect(&ld, SIGNAL(cancel()), lt, SLOT(cancel()));
|
||||
connect(lt, SIGNAL(success()), &ld, SLOT(accept()));
|
||||
connect(lt, SIGNAL(error()), &ld, SLOT(reject()));
|
||||
@@ -188,37 +181,43 @@ void OliveGlobal::LoadProject(const QString &fn, bool autorecovery, bool clear)
|
||||
ld.exec();
|
||||
}
|
||||
|
||||
void OliveGlobal::ClearProject()
|
||||
{
|
||||
// clear graph editor
|
||||
panel_graph_editor->set_row(nullptr);
|
||||
|
||||
// clear effects panel
|
||||
panel_effect_controls->Clear(true);
|
||||
|
||||
// clear existing project
|
||||
olive::Global->set_sequence(nullptr);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
|
||||
// clear project contents (footage, sequences, etc.)
|
||||
panel_project->clear();
|
||||
|
||||
// clear undo stack
|
||||
olive::UndoStack.clear();
|
||||
|
||||
// empty current project filename
|
||||
update_project_filename("");
|
||||
|
||||
// full update of all panels
|
||||
update_ui(false);
|
||||
|
||||
// set to unmodified
|
||||
olive::Global->set_modified(false);
|
||||
}
|
||||
|
||||
void OliveGlobal::ImportProject(const QString &fn)
|
||||
{
|
||||
LoadProject(fn, false, false);
|
||||
LoadProject(fn, false);
|
||||
set_modified(true);
|
||||
}
|
||||
|
||||
void OliveGlobal::new_project() {
|
||||
if (can_close_project()) {
|
||||
// clear graph editor
|
||||
panel_graph_editor->set_row(nullptr);
|
||||
|
||||
// clear effects panel
|
||||
panel_effect_controls->Clear(true);
|
||||
|
||||
// clear existing project
|
||||
olive::Global->set_sequence(nullptr);
|
||||
panel_footage_viewer->set_media(nullptr);
|
||||
|
||||
// clear project contents (footage, sequences, etc.)
|
||||
panel_project->clear();
|
||||
|
||||
// clear undo stack
|
||||
olive::UndoStack.clear();
|
||||
|
||||
// empty current project filename
|
||||
update_project_filename("");
|
||||
|
||||
// full update of all panels
|
||||
update_ui(false);
|
||||
|
||||
// set to unmodified
|
||||
olive::Global->set_modified(false);
|
||||
ClearProject();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -359,8 +358,9 @@ void OliveGlobal::set_sequence(SequencePtr s)
|
||||
}
|
||||
|
||||
void OliveGlobal::OpenProjectWorker(const QString& fn, bool autorecovery) {
|
||||
ClearProject();
|
||||
update_project_filename(fn);
|
||||
LoadProject(fn, autorecovery, true);
|
||||
LoadProject(fn, autorecovery);
|
||||
olive::UndoStack.clear();
|
||||
}
|
||||
|
||||
|
||||
+9
-1
@@ -366,7 +366,15 @@ private:
|
||||
* TRUE if the current project should be closed before opening, FALSE if the project should be imported into the
|
||||
* currently open one.
|
||||
*/
|
||||
void LoadProject(const QString& fn, bool autorecovery, bool clear);
|
||||
void LoadProject(const QString& fn, bool autorecovery);
|
||||
|
||||
/**
|
||||
* @brief Indiscriminately clear the project without prompting the user
|
||||
*
|
||||
* Will clear the entire project without prompting to save. This is dangerous, use new_project() instead for
|
||||
* anything initiated by the user.
|
||||
*/
|
||||
void ClearProject();
|
||||
|
||||
/**
|
||||
* @brief File filter used for any file dialogs relating to Olive project files.
|
||||
|
||||
@@ -37,10 +37,9 @@
|
||||
#include <QFile>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
LoadThread::LoadThread(const QString& filename, bool autorecovery, bool clear) :
|
||||
LoadThread::LoadThread(const QString& filename, bool autorecovery) :
|
||||
filename_(filename),
|
||||
autorecovery_(autorecovery),
|
||||
clear_(clear),
|
||||
cancelled_(false)
|
||||
{
|
||||
connect(this, SIGNAL(finished()), this, SLOT(deleteLater()));
|
||||
@@ -779,14 +778,12 @@ void LoadThread::success_func() {
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (clear_) {
|
||||
olive::Global->update_project_filename(orig_filename);
|
||||
}
|
||||
olive::Global->update_project_filename(orig_filename);
|
||||
} else {
|
||||
panel_project->add_recent_project(filename_);
|
||||
}
|
||||
|
||||
olive::Global->set_modified(autorecovery_ || !clear_);
|
||||
olive::Global->set_modified(autorecovery_);
|
||||
if (open_seq != nullptr) {
|
||||
olive::Global->set_sequence(open_seq);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class LoadThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LoadThread(const QString& filename, bool autorecovery, bool clear);
|
||||
LoadThread(const QString& filename, bool autorecovery);
|
||||
void run();
|
||||
public slots:
|
||||
void cancel();
|
||||
@@ -50,7 +50,6 @@ private slots:
|
||||
void success_func();
|
||||
private:
|
||||
bool autorecovery_;
|
||||
bool clear_;
|
||||
QString filename_;
|
||||
|
||||
bool load_worker(QFile& f, QXmlStreamReader& stream, int type);
|
||||
|
||||
Reference in New Issue
Block a user