@@ -834,6 +834,80 @@ TABS.pid_tuning.initialize = function (callback) {
834834 }
835835 } ) ;
836836
837+ var dialogCopyProfile = $ ( '.dialogCopyProfile' ) [ 0 ] ;
838+ var DIALOG_MODE_PROFILE = 0 ;
839+ var DIALOG_MODE_RATEPROFILE = 1 ;
840+ var dialogCopyProfileMode ;
841+
842+ var selectProfileValues = { "0" : "Profile 1" , "1" : "Profile 2" , "2" : "Profile 3" } ;
843+ var selectRateProfileValues = { "0" : "Rateprofile 1" , "1" : "Rateprofile 2" , "2" : "Rateprofile 3" } ;
844+
845+ if ( semver . gte ( CONFIG . apiVersion , "1.36.0" ) ) {
846+
847+ var selectProfile = $ ( '.selectProfile' ) ;
848+ var selectRateProfile = $ ( '.selectRateProfile' ) ;
849+
850+ $ . each ( selectProfileValues , function ( key , value ) {
851+ if ( key != CONFIG . profile )
852+ selectProfile . append ( new Option ( value , key ) ) ;
853+ } ) ;
854+ $ . each ( selectRateProfileValues , function ( key , value ) {
855+ if ( key != CONFIG . rateProfile )
856+ selectRateProfile . append ( new Option ( value , key ) ) ;
857+ } ) ;
858+
859+ $ ( '.copyprofilebtn' ) . click ( function ( ) {
860+ $ ( '.dialogCopyProfile' ) . find ( '.contentProfile' ) . show ( ) ;
861+ $ ( '.dialogCopyProfile' ) . find ( '.contentRateProfile' ) . hide ( ) ;
862+ dialogCopyProfileMode = DIALOG_MODE_PROFILE ;
863+ dialogCopyProfile . showModal ( ) ;
864+ } ) ;
865+
866+ $ ( '.copyrateprofilebtn' ) . click ( function ( ) {
867+ $ ( '.dialogCopyProfile' ) . find ( '.contentProfile' ) . hide ( ) ;
868+ $ ( '.dialogCopyProfile' ) . find ( '.contentRateProfile' ) . show ( ) ;
869+ dialogCopyProfileMode = DIALOG_MODE_RATEPROFILE ;
870+ dialogCopyProfile . showModal ( ) ;
871+ } ) ;
872+
873+ $ ( '.dialogCopyProfile-cancelbtn' ) . click ( function ( ) {
874+ dialogCopyProfile . close ( ) ;
875+ } ) ;
876+
877+ $ ( '.dialogCopyProfile-confirmbtn' ) . click ( function ( ) {
878+ switch ( dialogCopyProfileMode ) {
879+ case DIALOG_MODE_PROFILE :
880+ COPY_PROFILE . type = DIALOG_MODE_PROFILE ; // 0 = pid profile
881+ COPY_PROFILE . dstProfile = parseInt ( selectProfile . val ( ) ) ;
882+ COPY_PROFILE . srcProfile = CONFIG . profile ;
883+
884+ MSP . send_message ( MSPCodes . MSP_COPY_PROFILE , mspHelper . crunch ( MSPCodes . MSP_COPY_PROFILE ) , false , close_dialog ) ;
885+
886+ break ;
887+
888+ case DIALOG_MODE_RATEPROFILE :
889+ COPY_PROFILE . type = DIALOG_MODE_RATEPROFILE ; // 1 = rate profile
890+ COPY_PROFILE . dstProfile = parseInt ( selectRateProfile . val ( ) ) ;
891+ COPY_PROFILE . srcProfile = CONFIG . profile ;
892+
893+ MSP . send_message ( MSPCodes . MSP_COPY_PROFILE , mspHelper . crunch ( MSPCodes . MSP_COPY_PROFILE ) , false , close_dialog ) ;
894+
895+ break ;
896+
897+ default :
898+ close_dialog ( ) ;
899+ break ;
900+ }
901+
902+ function close_dialog ( ) {
903+ dialogCopyProfile . close ( ) ;
904+ }
905+ } ) ;
906+ } else {
907+ $ ( '.copyprofilebtn' ) . hide ( ) ;
908+ $ ( '.copyrateprofilebtn' ) . hide ( ) ;
909+ }
910+
837911 if ( semver . gte ( CONFIG . apiVersion , "1.16.0" ) ) {
838912 $ ( '#pid-tuning .delta select' ) . change ( function ( ) {
839913 self . setDirty ( true ) ;
0 commit comments