Commit b782b98f authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Core: Use QString in FileIconProvider API



Prefer "const QString &" over "const char *" in the API of FileIconProvider.

That makes no more sense, now that we no longer need QLatin1String around char arrays.

Change-Id: Iaf4af25d6e3b96529586032113297754d6c9d74e
Reviewed-by: Tim Jenssen's avatarTim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent b72d579e
......@@ -191,35 +191,32 @@ QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlay, const
Registers an icon for a given suffix, overlaying the system file icon.
See platform note in class documentation about recommended usage.
*/
void registerIconOverlayForSuffix(const char *path, const char *suffix)
void registerIconOverlayForSuffix(const QString &path, const QString &suffix)
{
instance()->registerIconOverlayForSuffix(QIcon(QLatin1String(path)), QLatin1String(suffix));
instance()->registerIconOverlayForSuffix(QIcon(path), suffix);
}
/*!
Registers an icon for all the suffixes of a given mime type, overlaying the system file icon.
*/
void registerIconOverlayForMimeType(const QIcon &icon, const char *mimeType)
void registerIconOverlayForMimeType(const QIcon &icon, const QString &mimeType)
{
Utils::MimeDatabase mdb;
instance()->registerIconOverlayForMimeType(icon,
mdb.mimeTypeForName(QString::fromLatin1(mimeType)));
instance()->registerIconOverlayForMimeType(icon, mdb.mimeTypeForName(mimeType));
}
/*!
* \overload
*/
void registerIconOverlayForMimeType(const char *path, const char *mimeType)
void registerIconOverlayForMimeType(const QString &path, const QString &mimeType)
{
Utils::MimeDatabase mdb;
instance()->registerIconOverlayForMimeType(QIcon(QLatin1String(path)),
mdb.mimeTypeForName(QString::fromLatin1(mimeType)));
instance()->registerIconOverlayForMimeType(QIcon(path), mdb.mimeTypeForName(mimeType));
}
void registerIconOverlayForFilename(const char *path, const char *filename)
void registerIconOverlayForFilename(const QString &path, const QString &filename)
{
instance()->registerIconOverlayForFilename(QIcon(QString::fromLatin1(path)),
QString::fromLatin1(filename));
instance()->registerIconOverlayForFilename(QIcon(path), filename);
}
} // namespace FileIconProvider
......
......@@ -44,10 +44,10 @@ CORE_EXPORT QIcon icon(QFileIconProvider::IconType type);
// Register additional overlay icons
CORE_EXPORT QPixmap overlayIcon(const QPixmap &baseIcon, const QIcon &overlayIcon);
CORE_EXPORT QPixmap overlayIcon(QStyle::StandardPixmap baseIcon, const QIcon &overlayIcon, const QSize &size);
CORE_EXPORT void registerIconOverlayForSuffix(const char *path, const char *suffix);
CORE_EXPORT void registerIconOverlayForFilename(const char *path, const char *filename);
CORE_EXPORT void registerIconOverlayForMimeType(const char *path, const char *mimeType);
CORE_EXPORT void registerIconOverlayForMimeType(const QIcon &icon, const char *mimeType);
CORE_EXPORT void registerIconOverlayForSuffix(const QString &path, const QString &suffix);
CORE_EXPORT void registerIconOverlayForFilename(const QString &path, const QString &filename);
CORE_EXPORT void registerIconOverlayForMimeType(const QString &path, const QString &mimeType);
CORE_EXPORT void registerIconOverlayForMimeType(const QIcon &icon, const QString &mimeType);
} // namespace FileIconProvider
} // namespace Core
......@@ -195,11 +195,11 @@ ProFileEditorFactory::ProFileEditorFactory()
const QString defaultOverlay = QLatin1String(ProjectExplorer::Constants::FILEOVERLAY_QT);
Core::FileIconProvider::registerIconOverlayForSuffix(
creatorTheme()->imageFile(Theme::IconOverlayPro, defaultOverlay).toLatin1().data(), "pro");
creatorTheme()->imageFile(Theme::IconOverlayPro, defaultOverlay), "pro");
Core::FileIconProvider::registerIconOverlayForSuffix(
creatorTheme()->imageFile(Theme::IconOverlayPri, defaultOverlay).toLatin1().data(), "pri");
creatorTheme()->imageFile(Theme::IconOverlayPri, defaultOverlay), "pri");
Core::FileIconProvider::registerIconOverlayForSuffix(
creatorTheme()->imageFile(Theme::IconOverlayPrf, defaultOverlay).toLatin1().data(), "prf");
creatorTheme()->imageFile(Theme::IconOverlayPrf, defaultOverlay), "prf");
}
} // namespace Internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment