diff options
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/mainwindow.cpp | 18 | ||||
-rw-r--r-- | qt-ui/mainwindow.h | 1 | ||||
-rw-r--r-- | qt-ui/mainwindow.ui | 3 |
3 files changed, 18 insertions, 4 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index deaab4715..12c803786 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -40,6 +40,7 @@ MainWindow::MainWindow() : ui(new Ui::MainWindow()) setWindowIcon(QIcon(":subsurface-icon")); connect(ui->ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int))); ui->globeMessage->hide(); + ui->mainErrorMessage->hide(); ui->globe->setMessageWidget(ui->globeMessage); ui->globeMessage->setCloseButtonVisible(false); ui->ProfileWidget->setFocusProxy(ui->ListWidget); @@ -79,14 +80,13 @@ void MainWindow::on_actionOpen_triggered() on_actionClose_triggered(); - GError *error = NULL; + char *error = NULL; parse_file(fileNamePtr.data(), &error); set_filename(fileNamePtr.data(), TRUE); if (error != NULL) { - QMessageBox::warning(this, "Error", error->message); - g_error_free(error); - error = NULL; + showError(error); + free(error); } process_dives(FALSE, FALSE); @@ -533,3 +533,13 @@ void MainWindow::file_save(void) save_dives(existing_filename); mark_divelist_changed(FALSE); } + +void MainWindow::showError(QString message) +{ + if (message.isEmpty()) + return; + ui->mainErrorMessage->setText(message); + ui->mainErrorMessage->setCloseButtonVisible(true); + ui->mainErrorMessage->setMessageType(KMessageWidget::Error); + ui->mainErrorMessage->animatedShow(); +} diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 121b5c74d..a5b1a9b48 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -39,6 +39,7 @@ public: MainTab *information(); DiveListView *dive_list(); GlobeGPS *globe(); + void showError(QString message); private Q_SLOTS: diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 36f594d2d..658f22c41 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -95,6 +95,9 @@ </widget> </widget> </item> + <item> + <widget class="KMessageWidget" name="mainErrorMessage" native="true"/> + </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> |