[qet] [4517] Remove unused methods in generic panel and elements panel. |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 4517
Author: blacksun
Date: 2016-05-24 22:06:04 +0200 (Tue, 24 May 2016)
Log Message:
-----------
Remove unused methods in generic panel and elements panel.
Remove the class tree color animation
Modified Paths:
--------------
trunk/sources/elementspanel.cpp
trunk/sources/elementspanel.h
trunk/sources/genericpanel.cpp
trunk/sources/genericpanel.h
trunk/sources/qetproject.h
Removed Paths:
-------------
trunk/sources/treecoloranimation.cpp
trunk/sources/treecoloranimation.h
Modified: trunk/sources/elementspanel.cpp
===================================================================
--- trunk/sources/elementspanel.cpp 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/elementspanel.cpp 2016-05-24 20:06:04 UTC (rev 4517)
@@ -26,7 +26,6 @@
#include "fileelementdefinition.h"
#include "qeticons.h"
#include "templatescollection.h"
-#include "treecoloranimation.h"
#include "element.h"
/*
@@ -348,34 +347,6 @@
}
/**
- Inform this panel the project \a project has integrated the element at \a location
-*/
-QList<ElementsLocation> ElementsPanel::elementIntegrated(QETProject *project, const ElementsLocation &location) {
- // the base implementation simply refreshes the adequate category and returns the list of added locations
- QList<ElementsLocation> added_locations = GenericPanel::elementIntegrated(project, location);
- if (!added_locations.count() || !mustHighlightIntegratedElements()) {
- return(added_locations);
- }
-
- // the additional job of this method consists in displaying the integrated elements...
- if (QTreeWidgetItem *integrated_element_qtwi = itemForElementsLocation(location)) {
- ensureHierarchyIsVisible(QList<QTreeWidgetItem *>() << integrated_element_qtwi);
- scrollToItem(integrated_element_qtwi, QAbstractItemView::PositionAtCenter);
- }
-
- // and make them "flash" (not too obviously though) so the user notices they have been integrated.
- QList<QTreeWidgetItem *> items;
- foreach (ElementsLocation loc, added_locations) {
- if (QTreeWidgetItem *added_item = itemForElementsLocation(loc)) {
- items << added_item;
- }
- }
- highlightItems(items, this, SLOT(scrollToSelectedItem()));
-
- return(added_locations);
-}
-
-/**
Methode permettant d'ajouter un projet au panel d'elements.
@param qtwi_parent QTreeWidgetItem parent sous lequel sera insere le projet
@param project Projet a inserer dans le panel d'elements
@@ -549,15 +520,6 @@
}
/**
- @return true if freshly integrated elements should be highlighted, false otherwise.
-*/
-bool ElementsPanel::mustHighlightIntegratedElements() const
-{
- QSettings settings;
- return(settings.value("diagrameditor/highlight-integrated-elements", true).toBool());
-}
-
-/**
* @brief ElementsPanel::reload
* Reload the elements tree
* @param reload_collections true for read all collections since their sources (files, projects ...)
@@ -896,30 +858,3 @@
scrollToItem(selected_items.first(), QAbstractItemView::PositionAtCenter);
}
}
-
-/**
- Scroll to and highlight \a items. Once the animation is finished, the slot
- \a method is called on the object \a receiver.
-*/
-void ElementsPanel::highlightItems(const QList<QTreeWidgetItem *> &items, const QObject *receiver, const char *method) {
- TreeColorAnimation *animation1 = new TreeColorAnimation(items);
- animation1 -> setStartValue(QColor(Qt::white));
- animation1 -> setEndValue(QColor(Qt::yellow));
- animation1 -> setDuration(400);
- animation1 -> setEasingCurve(QEasingCurve::InQuad);
-
- TreeColorAnimation *animation2 = new TreeColorAnimation(items);
- animation2 -> setStartValue(QColor(Qt::yellow));
- animation2 -> setEndValue(QColor(Qt::white));
- animation2 -> setDuration(500);
- animation2 -> setEasingCurve(QEasingCurve::OutInQuint);
-
- QSequentialAnimationGroup *animation = new QSequentialAnimationGroup(this);
- animation -> addAnimation(animation1);
- animation -> addAnimation(new QPauseAnimation(700));
- animation -> addAnimation(animation2);
- if (receiver) {
- connect(animation, SIGNAL(finished()), receiver, method);
- }
- animation -> start(QAbstractAnimation::DeleteWhenStopped);
-}
Modified: trunk/sources/elementspanel.h
===================================================================
--- trunk/sources/elementspanel.h 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/elementspanel.h 2016-05-24 20:06:04 UTC (rev 4517)
@@ -63,7 +63,6 @@
void reloadCollections();
int elementsCollectionItemsCount();
- bool mustHighlightIntegratedElements() const;
signals:
void requestForProject(QETProject *);
@@ -87,7 +86,6 @@
void applyCurrentFilter(const QList<QTreeWidgetItem *> &);
void ensureHierarchyIsVisible(const QList<QTreeWidgetItem *> &);
void scrollToSelectedItem();
- void highlightItems(const QList<QTreeWidgetItem *> &, const QObject * = 0, const char * = 0);
protected:
void dragEnterEvent(QDragEnterEvent *);
@@ -101,7 +99,6 @@
protected slots:
void panelContentChange();
- virtual QList<ElementsLocation> elementIntegrated(QETProject *, const ElementsLocation &);
private:
virtual QTreeWidgetItem *addProject (QETProject *);
Modified: trunk/sources/genericpanel.cpp
===================================================================
--- trunk/sources/genericpanel.cpp 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/genericpanel.cpp 2016-05-24 20:06:04 UTC (rev 4517)
@@ -265,10 +265,6 @@
project, SIGNAL(projectDiagramsOrderChanged(QETProject *, int, int)),
this, SLOT (projectDiagramsOrderChanged(QETProject *, int, int))
);
- connect(
- project, SIGNAL(elementIntegrated(QETProject *, const ElementsLocation &)),
- this, SLOT(elementIntegrated(QETProject *, const ElementsLocation &))
- );
} else {
// remove diagrams unknown to the project (presumably removed)
removeObsoleteItems(project -> diagrams(), project_qtwi, QET::Diagram, false);
@@ -787,45 +783,7 @@
}
/**
- Refresh elements category at \a location.
- @return the refreshed tree item
-*/
-QTreeWidgetItem *GenericPanel::refreshElementsCategory(const ElementsLocation &location) {
- QTreeWidgetItem *item = itemForElementsLocation(location);
- if (!item) return(0);
- if (item -> type() != QET::ElementsCategory && item -> type() != QET::ElementsCollection) return(0);
- QTreeWidgetItem *result = fillElementsCategoryItem(
- item,
- QETApp::collectionItem(location) -> toCategory(),
- PanelOptions(QFlag(item -> data(0, GenericPanel::PanelFlags).toInt())),
- false
- );
- return(result);
-}
-
-/**
- Refresh element at \a location.
- @return the refreshed tree item
-*/
-QTreeWidgetItem *GenericPanel::refreshElement(const ElementsLocation &location) {
- QTreeWidgetItem *item = itemForElementsLocation(location);
- if (!item) return(0);
- if (item -> type() != QET::Element) return(0);
- QTreeWidgetItem *parent = item -> parent();
- if (!parent) return(0);
-
- QTreeWidgetItem *result = updateElementItem(
- item,
- QETApp::collectionItem(location) -> toElement(),
- PanelOptions(QFlag(parent -> data(0, GenericPanel::PanelFlags).toInt())),
- false
- );
- return(result);
-}
-
-/**
-
*/
QTreeWidgetItem *GenericPanel::addElement(ElementDefinition *element, QTreeWidgetItem *parent_item, PanelOptions options) {
if (!element) return(0);
@@ -1007,40 +965,6 @@
}
/**
- Inform this panel the project \a project has integrated the element at \a location
-*/
-QList<ElementsLocation> GenericPanel::elementIntegrated(QETProject *project, const ElementsLocation &location) {
- Q_UNUSED(project)
- QList<ElementsLocation> added_locations;
-
- int i = 0;
- ElementsLocation loc = location;
- // starting from the provided location, goes up into the tree until a displayed location is reached
- while (i < 100 && !(itemForElementsLocation(loc))) {
- added_locations << loc;
- loc = loc.parent();
- ++ i;
- }
- if (added_locations.count()) {
- refreshElementsCategory(loc);
- } else {
- if (refreshElement(location)) {
- added_locations << location;
- }
- }
-
- // Since we have refreshed the panel before the element is actually used by
- // the diagram, it will appear as unused; we force it as used.
- // FIXME a better solution would be to get warned when an element gets used
- // or unused.
- if (QTreeWidgetItem *integrated_element_qtwi = itemForElementsLocation(location)) {
- integrated_element_qtwi -> setToolTip(0, location.toString());
- integrated_element_qtwi -> setBackground(0, QBrush());
- }
- return(added_locations);
-}
-
-/**
Inform this panel the diagram \a diagram has changed its title to \a title.
*/
void GenericPanel::diagramTitleChanged(Diagram *diagram, const QString &title) {
Modified: trunk/sources/genericpanel.h
===================================================================
--- trunk/sources/genericpanel.h 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/genericpanel.h 2016-05-24 20:06:04 UTC (rev 4517)
@@ -144,8 +144,6 @@
virtual QTreeWidgetItem *getItemForElementsCategory(ElementsCategory *, bool * = 0);
virtual QTreeWidgetItem *updateElementsCategoryItem(QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false);
virtual QTreeWidgetItem *fillElementsCategoryItem (QTreeWidgetItem *, ElementsCategory *, PanelOptions = AddAllChild, bool = false);
- virtual QTreeWidgetItem *refreshElementsCategory(const ElementsLocation &);
- virtual QTreeWidgetItem *refreshElement(const ElementsLocation &);
// elements methods
public:
@@ -167,7 +165,6 @@
virtual void diagramAdded(QETProject *, Diagram *);
virtual void diagramRemoved(QETProject *, Diagram *);
virtual void projectDiagramsOrderChanged(QETProject *, int, int);
- virtual QList<ElementsLocation> elementIntegrated(QETProject *, const ElementsLocation &);
virtual void diagramTitleChanged(Diagram *, const QString &);
virtual void templatesCollectionChanged(TitleBlockTemplatesCollection*, const QString &);
virtual void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
Modified: trunk/sources/qetproject.h
===================================================================
--- trunk/sources/qetproject.h 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/qetproject.h 2016-05-24 20:06:04 UTC (rev 4517)
@@ -164,7 +164,6 @@
void diagramRemoved(QETProject *, Diagram *);
void projectModified(QETProject *, bool);
void projectDiagramsOrderChanged(QETProject *, int, int);
- void elementIntegrated(QETProject *, const ElementsLocation &);
void diagramUsedTemplate(TitleBlockTemplatesCollection *, const QString &);
void readOnlyChanged(QETProject *, bool);
void reportPropertiesChanged(QString);
Deleted: trunk/sources/treecoloranimation.cpp
===================================================================
--- trunk/sources/treecoloranimation.cpp 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/treecoloranimation.cpp 2016-05-24 20:06:04 UTC (rev 4517)
@@ -1,52 +0,0 @@
-/*
- Copyright 2006-2016 The QElectroTech Team
- 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/>.
-*/
-#include "treecoloranimation.h"
-
-/**
- Constructor
- @param items List of items whose background color will be animated.
- @param parent Parent QObject
-*/
-TreeColorAnimation::TreeColorAnimation(const QList<QTreeWidgetItem *> &items, QObject *parent) :
- QVariantAnimation(parent),
- items_(items)
-{
-}
-
-/**
- Destructor
-*/
-TreeColorAnimation::~TreeColorAnimation() {
-}
-
-/**
- @return the list of items whose background color will be animated.
-*/
-QList<QTreeWidgetItem *> TreeColorAnimation::items() const {
- return(items_);
-}
-
-/**
- Apply the provided color to animated items.
- @param color Color to be applied on animated items.
-*/
-void TreeColorAnimation::updateCurrentValue(const QVariant &color) {
- foreach (QTreeWidgetItem *item, items_) {
- item -> setBackgroundColor(0, color.value<QColor>());
- }
-}
Deleted: trunk/sources/treecoloranimation.h
===================================================================
--- trunk/sources/treecoloranimation.h 2016-05-24 19:15:47 UTC (rev 4516)
+++ trunk/sources/treecoloranimation.h 2016-05-24 20:06:04 UTC (rev 4517)
@@ -1,43 +0,0 @@
-/*
- Copyright 2006-2016 The QElectroTech Team
- 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 TREE_COLOR_ANIMATION_H
-#define TREE_COLOR_ANIMATION_H
-#include <QtWidgets>
-
-/**
- This class allows animating a background color change for a
- set of QTreeWidgetItem.
-*/
-class TreeColorAnimation : public QVariantAnimation {
- // Constructors, destructor
- public:
- TreeColorAnimation(const QList<QTreeWidgetItem *> &items, QObject * = 0);
- virtual ~TreeColorAnimation();
-
- // methods
- public:
- QList<QTreeWidgetItem *> items() const;
-
- protected:
- void updateCurrentValue(const QVariant &);
-
- // attributes
- private:
- QList<QTreeWidgetItem *> items_; ///< Items this object will animate
-};
-#endif