const QString splitter_key = "HYDROGUI_ProfileDlg::splitter";
HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QString& theTitle,
- bool theSingleProfileMode )
+ bool theIsEdit )
: HYDROGUI_ViewerDlg( theModule, theTitle, true ),
myName( NULL ), myProfileNames (NULL), myProfilesPointer (NULL),
- mySingleProfileMode (theSingleProfileMode)
+ myIsEdit (theIsEdit)
{
QFrame* name_frame = new QFrame( mainFrame() );
QHBoxLayout* name_layout = new QHBoxLayout( name_frame );
name_layout->setMargin( 0 );
QLabel* aNameLabel = new QLabel(tr("PROFILE_NAME_TLT"), this);
name_layout->addWidget(aNameLabel);
- if (theSingleProfileMode)
+ if (!theIsEdit)
{
myName = new QLineEdit(this);
name_layout->addWidget(myName);
{
myProfileNames = new QListWidget(this);
myProfileNames->setSelectionMode(QAbstractItemView::SingleSelection);
- //myProfileNames->setEditable(true);
- //myProfileNames->setInsertPolicy(QComboBox::InsertPolicy::NoInsert);
name_layout->addWidget(myProfileNames);
- //
myAddProfBtn = new QPushButton(tr("ADD_PROFILES"), this);
myRemProfBtn = new QPushButton(tr("REMOVE_PROFILE"), this);
name_layout->addWidget(myAddProfBtn);
connect( myEditorWidget, SIGNAL( selectionChanged() ), this, SIGNAL( selectionChanged() ) );
connect( myEditorWidget, SIGNAL( subOperationStarted(QWidget*, bool) ), this, SLOT( processStartedSubOperation(QWidget*, bool) ) );
connect( myEditorWidget, SIGNAL( subOperationFinished(QWidget*) ), this, SLOT( processFinishedSubOperation(QWidget*) ) );
- if (!mySingleProfileMode)
+ if (myIsEdit)
{
connect( myProfileNames, SIGNAL( currentTextChanged(QString)), SLOT(ProfileNameChanged(QString)) );
connect( myProfileNames, SIGNAL( itemSelectionChanged()), this, SLOT( onProfileIndexChanged()));
void HYDROGUI_ProfileDlg::setProfileName( const QString& theName )
{
- if (!mySingleProfileMode)
+ if (myIsEdit)
return;
myName->setText(theName);
- //myProfileNames->setItemText(theInd, theName); //should used TODO check this
- //myName->setText(theName);
}
void HYDROGUI_ProfileDlg::eraseProfile( int index )
void HYDROGUI_ProfileDlg::addProfileName( const QString& theName, const QColor& theColor )
{
- if (mySingleProfileMode)
+ if (!myIsEdit)
return;
myProfileNames->blockSignals(true);
myProfileNames->addItem(theName);
SPixmap.fill(theColor);
QIcon SIcon(SPixmap);
anItem->setIcon( SIcon );
- //anItem->setBackground(QBrush(theColor));
if (count == 1)
anItem->setSelected(true);
+ if (count == 1 && myIsEdit)
+ myRemProfBtn->setEnabled(false);
if (count > 1)
myRemProfBtn->setEnabled(true);
+
myProfileNames->blockSignals(false);
}
QStringList HYDROGUI_ProfileDlg::getProfileNames() const
{
QStringList aProfNames;
- if (mySingleProfileMode)
+ if (!myIsEdit)
aProfNames << myName->text();
else
for (int i = 0; i < myProfileNames->count(); i++)
myProfileNames->blockSignals(false);
}
}
-
+/*
void HYDROGUI_ProfileDlg::SetSingleProfileMode(bool SingleMode)
{
mySingleProfileMode = SingleMode;
bool HYDROGUI_ProfileDlg::GetSingleProfileMode() const
{
return mySingleProfileMode;
-}
+}*/
Handle(AIS_Trihedron) HYDROGUI_ProfileDlg::trihedron()
{
void setProfile( CurveCreator_ICurve* theProfile );
void setProfilesPointer(std::vector<HYDROGUI_CurveCreatorProfile*>* theProfilesPointer);
void switchToFirstProfile();
- void SetSingleProfileMode(bool SingleMode);
- bool GetSingleProfileMode() const;
+ //void SetSingleProfileMode(bool SingleMode);
+ //bool GetSingleProfileMode() const;
void SwitchToProfile(int theIndex);
void BlockProfileNameSignals(bool state);
int GetProfileSelectionIndex();
void AddProfiles();
void RemoveProfile(int);
-
protected:
virtual Handle(AIS_Trihedron) trihedron();
QListWidget* myProfileNames;
QPushButton* myAddProfBtn;
QPushButton* myRemProfBtn;
-public://temp TODO
+public:
CurveCreator_Widget* myEditorWidget;
QGroupBox* myAddElementBox;
std::vector<HYDROGUI_CurveCreatorProfile*>* myProfilesPointer;
- bool mySingleProfileMode;
+private:
+ bool myIsEdit;
QString myCurrentName;
};
HYDROGUI_ProfileOp::HYDROGUI_ProfileOp( HYDROGUI_Module* theModule, bool theIsEdit )
: HYDROGUI_Operation( theModule ), myIsEdit(theIsEdit),
- myDisplayer (NULL), mySingleProfileMode (false)
+ myDisplayer (NULL)
{
setName( theIsEdit ? tr( "EDIT_PROFILE" ) : tr( "CREATE_PROFILE" ) );
}
for (int i = 0; i < myProfiles.size(); i++)
myProfiles[i] = new HYDROGUI_CurveCreatorProfile();
- mySingleProfileMode = myEditedObjects.IsEmpty() || lenP == 1;
+ //mySingleProfileMode = myEditedObjects.IsEmpty();
HYDROGUI_Operation::startOperation();
HYDROGUI_ProfileDlg* aPanel = (HYDROGUI_ProfileDlg*)inputPanel();
setPreviewManager( aPanel->viewManager() );
setCursor();
- aPanel->SetSingleProfileMode(mySingleProfileMode);
+ //aPanel->SetSingleProfileMode(mySingleProfileMode);
QMap<HYDROGUI_CurveCreatorProfile*, QColor> CurveToColor;
if( lenP )
{
}
int ext = myCurveToProfile.Extent(); //ext should be equal to lenP
QVector<QColor> PColors;
- if (!mySingleProfileMode)
+ if (myIsEdit)
HYDROData_Tool::GenerateRepeatableRandColors(ext, PColors);
else
PColors << QColor(0,0,255); //default color
CurveToColor[CC] = CurCol;
const QString& profName = CP->GetName();
const QColor& PColor = CurCol;
- if (!mySingleProfileMode)
+ if (myIsEdit)
aPanel->addProfileName(profName, PColor);
else
aPanel->setProfileName(profName);
CurveToColor[CC] = CurCol;
const QString& profName = CP->GetName();
const QColor& PColor = CurCol;
- if (!mySingleProfileMode)
+ if (myIsEdit)
aPanel->addProfileName(profName, PColor);
else
aPanel->setProfileName(profName);
HYDROGUI_InputPanel* HYDROGUI_ProfileOp::createInputPanel() const
{
- HYDROGUI_ProfileDlg* aDlg = new HYDROGUI_ProfileDlg( module(), getName(), mySingleProfileMode );
+ HYDROGUI_ProfileDlg* aDlg = new HYDROGUI_ProfileDlg( module(), getName(), myIsEdit );
connect( aDlg, SIGNAL( AddProfiles() ), this,
SLOT( onAddProfiles() ) );
connect( aDlg, SIGNAL( RemoveProfile(int) ), this,