Skip to content
Permalink
Browse files
Convert dialogs to Qt 4.2 StandardButton API.
Also fix memory leaks by using the delete operator or Qt::WA_DeleteOnClose along with accept or reject rather then deprecated Qt3 routines. Also eliminate compiler warnings.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6475 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Feb 1, 2007
1 parent 99a0d05 commit d22931690f2591ab0885cc970709607c0a3a70c9
Showing with 360 additions and 1,164 deletions.
  1. +2 −0 src/plugins/copyright_label/plugin.cpp
  2. +9 −14 src/plugins/copyright_label/plugingui.cpp
  3. +7 −8 src/plugins/copyright_label/plugingui.h
  4. +7 −53 src/plugins/copyright_label/pluginguibase.ui
  5. +1 −0 src/plugins/delimited_text/qgsdelimitedtextplugin.cpp
  6. +13 −8 src/plugins/delimited_text/qgsdelimitedtextplugingui.cpp
  7. +16 −9 src/plugins/delimited_text/qgsdelimitedtextplugingui.h
  8. +18 −125 src/plugins/delimited_text/qgsdelimitedtextpluginguibase.ui
  9. +1 −1 src/plugins/geoprocessing/qgsdlgpgbuffer.cpp
  10. +2 −2 src/plugins/geoprocessing/qgsdlgpgbuffer.h
  11. +10 −71 src/plugins/geoprocessing/qgsdlgpgbufferbase.ui
  12. +3 −5 src/plugins/geoprocessing/qgspggeoprocessing.cpp
  13. +1 −0 src/plugins/gps_importer/qgsgpsplugin.cpp
  14. +9 −6 src/plugins/gps_importer/qgsgpsplugingui.cpp
  15. +7 −4 src/plugins/gps_importer/qgsgpsplugingui.h
  16. +15 −64 src/plugins/gps_importer/qgsgpspluginguibase.ui
  17. +1 −0 src/plugins/grid_maker/plugin.cpp
  18. +13 −9 src/plugins/grid_maker/plugingui.cpp
  19. +8 −4 src/plugins/grid_maker/plugingui.h
  20. +7 −54 src/plugins/grid_maker/pluginguibase.ui
  21. +4 −3 src/plugins/navigation/navigation.cpp
  22. +10 −4 src/plugins/navigation/navigationgui.cpp
  23. +4 −2 src/plugins/navigation/navigationgui.h
  24. +10 −105 src/plugins/navigation/navigationgui.ui
  25. +1 −0 src/plugins/north_arrow/plugin.cpp
  26. +11 −12 src/plugins/north_arrow/plugingui.cpp
  27. +7 −6 src/plugins/north_arrow/plugingui.h
  28. +12 −54 src/plugins/north_arrow/pluginguibase.ui
  29. +1 −0 src/plugins/plugin_template/plugin.cpp
  30. +12 −9 src/plugins/plugin_template/plugingui.cpp
  31. +10 −6 src/plugins/plugin_template/plugingui.h
  32. +11 −90 src/plugins/plugin_template/pluginguibase.ui
  33. +1 −0 src/plugins/scale_bar/plugin.cpp
  34. +13 −10 src/plugins/scale_bar/plugingui.cpp
  35. +6 −5 src/plugins/scale_bar/plugingui.h
  36. +11 −53 src/plugins/scale_bar/pluginguibase.ui
  37. +0 −12 src/plugins/spit/qgsconnectiondialog.cpp
  38. +4 −4 src/plugins/spit/qgsconnectiondialog.h
  39. +8 −133 src/plugins/spit/qgsconnectiondialogbase.ui
  40. +10 −68 src/plugins/spit/qgseditreservedwordsbase.ui
  41. +5 −1 src/plugins/spit/qgseditreservedwordsdialog.cpp
  42. +8 −4 src/plugins/spit/qgseditreservedwordsdialog.h
  43. +12 −9 src/plugins/spit/qgsspit.cpp
  44. +3 −3 src/plugins/spit/qgsspit.h
  45. +11 −58 src/plugins/spit/qgsspitbase.ui
  46. +1 −0 src/plugins/spit/qgsspitplugin.cpp
  47. +11 −2 src/plugins/wfs/qgswfssourceselect.cpp
  48. +3 −0 src/plugins/wfs/qgswfssourceselect.h
  49. +10 −74 src/plugins/wfs/qgswfssourceselectbase.ui
