mirror of
https://github.com/leozide/leocad
synced 2025-01-17 18:11:42 +01:00
Added option to hide part aliases. Fixes #378.
This commit is contained in:
parent
1e2f6c208f
commit
e523398c70
4 changed files with 34 additions and 0 deletions
|
@ -42,6 +42,7 @@ lcPartSelectionListModel::lcPartSelectionListModel(QObject* Parent)
|
|||
mShowPartNames = lcGetProfileInt(LC_PROFILE_PARTS_LIST_NAMES);
|
||||
mListMode = lcGetProfileInt(LC_PROFILE_PARTS_LIST_LISTMODE);
|
||||
mShowDecoratedParts = lcGetProfileInt(LC_PROFILE_PARTS_LIST_DECORATED);
|
||||
mShowPartAliases = lcGetProfileInt(LC_PROFILE_PARTS_LIST_ALIASES);
|
||||
|
||||
int ColorCode = lcGetProfileInt(LC_PROFILE_PARTS_LIST_COLOR);
|
||||
if (ColorCode == -1)
|
||||
|
@ -214,6 +215,8 @@ void lcPartSelectionListModel::SetFilter(const QString& Filter)
|
|||
|
||||
if (!mShowDecoratedParts && Info->IsPatterned())
|
||||
Visible = false;
|
||||
else if (!mShowPartAliases && Info->m_strDescription[0] == '=')
|
||||
Visible = false;
|
||||
else if (mFilter.isEmpty())
|
||||
Visible = true;
|
||||
else
|
||||
|
@ -407,6 +410,16 @@ void lcPartSelectionListModel::SetShowDecoratedParts(bool Show)
|
|||
SetFilter(mFilter);
|
||||
}
|
||||
|
||||
void lcPartSelectionListModel::SetShowPartAliases(bool Show)
|
||||
{
|
||||
if (Show == mShowPartAliases)
|
||||
return;
|
||||
|
||||
mShowPartAliases = Show;
|
||||
|
||||
SetFilter(mFilter);
|
||||
}
|
||||
|
||||
void lcPartSelectionListModel::SetIconSize(int Size)
|
||||
{
|
||||
if (Size == mIconSize)
|
||||
|
@ -503,6 +516,10 @@ void lcPartSelectionListView::CustomContextMenuRequested(QPoint Pos)
|
|||
DecoratedParts->setCheckable(true);
|
||||
DecoratedParts->setChecked(mListModel->GetShowDecoratedParts());
|
||||
|
||||
QAction* PartAliases = Menu->addAction(tr("Show Part Aliases"), this, SLOT(TogglePartAliases()));
|
||||
PartAliases->setCheckable(true);
|
||||
PartAliases->setChecked(mListModel->GetShowPartAliases());
|
||||
|
||||
if (mListModel->GetIconSize() != 0)
|
||||
{
|
||||
QAction* ListMode = Menu->addAction(tr("List Mode"), this, SLOT(ToggleListMode()));
|
||||
|
@ -557,6 +574,13 @@ void lcPartSelectionListView::ToggleDecoratedParts()
|
|||
lcSetProfileInt(LC_PROFILE_PARTS_LIST_DECORATED, Show);
|
||||
}
|
||||
|
||||
void lcPartSelectionListView::TogglePartAliases()
|
||||
{
|
||||
bool Show = !mListModel->GetShowPartAliases();
|
||||
mListModel->SetShowPartAliases(Show);
|
||||
lcSetProfileInt(LC_PROFILE_PARTS_LIST_ALIASES, Show);
|
||||
}
|
||||
|
||||
void lcPartSelectionListView::ToggleListMode()
|
||||
{
|
||||
mListModel->ToggleListMode();
|
||||
|
|
|
@ -50,6 +50,11 @@ public:
|
|||
return mShowDecoratedParts;
|
||||
}
|
||||
|
||||
bool GetShowPartAliases() const
|
||||
{
|
||||
return mShowPartAliases;
|
||||
}
|
||||
|
||||
int GetIconSize() const
|
||||
{
|
||||
return mIconSize;
|
||||
|
@ -80,6 +85,7 @@ public:
|
|||
void SetFilter(const QString& Filter);
|
||||
void RequestPreview(int InfoIndex);
|
||||
void SetShowDecoratedParts(bool Show);
|
||||
void SetShowPartAliases(bool Show);
|
||||
void SetIconSize(int Size);
|
||||
void SetShowPartNames(bool Show);
|
||||
|
||||
|
@ -99,6 +105,7 @@ protected:
|
|||
bool mShowPartNames;
|
||||
bool mListMode;
|
||||
bool mShowDecoratedParts;
|
||||
bool mShowPartAliases;
|
||||
QByteArray mFilter;
|
||||
std::pair<lcFramebuffer, lcFramebuffer> mRenderFramebuffer;
|
||||
};
|
||||
|
@ -133,6 +140,7 @@ public slots:
|
|||
void SetExtraLargeIcons();
|
||||
void TogglePartNames();
|
||||
void ToggleDecoratedParts();
|
||||
void TogglePartAliases();
|
||||
void ToggleListMode();
|
||||
void ToggleFixedColor();
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ static lcProfileEntry gProfileEntries[LC_NUM_PROFILE_KEYS] =
|
|||
lcProfileEntry("Settings", "PartsListNames", 0), // LC_PROFILE_PARTS_LIST_NAMES
|
||||
lcProfileEntry("Settings", "PartsListFixedColor", -1), // LC_PROFILE_PARTS_LIST_FIXED_COLOR
|
||||
lcProfileEntry("Settings", "PartsListDecorated", 1), // LC_PROFILE_PARTS_LIST_DECORATED
|
||||
lcProfileEntry("Settings", "PartsListAliases", 1), // LC_PROFILE_PARTS_LIST_ALIASES
|
||||
lcProfileEntry("Settings", "PartsListListMode", 0), // LC_PROFILE_PARTS_LIST_LISTMODE
|
||||
|
||||
lcProfileEntry("Defaults", "Author", ""), // LC_PROFILE_DEFAULT_AUTHOR_NAME
|
||||
|
|
|
@ -44,6 +44,7 @@ enum LC_PROFILE_KEY
|
|||
LC_PROFILE_PARTS_LIST_NAMES,
|
||||
LC_PROFILE_PARTS_LIST_COLOR,
|
||||
LC_PROFILE_PARTS_LIST_DECORATED,
|
||||
LC_PROFILE_PARTS_LIST_ALIASES,
|
||||
LC_PROFILE_PARTS_LIST_LISTMODE,
|
||||
|
||||
// Defaults for new projects.
|
||||
|
|
Loading…
Reference in a new issue