NDEVR
API Documentation
DesignObjectGallery.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: DesignObjectGallery
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTModelManager.h>
34#include <NDEVR/LibraryManager.h>
35#include <NDEVR/ButtonGallery.h>
36#include <NDEVR/Button.h>
37#include <QWidget>
38namespace NDEVR
39{
40 class Ribbon;
46 {
47 Q_OBJECT
48 public:
58
62 DesignObjectGallery(QWidget* parent = nullptr);
67 void clear() override;
72 void clear(bool keep_selection);
77 const Buffer<UUID>& ids() const;
83 void setButtonVisible(const UUID& id, bool visible);
87 void sortByName();
93 void setObjects(const Buffer<UUID>& objects, bool keep_selected);
99 void setSelected(const Buffer<UUID>& id, bool scroll_to_selected = false);
108 void fillWithMaterials(bool keep_selected);
113 void setIsMaterialGallery(bool is_material);
119 void fillWithMaterials(Model model, bool keep_selected);
124 void fillWithModels(bool keep_selected);
129 const Buffer<UUID> currentSelection() const { return m_current_selection.values(); }
134 void setSelectionMode(SelectionMode selection_mode);
150 protected slots:
156 protected:
167 void updateFromManager(const UUID& id);
172 void updateFromLibrary(const UUID& id);
177 void resizeEvent(QResizeEvent* resize_event) override;
182 const QTModelManager* manager() { return m_manager; }
183 signals:
199 protected:
211 };
212
213}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
ButtonGallery(QWidget *parent=nullptr)
Constructs a ButtonGallery with an optional parent widget.
void resizeEvent(QResizeEvent *resize_event) override
Handles resize events to reflow gallery layout.
const QTModelManager * manager()
Returns the current model manager.
void setButtonVisible(const UUID &id, bool visible)
Sets the visibility of a specific gallery button by its UUID.
SelectionMode m_selection_mode
The current selection mode.
DesignObjectGallery(QWidget *parent=nullptr)
Constructs a DesignObjectGallery.
void saveRequestedSignal(Buffer< UUID > ids)
Emitted when the user requests that the selected objects be saved.
SelectionMode selectionMode() const
Returns the current selection mode.
void clear() override
Clears all gallery items and resets the selection.
bool m_is_material_gallery
Whether this gallery displays materials.
void setLibrary(LibraryManager *manager)
Sets the library manager used for library-based galleries.
void setManager(QTModelManager *manager)
Sets the model manager used to look up design objects.
void onSelectedSignal(Buffer< UUID > ids)
Emitted when the selection changes for any reason.
Dictionary< UUID, DynamicPointer< CaptureRequest > > m_active_requests
Active thumbnail capture requests.
void setObjects(const Buffer< UUID > &objects, bool keep_selected)
Populates the gallery with the given set of objects.
void setSelectionMode(SelectionMode selection_mode)
Sets the selection mode for the gallery.
void onUserSelectedSignal(Buffer< UUID > ids)
Emitted when the user explicitly changes the selection via interaction.
TranslatedString getObjectName(const UUID &id) const
Retrieves the display name for a given object UUID.
void fillWithModels(bool keep_selected)
Populates the gallery with all available models.
void sortByName()
Sorts the gallery items alphabetically by name.
const Buffer< UUID > currentSelection() const
Returns the currently selected UUIDs.
void setIsMaterialGallery(bool is_material)
Sets whether this gallery is being used as a material gallery.
void updateFromLibrary(const UUID &id)
Updates a gallery entry from the library manager.
void updateObjectsSlot(Buffer< UUID > ids)
Slot called to update gallery buttons when objects change.
void fillWithMaterials(bool keep_selected)
Populates the gallery with all available materials.
Buffer< UUID > m_objects
The ordered list of object UUIDs in the gallery.
const Buffer< UUID > & ids() const
Returns the ordered list of object UUIDs currently in the gallery.
void setSelected(const Buffer< UUID > &id, bool scroll_to_selected=false)
Sets the selected items in the gallery.
Set< UUID > m_current_selection
The set of currently selected object UUIDs.
SelectionMode
Defines how user selection behaves in the gallery.
@ e_multi_selection
Allows multiple simultaneous selections.
@ e_no_selection
User can click on an item but it does not become selected.
@ e_single_selection
User can select a single object at a time.
LibraryManager * m_library_manager
The library manager for library-based galleries.
Dictionary< UUID, TranslatedString > m_object_names
Cached display names for objects.
void updateFromManager(const UUID &id)
Updates a gallery entry from the model manager.
void scrollToSelected()
Scrolls the gallery view to make the currently selected item visible.
UUID m_capture_id
The UUID used for thumbnail capture requests.
void clear(bool keep_selection)
Clears all gallery items, optionally preserving the current selection.
Ribbon * m_browser_ribbon
The ribbon widget used for browsing categories.
Dictionary< UUID, Button * > m_buttons
Maps each object UUID to its gallery button.
void fillWithMaterials(Model model, bool keep_selected)
Populates the gallery with materials from a specific model.
QTModelManager * m_manager
The model manager providing design objects.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
Manages loading Models from a group that is stored either on a remote server or locally on the disk i...
A core class that represents a node on model hierarchy.
Definition Model.h:292
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
The UI ribbon is a horizontal menu bar typically located at the top of the application interface or a...
Definition Ribbon.h:56
Container that stores unique elements in no particular order, and which allow for fast retrieval or i...
Definition Set.h:59
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
The primary namespace for the NDEVR SDK.