Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Organize views as tree #576

Merged
merged 43 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
df4afd1
WIP: migrate ContextTableModel to BaseTreeModel
Nov 26, 2023
58f4315
WIP: Migrate views to basetreemodel; Add directories to views
ailujezi Dec 4, 2023
b2858e3
Make ContextTableModel migrate to a BaseTreeModel
ailujezi Dec 11, 2023
70c6378
fix crash on wrongful click; add naming for directory
ailujezi Dec 17, 2023
cf75caf
WIP: Update currentdirectory in ContextTreeModel
ailujezi Dec 18, 2023
6dfa474
Added 'add directory' icon
joern274 Dec 18, 2023
f6dd219
Make CurrentDirectory be set to the right directory
ailujezi Dec 19, 2023
f042d4c
Item icons added for context manager tree
joern274 Dec 19, 2023
244ba02
Merge branch 'feature/migrate_views_to_basetreemodel' of github.com:e…
joern274 Dec 19, 2023
088fda9
Lost 'add directory' icon on merge - added it again
joern274 Dec 19, 2023
b4ad8ee
WIP: Fix new view placement in ContextTreeModel
ailujezi Dec 20, 2023
d132a56
1.Double-Click bugfix: access item by proxy 2.Renamed classes
joern274 Dec 22, 2023
99201ad
add current directory change on click
ailujezi Jan 4, 2024
0e08c5f
Make new created directory current in view
ailujezi Jan 12, 2024
c7853ef
Change type UserActionObjectType::Context to UserActionObjectType::Co…
ailujezi Jan 17, 2024
ca90c70
Added parent-ID when creating new views or directories via UserAction
joern274 Jan 22, 2024
a5f997d
Add contextDir to action_delete_object; Change creation of directory …
ailujezi Jan 27, 2024
a9e221f
Fix directory naming; Fix chrash on directory deletion and then creat…
ailujezi Feb 2, 2024
b2a6abc
Fix renaming of directory
ailujezi Feb 2, 2024
b5ae89a
WIP: Add directory JSON
ailujezi Feb 5, 2024
d024b5b
Add Directories to json; Add parentId to views in json
ailujezi Feb 19, 2024
72840b8
WIP: Read directories from file
ailujezi Feb 19, 2024
db9f8c9
Fix json restore for directories and views
ailujezi Mar 2, 2024
7af3a7d
Add undo action for directories and views
ailujezi Mar 2, 2024
33d7e8e
Fix context menu texts
ailujezi Mar 3, 2024
6b5ce6f
Store parent-ID in UNDO action when deleting view or dir
joern274 Mar 4, 2024
f61f505
1.Remove parent object from user action 2.Merge master 3.Minor fixes …
joern274 Mar 11, 2024
e05b5c5
Move context tree items by user action (WIP)
joern274 May 3, 2024
ef0c66c
Additional debug info to trace drop row
joern274 May 5, 2024
f38bb17
dropMimeData method moved from model to proxy
joern274 May 8, 2024
0f0e5d1
Debug messages removed
joern274 May 8, 2024
af24cf1
Debug output removed
joern274 May 16, 2024
c478af1
Merge branch 'master' into feature/migrate_views_to_basetreemodel
Skaleee May 28, 2024
2390bd8
Fix MacOS build (remove not-implemented function header)
joern274 May 30, 2024
2e474f9
Merge remote-tracking branch 'origin/master' into feature/migrate_vie…
Skaleee Jun 7, 2024
1194a35
Added experimental python bindings for view-directory management.
Skaleee Jun 8, 2024
82e31f6
Bugfix: Python thread must block thread when executing user actions
joern274 Jun 10, 2024
962781a
1. Moved bindings from gui.Directory to gui.View
Skaleee Jun 12, 2024
ac4c8a6
disallow drop of directory into one of its (grand-)child directories
joern274 Jun 13, 2024
873d674
1. Changed directory IDs to be positive. IDs of new directories do no…
Skaleee Jun 15, 2024
8d034db
Disallow moving view-directory into one of its descendents via Python…
joern274 Jun 16, 2024
4a54267
Changelog updated
joern274 Jun 17, 2024
5c2cdf6
Merge branch 'master' into feature/migrate_views_to_basetreemodel
joern274 Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ All notable changes to this project will be documented in this file.
* added delete module action and shortcut
* added entries for context menu
* adapted appearance for menu content tree, selection details tree, grouping content tree (same model for all)
* refactored view widget
* changed appearance from tabular view to tree view
* added 'directory' elements to organize and manage groups of views
* added drag'n drop feature allowing to relocate views or directories to another branch in the tree
* added column for view ID
* added functions to Python GUI API to create, modify and delete views and directories
* added UNDO functionality for create/delete view and directory actions
* fixed sort-by-column feature. The tree is not sorted at program start thus showing elements in 'natural' order.
* refactored search bar
* changed appearance of search bar to be more intuitive
* added menu for extended options - e.g. option to search in selected columns only
Expand Down Expand Up @@ -65,7 +73,6 @@ All notable changes to this project will be documented in this file.
* added support for Ubuntu 24.04 LTS
* added INIT field declaration to FF-gate-types in example library
* added drag'n drop feature allowing to move several nodes in graph view at same time
* added functions to Python GUI API to create, modify and delete views
* added GUI PluginParameter type `ComboBox` for parameters that can be requested from plugin
* added GUI PluginParameter types `Module` and `Gated` for parameters that can be requested from plugin
* added `Show content` button to `Groupings` widget to show content of grouping as a list
Expand Down
2 changes: 2 additions & 0 deletions plugins/gui/include/gui/basic_tree_model/base_tree_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ namespace hal
*/
BaseTreeItem* getRootItem() const;

