|
1 | 1 | #include "qmlapplication.h" |
2 | 2 |
|
| 3 | +#include <qtextdocument.h> |
| 4 | + |
3 | 5 | #include <QQmlEngineExtensionPlugin> |
4 | 6 | #include <QQuickStyle> |
5 | 7 |
|
6 | 8 | #include "controllers/controllermanager.h" |
7 | 9 | #include "mixer/playermanager.h" |
8 | 10 | #include "moc_qmlapplication.cpp" |
| 11 | +#include "preferences/configobject.h" |
9 | 12 | #include "qml/asyncimageprovider.h" |
10 | 13 | #include "qml/qmldlgpreferencesproxy.h" |
11 | 14 | #include "soundio/soundmanager.h" |
| 15 | +#include "util/versionstore.h" |
12 | 16 | #include "waveform/visualsmanager.h" |
13 | 17 | #include "waveform/waveformwidgetfactory.h" |
14 | 18 | Q_IMPORT_QML_PLUGIN(MixxxPlugin) |
@@ -42,6 +46,36 @@ QmlApplication::QmlApplication( |
42 | 46 | QQuickStyle::setStyle("Basic"); |
43 | 47 |
|
44 | 48 | m_pCoreServices->initialize(app); |
| 49 | + |
| 50 | + QString configVersion = m_pCoreServices->getSettings()->getValue( |
| 51 | + ConfigKey("[Config]", "Version"), ""); |
| 52 | + if (configVersion == VersionStore::FUTURE_UNSTABLE) { |
| 53 | + qDebug() << "Generating a new user profile for safe testing with unstable code"; |
| 54 | + } else if (CmdlineArgs::Instance().isAwareOfRisk()) { |
| 55 | + qCritical() << "Existing user profile detected from" << configVersion |
| 56 | + << "but you said you wanted to play with fire!"; |
| 57 | + m_pCoreServices->getSettings()->setValue( |
| 58 | + ConfigKey("[Config]", "did_run_with_unstable"), true); |
| 59 | + } else { |
| 60 | + QMessageBox msgBox; |
| 61 | + msgBox.setIcon(QMessageBox::Critical); |
| 62 | + msgBox.setWindowTitle(tr("Existing user profile detected")); |
| 63 | + msgBox.setText( |
| 64 | + tr("Trying to run Mixxx 3.0 with an existing %0 user profile! " |
| 65 | + "<br><br>There is <b>serious risks</b> of data loss and " |
| 66 | + "corruption.<br>We recommend using a test profile folder " |
| 67 | + "with the '--settings-path' argument. <br><br>If you want " |
| 68 | + "to continue at your own risk, run Mixxx with the argument " |
| 69 | + "'--allow-dangerous-data-corruption-risk'.") |
| 70 | + .arg(configVersion)); |
| 71 | + |
| 72 | + QPushButton* continueButton = |
| 73 | + msgBox.addButton(tr("Ok"), QMessageBox::ActionRole); |
| 74 | + msgBox.exec(); |
| 75 | + m_pCoreServices.reset(); |
| 76 | + exit(-1); |
| 77 | + } |
| 78 | + |
45 | 79 | SoundDeviceStatus result = m_pCoreServices->getSoundManager()->setupDevices(); |
46 | 80 | if (result != SoundDeviceStatus::Ok) { |
47 | 81 | const int reInt = static_cast<int>(result); |
|
0 commit comments