From 8407f714a5e267a6b62b31525b7064bda0da90c1 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 30 Oct 2014 12:19:17 +0200 Subject: [PATCH] Do not open file twice after we restore him. --HG-- branch : develop --- src/app/main.cpp | 4 ++-- src/app/mainwindow.cpp | 3 ++- src/app/mainwindow.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index 36fa72ab6..a9a470cfd 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -187,12 +187,12 @@ int main(int argc, char *argv[]) parser.addVersionOption(); parser.addPositionalArgument("filename", QCoreApplication::translate("main", "Pattern file.")); parser.process(app); - const QStringList args = parser.positionalArguments(); + QStringList args = parser.positionalArguments(); //Before we load pattern show window. w.show(); - w.ReopenFilesAfterCrash(); + w.ReopenFilesAfterCrash(args); for (int i=0;igetSettings()->value("restoreFileList").toStringList(); if (files.size() > 0) @@ -2308,6 +2308,7 @@ void MainWindow::ReopenFilesAfterCrash() QFile autoFile(restoreFiles.at(i) +".autosave"); autoFile.remove(); LoadPattern(restoreFiles.at(i)); + args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him. } else { diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index 9f32d8e34..d12419374 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -56,7 +56,7 @@ public: explicit MainWindow(QWidget *parent = nullptr); virtual ~MainWindow(); void LoadPattern(const QString &curFile); - void ReopenFilesAfterCrash(); + void ReopenFilesAfterCrash(QStringList &args); public slots: void mouseMove(const QPointF &scenePos); void ArrowTool();