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