Skip to content

Commit 7ce30af

Browse files
authored
Fix/module pins gui (#622)
* Renamed files and classes to get a consistent naming scheme * Bugfix: enable UNDO on delete pin group * Move ActionPingroup helper routines into class * Preserve order of pins when restoring deleted pin group * Fixed internal bookkeeping of group start index allowing negative numbers * Rename misleading function- and class names * Assign pin to new group -> Update indexes in source group as well * Changelog updated * Bugfix: make sure group exists when updating pin index
1 parent 58952c8 commit 7ce30af

22 files changed

Lines changed: 204 additions & 211 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ All notable changes to this project will be documented in this file.
1616

1717
* pin groups
1818
* added getter for lowest and highest index of pin group
19-
* added column for pin index in pin tree shown in selection details
20-
* added context menu entry to toggle between ascending and descending
21-
* changed drag&drop behavior, allowing to drop pin on pin when ordering
19+
* added column for pin index in GUI module pin tree
20+
* added GUI module pin tree context menu entry to toggle between ascending and descending
21+
* fixed GUI undo function for group delete
22+
* changed GUI module pin tree drag'n drop behavior, allow drop pin(-group) on pin
2223

2324
* fixed availability of "save as" so that does not required modifications to be enabaled
2425
* added feature to unzip and open hal project by dropping zipped file on welcome screen

plugins/gui/include/gui/basic_tree_model/base_tree_item.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ namespace hal
8787
* @param index - The column to set the new data.
8888
* @param data - The new column data.
8989
*/
90-
virtual void setDataAtIndex(int index, QVariant& data) = 0;
90+
virtual void setDataAtColumn(int column, QVariant& data) = 0;
9191

9292
/**
9393
* Appends a new column to the item.
@@ -227,7 +227,7 @@ namespace hal
227227
* @param index - The column to set the new data.
228228
* @param data - The new column data.
229229
*/
230-
void setDataAtIndex(int index, QVariant& data) override;
230+
void setDataAtColumn(int column, QVariant& data) override;
231231

232232
/**
233233
* Appends a new column to the item.

plugins/gui/include/gui/context_manager_widget/models/context_tree_model.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ namespace hal
7171
ContextTreeItem(ContextDirectory* directory);
7272
QVariant getData(int column) const override;
7373
void setData(QList<QVariant> data) override;
74-
void setDataAtIndex(int index, QVariant& data) override;
74+
void setDataAtColumn(int column, QVariant& data) override;
7575
void appendData(QVariant data) override;
7676
int getColumnCount() const override;
7777
int row() const;

plugins/gui/include/gui/gatelibrary_management/gatelibrary_tab_widgets/gatelibrary_tab_pin.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#pragma once
2727

2828
#include "gatelibrary_tab_interface.h"
29-
#include "gui/selection_details_widget/gate_details_widget/pin_tree_model.h"
30-
#include "hal_core/defines.h"
3129
#include "hal_core/netlist/gate_library/gate_type.h"
3230

3331
#include <QGridLayout>

plugins/gui/include/gui/module_model/module_item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ namespace hal
6666
* @param index - The column to set the new data. Either 0 (name) or 2(type). Other columns will be ignored.
6767
* @param data - The new column data.
6868
*/
69-
void setDataAtIndex(int index, QVariant& data) override;
69+
void setDataAtColumn(int column, QVariant& data) override;
7070
/**
7171
* Unused dummy function overwritten from parent class.
7272
*/

plugins/gui/include/gui/pin_model/pin_item.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace hal
5050
enum class TreeItemType {PinGroup, Pin, GroupCreator, PinCreator, InvalidPinGroup, InvalidPin};
5151

5252
void setData(QList<QVariant> data) override;
53-
void setDataAtIndex(int index, QVariant& data) override;
53+
void setDataAtColumn(int column, QVariant& data) override;
5454
void appendData(QVariant data) override;
5555
int getColumnCount() const override;
5656

plugins/gui/include/gui/selection_details_widget/gate_details_widget/gate_pin_tree.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace hal
3333
{
3434
class GatePinsTreeModel;
3535
class Gate;
36-
class PinTreeItem;
36+
class GatePinsTreeItem;
3737
class GraphNavigationWidget;
3838

3939
/**
@@ -98,8 +98,8 @@ namespace hal
9898
bool mClearSelection;
9999

100100
//helper functions
101-
void buildPythonMenuForPin(QMenu &menu, PinTreeItem* clickedPinItem);
102-
void buildPythonMenuForPinGroup(QMenu &menu, PinTreeItem* clickedPinIGrouptem);
101+
void buildPythonMenuForPin(QMenu &menu, GatePinsTreeItem* clickedPinItem);
102+
void buildPythonMenuForPinGroup(QMenu &menu, GatePinsTreeItem* clickedPinIGrouptem);
103103
void addSourceOurDestinationToSelection(int netId, bool isInputPin);
104104
void handleNavigationCloseRequested();
105105
void handleNavigationJumpRequested(const Node& origin, const u32 via_net, const QSet<u32>& to_gates, const QSet<u32>& to_modules);

plugins/gui/include/gui/selection_details_widget/gate_details_widget/pin_tree_model.h renamed to plugins/gui/include/gui/selection_details_widget/gate_details_widget/gate_pins_tree_model.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace hal
3636

3737
class Gate;
3838

39-
class PinTreeItem : public BaseTreeItem
39+
class GatePinsTreeItem : public BaseTreeItem
4040
{
4141
public:
4242
enum Type {None, Pin, Group};
@@ -51,11 +51,11 @@ namespace hal
5151
int mIndex;
5252
public:
5353

54-
PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
55-
PinTreeItem();
54+
GatePinsTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
55+
GatePinsTreeItem();
5656
QVariant getData(int column) const override;
5757
void setData(QList<QVariant> data) override;
58-
void setDataAtIndex(int index, QVariant& data) override;
58+
void setDataAtColumn(int column, QVariant& data) override;
5959
void appendData(QVariant data) override;
6060
int getColumnCount() const override;
6161
void setType(Type tp) { mType = tp; }

plugins/gui/include/gui/selection_details_widget/module_details_widget/module_ports_tree.h renamed to plugins/gui/include/gui/selection_details_widget/module_details_widget/module_pins_tree.h

File renamed without changes.

plugins/gui/include/gui/selection_details_widget/module_details_widget/port_tree_model.h renamed to plugins/gui/include/gui/selection_details_widget/module_details_widget/module_pins_tree_model.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace hal
3838
class Net;
3939

4040

41-
class PortTreeItem : public BaseTreeItem
41+
class ModulePinsTreeItem : public BaseTreeItem
4242
{
4343
public:
4444
enum Type {None, Pin, Group};
@@ -54,11 +54,11 @@ namespace hal
5454

5555
public:
5656

57-
PortTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName = QString());
58-
PortTreeItem() : mItemType(None), mId(0) {;}
57+
ModulePinsTreeItem(Type itype, u32 id_, QString pinName, PinDirection dir, PinType ptype, int inx, QString netName = QString());
58+
ModulePinsTreeItem() : mItemType(None), mId(0) {;}
5959
QVariant getData(int column) const override;
6060
void setData(QList<QVariant> data) override;
61-
void setDataAtIndex(int index, QVariant& data) override;
61+
void setDataAtColumn(int column, QVariant& data) override;
6262
void appendData(QVariant data) override;
6363
int getColumnCount() const override;
6464
void setItemType(Type tp) { mItemType = tp; }
@@ -127,7 +127,7 @@ namespace hal
127127
* @param item - The (port) item.
128128
* @return The net or nullptr.
129129
*/
130-
Net* getNetFromItem(PortTreeItem* item);
130+
Net* getNetFromItem(ModulePinsTreeItem* item);
131131

132132
/**
133133
* Get the id of the module that is currently represented.
@@ -162,18 +162,18 @@ namespace hal
162162
Module* mModule;
163163
//name is (hopefully) enough to identify
164164
QMap<QString, BaseTreeItem*> mNameToTreeItem;
165-
QMap<int, PortTreeItem*> mIdToPinItem;
166-
QMap<int, PortTreeItem*> mIdToGroupItem;
165+
QMap<int, ModulePinsTreeItem*> mIdToPinItem;
166+
QMap<int, ModulePinsTreeItem*> mIdToGroupItem;
167167

168-
void insertItem(PortTreeItem* item, BaseTreeItem* parent, int index);
169-
void removeItem(PortTreeItem* item);
170-
void updateGroupIndex(PortTreeItem* groupItem);
168+
void insertItem(ModulePinsTreeItem* item, BaseTreeItem* parent, int index);
169+
void removeItem(ModulePinsTreeItem* item);
170+
void updateGroupIndex(ModulePinsTreeItem* groupItem);
171171

172172
// helper functions for dnd for more clarity
173173
void dndGroupOnGroup(BaseTreeItem* droppedGroup, BaseTreeItem* onDroppedGroup, int row=-1);
174-
void dndGroupBetweenGroup(PortTreeItem* droppedGroup, int row);
175-
void dndPinOnGroup(PortTreeItem* droppedPin, BaseTreeItem* onDroppedGroup);
176-
void dndPinBetweenPin(PortTreeItem* droppedPin, BaseTreeItem* onDroppedParent, int row);
177-
void dndPinBetweenGroup(PortTreeItem* droppedPin, int row);
174+
void dndGroupBetweenGroup(ModulePinsTreeItem* droppedGroup, int row);
175+
void dndPinOnGroup(ModulePinsTreeItem* droppedPin, BaseTreeItem* onDroppedGroup);
176+
void dndPinBetweenPin(ModulePinsTreeItem* droppedPin, BaseTreeItem* onDroppedParent, int row);
177+
void dndPinBetweenGroup(ModulePinsTreeItem* droppedPin, int row);
178178
};
179179
}

0 commit comments

Comments
 (0)