Port MessageViewer dialog to Qt4. (qgsmessageviewer.ui.h converted to qgsmessageviewer.cpp/h)

Also remove some 'fixme' comments for other items which have recently been ported to Qt4.


git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4461 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
telwertowski 2006-01-02 03:50:58 +00:00
parent f2a7f19996
commit 3fcde2612b
6 changed files with 119 additions and 37 deletions

View File

@ -134,6 +134,7 @@ libqgisHEADERS = \
qgsmarkerdialog.h \ qgsmarkerdialog.h \
qgsmarkersymbol.h \ qgsmarkersymbol.h \
qgsmeasure.h \ qgsmeasure.h \
qgsmessageviewer.h \
qgsnewhttpconnection.h \ qgsnewhttpconnection.h \
qgsnumericsortlistviewitem.h \ qgsnumericsortlistviewitem.h \
qgsoptions.h \ qgsoptions.h \
@ -294,6 +295,7 @@ libqgis_la_SOURCES = \
qgsmarkerdialog.cpp \ qgsmarkerdialog.cpp \
qgsmarkersymbol.cpp \ qgsmarkersymbol.cpp \
qgsmeasure.cpp \ qgsmeasure.cpp \
qgsmessageviewer.cpp \
qgsnewhttpconnection.cpp \ qgsnewhttpconnection.cpp \
qgsnumericsortlistviewitem.cpp \ qgsnumericsortlistviewitem.cpp \
qgsoptions.cpp \ qgsoptions.cpp \

View File

@ -101,6 +101,7 @@
#include "qgsmaplayerregistry.h" #include "qgsmaplayerregistry.h"
#include "qgsmapoverviewcanvas.h" #include "qgsmapoverviewcanvas.h"
#include "qgsmapserverexport.h" #include "qgsmapserverexport.h"
#include "qgsmessageviewer.h"
#include "qgsoptions.h" #include "qgsoptions.h"
#include "qgspastetransformations.h" #include "qgspastetransformations.h"
#include "qgspluginitem.h" #include "qgspluginitem.h"
@ -136,8 +137,6 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
//The next one needs to be sublassed!
//#include "qgsmessageviewer.ui"
//#include "qgssisydialog.h" //#include "qgssisydialog.h"
// XXX deprecated?? #include "qgslegenditem.h" // XXX deprecated?? #include "qgslegenditem.h"
@ -450,17 +449,16 @@ void QgisApp::createActions()
// //
// Settings Menu Related Items // Settings Menu Related Items
// //
// FIXME - causes segfault when invoked
mActionProjectProperties= new QAction(QIcon(iconPath+"/mActionProjectProperties.png"), tr("Project Properties"), this); mActionProjectProperties= new QAction(QIcon(iconPath+"/mActionProjectProperties.png"), tr("Project Properties"), this);
mActionProjectProperties->setShortcut(tr("Alt+P")); mActionProjectProperties->setShortcut(tr("Alt+P"));
mActionProjectProperties->setStatusTip(tr("Set project properties")); mActionProjectProperties->setStatusTip(tr("Set project properties"));
connect(mActionProjectProperties, SIGNAL(triggered()), this, SLOT(projectProperties())); connect(mActionProjectProperties, SIGNAL(triggered()), this, SLOT(projectProperties()));
// FIXME - causes segfault when invoked //
mActionOptions= new QAction(QIcon(iconPath+"/mActionOptions.png"), tr("QGIS Options"), this); mActionOptions= new QAction(QIcon(iconPath+"/mActionOptions.png"), tr("QGIS Options"), this);
mActionOptions->setShortcut(tr("Alt+O")); mActionOptions->setShortcut(tr("Alt+O"));
mActionOptions->setStatusTip(tr("Change various QGIS options")); mActionOptions->setStatusTip(tr("Change various QGIS options"));
connect(mActionOptions, SIGNAL(triggered()), this, SLOT(options())); connect(mActionOptions, SIGNAL(triggered()), this, SLOT(options()));
// FIXME - causes segfault when invoked //
mActionCustomProjection= new QAction(QIcon(iconPath+"/mActionCustomProjection.png"), tr("Custom Projection"), this); mActionCustomProjection= new QAction(QIcon(iconPath+"/mActionCustomProjection.png"), tr("Custom Projection"), this);
mActionCustomProjection->setShortcut(tr("Alt+I")); mActionCustomProjection->setShortcut(tr("Alt+I"));
mActionCustomProjection->setStatusTip(tr("Manage custom projections")); mActionCustomProjection->setStatusTip(tr("Manage custom projections"));
@ -577,7 +575,7 @@ void QgisApp::createActions()
connect(mActionInOverview, SIGNAL(triggered()), this, SLOT(inOverview())); connect(mActionInOverview, SIGNAL(triggered()), this, SLOT(inOverview()));
// //
// Plugin Menu Related Items // Plugin Menu Related Items
// FIXME - segfalts when run... //
mActionShowPluginManager= new QAction(QIcon(iconPath+"/mActionShowPluginManager.png"), tr("Plugin Manager"), this); mActionShowPluginManager= new QAction(QIcon(iconPath+"/mActionShowPluginManager.png"), tr("Plugin Manager"), this);
mActionShowPluginManager->setShortcut(tr("Ctrl+P")); mActionShowPluginManager->setShortcut(tr("Ctrl+P"));
mActionShowPluginManager->setStatusTip(tr("Open the plugin manager")); mActionShowPluginManager->setStatusTip(tr("Open the plugin manager"));
@ -4440,12 +4438,11 @@ void QgisApp::socketConnectionClosed()
int result = QMessageBox::information(this, tr("QGIS Version Information"), versionInfo, tr("Yes"), tr("No")); int result = QMessageBox::information(this, tr("QGIS Version Information"), versionInfo, tr("Yes"), tr("No"));
if (result == 0) if (result == 0)
{ {
//!NOTE Tim disabled for now (QT4 port) - this needs to be revisited
// show more info // show more info
//QgsMessageViewer *mv = new QgsMessageViewer(this); QgsMessageViewer *mv = new QgsMessageViewer(this);
//mv->setCaption(tr("QGIS - Changes in CVS Since Last Release")); mv->setCaption(tr("QGIS - Changes in CVS Since Last Release"));
//mv->setMessage(parts[2]); mv->setMessage(parts[2]);
//mv->exec(); mv->exec();
} }
} }
else else

