Sayonara Player
globals.h
1 /* globals.h */
2 
3 /* Copyright (C) 2012 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 #ifndef GLOBALS_H_
22 #define GLOBALS_H_
23 
24 #include <QObject>
25 #include <QString>
26 #include <QTime>
27 #include <QTranslator>
28 #include "Helper/Logger/Logger.h"
29 
30 #define SINGLETON_QOBJECT(class_name) protected: \
31  class_name (QObject* object=0); \
32  public: \
33  static class_name *getInstance() { static class_name instance; return &instance; } \
34  virtual ~class_name ();
35 
36 
37 #define SINGLETON(class_name) protected: \
38  class_name (); \
39  public: \
40  static class_name *getInstance() { static class_name instance; return &instance; } \
41  virtual ~class_name ();
42 
43 #define DARK_BLUE(x) QString("<font color=#0000FF>") + x + QString("</font>")
44 #define LIGHT_BLUE(x) QString("<font color=#8888FF>") + x + QString("</font>")
45 
46 #define CAR_RET QString("<br />")
47 #define BOLD(x) QString("<b>") + x + QString("</b>")
48 #define BLACK(x) QString("<font color=#000000>") + x + QString("</font>")
49 
50 
51 // name, target, dark, string
52 #define LINK(n, t, d, s) if(d) s=QString("<a href=\"t\">)") + LIGHT_BLUE(n) + QString("</a>"); \
53  else s=QString("<a href=\"t\">)") + DARK_BLUE(n) + QString("</a>");
54 
55 #define SAYONARA_ORANGE_STR QString("#e8841a")
56 #define SAYONARA_ORANGE_COL QColor(232, 132, 26)
57 
58 
59 #define PLUGIN_NUM 5
60 #define PLUGIN_NONE 0
61 #define PLUGIN_LFM_RADIO 1
62 #define PLUGIN_STREAM 2
63 #define PLUGIN_PODCASTS 3
64 #define PLUGIN_EQUALIZER 4
65 #define PLUGIN_PLAYLIST_CHOOSER 5
66 #define PLUGIN_LEVEL 6
67 /*
68 
69 #define PLUGIN_NAME_LFM_RADIO tr("Last.&fm")
70 #define PLUGIN_NAME_STREAM tr("&Stream")
71 #define PLUGIN_NAME_PODCASTS tr("P&odcasts")
72 #define PLUGIN_NAME_EQUALIZER tr("&Equalizer")
73 #define PLUGIN_NAME_PLAYLIST_CHOOSER tr("&PlaylistChooser")
74 */
75 
76 #define GOOGLE_IMG_ICON QString("icon")
77 #define GOOGLE_IMG_SMALL QString("small")
78 #define GOOGLE_IMG_MEDIUM QString("medium")
79 #define GOOGLE_IMG_LARGE QString("large")
80 #define GOOGLE_IMG_XLARGE QString("xlarge")
81 #define GOOGLE_IMG_XXLARGE QString("xxlarge")
82 #define GOOGLE_IMG_HUGE QString("huge")
83 
84 #define GOOGLE_FT_JPG QString("jpg")
85 #define GOOGLE_FT_PNG QString("png")
86 #define GOOGLE_FT_GIF QString("gif")
87 #define GOOGLE_FT_BMP QString("bmp")
88 
89 typedef QPair<QString, QString> StringPair;
90 typedef QList<int> IntList;
91 typedef QList<int> IDList;
92 typedef QList<int> IdxList;
93 typedef QList<bool> BoolList;
94 typedef qint32 ArtistID;
95 typedef qint32 AlbumID;
96 typedef qint32 TrackID;
97 
98 enum LameBitrate {
99 
100  LameBitrate_64=64,
101  LameBitrate_128=128,
102  LameBitrate_192=192,
103  LameBitrate_256=256,
104  LameBitrate_320=320,
105 
106  LameBitrate_var_0=0,
107  LameBitrate_var_1=1,
108  LameBitrate_var_2=2,
109  LameBitrate_var_3=3,
110  LameBitrate_var_4=4,
111  LameBitrate_var_5=5,
112  LameBitrate_var_6=6,
113  LameBitrate_var_7=7,
114  LameBitrate_var_8=8,
115  LameBitrate_var_9=9
116 };
117 
118 #define N_BINS 70
119 
120 #define MEASURE_TIME(x) QTime myTimer; \
121  myTimer.start(); \
122  { \
123  x \
124  } \
125  qDebug() << "Time: " << myTimer.elapsed();
126 
127 #define between(idx, start, size) ( idx >= start && idx < size)
128 
129 #endif /* GLOBALS_H_ */