+void HYDROGUI_ProfileDlg::ProfileNameChanged(QString text)
+{
+ myCurrentName = text;
+}
+
+void HYDROGUI_ProfileDlg::onProfileIndexChanged()
+{
+ int theIndex = GetProfileSelectionIndex();
+ if (theIndex > -1)
+ SwitchToProfile(theIndex);
+}
+
+int HYDROGUI_ProfileDlg::GetProfileSelectionIndex()
+{
+ if (!myProfilesPointer)
+ return -1;
+ QModelIndexList MI = myProfileNames->selectionModel()->selectedIndexes();
+ if (MI.size() != 1)
+ return -1;
+ return MI.first().row();
+}
+
+void HYDROGUI_ProfileDlg::BlockProfileNameSignals(bool state)
+{
+ myProfileNames->blockSignals(state);
+}
+
+void HYDROGUI_ProfileDlg::SwitchToProfile(int theIndex)
+{
+ myEditorWidget->setCurve(NULL);
+ myEditorWidget->reset();
+ myEditorWidget->setActionMode( CurveCreator_Widget::AdditionMode );
+ myEditorWidget->setSelectedSections(QList<int>());
+ setProfile( (*myProfilesPointer)[theIndex] );
+ for (int i = 0; i < myProfilesPointer->size(); i++)
+ {
+ HYDROGUI_CurveCreatorProfile* aCurve = (*myProfilesPointer)[i];
+ if (i == theIndex)
+ {
+ aCurve->myLineWidth = 3;
+ Handle(AIS_InteractiveObject) anAISObject = aCurve->getAISObject();
+ if (anAISObject)
+ anAISObject->SetWidth(3);
+ }
+ else
+ {
+ aCurve->myLineWidth = 1;
+ Handle(AIS_InteractiveObject) anAISObject = aCurve->getAISObject();
+ if (anAISObject)
+ anAISObject->SetWidth(1);
+ }
+ }
+
+ if( myProfilesPointer &&
+ myProfilesPointer->size()>0 &&
+ myProfilesPointer->at(0) &&
+ myProfilesPointer->at(0)->getDisplayer() )
+ myProfilesPointer->at(0)->getDisplayer()->Update();
+}
+
+void HYDROGUI_ProfileDlg::onAddBtnPressed(bool)
+{
+ emit AddProfiles();
+}
+
+void HYDROGUI_ProfileDlg::onRemoveBtnPressed(bool)
+{
+ int theIndex = GetProfileSelectionIndex();
+ if (theIndex > -1)
+ emit RemoveProfile(theIndex);
+}
+
+void HYDROGUI_ProfileDlg::onProfileNameChanged(QListWidgetItem* item)
+{
+ int ind = GetProfileSelectionIndex();
+ if (ind > -1)
+ {
+ int count = myProfileNames->count();
+ QSet<QString> names;
+ for (int i = 0; i < count; i++)
+ {
+ QListWidgetItem* citem = myProfileNames->item(i);
+ if (item!=citem)
+ names << citem->text();
+ }
+ QString curText = item->text();
+ myProfileNames->blockSignals(true);
+ if (names.contains(curText))
+ {
+ QString mes = tr( "PROFILE_ALREADY_EXISTS" );
+ QString title = tr( "PROFILEDLG_WARNING" );
+#ifndef TEST_MODE
+ SUIT_MessageBox::warning( module()->getApp()->desktop(), title, mes );
+#endif
+ item->setText(myCurrentName);
+ }
+ myProfileNames->blockSignals(false);
+ }
+}
+/*
+void HYDROGUI_ProfileDlg::SetSingleProfileMode(bool SingleMode)
+{
+ mySingleProfileMode = SingleMode;
+}
+
+bool HYDROGUI_ProfileDlg::GetSingleProfileMode() const
+{
+ return mySingleProfileMode;
+}*/
+