58 QString About::getCreditsHtml() |
58 QString About::getCreditsHtml() |
59 { |
59 { |
60 // Open the credits file |
60 // Open the credits file |
61 |
61 |
62 /* *** FILE FORMAT OF CREDITS FILE *** |
62 /* *** FILE FORMAT OF CREDITS FILE *** |
63 The credits file is an RFC-4180-compliant CSV file with 4 columns. |
63 The credits file is an RFC-4180-compliant CSV file with 5 columns. |
64 The first column (column 1) is always 1 letter long and is the row type. |
64 The first column (column 1) is always 1 letter long and is the row type. |
65 The row type determines the meaning of the other columns. |
65 The row type determines the meaning of the other columns. |
66 |
66 |
67 The following row types are supported: |
67 The following row types are supported: |
68 |
68 |
69 * E: Credits entry |
69 * E: Credits entry |
70 * Column 2: Task/contribution |
70 * Column 2: Task/contribution |
71 * Column 3: Contributor name |
71 * Column 3: Contributor name |
72 * Column 4: Contributor e-mail |
72 * Column 4: Contributor e-mail |
|
73 * Column 5: Contributor nickname |
73 * M: Alternative credits entry that is a placeholder for other or unknown authors |
74 * M: Alternative credits entry that is a placeholder for other or unknown authors |
74 * Columns 2-4: Unused |
75 * Columns 2-5: Unused |
75 * S: Section |
76 * S: Section |
76 * Column 2: Section name |
77 * Column 2: Section name |
77 * Columns 3-4: Unused |
78 * Columns 3-5: Unused |
78 * U: Subsection |
79 * U: Subsection |
79 * Column 2: Subsection name |
80 * Column 2: Subsection name |
80 * Columns 3-4: Unused |
81 * Columns 3-5: Unused |
81 |
82 |
82 Column 2 MUST be in US-ASCII. |
83 Columns 2, 3 and 5 MUST be in US-ASCII. |
83 */ |
84 */ |
84 QFile creditsFile(":/res/credits.csv"); |
85 QFile creditsFile(":/res/credits.csv"); |
85 if (!creditsFile.open(QIODevice::ReadOnly)) |
86 if (!creditsFile.open(QIODevice::ReadOnly)) |
86 { |
87 { |
87 qWarning("ERROR: Credits file could not be opened!"); |
88 qWarning("ERROR: Credits file could not be opened!"); |
88 return "<p>ERROR: Credits file could not be opened!</p>"; |
89 return "<p>ERROR: Credits file could not be opened!</p>"; |
89 } |
90 } |
90 QString creditsString = creditsFile.readAll(); |
91 QString creditsString = creditsFile.readAll(); |
91 QString out = QString("<h1>" + tr("Credits") + "</h1>\n"); |
92 QString out = QString("<h1>" + tr("Credits") + "</h1>\n"); |
92 QStringList cells = QStringList() << QString("") << QString("") << QString("") << QString(""); |
93 QStringList cells = QStringList() << QString("") << QString("") << QString("") << QString("") << QString(""); |
93 bool firstSection = true; |
94 bool firstSection = true; |
94 unsigned long int column = 0; |
95 unsigned long int column = 0; |
95 unsigned long int charInCell = 0; |
96 unsigned long int charInCell = 0; |
96 bool isInQuote = false; |
97 bool isInQuote = false; |
97 bool ignoreChar = false; |
98 bool ignoreChar = false; |
168 // other people |
170 // other people |
169 out = out + "<li>" + tr("Other people") + "</li>" + "\n"; |
171 out = out + "<li>" + tr("Other people") + "</li>" + "\n"; |
170 } |
172 } |
171 else if(type == "E") |
173 else if(type == "E") |
172 { |
174 { |
|
175 QString showName = QString(""); |
|
176 if(!name.isEmpty() && !nick.isEmpty()) |
|
177 showName = tr("%1 (alias %2)").arg(name).arg(nick); |
|
178 else if(name.isEmpty() && !nick.isEmpty()) |
|
179 showName = nick; |
|
180 else if(!name.isEmpty() && nick.isEmpty()) |
|
181 showName = name; |
173 // credits list entry |
182 // credits list entry |
174 QString mailLink = QString("<a href=\"mailto:%1\">%1</a>").arg(mail); |
183 QString mailLink = QString("<a href=\"mailto:%1\">%1</a>").arg(mail); |
175 if(task.isEmpty() && mail.isEmpty() && !name.isEmpty()) |
184 if(task.isEmpty() && mail.isEmpty() && !showName.isEmpty()) |
176 { |
185 { |
177 // Name only |
186 // Name only |
178 out = out + "<li>" + name + "</li>\n"; |
187 out = out + "<li>" + showName + "</li>\n"; |
179 } |
188 } |
180 else if(name.isEmpty() && mail.isEmpty() && !task.isEmpty()) |
189 else if(showName.isEmpty() && mail.isEmpty() && !task.isEmpty()) |
181 { |
190 { |
182 // Task only |
191 // Task only |
183 out = out + "<li>" + HWApplication::translate("credits", task.toLatin1().constData()) + "</li>\n"; |
192 out = out + "<li>" + HWApplication::translate("credits", task.toLatin1().constData()) + "</li>\n"; |
184 } |
193 } |
185 else if(task.isEmpty()) |
194 else if(task.isEmpty()) |
186 { |
195 { |
187 // Name and e-mail |
196 // Name and e-mail |
188 //: Part of credits. %1: Contribution name. %2: E-mail address |
197 //: Part of credits. %1: Contributor name. %2: E-mail address |
189 out = out + "<li>" + tr("%1 <%2>").arg(name).arg(mailLink) + "</li>\n"; |
198 out = out + "<li>" + tr("%1 <%2>").arg(showName).arg(mailLink) + "</li>\n"; |
190 } |
199 } |
191 else if(mail.isEmpty()) |
200 else if(mail.isEmpty()) |
192 { |
201 { |
193 // Contribution and name |
202 // Contribution and name |
194 //: Part of credits. %1: Description of contribution. %2: Contributor name |
203 //: Part of credits. %1: Description of contribution. %2: Contributor name |
195 out = out + "<li>" + tr("%1: %2") |
204 out = out + "<li>" + tr("%1: %2") |
196 .arg(HWApplication::translate("credits", task.toLatin1().constData())) |
205 .arg(HWApplication::translate("credits", task.toLatin1().constData())) |
197 .arg(name) |
206 .arg(showName) |
198 + "</li>\n"; |
207 + "</li>\n"; |
199 } |
208 } |
200 else |
209 else |
201 { |
210 { |
202 // Contribution, name and e-mail |
211 // Contribution, name and e-mail |
203 //: Part of credits. %1: Description of contribution. %2: Contributor name. %3: E-mail address |
212 //: Part of credits. %1: Description of contribution. %2: Contributor name. %3: E-mail address |
204 out = out + "<li>" + tr("%1: %2 <%3>") |
213 out = out + "<li>" + tr("%1: %2 <%3>") |
205 .arg(HWApplication::translate("credits", task.toLatin1().constData())) |
214 .arg(HWApplication::translate("credits", task.toLatin1().constData())) |
206 .arg(name) |
215 .arg(showName) |
207 .arg(mailLink) |
216 .arg(mailLink) |
208 + "</li>\n"; |
217 + "</li>\n"; |
209 } |
218 } |
210 } |
219 } |
211 else |
220 else |