Skip to content

Commit

Permalink
Gui: Use freedesktop name for the group icon so it can be displayed u…
Browse files Browse the repository at this point in the history
…sing the system theme
  • Loading branch information
yorikvanhavre committed Sep 4, 2019
1 parent 349acc7 commit 8de92d2
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Gui/CommandStructure.cpp
Expand Up @@ -94,7 +94,7 @@ StdCmdGroup::StdCmdGroup()
sToolTipText = QT_TR_NOOP("Create a new group for ordering objects");
sWhatsThis = "Std_Group";
sStatusTip = sToolTipText;
sPixmap = "Group";
sPixmap = "folder";
}

void StdCmdGroup::activated(int iMsg)
Expand Down
67 changes: 67 additions & 0 deletions src/Gui/Icons/folder.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/Gui/Icons/resource.qrc
Expand Up @@ -277,5 +277,6 @@
<file>DrawStyleShaded.svg</file>
<file>DrawStyleWireFrame.svg</file>
<file>user.svg</file>
<file>folder.svg</file>
</qresource>
</RCC>
7 changes: 6 additions & 1 deletion src/Gui/ViewProviderDocumentObjectGroup.cpp
Expand Up @@ -60,7 +60,7 @@ ViewProviderDocumentObjectGroup::ViewProviderDocumentObjectGroup()
#endif
ViewProviderGroupExtension::initExtension(this);

sPixmap = "Group.svg";
sPixmap = "folder";
}

ViewProviderDocumentObjectGroup::~ViewProviderDocumentObjectGroup()
Expand All @@ -78,6 +78,11 @@ bool ViewProviderDocumentObjectGroup::isShow(void) const
return Visibility.getValue();
}

QIcon ViewProviderDocumentObjectGroup::getIcon(void) const
{
return mergeOverlayIcons (Gui::BitmapFactory().iconFromTheme(sPixmap));
}

/**
* Extracts the associated view providers of the objects of the associated object group group.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/Gui/ViewProviderDocumentObjectGroup.h
Expand Up @@ -46,6 +46,8 @@ class GuiExport ViewProviderDocumentObjectGroup : public ViewProviderDocumentObj
std::vector<std::string> getDisplayModes(void) const override;
bool isShow(void) const override;

/// deliver the icon shown in the tree view
virtual QIcon getIcon(void) const override;

protected:
void getViewProviders(std::vector<ViewProviderDocumentObject*>&) const;
Expand Down
8 changes: 4 additions & 4 deletions src/Mod/AddonManager/AddonManager.py
Expand Up @@ -123,7 +123,7 @@ def launch(self):
self.dialog.buttonInstall.setIcon(QtGui.QIcon.fromTheme("download",QtGui.QIcon(":/icons/edit_OK.svg")))
self.dialog.buttonUpdateAll.setIcon(QtGui.QIcon(":/icons/button_valid.svg"))
self.dialog.buttonConfigure.setIcon(QtGui.QIcon(":/icons/preferences-system.svg"))
self.dialog.tabWidget.setTabIcon(0,QtGui.QIcon(":/icons/Group.svg"))
self.dialog.tabWidget.setTabIcon(0,QtGui.QIcon.fromTheme("folder",QtGui.QIcon(":/icons/folder.svg")))
self.dialog.tabWidget.setTabIcon(1,QtGui.QIcon(":/icons/applications-python.svg"))


Expand Down Expand Up @@ -263,7 +263,7 @@ def add_addon_repo(self, addon_repo):
import AddonManager_rc
addonicon = QtGui.QIcon(":/icons/" + addon_repo[0] + "_workbench_icon.svg")
if addonicon.isNull():
addonicon = QtGui.QIcon(":/icons/Group.svg")
addonicon = QtGui.QIcon.fromTheme("folder",QtGui.QIcon(":/icons/folder.svg"))
if addon_repo[2] > 0:
item = QtGui.QListWidgetItem(addonicon,str(addon_repo[0]) + str(" ("+translate("AddonsInstaller","Installed")+")"))
item.setForeground(QtGui.QBrush(QtGui.QColor(0,182,41)))
Expand Down Expand Up @@ -523,7 +523,7 @@ def update_status(self,soft=False):
self.dialog.listWorkbenches.item(i).setText(txt+ext)
else:
self.dialog.listWorkbenches.item(i).setText(txt)
self.dialog.listWorkbenches.item(i).setIcon(QtGui.QIcon(":/icons/Group.svg"))
self.dialog.listWorkbenches.item(i).setIcon(QtGui.QIcon.fromTheme("folder",QtGui.QIcon(":/icons/folder.svg")))
for i in range(self.dialog.listMacros.count()):
txt = self.dialog.listMacros.item(i).text().strip()
if txt.endswith(" ("+translate("AddonsInstaller","Installed")+")"):
Expand All @@ -534,7 +534,7 @@ def update_status(self,soft=False):
self.dialog.listMacros.item(i).setText(txt+ext)
else:
self.dialog.listMacros.item(i).setText(txt)
self.dialog.listMacros.item(i).setIcon(QtGui.QIcon(":/icons/Group.svg"))
self.dialog.listMacros.item(i).setIcon(QtGui.QIcon.fromTheme("folder",QtGui.QIcon(":/icons/folder.svg")))
else:
self.dialog.listWorkbenches.clear()
self.dialog.listMacros.clear()
Expand Down

1 comment on commit 8de92d2

@realthunder
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yorikvanhavre I think making the object's icon themeable may create confusion, because the project tree and the toolbar buttons now display differently on different system. For example, users may find it harder to follow a tutorial, because they can't find the same icon on their FreeCAD.

Please sign in to comment.