From 70f0688775e646f127047ee7d24a3d263710df4b Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 16 Feb 2010 03:23:57 +0000 Subject: [PATCH] 2010-02-15 19:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/ideprojmanager.prg + Project Management: first steps to integrate with .hbp engine. % 'Project Location' made sensitive to valid/invalid path with different background color. --- harbour/ChangeLog | 6 ++ harbour/contrib/hbide/ideprojmanager.prg | 70 +++++++++++++++++++----- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4b9761184e..5a0b59b840 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,12 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-15 19:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/ideprojmanager.prg + + Project Management: first steps to integrate with .hbp engine. + % 'Project Location' made sensitive to valid/invalid path + with different background color. + 2010-02-15 23:48 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbmysql/hbmysql.hbc * contrib/hbpgsql/hbpgsql.hbc diff --git a/harbour/contrib/hbide/ideprojmanager.prg b/harbour/contrib/hbide/ideprojmanager.prg index 23d7c29238..cf94595d93 100644 --- a/harbour/contrib/hbide/ideprojmanager.prg +++ b/harbour/contrib/hbide/ideprojmanager.prg @@ -269,6 +269,7 @@ CLASS IdeProject DATA cPathEnv INIT hb_DirBase() + "resources" DATA hSources INIT {=>} DATA hPaths INIT {=>} + DATA lPathAbs INIT .F. // Lets try relative paths first . xhp and hbp will be relative anyway METHOD new( oIDE, aProps ) METHOD applyMeta( s ) @@ -409,6 +410,8 @@ CLASS IdeProjManager INHERIT IdeObject METHOD manageEnvironments() METHOD loadXhpProject() METHOD loadHbpProject() + METHOD isValidProjectLocation( lTell ) + METHOD setProjectLocation( cPath ) ENDCLASS @@ -576,7 +579,7 @@ METHOD IdeProjManager:fetchProperties() ::oUI:q_buttonChooseDest :setIcon( cLukupPng ) ::oUI:q_buttonBackup :setIcon( cLukupPng ) ::oUI:q_buttonXmate :setIcon( ::resPath + "xmate.png" ) - ::oUI:q_buttonHbp :setIcon( ::resPath + "open.png" ) + ::oUI:q_buttonHbp :setIcon( ::resPath + "open.png" ) ::oUI:q_buttonSelect :setIcon( ::resPath + "open.png" ) ::oUI:q_buttonSort :setIcon( ::resPath + "toupper.png" ) // TODO: toupper.png => atoz.png @@ -602,6 +605,8 @@ METHOD IdeProjManager:fetchProperties() ::oUI:signal( "buttonXmate" , "clicked()", {|| ::loadXhpProject() } ) ::oUI:signal( "buttonHbp" , "clicked()", {|| ::loadHbpProject() } ) + ::oUI:signal( "editPrjLoctn" , "textChanged(QString)", {|cPath| ::setProjectLocation( cPath ) } ) + IF empty( ::aPrjProps ) /* * When they click on the button to confirm the name of the project, we @@ -1156,27 +1161,64 @@ METHOD IdeProjManager:updateMetaData() /*----------------------------------------------------------------------*/ +METHOD IdeProjManager:setProjectLocation( cPath ) + + IF ! hb_dirExists( cPath ) + ::oUI:q_editPrjLoctn:setStyleSheet( "background-color: rgba( 240,120,120,255 );" ) + ::oUI:q_editSources:setEnabled( .f. ) + ::oUI:q_buttonSelect:setEnabled( .f. ) + ELSE + ::oProject:location := cPath + ::oUI:q_editPrjLoctn:setStyleSheet( "" ) + ::oUI:q_editSources:setEnabled( .T. ) + ::oUI:q_buttonSelect:setEnabled( .T. ) + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeProjManager:isValidProjectLocation( lTell ) + LOCAL lOk := .f. + + IF empty( ::oUI:q_editPrjLoctn:text() ) + IF lTell + MsgBox( "Please supply 'Project Location' first" ) + ENDIF + ELSEIF ! hb_dirExists( ::oUI:q_editPrjLoctn:text() ) + IF lTell + MsgBox( "Please ensure 'Project Location' is correct" ) + ENDIF + ELSE + lOk := .t. + ENDIF + + RETURN lOk + +/*----------------------------------------------------------------------*/ + METHOD IdeProjManager:addSources() LOCAL aFiles, a_, b_, a4_1, s - IF !empty( aFiles := ::oSM:selectSource( "openmany" ) ) - a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() ) - a4_1 := hbide_setupMetaKeys( a_ ) + IF ::isValidProjectLocation( .t. ) + IF !empty( aFiles := ::oSM:selectSource( "openmany" ) ) + a_:= hbide_memoToArray( ::oUI:q_editMetaData:toPlainText() ) + a4_1 := hbide_setupMetaKeys( a_ ) - a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() ) + a_:= hbide_memoToArray( ::oUI:q_editSources:toPlainText() ) - b_:={} - aeval( aFiles, {|e| aadd( b_, hbide_applyMetaData( e, a4_1 ) ) } ) + b_:={} + aeval( aFiles, {|e| aadd( b_, hbide_applyMetaData( e, a4_1 ) ) } ) - FOR EACH s IN b_ - IF ascan( a_, s ) == 0 - aadd( a_, s ) - ENDIF - NEXT + FOR EACH s IN b_ + IF ascan( a_, s ) == 0 + aadd( a_, s ) + ENDIF + NEXT - ::oUI:q_editSources:setPlainText( hbide_arrayToMemo( a_ ) ) + ::oUI:q_editSources:setPlainText( hbide_arrayToMemo( a_ ) ) + ENDIF ENDIF - RETURN Self /*----------------------------------------------------------------------*/