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/wizardicon-file@2x.png</file>
|
||||||
<file>images/project.png</file>
|
<file>images/project.png</file>
|
||||||
<file>images/project@2x.png</file>
|
<file>images/project@2x.png</file>
|
||||||
|
<file>images/home.png</file>
|
||||||
|
<file>images/home@2x.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -28,6 +28,11 @@
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
namespace Icons {
|
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({
|
const Icon EDIT_CLEAR({
|
||||||
{QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint);
|
{QLatin1String(":/utils/images/editclear.png"), Theme::PanelTextColorMid}}, Icon::Tint);
|
||||||
const Icon EDIT_CLEAR_TOOLBAR({
|
const Icon EDIT_CLEAR_TOOLBAR({
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
namespace Icons {
|
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;
|
||||||
QTCREATOR_UTILS_EXPORT extern const Icon EDIT_CLEAR_TOOLBAR;
|
QTCREATOR_UTILS_EXPORT extern const Icon EDIT_CLEAR_TOOLBAR;
|
||||||
QTCREATOR_UTILS_EXPORT extern const Icon LOCKED_TOOLBAR;
|
QTCREATOR_UTILS_EXPORT extern const Icon LOCKED_TOOLBAR;
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<qresource prefix="/help">
|
<qresource prefix="/help">
|
||||||
<file>images/find.png</file>
|
<file>images/find.png</file>
|
||||||
<file>images/book.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/category_help.png</file>
|
||||||
<file>images/mode_help.png</file>
|
<file>images/mode_help.png</file>
|
||||||
<file>images/mode_help@2x.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));
|
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);
|
cmd = Core::ActionManager::registerAction(m_homeAction, Constants::HELP_HOME, context);
|
||||||
connect(m_homeAction, &QAction::triggered, this, &HelpWidget::goHome);
|
connect(m_homeAction, &QAction::triggered, this, &HelpWidget::goHome);
|
||||||
layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_homeAction, cmd));
|
layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_homeAction, cmd));
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "foldernavigationwidget.h"
|
#include "foldernavigationwidget.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
|
#include "projectexplorericons.h"
|
||||||
|
|
||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/documentmanager.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.id, ID_ROLE);
|
||||||
m_rootSelector->setItemData(index, directory.sortValue, SORT_ROLE);
|
m_rootSelector->setItemData(index, directory.sortValue, SORT_ROLE);
|
||||||
m_rootSelector->setItemData(index, directory.path.toUserOutput(), Qt::ToolTipRole);
|
m_rootSelector->setItemData(index, directory.path.toUserOutput(), Qt::ToolTipRole);
|
||||||
|
m_rootSelector->setItemIcon(index, directory.icon);
|
||||||
if (m_rootSelector->currentIndex() == previousIndex)
|
if (m_rootSelector->currentIndex() == previousIndex)
|
||||||
m_rootSelector->setCurrentIndex(index);
|
m_rootSelector->setCurrentIndex(index);
|
||||||
if (previousIndex < m_rootSelector->count())
|
if (previousIndex < m_rootSelector->count())
|
||||||
@@ -378,11 +380,13 @@ FolderNavigationWidgetFactory::FolderNavigationWidgetFactory()
|
|||||||
insertRootDirectory({QLatin1String("A.Computer"),
|
insertRootDirectory({QLatin1String("A.Computer"),
|
||||||
0 /*sortValue*/,
|
0 /*sortValue*/,
|
||||||
FolderNavigationWidget::tr("Computer"),
|
FolderNavigationWidget::tr("Computer"),
|
||||||
Utils::FileName()});
|
Utils::FileName(),
|
||||||
|
Icons::DESKTOP_DEVICE_SMALL.icon()});
|
||||||
insertRootDirectory({QLatin1String("A.Home"),
|
insertRootDirectory({QLatin1String("A.Home"),
|
||||||
10 /*sortValue*/,
|
10 /*sortValue*/,
|
||||||
FolderNavigationWidget::tr("Home"),
|
FolderNavigationWidget::tr("Home"),
|
||||||
Utils::FileName::fromString(QDir::homePath())});
|
Utils::FileName::fromString(QDir::homePath()),
|
||||||
|
Utils::Icons::HOME.icon()});
|
||||||
updateProjectsDirectoryRoot();
|
updateProjectsDirectoryRoot();
|
||||||
connect(Core::DocumentManager::instance(),
|
connect(Core::DocumentManager::instance(),
|
||||||
&Core::DocumentManager::projectsDirectoryChanged,
|
&Core::DocumentManager::projectsDirectoryChanged,
|
||||||
@@ -465,7 +469,8 @@ void FolderNavigationWidgetFactory::updateProjectsDirectoryRoot()
|
|||||||
insertRootDirectory({QLatin1String(PROJECTSDIRECTORYROOT_ID),
|
insertRootDirectory({QLatin1String(PROJECTSDIRECTORYROOT_ID),
|
||||||
20 /*sortValue*/,
|
20 /*sortValue*/,
|
||||||
FolderNavigationWidget::tr("Projects"),
|
FolderNavigationWidget::tr("Projects"),
|
||||||
Core::DocumentManager::projectsDirectory()});
|
Core::DocumentManager::projectsDirectory(),
|
||||||
|
Utils::Icons::PROJECT.icon()});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include <coreplugin/inavigationwidgetfactory.h>
|
#include <coreplugin/inavigationwidgetfactory.h>
|
||||||
#include <utils/fileutils.h>
|
#include <utils/fileutils.h>
|
||||||
|
|
||||||
|
#include <QIcon>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Core { class IEditor; }
|
namespace Core { class IEditor; }
|
||||||
@@ -56,6 +57,7 @@ public:
|
|||||||
int sortValue;
|
int sortValue;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
Utils::FileName path;
|
Utils::FileName path;
|
||||||
|
QIcon icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
FolderNavigationWidgetFactory();
|
FolderNavigationWidgetFactory();
|
||||||
|
|||||||
@@ -394,14 +394,19 @@ void SessionManager::addProject(Project *pro)
|
|||||||
|
|
||||||
emit m_instance->projectAdded(pro);
|
emit m_instance->projectAdded(pro);
|
||||||
const auto updateFolderNavigation = [pro] {
|
const auto updateFolderNavigation = [pro] {
|
||||||
|
const QIcon icon = pro->rootProjectNode() ? pro->rootProjectNode()->icon() : QIcon();
|
||||||
FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro),
|
FolderNavigationWidgetFactory::insertRootDirectory({projectFolderId(pro),
|
||||||
PROJECT_SORT_VALUE,
|
PROJECT_SORT_VALUE,
|
||||||
pro->displayName(),
|
pro->displayName(),
|
||||||
pro->projectFilePath().parentDir()});
|
pro->projectFilePath().parentDir(),
|
||||||
|
icon});
|
||||||
};
|
};
|
||||||
updateFolderNavigation();
|
updateFolderNavigation();
|
||||||
configureEditors(pro);
|
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);
|
connect(pro, &Project::displayNameChanged, pro, updateFolderNavigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@
|
|||||||
namespace Help {
|
namespace Help {
|
||||||
namespace Icons {
|
namespace Icons {
|
||||||
|
|
||||||
const Utils::Icon HOME_TOOLBAR({
|
|
||||||
{QLatin1String(":/help/images/home.png"), Utils::Theme::IconsBaseColor}});
|
|
||||||
const Utils::Icon MODE_HELP_CLASSIC(
|
const Utils::Icon MODE_HELP_CLASSIC(
|
||||||
QLatin1String(":/help/images/mode_help.png"));
|
QLatin1String(":/help/images/mode_help.png"));
|
||||||
const Utils::Icon MODE_HELP_FLAT({
|
const Utils::Icon MODE_HELP_FLAT({
|
||||||
|
|||||||
@@ -4087,7 +4087,7 @@
|
|||||||
sodipodi:nodetypes="cccc" />
|
sodipodi:nodetypes="cccc" />
|
||||||
</g>
|
</g>
|
||||||
<g
|
<g
|
||||||
id="src/plugins/help/images/home">
|
id="src/libs/utils/images/home">
|
||||||
<rect
|
<rect
|
||||||
style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none"
|
style="display:inline;fill:#ffffff;fill-opacity:1;stroke:none"
|
||||||
width="16"
|
width="16"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 316 KiB After Width: | Height: | Size: 316 KiB |
Reference in New Issue
Block a user