2
* \file importselector.h
3
* Import selector widget.
10
#ifndef IMPORTSELECTOR_H
11
#define IMPORTSELECTOR_H
15
#include <qstringlist.h>
27
* Import selector widget.
29
class ImportSelector : public QVBox
34
/** Import destinations */
35
enum Destination { DestV1, DestV2 };
40
* @param parent parent widget
42
* @param f window flags
44
ImportSelector(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
50
* Look for album specific information (artist, album, year, genre) in
51
* a header (e.g. in a freedb header).
53
* @param st standard tags to put resulting values in,
54
* fields which are not found are not touched.
56
* @return true if one or more field were found.
58
bool parseHeader(StandardTags &st);
60
* Get next line as standardtags from imported file or clipboard.
62
* @param st standard tags
63
* @param start true to start with the first line, false for all
66
* @return true if ok (result in st),
67
* false if end of file reached.
69
bool getNextTags(StandardTags &st, bool start);
71
* Set ID3v1 or ID3v2 tags as import destination.
73
* @param dest DestV1 or DestV2 for ID3v1 or ID3v2
75
void setDestination(ImportSelector::Destination dest);
77
* Get import destination.
79
* @return DestV1 or DestV2 for ID3v1 or ID3v2.
81
Destination getDestination();
83
* Set import format regexp.
85
* @param names import format names list
86
* @param headers import format header regexps
87
* @param tracks import format track regexps
88
* @param idx selected index
90
void setImportFormat(const QStringList &names,
91
const QStringList &headers,
92
const QStringList &tracks,
95
* Get import format regexp.
97
* @param name import format name
98
* @param header import format header regexp
99
* @param track import format track regexp
101
* @return index of current selection.
103
int getImportFormat(QString &names,
105
QString &tracks) const;
107
* Set freedb.org configuration.
109
* @param cfg freedb configuration.
111
void setFreedbConfig(const FreedbConfig *cfg);
113
* Get freedb.org configuration.
115
* @param cfg freedb configuration.
117
void getFreedbConfig(FreedbConfig *cfg) const;
119
* List with line formats.
120
* The following codes are used before the () expressions.
129
static const char **lineFmtList;
133
* Let user select file, assign file contents to text and preview in
138
* Assign clipboard contents to text and preview in table.
140
void fromClipboard();
142
* Import from freedb.org and preview in table.
146
* Set the format lineedits to the format selected in the combo box.
148
* @param index current index of the combo box
150
void setFormatLineEdit(int index);
152
* Called when freedb.org album data is received.
154
* @param txt text containing album data from freedb.org
156
void freedbAlbumDataReceived(QString txt);
159
TrackColumn, TitleColumn, ArtistColumn, AlbumColumn,
160
YearColumn, GenreColumn, CommentColumn, NumColumns
163
None, File, Clipboard, Freedb
166
* Show fields to import in text as preview in table.
168
* @return true if tags were found.
171
/** From File button */
172
QPushButton *fileButton;
173
/** From Clipboard button */
174
QPushButton *clipButton;
175
/** From freedb.org button */
176
QPushButton *freedbButton;
179
/** contents of imported file/clipboard */
181
/** combobox with import destinations */
182
QComboBox *destComboBox;
183
/** combobox with import formats */
184
QComboBox *formatComboBox;
185
/** LineEdit for header regexp */
186
QLineEdit *headerLineEdit;
187
/** LineEdit for track regexp */
188
QLineEdit *trackLineEdit;
189
/** header parser object */
190
ImportParser *header_parser;
191
/** track parser object */
192
ImportParser *track_parser;
193
/** header format regexps */
194
QStringList formatHeaders;
195
/** track format regexps */
196
QStringList formatTracks;
197
/** freedb.org import dialog */
198
FreedbDialog *freedbDialog;
200
ImportSource importSource;
202
const FreedbConfig *freedbCfg;