Skip to content
Permalink
Browse files
Apply patch in ticket #316.
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/qgis@5886 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Sep 30, 2006
1 parent fed87e0 commit 3b81cb082293125006fd4b4a94c7673e852e3475
@@ -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"

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

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

mFont = QApplication::font();
mFamilyIsSet = true;
@@ -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();
}
@@ -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();
}
@@ -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.
@@ -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;
@@ -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;
@@ -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));
}
@@ -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" );
@@ -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) );
}
@@ -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) );
}
@@ -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;
@@ -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) );
}
@@ -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();
@@ -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;
}

@@ -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 );
@@ -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;
}
@@ -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;
}
@@ -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:
@@ -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;
}
@@ -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 );
@@ -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;
}
Loading

0 comments on commit 3b81cb0

Please sign in to comment.