diff --git a/src/plugins/help/images/home.png b/src/libs/utils/images/home.png similarity index 100% rename from src/plugins/help/images/home.png rename to src/libs/utils/images/home.png diff --git a/src/plugins/help/images/home@2x.png b/src/libs/utils/images/home@2x.png similarity index 100% rename from src/plugins/help/images/home@2x.png rename to src/libs/utils/images/home@2x.png diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc index 9086ea94a77d3fd610b137c1ca1bf99b15082302..95a473da2abaf8a29bc960bf629307610c5dd51d 100644 --- a/src/libs/utils/utils.qrc +++ b/src/libs/utils/utils.qrc @@ -178,5 +178,7 @@ <file>images/wizardicon-file@2x.png</file> <file>images/project.png</file> <file>images/project@2x.png</file> + <file>images/home.png</file> + <file>images/home@2x.png</file> </qresource> </RCC> diff --git a/src/libs/utils/utilsicons.cpp b/src/libs/utils/utilsicons.cpp index cc08c3920c4c5a1ad348533943f861d3c514f1c9..016d3d5fb464d3ac3188a2db90393531b5d661f6 100644 --- a/src/libs/utils/utilsicons.cpp +++ b/src/libs/utils/utilsicons.cpp @@ -28,6 +28,11 @@ namespace Utils { namespace Icons { + +const Icon HOME({ + {QLatin1String(":/utils/images/home.png"), Utils::Theme::PanelTextColorDark}}, Icon::Tint); +const Icon HOME_TOOLBAR({ + {QLatin1String(":/utils/images/home.png"), Utils::Theme::IconsBaseColor}}); const Icon EDIT_CLEAR({ {QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint); const Icon EDIT_CLEAR_TOOLBAR({ diff --git a/src/libs/utils/utilsicons.h b/src/libs/utils/utilsicons.h index af618ee4546c11ee182c8a1c94b6c3c765256273..9a3a586e14723f5416142b50ce8bde22dd8dfa7a 100644 --- a/src/libs/utils/utilsicons.h +++ b/src/libs/utils/utilsicons.h @@ -31,6 +31,8 @@ namespace Utils { namespace Icons { +QTCREATOR_UTILS_EXPORT extern const Icon HOME; +QTCREATOR_UTILS_EXPORT extern const Icon HOME_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon EDIT_CLEAR; QTCREATOR_UTILS_EXPORT extern const Icon EDIT_CLEAR_TOOLBAR; QTCREATOR_UTILS_EXPORT extern const Icon LOCKED_TOOLBAR; diff --git a/src/plugins/help/help.qrc b/src/plugins/help/help.qrc index d2db8d1a6b5c2cc232f18d3d0bf329fe8be1caab..12c1f0803eedd8eb0389affe830b38c7ca7485ec 100644 --- a/src/plugins/help/help.qrc +++ b/src/plugins/help/help.qrc @@ -2,8 +2,6 @@ <qresource prefix="/help"> <file>images/find.png</file> <file>images/book.png</file> - <file>images/home.png</file> - <file>images/home@2x.png</file> <file>images/category_help.png</file> <file>images/mode_help.png</file> <file>images/mode_help@2x.png</file> diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index b0e6cb3daf7d4ef49d099318cb12a0878c457085..feb6c3ffa43d328d6c7a5b5a10ed0a8a99e7b2da 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -176,7 +176,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_switchToHelp, cmd)); } - m_homeAction = new QAction(Icons::HOME_TOOLBAR.icon(), tr("Home"), this); + m_homeAction = new QAction(Utils::Icons::HOME_TOOLBAR.icon(), tr("Home"), this); cmd = Core::ActionManager::registerAction(m_homeAction, Constants::HELP_HOME, context); connect(m_homeAction, &QAction::triggered, this, &HelpWidget::goHome); layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_homeAction, cmd)); diff --git a/src/plugins/projectexplorer/foldernavigationwidget.cpp b/src/plugins/projectexplorer/foldernavigationwidget.cpp index f981545c690efb90cef8f72debd7379d7db84d34..3ba8fecce1813b97eb0c5281710781d02e6d0aaf 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.cpp +++ b/src/plugins/projectexplorer/foldernavigationwidget.cpp @@ -25,6 +25,7 @@ #include "foldernavigationwidget.h" #include "projectexplorer.h" +#include "projectexplorericons.h" #include <coreplugin/actionmanager/command.h> #include <coreplugin/documentmanager.h> @@ -199,6 +200,7 @@ void FolderNavigationWidget::insertRootDirectory( m_rootSelector->setItemData(index, directory.id, ID_ROLE); m_rootSelector->setItemData(index, directory.sortValue, SORT_ROLE); m_rootSelector->setItemData(index, directory.path.toUserOutput(), Qt::ToolTipRole); + m_rootSelector->setItemIcon(index, directory.icon); if (m_rootSelector->currentIndex() == previousIndex) m_rootSelector->setCurrentIndex(index); if (previousIndex < m_rootSelector->count()) @@ -378,11 +380,13 @@ FolderNavigationWidgetFactory::FolderNavigationWidgetFactory() insertRootDirectory({QLatin1String("A.Computer"), 0 /*sortValue*/, FolderNavigationWidget::tr("Computer"), - Utils::FileName()}); + Utils::FileName(), + Icons::DESKTOP_DEVICE_SMALL.icon()}); insertRootDirectory({QLatin1String("A.Home"), 10 /*sortValue*/, FolderNavigationWidget::tr("Home"), - Utils::FileName::fromString(QDir::homePath())}); + Utils::FileName::fromString(QDir::homePath()), + Utils::Icons::HOME.icon()}); updateProjectsDirectoryRoot(); connect(Core::DocumentManager::instance(), &Core::DocumentManager::projectsDirectoryChanged, @@ -465,7 +469,8 @@ void FolderNavigationWidgetFactory::updateProjectsDirectoryRoot() insertRootDirectory({QLatin1String(PROJECTSDIRECTORYROOT_ID), 20 /*sortValue*/, FolderNavigationWidget::tr("Projects"), - Core::DocumentManager::projectsDirectory()}); + Core::DocumentManager::projectsDirectory(), + Utils::Icons::PROJECT.icon()}); } } // namespace Internal diff --git a/src/plugins/projectexplorer/foldernavigationwidget.h b/src/plugins/projectexplorer/foldernavigationwidget.h index 11e2bbc9ec88a609056f069c2e12dbf629a9a27b..55bbf44a278dd9be9cd841645484279b2ab5022d 100644 --- a/src/plugins/projectexplorer/foldernavigationwidget.h +++ b/src/plugins/projectexplorer/foldernavigationwidget.h @@ -28,6 +28,7 @@ #include <coreplugin/inavigationwidgetfactory.h> #include <utils/fileutils.h> +#include <QIcon> #include <QWidget> namespace Core { class IEditor; } @@ -56,6 +57,7 @@ public: int sortValue; QString displayName; Utils::FileName path; + QIcon icon; }; FolderNavigationWidgetFactory(); diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp index e66e8e7d8b1abd131dc8e44cb6c74c6ecf433f26..b5fddb74ce232e11ddcb4b95021cf465d47dae22 100644 --- a/src/plugins/projectexplorer/session.cpp +++ b/src/plugins/projectexplorer/session.cpp @@ -394,14 +394,19 @@ void SessionManager::addProject(Project *pro) emit m_instance->projectAdded(pro); const auto updateFolderNavigation = [pro] { + const QIcon icon = pro->rootProjectNode() ? pro->rootProjectNode()->icon() : QIcon(); FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro), PROJECT_SORT_VALUE, pro->displayName(), - pro->projectFilePath().parentDir()}); + pro->projectFilePath().parentDir(), + icon}); }; updateFolderNavigation(); configureEditors(pro); - connect(pro, &Project::fileListChanged, [pro](){ configureEditors(pro); }); + connect(pro, &Project::fileListChanged, [pro, updateFolderNavigation]() { + configureEditors(pro); + updateFolderNavigation(); // update icon + }); connect(pro, &Project::displayNameChanged, pro, updateFolderNavigation); } diff --git a/src/shared/help/helpicons.h b/src/shared/help/helpicons.h index f9429a28150906759cd70d54b9cbb5d98e5ad716..dd4ebce26a50a292be0c2c359e54fe227ce2c21a 100644 --- a/src/shared/help/helpicons.h +++ b/src/shared/help/helpicons.h @@ -30,8 +30,6 @@ namespace Help { namespace Icons { -const Utils::Icon HOME_TOOLBAR({ - {QLatin1String(":/help/images/home.png"), Utils::Theme::IconsBaseColor}}); const Utils::Icon MODE_HELP_CLASSIC( QLatin1String(":/help/images/mode_help.png")); const Utils::Icon MODE_HELP_FLAT({ diff --git a/src/tools/icons/qtcreatoricons.svg b/src/tools/icons/qtcreatoricons.svg index 442a26574925b4ac80fecb74a2478e3a7d04bc10..2cfb5042d24893e5f908eb39f59e53cafaa77957 100644 --- a/src/tools/icons/qtcreatoricons.svg +++ b/src/tools/icons/qtcreatoricons.svg @@ -4087,7 +4087,7 @@ sodipodi:nodetypes="cccc" /> </g> <g - id="src/plugins/help/images/home"> + id="src/libs/utils/images/home"> <rect style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none" width="16"