| 34 | } |
| 35 | |
| 36 | void ProjectDock::setProject(Project* project) { |
| 37 | CONDITIONAL_LOCK_RETURN; |
| 38 | m_project = project; |
| 39 | setAspects(QList<Project*>({project})); |
| 40 | |
| 41 | ui.leFileName->setText(project->fileName()); |
| 42 | ui.leAuthor->setText(m_project->author()); |
| 43 | |
| 44 | ui.lVersion->setText(project->version()); |
| 45 | ui.lCreated->setText(project->creationTime().toString()); |
| 46 | ui.lModified->setText(project->modificationTime().toString()); |
| 47 | ui.chkSaveDockStates->setChecked(project->saveDefaultDockWidgetState()); |
| 48 | |
| 49 | bool visible = !project->children<XYAnalysisCurve>(AbstractAspect::ChildIndexFlag::Recursive).isEmpty(); |
| 50 | ui.lSaveCalculations->setVisible(visible); |
| 51 | ui.chkSaveCalculations->setVisible(visible); |
| 52 | ui.chkSaveCalculations->setChecked(project->saveCalculations()); |
| 53 | |
| 54 | // resize the height of the comment field to fit the content (word wrap is ignored) |
| 55 | const double height = ui.teComment->document()->size().height() + ui.teComment->contentsMargins().top() * 2; |
| 56 | // HACK: we set the fixed height first and then set the min and max values back to the default ones, |
| 57 | // other methods don't seem to properly trigger the update of the layout and we don't get the proper |
| 58 | // widgets sizes in the dock widget. |
| 59 | ui.teComment->setFixedHeight(height); |
| 60 | ui.teComment->setMinimumHeight(0); |
| 61 | ui.teComment->setMaximumHeight(16777215); |
| 62 | |
| 63 | connect(m_project, &Project::authorChanged, this, &ProjectDock::projectAuthorChanged); |
| 64 | connect(m_project, &Project::saveDefaultDockWidgetStateChanged, this, &ProjectDock::projectSaveDockStatesChanged); |
| 65 | connect(m_project, &Project::saveCalculationsChanged, this, &ProjectDock::projectSaveCalculationsChanged); |
| 66 | } |
| 67 | |
| 68 | void ProjectDock::retranslateUi() { |
| 69 | QString msg = i18n("If checked, the state of the default application docks is saved in the project file and restored on project load."); |
nothing calls this directly
no test coverage detected