Skip to content

Commit

Permalink
- Change to API for QgsMessageViewer (allow plain text or html input,
Browse files Browse the repository at this point in the history
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@4911 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Feb 28, 2006
1 parent 90f2f9b commit 32fcc4a
Show file tree
Hide file tree
Showing 10 changed files with 328 additions and 203 deletions.
4 changes: 2 additions & 2 deletions src/gui/qgisapp.cpp
Expand Up @@ -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();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsdbsourceselect.cpp
Expand Up @@ -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)));
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/gui/qgsmessageviewer.cpp
Expand Up @@ -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);
Expand Down
13 changes: 10 additions & 3 deletions src/gui/qgsmessageviewer.h
Expand Up @@ -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);
};

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsrunprocess.cpp
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/spit/qgsconnectiondialog.cpp
Expand Up @@ -15,7 +15,7 @@
* *
***************************************************************************/

// $Id:$
// $Id$

#include <iostream>

Expand Down Expand Up @@ -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();
}
4 changes: 2 additions & 2 deletions src/plugins/spit/qgsspit.cpp
Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion src/providers/postgres/Makefile.am
@@ -1,4 +1,4 @@
INCLUDES = -I../../core/ -I../../gui/
INCLUDES = -I../../core/ -I../../gui/ -I../../ui/

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

0 comments on commit 32fcc4a

Please sign in to comment.