Skip to content

Commit

Permalink
Merging feature/assignation into feature/api
Browse files Browse the repository at this point in the history
  • Loading branch information
theod committed Sep 1, 2014
2 parents aa0b102 + 9573e0d commit 2746af9
Show file tree
Hide file tree
Showing 10 changed files with 653 additions and 296 deletions.
7 changes: 6 additions & 1 deletion headers/GUI/AttributesEditor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class AttributesEditor : public QDockWidget

public slots:
void addToExpandedItemsList(QTreeWidgetItem *item);
void addToSelectedItemsList(QList<QTreeWidgetItem *> selectedItems);
void removeFromExpandedItemsList(QTreeWidgetItem *item);

/*!
Expand All @@ -133,11 +134,13 @@ class AttributesEditor : public QDockWidget
* \brief Assigns the snapshot to the start of the box.
*/
void snapshotStartAssignment();
void snapshotStartAssignment(QList<QTreeWidgetItem *> itemsList);

/*!
* \brief Assigns the snapshot to the end of the box.
*/
void snapshotEndAssignment();
void snapshotEndAssignment(QList<QTreeWidgetItem *> itemsList);

void changeRangeBoundMin(QTreeWidgetItem* item, float value);
void changeRangeBoundMax(QTreeWidgetItem* item, float value);
Expand Down Expand Up @@ -217,7 +220,7 @@ class AttributesEditor : public QDockWidget
QWidget * _centralWidget; //!< Central widget.
QGridLayout * _centralLayout; //!< Central layout

QHBoxLayout *_boxSettingsLayout; //!< Layout handling box settings (name, color, assignation...).
QGridLayout *_boxSettingsLayout; //!< Layout handling box settings (name, color, assignation...).
NetworkTree *_networkTree; //!< NetworkTree (inspector).

/// \todo Old TODO updated (by jC)
Expand All @@ -226,6 +229,8 @@ class AttributesEditor : public QDockWidget

// boxEditLayout items
QLineEdit * _boxName; //!< Color button.
QLabel * _updateLabel; //!< Color button.

QPixmap *_colorButtonPixmap; //!< Color button.
QPushButton *_generalColorButton; //!< Color button.
QPushButton *_snapshotAssignStart; //!< Start assignation button.
Expand Down
2 changes: 2 additions & 0 deletions headers/GUI/BasicBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,8 @@ class BasicBox : public QObject, public QGraphicsItem
*/
void addToExpandedItemsList(QTreeWidgetItem* item);

void setSelectedTreeItems(QList<QTreeWidgetItem *> selectedItems);

/*!
* \brief Send the items to be removed from the networkTreeExpandedItems.
*
Expand Down
28 changes: 23 additions & 5 deletions headers/GUI/NetworkTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,11 @@ class NetworkTree : public QTreeWidget
* General tools
***********************************************************************/

/*!
* \brief Gets all assigned items.
*/
QPair< QMap <QTreeWidgetItem *, Data>, QList<QString> > treeSnapshot(unsigned int boxID);
QPair< QMap <QTreeWidgetItem *, Data>, QList<QString> > treeSnapshot(unsigned int boxID, QList<QTreeWidgetItem *> itemsList);

