Skip to content

Commit

Permalink
Only show the hidden classes if they are not encrypted (#11135)
Browse files Browse the repository at this point in the history
Fixes #11121

Renamed the option `Show Hidden Classes` to `Show Hidden Classes if not encrypted`. The option does not have an influence on encrypted libraries.
  • Loading branch information
adeas31 committed Sep 7, 2023
1 parent 682fa8b commit 25c8b24
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions OMEdit/OMEditLIB/Modeling/LibraryTreeWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,7 @@ LibraryTreeItem::Access LibraryTreeItem::getAccess()
/* Activate the access annotations if the class is encrypted
* OR if the LibraryTreeItem's mAccessAnnotations is marked true based on the activate access annotation setting.
*/
bool isEncryptedClass = mFileName.endsWith(".moc");

if (isEncryptedClass || isAccessAnnotationsEnabled()) {
if (isEncryptedClass() || isAccessAnnotationsEnabled()) {
if (mClassInformation.access.compare("Access.hide") == 0) {
return LibraryTreeItem::hide;
} else if (mClassInformation.access.compare("Access.icon") == 0) {
Expand All @@ -307,7 +305,7 @@ LibraryTreeItem::Access LibraryTreeItem::getAccess()
} else if (mpParentLibraryTreeItem && !mpParentLibraryTreeItem->isRootItem()) { // if there is no override for Access annotation then look in the parent class.
return mpParentLibraryTreeItem->getAccess();
} else {
if (isEncryptedClass) { // if a class is encrypted and no Protection annotation is defined, the access annotation has the default value Access.documentation
if (isEncryptedClass()) { // if a class is encrypted and no Protection annotation is defined, the access annotation has the default value Access.documentation
return LibraryTreeItem::documentation;
} else {
return LibraryTreeItem::all;
Expand Down Expand Up @@ -1116,7 +1114,7 @@ bool LibraryTreeProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &s
}

bool hide = ((pLibraryTreeItem->getAccess() == LibraryTreeItem::hide
&& !OptionsDialog::instance()->getGeneralSettingsPage()->getShowHiddenClasses())
&& !(OptionsDialog::instance()->getGeneralSettingsPage()->getShowHiddenClasses() && !pLibraryTreeItem->isEncryptedClass()))
|| (pLibraryTreeItem->isProtected() && !OptionsDialog::instance()->getGeneralSettingsPage()->getShowProtectedClasses()));

// if any of children matches the filter, then current index matches the filter as well
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditLIB/Modeling/LibraryTreeWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class LibraryTreeItem : public QObject
bool isExpanded() const {return mExpanded;}
void setNonExisting(bool nonExisting) {mNonExisting = nonExisting;}
bool isNonExisting() const {return mNonExisting;}
bool isEncryptedClass() const {return mFileName.endsWith(".moc");}
bool isAccessAnnotationsEnabled() const {return mAccessAnnotations;}
void setAccessAnnotations(bool accessAnnotations) {mAccessAnnotations = accessAnnotations;}
void setOMSElement(oms_element_t *pOMSComponent) {mpOMSElement = pOMSComponent;}
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditLIB/Options/OptionsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3645,7 +3645,7 @@ GeneralSettingsPage::GeneralSettingsPage(OptionsDialog *pOptionsDialog)
// show protected classes
mpShowProtectedClasses = new QCheckBox(tr("Show Protected Classes"));
// show hidden classes
mpShowHiddenClasses = new QCheckBox(tr("Show Hidden Classes (Ignores the annotation(Protection(access = Access.hide)))"));
mpShowHiddenClasses = new QCheckBox(tr("Show Hidden Classes if not encrypted"));
// synchronize Libraries Browser with ModelWidget
mpSynchronizeWithModelWidgetCheckBox = new QCheckBox(tr("Synchronize with Model Widget"));
mpSynchronizeWithModelWidgetCheckBox->setChecked(OptionsDefaults::GeneralSettings::synchronizeWithModelWidget);
Expand Down

0 comments on commit 25c8b24

Please sign in to comment.