1 /* 2 * Copyright 2011-2012 Arx Libertatis Team (see the AUTHORS file) 3 * 4 * This file is part of Arx Libertatis. 5 * 6 * Arx Libertatis is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Arx Libertatis is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Arx Libertatis. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef ARX_TOOLS_CRASHREPORTER_TBG_TBG_H 21 #define ARX_TOOLS_CRASHREPORTER_TBG_TBG_H 22 23 #include <QString> 24 #include <QNetworkAccessManager> 25 #include <QNetworkRequest> 26 #include <QNetworkReply> 27 28 namespace TBG { 29 30 class Server : public QObject { 31 32 public: 33 34 enum OperatingSystem { 35 OS_Linux = 100, // Linux 36 OS_MacOSX = 200, // Mac 37 OS_FreeBSD = 300, // FreeBSD 38 OS_Windows = 400, // Windows 39 OS_Other = 0xFFFFFFFF 40 }; 41 42 enum Architecture { 43 Arch_Amd64 = 3, 44 Arch_x86 = 2, 45 Arch_Other = 0xFFFFFFFF 46 }; 47 48 explicit Server(const QString & adress); 49 50 bool login(const QString & username, const QString & password); 51 bool createCrashReport(const QString & title, const QString & description, 52 const QString & reproSteps, int version_id, int & issue_id); 53 bool addComment(int issue_id, const QString & comment); 54 bool setOperatingSystem(int issue_id, int os_id); 55 bool setArchitecture(int issue_id, int arch_id); 56 bool attachFile(int issue_id, const QString & filePath, const QString & fileDescription, 57 const QString & comment); 58 bool findIssue(const QString & text, int & issue_id); 59 60 QUrl getUrl() const; 61 62 const QString & getErrorString() const; 63 64 private: 65 66 bool waitForReply(bool followRedirect = true); 67 bool setFieldValue(const QString & fieldName, int issue_id, int value_id); 68 bool getIssueIdFromUrl(const QUrl & url, int& issue_id); 69 70 private: 71 72 QString m_ServerAddress; 73 QString m_ServerPrefix; 74 QNetworkAccessManager m_NetAccessManager; 75 QNetworkReply * m_CurrentReply; 76 QUrl m_CurrentUrl; 77 QString m_LastErrorString; 78 }; 79 80 } 81 82 #endif // ARX_TOOLS_CRASHREPORTER_TBG_TBG_H 83