2009-04-03 19:30:25 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 The QElectroTech Team
|
2009-04-03 19:30:25 +00:00
|
|
|
This file is part of QElectroTech.
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef PROJECT_VIEW_H
|
|
|
|
#define PROJECT_VIEW_H
|
2016-06-30 09:12:25 +00:00
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
2012-01-25 07:29:50 +00:00
|
|
|
#include "templatelocation.h"
|
2012-07-13 07:21:19 +00:00
|
|
|
#include "qetresult.h"
|
2016-06-30 09:12:25 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
class QETProject;
|
|
|
|
class DiagramView;
|
|
|
|
class Diagram;
|
2009-05-19 19:00:37 +00:00
|
|
|
class ElementsLocation;
|
2015-03-05 13:11:38 +00:00
|
|
|
class QTabWidget;
|
2016-06-30 09:12:25 +00:00
|
|
|
class QLabel;
|
|
|
|
class QVBoxLayout;
|
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class provides a widget displaying the diagrams of a particular
|
|
|
|
project using tabs.
|
2009-04-03 19:30:25 +00:00
|
|
|
*/
|
2017-03-05 12:24:33 +00:00
|
|
|
class ProjectView : public QWidget
|
|
|
|
{
|
2009-04-03 19:30:25 +00:00
|
|
|
Q_OBJECT
|
2017-03-05 12:24:33 +00:00
|
|
|
|
|
|
|
// constructors, destructor
|
2012-07-13 07:21:19 +00:00
|
|
|
public:
|
2017-03-05 12:24:33 +00:00
|
|
|
ProjectView(QETProject *, QWidget * = 0);
|
|
|
|
virtual ~ProjectView();
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
2017-03-05 12:24:33 +00:00
|
|
|
ProjectView(const ProjectView &);
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2017-03-05 12:24:33 +00:00
|
|
|
// methods
|
2009-04-03 19:30:25 +00:00
|
|
|
public:
|
2017-03-05 12:24:33 +00:00
|
|
|
QETProject *project();
|
|
|
|
void setProject(QETProject *);
|
|
|
|
QList<DiagramView *> diagram_views() const;
|
|
|
|
DiagramView *currentDiagram() const;
|
|
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
void changeTabUp();
|
|
|
|
void changeTabDown();
|
|
|
|
void changeFirstTab();
|
|
|
|
void changeLastTab();
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
public slots:
|
2017-02-18 13:30:38 +00:00
|
|
|
void addNewDiagram();
|
|
|
|
void addNewDiagramFolioList();
|
|
|
|
void addDiagram(DiagramView *);
|
|
|
|
void removeDiagram(DiagramView *);
|
|
|
|
void removeDiagram(Diagram *);
|
|
|
|
void showDiagram(DiagramView *);
|
|
|
|
void showDiagram(Diagram *);
|
|
|
|
void editProjectProperties();
|
|
|
|
void editCurrentDiagramProperties();
|
|
|
|
void editDiagramProperties(DiagramView *);
|
|
|
|
void editDiagramProperties(Diagram *);
|
|
|
|
void moveDiagramUp(DiagramView *);
|
|
|
|
void moveDiagramUp(Diagram *);
|
|
|
|
void moveDiagramDown(DiagramView *);
|
|
|
|
void moveDiagramDown(Diagram *);
|
|
|
|
void moveDiagramUpTop(DiagramView *);
|
|
|
|
void moveDiagramUpTop(Diagram *);
|
|
|
|
void moveDiagramUpx10(DiagramView *);
|
|
|
|
void moveDiagramUpx10(Diagram *);
|
|
|
|
void moveDiagramDownx10(DiagramView *);
|
|
|
|
void moveDiagramDownx10(Diagram *);
|
|
|
|
void printProject();
|
|
|
|
void exportProject();
|
|
|
|
QETResult save();
|
2017-03-05 12:24:33 +00:00
|
|
|
QETResult saveAs();
|
|
|
|
QETResult doSave();
|
2017-02-18 13:30:38 +00:00
|
|
|
int cleanProject();
|
|
|
|
void updateWindowTitle();
|
|
|
|
void updateTabTitle(DiagramView *);
|
|
|
|
void updateAllTabsTitle();
|
|
|
|
void tabMoved(int, int);
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
signals:
|
2017-02-18 13:30:38 +00:00
|
|
|
void diagramAdded(DiagramView *);
|
|
|
|
void diagramRemoved(DiagramView *);
|
|
|
|
void diagramActivated(DiagramView *);
|
|
|
|
void projectClosed(ProjectView *);
|
|
|
|
void errorEncountered(const QString &);
|
|
|
|
// relayed signals
|
|
|
|
void findElementRequired(const ElementsLocation &);
|
|
|
|
void editElementRequired(const ElementsLocation &);
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
2017-03-05 12:24:33 +00:00
|
|
|
void initActions();
|
|
|
|
void initWidgets();
|
|
|
|
void initLayout();
|
|
|
|
void loadDiagrams();
|
|
|
|
DiagramView *findDiagram(Diagram *);
|
|
|
|
DiagramView *nextDiagram();
|
|
|
|
DiagramView *previousDiagram();
|
|
|
|
DiagramView *firstDiagram();
|
|
|
|
DiagramView *lastDiagram();
|
|
|
|
void rebuildDiagramsMap();
|
|
|
|
bool tryClosing();
|
|
|
|
bool tryClosingElementEditors();
|
|
|
|
int tryClosingDiagrams();
|
|
|
|
QString askUserForFilePath(bool = true);
|
|
|
|
QETResult noProjectResult() const;
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
private slots:
|
2017-03-05 12:24:33 +00:00
|
|
|
void tabChanged(int);
|
|
|
|
void tabDoubleClicked(int);
|
|
|
|
void setDisplayFallbackWidget(bool);
|
|
|
|
void adjustReadOnlyState();
|
2016-05-13 15:00:22 +00:00
|
|
|
|
2017-03-05 12:24:33 +00:00
|
|
|
// attributes
|
2009-04-03 19:30:25 +00:00
|
|
|
private:
|
2017-03-05 12:24:33 +00:00
|
|
|
QAction *add_new_diagram_;
|
|
|
|
QETProject *m_project;
|
|
|
|
QVBoxLayout *layout_;
|
|
|
|
QWidget *fallback_widget_;
|
|
|
|
QLabel *fallback_label_;
|
|
|
|
QTabWidget *m_tab;
|
|
|
|
QMap<int, DiagramView *> m_diagram_ids;
|
2017-07-26 08:55:32 +00:00
|
|
|
int m_previous_tab_index = -1;
|
2017-03-05 12:24:33 +00:00
|
|
|
QList<DiagramView *> m_diagram_view_list;
|
2009-04-03 19:30:25 +00:00
|
|
|
};
|
2017-03-05 12:24:33 +00:00
|
|
|
|
2009-04-03 19:30:25 +00:00
|
|
|
#endif
|