Skip to content

Commit

Permalink
More message box fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ committed Feb 17, 2018
1 parent 576030b commit b3b17b6
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -10398,7 +10398,7 @@ bool QgisApp::saveDirty()
// old code: mProjectIsDirtyFlag = true;

// prompt user to save
answer = QMessageBox::question( this, tr( "Save Project?" ),
answer = QMessageBox::question( this, tr( "Save Project" ),
tr( "Do you want to save the current project? %1" )
.arg( whyDirty ),
QMessageBox::Save | QMessageBox::Cancel | QMessageBox::Discard,
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsaddattrdialog.cpp
Expand Up @@ -95,13 +95,13 @@ void QgsAddAttrDialog::accept()
{
if ( mIsShapeFile && mNameEdit->text().toLower() == QLatin1String( "shape" ) )
{
QMessageBox::warning( this, tr( "Warning" ),
QMessageBox::warning( this, tr( "Add Field" ),
tr( "Invalid field name. This field name is reserved and cannot be used." ) );
return;
}
if ( mNameEdit->text().isEmpty() )
{
QMessageBox::warning( this, tr( "Warning" ),
QMessageBox::warning( this, tr( "Add Field" ),
tr( "No name specified. Please specify a name to create a new field." ) );
return;
}
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -550,7 +550,7 @@ void QgsAttributeTableDialog::runFieldCalculation( QgsVectorLayer *layer, const

if ( !calculationSuccess )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occurred while evaluating the calculation string:\n%1" ).arg( error ) );
QMessageBox::critical( nullptr, tr( "Update Attributes" ), tr( "An error occurred while evaluating the calculation string:\n%1" ).arg( error ) );
mLayer->destroyEditCommand();
}
else
Expand Down Expand Up @@ -871,7 +871,7 @@ void QgsAttributeTableDialog::mActionAddAttribute_triggered()
else
{
mLayer->destroyEditCommand();
QMessageBox::critical( this, tr( "Failed to add field" ), tr( "Failed to add field '%1' of type '%2'. Is the field name unique?" ).arg( dialog.field().name(), dialog.field().typeName() ) );
QMessageBox::critical( this, tr( "Add Field" ), tr( "Failed to add field '%1' of type '%2'. Is the field name unique?" ).arg( dialog.field().name(), dialog.field().typeName() ) );
}


Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsbookmarks.cpp
Expand Up @@ -77,7 +77,7 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )
db.setDatabaseName( QgsApplication::qgisUserDatabaseFilePath() );
if ( ! db.open() )
{
QMessageBox::warning( this, tr( "Error" ),
QMessageBox::warning( this, tr( "Spatial Bookmarks" ),
tr( "Unable to open bookmarks database.\nDatabase: %1\nDriver: %2\nDatabase: %3" )
.arg( QgsApplication::qgisUserDatabaseFilePath(),
db.lastError().driverText(),
Expand Down Expand Up @@ -190,7 +190,7 @@ void QgsBookmarks::addClicked()
}
else
{
QMessageBox::warning( this, tr( "Error" ), tr( "Unable to create the bookmark.\nDriver: %1\nDatabase: %2" )
QMessageBox::warning( this, tr( "Add Bookmark" ), tr( "Unable to create the bookmark.\nDriver: %1\nDatabase: %2" )
.arg( mQgisModel->database().lastError().driverText(),
mQgisModel->database().lastError().databaseText() ) );
}
Expand Down Expand Up @@ -254,7 +254,7 @@ void QgsBookmarks::zoomToBookmark()
rect = ct.transform( rect );
if ( rect.isEmpty() )
{
QMessageBox::warning( this, tr( "Empty Extent" ), tr( "Reprojected extent is empty." ) );
QMessageBox::warning( this, tr( "Zoom to Bookmark" ), tr( "Reprojected extent is empty." ) );
return;
}
}
Expand Down Expand Up @@ -329,7 +329,7 @@ void QgsBookmarks::importFromXml()
}
if ( !query.exec( queryTxt ) )
{
QMessageBox::warning( this, tr( "Error" ), tr( "Unable to create the bookmark.\nDriver: %1\nDatabase: %2" )
QMessageBox::warning( this, tr( "Import Bookmarks" ), tr( "Unable to create the bookmark.\nDriver: %1\nDatabase: %2" )
.arg( query.lastError().driverText(),
query.lastError().databaseText() ) );
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsdecorationgrid.cpp
Expand Up @@ -805,18 +805,18 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double *values )
QgsMapLayer *layer = QgisApp::instance()->mapCanvas()->currentLayer();
if ( ! layer )
{
QMessageBox::warning( nullptr, tr( "Error" ), tr( "No active layer" ) );
QMessageBox::warning( nullptr, tr( "Get Interval from Layer" ), tr( "No active layer" ) );
return false;
}
if ( layer->type() != QgsMapLayer::RasterLayer )
{
QMessageBox::warning( nullptr, tr( "Error" ), tr( "Please select a raster layer" ) );
QMessageBox::warning( nullptr, tr( "Get Interval from Layer" ), tr( "Please select a raster layer." ) );
return false;
}
QgsRasterLayer *rlayer = dynamic_cast<QgsRasterLayer *>( layer );
if ( !rlayer || rlayer->width() == 0 || rlayer->height() == 0 )
{
QMessageBox::warning( nullptr, tr( "Error" ), tr( "Invalid raster layer" ) );
QMessageBox::warning( nullptr, tr( "Get Interval from Layer" ), tr( "Invalid raster layer" ) );
return false;
}
QgsCoordinateReferenceSystem layerCRS = layer->crs();
Expand All @@ -826,7 +826,7 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double *values )
// TODO calculate transformed values if necessary
if ( layerCRS != mapCRS )
{
QMessageBox::warning( nullptr, tr( "Error" ), tr( "Layer CRS must be equal to project CRS" ) );
QMessageBox::warning( nullptr, tr( "Get Interval from Layer" ), tr( "Layer CRS must be equal to project CRS." ) );
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsdiagramproperties.cpp
Expand Up @@ -453,7 +453,7 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer *layer, QWidget *pare
mDiagramTypeComboBox_currentIndexChanged( mDiagramTypeComboBox->currentIndex() );
if ( mDiagramTypeComboBox->currentIndex() == -1 )
{
QMessageBox::warning( this, tr( "Unknown diagram type." ),
QMessageBox::warning( this, tr( "Diagram Properties" ),
tr( "The diagram type '%1' is unknown. A default type is selected for you." ).arg( mDiagramType ), QMessageBox::Ok );
mDiagramTypeComboBox->setCurrentIndex( mDiagramTypeComboBox->findData( DIAGRAM_NAME_PIE ) );
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsfieldcalculator.cpp
Expand Up @@ -173,7 +173,7 @@ void QgsFieldCalculator::accept()

if ( !exp.prepare( &expContext ) )
{
QMessageBox::critical( nullptr, tr( "Evaluation error" ), exp.evalErrorString() );
QMessageBox::critical( nullptr, tr( "Evaluation Error" ), exp.evalErrorString() );
return;
}

Expand Down Expand Up @@ -222,7 +222,7 @@ void QgsFieldCalculator::accept()
if ( !mVectorLayer->addAttribute( newField ) )
{
QApplication::restoreOverrideCursor();
QMessageBox::critical( nullptr, tr( "Provider error" ), tr( "Could not add the new field to the provider." ) );
QMessageBox::critical( nullptr, tr( "Create New Field" ), tr( "Could not add the new field to the provider." ) );
mVectorLayer->destroyEditCommand();
return;
}
Expand All @@ -244,7 +244,7 @@ void QgsFieldCalculator::accept()
if ( ! exp.prepare( &expContext ) )
{
QApplication::restoreOverrideCursor();
QMessageBox::critical( nullptr, tr( "Evaluation error" ), exp.evalErrorString() );
QMessageBox::critical( nullptr, tr( "Evaluation Error" ), exp.evalErrorString() );
return;
}
}
Expand Down Expand Up @@ -310,7 +310,7 @@ void QgsFieldCalculator::accept()

if ( !calculationSuccess )
{
QMessageBox::critical( nullptr, tr( "Error" ), tr( "An error occurred while evaluating the calculation string:\n%1" ).arg( error ) );
QMessageBox::critical( nullptr, tr( "Evaluation Error" ), tr( "An error occurred while evaluating the calculation string:\n%1" ).arg( error ) );
mVectorLayer->destroyEditCommand();
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsguivectorlayertools.cpp
Expand Up @@ -103,7 +103,7 @@ bool QgsGuiVectorLayerTools::stopEditing( QgsVectorLayer *layer, bool allowCance
buttons |= QMessageBox::Cancel;

switch ( QMessageBox::question( nullptr,
tr( "Stop editing" ),
tr( "Stop Editing" ),
tr( "Do you want to save the changes to layer %1?" ).arg( layer->name() ),
buttons ) )
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgshandlebadlayers.cpp
Expand Up @@ -266,7 +266,7 @@ void QgsHandleBadLayers::browseClicked()

QStringList selectedFiles;
QString enc;
QString title = tr( "Select file to replace '%1'" ).arg( fn );
QString title = tr( "Select File to Replace '%1'" ).arg( fn );

QgsGuiUtils::openFilesRememberingFilter( memoryQualifier, fileFilter, selectedFiles, enc, title );
if ( selectedFiles.size() != 1 )
Expand All @@ -279,7 +279,7 @@ void QgsHandleBadLayers::browseClicked()
}
else if ( mRows.size() > 1 )
{
QString title = tr( "Select new directory of selected files" );
QString title = tr( "Select New Directory of Selected Files" );

QgsSettings settings;
QString lastDir = settings.value( QStringLiteral( "UI/missingDirectory" ), QDir::homePath() ).toString();
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsidentifyresultsdialog.cpp
Expand Up @@ -1838,7 +1838,7 @@ void QgsIdentifyResultsDialog::printCurrentItem()

if ( !wv )
{
QMessageBox::warning( this, tr( "Cannot print" ), tr( "Cannot print this item" ) );
QMessageBox::warning( this, tr( "Print HTML Response" ), tr( "Cannot print this item." ) );
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmeasuretool.cpp
Expand Up @@ -85,7 +85,7 @@ void QgsMeasureTool::activate()
( mCanvas->extent().height() > 360 ||
mCanvas->extent().width() > 720 ) )
{
QMessageBox::warning( nullptr, tr( "Incorrect measure results" ),
QMessageBox::warning( nullptr, tr( "Incorrect Measure Results" ),
tr( "<p>This map is defined with a geographic coordinate system "
"(latitude/longitude) "
"but the map extents suggests that it is actually a projected "
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsnewspatialitelayerdialog.cpp
Expand Up @@ -241,7 +241,7 @@ void QgsNewSpatialiteLayerDialog::pbnFindSRID_clicked()
}
else
{
// XXX query failed -- warn the user some how
// XXX query failed -- warn the user somehow
QMessageBox::warning( nullptr, tr( "Error" ), tr( "Failed to load SRIDS: %1" ).arg( database.errorMessage() ) );
status = false;
}
Expand Down Expand Up @@ -289,8 +289,8 @@ bool QgsNewSpatialiteLayerDialog::createDb()
{
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 SpatiaLite 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 );
Expand Down Expand Up @@ -480,7 +480,7 @@ bool QgsNewSpatialiteLayerDialog::apply()
else
{
QgsDebugMsg( leLayerName->text() + " is an invalid layer - not loaded" );
QMessageBox::critical( this, tr( "Invalid Layer" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( leLayerName->text() ) );
QMessageBox::critical( this, tr( "SpatiaLite Database" ), tr( "%1 is an invalid layer and cannot be loaded." ).arg( leLayerName->text() ) );
delete layer;
}

Expand Down
12 changes: 6 additions & 6 deletions src/app/qgsoptions.cpp
Expand Up @@ -1017,7 +1017,7 @@ void QgsOptions::cbxProjectDefaultNew_toggled( bool checked )
QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" );
if ( ! QFile::exists( fileName ) )
{
QMessageBox::information( nullptr, tr( "Save default project" ), tr( "You must set a default project" ) );
QMessageBox::information( nullptr, tr( "Save Default Project" ), tr( "You must set a default project" ) );
cbxProjectDefaultNew->setChecked( false );
}
}
Expand All @@ -1028,11 +1028,11 @@ void QgsOptions::setCurrentProjectDefault()
QString fileName = QgsApplication::qgisSettingsDirPath() + QStringLiteral( "project_default.qgs" );
if ( QgsProject::instance()->write( fileName ) )
{
QMessageBox::information( nullptr, tr( "Save default project" ), tr( "Current project saved as default" ) );
QMessageBox::information( nullptr, tr( "Save Default Project" ), tr( "Current project saved as default" ) );
}
else
{
QMessageBox::critical( nullptr, tr( "Save default project" ), tr( "Error saving current project as default" ) );
QMessageBox::critical( nullptr, tr( "Save Default Project" ), tr( "Error saving current project as default" ) );
}
}

Expand Down Expand Up @@ -1920,13 +1920,13 @@ void QgsOptions::browseCacheDirectory()
void QgsOptions::clearCache()
{
QgsNetworkAccessManager::instance()->cache()->clear();
QMessageBox::information( this, tr( "Cache cleared" ), tr( "Content cache has been cleared" ) );
QMessageBox::information( this, tr( "Clear Cache" ), tr( "Content cache has been cleared." ) );
}

void QgsOptions::clearAccessCache()
{
QgsNetworkAccessManager::instance()->clearAccessCache();
QMessageBox::information( this, tr( "Cache cleared" ), tr( "Connection authentication cache has been cleared" ) );
QMessageBox::information( this, tr( "Clear Cache" ), tr( "Connection authentication cache has been cleared." ) );
}

void QgsOptions::optionsStackedWidget_CurrentChanged( int index )
Expand Down Expand Up @@ -2260,7 +2260,7 @@ void QgsOptions::scaleItemChanged( QListWidgetItem *changedScaleItem )
}
else
{
QMessageBox::warning( this, tr( "Invalid scale" ), tr( "The text you entered is not a valid scale." ) );
QMessageBox::warning( this, tr( "Set Scale" ), tr( "The text you entered is not a valid scale." ) );
changedScaleItem->setText( changedScaleItem->data( Qt::UserRole ).toString() );
}

Expand Down

0 comments on commit b3b17b6

Please sign in to comment.