joinerror.cpp
1 //------------------------------------------------------------------------------
2 // joinerror.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301, USA.
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2014 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #include "joinerror.h"
25 
26 #include <QList>
27 
28 DClass<JoinError>
29 {
30  public:
32  QString error;
33 
37  QString missingIwad;
38 
42  QList<PWad> missingWads;
43 };
44 
45 DPointered(JoinError)
46 
48 {
49  d->type = NoError;
50 }
51 
52 JoinError::JoinError(JoinError::JoinErrorType type)
53 {
54  d->type = type;
55 }
56 
57 JoinError::JoinError(const JoinError& other)
58 {
59  d = other.d;
60 }
61 
62 JoinError& JoinError::operator=(const JoinError& other)
63 {
64  d = other.d;
65  return *this;
66 }
67 
68 JoinError::~JoinError()
69 {
70 }
71 
72 void JoinError::addMissingWad(const PWad& wad)
73 {
74  d->missingWads << wad;
75 }
76 
77 void JoinError::clearMissingWads()
78 {
79  d->missingWads.clear();
80 }
81 
82 const QString& JoinError::error() const
83 {
84  return d->error;
85 }
86 
87 bool JoinError::isError() const
88 {
89  return d->type != NoError;
90 }
91 
92 bool JoinError::isMissingIwadOnly() const
93 {
94  return d->type == MissingWads
95  && !d->missingIwad.isEmpty()
96  && d->missingWads.isEmpty();
97 }
98 
99 bool JoinError::isMissingWadsError() const
100 {
101  return d->type == MissingWads;
102 }
103 
104 const QString& JoinError::missingIwad() const
105 {
106  return d->missingIwad;
107 }
108 
109 const QList<PWad>& JoinError::missingWads() const
110 {
111  return d->missingWads;
112 }
113 
114 void JoinError::setError(const QString& error)
115 {
116  d->error = error;
117 }
118 
119 void JoinError::setMissingIwad(const QString& iwad)
120 {
121  d->missingIwad = iwad;
122 }
123 
124 void JoinError::setMissingWads(const QList<PWad>& wads)
125 {
126  d->missingWads = wads;
127 }
128 
129 void JoinError::setType(JoinErrorType type)
130 {
131  d->type = type;
132 }
133 
134 JoinError::JoinErrorType JoinError::type() const
135 {
136  return d->type;
137 }
PWAD hosted on a server.
const QList< PWad > & missingWads() const
Definition: joinerror.cpp:109
Indicator of error for the server join process.
Definition: joinerror.h:41
const QString & missingIwad() const
Definition: joinerror.cpp:104