blob: 57f916ea26d930174d4aa50721e244f102487207 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#ifndef DLGTRACKEXPORT_H
#define DLGTRACKEXPORT_H
#include <future>
#include <QDialog>
#include <QString>
#include <QScopedPointer>
#include <QTime>
#include "configobject.h"
#include "library/export/trackexportworker.h"
#include "library/export/ui_dlgtrackexport.h"
#include "trackinfoobject.h"
// A dialog for interacting with the track exporter in an interactive manner.
// Handles errors and user interactions.
class TrackExportDlg : public QDialog, public Ui::DlgTrackExport {
Q_OBJECT
public:
enum class OverwriteMode {
ASK,
OVERWRITE_ALL,
SKIP_ALL,
};
// The dialog is prepared, but not shown on construction. Does not
// take ownership of the export worker.
TrackExportDlg(QWidget *parent, ConfigObject<ConfigValue>* pConfig,
TrackExportWorker* worker);
virtual ~TrackExportDlg() { }
public slots:
void slotProgress(QString filename, int progress, int count);
void slotAskOverwriteMode(
QString filename,
std::promise<TrackExportWorker::OverwriteAnswer>* promise);
void cancelButtonClicked();
protected:
// First pops up a directory selector on show(), then does the actual
// copying.
void showEvent(QShowEvent* event) override;
private:
// Called when progress is complete or the procedure has been canceled.
// Displays a final message box indicating success or failure.
// Makes sure the exporter thread has exited.
void finish();
ConfigObject<ConfigValue>* m_pConfig;
QList<TrackPointer> m_tracks;
TrackExportWorker* m_worker;
};
#endif // DLGTRACKEXPORT_H
|