use QgsDialog ; formatting cleanup

This commit is contained in:
Etienne Tourigny 2012-07-23 11:24:25 -03:00
parent a5e010f735
commit ee3bf0e29f
3 changed files with 43 additions and 23 deletions

View File

@ -27,6 +27,7 @@
#include "qgsproject.h"
#include "qgsrasterformatoptionswidget.h"
#include "qgsdialog.h"
#include <QInputDialog>
#include <QFileDialog>
@ -1093,30 +1094,23 @@ void QgsOptions::editGdalDriver( const QString& driverName )
if ( driverName.isEmpty() )
return;
QDialog dlg( this );
QVBoxLayout *layout = new QVBoxLayout();
QgsDialog dlg( this, 0, QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
QVBoxLayout *layout = dlg.layout();
QString title = tr( "Create Options - %1 Driver" ).arg( driverName );
if ( driverName == "_pyramids" )
title = tr( "Create Options - pyramids" );
dlg.setWindowTitle( title );
QLabel *label = new QLabel( title );
QLabel *label = new QLabel( title, &dlg );
label->setAlignment( Qt::AlignHCenter );
layout->addWidget( label );
QgsRasterFormatOptionsWidget* optionsWidget = new QgsRasterFormatOptionsWidget( 0, driverName, "gdal" );
QgsRasterFormatOptionsWidget* optionsWidget = new QgsRasterFormatOptionsWidget( &dlg, driverName, "gdal" );
layout->addWidget( optionsWidget );
optionsWidget->showProfileButtons( true );
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel );
connect( buttonBox, SIGNAL( accepted() ), &dlg, SLOT( accept() ) );
connect( buttonBox, SIGNAL( rejected() ), &dlg, SLOT( reject() ) );
layout->addWidget( buttonBox );
dlg.setLayout( layout );
if ( dlg.exec() == QDialog::Accepted )
{
// perhaps setting should not be applied already, but this is easier
optionsWidget->apply();
}
delete optionsWidget;
}
// Return state of the visibility flag for newly added layers. If

View File

@ -1,5 +1,23 @@
/***************************************************************************
qgsrasterformatoptionswidget.cpp
-------------------
begin : July 2012
copyright : (C) 2012 by Etienne Tourigny
email : etourigny dot dev at gmail dot 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. *
* *
***************************************************************************/
#include "qgsrasterformatoptionswidget.h"
#include "qgslogger.h"
#include "qgsdialog.h"
#include "gdal.h"
#include "cpl_string.h"
@ -10,7 +28,6 @@
#include <QInputDialog>
#include <QMessageBox>
#include <QTextEdit>
#include <QDialogButtonBox>
// todo put this somewhere else - how can we access gdal provider?
char** papszFromStringList( const QStringList& list )
@ -187,18 +204,12 @@ void QgsRasterFormatOptionsWidget::optionsHelp()
else
message = tr( "No help available" );
// show simple noon-modal dialog - should we make this basic xml pretty?
QDialog *dlg = new QDialog( this );
QVBoxLayout *layout = new QVBoxLayout();
// show simple non-modal dialog - should we make the basic xml prettier?
QgsDialog *dlg = new QgsDialog( this );
QTextEdit *textEdit = new QTextEdit( dlg );
layout->addWidget( textEdit );
textEdit->setReadOnly( true );
textEdit->setText( message );
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Close );
connect( buttonBox, SIGNAL( accepted() ), dlg, SLOT( accept() ) );
connect( buttonBox, SIGNAL( rejected() ), dlg, SLOT( reject() ) );
layout->addWidget( buttonBox );
dlg->setLayout( layout );
dlg->layout()->addWidget( textEdit );
dlg->resize( 600, 600 );
dlg->show(); //non modal
}

View File

@ -1,10 +1,25 @@
/***************************************************************************
qgsrasterformatoptionswidget.h
-------------------
begin : July 2012
copyright : (C) 2012 by Etienne Tourigny
email : etourigny dot dev at gmail dot 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. *
* *
***************************************************************************/
#ifndef QGSRASTERFORMATOPTIONSWIDGET_H
#define QGSRASTERFORMATOPTIONSWIDGET_H
#include "ui_qgsrasterformatoptionswidgetbase.h"
//class QgsRasterDataProvider;
class GUI_EXPORT QgsRasterFormatOptionsWidget: public QWidget, private Ui::QgsRasterFormatOptionsWidgetBase
{
Q_OBJECT