/*!
* \brief Gets the absolute address of an item in the snapshot tree.
Expand Down Expand Up @@ -384,10 +388,13 @@ class NetworkTree : public QTreeWidget
virtual void keyReleaseEvent(QKeyEvent *event);
virtual void mouseDoubleClickEvent(QMouseEvent *event);
virtual void mousePressEvent(QMouseEvent *event);
virtual void mouseReleaseEvent(QMouseEvent *event);

static int NAME_COLUMN;
static int VALUE_COLUMN;
static int START_ASSIGNATION_COLUMN;
static int START_COLUMN;
static int END_ASSIGNATION_COLUMN;
static int END_COLUMN;
static int INTERPOLATION_COLUMN;
static int REDUNDANCY_COLUMN;
Expand Down Expand Up @@ -428,6 +435,9 @@ class NetworkTree : public QTreeWidget
void rangeBoundMinChanged(QTreeWidgetItem *item, float newValue);
void rangeBoundMaxChanged(QTreeWidgetItem *item, float newValue);
void recModeChanged(QTreeWidgetItem *item);
void requestSnapshotStart(QList<QTreeWidgetItem *> itemsList);
void requestSnapshotEnd(QList<QTreeWidgetItem *> itemsLists);
void selectionChanged(QList<QTreeWidgetItem *> selectedItems);

private:
void treeRecursiveExploration(QTreeWidgetItem *curItem, bool conflict);
Expand Down Expand Up @@ -487,7 +497,7 @@ class NetworkTree : public QTreeWidget
_nodesWithSomeChildrenAssigned.removeAll(item);
}
}
void assignPartially(QTreeWidgetItem *item);
void setPartiallyAssign(QTreeWidgetItem *item);
void unassignPartially(QTreeWidgetItem *item);
void unassignItem(QTreeWidgetItem *item, bool recursive=true);
void setUnassignedStyle(QTreeWidgetItem *item);
Expand All @@ -506,14 +516,18 @@ class NetworkTree : public QTreeWidget
_nodesWithAllChildrenAssigned.removeAll(item);
}
}
void assignTotally(QTreeWidgetItem *item);

void setTotallyAssignedStyle(QTreeWidgetItem *item);
void unassignTotally(QTreeWidgetItem *item);
void assignItem(QTreeWidgetItem *item, Data data);
void updateOSCAddresses();
void getChildren(QTreeWidgetItem *item, QList<QTreeWidgetItem *> &items);
void execClickAction(QTreeWidgetItem *curItem, QList<QTreeWidgetItem *> items, int column);
void unselectAll();

QMap<QTreeWidgetItem *, string> _addressMap;
QList<QTreeWidgetItem*> _nodesWithSelectedChildren;
QMap<QTreeWidgetItem *, Data> _assignedItems;
QMap<QTreeWidgetItem *, Data> _assignedItems;
QList<QTreeWidgetItem*> _nodesWithSomeChildrenAssigned;
QList<QTreeWidgetItem*> _nodesWithAllChildrenAssigned;

Expand All @@ -524,10 +538,12 @@ class NetworkTree : public QTreeWidget
QList<QTreeWidgetItem *> _recMessages;
QMap<QTreeWidgetItem *, QString> _OSCMessages;
QTreeWidgetItem *_addADeviceItem;
QList<QTreeWidgetItem*> _expandedItems;

int _OSCMessageCount;
bool _treeFilterActive;
bool _recMode;
bool _noItemClicked;

DeviceEdit *_deviceEdit;

Expand All @@ -536,13 +552,13 @@ class NetworkTree : public QTreeWidget
* \brief Rebuild the networkTree under the item (or currentItem by default), after asking the engine to refresh its namespace.
* \param The application we want to refresh.
*/
void refreshItemNamespace(QTreeWidgetItem *item);
void refreshItemNamespace(QTreeWidgetItem *item, bool updateBoxes = true);
void refreshCurrentItemNamespace();
void deleteCurrentItemNamespace();
void itemCollapsed();
void clickInNetworkTree(QTreeWidgetItem *item, int column);
void valueChanged(QTreeWidgetItem* item, int column);
void changeStartValue(QTreeWidgetItem* item, QString newValue);
void changeStartValue(QTreeWidgetItem* item, QString newValue);
void changeEndValue(QTreeWidgetItem* item, QString newValue);
void changeNameValue(QTreeWidgetItem* item, QString newValue);
void updateDeviceName(QString oldName, QString newName);
Expand All @@ -551,6 +567,8 @@ class NetworkTree : public QTreeWidget
void updateDeviceNamespace(QString deviceName);
void setRecMode(std::string address);
void setRecMode(QList<std::string> items);
void addToExpandedItems(QTreeWidgetItem *item);
void removeFromExpandedItems(QTreeWidgetItem *item);

