Sayonara Player
Helper.h
1 /* Helper.h */
2 
3 /* Copyright (C) 2011-2016 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 
29 #ifndef _HELPER_H
30 #define _HELPER_H
31 
32 #include <QDir>
33 #include <QUrl>
34 #include <QCryptographicHash>
35 #include <QFile>
36 #include <QFontMetrics>
37 #include <QFileInfo>
38 #include <QMap>
39 
40 class MetaData;
45 namespace Helper {
46 
47  class StringDummy : public QObject
48  {
49  Q_OBJECT
50 
51  public:
52  StringDummy(QObject* parent=nullptr) :
53  QObject(parent)
54  {
55 
56  }
57 
58  QString various();
59  QString days();
60  QString hours();
61  QString minutes();
62  QString seconds();
63  QString disc();
64  QString discs();
65  };
66 
67 
68 
74  QString cvt_str_to_first_upper(const QString& str);
75 
81  QString cvt_str_to_very_first_upper(const QString& str);
82 
91  QString cvt_ms_to_string(quint64 msec, bool empty_zero = false, bool colon=true, bool show_days=true);
92 
93 
94 
99  QString get_error_file();
100 
105  QString get_sayonara_path();
106 
111  QString get_share_path();
112 
117  QString get_lib_path();
118 
126  QString create_link(const QString& name,
127  bool dark=true,
128  const QString& target="",
129  bool underline=true);
130 
131 
136  QStringList get_soundfile_extensions();
137 
142  QStringList get_playlistfile_extensions();
143 
148  QStringList get_podcast_extensions();
149 
150 
157  int get_random_number(int min, int max);
158 
159 
166  QString easy_tag_finder(const QString& tag, const QString& xml_doc);
167 
173  QByteArray calc_hash(const QByteArray& data);
174 
175 
176 
181  void sleep_ms(quint64 ms);
182 
187  QStringList get_ip_addresses();
188 
189 
195  void set_environment(const QString& key, const QString& value);
196 
197 }
198 
199 
200 
201 #endif
QString get_lib_path()
get library path of sayonara
QString get_sayonara_path()
get sayonara path in home directory
int get_random_number(int min, int max)
get a random val between min max
QStringList get_playlistfile_extensions()
get all supported playlist file extensions
QString create_link(const QString &name, bool dark=true, const QString &target="", bool underline=true)
create a link string
Definition: MetaData.h:49
QStringList get_soundfile_extensions()
get all supported sound file extensions
QString easy_tag_finder(const QString &tag, const QString &xml_doc)
gets value out of tag
QStringList get_podcast_extensions()
get all supported podcast file extensions
Helper functions.
Definition: FileHelper.h:29
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_error_file()
get error log file
Definition: Helper.h:47
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 get_share_path()
get share path of sayonara
QString cvt_str_to_very_first_upper(const QString &str)
Transform only first letter to upper case.