Sayonara Player
Namespaces | Classes | Functions
Util Namespace Reference

Detailed Description

Helper functions.

Namespaces

 File
 FileUtils functions.
 

Classes

class  Image
 
class  Set
 A set structure. Inherited from std::set with some useful methods. For integer and String this set is ordered. More...
 
class  Tree
 The Tree class. More...
 

Functions

uint64_t current_date_to_int ()
 
uint64_t date_to_int (const QDateTime &date)
 
QDateTime int_to_date (uint64_t date)
 
QString cvt_str_to_first_upper (const QString &str)
 Transform all letters after a space to upper case. More...
 
QString cvt_str_to_very_first_upper (const QString &str)
 Transform only first letter to upper case. More...
 
QString cvt_ms_to_string (MilliSeconds msec, bool empty_zero=false, bool colon=true, bool show_days=true)
 Convert milliseconds to string. More...
 
QString cvt_not_null (const QString &str)
 
QString sayonara_path (const QString &append_path=QString())
 get sayonara path in home directory More...
 
QString share_path (const QString &append_path=QString())
 get share path of sayonara More...
 
QString lib_path (const QString &append_path=QString())
 get library path of sayonara More...
 
QString create_link (const QString &name, bool dark=true, const QString &target="", bool underline=true)
 create a link string More...
 
QStringList soundfile_extensions (bool with_asterisk=true)
 get all supported sound file extensions More...
 
QStringList playlist_extensions (bool with_asterisk=true)
 get all supported playlist file extensions More...
 
QStringList podcast_extensions (bool with_asterisk=true)
 get all supported podcast file extensions More...
 
QStringList image_extensions (bool with_asterisk=true)
 
int random_number (int min, int max)
 get a random val between min max More...
 
QString random_string (int max_chars)
 
QString easy_tag_finder (const QString &tag, const QString &xml_doc)
 gets value out of tag More...
 
QByteArray calc_hash (const QByteArray &data)
 calculate a md5 hashsum More...
 
void sleep_ms (uint64_t ms)
 sleep More...
 
QStringList ip_addresses ()
 get all ip addresses of the host More...
 
QByteArray cvt_pixmap_to_bytearray (const QPixmap &pm)
 
QPixmap cvt_bytearray_to_pixmap (const QByteArray &arr)
 
void set_environment (const QString &key, const QString &value)
 set an environment variable. This function is platform independent More...
 
void unset_environment (const QString &key)
 
template<typename T , typename FN >
bool contains (const T &container, FN fn)
 
template<typename T , typename FN >
void sort (T &container, FN fn)
 
template<typename T , typename FN >
T::iterator find (T &container, FN fn)
 
template<typename T , typename FN >
T::const_iterator find (const T &container, FN fn)
 
template<typename T >
constexpr std::add_const< T >::type & AsConst (T &t)
 
template<typename T , typename FN >
int indexOf (const T &container, FN fn)
 

Function Documentation

◆ calc_hash()

QByteArray Util::calc_hash ( const QByteArray &  data)

calculate a md5 hashsum

Parameters
datainput data
Returns
hashsum

◆ create_link()

QString Util::create_link ( const QString &  name,
bool  dark = true,
const QString &  target = "",
bool  underline = true 
)

create a link string

Parameters
nameappearing name in link
targettarget url (if not given, name is taken)
underlineif link should be underlined
Returns
link string

◆ cvt_ms_to_string()

QString Util::cvt_ms_to_string ( MilliSeconds  msec,
bool  empty_zero = false,
bool  colon = true,
bool  show_days = true 
)

Convert milliseconds to string.

Parameters
msecmilliseconds
empty_zeroif false, prepend a zero to numbers < 10
colonif true, set colon between minutes and seconds
show_daysif true, days will be shown, too
Returns
converted milliseconds

◆ cvt_str_to_first_upper()

QString Util::cvt_str_to_first_upper ( const QString &  str)

Transform all letters after a space to upper case.

Parameters
strinput string
Returns
result string

◆ cvt_str_to_very_first_upper()

QString Util::cvt_str_to_very_first_upper ( const QString &  str)

Transform only first letter to upper case.

Parameters
strinput string
Returns
result string

◆ easy_tag_finder()

QString Util::easy_tag_finder ( const QString &  tag,
const QString &  xml_doc 
)

gets value out of tag

Parameters
tagform: grandparent.parent.child
xml_doccontent of the xml document
Returns
extracted string

◆ ip_addresses()

QStringList Util::ip_addresses ( )

get all ip addresses of the host

Returns
list of ip addresses

◆ lib_path()

QString Util::lib_path ( const QString &  append_path = QString())

get library path of sayonara

Returns
./lib on windows, lib path of unix system

◆ playlist_extensions()

QStringList Util::playlist_extensions ( bool  with_asterisk = true)

get all supported playlist file extensions

Returns

◆ podcast_extensions()

QStringList Util::podcast_extensions ( bool  with_asterisk = true)

get all supported podcast file extensions

Returns

◆ random_number()

int Util::random_number ( int  min,
int  max 
)

get a random val between min max

Parameters
minminimum included value
maxmaximum included value
Returns
random number

◆ sayonara_path()

QString Util::sayonara_path ( const QString &  append_path = QString())

get sayonara path in home directory

Returns

◆ set_environment()

void Util::set_environment ( const QString &  key,
const QString &  value 
)

set an environment variable. This function is platform independent

Parameters
keyvariable name
valuevariable value

◆ share_path()

QString Util::share_path ( const QString &  append_path = QString())

get share path of sayonara

Returns
./share on windows, share path of unix system

◆ sleep_ms()

void Util::sleep_ms ( uint64_t  ms)

sleep

Parameters
msmilliseconds to sleep

◆ soundfile_extensions()

QStringList Util::soundfile_extensions ( bool  with_asterisk = true)

get all supported sound file extensions

Returns