virtual void clear();
};
Expand Down
36 changes: 27 additions & 9 deletions headers/data/AbstractBox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ class AbstractBox : public Abstract
inline void
setNetworkTreeExpandedItems(QList<QTreeWidgetItem*> &items)
{
_justCreated = false;
_networkTreeExpandedItems.clear();
_networkTreeExpandedItems = items;
}
Expand All @@ -263,18 +264,32 @@ class AbstractBox : public Abstract
inline void
addToNetworkTreeExpandedItems(QTreeWidgetItem *item)
{
_justCreated = false;
if (!_networkTreeExpandedItems.contains(item)) {
_networkTreeExpandedItems << item;
}
}

inline void
setNetworkTreeSelectedItems(QList<QTreeWidgetItem *> selectedItems)
{
_networkTreeSelectedItems = selectedItems;
}

inline QList<QTreeWidgetItem *>
getNetworkTreeSelectedItems()
{
return _networkTreeSelectedItems;
}

/*!
* \brief Remove the expanded items from the list.
* \param item : the item to remove.
*/
inline void
removeFromNetworkTreeExpandedItems(QTreeWidgetItem *item)
{
_justCreated = false;
_networkTreeExpandedItems.removeAt(_networkTreeExpandedItems.indexOf(item));
}
inline void
Expand All @@ -299,19 +314,22 @@ class AbstractBox : public Abstract
void addMessageToRecord(std::string address);
void removeMessageToRecord(std::string address);
inline QList<std::string> messagesToRecord() const {return _messagesToRecord;}
inline bool justCreated(){return _justCreated;}

protected:
QPointF _topLeft; //!< The local coordinates of the upper left corner.
float _width; //!< The width of the box.
float _height; //!< The height of the box.
std::string _name; //!< The name of the box.
QColor _color; //!< The color of the box.
unsigned int _ID; //!< The ID of the box.
unsigned int _motherID; //!< The possible mother's ID
NetworkMessages *_startMessages; //!< pairs QTreeWidgetItem-Message
NetworkMessages *_endMessages; //!< pairs QTreeWidgetItem-Message
QPointF _topLeft; //!< The local coordinates of the upper left corner.
float _width; //!< The width of the box.
float _height; //!< The height of the box.
std::string _name; //!< The name of the box.
QColor _color; //!< The color of the box.
unsigned int _ID; //!< The ID of the box.
unsigned int _motherID; //!< The possible mother's ID
NetworkMessages *_startMessages; //!< pairs QTreeWidgetItem-Message
NetworkMessages *_endMessages; //!< pairs QTreeWidgetItem-Message
QMap<QTreeWidgetItem *, Data> _networkTreeItems;
QList<QTreeWidgetItem *> _networkTreeExpandedItems;
QList<QTreeWidgetItem *> _networkTreeSelectedItems;
QList<std::string> _messagesToRecord;
bool _justCreated; //!< Used just for expanded items. Special case if the box is just created. We set the tree current state.
};
#endif
1 change: 1 addition & 0 deletions headers/data/Maquette.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ class Maquette : public QObject
bool setDevicePort(std::string device, int destinationPort, int receptionPort = 0);
bool setDeviceLocalHost(std::string device, std::string localHost);
bool setDeviceProtocol(std::string device, std::string protocol);
bool setDeviceLearn(std::string deviceName, bool newLearn);

bool loadNetworkNamespace(const string &application, const string &filepath);
int appendToNetWorkNamespace(const std::string & address, const std::string & service = "parameter", const std::string & type = "generic", const std::string & priority = "0", const std::string & description = "", const std::string & range = "0. 1.", const std::string & clipmode = "none", const std::string & tags = "");
Expand Down
Loading

0 comments on commit 2746af9

Please sign in to comment.