On Sat, May 07, 2005 at 11:19:22AM +0200, Daniel Staaf wrote:
> Robert Tsai wrote / skrev:
> >On Fri, May 06, 2005 at 01:28:42PM +0200, Stefan Frank wrote:
> >>i can't comment on the changes itself, but please resend it with
> >>all strings marked for translation by the tr("EXAMPLE") function
> >>as they were originally.
> >
> >OK; done.
> 
> No, this i wrong:
> 
> >+#define JOBSTATUS_STATUSTEXT(A,B,C) case A: return tr(C);
> 
> You can not use preprocessor or function tricks because the
> translation tool 'lupdate' simply searches for 'tr("' and '")'
> markers and adds the text in between to the .ts-files.
> 
> If you move the tr("")'s to jobqueue.h you have to add it to 
> i18n/translate.pro too:

Ah, I understand now. Thanks.

After applying this patch, libs/libmythtv/Makefile will need to be
removed so that the MOC rules for jobqueue can get generated
(otherwise you will get linker errors).

--Rob
Index: i18n/translate.pro
===================================================================
RCS file: /var/lib/mythcvs/mythtv/i18n/translate.pro,v
retrieving revision 1.29
diff -u -r1.29 translate.pro
--- i18n/translate.pro  11 Apr 2005 13:39:13 -0000      1.29
+++ i18n/translate.pro  7 May 2005 14:33:28 -0000
@@ -17,6 +17,7 @@
 SOURCES += ../libs/libmythtv/NuppelVideoPlayer.cpp
 SOURCES += ../libs/libmythtv/guidegrid.cpp
 SOURCES += ../libs/libmythtv/infodialog.cpp
+SOURCES += ../libs/libmythtv/jobqueue.h
 SOURCES += ../libs/libmythtv/jobqueue.cpp
 SOURCES += ../libs/libmythtv/progfind.cpp
 SOURCES += ../libs/libmythtv/proglist.cpp
Index: libs/libmythtv/jobqueue.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/jobqueue.cpp,v
retrieving revision 1.24
diff -u -r1.24 jobqueue.cpp
--- libs/libmythtv/jobqueue.cpp 3 May 2005 20:19:32 -0000       1.24
+++ libs/libmythtv/jobqueue.cpp 7 May 2005 14:33:29 -0000
@@ -523,9 +523,9 @@
     if (! (tmpStatus & JOB_DONE) && (tmpCmd & JOB_STOP))
         return false;
     query.prepare("INSERT jobqueue (chanid, starttime, inserttime, type, "
-                         "status, hostname, args, comment, flags) "
+                         "status, statustime, hostname, args, comment, flags) "
                      "VALUES (:CHANID, :STARTTIME, now(), :JOBTYPE, :STATUS, "
-                         ":HOST, :ARGS, :COMMENT, :FLAGS);");
+                         "now(), :HOST, :ARGS, :COMMENT, :FLAGS);");
 
     query.bindValue(":CHANID", chanid);
     query.bindValue(":STARTTIME", startts);
@@ -960,17 +960,9 @@
 {
     switch (status)
     {
-        case JOB_QUEUED:    return tr("Queued");
-        case JOB_PENDING:   return tr("Pending");
-        case JOB_STARTING:  return tr("Starting");
-        case JOB_RUNNING:   return tr("Running");
-        case JOB_PAUSED:    return tr("Paused");
-        case JOB_STOPPING:  return tr("Stopping");
-        case JOB_DONE:      return tr("Done (Invalid status!)");
-        case JOB_FINISHED:  return tr("Finished");
-        case JOB_ABORTED:   return tr("Aborted");
-        case JOB_ERRORED:   return tr("Errored");
-        case JOB_CANCELLED: return tr("Cancelled");
+#define JOBSTATUS_STATUSTEXT(A,B,C) case A: return C;
+        JOBSTATUS_MAP(JOBSTATUS_STATUSTEXT)
+        default: break;
     }
     return tr("Undefined");
 }
@@ -991,7 +983,7 @@
                       "j.args, j.comment, r.endtime "
                   "FROM jobqueue j, recorded r "
                   "WHERE j.chanid = r.chanid AND j.starttime = r.starttime "
-                  "ORDER BY j.starttime, j.chanid, j.id;");
+                  "ORDER BY j.inserttime, j.chanid, j.id;");
 
     if (!query.exec() || !query.isActive())
     {
Index: libs/libmythtv/jobqueue.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/jobqueue.h,v
retrieving revision 1.8
diff -u -r1.8 jobqueue.h
--- libs/libmythtv/jobqueue.h   27 Mar 2005 23:53:21 -0000      1.8
+++ libs/libmythtv/jobqueue.h   7 May 2005 14:33:29 -0000
@@ -13,26 +13,31 @@
 
 using namespace std;
 
-// When Updating this enum, also update the JobQueue::StatusText() method.
-enum JobStatus {
-    JOB_QUEUED        = 0x0001,
-    JOB_PENDING       = 0x0002,
-    JOB_STARTING      = 0x0003,
-    JOB_RUNNING       = 0x0004,
-    JOB_STOPPING      = 0x0005,
-    JOB_PAUSED        = 0x0006,
-    JOB_RETRY         = 0x0007,
-    JOB_ERRORING      = 0x0008,
-    JOB_ABORTING      = 0x0009,
-
-    // JOB_DONE is a mask to indicate the job is done no matter what the status
-    JOB_DONE          = 0x0100,
-    JOB_FINISHED      = 0x0110,
-    JOB_ABORTED       = 0x0120,
-    JOB_ERRORED       = 0x0130,
-    JOB_CANCELLED     = 0x0140,
+// Strings are used by JobQueue::StatusText()
+#define JOBSTATUS_MAP(F) \
+    F(JOB_UNKNOWN,      0x0000, tr("Unknown")) \
+    F(JOB_QUEUED,       0x0001, tr("Queued")) \
+    F(JOB_PENDING,      0x0002, tr("Pending")) \
+    F(JOB_STARTING,     0x0003, tr("Starting")) \
+    F(JOB_RUNNING,      0x0004, tr("Running")) \
+    F(JOB_STOPPING,     0x0005, tr("Stopping")) \
+    F(JOB_PAUSED,       0x0006, tr("Paused")) \
+    F(JOB_RETRY,        0x0007, tr("Retrying")) \
+    F(JOB_ERRORING,     0x0008, tr("Erroring")) \
+    F(JOB_ABORTING,     0x0009, tr("Aborting")) \
+    /* \
+     * JOB_DONE is a mask to indicate the job is done no matter what the \
+     * status \
+     */ \
+    F(JOB_DONE,         0x0100, tr("Done (Invalid status!)")) \
+    F(JOB_FINISHED,     0x0110, tr("Finished")) \
+    F(JOB_ABORTED,      0x0120, tr("Aborted")) \
+    F(JOB_ERRORED,      0x0130, tr("Errored")) \
+    F(JOB_CANCELLED,    0x0140, tr("Cancelled")) \
 
-    JOB_UNKNOWN       = 0x0000
+enum JobStatus {
+#define JOBSTATUS_ENUM(A,B,C)   A = B ,
+    JOBSTATUS_MAP(JOBSTATUS_ENUM)
 };
 
 enum JobCmds {
@@ -89,6 +94,7 @@
 
 class JobQueue : public QObject
 {
+    Q_OBJECT
   public:
     JobQueue(bool master);
     ~JobQueue(void);

Attachment: signature.asc
Description: Digital signature

_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

Reply via email to