summaryrefslogtreecommitdiffstats
path: root/src/library/export/dlglibraryexport.h
blob: 364acb2b9468d654903b96858e87d2155ba4a187 (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
57
58
59
60
61
62
63
64
#pragma once

#include <QDialog>
#include <QLineEdit>
#include <QListWidget>
#include <QRadioButton>
#include <QTreeWidget>
#include <QWidget>
#include <memory>

#include "library/export/engineprimeexportrequest.h"
#include "library/trackset/crate/crateid.h"
#include "preferences/usersettings.h"
#include "util/optional.h"
#include "util/parented_ptr.h"

class TrackCollectionManager;

namespace mixxx {

/// The DlgLibraryExport class is a UI window that gathers information from
/// the user about how they would like to export the Mixxx library.
///
/// Currently, the dialog only supports exporting to the Engine Library format,
/// but in future it is expected that this dialog could be expanded to include
/// other formats, and generate different export signals accordingly.
class DlgLibraryExport : public QDialog {
    Q_OBJECT

  public:
    DlgLibraryExport(
            QWidget* parent,
            UserSettingsPointer pConfig,
            TrackCollectionManager* pTrackCollectionManager);

    /// Set the specified crate to be selected for export on the dialog.  If no
    /// crate is provided (i.e. `std::nullopt`), then the dialog will be ready
    //  to export the whole library.  If an unknown crate is provided, then no
    /// action is taken.
    void setSelectedCrate(std::optional<CrateId> crateId);

  signals:
    /// The startEnginePrimeExport signal is emitted when sufficient information
    /// has been gathered from the user to kick off an Engine Prime export, and
    /// details of the request are provided as part of the signal.
    void startEnginePrimeExport(EnginePrimeExportRequest) const;

  private slots:
    void browseExportDirectory();
    void exportRequested();

  private:
    UserSettingsPointer m_pConfig;
    TrackCollectionManager* m_pTrackCollectionManager;

    parented_ptr<QRadioButton> m_pWholeLibraryRadio;
    parented_ptr<QRadioButton> m_pCratesRadio;
    parented_ptr<QListWidget> m_pCratesList;
    parented_ptr<QLineEdit> m_pBaseDirectoryTextField;
    parented_ptr<QLineEdit> m_pDatabaseDirectoryTextField;
    parented_ptr<QLineEdit> m_pMusicDirectoryTextField;
};

} // namespace mixxx