Sayonara Player
Helper.h
1 /* Helper.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /*
22  * Helper.cpp
23  *
24  * Created on: Apr 4, 2011
25  * Author: Lucio Carreras
26  */
27 
28 #ifndef _HELPER_H
29 #define _HELPER_H
30 
31 #include <QObject>
32 
33 class QDateTime;
38 namespace Helper
39 {
40  quint64 current_date_to_int();
41  quint64 date_to_int(const QDateTime& date);
42 
48  QString cvt_str_to_first_upper(const QString& str);
49 
55  QString cvt_str_to_very_first_upper(const QString& str);
56 
65  QString cvt_ms_to_string(quint64 msec, bool empty_zero = false, bool colon=true, bool show_days=true);
66 
67 
72  QString get_sayonara_path(const QString& append_path=QString());
73 
78  QString get_share_path(const QString& append_path=QString());
79 
84  QString get_lib_path(const QString& append_path=QString());
85 
93  QString create_link(const QString& name,
94  bool dark=true,
95  const QString& target="",
96  bool underline=true);
97 
98 
103  QStringList get_soundfile_extensions(bool with_asterisk=true);
104 
109  QStringList get_playlistfile_extensions(bool with_asterisk=true);
110 
115  QStringList get_podcast_extensions(bool with_asterisk=true);
116 
117 
124  int get_random_number(int min, int max);
125 
126 
127  QString get_random_string(int max_chars);
128 
129 
136  QString easy_tag_finder(const QString& tag, const QString& xml_doc);
137 
143  QByteArray calc_hash(const QByteArray& data);
144 
145 
150  void sleep_ms(quint64 ms);
151 
156  QStringList get_ip_addresses();
157 
158 
164  void set_environment(const QString& key, const QString& value);
165 }
166 
167 #endif
int get_random_number(int min, int max)
get a random val between min max
QString create_link(const QString &name, bool dark=true, const QString &target="", bool underline=true)
create a link string
QString easy_tag_finder(const QString &tag, const QString &xml_doc)
gets value out of tag
QString get_sayonara_path(const QString &append_path=QString())
get sayonara path in home directory
QStringList get_playlistfile_extensions(bool with_asterisk=true)
get all supported playlist file extensions
QStringList get_podcast_extensions(bool with_asterisk=true)
get all supported podcast file extensions
Helper functions.
Definition: FileHelper.h:29
QString get_lib_path(const QString &append_path=QString())
get library path of sayonara
void set_environment(const QString &key, const QString &value)
set an environment variable. This function is platform independent
QStringList get_ip_addresses()
get all ip addresses of the host
void sleep_ms(quint64 ms)
sleep
QByteArray calc_hash(const QByteArray &data)
calculate a md5 hashsum
QString get_share_path(const QString &append_path=QString())
get share path of sayonara
QStringList get_soundfile_extensions(bool with_asterisk=true)
get all supported sound file extensions
QString cvt_str_to_first_upper(const QString &str)
Transform all letters after a space to upper case.
QString cvt_ms_to_string(quint64 msec, bool empty_zero=false, bool colon=true, bool show_days=true)
Convert milliseconds to string.
QString cvt_str_to_very_first_upper(const QString &str)
Transform only first letter to upper case.