From 7bb8da28edc30835dbef7be9b5790dfe925b1bf4 Mon Sep 17 00:00:00 2001 From: isn Date: Tue, 14 Nov 2017 16:55:04 +0300 Subject: [PATCH] debug of profileOp --- src/HYDROGUI/HYDROGUI_ProfileDlg.cxx | 27 ++++++++++------------- src/HYDROGUI/HYDROGUI_ProfileDlg.h | 10 ++++----- src/HYDROGUI/HYDROGUI_ProfileOp.cxx | 14 ++++++------ src/HYDROGUI/HYDROGUI_ProfileOp.h | 2 +- src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 2 +- 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx index 239645b4..c6c49c1c 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.cxx @@ -57,17 +57,17 @@ 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); @@ -76,10 +76,7 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr { 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); @@ -108,7 +105,7 @@ HYDROGUI_ProfileDlg::HYDROGUI_ProfileDlg( HYDROGUI_Module* theModule, const QStr 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())); @@ -151,11 +148,9 @@ void HYDROGUI_ProfileDlg::reset() 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 ) @@ -167,7 +162,7 @@ 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); @@ -178,18 +173,20 @@ void HYDROGUI_ProfileDlg::addProfileName( const QString& theName, const QColor& 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++) @@ -360,7 +357,7 @@ void HYDROGUI_ProfileDlg::onProfileNameChanged(QListWidgetItem* item) myProfileNames->blockSignals(false); } } - +/* void HYDROGUI_ProfileDlg::SetSingleProfileMode(bool SingleMode) { mySingleProfileMode = SingleMode; @@ -369,7 +366,7 @@ void HYDROGUI_ProfileDlg::SetSingleProfileMode(bool SingleMode) bool HYDROGUI_ProfileDlg::GetSingleProfileMode() const { return mySingleProfileMode; -} +}*/ Handle(AIS_Trihedron) HYDROGUI_ProfileDlg::trihedron() { diff --git a/src/HYDROGUI/HYDROGUI_ProfileDlg.h b/src/HYDROGUI/HYDROGUI_ProfileDlg.h index 36ad245d..91f06f88 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileDlg.h +++ b/src/HYDROGUI/HYDROGUI_ProfileDlg.h @@ -52,8 +52,8 @@ public: void setProfile( CurveCreator_ICurve* theProfile ); void setProfilesPointer(std::vector* 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(); @@ -83,7 +83,6 @@ signals: void AddProfiles(); void RemoveProfile(int); - protected: virtual Handle(AIS_Trihedron) trihedron(); @@ -92,11 +91,12 @@ private: QListWidget* myProfileNames; QPushButton* myAddProfBtn; QPushButton* myRemProfBtn; -public://temp TODO +public: CurveCreator_Widget* myEditorWidget; QGroupBox* myAddElementBox; std::vector* myProfilesPointer; - bool mySingleProfileMode; +private: + bool myIsEdit; QString myCurrentName; }; diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx index fc470e6b..a7ae37ff 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.cxx @@ -128,7 +128,7 @@ static int CurveCrProfileToHProfile(const HYDROGUI_CurveCreatorProfile* outProfi 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" ) ); } @@ -183,7 +183,7 @@ void HYDROGUI_ProfileOp::startOperation() 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(); @@ -192,7 +192,7 @@ void HYDROGUI_ProfileOp::startOperation() setPreviewManager( aPanel->viewManager() ); setCursor(); - aPanel->SetSingleProfileMode(mySingleProfileMode); + //aPanel->SetSingleProfileMode(mySingleProfileMode); QMap CurveToColor; if( lenP ) { @@ -214,7 +214,7 @@ void HYDROGUI_ProfileOp::startOperation() } int ext = myCurveToProfile.Extent(); //ext should be equal to lenP QVector PColors; - if (!mySingleProfileMode) + if (myIsEdit) HYDROData_Tool::GenerateRepeatableRandColors(ext, PColors); else PColors << QColor(0,0,255); //default color @@ -227,7 +227,7 @@ void HYDROGUI_ProfileOp::startOperation() CurveToColor[CC] = CurCol; const QString& profName = CP->GetName(); const QColor& PColor = CurCol; - if (!mySingleProfileMode) + if (myIsEdit) aPanel->addProfileName(profName, PColor); else aPanel->setProfileName(profName); @@ -317,7 +317,7 @@ void HYDROGUI_ProfileOp::onAddProfiles() CurveToColor[CC] = CurCol; const QString& profName = CP->GetName(); const QColor& PColor = CurCol; - if (!mySingleProfileMode) + if (myIsEdit) aPanel->addProfileName(profName, PColor); else aPanel->setProfileName(profName); @@ -344,7 +344,7 @@ void HYDROGUI_ProfileOp::commitOperation() 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, diff --git a/src/HYDROGUI/HYDROGUI_ProfileOp.h b/src/HYDROGUI/HYDROGUI_ProfileOp.h index ecdfbf13..a74472d3 100644 --- a/src/HYDROGUI/HYDROGUI_ProfileOp.h +++ b/src/HYDROGUI/HYDROGUI_ProfileOp.h @@ -67,7 +67,7 @@ protected slots: private: bool myIsEdit; - bool mySingleProfileMode; + //bool mySingleProfileMode; HYDROData_SequenceOfObjects myEditedObjects; std::vector myProfiles; CurveCreator_Displayer* myDisplayer; diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index da5bed2d..7af82b32 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -284,7 +284,7 @@ All supported formats (*.brep *.iges *.igs *.step *.stp) PREF_VIEWER_ZOOM_SHUTOFF - Turn on the conservation of zoom (zoom shutoff) when when front/top/left/etc called + Conservation of zoom when top-view/etc is activated PREF_GROUP_STRICKLER_TABLE -- 2.39.2