45
src/qgsmessageviewer.cpp Normal file
View File

@ -0,0 +1,45 @@
/***************************************************************************
qgsmessageviewer.cpp - description
-------------------
begin : Wed Jun 4 2003
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#include "qgsmessageviewer.h"
QgsMessageViewer::QgsMessageViewer(QWidget *parent, const char *name, bool modal, Qt::WFlags f)
: QDialog(parent, name, modal, f)
{
setupUi(this);
}
QgsMessageViewer::~QgsMessageViewer()
{
}
void QgsMessageViewer::setTextFormat(Qt::TextFormat f)
{
txtMessage->setTextFormat(f);
}
void QgsMessageViewer::setMessage(const QString& msg)
{
txtMessage->setText(msg);
}
void QgsMessageViewer::appendMessage(const QString& msg)
{
txtMessage->append(msg);
}

34
src/qgsmessageviewer.h Normal file
View File

@ -0,0 +1,34 @@
/***************************************************************************
qgsmessageviewer.h - description
-------------------
begin : Wed Jun 4 2003
copyright : (C) 2002 by Gary E.Sherman
email : sherman at mrcc.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGSMESSAGEVIEWER_H
#define QGSMESSAGEVIEWER_H
#include "ui_qgsmessageviewer.h"
#include <QDialog>
class QgsMessageViewer: public QDialog, private Ui::QgsMessageViewer
{
public:
QgsMessageViewer(QWidget *parent, const char *name = 0, bool modal = false, Qt::WFlags f = 0);
~QgsMessageViewer();
void setTextFormat(Qt::TextFormat f);
void setMessage(const QString& msg);
void appendMessage(const QString& msg);
};
#endif

View File

@ -21,11 +21,9 @@
#include "qgsrunprocess.h" #include "qgsrunprocess.h"
#include "ui_qgsmessageviewer.h" #include "qgsmessageviewer.h"
#include <qstring.h> #include <QMessageBox>
#include <qmessagebox.h> #include <Q3Process>
#include <q3process.h>
#include <q3textedit.h>
QgsRunProcess::QgsRunProcess(const QStringList& args, QgsRunProcess::QgsRunProcess(const QStringList& args,
bool capture) : mProcess(NULL), mLogViewer(NULL) bool capture) : mProcess(NULL), mLogViewer(NULL)
@ -60,22 +58,17 @@ QgsRunProcess::QgsRunProcess(const QStringList& args,
} }
else if (capture) else if (capture)
{ {
//
// Temporarily disabled by Tim during qt4 ui porting FIXME!!!
//
/*
// Create a dialog box to display the output. Use the // Create a dialog box to display the output. Use the
// QgsMessageViewer dialog, but tweak its behaviour to suit our // QgsMessageViewer dialog, but tweak its behaviour to suit our
// needs. It will delete itself when the dialog box is closed. // needs. It will delete itself when the dialog box is closed.
mLogViewer = new QgsMessageViewer(0, "", false, Qt::WDestructiveClose); mLogViewer = new QgsMessageViewer(0, "", false, Qt::WDestructiveClose);
mLogViewer->txtMessage->setTextFormat(Qt::LogText); mLogViewer->setTextFormat(Qt::LogText);
mLogViewer->setCaption(whole_cmd); mLogViewer->setCaption(whole_cmd);
mLogViewer->txtMessage->append( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" ); mLogViewer->appendMessage( "<b>" + tr("Starting") + " " + whole_cmd + "...</b>" );
mLogViewer->show(); mLogViewer->show();
// Be told when the dialog box is closed (it gets destroyed when // Be told when the dialog box is closed (it gets destroyed when
// closed because of the Qt flag used when it was created above). // closed because of the Qt flag used when it was created above).
connect(mLogViewer, SIGNAL(destroyed()), this, SLOT(dialogGone())); connect(mLogViewer, SIGNAL(destroyed()), this, SLOT(dialogGone()));
*/
} }
else else
// We're not capturing the output from the process, so we don't // We're not capturing the output from the process, so we don't
@ -101,9 +94,7 @@ void QgsRunProcess::stdoutAvailable()
QString line; QString line;
while ((line = mProcess->readLineStdout()) != QString::null) while ((line = mProcess->readLineStdout()) != QString::null)
{ {
//Tim disabled log viewer during qt4 ui port - FIXME! mLogViewer->appendMessage(line);
assert(1==0);
// mLogViewer->txtMessage->append(line);
} }
} }
} }
@ -114,14 +105,12 @@ void QgsRunProcess::stderrAvailable()
if (mProcess->canReadLineStderr()) if (mProcess->canReadLineStderr())
{ {
QString line; QString line;
//mLogViewer->txtMessage->append("<font color=red>"); mLogViewer->appendMessage("<font color=red>");
while ((line = mProcess->readLineStderr()) != QString::null) while ((line = mProcess->readLineStderr()) != QString::null)
{ {
//Tim disabled log viewer during qt4 ui port - FIXME! mLogViewer->appendMessage(line);
assert(1==0);
// mLogViewer->txtMessage->append(line);
} }
// mLogViewer->txtMessage->append("</font>"); mLogViewer->appendMessage("</font>");
} }
} }
@ -135,11 +124,9 @@ void QgsRunProcess::processExit()
// test against 0 is for). // test against 0 is for).
if (mLogViewer != 0) if (mLogViewer != 0)
{ {
//Tim disabled log viewer during qt4 ui port - FIXME! mLogViewer->appendMessage( "<b>" + tr("Done") + "</b>" );
assert(1==0); }
//mLogViewer->txtMessage->append( "<b>" + tr("Done") + "</b>" );
}
// Since the dialog box takes care of deleting itself, and the // Since the dialog box takes care of deleting itself, and the
// process has gone, there's no need for this instance to stay // process has gone, there's no need for this instance to stay

View File

@ -78,5 +78,22 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections/> <connections>
<connection>
<sender>btnClose</sender>
<signal>clicked()</signal>
<receiver>QgsMessageViewer</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>249</x>
<y>256</y>
</hint>
<hint type="destinationlabel" >
<x>249</x>
<y>141</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>