Skip to content

Commit

Permalink
Apply patch in ticket #316.
Browse files Browse the repository at this point in the history
Tidy up #includes in qgslabelattributes.*
Remove a compiler warning about returning a temporary object in qgslabelattribute.*


git-svn-id: http://svn.osgeo.org/qgis/trunk@5886 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 30, 2006
1 parent b1705c1 commit f7117cb
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 142 deletions.
18 changes: 9 additions & 9 deletions src/core/qgslabelattributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
/* $Id$ */
#include <iostream>

#include <qapplication.h>
#include <qstring.h>
#include <qfont.h>
#include <qcolor.h>
#include <qpen.h>
#include <qbrush.h>
#include <QApplication>
#include <QString>
#include <QFont>
#include <QColor>
#include <QPen>
#include <QBrush>

#include "qgslabelattributes.h"

Expand Down Expand Up @@ -55,7 +55,7 @@ QgsLabelAttributes::QgsLabelAttributes( bool def )
{

if ( def ) { // set defaults
setText ( "Label" );
setText (QObject::tr("Label"));

mFont = QApplication::font();
mFamilyIsSet = true;
Expand Down Expand Up @@ -316,7 +316,7 @@ bool QgsLabelAttributes::bufferColorIsSet ( void ) const
return mColorIsSet;
}

const QColor & QgsLabelAttributes::bufferColor ( void ) const
QColor QgsLabelAttributes::bufferColor ( void ) const
{
return mBufferBrush.color();
}
Expand Down Expand Up @@ -350,7 +350,7 @@ bool QgsLabelAttributes::borderColorIsSet ( void ) const
return mBorderColorIsSet;
}

const QColor & QgsLabelAttributes::borderColor ( void ) const
QColor QgsLabelAttributes::borderColor ( void ) const
{
return mBorderPen.color();
}
Expand Down
8 changes: 3 additions & 5 deletions src/core/qgslabelattributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@
#ifndef QGSLABELATTRIBUTES_H
#define QGSLABELATTRIBUTES_H

#include <qnamespace.h>
#include <qpen.h>
#include <QPen>
class QString;
class QFont;
class QColor;
class QPen;
class QBrush;

/** This class can be used to store attributes needed for label rendering.
Expand Down Expand Up @@ -154,7 +152,7 @@ class QgsLabelAttributes

void setBufferColor ( const QColor &color );
bool bufferColorIsSet ( void ) const;
const QColor & bufferColor ( void ) const;
QColor bufferColor ( void ) const;

void setBufferStyle ( Qt::BrushStyle style );
bool bufferStyleIsSet ( void ) const;
Expand All @@ -163,7 +161,7 @@ class QgsLabelAttributes
/* Border */
void setBorderColor ( const QColor &color );
bool borderColorIsSet ( void ) const;
const QColor & borderColor ( void ) const;
QColor borderColor ( void ) const;

