forked from qt-creator/qt-creator
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>
This commit is contained in:
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
|
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |
@@ -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>
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
Reference in New Issue
Block a user