@@ -122,6 +122,7 @@ void QgsCopyrightLabelPlugin::help()
void QgsCopyrightLabelPlugin::run()
{
QgsCopyrightLabelPluginGui *myPluginGui=new QgsCopyrightLabelPluginGui(qGisInterface->getMainWindow(), QgisGui::ModalDialogFlags);
myPluginGui->setAttribute(Qt::WA_DeleteOnClose);
//listen for when the layer has been made so we can draw it
//connect(myPluginGui, SIGNAL(drawRasterLayer(QString)), this, SLOT(drawRasterLayer(QString)));
//connect(myPluginGui, SIGNAL(drawVectorLayer(QString,QString,QString)), this, SLOT(drawVectorLayer(QString,QString,QString)));
@@ -134,6 +135,7 @@ void QgsCopyrightLabelPlugin::run()
myPluginGui->setText(mLabelQString);
myPluginGui->setPlacementLabels(mPlacementLabels);
myPluginGui->setPlacement(mPlacementIndex);
myPluginGui->setEnabled(mEnable);
myPluginGui->show();
}
//! Refresh the map display using the mapcanvas exported via the plugin interface
@@ -16,14 +16,6 @@

//standard includes

QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui() : QDialog()
{
setupUi(this);
//programmatically hide orientation selection for now
cboOrientation->hide();
textLabel15->hide();
}

QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui(QWidget* parent, Qt::WFlags fl)
: QDialog(parent, fl)
{
@@ -32,11 +24,12 @@ QgsCopyrightLabelPluginGui::QgsCopyrightLabelPluginGui(QWidget* parent, Qt::WFla
cboOrientation->hide();
textLabel15->hide();
}

QgsCopyrightLabelPluginGui::~QgsCopyrightLabelPluginGui()
{
}

void QgsCopyrightLabelPluginGui::on_pbnOK_clicked()
void QgsCopyrightLabelPluginGui::on_buttonBox_accepted()
{
//hide the dialog before we send all our signals
hide();
@@ -46,18 +39,20 @@ void QgsCopyrightLabelPluginGui::on_pbnOK_clicked()
emit changeColor(txtCopyrightText->color());
emit changePlacement(cboPlacement->currentIndex());
emit enableCopyrightLabel(cboxEnabled->isChecked());
done(1);

accept();
}
void QgsCopyrightLabelPluginGui::on_pbnCancel_clicked()

void QgsCopyrightLabelPluginGui::on_buttonBox_rejected()
{
close(1);
reject();
}

void QgsCopyrightLabelPluginGui::on_pbnHelp_clicked()
void QgsCopyrightLabelPluginGui::on_buttonBox_helpRequested()
{
QgsContextHelp::run(context_id);
}

void QgsCopyrightLabelPluginGui::setEnabled(bool theBool)
{
cboxEnabled->setChecked(theBool);
@@ -13,8 +13,8 @@
#define QGSCOPYRIGHTLABELPLUGINGUI_H

#include <ui_pluginguibase.h>
#include <qfont.h>
#include <qcolor.h>
#include <QColor>
#include <QFont>

/**
@author Tim Sutton
@@ -23,18 +23,17 @@ class QgsCopyrightLabelPluginGui : public QDialog, private Ui::QgsCopyrightLabel
{
Q_OBJECT;
public:
QgsCopyrightLabelPluginGui();
QgsCopyrightLabelPluginGui( QWidget* parent = 0, Qt::WFlags fl = 0 );
~QgsCopyrightLabelPluginGui();
void setText(QString);
void setPlacementLabels(QStringList&);
void setPlacement(int);

public slots:
void on_pbnOK_clicked();
void on_pbnCancel_clicked();
void on_pbnHelp_clicked();
void setEnabled(bool);

private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_buttonBox_helpRequested();

private:
static const int context_id = 32338213;
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>578</width>
<height>490</height>
<height>489</height>
</rect>
</property>
<property name="windowTitle" >
@@ -184,60 +184,14 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
<item row="4" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="spacing" >
<number>6</number>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
<item>
<widget class="QPushButton" name="pbnHelp" >
<property name="text" >
<string>Help</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>281</width>
<height>26</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbnOK" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="shortcut" >
<string>Alt+O</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbnCancel" >
<property name="text" >
<string>&amp;Cancel</string>
</property>
<property name="shortcut" >
<string>Alt+C</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
@@ -122,6 +122,7 @@ void QgsDelimitedTextPlugin::run()
QgsDelimitedTextPluginGui *myQgsDelimitedTextPluginGui=
new QgsDelimitedTextPluginGui(qGisInterface,
qGisInterface->getMainWindow(), QgisGui::ModalDialogFlags);
myQgsDelimitedTextPluginGui->setAttribute(Qt::WA_DeleteOnClose);
//listen for when the layer has been made so we can draw it
connect(myQgsDelimitedTextPluginGui,
SIGNAL(drawVectorLayer(QString,QString,QString)),
@@ -27,16 +27,14 @@
#include <QMessageBox>
#include <QTextStream>

QgsDelimitedTextPluginGui::QgsDelimitedTextPluginGui() : QDialog()
{
setupUi(this);

}

QgsDelimitedTextPluginGui::QgsDelimitedTextPluginGui(QgisInterface * _qI, QWidget * parent, Qt::WFlags fl)
: QDialog(parent, fl), qI(_qI)
{
setupUi(this);
pbnOK = buttonBox->button(QDialogButtonBox::Ok);
pbnParse = buttonBox->addButton(tr("Parse"), QDialogButtonBox::ActionRole);
connect(pbnParse, SIGNAL(clicked()), this, SLOT(on_pbnParse_clicked()));
enableButtons();
// at startup, fetch the last used delimiter and directory from
// settings
QSettings settings;
@@ -48,7 +46,7 @@ QgsDelimitedTextPluginGui::~QgsDelimitedTextPluginGui()
{
}
/** Autoconnected slots **/
void QgsDelimitedTextPluginGui::on_pbnHelp_clicked()
void QgsDelimitedTextPluginGui::on_buttonBox_helpRequested()
{
QgsContextHelp::run(context_id);
}
@@ -60,7 +58,7 @@ void QgsDelimitedTextPluginGui::on_pbnParse_clicked()
{
updateFieldLists();
}
void QgsDelimitedTextPluginGui::on_pbnOK_clicked()
void QgsDelimitedTextPluginGui::on_buttonBox_accepted()
{
if(txtLayerName->text().length() > 0)
{
@@ -80,13 +78,20 @@ void QgsDelimitedTextPluginGui::on_pbnOK_clicked()
settings.writeEntry(key + "/delimiter", txtDelimiter->text());
QFileInfo fi(txtFilePath->text());
settings.writeEntry(key + "/text_path", fi.dirPath());

accept();
}
else
{
QMessageBox::warning(this, tr("No layer name"), tr("Please enter a layer name before adding the layer to the map"));
}
}

void QgsDelimitedTextPluginGui::on_buttonBox_rejected()
{
reject();
}

void QgsDelimitedTextPluginGui::updateFieldLists()
{
// Update the x and y field dropdown boxes
@@ -24,23 +24,30 @@ class QgsDelimitedTextPluginGui : public QDialog, private Ui::QgsDelimitedTextPl
{
Q_OBJECT
public:
QgsDelimitedTextPluginGui();
QgsDelimitedTextPluginGui( QgisInterface * _qI, QWidget* parent = 0, Qt::WFlags fl = 0 );
~QgsDelimitedTextPluginGui();
public slots:
void on_pbnOK_clicked();
void on_pbnHelp_clicked();
void on_btnBrowseForFile_clicked();
void on_pbnParse_clicked();

public slots:
void help();

private:
void updateFieldLists();
void getOpenFileName();
void enableButtons();
void help();

private:
QgisInterface * qI;
QAbstractButton *pbnOK;
QAbstractButton *pbnParse;
static const int context_id = 1033030847;
signals:

private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
void on_buttonBox_helpRequested();
void on_btnBrowseForFile_clicked();
void on_pbnParse_clicked();

signals:
void drawRasterLayer(QString);
void drawVectorLayer(QString,QString,QString);
};

0 comments on commit d229316

Please sign in to comment.