Skip to content
Snippets Groups Projects
Commit 67f7634e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rm more doc args

parent b37d35f6
No related branches found
No related tags found
1 merge request!2263make full use of gDoc being global
Pipeline #124540 canceled
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
// ************************************************************************************************ // ************************************************************************************************
#include "GUI/View/Manager/ProjectLoadProblemDialog.h" #include "GUI/View/Manager/ProjectLoadProblemDialog.h"
#include "Base/Util/Assert.h"
#include "GUI/Model/Project/ProjectDocument.h"
#include "GUI/Support/Style/Style.h" #include "GUI/Support/Style/Style.h"
#include "GUI/Support/Util/Path.h" #include "GUI/Support/Util/Path.h"
#include <QGridLayout> #include <QGridLayout>
...@@ -23,12 +25,10 @@ ...@@ -23,12 +25,10 @@
namespace { namespace {
const int top_panel_height = 80; const int top_panel_height = 80;
} // namespace } // namespace
ProjectLoadProblemDialog::ProjectLoadProblemDialog(QWidget* parent, const QStringList& details, ProjectLoadProblemDialog::ProjectLoadProblemDialog(const QStringList& details)
QString documentVersion)
: QDialog(parent)
, m_projectDocumentVersion(std::move(documentVersion))
{ {
setMinimumSize(256, 256); setMinimumSize(256, 256);
resize(520, 620); resize(520, 620);
...@@ -119,18 +119,20 @@ QLayout* ProjectLoadProblemDialog::buttonLayout() ...@@ -119,18 +119,20 @@ QLayout* ProjectLoadProblemDialog::buttonLayout()
//! Returns explanations what went wrong. //! Returns explanations what went wrong.
QString ProjectLoadProblemDialog::explanationText() const QString ProjectLoadProblemDialog::explanationText() const
{ {
if (m_projectDocumentVersion != GUI::Path::getBornAgainVersionString()) { ASSERT(gDoc);
const QString& doc_version = gDoc->documentVersion();
if (doc_version != GUI::Path::getBornAgainVersionString())
return QString( return QString(
"Given project was created using BornAgain version %1 " "Given project was created using BornAgain version %1 "
" which is different from version %2 you are currently using. " " which is different from version %2 you are currently using. "
"At the moment we provide only limited support for import from older versions.") "At the moment we provide only limited support for import from older versions.")
.arg(m_projectDocumentVersion) .arg(doc_version)
.arg(GUI::Path::getBornAgainVersionString()); .arg(GUI::Path::getBornAgainVersionString());
}
return QString("Given project was created using BornAgain version %1 " return QString("Given project was created using BornAgain version %1 "
"which is the same as the current version of the framework. " "which is the same as the current version of the framework. "
"Strangely enough, some parts were not loaded correctly due to format mismatch. " "Strangely enough, some parts were not loaded correctly due to format mismatch. "
"Please contact the developers.") "Please contact the developers.")
.arg(m_projectDocumentVersion); .arg(doc_version);
} }
...@@ -23,14 +23,12 @@ ...@@ -23,14 +23,12 @@
class ProjectLoadProblemDialog : public QDialog { class ProjectLoadProblemDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
ProjectLoadProblemDialog(QWidget* parent, const QStringList& details, QString documentVersion); ProjectLoadProblemDialog(const QStringList& details);
private: private:
QWidget* createWarningWidget(); QWidget* createWarningWidget();
QLayout* buttonLayout(); QLayout* buttonLayout();
QString explanationText() const; QString explanationText() const;
QString m_projectDocumentVersion;
}; };
#endif // BORNAGAIN_GUI_VIEW_MANAGER_PROJECTLOADPROBLEMDIALOG_H #endif // BORNAGAIN_GUI_VIEW_MANAGER_PROJECTLOADPROBLEMDIALOG_H
...@@ -423,10 +423,7 @@ void ProjectManager::riseProjectLoadFailedDialog(const MessageService& messageSe ...@@ -423,10 +423,7 @@ void ProjectManager::riseProjectLoadFailedDialog(const MessageService& messageSe
void ProjectManager::riseProjectLoadProblemDialog(const MessageService& messageService) void ProjectManager::riseProjectLoadProblemDialog(const MessageService& messageService)
{ {
ASSERT(gDoc); auto* problemDialog = new ProjectLoadProblemDialog(messageService.warnings(true));
auto* problemDialog = new ProjectLoadProblemDialog(
GUI::Global::mainWindow, messageService.warnings(true), gDoc->documentVersion());
problemDialog->show(); problemDialog->show();
problemDialog->raise(); problemDialog->raise();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment