NDEVR
API Documentation
DesignObjectChooser.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: DesignObjectChooser
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/DesignObjectGallery.h>
34#include <NDEVR/Dictionary.h>
35namespace Ui
36{
37 class DesignObjectChooserUI;
38}
39namespace NDEVR
40{
44 class NDEVR_API DesignObjectChooser : public QWidget
45 {
46 Q_OBJECT
47 public:
52 DesignObjectChooser(QWidget* parent = nullptr);
58 DesignObjectChooser(QTModelManager* manager, QWidget* parent = nullptr);
64 DesignObjectChooser(LibraryManager* manager, QWidget* parent = nullptr);
70 void addCategory(const StringView& name, const Buffer<UUID>& items);
75 void removeCategory(const StringView& name);
85 void showActiveModelsCategory(bool show);
102 bool assignToModel(UUID id, Model& model);
112 void clear();
119 void updateFromArchive(bool show_active_models, bool show_active_materials, bool refresh_archive_files);
124 void updateFromArchive(bool refresh_archive_files);
137 void filter(const String& keyword_search);
147 void setSelected(const Buffer<UUID>& id);
152 void setCategory(const String& category);
157 void addButton(Button* button);
172 QSize sizeHint() const override;
173 protected:
177 void init();
182 void setSaveSelection(bool multiselection);
187 void initContextMenu(Button* button);
193 void showFileMenu(bool is_save, const Buffer<UUID>& ids = Buffer<UUID>());
198 signals:
213 protected slots:
218 protected:
221 bool m_is_library = false;
222 bool m_is_save_selection = false;
230 Ui::DesignObjectChooserUI* ui;
231 };
232}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
A core widget that allows the user to click one of many button types.
Definition Button.h:68
void clear()
Clears all categories and items from the chooser.
void onCategoryChanged()
Slot called when the active category is changed by the user.
bool m_is_material_chooser
Whether this chooser is configured for materials.
QTModelManager * m_manager
The model manager providing scene data.
void addButton(Button *button)
Adds a custom button to the chooser toolbar.
void updateFromArchive(bool show_active_models, bool show_active_materials, bool refresh_archive_files)
Updates the chooser contents from the archive with full control over categories.
void setModelManager(QTModelManager *manager)
Sets the model manager used to populate design objects.
void updateFromArchive(bool refresh_archive_files)
Updates the chooser contents from the archive.
void setLibraryManager(LibraryManager *manager)
Sets the library manager used to populate archived objects.
void filter(const String &keyword_search)
Filters the displayed items by a keyword search string.
void init()
Initializes the UI layout and connects signals.
bool m_is_library
Whether this chooser is sourcing from a library archive.
DesignObjectChooser(QWidget *parent=nullptr)
Constructs a DesignObjectChooser with no manager.
void setCategory(const String &category)
Sets the active category by name.
void showActiveModelsCategory(bool show)
Sets whether the active models category is shown.
bool m_is_model_chooser
Whether this chooser is configured for models.
Buffer< String > m_category_list
Ordered list of category names.
void exportImages()
Exports images of the selected design objects.
Dictionary< String, Buffer< UUID > > m_keywords
Keyword-to-UUID mapping for search filtering.
DesignObjectGallery::SelectionMode m_default_mode
The default gallery selection mode.
void filterFromManager()
Filters the displayed items using data from the model manager.
void setSaveSelection(bool multiselection)
Configures the chooser for save-selection mode.
void removeCategory(const StringView &name)
Removes a category by name from the chooser.
void onSelectedSignal(Buffer< UUID > id)
Emitted when the selection changes.
void setSelectionMode(DesignObjectGallery::SelectionMode selection_mode)
Sets the selection mode for the gallery (single or multi-select).
void setSelected(const Buffer< UUID > &id)
Sets the currently selected items by their UUIDs.
QSize sizeHint() const override
Returns the recommended size for this widget.
void addCategory(const StringView &name, const Buffer< UUID > &items)
Adds a named category with the specified items to the chooser.
LibraryManager * m_library_manager
The library manager providing archived objects.
bool assignToSelection(Model &model)
Assigns the current selection to the specified model.
void onUserSelectedSignal(Buffer< UUID > id)
Emitted when the user explicitly selects objects (as opposed to programmatic selection).
void showFileMenu(bool is_save, const Buffer< UUID > &ids=Buffer< UUID >())
Shows the file import/export menu.
Ui::DesignObjectChooserUI * ui
Pointer to the auto-generated UI form.
bool assignToModel(UUID id, Model &model)
Assigns the design object with the given UUID to the specified model.
void initContextMenu(Button *button)
Initializes the context menu for a button.
void showActiveMaterialsCategory(bool show)
Sets whether the active materials category is shown.
Buffer< UUID > currentSelection() const
Returns the UUIDs of the currently selected design objects.
String m_keyword_search
The current keyword search filter.
bool m_is_save_selection
Whether save-selection mode is active.
DesignObjectChooser(QTModelManager *manager, QWidget *parent=nullptr)
Constructs a DesignObjectChooser using the given model manager.
void contextMenuChangedSignal()
Emitted when the context menu configuration changes.
void filterFromArchive()
Filters the displayed items using data from the archive.
LibraryManager * activeLibrary()
Returns the active library manager.
DesignObjectChooser(LibraryManager *manager, QWidget *parent=nullptr)
Constructs a DesignObjectChooser using the given library manager.
Dictionary< String, Buffer< UUID > > m_categories
Category-to-UUID mapping for category filtering.
SelectionMode
Defines how user selection behaves in the gallery.
@ e_single_selection
User can select a single object at a time.
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 core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
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.