Skip to content
Permalink
Browse files

Merge pull request #6398 from DelazJ/QMessageBoxTitles

Updating some dialogs caption
  • Loading branch information
nyalldawson committed Feb 21, 2018
2 parents 6573eb3 + ed99ba9 commit bb08b64a03dfef03d10a29c6354de54c06a58859
@@ -185,6 +185,7 @@ void QgsMapLayerStyleManagerWidget::saveAsDefault()
if ( layer->dataProvider()->isSaveAndLoadStyleToDatabaseSupported() )
{
QMessageBox askToUser;
askToUser.setWindowTitle( tr( "Save Style" ) );
askToUser.setText( tr( "Save default style to: " ) );
askToUser.setIcon( QMessageBox::Question );
askToUser.addButton( tr( "Cancel" ), QMessageBox::RejectRole );
@@ -227,6 +228,7 @@ void QgsMapLayerStyleManagerWidget::loadDefault()
if ( layer->dataProvider()->isSaveAndLoadStyleToDatabaseSupported() )
{
QMessageBox askToUser;
askToUser.setWindowTitle( tr( "Load Style" ) );
askToUser.setText( tr( "Load default style from: " ) );
askToUser.setIcon( QMessageBox::Question );
askToUser.addButton( tr( "Cancel" ), QMessageBox::RejectRole );
@@ -79,14 +79,14 @@ void QgsNewAuxiliaryFieldDialog::accept()
const int idx = mLayer->fields().lookupField( fieldName );
if ( idx >= 0 )
{
const QString title = tr( "Invalid name" );
const QString msg = tr( "Auxiliary field '%1' already exists" ).arg( fieldName );
const QString title = tr( "New Auxiliary Field" );
const QString msg = tr( "Invalid name. Auxiliary field '%1' already exists." ).arg( fieldName );
QMessageBox::critical( this, title, msg, QMessageBox::Ok );
}
else if ( def.comment().isEmpty() )
{
const QString title = tr( "Invalid name" );
const QString msg = tr( "Name is a mandatory parameter" );
const QString title = tr( "New Auxiliary Field" );
const QString msg = tr( "Name is a mandatory parameter." );
QMessageBox::critical( this, title, msg, QMessageBox::Ok );
}
else
@@ -198,7 +198,7 @@ void QgsNewGeoPackageLayerDialog::mAddAttributeButton_clicked()
QString myName = mFieldNameEdit->text();
if ( myName == mFeatureIdColumnEdit->text() )
{
QMessageBox::critical( this, tr( "Invalid field name" ), tr( "The field cannot have the same name as the feature identifier" ) );
QMessageBox::critical( this, tr( "Add Field" ), tr( "The field cannot have the same name as the feature identifier." ) );
return;
}

@@ -259,8 +259,8 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
QMessageBox msgBox;
msgBox.setIcon( QMessageBox::Question );
msgBox.setWindowTitle( tr( "The File Already Exists." ) );
msgBox.setText( tr( "Do you want to overwrite the existing file with a new database or add a new layer to it?" ) );
msgBox.setWindowTitle( tr( "New GeoPackage Layer" ) );
msgBox.setText( tr( "The File already exists. Do you want to overwrite the existing file with a new database or add a new layer to it?" ) );
QPushButton *overwriteButton = msgBox.addButton( tr( "Overwrite" ), QMessageBox::ActionRole );
QPushButton *addNewLayerButton = msgBox.addButton( tr( "Add new layer" ), QMessageBox::ActionRole );
msgBox.setStandardButtons( QMessageBox::Cancel );
@@ -311,8 +311,8 @@ bool QgsNewGeoPackageLayerDialog::apply()
if ( !hGpkgDriver )
{
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ),
tr( "GeoPackage driver not found" ) );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ),
tr( "Layer creation failed. GeoPackage driver not found." ) );
return false;
}

