addPage( createPage3() );
myFirstPageState = false;
myDbfState = false;
+ myUpdateViewerState = false;
}
QWizardPage* HYDROGUI_ImportLandCoverMapDlg::createPage1() {
void HYDROGUI_ImportLandCoverMapDlg::onItemSelectionChanged()
{
- int aCurIndex = GetCurrentWizardIndex();
- if (aCurIndex == 0)
+ int aCurIndex = getCurrentWizardIndex();
+ if (aCurIndex == 0 && getViewerState())
emit selectionChanged( getSelectedPolygonNames() );
}
myCorrTableWidget->setHorizontalHeaderItem(0, aHeader_1);
myCorrTableWidget->setHorizontalHeaderItem(1, aHeader_2);
myCorrTableWidget->setHorizontalHeaderItem(2, aHeader_3);
- myCorrTableWidget->horizontalHeader()->setResizeMode( QHeaderView::ResizeToContents );
+ myCorrTableWidget->horizontalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
//
for (int i = 0; i < aFCSize; i++)
{
//
for (int i = 0; i < aFCSize; i++)
{
- myCorrTableWidget->setItem(i, 2, new QTableWidgetItem);
- myCorrTableWidget->item(i, 2)->setBackground(myStrColors[theDefCBIndices[i]]);
+ QTableWidgetItem* aTWI = new QTableWidgetItem;
+ aTWI->setBackground(myStrColors[theDefCBIndices[i]]);
+ aTWI->setFlags(Qt::NoItemFlags);
+ myCorrTableWidget->setItem(i, 2, aTWI);
}
}
myFirstPageState = theState;
}
+bool HYDROGUI_ImportLandCoverMapDlg::getFirstPageState() const
+{
+ return myFirstPageState;
+}
+
+
bool HYDROGUI_ImportLandCoverMapDlg::acceptCurrent() const
{
//Check the state of the current page
- int aCurrPage = GetCurrentWizardIndex();
+ int aCurrPage = getCurrentWizardIndex();
switch ( aCurrPage )
{
case 0:
{
- if (!myFirstPageState)
- {
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("FILE_ISNT_CHOSEN"));
+ //this method verifies first page
+ if (!CheckFirstPageFilling())
return false;
- }
- if (myPolygonsListWidget->selectedItems().empty())
- {
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
- return false;
- }
- if (getAttrCheckBoxState() && !getDbfState())
- {
- SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), tr("DBF_LOAD_ERR_MESS"));
- return false;
- }
break;
}
case 1:
{
if (myDBFAttrListWidget->selectedItems().empty())
{
- SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), "Attribute isn't selected");
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr ("ATTRS_ISNT_SELECTED"));
return false;
}
break;
}
case 2: //last page
{
- if (myPolygonsListWidget->selectedItems().empty())
+ if (this->isPolygonListEmpty())
{
SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
return false;
return myDbfState;
}
-int HYDROGUI_ImportLandCoverMapDlg::GetCurrentWizardIndex() const
+void HYDROGUI_ImportLandCoverMapDlg::setDbfRecordsNb(int theRecordsNbs)
+{
+ myDbfRecordsNbs = theRecordsNbs;
+}
+
+int HYDROGUI_ImportLandCoverMapDlg::getDbfRecordsNb() const
+{
+ return myDbfRecordsNbs;
+}
+
+int HYDROGUI_ImportLandCoverMapDlg::getCurrentWizardIndex() const
{
return wizard()->currentIndex();
-}
\ No newline at end of file
+}
+
+void HYDROGUI_ImportLandCoverMapDlg::setViewerState(bool theState)
+{
+ myUpdateViewerState = theState;
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::getViewerState() const
+{
+ return myUpdateViewerState;
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::isPolygonListEmpty() const
+{
+ return myPolygonsListWidget->selectedItems().empty();
+}
+
+bool HYDROGUI_ImportLandCoverMapDlg::CheckFirstPageFilling() const
+{
+ if (!this->getFirstPageState())
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("FILE_ISNT_CHOSEN"));
+ return false;
+ }
+ if (this->isPolygonListEmpty())
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "LCM_IMPORT_WARNING" ), tr("POLYGONS_ISNT_SELECTED"));
+ return false;
+ }
+ if (this->getAttrCheckBoxState() && !this->getDbfState())
+ {
+ SUIT_MessageBox::critical( module()->getApp()->desktop(), tr( "DBF_LOAD_ERROR" ), tr("DBF_LOAD_ERR_MESS"));
+ return false;
+ }
+ if (this->getAttrCheckBoxState() && this->getDbfRecordsNb() == 0)
+ {
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "DBF_NB_RECORDS_IS_NULL" ), tr("DBF_NB_RECORDS_IS_NULL_MESS"));
+ return false;
+ }
+ return true;
+}