-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_FilterLibraryDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
connect(myOpenBtn, SIGNAL(clicked()), this, SLOT(onBrowse()));
connect(myListBox, SIGNAL(itemSelectionChanged()),
- this, SLOT(onFilterChanged()));
+ this, SLOT(onFilterChanged()));
connect(myAddBtn, SIGNAL(clicked()), this, SLOT(onAddBtnPressed()));
connect(myDeleteBtn, SIGNAL(clicked()), this, SLOT(onDeleteBtnPressed()));
myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp);
myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
- myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
aLay->addWidget(myButtons[ BTN_Apply ]);
aLay->addSpacing(10);
aLay->addStretch();
- aLay->addWidget(myButtons[ BTN_Cancel ]);
aLay->addWidget(myButtons[ BTN_Close ]);
aLay->addWidget(myButtons[ BTN_Help ]);
connect(myButtons[ BTN_OK ], SIGNAL(clicked()), SLOT(onOk()));
- connect(myButtons[ BTN_Cancel ], SIGNAL(clicked()), SLOT(onClose()));
- connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(onClose()));
+ connect(myButtons[ BTN_Close ], SIGNAL(clicked()), SLOT(reject()));
connect(myButtons[ BTN_Apply ], SIGNAL(clicked()), SLOT(onApply()));
connect(myButtons[ BTN_Help ], SIGNAL(clicked()), SLOT(onHelp()));
//=======================================================================
void SMESHGUI_FilterLibraryDlg::updateMainButtons()
{
+ myButtons[ BTN_Close ]->show();
if (myTypes.count() == 1) {
- myButtons[ BTN_Cancel ]->show();
myButtons[ BTN_Apply ]->hide();
- myButtons[ BTN_Close ]->hide();
} else {
- myButtons[ BTN_Cancel ]->hide();
myButtons[ BTN_Apply ]->show();
- myButtons[ BTN_Close ]->show();
}
}
setEnabled(true);
connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
- connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+ connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject()));
if (myMode == ADD_TO)
{
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return false;
}
} else if (myMode == EDIT || myMode == ADD_TO) {
SMESH::Filter_var aFilter = createFilter();
if (!myListBox->selectedItems().empty() &&
- !myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter.in())) {
+ !myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
+ myName->text().toLatin1().constData(),
+ aFilter.in())) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_EDITING"));
+ tr("ERROR_OF_EDITING"));
aResult = false;
}
else
delete aFileName;
} else if (myMode != COPY_FROM) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_SAVING"));
+ tr("ERROR_OF_SAVING"));
} else {
}
//=======================================================================
void SMESHGUI_FilterLibraryDlg::onOk()
{
- if (onApply())
- {
+ if (onApply()) {
disconnect( mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
accept();
}
//=======================================================================
-// name : SMESHGUI_FilterLibraryDlg::onClose
+// name : SMESHGUI_FilterLibraryDlg::reject
// Purpose : SLOT called when "Close" button pressed. Close dialog
//=======================================================================
-void SMESHGUI_FilterLibraryDlg::onClose()
+void SMESHGUI_FilterLibraryDlg::reject()
{
disconnect( mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
- reject();
+ QDialog::reject();
}
//=================================================================================
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
setEnabled(true);
}
-//=================================================================================
-// function : closeEvent()
-// purpose : Close dialog
-//=================================================================================
-void SMESHGUI_FilterLibraryDlg::closeEvent(QCloseEvent* e)
-{
- onClose();
-}
-
//=======================================================================
// name : SMESHGUI_FilterLibraryDlg::getFileName
// Purpose : Get file name
if (myLibrary->_is_nil()) {
if (myMode == COPY_FROM) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_LOAD"));
+ tr("ERROR_LOAD"));
return;
} else {
myLibrary = aFilterMgr->CreateLibrary();
if (aCurrName.isEmpty()) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("EMPTY_FILTER_NAME"));
+ tr("EMPTY_FILTER_NAME"));
return false;
}
if (aNames[ f ] == aCurrName && aNames[ f ] != myCurrFilterName) {
if (theMess)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_INSUFFICIENT_DATA"),
- tr("ERROR_FILTER_NAME"));
+ tr("ERROR_FILTER_NAME"));
return false;
}
}
if (!isWritable) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("NO_PERMISSION"));
+ tr("NO_PERMISSION"));
return false;
}
SMESH::Filter_var aFilter = createFilter();
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
// Fill table with filter parameters
SMESH::Filter_var aFilter = createFilter();
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
myTable->Clear(myTable->GetType());
{
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return;
}
if (!aResult) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_ADDING"));
+ tr("ERROR_OF_ADDING"));
}
updateList();
if (theName != aName)
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WARNING"),
- tr("ASSIGN_NEW_NAME").arg(theName).arg(aName));
+ tr("ASSIGN_NEW_NAME").arg(theName).arg(aName));
}
//=======================================================================
{
if (myLibrary->_is_nil()) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_WRN_WARNING"),
- tr("LIBRARY_IS_NOT_LOADED"));
+ tr("LIBRARY_IS_NOT_LOADED"));
return;
}
if (anIndex == -1 || !myLibrary->Delete(myCurrFilterName.toLatin1().constData())) {
SUIT_MessageBox::information(SMESHGUI::desktop(), tr("SMESH_ERROR"),
- tr("ERROR_OF_DELETING"));
+ tr("ERROR_OF_DELETING"));
} else {
myCurrFilterName = "";
myCurrFilter = -1;
{
SMESH::Filter_var aFilter = createFilter(myTable->GetType());
myLibrary->Replace(myCurrFilterName.toLatin1().constData(),
- myName->text().toLatin1().constData(),
- aFilter);
+ myName->text().toLatin1().constData(),
+ aFilter);
}
}
}