@@ -324,7 +324,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
QString msg( tr( "Creation of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ), msg );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), msg );
return false;
}
}
@@ -336,14 +336,14 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
QString msg( tr( "Opening of database failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ), msg );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), msg );
return false;
}
if ( hDriver != hGpkgDriver )
{
QString msg( tr( "Opening of file succeeded, but this is not a GeoPackage database" ) );
QString msg( tr( "Opening of file succeeded, but this is not a GeoPackage database." ) );
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ), msg );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), msg );
return false;
}
}
@@ -357,7 +357,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
overwriteTable = property( "question_existing_layer_answer_overwrite" ).toBool();
}
else if ( QMessageBox::question( this, tr( "Existing layer" ),
else if ( QMessageBox::question( this, tr( "New GeoPackage Layer" ),
tr( "A table with the same name already exists. Do you want to overwrite it?" ),
QMessageBox::Yes | QMessageBox::No, QMessageBox::No ) == QMessageBox::Yes )
{
@@ -421,7 +421,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
QString msg( tr( "Creation of layer failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ), msg );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), msg );
return false;
}

@@ -455,7 +455,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
if ( !property( "hideDialogs" ).toBool() )
{
QMessageBox::critical( this, tr( "Layer creation failed" ),
QMessageBox::critical( this, tr( "New GeoPackage Layer" ),
tr( "Creation of field %1 failed (OGR error: %2)" )
.arg( fieldName, QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
}
@@ -473,7 +473,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
{
QString msg( tr( "Creation of layer failed (OGR error: %1)" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Layer creation failed" ), msg );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), msg );
return false;
}
hDS.reset();
@@ -494,7 +494,7 @@ bool QgsNewGeoPackageLayerDialog::apply()
else
{
if ( !property( "hideDialogs" ).toBool() )
QMessageBox::critical( this, tr( "Invalid Layer" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( tableName ) );
QMessageBox::critical( this, tr( "New GeoPackage Layer" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( tableName ) );
delete layer;
}

@@ -393,7 +393,7 @@ void QgsOptionsDialogBase::optionsStackedWidget_WidgetRemoved( int index )

void QgsOptionsDialogBase::warnAboutMissingObjects()
{
QMessageBox::warning( nullptr, tr( "Missing objects" ),
QMessageBox::warning( nullptr, tr( "Missing Objects" ),
tr( "Base options dialog could not be initialized.\n\n"
"Missing some of the .ui template objects:\n" )
+ " mOptionsListWidget,\n mOptionsStackedWidget,\n mOptionsSplitter,\n mOptionsListFrame",
@@ -289,7 +289,7 @@ void QgsOWSSourceSelect::mDeleteButton_clicked()
{
QString msg = tr( "Are you sure you want to remove the %1 connection and all associated settings?" )
.arg( mConnectionsComboBox->currentText() );
QMessageBox::StandardButton result = QMessageBox::question( this, tr( "Confirm Delete" ), msg, QMessageBox::Yes | QMessageBox::No );
QMessageBox::StandardButton result = QMessageBox::question( this, tr( "Delete Connection" ), msg, QMessageBox::Yes | QMessageBox::No );
if ( result == QMessageBox::Yes )
{
QgsOwsConnection::deleteConnection( mService, mConnectionsComboBox->currentText() );
@@ -631,9 +631,9 @@ void QgsOWSSourceSelect::addDefaultServers()
settings.endGroup();
populateConnectionList();

QMessageBox::information( this, tr( "WMS proxies" ), "<p>" + tr( "Several WMS servers have "
QMessageBox::information( this, tr( "Add WMS Servers" ), "<p>" + tr( "Several WMS servers have "
"been added to the server list. Note that if "
"you access the internet via a web proxy, you will "
"you access the Internet via a web proxy, you will "
"need to set the proxy settings in the QGIS options dialog." ) + "</p>" );
}

@@ -233,15 +233,15 @@ void QgsQueryBuilder::test()
else if ( mLayer->dataProvider()->hasErrors() )
{
QMessageBox::warning( this,
tr( "Query Failed" ),
tr( "Query Result" ),
tr( "An error occurred when executing the query." )
+ tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) );
mLayer->dataProvider()->clearErrors();
}
else
{
QMessageBox::warning( this,
tr( "Query Failed" ),
tr( "Query Result" ),
tr( "An error occurred when executing the query." ) );
}
}
@@ -254,14 +254,14 @@ void QgsQueryBuilder::accept()
if ( mLayer->dataProvider()->hasErrors() )
{
QMessageBox::warning( this,
tr( "Query Failed" ),
tr( "Query Result" ),
tr( "An error occurred when executing the query." )
+ tr( "\nThe data provider said:\n%1" ).arg( mLayer->dataProvider()->errors().join( QStringLiteral( "\n" ) ) ) );
mLayer->dataProvider()->clearErrors();
}
else
{
QMessageBox::warning( this, tr( "Error in Query" ), tr( "The subset string could not be set" ) );
QMessageBox::warning( this, tr( "Query Result" ), tr( "Error in query. The subset string could not be set." ) );
}

return;
@@ -378,7 +378,7 @@ QString QgsRasterFormatSaveOptionsWidget::validateOptions( bool gui, bool report
}
else if ( ! createOptions.isEmpty() )
{
QMessageBox::information( this, QLatin1String( "" ), tr( "Cannot validate creation options" ), QMessageBox::Close );
QMessageBox::information( this, QLatin1String( "" ), tr( "Cannot validate creation options." ), QMessageBox::Close );
if ( tmpLayer )
delete rasterLayer;
return QString();
@@ -197,7 +197,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterLayer *rasterLa
if ( files.isEmpty() )
break;

if ( QMessageBox::warning( this, tr( "Warning" ),
if ( QMessageBox::warning( this, tr( "Save Raster Layer" ),
tr( "The directory %1 contains files which will be overwritten: %2" ).arg( dir.absolutePath(), files.join( QStringLiteral( ", " ) ) ),
QMessageBox::Ok | QMessageBox::Cancel ) == QMessageBox::Ok )
break;
@@ -195,7 +195,7 @@ void QgsSearchQueryBuilder::btnTest_clicked()
if ( count == -1 )
return;

QMessageBox::information( this, tr( "Search results" ), tr( "Found %n matching feature(s).", "test result", count ) );
QMessageBox::information( this, tr( "Test Query" ), tr( "Found %n matching feature(s).", "test result", count ) );
}

// This method tests the number of records that would be returned
@@ -204,7 +204,7 @@ long QgsSearchQueryBuilder::countRecords( const QString &searchString )
QgsExpression search( searchString );
if ( search.hasParserError() )
{
QMessageBox::critical( this, tr( "Search string parsing error" ), search.parserErrorString() );
QMessageBox::critical( this, tr( "Query Result" ), search.parserErrorString() );
return -1;
}

@@ -220,7 +220,7 @@ long QgsSearchQueryBuilder::countRecords( const QString &searchString )

if ( !search.prepare( &context ) )
{
QMessageBox::critical( this, tr( "Evaluation error" ), search.evalErrorString() );
QMessageBox::critical( this, tr( "Query Result" ), search.evalErrorString() );
return -1;
}

@@ -237,7 +237,7 @@ long QgsSearchQueryBuilder::countRecords( const QString &searchString )
count++;
}

// check if there were errors during evaulating
// check if there were errors during evaluating
if ( search.hasEvalError() )
break;
}
@@ -246,7 +246,7 @@ long QgsSearchQueryBuilder::countRecords( const QString &searchString )

if ( search.hasEvalError() )
{
QMessageBox::critical( this, tr( "Error during search" ), search.evalErrorString() );
QMessageBox::critical( this, tr( "Query Result" ), search.evalErrorString() );
return -1;
}

@@ -271,7 +271,7 @@ void QgsSearchQueryBuilder::btnOk_clicked()
}
else if ( numRecs == 0 )
{
QMessageBox::warning( this, tr( "No Records" ), tr( "The query you specified results in zero records being returned." ) );
QMessageBox::warning( this, tr( "Query Result" ), tr( "The query you specified results in zero records being returned." ) );
}
else
{
@@ -380,7 +380,7 @@ void QgsSearchQueryBuilder::saveQuery()
QgsSettings s;
QString lastQueryFileDir = s.value( QStringLiteral( "/UI/lastQueryFileDir" ), QDir::homePath() ).toString();
//save as qqt (QGIS query file)
QString saveFileName = QFileDialog::getSaveFileName( nullptr, tr( "Save query to file" ), lastQueryFileDir, QStringLiteral( "*.qqf" ) );
QString saveFileName = QFileDialog::getSaveFileName( nullptr, tr( "Save Query to File" ), lastQueryFileDir, QStringLiteral( "*.qqf" ) );
if ( saveFileName.isNull() )
{
return;
@@ -394,7 +394,7 @@ void QgsSearchQueryBuilder::saveQuery()
QFile saveFile( saveFileName );
if ( !saveFile.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "Could not open file for writing" ) );
QMessageBox::critical( nullptr, tr( "Save Query to File" ), tr( "Could not open file for writing." ) );
return;
}

@@ -416,7 +416,7 @@ void QgsSearchQueryBuilder::loadQuery()
QgsSettings s;
QString lastQueryFileDir = s.value( QStringLiteral( "/UI/lastQueryFileDir" ), QDir::homePath() ).toString();

QString queryFileName = QFileDialog::getOpenFileName( nullptr, tr( "Load query from file" ), lastQueryFileDir, tr( "Query files" ) + " (*.qqf);;" + tr( "All files" ) + " (*)" );
QString queryFileName = QFileDialog::getOpenFileName( nullptr, tr( "Load Query from File" ), lastQueryFileDir, tr( "Query files" ) + " (*.qqf);;" + tr( "All files" ) + " (*)" );
if ( queryFileName.isNull() )
{
return;
@@ -425,20 +425,20 @@ void QgsSearchQueryBuilder::loadQuery()
QFile queryFile( queryFileName );
if ( !queryFile.open( QIODevice::ReadOnly ) )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "Could not open file for reading" ) );
QMessageBox::critical( nullptr, tr( "Load Query from File" ), tr( "Could not open file for reading." ) );
return;
}
QDomDocument queryDoc;
if ( !queryDoc.setContent( &queryFile ) )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "File is not a valid xml document" ) );
QMessageBox::critical( nullptr, tr( "Load Query from File" ), tr( "File is not a valid xml document." ) );
return;
}

QDomElement queryElem = queryDoc.firstChildElement( QStringLiteral( "Query" ) );
if ( queryElem.isNull() )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "File is not a valid query document" ) );
QMessageBox::critical( nullptr, tr( "Load Query from File" ), tr( "File is not a valid query document." ) );
return;
}

@@ -448,7 +448,7 @@ void QgsSearchQueryBuilder::loadQuery()
QgsExpression search( query );
if ( search.hasParserError() )
{
QMessageBox::critical( this, tr( "Search string parsing error" ), search.parserErrorString() );
QMessageBox::critical( this, tr( "Query Result" ), search.parserErrorString() );
return;
}

@@ -476,7 +476,7 @@ void QgsSearchQueryBuilder::loadQuery()
if ( !mFieldMap.contains( attIt ) )
{
bool ok;
QString replaceAttribute = QInputDialog::getItem( 0, tr( "Select attribute" ), tr( "There is no attribute '%1' in the current vector layer. Please select an existing attribute" ).arg( *attIt ),
QString replaceAttribute = QInputDialog::getItem( 0, tr( "Select Attribute" ), tr( "There is no attribute '%1' in the current vector layer. Please select an existing attribute." ).arg( *attIt ),
existingAttributes, 0, false, &ok );
if ( !ok || replaceAttribute.isEmpty() )
{
@@ -213,12 +213,12 @@ void QgsSQLComposerDialog::accept()
{
if ( errorMsg.isEmpty() )
errorMsg = tr( "An error occurred during evaluation of the SQL statement." );
QMessageBox::critical( this, tr( "SQL Error" ), errorMsg );
QMessageBox::critical( this, tr( "SQL Evaluation" ), errorMsg );
return;
}
if ( !warningMsg.isEmpty() )
{
QMessageBox::warning( this, tr( "SQL Warning" ), warningMsg );
QMessageBox::warning( this, tr( "SQL Evaluation" ), warningMsg );
}
}
QDialog::accept();

0 comments on commit bb08b64

Please sign in to comment.
You can’t perform that action at this time.