From 90670f8b46c3c0729535673bbae640be222f7379 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Fri, 1 Aug 2014 09:56:40 +0200 Subject: [PATCH] Improve formatting of error messages --- src/libcalamares/PythonHelper.cpp | 9 +++++++-- src/libcalamares/PythonJob.cpp | 8 ++------ src/libcalamaresui/ViewManager.cpp | 22 +++++++++------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/libcalamares/PythonHelper.cpp b/src/libcalamares/PythonHelper.cpp index 407ac8c70..4dee34d35 100644 --- a/src/libcalamares/PythonHelper.cpp +++ b/src/libcalamares/PythonHelper.cpp @@ -270,9 +270,14 @@ Helper::handleLastError() msgList.append( valMsg ); if ( !tbMsg.isEmpty() ) - msgList.append( QString( "Traceback:
%1" ).arg( tbMsg ) ); + { + msgList.append( "Traceback:" ); + msgList.append( QString( "
%1
" ).arg( tbMsg ) ); + cDebug() << "tbMsg" << tbMsg; + } - return QString( "%1" ).arg( msgList.join( "
" ) ); + // Return a string made of the msgList items, wrapped in
tags + return QString( "
%1
" ).arg( msgList.join( "
" ) ); } diff --git a/src/libcalamares/PythonJob.cpp b/src/libcalamares/PythonJob.cpp index 455891336..df3a11016 100644 --- a/src/libcalamares/PythonJob.cpp +++ b/src/libcalamares/PythonJob.cpp @@ -195,11 +195,7 @@ PythonJob::exec() bp::tuple resultTuple = bp::extract< bp::tuple >( runResult ); QString message = QString::fromStdString( bp::extract< std::string >( resultTuple[ 0 ] ) ); QString description = QString::fromStdString( bp::extract< std::string >( resultTuple[ 1 ] ) ); - return JobResult::error( tr( "Job \"%1\" finished with error" ) - .arg( prettyName() ), - QString( "%1
%2" ) - .arg( message ) - .arg( description ) ); + return JobResult::error( message, description ); } } catch ( bp::error_already_set ) @@ -211,7 +207,7 @@ PythonJob::exec() } bp::handle_exception(); PyErr_Clear(); - return JobResult::error( tr( "Boost.Python error in job \"%1\"" ).arg( prettyName() ), + return JobResult::error( tr( "Boost.Python error in job \"%1\"." ).arg( prettyName() ), msg ); } diff --git a/src/libcalamaresui/ViewManager.cpp b/src/libcalamaresui/ViewManager.cpp index 8d02ff104..b9e3ea79d 100644 --- a/src/libcalamaresui/ViewManager.cpp +++ b/src/libcalamaresui/ViewManager.cpp @@ -116,24 +116,20 @@ ViewManager::insertViewStep( int before, ViewStep* step) void ViewManager::onInstallationFailed( const QString& message, const QString& details ) { - QString text = tr( - "

Installation Failed

" - "

%1

" - ).arg( message ); + QMessageBox msgBox; + msgBox.setIcon( QMessageBox::Critical ); + msgBox.setWindowTitle( tr("Error") ); + msgBox.setText( "" + tr( "Installation Failed" ) + "" ); + msgBox.setStandardButtons( QMessageBox::Close ); + QString text = "

" + message + "

"; if ( !details.isEmpty() ) { - text += tr( - "

%1

" - ).arg( details ); + text += "

" + details + "

"; } + msgBox.setInformativeText( text ); - QMessageBox::critical( - QApplication::activeWindow(), - tr( "Error" ), - text, - QMessageBox::Close - ); + msgBox.exec(); QApplication::quit(); }