Do not open file twice after we restore him.
--HG-- branch : develop
This commit is contained in:
parent
1d8a0054ac
commit
8407f714a5
|
@ -187,12 +187,12 @@ int main(int argc, char *argv[])
|
||||||
parser.addVersionOption();
|
parser.addVersionOption();
|
||||||
parser.addPositionalArgument("filename", QCoreApplication::translate("main", "Pattern file."));
|
parser.addPositionalArgument("filename", QCoreApplication::translate("main", "Pattern file."));
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
const QStringList args = parser.positionalArguments();
|
QStringList args = parser.positionalArguments();
|
||||||
|
|
||||||
//Before we load pattern show window.
|
//Before we load pattern show window.
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
w.ReopenFilesAfterCrash();
|
w.ReopenFilesAfterCrash(args);
|
||||||
|
|
||||||
for (int i=0;i<args.size();++i)
|
for (int i=0;i<args.size();++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2274,7 +2274,7 @@ void MainWindow::LoadPattern(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void MainWindow::ReopenFilesAfterCrash()
|
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
|
||||||
{
|
{
|
||||||
QStringList files = qApp->getSettings()->value("restoreFileList").toStringList();
|
QStringList files = qApp->getSettings()->value("restoreFileList").toStringList();
|
||||||
if (files.size() > 0)
|
if (files.size() > 0)
|
||||||
|
@ -2308,6 +2308,7 @@ void MainWindow::ReopenFilesAfterCrash()
|
||||||
QFile autoFile(restoreFiles.at(i) +".autosave");
|
QFile autoFile(restoreFiles.at(i) +".autosave");
|
||||||
autoFile.remove();
|
autoFile.remove();
|
||||||
LoadPattern(restoreFiles.at(i));
|
LoadPattern(restoreFiles.at(i));
|
||||||
|
args.removeAll(restoreFiles.at(i));// Do not open file twice after we restore him.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ public:
|
||||||
explicit MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
virtual ~MainWindow();
|
virtual ~MainWindow();
|
||||||
void LoadPattern(const QString &curFile);
|
void LoadPattern(const QString &curFile);
|
||||||
void ReopenFilesAfterCrash();
|
void ReopenFilesAfterCrash(QStringList &args);
|
||||||
public slots:
|
public slots:
|
||||||
void mouseMove(const QPointF &scenePos);
|
void mouseMove(const QPointF &scenePos);
|
||||||
void ArrowTool();
|
void ArrowTool();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user