diff --git a/src/app/core/vapplication.cpp b/src/app/core/vapplication.cpp index 0faceb853..8353e1ff3 100644 --- a/src/app/core/vapplication.cpp +++ b/src/app/core/vapplication.cpp @@ -98,25 +98,16 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con debugdate += QString(":WARNING:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) .arg(context.function).arg(context.category).arg(msg); messageBox.setIcon(QMessageBox::Warning); - messageBox.setInformativeText(msg); - messageBox.setStandardButtons(QMessageBox::Ok); - messageBox.exec(); break; case QtCriticalMsg: debugdate += QString(":CRITICAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) .arg(context.function).arg(context.category).arg(msg); messageBox.setIcon(QMessageBox::Critical); - messageBox.setInformativeText(msg); - messageBox.setStandardButtons(QMessageBox::Ok); - messageBox.exec(); break; case QtFatalMsg: debugdate += QString(":FATAL:%1(%2)] %3: %4: %5").arg(context.file).arg(context.line) .arg(context.function).arg(context.category).arg(msg); messageBox.setIcon(QMessageBox::Critical); - messageBox.setInformativeText(msg); - messageBox.setStandardButtons(QMessageBox::Ok); - messageBox.exec(); break; default: break; @@ -124,6 +115,15 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con (*qApp->LogFile()) << debugdate << endl; + if (type == QtWarningMsg || type == QtCriticalMsg || type == QtFatalMsg) + { + messageBox.setInformativeText(msg); + messageBox.setStandardButtons(QMessageBox::Ok); + messageBox.setWindowModality(Qt::ApplicationModal); + messageBox.setModal(true); + messageBox.exec(); + } + if (QtFatalMsg == type) { abort(); diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index 2a25f54fb..a72d9cf05 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -764,7 +764,11 @@ void MainWindow::OpenRecentFile() QAction *action = qobject_cast(sender()); if (action) { - OpenPattern(action->data().toString()); + const QString filePath = action->data().toString(); + if (filePath.isEmpty() == false) + { + LoadPattern(filePath); + } } } @@ -1406,7 +1410,7 @@ void MainWindow::Open() } qCDebug(vMainWindow)<<"Run QFileDialog::getOpenFileName: dir ="<menuPatternPiece->insertAction(ui->actionPattern_properties, ui->dockWidgetToolOptions->toggleViewAction()); @@ -2176,12 +2181,14 @@ void MainWindow::PropertyBrowser() } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::OpenNewValentina(const QString &fileName) const +bool MainWindow::OpenNewValentina(const QString &fileName) const { if (this->isWindowModified() || curFile.isEmpty() == false) { VApplication::NewValentina(fileName); + return true; } + return false; } //--------------------------------------------------------------------------------------------------------------------- @@ -2293,7 +2300,17 @@ void MainWindow::LoadPattern(const QString &fileName) qCDebug(vMainWindow)<<"Loading new file"<isWindowModified() == false) - { - LoadPattern(filePath); - } - else - { - VApplication::NewValentina(filePath); - } - } -} - //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ChangePP(int index, bool zoomBestFit) { diff --git a/src/app/mainwindow.h b/src/app/mainwindow.h index b93d10c41..f555a21ad 100644 --- a/src/app/mainwindow.h +++ b/src/app/mainwindow.h @@ -242,7 +242,6 @@ private: void InitAutoSave(); QString PatternPieceName(const QString &text); QString CheckPathToMeasurements(const QString &path, const MeasurementsType &patternType); - void OpenPattern(const QString &filePath); QComboBox *SetGradationList(const QString &label, const QStringList &list); void ChangePP(int index, bool zoomBestFit = true); /** @@ -257,7 +256,7 @@ private: void AddDocks(); void PropertyBrowser(); - void OpenNewValentina(const QString &fileName = QString())const; + bool OpenNewValentina(const QString &fileName = QString())const; void FileClosedCorrect(); QStringList GetUnlokedRestoreFileList()const; };