void insertChildItem(BaseTreeItem* childItem, BaseTreeItem* parentItem = nullptr, int row = -1);

protected:
RootTreeItem* mRootItem;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include "hal_core/defines.h"

#include "gui/graph_widget/contexts/graph_context.h"
#include "gui/context_manager_widget/models/context_table_model.h"
#include "gui/context_manager_widget/models/context_table_proxy_model.h"
#include "gui/context_manager_widget/models/context_tree_model.h"
#include "gui/context_manager_widget/models/context_proxy_model.h"
#include "gui/searchbar/searchbar.h"
#include "gui/settings/settings_items/settings_item_keybind.h"

Expand All @@ -40,6 +40,8 @@
#include <QTableView>
#include <QPushButton>
#include <QMenu>
#include <QTreeView>



namespace hal
Expand All @@ -60,6 +62,7 @@ namespace hal
Q_OBJECT
Q_PROPERTY(QString disabledIconStyle READ disabledIconStyle WRITE setDisabledIconStyle)
Q_PROPERTY(QString newViewIconPath READ newViewIconPath WRITE setNewViewIconPath)
Q_PROPERTY(QString newDirIconPath READ newDirIconPath WRITE setNewDirIconPath)
Q_PROPERTY(QString newViewIconStyle READ newViewIconStyle WRITE setNewViewIconStyle)
Q_PROPERTY(QString renameIconPath READ renameIconPath WRITE setRenameIconPath)
Q_PROPERTY(QString renameIconStyle READ renameIconStyle WRITE setRenameIconStyle)
Expand All @@ -84,7 +87,7 @@ namespace hal
ContextManagerWidget(GraphTabWidget* tab_view, QWidget* parent = nullptr);

/**
* Selects the given context if possible (if it is indeed in the widget's ContextTableModel).
* Selects the given context if possible (if it is indeed in the widget's ContextTreeModel).
*
* @param context - The context to select.
*/
Expand All @@ -97,11 +100,28 @@ namespace hal
*/
GraphContext* getCurrentContext();

/**
* Get the currently selected directory in the table.
*
* @return The ContextTreeItem.
*/
ContextTreeItem* getCurrentItem();

/**
* Opens the currently selected GraphContext in hal's GraphTabWidget
*/
void handleOpenContextClicked();

/**
* Handle double clicked
*/
void handleItemDoubleClicked(const QModelIndex &proxyIndex);

/**
* Handle clicked
*/
void handleItemClicked(const QModelIndex &proxyIndex);

