#include <QPushButton>
#include <QCheckBox>
-//TODO add new checkbox ('FUSE INTO THE ONE')!!!
HYDROGUI_ImportBathymetryDlg::HYDROGUI_ImportBathymetryDlg( HYDROGUI_Module* theModule, const QString& theTitle )
: HYDROGUI_InputPanel( theModule, theTitle )
{
QLabel* aFileNameLabel = new QLabel( tr( "FILE_NAME" ), myFileNameGroup );
myFileNames = new QListWidget( myFileNameGroup );
- myFileNames->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents );
- //myFileNames->setFocusPolicy(Qt::FocusPolicy::NoFocus); //TODO
- //myFileNames->setReadOnly( true );
+ //myFileNames->viewport()->setAttribute( Qt::WA_TransparentForMouseEvents );
+ //myFileNames->setFocusPolicy(Qt::FocusPolicy::NoFocus);
QPushButton* aBrowseBtn = new QPushButton( myFileNameGroup );
- // aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
aBrowseBtn->setText("Load files(s)");
aBrowseBtn->setIcon( aResMgr->loadPixmap( "HYDRO", tr( "BROWSE_ICO" ) ) );
QBoxLayout* aFileNameLayout = new QVBoxLayout( myFileNameGroup );
+
+ myFuseIntoOne = new QCheckBox();
+ myFuseIntoOne->setText("Import as one bathemetry object (fuse the geometry data)");
+ myFuseIntoOne->setEnabled( false );
+
aFileNameLayout->setMargin( 5 );
aFileNameLayout->setSpacing( 5 );
aFileNameLayout->addWidget( aFileNameLabel );
aFileNameLayout->addWidget( aBrowseBtn );
aFileNameLayout->addWidget( myFileNames );
+ aFileNameLayout->addWidget( myFuseIntoOne );
// Bathymetry name
myObjectNameGroup = new QGroupBox( tr( "BATHYMETRY_NAME" ) );
addStretch();
connect( aBrowseBtn, SIGNAL( clicked() ), this, SLOT( onBrowse() ) );
+ connect( myFuseIntoOne, SIGNAL( stateChanged(int) ), this, SLOT( onStateChanged(int) ) );
}
HYDROGUI_ImportBathymetryDlg::~HYDROGUI_ImportBathymetryDlg()
myFileNames->clear();
myObjectName->clear();
myObjectNameGroup->setEnabled( false );
+ myFuseIntoOne->setEnabled( false );
}
void HYDROGUI_ImportBathymetryDlg::setObjectName( const QString& theName )
{
myObjectName->setText( theName );
- myObjectNameGroup->setEnabled( !theName.isEmpty() || !myFileNames->count() );
+ bool ObjNameState = myObjectName->isEnabled();
+ myObjectNameGroup->setEnabled( !theName.isEmpty() || myFileNames->count() > 0 );
+ myObjectName->setEnabled(ObjNameState);
+ myFuseIntoOne->setEnabled( myFileNames->count() > 1 );
}
QString HYDROGUI_ImportBathymetryDlg::getObjectName() const
void HYDROGUI_ImportBathymetryDlg::setFileNames( const QStringList& theFileNames )
{
-
+ myFileNames->clear();
myFileNames->addItems( theFileNames );
- if ( !myObjectNameGroup->isEnabled() )
- myObjectNameGroup->setEnabled( !theFileNames.isEmpty() );
+ if (myFuseIntoOne->isChecked() || theFileNames.count() == 1 )
+ {
+ myObjectNameGroup->setEnabled( true );
+ myObjectName->setEnabled( true );
+ }
+ else
+ {
+ myObjectNameGroup->setEnabled( false );
+ myObjectName->setEnabled( false );
+ }
+ //
+ if (theFileNames.count() == 1)
+ myFuseIntoOne->setEnabled( false );
+ else if (theFileNames.count() > 1)
+ myFuseIntoOne->setEnabled( true );
+
}
QStringList HYDROGUI_ImportBathymetryDlg::getFileNames() const
return myInvertAltitudes->isChecked();
}
+void HYDROGUI_ImportBathymetryDlg::setFuseIntoOneOptionChecked( bool isFIO )
+{
+ myFuseIntoOne->setChecked( isFIO );
+}
+
+bool HYDROGUI_ImportBathymetryDlg::isFuseIntoOneOptionChecked() const
+{
+ return myFuseIntoOne->isChecked();
+}
+
+void HYDROGUI_ImportBathymetryDlg::setFuseIntoOneOptionEnabled(bool enabled)
+{
+ myFuseIntoOne->setEnabled(enabled);
+}
+
+bool HYDROGUI_ImportBathymetryDlg::isFuseIntoOneOptionEnabled() const
+{
+ return myFuseIntoOne->isEnabled();
+}
+
void HYDROGUI_ImportBathymetryDlg::onBrowse()
{
QString aFilter( tr( "BATHYMETRY_FILTER" ) );
}
}
-
+void HYDROGUI_ImportBathymetryDlg::onStateChanged (int state)
+{
+ if (getFileNames().count() > 1)
+ {
+ if (state == Qt::Checked)
+ {
+ myObjectName->setEnabled(true);
+ myObjectNameGroup->setEnabled(true);
+ }
+ else if (state == Qt::Unchecked)
+ {
+ myObjectName->setEnabled(false);
+ myObjectNameGroup->setEnabled(false);
+ }
+ }
+}