Skip to content

Commit

Permalink
use QgsDialog ; formatting cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesky committed Jul 23, 2012
1 parent a5e010f commit ee3bf0e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 23 deletions.
16 changes: 5 additions & 11 deletions src/app/qgsoptions.cpp
Expand Up @@ -27,6 +27,7 @@
#include "qgsproject.h"

#include "qgsrasterformatoptionswidget.h"
#include "qgsdialog.h"

#include <QInputDialog>
#include <QFileDialog>
Expand Down Expand Up @@ -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
Expand Down
31 changes: 21 additions & 10 deletions src/gui/raster/qgsrasterformatoptionswidget.cpp
@@ -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"
Expand All @@ -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 )
Expand Down Expand Up @@ -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
}
Expand Down
19 changes: 17 additions & 2 deletions src/gui/raster/qgsrasterformatoptionswidget.h
@@ -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
Expand Down

0 comments on commit ee3bf0e

Please sign in to comment.