aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2017-10-09 06:59:54 +0200
committerEike Ziller <eike.ziller@qt.io>2017-10-11 07:06:41 +0000
commit1932912e7c07484fa3523f451a9317630b9aac20 (patch)
tree709d3b890a6610f747b3c385bf8a6740ba09e573
parent679cee878db1eac305e42e305da91570cf164e36 (diff)
Add icons to file system view directory selector
Change-Id: I0b6451d7f68fae93e0b140aaea030c88ec1a8801 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
-rw-r--r--src/libs/utils/images/home.png (renamed from src/plugins/help/images/home.png)bin146 -> 146 bytes
-rw-r--r--src/libs/utils/images/home@2x.png (renamed from src/plugins/help/images/home@2x.png)bin251 -> 251 bytes
-rw-r--r--src/libs/utils/utils.qrc2
-rw-r--r--src/libs/utils/utilsicons.cpp5
-rw-r--r--src/libs/utils/utilsicons.h2
-rw-r--r--src/plugins/help/help.qrc2
-rw-r--r--src/plugins/help/helpwidget.cpp2
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.cpp11
-rw-r--r--src/plugins/projectexplorer/foldernavigationwidget.h2
-rw-r--r--src/plugins/projectexplorer/session.cpp9
-rw-r--r--src/shared/help/helpicons.h2
-rw-r--r--src/tools/icons/qtcreatoricons.svg2
12 files changed, 28 insertions, 11 deletions
diff --git a/src/plugins/help/images/home.png b/src/libs/utils/images/home.png
index 45b92a001e..45b92a001e 100644
--- a/src/plugins/help/images/home.png
+++ b/src/libs/utils/images/home.png
Binary files differ
diff --git a/src/plugins/help/images/home@2x.png b/src/libs/utils/images/home@2x.png
index 72629cb719..72629cb719 100644
--- a/src/plugins/help/images/home@2x.png
+++ b/src/libs/utils/images/home@2x.png
Binary files differ
diff --git a/src/libs/utils/utils.qrc b/src/libs/utils/utils.qrc
index 9086ea94a7..95a473da2a 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 cc08c3920c..016d3d5fb4 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 af618ee454..9a3a586e14 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 d2db8d1a6b..12c1f0803e 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 b0e6cb3daf..feb6c3ffa4 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 f981545c69..3ba8fecce1 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 11e2bbc9ec..55bbf44a27 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 e66e8e7d8b..b5fddb74ce 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 f9429a2815..dd4ebce26a 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 442a265749..2cfb5042d2 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"