Albert
Loading...
Searching...
No Matches
albert::detail Namespace Reference

Albert private namespace. More...

Classes

class  DesktopEntryParser
 Desktop entry parser http://standards.freedesktop.org/desktop-entry-spec/latest/. More...
 
class  DynamicItem
 
class  Frontend
 The interface for albert frontends. More...
 
class  RateLimiter
 Blocks execution. More...
 
class  TelemetryProvider
 
struct  TimeIt
 

Functions

QPixmap pixmapFromUrl (const QString &url, const QSize &requestedSize)
 URL based icon factory.
 
QPixmap pixmapFromUrls (const QStringList &urls, const QSize &requestedSize)
 URL list based icon factory.
 
QIcon iconFromUrl (const QString &url)
 URL based icon factory.
 
QIcon iconFromUrls (const QStringList &urls)
 URL list based icon factory.
 
QPixmap genericPixmap (int size, const QColor &bgcolor={}, const QColor &fgcolor=Qt::black, const QString &text={}, float scalar=1.)
 Generic pixmap factory.
 
QIcon genericIcon (const QColor &bgcolor={}, const QColor &fgcolor=Qt::black, const QString &text={}, float scalar=1.)
 Generic icon factory.
 
QIcon fileIcon (const QString &path)
 Create an icon for a file using QFileIconProvider.
 

Detailed Description

Albert private namespace.

Function Documentation

◆ fileIcon()

QIcon albert::detail::fileIcon ( const QString &  path)

Create an icon for a file using QFileIconProvider.

Parameters
pathThe path to the file.
Returns
The file icon.

◆ genericIcon()

QIcon albert::detail::genericIcon ( const QColor &  bgcolor = {},
const QColor &  fgcolor = Qt::black,
const QString &  text = {},
float  scalar = 1. 
)

Generic icon factory.

Supports drawing a background circle with some text on it.

Parameters
bgcolorThe background color. Default: none.
fgcolorThe text color. Default: black.
textThe text to display. Default: empty.
scalarScalar for the default font size which is the pixmap height. Default: 1.
Returns
The generic pixmap.

◆ genericPixmap()

QPixmap albert::detail::genericPixmap ( int  size,
const QColor &  bgcolor = {},
const QColor &  fgcolor = Qt::black,
const QString &  text = {},
float  scalar = 1. 
)

Generic pixmap factory.

Supports drawing a background circle with some text on it.

Parameters
bgcolorThe background color. Default: none.
fgcolorThe text color. Default: black.
textThe text to display. Default: empty.
scalarScalar for the default font size which is the pixmap height. Default: 1.
Returns
The generic icon.

◆ iconFromUrl()

QIcon albert::detail::iconFromUrl ( const QString &  url)

URL based icon factory.

Parameters
urlThe icon URL.
Returns
The icon, if available, null icon otherwise.

◆ iconFromUrls()

QIcon albert::detail::iconFromUrls ( const QStringList urls)

URL list based icon factory.

See iconFromUrl(const QString &url).

Parameters
urlsThe icon URLs.
Returns
The first icon available in the urls list. Null icon otherwise.

◆ pixmapFromUrl()

QPixmap albert::detail::pixmapFromUrl ( const QString &  url,
const QSize &  requestedSize 
)

URL based icon factory.

Supported URL schemes:

  • <path> or
  • file:<path> Use the file at path as icon.
  • :<path> or
  • qrc:<path> Use the file at path in the resource collection as icon.
  • qfip:<path> Uses fileIcon(const QString &path)
  • qsp:<pixmap enumerator> Get an icon from QStyle::StandardPixmap enum.
  • xdg:<icon name> Uses xdgIconLookup(const QString &name);
  • gen:<> Uses genericPixmapFactory. See also QColor::fromString.
  • mask:?src=&radius= Masks a given icon url.
  • comp:?src1=<>&src2=<> Composes two given icons.

Examples

/absolute/path/to/a/local/image/file.png
file:/absolute/path/to/a/local/image/file.png
:path-to-a-qresource-file
qrc:path-to-a-qresource-file
qfip:/path/to/any/file/for/example/a.pdf
qsp:SP_TrashIcon
xdg:some-themed-icon-name
gen:?background=blue&foreground=red&text=Hi&fontscalar=0.5
Parameters
urlThe icon URL.
requestedSizeThe size the pixmap should have if possible.
Returns
The pixmap, if available, null pixmap otherwise. The size can be smaller than requestedSize, but is never larger.

◆ pixmapFromUrls()

QPixmap albert::detail::pixmapFromUrls ( const QStringList urls,
const QSize &  requestedSize 
)

URL list based icon factory.

See pixmapFromUrl(const QString &url, QSize *size, const QSize &requestedSize).

Parameters
urlsThe icon URLs.
requestedSizeThe size the pixmap should have if possible.
Returns
The first pixmap available in the urls list. Null pixmap otherwise.