Skip to content
Permalink
Browse files

use QgsDialog ; formatting cleanup

  • Loading branch information
etiennesky committed Jul 23, 2012
1 parent a5e010f commit ee3bf0e29f5e0fb14e98e09165f55ccdaaf6ad3f
@@ -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
@@ -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
}
@@ -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

0 comments on commit ee3bf0e

Please sign in to comment.
You can’t perform that action at this time.