diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bd1f806a74..5f28893ec8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,15 @@ The license applies to all entries newer than 2009-04-28. */ +2011-06-03 18:45 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/idemisc.prg + ! Minor. + * contrib/hbide/changelog.ui + + One more button. + * contrib/hbide/idechangelog.prg + + Advanced: now you can build a log in real-time. + It is scheduled to be polished a bit more. + 2011-06-04 01:33 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * examples/superlib/superlib.hbc ! adjusted libname diff --git a/harbour/contrib/hbide/changelog.ui b/harbour/contrib/hbide/changelog.ui index ffed7c3d92..1d66e9f8c2 100644 --- a/harbour/contrib/hbide/changelog.ui +++ b/harbour/contrib/hbide/changelog.ui @@ -94,6 +94,9 @@ true + + MM/dd/yyyy + @@ -140,7 +143,14 @@ - Done + Description OK + + + + + + + Source/Desc OK diff --git a/harbour/contrib/hbide/idechangelog.prg b/harbour/contrib/hbide/idechangelog.prg index 3bf202463c..eb24c52124 100644 --- a/harbour/contrib/hbide/idechangelog.prg +++ b/harbour/contrib/hbide/idechangelog.prg @@ -82,8 +82,9 @@ CLASS IdeChangeLog INHERIT IdeObject METHOD destroy() METHOD show() METHOD execEvent( cEvent, p ) - METHOD updateLog( cLogFile ) + METHOD updateLog() METHOD refresh() + METHOD buildLogEntry() ENDCLASS @@ -128,17 +129,30 @@ METHOD IdeChangeLog:show() ::oUI:q_buttonChangelog :setIcon( hbide_image( "dc_folder" ) ) ::oUI:q_buttonAddSrc :setIcon( hbide_image( "dc_plus" ) ) - ::oUI:q_buttonChangelog :connect( "clicked()", {|| ::execEvent( "buttonChangelog_clicked" ) } ) - ::oUI:q_buttonAddSrc :connect( "clicked()", {|| ::execEvent( "buttonAddSrc_clicked" ) } ) - ::oUI:q_buttonDone :connect( "clicked()", {|| ::execEvent( "buttonDone_clicked" ) } ) - ::oUI:q_buttonRefresh :connect( "clicked()", {|| ::execEvent( "buttonRefresh_clicked" ) } ) - ::oUI:q_buttonSave :connect( "clicked()", {|| ::execEvent( "buttonSave_clicked" ) } ) + ::oUI:q_buttonChangelog :connect( "clicked()", {|| ::execEvent( "buttonChangelog_clicked" ) } ) + ::oUI:q_buttonAddSrc :connect( "clicked()", {|| ::execEvent( "buttonAddSrc_clicked" ) } ) + ::oUI:q_buttonDone :connect( "clicked()", {|| ::execEvent( "buttonDone_clicked" ) } ) + ::oUI:q_buttonRefresh :connect( "clicked()", {|| ::execEvent( "buttonRefresh_clicked" ) } ) + ::oUI:q_buttonSave :connect( "clicked()", {|| ::execEvent( "buttonSave_clicked" ) } ) + ::oUI:q_buttonSrcDescOK :connect( "clicked()", {|| ::execEvent( "buttonSrcDesc_clicked" ) } ) ::oUI:q_editChangelog :connect( "textChanged(QString)", {|p| ::execEvent( "editChangelog_textChanged", p ) } ) - ::updateLog( ::oINI:cChangeLog ) + ::oUI:q_comboAction:addItem( "! Fixed : " ) + ::oUI:q_comboAction:addItem( "& Changed : " ) + ::oUI:q_comboAction:addItem( "% Optimized : " ) + ::oUI:q_comboAction:addItem( "+ Added : " ) + ::oUI:q_comboAction:addItem( "- Removed : " ) + ::oUI:q_comboAction:addItem( "; Comment : " ) + ::oUI:q_comboAction:addItem( "@ TODO : " ) + ::oUI:q_comboAction:addItem( "| Moved : " ) + + ::oUI:q_editChangelog:setText( ::oINI:cChangeLog ) + ::updateLog() ::cUser := hbide_fetchAString( ::oDlg:oWidget, , , "Developer Name" ) + + ::oUI:q_comboAuthor:addItem( ::cUser ) ENDIF ::oUI:show() @@ -147,6 +161,11 @@ METHOD IdeChangeLog:show() /*----------------------------------------------------------------------*/ +STATIC FUNCTION hbide_eol() + RETURN hb_eol() // chr( 13 ) + chr( 10 ) + +/*----------------------------------------------------------------------*/ + STATIC FUNCTION hbide_getLogCounter( cBuffer ) LOCAL n, n1, nCntr := 0 @@ -155,7 +174,7 @@ STATIC FUNCTION hbide_getLogCounter( cBuffer ) nCntr := val( substr( cBuffer, n + 2, n1 - n - 2 ) ) ENDIF - RETURN nCntr + RETURN nCntr + 1 /*----------------------------------------------------------------------*/ @@ -167,46 +186,63 @@ METHOD IdeChangeLog:execEvent( cEvent, p ) SWITCH cEvent CASE "buttonSave_clicked" - IF !empty( cTmp := ::oUI:q_plainLogEntry:toPlainText() ) + //IF !empty( cTmp := ::oUI:q_plainLogEntry:toPlainText() ) + IF ! empty( ::aLog ) cTmp1 := hb_memoread( ::oINI:cChangeLog ) ::nCntr := hbide_getLogCounter( cTmp1 ) - s := "$<" + strzero( ::nCntr, 6 ) + "> " + hbide_dtosFmt() + " " + time() + " " + ::cUser + s := "$<" + strzero( ::nCntr, 6 ) + "> " + hbide_dtosFmt() + " " + left( time(), 5 ) + " " + ::cUser IF ( n := at( "$<", cTmp1 ) ) > 0 - cTmp1 := substr( cTmp1, 1, n - 1 ) + hb_eol() + s + hb_eol() + cTmp + hb_eol() + substr( cTmp1, n ) + cTmp1 := substr( cTmp1, 1, n - 1 ) + s + hbide_eol() + ::buildLogEntry() + hbide_eol() + substr( cTmp1, n ) ELSE - cTmp1 += hb_eol() + s + hb_eol() + cTmp + hb_eol() + cTmp1 += hbide_eol() + s + hbide_eol() + cTmp + hbide_eol() ENDIF hb_memowrit( ::oINI:cChangeLog, cTmp1 ) /* TODO: put it under locking protocol */ - ::aLog := {} - ::oUI:q_plainLogEntry:setPlainText( "" ) - ::oUI:q_plainCurrentLog:setPlainText( "" ) + ::updateLog() ENDIF - EXIT CASE "buttonRefresh_clicked" + ::aLog := {} + ::refresh() + EXIT + CASE "buttonSrcDesc_clicked" + IF ! empty( cTmp := ::oUI:q_editSource:text() ) + aadd( ::aLog, { "Source", cTmp, "" } ) + ENDIF + IF ! empty( cTmp := ::oUI:q_plainCurrentLog:toPlainText() ) + aadd( ::aLog, { "Desc", ::oUI:q_comboAction:currentText(), cTmp } ) + ::oUI:q_plainCurrentLog:clear() + ENDIF ::refresh() EXIT CASE "buttonDone_clicked" - IF !empty( cTmp := ::oUI:q_plainCurrentLog:toPlainText() ) - aadd( ::aLog, { "Desc", cTmp, "" } ) - ::oUI:q_plainLogEntry:setPlainText( "" ) + IF ! empty( cTmp := ::oUI:q_plainCurrentLog:toPlainText() ) + aadd( ::aLog, { "Desc", ::oUI:q_comboAction:currentText(), cTmp } ) + ::oUI:q_plainCurrentLog:clear() ::refresh() ENDIF EXIT CASE "buttonAddSrc_clicked" - IF !empty( cTmp := ::oUI:q_editSource:text() ) + IF ! empty( cTmp := ::oUI:q_editSource:text() ) aadd( ::aLog, { "Source", cTmp, "" } ) ::refresh() ENDIF EXIT CASE "buttonChangelog_clicked" cTmp := hbide_fetchAFile( ::oDlg, "Select a ChangeLog File" ) - ::updateLog( cTmp ) + IF ! empty( cTmp ) .AND. hb_fileExists( cTmp ) + ::oINI:cChangeLog := cTmp + ::oUI:q_editChangelog:setText( ::oINI:cChangeLog ) + ENDIF EXIT CASE "editChangelog_textChanged" - ::updateLog( p ) + IF ! empty( p ) .AND. hb_fileExists( p ) + ::oUI:q_editChangelog:setStyleSheet( "" ) + ::updateLog() + ELSE + ::oUI:q_editChangelog:setStyleSheet( "background-color: rgba( 240,120,120,255 );" ) + ENDIF EXIT ENDSWITCH @@ -215,19 +251,15 @@ METHOD IdeChangeLog:execEvent( cEvent, p ) /*----------------------------------------------------------------------*/ -METHOD IdeChangeLog:updateLog( cLogFile ) +METHOD IdeChangeLog:updateLog() - IF !empty( cLogFile ) .AND. hb_fileExists( cLogFile ) - ::oUI:q_editChangelog:setStyleSheet( "" ) - ::oINI:cChangeLog := cLogFile - ::oUI:q_editChangelog:setText( cLogFile ) + ::oUI:q_plainLogEntry:clear() + ::oUI:q_plainCurrentLog:clear() + ::oUI:q_plainChangelog:clear() - ::oUI:q_plainChangelog:clear() - ::oUI:q_plainChangelog:setPlainText( memoread( cLogFile ) ) - ::refresh() - ELSE - ::oUI:q_editChangelog:setStyleSheet( "background-color: rgba( 240,120,120,255 );" ) - ENDIF + ::oUI:q_plainChangelog:setPlainText( hb_memoread( ::oINI:cChangeLog ) ) + + ::refresh() RETURN Self @@ -244,28 +276,33 @@ STATIC FUNCTION hbide_dtosFmt( dDate ) /*----------------------------------------------------------------------*/ - METHOD IdeChangeLog:refresh() - LOCAL s := "", a_ ::oUI:q_plainLogEntry:clear() - #if 0 - ::nCntr := hbide_getlogCounter( hb_memoread( ::oINI:cChangeLog ) ) - s := "$<" + strzero( ::nCntr, 6 ) + "> " + hbide_dtosFmt() + " " + time() + " " + ::cUser - #endif - FOR EACH a_ IN ::aLog - IF a_[ 1 ] == "Source" - s += hb_eol() + " * " + a_[ 2 ] - - ELSEIF a_[ 1 ] == "Desc" - s += hb_eol() + " ! " + a_[ 2 ] - - ENDIF - NEXT - - ::oUI:q_plainLogEntry:clear() - ::oUI:q_plainLogEntry:setPlainText( s ) + ::oUI:q_plainLogEntry:setPlainText( ::buildLogEntry() ) RETURN Self /*----------------------------------------------------------------------*/ + +METHOD IdeChangeLog:buildLogEntry() + LOCAL s := "", a_, k, e + + FOR EACH a_ IN ::aLog + IF a_[ 1 ] == "Source" + s += " * " + upper( a_[ 2 ] ) + hbide_eol() + ELSEIF a_[ 1 ] == "Desc" + k := hbide_memoToArray( a_[ 3 ] ) + FOR EACH e IN k + IF e:__enumIndex() == 1 + s += " " + a_[ 2 ] + e + hbide_eol() + ELSE + s += " " + space( 14 ) + e + hbide_eol() + ENDIF + NEXT + ENDIF + NEXT + + RETURN s + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idemisc.prg b/harbour/contrib/hbide/idemisc.prg index 32167795aa..72e1a0e9ac 100644 --- a/harbour/contrib/hbide/idemisc.prg +++ b/harbour/contrib/hbide/idemisc.prg @@ -156,8 +156,6 @@ FUNCTION hbide_execPopup( aPops, aqPos, qParent ) qPoint := QPoint( aqPos[ 1 ], aqPos[ 2 ] ) ELSEIF hb_isObject( aqPos ) qPoint := aqPos -// ELSEIF hb_isPointer( aqPos ) -// qPoint := qParent:mapToGlobal( QPoint( aqPos ) ) ENDIF IF ( qAct := qPop:exec( qPoint ) ):hasValidPointer() cAct := qAct:text()