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 , client(client)
32 , lang(lang)
33 {
34 }
35
36 QString Job::stateAsString() const
37 {
38 switch (state) {
39 case WaitingForCS:
40 return QApplication::tr("Waiting");
41 break;
42 case Compiling:
43 return QApplication::tr("Compiling");
44 break;
45 case Finished:
46 return QApplication::tr("Finished");
47 break;
48 case Failed:
49 return QApplication::tr("Failed");
50 break;
51 case Idle:
52 return QApplication::tr("Idle");
53 break;
54 case LocalOnly:
55 return QApplication::tr("Local Only");
56 break;
57 }
58 return QString();
59 }
60
61 QDebug operator<<(QDebug dbg, const Job &job)
62 {
63 return dbg.nospace() << "Job[id=" << job.id
64 << ", client=" << job.client
65 << ", server=" << job.server
66 << ", fileName=" << job.fileName
67 << ", state=" << job.stateAsString()
68 << "]";
69 }