void setBorderWidth ( int width );
bool borderWidthIsSet ( void ) const;
Expand Down
2 changes: 1 addition & 1 deletion src/helpviewer/qgshelpviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void QgsHelpViewer::loadContext(const QString &contextId)
}
else
{
QMessageBox::critical(this, "Error",
QMessageBox::critical(this, tr("Error"),
tr("Failed to get the help text from the database") + QString(":\n ")
+ sqlite3_errmsg(db));
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qgsgrassattributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void QgsGrassAttributes::updateAttributes ( )
QString *error = mProvider->updateAttributes ( tb->text(0,1).toInt(), tb->text(1,1).toInt(), sql );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", *error );
QMessageBox::warning( 0, tr("Warning"), *error );
resultLabel->setText ( "ERROR" );
} else {
resultLabel->setText ( "OK" );
Expand Down
20 changes: 10 additions & 10 deletions src/plugins/grass/qgsgrassbrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ void QgsGrassBrowser::copyMap()
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot copy map "
QMessageBox::warning( 0, tr("Warning"), tr("Cannot copy map ")
+ map + "@" + mapset
+ "<br>command: " + module + " " + args.join(" ")
+ tr("<br>command: ") + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
Expand Down Expand Up @@ -351,9 +351,9 @@ void QgsGrassBrowser::renameMap()
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot rename map "
QMessageBox::warning( 0, tr("Warning"), tr("Cannot rename map ")
+ map
+ "<br>command: " + module + " " + args.join(" ")
+ tr("<br>command: ") + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
Expand Down Expand Up @@ -389,8 +389,8 @@ void QgsGrassBrowser::deleteMap()
continue; // should not happen
}

int ret = QMessageBox::question ( 0, "Warning",
"Delete map <b>" + map + "</b>",
int ret = QMessageBox::question ( 0, tr("Warning"),
tr("Delete map <b>") + map + "</b>",
QMessageBox::Yes, QMessageBox::No );

if ( ret == QMessageBox::No ) continue;
Expand All @@ -406,9 +406,9 @@ void QgsGrassBrowser::deleteMap()
{
QString output ( process.readAllStandardOutput () );
QString error ( process.readAllStandardError () );
QMessageBox::warning( 0, "Warning", "Cannot delete map "
QMessageBox::warning( 0, tr("Warning"), tr("Cannot delete map ")
+ map
+ "<br>command: " + module + " " + args.join(" ")
+ tr("<br>command: ") + module + " " + args.join(" ")
+ "<br>" + formatMessage(output)
+ "<br>" + formatMessage(error) );
}
Expand Down Expand Up @@ -450,8 +450,8 @@ void QgsGrassBrowser::writeRegion(struct Cell_head *window )

if ( G_put_window ( window ) == -1 )
{
QMessageBox::warning( 0, "Warning",
"Cannot write new region" );
QMessageBox::warning( 0, tr("Warning"),
tr("Cannot write new region") );
return;
}
emit regionChanged();
Expand Down
30 changes: 15 additions & 15 deletions src/plugins/grass/qgsgrassedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,13 @@ QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
void QgsGrassEdit::init()
{
if ( !(mProvider->isGrassEditable()) ) {
QMessageBox::warning( 0, "Warning", "You are not owner of the mapset, "
"cannot open the vector for editing." );
QMessageBox::warning( 0, tr("Warning"), tr("You are not owner of the mapset, "
"cannot open the vector for editing.") );
return;
}

if ( !(mProvider->startEdit()) ) {
QMessageBox::warning( 0, "Warning", "Cannot open vector for update." );
QMessageBox::warning( 0, tr("Warning"), tr("Cannot open vector for update." ));
return;
}

Expand Down Expand Up @@ -691,9 +691,9 @@ void QgsGrassEdit::alterTable ( void )
QString *error = mProvider->createTable ( field, mAttributeTable->item(0,0)->text(), sql );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", *error );
QMessageBox::warning( 0, tr("Warning"), *error );
} else {
QMessageBox::information( 0, "Info", "The table was created" );
QMessageBox::information( 0, tr("Info"), tr("The table was created") );
QString str;
str.sprintf ( "%d", field );
mFieldBox->insertItem( str );
Expand All @@ -716,7 +716,7 @@ void QgsGrassEdit::alterTable ( void )
QString *error = mProvider->addColumn ( field, sql );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", *error );
QMessageBox::warning( 0, tr("Warning"), *error );
}
delete error;
}
Expand Down Expand Up @@ -1084,7 +1084,7 @@ int QgsGrassEdit::writeLine ( int type, struct line_pnts *Points )
QString *error = mProvider->insertAttributes ( field, cat );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", *error );
QMessageBox::warning( 0, tr("Warning"), *error );
}
delete error;
}
Expand Down Expand Up @@ -1323,7 +1323,7 @@ void QgsGrassEdit::startTool(int tool)

case EDIT_CATS:
mTool = NONE;
QMessageBox::warning( 0, "Warning", "Tool not yet implemented." );
QMessageBox::warning( 0, tr("Warning"), tr("Tool not yet implemented.") );
break;

default:
Expand All @@ -1350,23 +1350,23 @@ void QgsGrassEdit::checkOrphan ( int field, int cat )
QString *error = mProvider->isOrphan ( field, cat, &orphan );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", "Cannot check orphan record: "
QMessageBox::warning( 0, tr("Warning"), tr("Cannot check orphan record: ")
+ *error );
return;
}
if ( !orphan ) return;

int ret = QMessageBox::question ( 0, "Warning",
"Orphan record was left in attribute table. "
"<br>Delete the record?",
int ret = QMessageBox::question ( 0, tr("Warning"),
tr("Orphan record was left in attribute table. "
"<br>Delete the record?"),
QMessageBox::Yes, QMessageBox::No );

if ( ret == QMessageBox::No ) return;

// Delete record
error = mProvider->deleteAttributes ( field, cat );
if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", "Cannot delete orphan record: "
QMessageBox::warning( 0, tr("Warning"), tr("Cannot delete orphan record: ")
+ *error );
return;
}
Expand Down Expand Up @@ -1395,7 +1395,7 @@ void QgsGrassEdit::addAttributes ( int field, int cat )
if ( cols->size() == 0 ) {
QString str;
str.setNum( field );
QMessageBox::warning( 0, "Warning", "Cannot describe table for field " + str );
QMessageBox::warning( 0, tr("Warning"), tr("Cannot describe table for field ") + str );
} else {
std::vector<QgsFeatureAttribute> *atts =
mProvider->attributes ( field, cat );
Expand Down Expand Up @@ -1452,7 +1452,7 @@ void QgsGrassEdit::addCat ( int line )
QString *error = mProvider->insertAttributes ( field, cat );

if ( !error->isEmpty() ) {
QMessageBox::warning( 0, "Warning", *error );
QMessageBox::warning( 0, tr("Warning"), *error );
}
delete error;
}
Expand Down
Loading

0 comments on commit f7117cb

Please sign in to comment.