Remoto - VFS: VFS_icons Class Reference
Remoto - VFS

Icons for general use. More...

#include <VFS_icons.h>

Static Public Member Functions

static char * get (QString which="")
 Fetch an icon from the library. More...
 

Static Private Member Functions

static void initialize ()
 Initialize the icon library. More...
 

Static Private Attributes

static QMap< QString, char * > _icons
 The icon library map. More...
 
static bool _initialized = false
 The initialization state of the icon library. More...
 
static QMutex _initializeMutex
 An initialize locker... needed because icons may be requested by multiple threads before initialization has completed. More...
 

Detailed Description

Icons for general use.

Icons are returned as either inline SVG or base64-encoded strings with a mime prefix suitable for use in a web browser. This string can be directly placed in the 'src' field of an image tag or css field.

There are many websites that offer pre-built svg icons, for instance: https://www.flaticon.com

When icons are downloaded, it's best to optimize and minimize the icon using a tool like svgo, which can be found here: https://github.com/svg/svgo .

All of the icons in the standard VFS_icons library are raw inline SVG, not base64-encoded.

Definition at line 7 of file VFS_icons.h.

Member Function Documentation

◆ get()

char * VFS_icons::get ( QString  which = "")
static

Fetch an icon from the library.

Parameters
whichAn icon's name, as a string. Defaults to an empty string, which will return a default document icon.
Returns
An SVG or base64-encoded string of image data, prefixed with a mime type.

If a name is unknown, a default icon will be returned.

Definition at line 34 of file VFS_icons.cpp.

◆ initialize()

void VFS_icons::initialize ( )
staticprivate

Initialize the icon library.

This method uses a blocking mutex to ensure thread safety.

To view the default list, please browse the source code.

Note
When providing an icon as an inline data source, Firefox will not support inline colors like #FFFFFF, because it will interpret the # as a url fragment/anchor. The remedy is to use a named color like white or the longer syntax rgb(1.0,1.0,1.0).

Definition at line 60 of file VFS_icons.cpp.

Member Data Documentation

◆ _icons

QMap< QString, char * > VFS_icons::_icons
staticprivate

The icon library map.

Definition at line 15 of file VFS_icons.h.

◆ _initialized

bool VFS_icons::_initialized = false
staticprivate

The initialization state of the icon library.

Definition at line 13 of file VFS_icons.h.

◆ _initializeMutex

QMutex VFS_icons::_initializeMutex
staticprivate

An initialize locker... needed because icons may be requested by multiple threads before initialization has completed.

Definition at line 14 of file VFS_icons.h.


The documentation for this class was generated from the following files: