~ubuntu-branches/ubuntu/wily/kid3/wily-proposed

« back to all changes in this revision

Viewing changes to src/gui/dialogs/importdialog.h

  • Committer: Package Import Robot
  • Author(s): Ana Beatriz Guerrero Lopez, Patrick Matthäi, Ana Beatriz Guerrero Lopez
  • Date: 2011-11-13 16:34:13 UTC
  • mfrom: (1.1.13) (2.1.11 sid)
  • Revision ID: package-import@ubuntu.com-20111113163413-5y0anlc4dqf511uh
Tags: 2.0.1-1
* New upstream release.

[ Patrick Matthäi ]
* Adjust build system.
* Add build dependency xsltproc.

[ Ana Beatriz Guerrero Lopez ]
* Some more adjustments to the build system taken from upstream's deb/
* directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * \file importdialog.h
 
3
 * Import dialog.
 
4
 *
 
5
 * \b Project: Kid3
 
6
 * \author Urs Fleisch
 
7
 * \date 17 Sep 2003
 
8
 *
 
9
 * Copyright (C) 2003-2007  Urs Fleisch
 
10
 *
 
11
 * This file is part of Kid3.
 
12
 *
 
13
 * Kid3 is free software; you can redistribute it and/or modify
 
14
 * it under the terms of the GNU General Public License as published by
 
15
 * the Free Software Foundation; either version 2 of the License, or
 
16
 * (at your option) any later version.
 
17
 *
 
18
 * Kid3 is distributed in the hope that it will be useful,
 
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
 * GNU General Public License for more details.
 
22
 *
 
23
 * You should have received a copy of the GNU General Public License
 
24
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
 */
 
26
 
 
27
#ifndef IMPORTDIALOG_H
 
28
#define IMPORTDIALOG_H
 
29
 
 
30
#include <QDialog>
 
31
#include "config.h"
 
32
#include "importconfig.h"
 
33
 
 
34
class QString;
 
35
class QPushButton;
 
36
class QComboBox;
 
37
class QLineEdit;
 
38
class QCheckBox;
 
39
class QSpinBox;
 
40
class QTableView;
 
41
class TrackDataModel;
 
42
class MusicBrainzDialog;
 
43
class ServerImporter;
 
44
class ServerImportDialog;
 
45
class TextImportDialog;
 
46
class TagImportDialog;
 
47
class ImportTrackDataVector;
 
48
class FrameCollection;
 
49
class FreedbConfig;
 
50
#ifdef HAVE_TUNEPIMP
 
51
class MusicBrainzConfig;
 
52
#endif
 
53
 
 
54
/**
 
55
 * Import dialog.
 
56
 */
 
57
class ImportDialog : public QDialog {
 
58
Q_OBJECT
 
59
 
 
60
public:
 
61
  /**
 
62
   * Constructor.
 
63
   *
 
64
   * @param parent        parent widget
 
65
   * @param caption       dialog title
 
66
   * @param trackDataModel track data to be filled with imported values,
 
67
   *                      is passed with durations of files set
 
68
   * @param importers     server importers
 
69
   */
 
70
  ImportDialog(QWidget* parent, QString& caption,
 
71
               TrackDataModel* trackDataModel,
 
72
               const QList<ServerImporter*>& importers);
 
73
  /**
 
74
   * Destructor.
 
75
   */
 
76
  ~ImportDialog();
 
77
 
 
78
  /**
 
79
   * Set dialog to be started automatically.
 
80
   *
 
81
   * @param importerIndex index of importer to use
 
82
   */
 
83
  void setAutoStartSubDialog(int importerIndex);
 
84
 
 
85
  /**
 
86
   * Clear dialog data.
 
87
   */
 
88
  void clear();
 
89
 
 
90
  /**
 
91
   * Get import destination.
 
92
   *
 
93
   * @return TagV1, TagV2 or TagV2V1 for ID3v1, ID3v2 or both.
 
94
   */
 
95
  TrackData::TagVersion getDestination() const;
 
96
 
 
97
public slots:
 
98
  /**
 
99
   * Shows the dialog as a modal dialog.
 
100
   */
 
101
  int exec();
 
102
 
 
103
private slots:
 
104
  /**
 
105
   * Show help.
 
106
   */
 
107
  void showHelp();
 
108
 
 
109
  /**
 
110
   * Save the local settings to the configuration.
 
111
   */
 
112
  void saveConfig();
 
113
 
 
114
  /**
 
115
   * Called when the maximum time difference value is changed.
 
116
   */
 
117
  void maxDiffChanged();
 
118
 
 
119
  /**
 
120
   * Move a table row.
 
121
   *
 
122
   * The first parameter @a section is not used.
 
123
   * @param fromIndex index of position moved from
 
124
   * @param toIndex   index of position moved to
 
125
   */
 
126
  void moveTableRow(int, int fromIndex, int toIndex);
 
127
 
 
128
  /**
 
129
   * Import from server and preview in table.
 
130
   */
 
131
  void fromServer();
 
132
 
 
133
  /**
 
134
   * Import from text.
 
135
   */
 
136
  void fromText();
 
137
 
 
138
  /**
 
139
   * Import from tags.
 
140
   */
 
141
  void fromTags();
 
142
 
 
143
  /**
 
144
   * Show fields to import in text as preview in table.
 
145
   */
 
146
  void showPreview();
 
147
 
 
148
  /**
 
149
   * Match import data with length.
 
150
   */
 
151
  void matchWithLength();
 
152
 
 
153
  /**
 
154
   * Match import data with track number.
 
155
   */
 
156
  void matchWithTrack();
 
157
 
 
158
  /**
 
159
   * Match import data with title.
 
160
   */
 
161
  void matchWithTitle();
 
162
 
 
163
#ifdef HAVE_TUNEPIMP
 
164
  /**
 
165
   * Import from MusicBrainz and preview in table.
 
166
   */
 
167
  void fromMusicBrainz();
 
168
#endif
 
169
 
 
170
  /**
 
171
   * Hide subdialogs.
 
172
   */
 
173
  void hideSubdialogs();
 
174
 
 
175
  /**
 
176
   * Called when the destination combo box value is changed.
 
177
   */
 
178
  void changeTagDestination();
 
179
 
 
180
  /**
 
181
   * Display custom context menu for horizontal table header.
 
182
   *
 
183
   * @param pos position where context menu is drawn on screen
 
184
   */
 
185
  void showTableHeaderContextMenu(const QPoint& pos);
 
186
 
 
187
  /**
 
188
   * Toggle visibility of table column.
 
189
   *
 
190
   * @param visible true to make column visible
 
191
   */
 
192
  void toggleTableColumnVisibility(bool visible);
 
193
 
 
194
private:
 
195
  /**
 
196
   * Get time difference check configuration.
 
197
   *
 
198
   * @param enable  true if check is enabled
 
199
   * @param maxDiff maximum allowed time difference
 
200
   */
 
201
  void getTimeDifferenceCheck(bool& enable, int& maxDiff) const;
 
202
 
 
203
  /**
 
204
   * Display server import dialog.
 
205
   *
 
206
   * @param importerIdx importer index, if invalid but not negative the
 
207
   *                    MusicBrainz Fingerprint dialog is displayed
 
208
   */
 
209
  void displayServerImportDialog(int importerIdx);
 
210
 
 
211
  /**
 
212
   * Display server import dialog.
 
213
   *
 
214
   * @param source import source
 
215
   */
 
216
  void displayServerImportDialog(ServerImporter* source);
 
217
 
 
218
  /** Index of importer for subdialog to open when starting, -1 for none */
 
219
  int m_autoStartSubDialog;
 
220
  /** Mask for visibility of optional columns */
 
221
  quint64 m_columnVisibility;
 
222
  /** Preview table */
 
223
  QTableView* m_trackDataTable;
 
224
  /** Track data model */
 
225
  TrackDataModel* m_trackDataModel;
 
226
  /** combobox with import servers */
 
227
  QComboBox* m_serverComboBox;
 
228
  /** combobox with import destinations */
 
229
  QComboBox* m_destComboBox;
 
230
  QCheckBox* m_mismatchCheckBox;
 
231
  QSpinBox* m_maxDiffSpinBox;
 
232
  /** importers for different servers */
 
233
  QList<ServerImporter*> m_importers;
 
234
  /** MusicBrainz import dialog */
 
235
  MusicBrainzDialog* m_musicBrainzDialog;
 
236
  /** Server import dialog */
 
237
  ServerImportDialog* m_serverImportDialog;
 
238
  /** Text import dialog */
 
239
  TextImportDialog* m_textImportDialog;
 
240
  /** Tag import dialog */
 
241
  TagImportDialog* m_tagImportDialog;
 
242
};
 
243
 
 
244
#endif