33#include <NDEVR/QTModelManager.h>
34#include <NDEVR/QCustomCombobox.h>
48 return !m_models.hasKey(model.
uuid()) && isModelAllowed(model);
54 m_model_filter = model_filter;
59 lib_assert(m_manager !=
nullptr,
"Need to set Model Manager");
60 if (m_manager !=
nullptr)
61 setModels(m_manager->getModelsByID(ids));
66 if (m_models.hasKey(
id))
82 lib_assert(m_allow_add_new,
"Tried to set to new when new not enabled");
83 setValue(UUID::CreateUUID(
"New Model"));
87 return getAs<UUID>() == UUID::CreateUUID(
"New Model");
91 m_exclusion_list.clear();
92 for (
uint04 i = 0; i < exclusion_list.
size(); i++)
93 m_exclusion_list.insert(exclusion_list[i]);
97 UUID id = getAs<UUID>();
98 if (
id == UUID::CreateUUID(
"New Model"))
105 m_display_name_callback = callback;
125 void _removeID(
const UUID&
id);
126 void _addModel(
const Model& m);
#define lib_assert(expression, message)
Asserts some logic in the code. Disabled in non debug mode by default. Can be re-enabled in release u...
Definition LibAssert.h:68
The equivelent of std::vector but with a bit more control. The basic array unit of the library.
Definition Buffer.hpp:59
constexpr t_index_type size() const
Definition Buffer.hpp:1374
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
Definition ModelChooserCombo.h:39
void setToNew()
Definition ModelChooserCombo.h:80
void addID(const UUID &id)
TranslatedString displayName(const Model &m)
ModelChooserCombo(QWidget *parent=nullptr)
void setModelParentID(const UUID &parent)
void addModel(const Model &m)
Definition ModelChooserCombo.h:114
void onObjectUpdatedSlot(Buffer< UUID > ids)
bool isNewSelected() const
Definition ModelChooserCombo.h:85
void newModelSelectedSignal()
void setDisplayNameCallback(std::function< TranslatedString(const Model &)> &callback)
Definition ModelChooserCombo.h:103
void setIncludePath(bool include_parent_name, const String &parent_type=String())
void setModels(const Buffer< Model > &models)
void setManager(QTModelManager *manager)
void setAllowNew(bool allow_new, const TranslatedString &new_title)
void setIDs(const Buffer< UUID > &ids)
Definition ModelChooserCombo.h:57
bool canAddModel(const Model &model)
Definition ModelChooserCombo.h:46
bool m_include_path
Definition ModelChooserCombo.h:139
bool m_include_parent_name
Definition ModelChooserCombo.h:138
virtual void onSorted(const Buffer< uint04 > &sorted_indices)
void setModelType(const String &type)
void removeID(const UUID &id)
Definition ModelChooserCombo.h:64
void refreshFromManager()
Definition ModelChooserCombo.h:74
void setExclusionList(const Buffer< UUID > &exclusion_list)
Definition ModelChooserCombo.h:89
Dictionary< UUID, Buffer< UUID > > m_model_parents
Definition ModelChooserCombo.h:131
void onObjectsDeletedSlot()
std::function< TranslatedString(const Model &)> m_display_name_callback
Definition ModelChooserCombo.h:129
Dictionary< UUID, uint04 > m_models
Definition ModelChooserCombo.h:130
void modelSelectedSignal(UUID id)
void setCurrentSelection(UUID id)
void setModelFilter(const std::function< bool(const Model &)> &model_filter)
Definition ModelChooserCombo.h:51
std::function< bool(const Model &)> m_model_filter
Definition ModelChooserCombo.h:136
void setIncludeParentName(bool include_parent_name, const String &parent_type=String())
UUID selectedID() const
Definition ModelChooserCombo.h:95
bool isModelAllowed(const Model &model)
QTModelManager * m_manager
Definition ModelChooserCombo.h:135
void onObjectAddedSlot(const Buffer< UUID > &ids)
String m_parent_type
Definition ModelChooserCombo.h:134
String m_model_type
Definition ModelChooserCombo.h:133
bool m_allow_add_new
Definition ModelChooserCombo.h:137
Set< UUID > m_exclusion_list
Definition ModelChooserCombo.h:128
A core class that represents a node on model heirarchy. This node may contain a Geometry or.
Definition Model.h:58
A compact way to present a list of options to the user.
Definition QCustomCombobox.h:53
Definition QTModelManager.h:94
Container that stores unique elements in no particular order, and which allow for fast retrieval.
Definition Model.h:51
The core String class for the software.
Definition String.h:47
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:94
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved.
Definition BaseValues.hpp:230