Debian Codegraph @

src/job.cc

raw
1 /*
2 This file is part of Icecream.
3
4 Copyright (c) 2003 Frerich Raabe <[email protected]>
5 Copyright (c) 2003,2004 Stephan Kulow <[email protected]>
6 Copyright (c) 2003,2004 Cornelius Schumacher <[email protected]>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License along
19 with this program; if not, write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23 #include "job.h"
24
25 #include <QObject>
26 #include <QApplication>
27
28 Job::Job(unsigned int id, unsigned int client, const QString &filename, const QString &lang)
29 : id(id)
30 , fileName(filename)
31 , server(0)
32 , client(client)
33 , lang(lang)
34 , state(WaitingForCS)
35 , startTime{}
36 , real_msec(0)
37 , user_msec(0)
38 , sys_msec(0)
39 , pfaults(0)
40 , exitcode(0)
41 , in_compressed(0)
42 , in_uncompressed(0)
43 , out_compressed(0)
44 , out_uncompressed(0)
45 {
46 }
47
48 QString Job::stateAsString() const
49 {
50 switch (state) {
51 case WaitingForCS:
52 return QApplication::tr("Waiting");
53 break;
54 case Compiling:
55 return QApplication::tr("Compiling");
56 break;
57 case Finished:
58 return QApplication::tr("Finished");
59 break;
60 case Failed:
61 return QApplication::tr("Failed");
62 break;
63 case Idle:
64 return QApplication::tr("Idle");
65 break;
66 case LocalOnly:
67 return QApplication::tr("Local Only");
68 break;
69 }
70 return QString();
71 }
72
73 QDebug operator<<(QDebug dbg, const Job &job)
74 {
75 return dbg.nospace() << "Job[id=" << job.id
76 << ", client=" << job.client
77 << ", server=" << job.server
78 << ", fileName=" << job.fileName
79 << ", state=" << job.stateAsString()
80 << "]";
81 }