Sayonara Player
Namespaces | Classes | Typedefs | Enumerations | Functions
Util Namespace Reference

Helper functions. More...

Namespaces

 File
 FileUtils functions.
 
 Language
 language namespace
 

Classes

class  Image
 The Image class. More...
 
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...
 

Typedefs

using Extensions = uint16_t
 

Enumerations

enum  SaveAsAnswer {
  Success,
  InvalidName,
  NotStorable,
  NameAlreadyThere,
  InvalidObject,
  OtherError
}
 
enum  Extension {
  Soundfile =1<<0,
  Playlist =1<<1,
  Podcast =1<<2,
  Haltdeimaul =1<<3
}
 

Functions

template<typename TINT , typename T >
std::enable_if< std::is_pointer< T >::value, bool >::type between (TINT idx, const T &cont)
 
template<typename TINT , typename T >
std::enable_if< std::is_class< T >::value, bool >::type between (TINT idx, const T &cont)
 
template<typename TINT >
std::enable_if< std::is_integral< TINT >::value, bool >::type between (TINT idx, TINT max)
 
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, const QString &format)
 Convert milliseconds to string. More...
 
QString cvt_not_null (const QString &str)
 
QString sayonara_path ()
 get sayonara path in home directory More...
 
QString sayonara_path (const QString &append_path)
 
QString share_path ()
 get share path of sayonara More...
 
QString share_path (const QString &append_path)
 
QString lib_path ()
 get library path of sayonara More...
 
QString lib_path (const QString &append_path)
 
QString create_link (const QString &name, bool dark=true, bool underline=true)
 create a link string More...
 
QString create_link (const QString &name, bool dark, bool underline, const QString &target)
 
QStringList soundfile_extensions (bool with_asterisk=true)
 get all supported sound file extensions More...
 
QString soundfile_filter ()
 get filter for file reader or file chooser 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)
 
QString get_file_filter (Extensions extensions, const QString &name)
 get filter for file chooser dialog based on extensions More...
 
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)
 
QString get_environment (const char *key)
 

Detailed Description

Helper functions.

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,
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,
const QString &  format 
)

Convert milliseconds to string.

Parameters
msecmilliseconds
format$Dfor days, $H for hours, $M for minutes $S for secods, A little 'e' behind the number will result in the unit displayed after the string
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

◆ get_file_filter()

QString Util::get_file_filter ( Extensions  extensions,
const QString &  name 
)

get filter for file chooser dialog based on extensions

Parameters
extensionsdisjunction of Extension
namename that should appear in the file dialog
Returns
concatenated list of extensions

◆ ip_addresses()

QStringList Util::ip_addresses ( )

get all ip addresses of the host

Returns
list of ip addresses

◆ lib_path()

QString Util::lib_path ( )

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 ( )

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 ( )

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

◆ soundfile_filter()

QString Util::soundfile_filter ( )

get filter for file reader or file chooser

Returns