Skip to content
Permalink
Browse files
- Change to API for QgsMessageViewer (allow plain text or html input,
required changes in all code that uses QgsMessageViewer)

- Improvements to messages when qgis can't find a key column in a
postgres table
- Fix a couple of bugs when loading postgres tables (invalid layers
would appear to load, giving a legend entry, but not show anything on
the map)
- Tidy up of #includes in postgres files


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4911 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Feb 28, 2006
1 parent 193a00b commit 0c8a32e543a5d81e0488ddeffc1f2b43e6fdadb1
@@ -4567,8 +4567,8 @@ void QgisApp::socketConnectionClosed()
{
// show more info
QgsMessageViewer *mv = new QgsMessageViewer(this);
mv->setCaption(tr("QGIS - Changes in CVS Since Last Release"));
mv->setMessage(parts[2]);
mv->setCaption(tr("QGIS - Changes in SVN Since Last Release"));
mv->setMessageAsPlainText(parts[2]);
mv->exec();
}
}
@@ -315,8 +315,8 @@ void QgsDbSourceSelect::on_btnConnect_clicked()
{
QMessageBox::warning(this, tr("Connection failed"),
tr
("Connection to %1 on %2 failed. Either the database is down or your settings are incorrect.%3Check your username and password and try again.%4%5").
arg(settings.readEntry(key + "/database")).arg(settings.readEntry(key + "/host")).arg("\n\n").arg("\n\n").arg(PQerrorMessage(pd)));
("Connection to %1 on %2 failed. Either the database is down or your settings are incorrect.%3Check your username and password and try again.%4The database said:%5%6").
arg(settings.readEntry(key + "/database")).arg(settings.readEntry(key + "/host")).arg("\n\n").arg("\n\n").arg("\n").arg(PQerrorMessage(pd)));
}
}
}
@@ -29,11 +29,16 @@ QgsMessageViewer::~QgsMessageViewer()
{
}

void QgsMessageViewer::setMessage(const QString& msg)
void QgsMessageViewer::setMessageAsHtml(const QString& msg)
{
txtMessage->setHtml(msg);
}

void QgsMessageViewer::setMessageAsPlainText(const QString& msg)
{
txtMessage->setPlainText(msg);
}

void QgsMessageViewer::appendMessage(const QString& msg)
{
txtMessage->append(msg);
@@ -18,15 +18,22 @@
#ifndef QGSMESSAGEVIEWER_H
#define QGSMESSAGEVIEWER_H

#include "ui_qgsmessageviewer.h"
#include "qgisgui.h"
#include <ui_qgsmessageviewer.h>
#include <qgisgui.h>

class QgsMessageViewer: public QDialog, private Ui::QgsMessageViewer
{
public:
QgsMessageViewer(QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags);
~QgsMessageViewer();
void setMessage(const QString& msg);
// Call one of the setMessage...() functions first.
// Subsequent calls to appendMessage use the format as determined
// by the call to setMessage...()

// Treats the given text as html.
void setMessageAsHtml(const QString& msg);
// Treats the given text as plain text
void setMessageAsPlainText(const QString& msg);
void appendMessage(const QString& msg);
};

@@ -63,7 +63,7 @@ QgsRunProcess::QgsRunProcess(const QStringList& args,
// needs. It will delete itself when the dialog box is closed.
mLogViewer = new QgsMessageViewer(0, Qt::WDestructiveClose);
mLogViewer->setCaption(whole_cmd);
mLogViewer->appendMessage( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" );
mLogViewer->setMessageAsHtml( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" );
mLogViewer->show();
// Be told when the dialog box is closed (it gets destroyed when
// closed because of the Qt flag used when it was created above).
@@ -15,7 +15,7 @@
* *
***************************************************************************/

// $Id:$
// $Id$

#include <iostream>

@@ -106,6 +106,6 @@ void QgsConnectionDialog::saveConnection()
void QgsConnectionDialog::helpInfo(){
QString message = tr("General Interface Help:\n\n");
QgsMessageViewer * e = new QgsMessageViewer(this);
e->setMessage(message);
e->setMessageAsPlainText(message);
e->exec();
}
@@ -301,7 +301,7 @@ void QgsSpit::addFile()
error2 += "\n" + tr("REASON: One or both of the Shapefile files (*.dbf, *.shx) missing") + "\n\n";
}
QgsMessageViewer * e = new QgsMessageViewer( this );
e->setMessage( message + error1 + error2 );
e->setMessageAsPlainText( message + error1 + error2 );
e->exec();
}
}
@@ -397,7 +397,7 @@ void QgsSpit::helpInfo()
tr("[Quit] - quit the program\n") ) + QString(
tr("[Help] - display this help dialog") + "\n\n" );
QgsMessageViewer * e = new QgsMessageViewer( this );
e->setMessage( message );
e->setMessageAsPlainText( message );
e->exec();
}

@@ -1,4 +1,4 @@
INCLUDES = -I../../core/ -I../../gui/
INCLUDES = -I../../core/ -I../../gui/ -I../../ui/

%.moc.cpp: %.h
$(MOC) -o $@ $<

0 comments on commit 0c8a32e

Please sign in to comment.