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;
41 class QDateTime;
46 namespace Helper {
47 
48  class StringDummy : public QObject
49  {
50  Q_OBJECT
51 
52  public:
53  StringDummy(QObject* parent=nullptr) :
54  QObject(parent)
55  {
56 
57  }
58 
59  QString various();
60  QString days();
61  QString hours();
62  QString minutes();
63  QString seconds();
64  QString disc();
65  QString discs();
66  };
67 
68  quint64 current_date_to_int();
69  quint64 date_to_int(const QDateTime& date);
70 
76  QString cvt_str_to_first_upper(const QString& str);
77 
83  QString cvt_str_to_very_first_upper(const QString& str);
84 
93  QString cvt_ms_to_string(quint64 msec, bool empty_zero = false, bool colon=true, bool show_days=true);
94 
95 
96 
101  QString get_error_file();
102 
107  QString get_sayonara_path();
108 
113  QString get_share_path();
114 
119  QString get_lib_path();
120 
128  QString create_link(const QString& name,
129  bool dark=true,
130  const QString& target="",
131  bool underline=true);
132 
133 
138  QStringList get_soundfile_extensions();
139 
144  QStringList get_playlistfile_extensions();
145 
150  QStringList get_podcast_extensions();
151 
152 
159  int get_random_number(int min, int max);
160 
161 
168  QString easy_tag_finder(const QString& tag, const QString& xml_doc);
169 
175  QByteArray calc_hash(const QByteArray& data);
176 
177 
178 
183  void sleep_ms(quint64 ms);
184 
189  QStringList get_ip_addresses();
190 
191 
197  void set_environment(const QString& key, const QString& value);
198 
199 }
200 
201 
202 
203 #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:48
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.