diff --git a/src/QUMainWindow.cpp b/src/QUMainWindow.cpp index fe7dacb..6d1b0c4 100644 --- a/src/QUMainWindow.cpp +++ b/src/QUMainWindow.cpp @@ -54,10 +54,6 @@ QUMainWindow::QUMainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::QUM lyricsProgressBar->setFormat("%v/%m (%p%)"); QMainWindow::statusBar()->addPermanentWidget(lyricsProgressBar, 1); - if (BASS_Init(-1, 44100, 0, 0, NULL)) { - QMainWindow::statusBar()->showMessage(tr("BASS initialized.")); - } - QSettings settings; bool firstRun = settings.value("firstRun", "true").toBool(); diff --git a/src/main.cpp b/src/main.cpp index 8d7edde..159fdf1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ //#include void initApplication(); +void initBASS(); void initLanguage(QApplication&, QTranslator&, QTranslator&, QSplashScreen&); void handlePreviousAppCrash(); void handleWipWarning(); @@ -49,6 +50,7 @@ int main(int argc, char *argv[]) { handleArguments(); QUMainWindow mainWindow; + initBASS(); app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); mainWindow.show(); @@ -70,6 +72,22 @@ void initApplication() { QCoreApplication::setApplicationName("UltraStar Creator"); } +void initBASS() +{ + if (!BASS_Init(-1, 44100, 0, 0, NULL)) + { + QPushButton *quitButton = new QPushButton(); + QMessageBox dlg; + dlg.setWindowTitle("BASS could not be initialized"); + dlg.setText("BASS audio library could not initialize the audio device.\nThe application will quit now."); + dlg.setDefaultButton(quitButton); + dlg.setIcon(QMessageBox::Critical); + + QObject::connect(&dlg, &QMessageBox::accepted, qApp, &QCoreApplication::quit, Qt::QueuedConnection); + dlg.exec(); + } +} + /*! * Installs a proper translator according to the registry settings. That's why you * have to restart this application if you want to change its language. Uses the system