summaryrefslogtreecommitdiffstats
path: root/src/library/export/dlglibraryexport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/library/export/dlglibraryexport.cpp')
-rw-r--r--src/library/export/dlglibraryexport.cpp50
1 files changed, 17 insertions, 33 deletions
diff --git a/src/library/export/dlglibraryexport.cpp b/src/library/export/dlglibraryexport.cpp
index 26fbdf73ae..22bc707c47 100644
--- a/src/library/export/dlglibraryexport.cpp
+++ b/src/library/export/dlglibraryexport.cpp
@@ -17,7 +17,7 @@
#include "library/trackset/crate/crateid.h"
#include "library/trackset/crate/cratestorage.h"
-namespace el = djinterop::enginelibrary;
+namespace el = djinterop::engine;
namespace mixxx {
@@ -198,8 +198,8 @@ void DlgLibraryExport::exportRequested() {
// Work out what version was requested.
// If there is an existing database, the version does not matter.
int versionIndex = m_pVersionCombo->currentData().toInt();
- djinterop::semantic_version exportVersion =
- versionIndex == -1 ? el::version_latest_firmware : el::all_versions[versionIndex];
+ el::engine_version exportVersion =
+ versionIndex == -1 ? el::latest_os : el::all_versions[versionIndex];
// Construct a request to export the library/crates.
auto pRequest = QSharedPointer<EnginePrimeExportRequest>::create();
@@ -231,46 +231,30 @@ void DlgLibraryExport::checkExistingDatabase() {
m_pExistingDatabaseLabel->setText("");
m_pVersionCombo->clear();
m_pVersionCombo->setEnabled(true);
- int versionIndex = 0;
- for (const djinterop::semantic_version& version : el::all_versions) {
+ for (int versionIndex = 0; versionIndex < (int)el::all_versions.size(); ++versionIndex) {
+ el::engine_version version = el::all_versions[versionIndex];
m_pVersionCombo->insertItem(0,
- QString::fromStdString(el::version_name(version)),
+ QString::fromStdString(version.name),
QVariant{versionIndex});
- if (version == el::version_latest_firmware) {
+ if (version == el::latest_os) {
// Latest firmware version is the default selection.
m_pVersionCombo->setCurrentIndex(0);
}
-
- ++versionIndex;
}
return;
}
- // Find out version of the existing database, and set the displayed
- // version widget accordingly. Changing the schema version of existing
- // databases is not currently supported.
+ // Load the existing database, and set the displayed version widget
+ // accordingly. Changing the schema version of existing databases is
+ // not currently supported.
djinterop::database db = el::load_database(databaseDirectory.toStdString());
- const auto version = db.version();
-
- const auto result = std::find(el::all_versions.begin(), el::all_versions.end(), version);
- if (result == el::all_versions.end()) {
- // Unknown database version.
- m_pExistingDatabaseLabel->setText(
- tr("A database already exists in the chosen directory, "
- "but it is of an unsupported version. Export is not "
- "guaranteed to succeed in this situation."));
- m_pVersionCombo->clear();
- m_pVersionCombo->setEnabled(false);
- } else {
- int versionIndex = std::distance(el::all_versions.begin(), result);
- m_pExistingDatabaseLabel->setText(
- tr("A database already exists in the chosen directory. "
- "Exported tracks will be added into this database."));
- m_pVersionCombo->clear();
- m_pVersionCombo->insertItem(
- 0, QString::fromStdString(el::version_name(version)), QVariant{versionIndex});
- m_pVersionCombo->setEnabled(false);
- }
+ m_pExistingDatabaseLabel->setText(
+ tr("A database already exists in the chosen directory. "
+ "Exported tracks will be added into this database."));
+ m_pVersionCombo->clear();
+ m_pVersionCombo->insertItem(
+ 0, QString::fromStdString(db.version_name()), QVariant{-1});
+ m_pVersionCombo->setEnabled(false);
} catch (std::exception& e) {
Q_UNUSED(e);