2014-03-12 09:32:56 +00:00
|
|
|
/*
|
2017-01-20 10:55:49 +00:00
|
|
|
Copyright 2006-2017 The QElectroTech Team
|
2014-03-12 09:32:56 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef LINKSINGLEELEMENTWIDGET_H
|
|
|
|
#define LINKSINGLEELEMENTWIDGET_H
|
|
|
|
|
2014-07-21 20:44:32 +00:00
|
|
|
#include "element.h"
|
2015-05-25 10:22:00 +00:00
|
|
|
#include "abstractelementpropertieseditorwidget.h"
|
|
|
|
|
2014-03-12 09:32:56 +00:00
|
|
|
|
|
|
|
class Diagram;
|
2014-07-21 20:44:32 +00:00
|
|
|
class QLineEdit;
|
|
|
|
class ElementSelectorWidget;
|
2014-03-12 09:32:56 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class LinkSingleElementWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The LinkSingleElementWidget class
|
|
|
|
* this class provide a widget to select an element to be linked
|
|
|
|
* to the element given in the constructor.
|
|
|
|
* The element given in constructor must be linked with only one other element (like report or slave element).
|
|
|
|
* This widget detect automaticaly the kind of element given in the constructor and
|
|
|
|
* search all element that can be linked with it.
|
|
|
|
* If the element is already linked, the widget ask user to unlink.
|
|
|
|
* This widget embedded the diagram command for undo/redo the action
|
|
|
|
*/
|
2015-05-25 10:22:00 +00:00
|
|
|
class LinkSingleElementWidget : public AbstractElementPropertiesEditorWidget
|
2014-03-12 09:32:56 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
///Methods
|
|
|
|
public:
|
2015-05-03 17:32:28 +00:00
|
|
|
explicit LinkSingleElementWidget(Element *elmt, QWidget *parent = 0);
|
|
|
|
~LinkSingleElementWidget();
|
|
|
|
|
2015-05-21 20:46:23 +00:00
|
|
|
void setElement (Element *element);
|
2015-05-03 17:32:28 +00:00
|
|
|
void apply();
|
|
|
|
QUndoCommand *associatedUndo() const;
|
|
|
|
QString title() const;
|
2015-05-27 07:22:50 +00:00
|
|
|
|
|
|
|
public slots:
|
2015-05-09 11:35:00 +00:00
|
|
|
void updateUi();
|
2014-03-12 09:32:56 +00:00
|
|
|
|
2015-05-27 07:22:50 +00:00
|
|
|
public:
|
|
|
|
bool setLiveEdit(bool live_edit);
|
|
|
|
|
|
|
|
private :
|
|
|
|
void enableLiveEdit();
|
|
|
|
void disableLiveEdit();
|
2015-05-09 11:35:00 +00:00
|
|
|
void buildList();
|
|
|
|
void buildSearchField();
|
|
|
|
QList <Element *> availableElements();
|
|
|
|
void setUpCompleter();
|
2014-03-12 09:32:56 +00:00
|
|
|
|
|
|
|
private slots:
|
2015-05-21 20:46:23 +00:00
|
|
|
void setNewList();
|
|
|
|
void unlinkClicked();
|
|
|
|
void on_button_this_clicked();
|
|
|
|
void on_button_linked_clicked();
|
|
|
|
void diagramWasRemovedFromProject();
|
2014-03-12 09:32:56 +00:00
|
|
|
|
|
|
|
///Attributes
|
|
|
|
private:
|
|
|
|
Ui::LinkSingleElementWidget *ui;
|
|
|
|
ElementSelectorWidget *esw_;
|
|
|
|
QList <Diagram *> diagram_list;
|
|
|
|
bool unlink_;
|
|
|
|
Element::kind filter_;
|
2014-03-15 20:49:05 +00:00
|
|
|
QLineEdit *search_field;
|
2014-03-12 09:32:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LINKSINGLEELEMENTWIDGET_H
|