diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.cpp | 22 | ||||
-rw-r--r-- | src/plugins/coreplugin/manhattanstyle.h | 4 | ||||
-rw-r--r-- | src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp | 27 | ||||
-rw-r--r-- | src/plugins/coreplugin/themeeditor/themesettingstablemodel.h | 4 | ||||
-rw-r--r-- | src/plugins/cppeditor/cppeditorplugin.cpp | 12 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/profileeditor.cpp | 10 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakenodes.cpp | 22 | ||||
-rw-r--r-- | src/plugins/qtsupport/qtsupportconstants.h | 1 |
8 files changed, 57 insertions, 45 deletions
diff --git a/src/plugins/coreplugin/manhattanstyle.cpp b/src/plugins/coreplugin/manhattanstyle.cpp index 0722e31110..cdcd86f98b 100644 --- a/src/plugins/coreplugin/manhattanstyle.cpp +++ b/src/plugins/coreplugin/manhattanstyle.cpp @@ -314,12 +314,17 @@ void ManhattanStyle::polish(QPalette &pal) QProxyStyle::polish(pal); } -QIcon ManhattanStyle::standardIcon(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const +QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const { - QIcon ico = creatorTheme()->standardIcon(standardPixmap, opt, widget); - if (!ico.isNull()) - return ico; - return QProxyStyle::standardIcon(standardPixmap, opt, widget); + QIcon icon; + switch (standardIcon) { + case QStyle::SP_TitleBarCloseButton: + case QStyle::SP_ToolBarHorizontalExtensionButton: + return QIcon(standardPixmap(standardIcon, option, widget)); + default: + icon = baseStyle()->standardIcon(standardIcon, option, widget); + } + return icon; } QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, @@ -376,13 +381,8 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const void ManhattanStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const { - if (!panelWidget(widget)) { - if (creatorTheme()->flag(Theme::DrawIndicatorBranch) && element == PE_IndicatorBranch) { - creatorTheme()->drawIndicatorBranch(painter, option->rect, option->state); - return; - } + if (!panelWidget(widget)) return QProxyStyle::drawPrimitive(element, option, painter, widget); - } bool animating = (option->state & State_Animating); int state = option->state; diff --git a/src/plugins/coreplugin/manhattanstyle.h b/src/plugins/coreplugin/manhattanstyle.h index e67ea49c09..c4b9571227 100644 --- a/src/plugins/coreplugin/manhattanstyle.h +++ b/src/plugins/coreplugin/manhattanstyle.h @@ -56,7 +56,6 @@ public: SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget = 0) const; QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; - QIcon standardIcon(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget = 0) const; int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const; QRect itemRect(QPainter *p, const QRect &r, int flags, bool enabled, const QPixmap *pixmap, const QString &text, int len = -1) const; QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const; @@ -72,6 +71,9 @@ public: void unpolish(QWidget *widget); void unpolish(QApplication *app); +protected slots: + QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const; + private: void drawButtonSeparator(QPainter *painter, const QRect &rect, bool reverse) const; diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp index e3eebce56e..3bcebcaff3 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.cpp @@ -65,7 +65,7 @@ int ThemeSettingsTableModel::sectionRowCount(int section) const case SectionWidgetStyle: return 1; case SectionColors: return m_colors->numColorRoles(); case SectionFlags: return m_flags.size(); - case SectionIconOverlays: return m_iconOverlays.size(); + case SectionImageFiles: return m_imageFiles.size(); default: return 0; } } @@ -110,11 +110,11 @@ QVariant ThemeSettingsTableModel::sectionBodyData(int section, int row, int colu return QVariant::fromValue(makeDecoration(Qt::transparent)); return QVariant(); } - case SectionIconOverlays: { + case SectionImageFiles: { if (column == 0 && role == Qt::DisplayRole) - return m_iconOverlays[row].first; + return m_imageFiles[row].first; else if (column == 1 && role == Qt::DisplayRole) - return m_iconOverlays[row].second; + return m_imageFiles[row].second; else if (column == 0 && role == Qt::DecorationRole) return QVariant::fromValue(makeDecoration(Qt::transparent)); return QVariant(); @@ -131,7 +131,7 @@ QVariant ThemeSettingsTableModel::sectionHeaderData(int section, int role) const case SectionWidgetStyle: return tr("Widget Style"); case SectionColors: return tr("Colors"); case SectionFlags: return tr("Flags"); - case SectionIconOverlays: return tr("Icon Overlays"); + case SectionImageFiles: return tr("Image Files"); default: return QString(); } } @@ -159,7 +159,7 @@ Qt::ItemFlags ThemeSettingsTableModel::sectionBodyFlags(int section, int row, in case SectionFlags: return (column == 0) ? Qt::ItemIsEnabled : Qt::ItemIsEnabled | Qt::ItemIsUserCheckable; - case SectionIconOverlays: + case SectionImageFiles: return Qt::ItemIsEnabled; default: return Qt::ItemIsEnabled; } @@ -225,12 +225,12 @@ void ThemeSettingsTableModel::initFrom(Theme *theme) m_flags.append(qMakePair(key, theme->flag(static_cast<Theme::Flag>(i)))); } } - // IconOverlays + // ImageFiles { - QMetaEnum e = metaObject.enumerator(metaObject.indexOfEnumerator("MimeType")); + QMetaEnum e = metaObject.enumerator(metaObject.indexOfEnumerator("ImageFile")); for (int i = 0, total = e.keyCount(); i < total; ++i) { const QString key = QLatin1String(e.key(i)); - m_iconOverlays.append(qMakePair(key, theme->iconOverlay(static_cast<Theme::MimeType>(i)))); + m_imageFiles.append(qMakePair(key, theme->imageFile(static_cast<Theme::ImageFile>(i), QString()))); } } @@ -256,12 +256,11 @@ void ThemeSettingsTableModel::toTheme(Theme *t) const for (int i = 0; i < theme->flags.size(); ++i) theme->flags[i] = m_flags[i].second; } - // IconOveralys + // ImageFiles { - const int nOverlays = theme->iconOverlays.size(); - QTC_ASSERT(nOverlays == m_iconOverlays.size(), return); - for (int i = 0; i < nOverlays; ++i) - theme->iconOverlays[i] = m_iconOverlays[i].second; + const int nImageFiles = theme->imageFiles.size(); + for (int i = 0; i < nImageFiles; ++i) + theme->imageFiles[i] = m_imageFiles.at(i).second; } theme->widgetStyle = m_widgetStyle; diff --git a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h index 7af96458cc..720c07e4e7 100644 --- a/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h +++ b/src/plugins/coreplugin/themeeditor/themesettingstablemodel.h @@ -52,7 +52,7 @@ public: SectionWidgetStyle, SectionColors, SectionFlags, - SectionIconOverlays, + SectionImageFiles, SectionInvalid // end }; @@ -82,7 +82,7 @@ public: public: ThemeColors::Ptr m_colors; QList<QPair<QString, bool> > m_flags; - QList<QPair<QString, QString> > m_iconOverlays; + QList<QPair<QString, QString> > m_imageFiles; Utils::Theme::WidgetStyle m_widgetStyle; bool m_hasChanges; }; diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index d31b279d46..e5d21bdd33 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -105,9 +105,15 @@ public: addHoverHandler(new CppHoverHandler); if (!Utils::HostOsInfo::isMacHost() && !Utils::HostOsInfo::isWindowsHost()) { - FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CppSourceMimetype).toLatin1().data(), Constants::CPP_SOURCE_MIMETYPE); - FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CSourceMimetype).toLatin1().data(), Constants::C_SOURCE_MIMETYPE); - FileIconProvider::registerIconOverlayForMimeType(creatorTheme()->iconOverlay(Theme::CppHeaderMimetype).toLatin1().data(), Constants::CPP_HEADER_MIMETYPE); + FileIconProvider::registerIconOverlayForMimeType( + QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppSource, QLatin1String(":/cppeditor/images/qt_cpp.png"))), + Constants::CPP_SOURCE_MIMETYPE); + FileIconProvider::registerIconOverlayForMimeType( + QIcon(creatorTheme()->imageFile(Theme::IconOverlayCSource, QLatin1String(":/cppeditor/images/qt_c.png"))), + Constants::C_SOURCE_MIMETYPE); + FileIconProvider::registerIconOverlayForMimeType( + QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppHeader, QLatin1String(":/cppeditor/images/qt_h.png"))), + Constants::CPP_HEADER_MIMETYPE); } } }; diff --git a/src/plugins/qmakeprojectmanager/profileeditor.cpp b/src/plugins/qmakeprojectmanager/profileeditor.cpp index 0b5ae42613..b183f685ed 100644 --- a/src/plugins/qmakeprojectmanager/profileeditor.cpp +++ b/src/plugins/qmakeprojectmanager/profileeditor.cpp @@ -224,9 +224,13 @@ ProFileEditorFactory::ProFileEditorFactory() addHoverHandler(new ProFileHoverHandler(keywords)); setSyntaxHighlighterCreator([keywords]() { return new ProFileHighlighter(keywords); }); - Core::FileIconProvider::registerIconOverlayForSuffix(creatorTheme()->iconOverlay(Theme::ProMimetype).toLatin1().data(), "pro"); - Core::FileIconProvider::registerIconOverlayForSuffix(creatorTheme()->iconOverlay(Theme::PriMimetype).toLatin1().data(), "pri"); - Core::FileIconProvider::registerIconOverlayForSuffix(creatorTheme()->iconOverlay(Theme::PrfMimetype).toLatin1().data(), "prf"); + const QString defaultOverlay = QLatin1String(QtSupport::Constants::ICON_QT_PROJECT); + Core::FileIconProvider::registerIconOverlayForSuffix( + creatorTheme()->imageFile(Theme::IconOverlayPro, defaultOverlay).toLatin1().data(), "pro"); + Core::FileIconProvider::registerIconOverlayForSuffix( + creatorTheme()->imageFile(Theme::IconOverlayPri, defaultOverlay).toLatin1().data(), "pri"); + Core::FileIconProvider::registerIconOverlayForSuffix( + creatorTheme()->imageFile(Theme::IconOverlayPrf, defaultOverlay).toLatin1().data(), "prf"); } } // namespace Internal diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 085ce968d4..49f4091b78 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -84,27 +84,28 @@ struct FileTypeDataStorage { ProjectExplorer::FileType type; const char *typeName; const char *icon; + Theme::ImageFile themeImage; }; static const FileTypeDataStorage fileTypeDataStorage[] = { { ProjectExplorer::HeaderType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Headers"), - ":/qmakeprojectmanager/images/headers.png" }, + ":/qmakeprojectmanager/images/headers.png", Theme::ProjectExplorerHeader }, { ProjectExplorer::SourceType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Sources"), - ":/qmakeprojectmanager/images/sources.png" }, + ":/qmakeprojectmanager/images/sources.png", Theme::ProjectExplorerSource }, { ProjectExplorer::FormType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Forms"), - ":/qtsupport/images/forms.png" }, + ":/qtsupport/images/forms.png", Theme::ProjectExplorerForm }, { ProjectExplorer::ResourceType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Resources"), - ":/qtsupport/images/qt_qrc.png" }, + ":/qtsupport/images/qt_qrc.png", Theme::ProjectExplorerResource }, { ProjectExplorer::QMLType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "QML"), - ":/qtsupport/images/qml.png" }, + ":/qtsupport/images/qml.png", Theme::ProjectExplorerQML }, { ProjectExplorer::UnknownFileType, QT_TRANSLATE_NOOP("QmakeProjectManager::QmakePriFileNode", "Other files"), - ":/qmakeprojectmanager/images/unknown.png" } + ":/qmakeprojectmanager/images/unknown.png", Theme::ProjectExplorerOtherFiles } }; class SortByPath @@ -153,8 +154,8 @@ QmakeNodeStaticData::QmakeNodeStaticData() for (unsigned i = 0 ; i < count; ++i) { QIcon overlayIcon; - QString iconFile = QString::fromLatin1(fileTypeDataStorage[i].icon); - iconFile = creatorTheme()->imageFile(iconFile); + const QString iconFile = creatorTheme()->imageFile(fileTypeDataStorage[i].themeImage, + QString::fromLatin1(fileTypeDataStorage[i].icon)); overlayIcon = QIcon(iconFile); const QPixmap folderPixmap = Core::FileIconProvider::overlayIcon(QStyle::SP_DirIcon, @@ -166,8 +167,9 @@ QmakeNodeStaticData::QmakeNodeStaticData() desc, folderIcon)); } // Project icon - const QLatin1String fname(":/qtsupport/images/qt_project.png"); - const QIcon projectBaseIcon(creatorTheme()->imageFile(fname)); + const QString fileName = creatorTheme()->imageFile(Theme::ProjectFileIcon, + QLatin1String(":/qtsupport/images/qt_project.png")); + const QIcon projectBaseIcon(fileName); const QPixmap projectPixmap = Core::FileIconProvider::overlayIcon(QStyle::SP_DirIcon, projectBaseIcon, desiredSize); diff --git a/src/plugins/qtsupport/qtsupportconstants.h b/src/plugins/qtsupport/qtsupportconstants.h index dae80d1012..343d6865aa 100644 --- a/src/plugins/qtsupport/qtsupportconstants.h +++ b/src/plugins/qtsupport/qtsupportconstants.h @@ -100,7 +100,6 @@ const char IOS_PLATFORM_TR[] = QT_TRANSLATE_NOOP("QtSupport", "iOS"); const char QML_WIZARD_ICON[] = ":/qmlproject/images/qml_wizard.png"; const char ICON_QT_PROJECT[] = ":/qtsupport/images/qt_project.png"; -const char DARK_ICON_QT_PROJECT[] = ":/qtsupport/images/dark_qt_project.png"; } // namepsace Constants } // namepsace QtSupport |