/**
* Initializes the Toolbar of the ContextManagerWidget.
*
Expand All @@ -119,6 +139,7 @@ namespace hal
///@{
QString disabledIconStyle() const;
QString newViewIconPath() const;
QString newDirIconPath() const;
QString newViewIconStyle() const;
QString renameIconPath() const;
QString renameIconStyle() const;
Expand All @@ -139,6 +160,7 @@ namespace hal
void setDisabledIconStyle(const QString &path);
void setNewViewIconPath(const QString &path);
void setNewViewIconStyle(const QString &style);
void setNewDirIconPath(const QString &path);
void setRenameIconPath(const QString &path);
void setRenameIconStyle(const QString &style);
void setDeleteIconPath(const QString &path);
Expand Down Expand Up @@ -167,30 +189,48 @@ namespace hal
*/
void updateSearchIcon();

/**
* Q_SLOT to select the Directory.
*/
void selectDirectory(ContextTreeItem* item);

void handleRowsInserted(const QModelIndex &parent, int first, int last);

private Q_SLOTS:

void handleDeleteShortcutOnFocusChanged(QWidget* oldWidget, QWidget* newWidget);
void handleFocusChanged(QWidget* oldWidget, QWidget* newWidget);
void handleCreateContextClicked();
void handleCreateDirectoryClicked();
void handleRenameClicked();
void handleDuplicateContextClicked();
void handleDeleteClicked();

void handleContextMenuRequest(const QPoint& point);
void handleSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);

private:
GraphTabWidget* mTabView;

QTableView* mContextTableView;
ContextTableModel* mContextTableModel;
ContextTableProxyModel* mContextTableProxyModel;
QTreeView* mContextTreeView;
ContextTreeModel* mContextTreeModel;
ContextProxyModel* mContextTreeProxyModel;

Searchbar* mSearchbar;

QString mDisabledIconStyle;

QAction* mNewDirectoryAction;

QAction* mNewViewAction;
QString mNewViewIconPath;
QString mNewDirIconPath;
QString mNewViewIconStyle;

QAction* mRenameAction;
QString mRenameIconPath;
QString mRenameIconStyle;


QAction* mDuplicateAction;
QString mDuplicateIconPath;
QString mDuplicateIconStyle;
Expand All @@ -209,14 +249,6 @@ namespace hal

QShortcut* mShortCutDeleteItem;

void handleCreateContextClicked();
void handleRenameContextClicked();
void handleDuplicateContextClicked();
void handleDeleteContextClicked();

void handleContextMenuRequest(const QPoint& point);
void handleSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);

void setToolbarButtonsEnabled(bool enabled);

void toggleSearchbar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@

#include <QRegularExpression>
#include <QSortFilterProxyModel>
#include <QMimeData>

namespace hal
{
/**
* @ingroup utility_widgets-context
* @brief A proxy model to filter the ContextTableModel by a given string.
*/
class ContextTableProxyModel : public SearchProxyModel
class ContextProxyModel : public SearchProxyModel
{
Q_OBJECT

Expand All @@ -47,7 +48,7 @@ namespace hal
*
* @param parent - The widget's parent.
*/
ContextTableProxyModel(QObject* parent = nullptr);
ContextProxyModel(QObject* parent = nullptr);

/**
* Determines if the index specified by the row and its parent should be displayed
Expand All @@ -60,6 +61,11 @@ namespace hal
*/
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;

QStringList mimeTypes() const override;
QMimeData* mimeData(const QModelIndexList &indexes) const override;
bool dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) override;
bool canDropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) const override;

public Q_SLOTS:

/**
Expand All @@ -74,13 +80,13 @@ namespace hal
protected:

/**
* Defines the compare criteria of 2 data entries (might be defined for each column specifically).
* Defines the compare criteria of tree entries (might be defined for each column specifically).
*
* @param left - The first entry.
* @param right - The seconds entry.
* @return True if left < right, False otherwise.
*/
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;
bool lessThan(const QModelIndex& left, const QModelIndex& right) const override;

};
} // namespace hal

This file was deleted.

Loading
Loading