102 int current_tab_index =
m_tab -> currentIndex();
103 if (current_tab_index == -1)
114 if (can_close_project) {
127 if (nextDiagramView!=
nullptr){
129 m_tab -> setCurrentWidget(nextDiagramView);
137 int current_tab_index =
m_tab -> currentIndex();
138 int next_tab_index = current_tab_index + 1;
150 if (previousDiagramView!=
nullptr){
152 m_tab -> setCurrentWidget(previousDiagramView);
160 int current_tab_index =
m_tab -> currentIndex();
161 int previous_tab_index = current_tab_index - 1;
162 if (previous_tab_index>=0)
173 m_tab->setCurrentWidget(lastDiagramView);
188 m_tab->setCurrentWidget(firstDiagramView);
231 }
else if (user_input == QMessageBox::Discard) {
242 if (filepath.isEmpty())
return(
false);
247 return(result.
isOk());
264 if (!editor -> close())
return(
false);
269 if (!template_editor -> close())
return(
false);
281 if (!
m_project)
return(QMessageBox::Discard);
283 if (!
project()->projectOptionsWereModified() &&
284 project()->undoStack()->isClean() &&
285 !
project()->filePath().isEmpty()) {
288 return(QMessageBox::Discard);
292 if (title.isEmpty()) title =
"QElectroTech ";
295 tr(
"Le projet à été modifié.\n" 296 "Voulez-vous enregistrer les modifications ?"),
297 QMessageBox::Save | QMessageBox::Discard
301 return(close_dialog);
313 QString filepath = QFileDialog::getSaveFileName(
315 tr(
"Enregistrer sous",
"dialog title"),
317 tr(
"Projet QElectroTech (*.qet)",
"filetypes allowed when saving a project file")
321 if (filepath.isEmpty())
return(filepath);
324 if (!filepath.endsWith(
".qet", Qt::CaseInsensitive)) filepath +=
".qet";
339 QETResult no_project(
tr(
"aucun projet affiché",
"error message"),
false);
354 if (
m_project -> diagrams().size() % 58 == 1 &&
m_project -> getFolioSheetsQuantity() != 0)
392 diagram_view->setFrameStyle(QFrame::Plain | QFrame::NoFrame);
428 tr(
"Supprimer le folio ?",
"message box title"),
429 tr(
"Êtes-vous sûr de vouloir supprimer ce folio du projet ? Ce changement est irréversible.",
"message box content"),
433 if (answer != QMessageBox::Yes) {
439 m_tab->removeTab(index_to_remove);
460 if (!diagram)
return;
472 if (!diagram)
return;
473 m_tab -> setCurrentWidget(diagram);
481 if (!diagram)
return;
483 m_tab -> setCurrentWidget(diagram_view);
508 if (!diagram_view)
return;
524 if (!diagram_view)
return;
527 if (!diagram_view_position) {
531 m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position - 1);
545 if (!diagram_view)
return;
552 m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position + 1);
567 if (!diagram_view)
return;
570 if (!diagram_view_position) {
589 if (!diagram_view)
return;
592 if (!diagram_view_position) {
596 m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position - 10);
610 if (!diagram_view)
return;
617 m_tab -> tabBar() -> moveTab(diagram_view_position, diagram_view_position + 10);
638 }
else if (!
m_project -> filePath().isEmpty()) {
639 doc_name = QFileInfo(
m_project -> filePath()).baseName();
642 if (doc_name.isEmpty()) {
643 doc_name =
tr(
"projet",
"string used to generate a filename");
647 QString dir_path =
m_project -> currentDir();
650 QString file_name = QDir::toNativeSeparators(QDir::cleanPath(dir_path +
"/" + doc_name));
666 ed.setWindowFlags(Qt::Sheet);
693 if (filepath.isEmpty())
return(
QETResult());
735 tr(
"Projet en lecture seule",
"message box title"),
736 tr(
"Ce projet est en lecture seule. Il n'est donc pas possible de le nettoyer.",
"message box content")
742 QCheckBox *clean_tbt =
new QCheckBox(
tr(
"Supprimer les modèles de cartouche inutilisés dans le projet"));
743 QCheckBox *clean_elements =
new QCheckBox(
tr(
"Supprimer les éléments inutilisés dans le projet"));
744 QCheckBox *clean_categories =
new QCheckBox(
tr(
"Supprimer les catégories vides"));
747 clean_tbt -> setChecked(
true);
748 clean_elements -> setChecked(
true);
749 clean_categories -> setChecked(
true);
751 QDialog clean_dialog(parentWidget());
753 clean_dialog.setWindowFlags(Qt::Sheet);
756 clean_dialog.setWindowTitle(
tr(
"Nettoyer le projet",
"window title"));
757 QVBoxLayout *clean_dialog_layout =
new QVBoxLayout();
758 clean_dialog_layout -> addWidget(clean_tbt);
759 clean_dialog_layout -> addWidget(clean_elements);
760 clean_dialog_layout -> addWidget(clean_categories);
761 clean_dialog_layout -> addWidget(buttons);
762 clean_dialog.setLayout(clean_dialog_layout);
764 connect(buttons, SIGNAL(accepted()), &clean_dialog, SLOT(accept()));
765 connect(buttons, SIGNAL(rejected()), &clean_dialog, SLOT(reject()));
768 if (clean_dialog.exec() == QDialog::Accepted)
770 if (clean_tbt -> isChecked()) {
773 if (clean_elements->isChecked()) {
776 if (clean_categories->isChecked()) {
797 setObjectName(
"ProjectView");
804 "Ce projet ne contient aucun folio",
805 "label displayed when a project contains no diagram" 811 m_tab =
new QTabWidget(
this);
812 m_tab -> setMovable(
true);
814 QToolButton *add_new_diagram_button =
new QToolButton;
816 add_new_diagram_button -> setAutoRaise(
true);
817 m_tab -> setCornerWidget(add_new_diagram_button, Qt::TopRightCorner);
819 connect(
m_tab, SIGNAL(currentChanged(
int)),
this, SLOT(
tabChanged(
int)));
824 m_tab -> setVisible(
false);
834 layout_ =
new QVBoxLayout(
this);
836 layout_ -> setContentsMargins(0, 8, 0, 0);
838 layout_ -> setContentsMargins(0, 0, 0, 0);
863 "<b>Ouverture du projet en cours...</b><br/>" 864 "Création des onglets de folio :" 883 if (
m_project -> getFolioSheetsQuantity()) {
899 title =
tr(
"Projet",
"window title for a project-less ProjectView");
901 setWindowTitle(title);
909 bool editable = !(
m_project -> isReadOnly());
912 m_tab -> setMovable(editable);
929 if (diagram_tab_id != -1)
935 if (settings.value(
"genericpanel/folio",
false).toBool())
942 title = QString::number(diagram->
folioIndex() + 1);
945 title += diagram->
title();
946 m_tab->setTabText(diagram_tab_id ,title);
973 for (
int i= qMin(from,to) ; i< qMax(from,to)+1 ; ++i)
987 if (diagram_view -> diagram() == diagram) {
988 return(diagram_view);
1002 int dv_idx =
m_tab -> indexOf(diagram_view);
1003 if (dv_idx == -1)
continue;
1019 else if(
m_tab->count() == 1)
1029 dv->diagram()->clearEventInterface();
1040 if (!diagram_view)
return;
1053 m_tab -> setVisible(!fallback);
void changeFirstTab()
change current diagramview to first tab
void setProgressBar(int val)
DialogWaiting::setProgressBar.
void setTitle(const QString &val)
DialogWaiting::setTitle of action.
void diagramRemoved(DiagramView *)
void editProjectProperties()
The ProjectPropertiesDialog class this class builds a dialog to edit whole properties of a project...
QList< Diagram * > diagrams() const
void updateAllTabsTitle()
ProjectView::updateAllTabsTitle Update all tabs title.
static QString formulaToLabel(QString formula, sequentialNumbers &seqStruct, Diagram *diagram, const Element *elmt=nullptr)
AssignVariables::formulaToLabel Return the with variable assigned (ready to be displayed) ...
void projectClosed(ProjectView *)
void changeTabDown()
change current diagramview to next folio
void rebuildDiagramsMap()
QList< DiagramView * > m_diagram_view_list
void setDetail(const QString &val)
DialogWaiting::setDetail of action.
QString errorMessage() const
QETResult noProjectResult() const
void updateTabTitle(DiagramView *)
ProjectView::updateTabTitle Update the title of the tab which display the diagram view ...
void updateWindowTitle()
ProjectView::updateWindowTitle Update the project view title.
void addNewDiagram()
ProjectView::addNewDiagram Add new diagram to project view.
void closeEvent(QCloseEvent *) override
void tabDoubleClicked(int)
static bool hasInstance()
void cleanUnusedDirectory()
XmlElementCollection::cleanUnusedDirectory Remove the empty directories of this collection.
void changeTabUp()
change current diagramview to previous tab
void diagramActivated(DiagramView *)
void titleBlockFolioChanged(const QString &)
titleBlockFolioChanged Signal emitted after Folio has changed
int getFolioSheetsQuantity() const
DiagramView * firstDiagram()
XmlElementCollection * embeddedElementCollection() const
QETProject::embeddedCollection.
void addNewDiagramFolioList()
ProjectView::addNewDiagramFolioList Add new diagram folio list to project.
void addDiagram(DiagramView *)
ProjectView::addDiagram Add diagram view to this project view.
int tryClosingDiagrams()
ProjectView::tryClosingDiagrams try to close this project, if diagram or project option are changed a...
void diagramOrderChanged(int, int)
void errorEncountered(const QString &)
QString askUserForFilePath(bool=true)
DiagramView * previousDiagram()
void exec()
ProjectPropertiesDialog::exec execute this dialog.
void setDisplayFallbackWidget(bool)
void findElementRequired(const ElementsLocation &)
static QList< QETTitleBlockTemplateEditor * > titleBlockTemplateEditors()
void moveDiagramUpTop(DiagramView *)
void setProject(QETProject *)
void adjustReadOnlyState()
DiagramView * nextDiagram()
static QList< QETElementEditor * > elementEditors()
void moveDiagramUpx10(DiagramView *)
void changeLastTab()
change current diagramview to last tab
QWidget * fallback_widget_
DiagramView * currentDiagram() const
ProjectView::currentDiagram.
void cleanUnusedElement()
XmlElementCollection::cleanUnusedElement Remove elements in this collection which is not used in the ...
int progressBarValue() const
DialogWaiting::progressBarValue.
static DialogWaiting * instance(QWidget *parent=nullptr)
QString stringToFileName(const QString &)
void showDiagram(DiagramView *)
void loadDiagrams()
ProjectView::loadDiagrams Load diagrams of project. We create a diagram view for each diagram...
void removeDiagram(DiagramView *)
ProjectView::removeDiagram Remove a diagram (folio) of the project.
QList< DiagramView * > diagram_views() const
virtual void deleteUnusedTitleBlocKTemplates()
bool tryClosingElementEditors()
DiagramView * findDiagram(Diagram *)
void editCurrentDiagramProperties()
void editDiagramProperties(DiagramView *)
QMessageBox::StandardButton question(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
ProjectView(QETProject *, QWidget *=nullptr)
void moveDiagramUp(DiagramView *)
void loadCndFolioSeq()
Diagram::loadCndFolioSeq This class loads all conductor folio sequential variables related to the cur...
QMap< int, DiagramView * > m_diagram_ids
void loadElmtFolioSeq()
Diagram::loadElmtFolioSeq This class loads all folio sequential variables related to the current auto...
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
TitleBlockTemplatesProjectCollection * embeddedTitleBlockTemplatesCollection()
QMessageBox::StandardButton critical(QWidget *, const QString &, const QString &, QMessageBox::StandardButtons=QMessageBox::Ok, QMessageBox::StandardButton=QMessageBox::NoButton)
void editElementRequired(const ElementsLocation &)
DiagramView * lastDiagram()
QAction * add_new_diagram_
void setFileName(const QString &)
void setDocName(const QString &)
void moveDiagramDownx10(DiagramView *)
void diagramAdded(DiagramView *)
void tabChanged(int)
ProjectView::tabChanged Manage the tab change. If tab_id == -1 (there is no diagram opened)...
void moveDiagramDown(DiagramView *)