Ticket #314: jobqueue.userjobs.diff
File jobqueue.userjobs.diff, 3.1 KB (added by , 19 years ago) |
---|
-
libs/libmythtv/jobqueue.cpp
955 955 956 956 if (jobType & JOB_USERJOB) 957 957 { 958 QString settingName = QString("UserJobDesc%1").arg(jobType >> 8);958 QString settingName = QString("UserJobDesc%1").arg(jobTypeToIndex(jobType)); 959 959 return gContext->GetSetting(settingName, settingName); 960 960 } 961 961 … … 1072 1072 1073 1073 if (thisJob.type & JOB_USERJOB) 1074 1074 { 1075 int userJobNumber = 1; 1076 int jobType = thisJob.type; 1077 1078 jobType = jobType >> 8; 1079 while (jobType != 0x01 && userJobNumber < 5) 1080 { 1081 jobType = jobType >> 1; 1082 userJobNumber++; 1083 } 1084 1085 if (userJobNumber >= 5) 1086 thisJob.type = JOB_NONE; 1087 else 1088 thisJob.type = userJobNumber << 8; 1075 thisJob.type = 1 << (8 + jobTypeToIndex(thisJob.type) -1); 1089 1076 } 1090 1077 1091 1078 jobs[jobCount++] = thisJob; … … 1152 1139 break; 1153 1140 case JOB_USERJOB4: allowSetting = "JobAllowUserJob4"; 1154 1141 break; 1155 default: return false; 1142 default: VERBOSE(VB_JOBQUEUE, QString("JobQueue::AllowedToRun: unknown job.type: %1").arg(job.type)); 1143 return false; 1156 1144 } 1157 1145 1158 1146 if (gContext->GetNumSetting(allowSetting, 1)) … … 1443 1431 else if (!(jobType & JOB_USERJOB)) 1444 1432 return "Unknown Job"; 1445 1433 1446 QString descSetting = QString("UserJobDesc%1").arg(jobType >> 8);1434 QString descSetting = QString("UserJobDesc%1").arg(jobTypeToIndex(jobType)); 1447 1435 1448 1436 return gContext->GetSetting(descSetting, "Unknown Job"); 1449 1437 } … … 1460 1448 else if (!(jobType & JOB_USERJOB)) 1461 1449 return ""; 1462 1450 1463 QString commandSetting = QString("UserJob%1").arg(jobType >> 8);1451 QString commandSetting = QString("UserJob%1").arg(jobTypeToIndex(jobType)); 1464 1452 1465 1453 command = gContext->GetSetting(commandSetting, ""); 1466 1454 … … 1892 1880 controlFlagsLock.unlock(); 1893 1881 } 1894 1882 1883 int JobQueue::jobTypeToIndex(int JobType) 1884 { 1885 if (JobType & JOB_USERJOB) 1886 { 1887 int x = ((JobType & JOB_USERJOB)>> 8); 1888 int bits = 1; 1889 while( (x != 0) && ((x & 0x01) == 0) ) 1890 { 1891 bits++; 1892 x = x >> 1; 1893 } 1894 if( bits > 4 ) 1895 return 0; 1896 1897 return bits; 1898 } 1899 return 0; 1900 } 1901 1895 1902 /* vim: set expandtab tabstop=4 shiftwidth=4: */ -
libs/libmythtv/jobqueue.h
137 137 static int GetJobFlags(int jobID); 138 138 static int GetJobStatus(int jobID); 139 139 static int GetJobStatus(int jobType, QString chanid, QDateTime starttime); 140 static int jobTypeToIndex(int JobType); 140 141 141 142 static bool DeleteAllJobs(QString chanid, QDateTime starttime); 142 143