Changeset View
Changeset View
Standalone View
Standalone View
src/kiconloader.h
Show First 20 Lines • Show All 238 Lines • ▼ Show 20 Line(s) | 82 | public: | |||
---|---|---|---|---|---|
239 | * @return the QPixmap. Can be null when not found, depending on | 239 | * @return the QPixmap. Can be null when not found, depending on | ||
240 | * @p canReturnNull. | 240 | * @p canReturnNull. | ||
241 | */ | 241 | */ | ||
242 | QPixmap loadIcon(const QString &name, KIconLoader::Group group, int size = 0, | 242 | QPixmap loadIcon(const QString &name, KIconLoader::Group group, int size = 0, | ||
243 | int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList(), | 243 | int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList(), | ||
244 | QString *path_store = nullptr, | 244 | QString *path_store = nullptr, | ||
245 | bool canReturnNull = false) const; | 245 | bool canReturnNull = false) const; | ||
246 | 246 | | |||
247 | /** | 247 | /** | ||
cfeck: FIXME | |||||
248 | * Loads an icon. It will try very hard to find an icon which is | ||||
249 | * suitable. If no exact match is found, a close match is searched. | ||||
250 | * If neither an exact nor a close match is found, a null pixmap or | ||||
251 | * the "unknown" pixmap is returned, depending on the value of the | ||||
252 | * @p canReturnNull parameter. | ||||
253 | * | ||||
254 | * @param name The name of the icon, without extension. | ||||
255 | * @param group The icon group. This will specify the size of and effects to | ||||
256 | * be applied to the icon. | ||||
257 | * @param scale The scale of the icon group to use. If no icon exists in the | ||||
258 | * scaled group, a 1x icon with its size multiplied by the scale will be | ||||
259 | * loaded instead. | ||||
260 | * @param size If nonzero, this overrides the size specified by @p group. | ||||
261 | * See KIconLoader::StdSizes. | ||||
262 | * @param state The icon state: @p DefaultState, @p ActiveState or | ||||
263 | * @p DisabledState. Depending on the user's preferences, the iconloader | ||||
264 | * may apply a visual effect to hint about its state. | ||||
265 | * @param overlays a list of emblem icons to overlay, by name | ||||
266 | * @see drawOverlays | ||||
267 | * @param path_store If not null, the path of the icon is stored here, | ||||
268 | * if the icon was found. If the icon was not found @p path_store | ||||
269 | * is unaltered even if the "unknown" pixmap was returned. | ||||
270 | * @param canReturnNull Can return a null pixmap? If false, the | ||||
271 | * "unknown" pixmap is returned when no appropriate icon has been | ||||
272 | * found. <em>Note:</em> a null pixmap can still be returned in the | ||||
273 | * event of invalid parameters, such as empty names, negative sizes, | ||||
274 | * and etc. | ||||
275 | * @return the QPixmap. Can be null when not found, depending on | ||||
276 | * @p canReturnNull. | ||||
277 | * @since 5.48 | ||||
278 | */ | ||||
279 | // TODO KF6 merge loadIcon() and loadScaledIcon() | ||||
280 | QPixmap loadScaledIcon(const QString &name, KIconLoader::Group group, qreal scale, int size = 0, | ||||
281 | int state = KIconLoader::DefaultState, const QStringList &overlays = QStringList(), | ||||
282 | QString *path_store = nullptr, | ||||
283 | bool canReturnNull = false) const; | ||||
284 | | ||||
285 | /** | ||||
248 | * Loads an icon for a mimetype. | 286 | * Loads an icon for a mimetype. | ||
249 | * This is basically like loadIcon except that extra desktop themes are loaded if necessary. | 287 | * This is basically like loadIcon except that extra desktop themes are loaded if necessary. | ||
250 | * | 288 | * | ||
251 | * @param iconName The name of the icon, without extension, usually from KMimeType. | 289 | * @param iconName The name of the icon, without extension, usually from KMimeType. | ||
252 | * @param group The icon group. This will specify the size of and effects to | 290 | * @param group The icon group. This will specify the size of and effects to | ||
253 | * be applied to the icon. | 291 | * be applied to the icon. | ||
254 | * @param size If nonzero, this overrides the size specified by @p group. | 292 | * @param size If nonzero, this overrides the size specified by @p group. | ||
255 | * See KIconLoader::StdSizes. | 293 | * See KIconLoader::StdSizes. | ||
Show All 13 Lines | |||||
269 | /** | 307 | /** | ||
270 | * Loads a pixmapSequence given the xdg icon name | 308 | * Loads a pixmapSequence given the xdg icon name | ||
271 | * | 309 | * | ||
272 | * @param iconName The name of the icon, without extension. | 310 | * @param iconName The name of the icon, without extension. | ||
273 | * @param size the size/group to be used | 311 | * @param size the size/group to be used | ||
274 | * @since 5.0 | 312 | * @since 5.0 | ||
275 | */ | 313 | */ | ||
276 | KPixmapSequence loadPixmapSequence(const QString &iconName, int size = SizeSmall) const; | 314 | KPixmapSequence loadPixmapSequence(const QString &iconName, int size = SizeSmall) const; | ||
277 | 315 | | |||
Next release is 5.47, but I am fine with waiting for additional feedback if this is controversial. cfeck: Next release is 5.47, but I am fine with waiting for additional feedback if this is… | |||||
278 | /** | 316 | /** | ||
279 | * Creates an icon set, that will do on-demand loading of the icon. | 317 | * Creates an icon set, that will do on-demand loading of the icon. | ||
cfeck: loadIcon("test", mygroup, 2);
Which overload is called? | |||||
broulik: Looks like it's always taking the one without `scale`. Meh. | |||||
280 | * Loading itself is done by calling loadIcon . | 318 | * Loading itself is done by calling loadIcon . | ||
281 | * | 319 | * | ||
282 | * @param name The name of the icon, without extension. | 320 | * @param name The name of the icon, without extension. | ||
283 | * @param group The icon group. This will specify the size of and effects to | 321 | * @param group The icon group. This will specify the size of and effects to | ||
284 | * be applied to the icon. | 322 | * be applied to the icon. | ||
285 | * @param size If nonzero, this overrides the size specified by @p group. | 323 | * @param size If nonzero, this overrides the size specified by @p group. | ||
286 | * See KIconLoader::StdSizes. | 324 | * See KIconLoader::StdSizes. | ||
287 | * @param canReturnNull Can return a null iconset? If false, iconset | 325 | * @param canReturnNull Can return a null iconset? If false, iconset | ||
Show All 22 Lines | 336 | #endif | |||
310 | * "unknown" icon will be returned. | 348 | * "unknown" icon will be returned. | ||
311 | * @return the path of an icon, can be null or the "unknown" icon when | 349 | * @return the path of an icon, can be null or the "unknown" icon when | ||
312 | * not found, depending on @p canReturnNull. | 350 | * not found, depending on @p canReturnNull. | ||
313 | */ | 351 | */ | ||
314 | QString iconPath(const QString &name, int group_or_size, | 352 | QString iconPath(const QString &name, int group_or_size, | ||
315 | bool canReturnNull = false) const; | 353 | bool canReturnNull = false) const; | ||
316 | 354 | | |||
317 | /** | 355 | /** | ||
356 | * Returns the path of an icon. | ||||
357 | * @param name The name of the icon, without extension. If an absolute | ||||
358 | * path is supplied for this parameter, iconPath will return it | ||||
359 | * directly. | ||||
360 | * @param group_or_size If positive, search icons whose size is | ||||
361 | * specified by the icon group @p group_or_size. If negative, search | ||||
362 | * icons whose size is - @p group_or_size. | ||||
363 | * See KIconLoader::Group and KIconLoader::StdSizes | ||||
364 | * @param canReturnNull Can return a null string? If not, a path to the | ||||
365 | * "unknown" icon will be returned. | ||||
366 | * @param scale The scale of the icon group. | ||||
367 | * @return the path of an icon, can be null or the "unknown" icon when | ||||
368 | * not found, depending on @p canReturnNull. | ||||
369 | * @since 5.48 | ||||
370 | */ | ||||
371 | // TODO KF6 merge iconPath() with and without "scale" and move that argument after "group_or_size" | ||||
372 | QString iconPath(const QString &name, int group_or_size, | ||||
373 | bool canReturnNull, qreal scale) const; | ||||
374 | | ||||
375 | /** | ||||
318 | * Loads an animated icon. | 376 | * Loads an animated icon. | ||
319 | * @param name The name of the icon. | 377 | * @param name The name of the icon. | ||
320 | * @param group The icon group. See loadIcon(). | 378 | * @param group The icon group. See loadIcon(). | ||
321 | * @param size Override the default size for @p group. | 379 | * @param size Override the default size for @p group. | ||
322 | * See KIconLoader::StdSizes. | 380 | * See KIconLoader::StdSizes. | ||
323 | * @param parent The parent object of the returned QMovie. | 381 | * @param parent The parent object of the returned QMovie. | ||
324 | * @return A QMovie object. Can be null if not found or not valid. | 382 | * @return A QMovie object. Can be null if not found or not valid. | ||
325 | * Ownership is passed to the caller. | 383 | * Ownership is passed to the caller. | ||
▲ Show 20 Lines • Show All 135 Lines • ▼ Show 20 Line(s) | |||||
461 | bool hasIcon(const QString &iconName) const; | 519 | bool hasIcon(const QString &iconName) const; | ||
462 | 520 | | |||
463 | /** | 521 | /** | ||
464 | * Sets the colors for this KIconLoader. | 522 | * Sets the colors for this KIconLoader. | ||
465 | * NOTE: if you set a custom palette, if you are using some colors from | 523 | * NOTE: if you set a custom palette, if you are using some colors from | ||
466 | * application's palette, you need to track the application palette changes by yourself. | 524 | * application's palette, you need to track the application palette changes by yourself. | ||
467 | * If you no longer wish to use a custom palette, use resetPalette() | 525 | * If you no longer wish to use a custom palette, use resetPalette() | ||
468 | * @see resetPalette | 526 | * @see resetPalette | ||
469 | * @since 5.39 | 527 | * @since 5.39 | ||
Is this missing a rebase or intended? See https://cgit.kde.org/kiconthemes.git/commit/?id=b506a48214a08f56d79e7847a22b0417028a46ff cfeck: Is this missing a rebase or intended? See https://cgit.kde.org/kiconthemes.git/commit/? | |||||
470 | */ | 528 | */ | ||
471 | void setCustomPalette(const QPalette &palette); | 529 | void setCustomPalette(const QPalette &palette); | ||
472 | 530 | | |||
473 | /** | 531 | /** | ||
474 | * The colors that will be used for the svg stylesheet in case the | 532 | * The colors that will be used for the svg stylesheet in case the | ||
475 | * loaded icons are svg-based, icons can be colored in different ways in | 533 | * loaded icons are svg-based, icons can be colored in different ways in | ||
476 | * different areas of the application | 534 | * different areas of the application | ||
477 | * @return the palette, if any, an invalid one if the user didn't set it | 535 | * @return the palette, if any, an invalid one if the user didn't set it | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |
FIXME