mirror of
https://github.com/arcan1s/reportabug.git
synced 2025-04-24 15:27:18 +00:00
release 1.1.0
This commit is contained in:
parent
49ad399c62
commit
653840d69f
@ -1,3 +1,7 @@
|
|||||||
|
Ver.1.1.0:
|
||||||
|
+ add abillity to load parametrs dynamically
|
||||||
|
* some fixes
|
||||||
|
|
||||||
Ver.1.0.2:
|
Ver.1.0.2:
|
||||||
* some fixes
|
* some fixes
|
||||||
|
|
||||||
|
11
README.md
11
README.md
@ -4,12 +4,12 @@ reportabug
|
|||||||
Information
|
Information
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Qt application/library which allows users to create an issue for GitHub projects. It may work over [GitHub](https://github.com) or [GitReport](https://gitreports.com/). For the developer configuration please use `config.h.in` header.
|
Qt application/library which allows users to create an issue for GitHub projects. It may work over [GitHub](https://github.com) or [GitReport](https://gitreports.com/). For the developer configuration please use `config.h` header.
|
||||||
|
|
||||||
Configuration
|
Configuration
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
Edit `src/config.h.in` header and set up needed variables.
|
Edit `src/config.h` header and set up needed variables or load parametrs dynamically using `params` array (**NOTE** please use the same keys as for `config.h`).
|
||||||
|
|
||||||
### Main configuration ###
|
### Main configuration ###
|
||||||
|
|
||||||
@ -100,15 +100,18 @@ Installation
|
|||||||
|
|
||||||
* declare class in you sources. For example:
|
* declare class in you sources. For example:
|
||||||
|
|
||||||
Reportabug *reportWindow = new Reportabug(this, false);
|
Reportabug *reportWindow = new Reportabug(parent=this,
|
||||||
|
debugCmd=false,
|
||||||
|
params=0);
|
||||||
reportWindow->showWindow();
|
reportWindow->showWindow();
|
||||||
|
|
||||||
* link your application with this library
|
* link your application with this library
|
||||||
|
|
||||||
### Available cmake flags ###
|
### Available cmake flags ###
|
||||||
|
|
||||||
* `-DBUILD_AS_LIBRARY:BOOL=0` - build the application but not a shared library
|
* `-DBUILD_AS_LIBRARY:BOOL=0` - build the application but not a library
|
||||||
* `-DBUILD_DOCS:BOOL=1` - build developer documentation
|
* `-DBUILD_DOCS:BOOL=1` - build developer documentation
|
||||||
|
* `-DBUILD_SHARED_LIBRARY=1` - build a shared library instead of static one
|
||||||
* `-DENABLE_GITHUB=0` - disable GitHub module
|
* `-DENABLE_GITHUB=0` - disable GitHub module
|
||||||
* `-DENABLE_GITREPORT=0` - disable GitReport module
|
* `-DENABLE_GITREPORT=0` - disable GitReport module
|
||||||
* `-DOWN_GITHUB_TOKEN=STRING` - use STRING as own GitHub token
|
* `-DOWN_GITHUB_TOKEN=STRING` - use STRING as own GitHub token
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
#include <QNetworkRequest>
|
#include <QNetworkRequest>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GithubModule
|
* @class GithubModule
|
||||||
@ -44,9 +42,10 @@
|
|||||||
/**
|
/**
|
||||||
* @fn GithubModule
|
* @fn GithubModule
|
||||||
*/
|
*/
|
||||||
GithubModule::GithubModule(QWidget *parent, bool debugCmd)
|
GithubModule::GithubModule(QWidget *parent, bool debugCmd, QMap<QString, QString> params)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
debug(debugCmd),
|
debug(debugCmd),
|
||||||
|
dynamic(params),
|
||||||
mainWindow((Reportabug *)parent)
|
mainWindow((Reportabug *)parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -75,12 +74,12 @@ QByteArray GithubModule::prepareRequest(const QString title, const QString body)
|
|||||||
QString fixBody = body;
|
QString fixBody = body;
|
||||||
fixBody.replace(QString("\n"), QString("<br>"));
|
fixBody.replace(QString("\n"), QString("<br>"));
|
||||||
requestList.append(QString("\"body\":\"") + fixBody + QString("\""));
|
requestList.append(QString("\"body\":\"") + fixBody + QString("\""));
|
||||||
if (!QString(TAG_ASSIGNEE).isEmpty())
|
if (!dynamic[QString("TAG_ASSIGNEE")].isEmpty())
|
||||||
requestList.append(QString("\"assignee\":\"") + parseString(QString(TAG_ASSIGNEE)) + QString("\""));
|
requestList.append(QString("\"assignee\":\"") + parseString(dynamic[QString("TAG_ASSIGNEE")]) + QString("\""));
|
||||||
if (!QString(TAG_MILESTONE).isEmpty())
|
if (!dynamic[QString("TAG_MILESTONE")].isEmpty())
|
||||||
requestList.append(QString("\"milestone\":") + QString(TAG_MILESTONE));
|
requestList.append(QString("\"milestone\":") + dynamic[QString("TAG_MILESTONE")]);
|
||||||
if (!QString(TAG_LABELS).isEmpty()) {
|
if (!dynamic[QString("TAG_LABELS")].isEmpty()) {
|
||||||
QStringList labels = QString(TAG_LABELS).split(QChar(','));
|
QStringList labels = dynamic[QString("TAG_LABELS")].split(QChar(','));
|
||||||
for (int i=0; i<labels.count(); i++)
|
for (int i=0; i<labels.count(); i++)
|
||||||
labels[i] = QString("\"") + labels[i] + QString("\"");
|
labels[i] = QString("\"") + labels[i] + QString("\"");
|
||||||
requestList.append(QString("\"labels\":[") + labels.join(QChar(',')) + QString("]"));
|
requestList.append(QString("\"labels\":[") + labels.join(QChar(',')) + QString("]"));
|
||||||
@ -105,11 +104,11 @@ QString GithubModule::parseString(QString line)
|
|||||||
|
|
||||||
if (line.contains(QString("$OWNER")))
|
if (line.contains(QString("$OWNER")))
|
||||||
line = line.split(QString("$OWNER"))[0] +
|
line = line.split(QString("$OWNER"))[0] +
|
||||||
QString(OWNER) +
|
dynamic[QString("OWNER")] +
|
||||||
line.split(QString("$OWNER"))[1];
|
line.split(QString("$OWNER"))[1];
|
||||||
if (line.contains(QString("$PROJECT")))
|
if (line.contains(QString("$PROJECT")))
|
||||||
line = line.split(QString("$PROJECT"))[0] +
|
line = line.split(QString("$PROJECT"))[0] +
|
||||||
QString(PROJECT) +
|
dynamic[QString("PROJECT")] +
|
||||||
line.split(QString("$PROJECT"))[1];
|
line.split(QString("$PROJECT"))[1];
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
@ -136,7 +135,7 @@ void GithubModule::sendReportUsingGithub(const QMap<QString, QString> info)
|
|||||||
QByteArray text = prepareRequest(info[QString("title")], info[QString("body")]);
|
QByteArray text = prepareRequest(info[QString("title")], info[QString("body")]);
|
||||||
QByteArray textSize = QByteArray::number(text.size());
|
QByteArray textSize = QByteArray::number(text.size());
|
||||||
// sending request
|
// sending request
|
||||||
QNetworkRequest request = QNetworkRequest(parseString(QString(ISSUES_URL)));
|
QNetworkRequest request = QNetworkRequest(parseString(dynamic[QString("ISSUES_URL")]));
|
||||||
request.setRawHeader("Authorization", headerData.toLocal8Bit());
|
request.setRawHeader("Authorization", headerData.toLocal8Bit());
|
||||||
request.setRawHeader("User-Agent", "reportabug");
|
request.setRawHeader("User-Agent", "reportabug");
|
||||||
request.setRawHeader("Host", "api.github.com");
|
request.setRawHeader("Host", "api.github.com");
|
||||||
|
@ -59,9 +59,11 @@ public:
|
|||||||
* @brief GithubModule class constructor
|
* @brief GithubModule class constructor
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
* @param debugCmd show debug messages
|
* @param debugCmd show debug messages
|
||||||
|
* @param params dynamic parametrs. Needed keys are the same as in config.h
|
||||||
*/
|
*/
|
||||||
explicit GithubModule(QWidget *parent = 0,
|
explicit GithubModule(QWidget *parent = 0,
|
||||||
bool debugCmd = false);
|
bool debugCmd = false,
|
||||||
|
QMap<QString, QString> params = QMap<QString, QString>());
|
||||||
/**
|
/**
|
||||||
* @brief GithubModule class destructor
|
* @brief GithubModule class destructor
|
||||||
*/
|
*/
|
||||||
@ -91,6 +93,10 @@ private:
|
|||||||
* @brief show debug messages
|
* @brief show debug messages
|
||||||
*/
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
|
/**
|
||||||
|
* @brief dynamic parametrs
|
||||||
|
*/
|
||||||
|
QMap<QString, QString> dynamic;
|
||||||
/**
|
/**
|
||||||
* @brief Reportabug class
|
* @brief Reportabug class
|
||||||
*/
|
*/
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
#include <QWebElement>
|
#include <QWebElement>
|
||||||
#include <QWebFrame>
|
#include <QWebFrame>
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GitreportModule
|
* @class GitreportModule
|
||||||
@ -46,9 +44,10 @@
|
|||||||
/**
|
/**
|
||||||
* @fn GitreportModule
|
* @fn GitreportModule
|
||||||
*/
|
*/
|
||||||
GitreportModule::GitreportModule(QWidget *parent, bool debugCmd)
|
GitreportModule::GitreportModule(QWidget *parent, bool debugCmd, QMap<QString, QString> params)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
debug(debugCmd),
|
debug(debugCmd),
|
||||||
|
dynamic(params),
|
||||||
mainWindow((Reportabug *)parent)
|
mainWindow((Reportabug *)parent)
|
||||||
{
|
{
|
||||||
webView = new QWebView();
|
webView = new QWebView();
|
||||||
@ -106,7 +105,7 @@ void GitreportModule::gitreportLoaded(const bool state)
|
|||||||
// captcha
|
// captcha
|
||||||
QWebElement document = webView->page()->mainFrame()->documentElement();
|
QWebElement document = webView->page()->mainFrame()->documentElement();
|
||||||
QWebElement captchaImg = document.findFirst(QString("input#captcha_key"));
|
QWebElement captchaImg = document.findFirst(QString("input#captcha_key"));
|
||||||
QString captchaUrl = QString(CAPTCHA_URL) + captchaImg.attribute(QString("value"));
|
QString captchaUrl = QString(dynamic[QString("CAPTCHA_URL")]) + captchaImg.attribute(QString("value"));
|
||||||
QNetworkRequest request(captchaUrl);
|
QNetworkRequest request(captchaUrl);
|
||||||
manager.get(request);
|
manager.get(request);
|
||||||
disconnect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(setCaptcha(QNetworkReply *)));
|
disconnect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(setCaptcha(QNetworkReply *)));
|
||||||
|
@ -49,9 +49,11 @@ public:
|
|||||||
* @brief GitreportModule class constructor
|
* @brief GitreportModule class constructor
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
* @param debugCmd show debug messages
|
* @param debugCmd show debug messages
|
||||||
|
* @param params dynamic parametrs. Needed keys are the same as in config.h
|
||||||
*/
|
*/
|
||||||
explicit GitreportModule(QWidget *parent = 0,
|
explicit GitreportModule(QWidget *parent = 0,
|
||||||
bool debugCmd = false);
|
bool debugCmd = false,
|
||||||
|
QMap<QString, QString> params = QMap<QString, QString>());
|
||||||
/**
|
/**
|
||||||
* @brief GitreportModule class destructor
|
* @brief GitreportModule class destructor
|
||||||
*/
|
*/
|
||||||
@ -93,6 +95,10 @@ private:
|
|||||||
* @brief show debug messages
|
* @brief show debug messages
|
||||||
*/
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
|
/**
|
||||||
|
* @brief dynamic parametrs
|
||||||
|
*/
|
||||||
|
QMap<QString, QString> dynamic;
|
||||||
/**
|
/**
|
||||||
* @brief Reportabug class
|
* @brief Reportabug class
|
||||||
*/
|
*/
|
||||||
|
@ -44,11 +44,41 @@
|
|||||||
/**
|
/**
|
||||||
* @fn Reportabug
|
* @fn Reportabug
|
||||||
*/
|
*/
|
||||||
Reportabug::Reportabug(QWidget *parent, bool debugCmd)
|
Reportabug::Reportabug(QWidget *parent, bool debugCmd, QMap<QString, QString> params)
|
||||||
: QMainWindow(parent),
|
: QMainWindow(parent),
|
||||||
debug(debugCmd),
|
debug(debugCmd),
|
||||||
|
dynamic(params),
|
||||||
ui(new Ui::Reportabug)
|
ui(new Ui::Reportabug)
|
||||||
{
|
{
|
||||||
|
// read settings
|
||||||
|
// main
|
||||||
|
if (!dynamic.contains(QString("OWNER")))
|
||||||
|
dynamic[QString("OWNER")] = QString(OWNER);
|
||||||
|
if (!dynamic.contains(QString("PROJECT")))
|
||||||
|
dynamic[QString("PROJECT")] = QString(PROJECT);
|
||||||
|
if (!dynamic.contains(QString("TAG_ASSIGNEE")))
|
||||||
|
dynamic[QString("TAG_ASSIGNEE")] = QString(TAG_ASSIGNEE);
|
||||||
|
if (!dynamic.contains(QString("TAG_BODY")))
|
||||||
|
dynamic[QString("TAG_BODY")] = QString(TAG_BODY);
|
||||||
|
if (!dynamic.contains(QString("TAG_LABELS")))
|
||||||
|
dynamic[QString("TAG_LABELS")] = QString(TAG_LABELS);
|
||||||
|
if (!dynamic.contains(QString("TAG_MILESTONE")))
|
||||||
|
dynamic[QString("TAG_MILESTONE")] = QString(TAG_MILESTONE);
|
||||||
|
if (!dynamic.contains(QString("TAG_TITLE")))
|
||||||
|
dynamic[QString("TAG_TITLE")] = QString(TAG_TITLE);
|
||||||
|
// github module
|
||||||
|
if (!dynamic.contains(QString("GITHUB_COMBOBOX")))
|
||||||
|
dynamic[QString("GITHUB_COMBOBOX")] = QString(GITHUB_COMBOBOX);
|
||||||
|
if (!dynamic.contains(QString("ISSUES_URL")))
|
||||||
|
dynamic[QString("ISSUES_URL")] = QString(ISSUES_URL);
|
||||||
|
// gitreport module
|
||||||
|
if (!dynamic.contains(QString("CAPTCHA_URL")))
|
||||||
|
dynamic[QString("CAPTCHA_URL")] = QString(CAPTCHA_URL);
|
||||||
|
if (!dynamic.contains(QString("GITREPORT_COMBOBOX")))
|
||||||
|
dynamic[QString("GITREPORT_COMBOBOX")] = QString(GITREPORT_COMBOBOX);
|
||||||
|
if (!dynamic.contains(QString("PUBLIC_URL")))
|
||||||
|
dynamic[QString("PUBLIC_URL")] = QString(PUBLIC_URL);
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
initModules();
|
initModules();
|
||||||
createComboBox();
|
createComboBox();
|
||||||
@ -117,9 +147,9 @@ void Reportabug::createComboBox()
|
|||||||
|
|
||||||
ui->comboBox->clear();
|
ui->comboBox->clear();
|
||||||
if (modules[0])
|
if (modules[0])
|
||||||
ui->comboBox->addItem(GITHUB_COMBOBOX);
|
ui->comboBox->addItem(dynamic[QString("GITHUB_COMBOBOX")]);
|
||||||
if (modules[1] || modules[2])
|
if (modules[1] || modules[2])
|
||||||
ui->comboBox->addItem(GITREPORT_COMBOBOX);
|
ui->comboBox->addItem(dynamic[QString("GITREPORT_COMBOBOX")]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,11 +238,11 @@ QString Reportabug::parseString(QString line)
|
|||||||
|
|
||||||
if (line.contains(QString("$OWNER")))
|
if (line.contains(QString("$OWNER")))
|
||||||
line = line.split(QString("$OWNER"))[0] +
|
line = line.split(QString("$OWNER"))[0] +
|
||||||
QString(OWNER) +
|
dynamic[QString("OWNER")] +
|
||||||
line.split(QString("$OWNER"))[1];
|
line.split(QString("$OWNER"))[1];
|
||||||
if (line.contains(QString("$PROJECT")))
|
if (line.contains(QString("$PROJECT")))
|
||||||
line = line.split(QString("$PROJECT"))[0] +
|
line = line.split(QString("$PROJECT"))[0] +
|
||||||
QString(PROJECT) +
|
dynamic[QString("PROJECT")] +
|
||||||
line.split(QString("$PROJECT"))[1];
|
line.split(QString("$PROJECT"))[1];
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
@ -274,8 +304,8 @@ void Reportabug::updateTabs(const int index)
|
|||||||
int number = getNumberByIndex(index);
|
int number = getNumberByIndex(index);
|
||||||
ui->lineEdit_username->clear();
|
ui->lineEdit_username->clear();
|
||||||
ui->lineEdit_password->clear();
|
ui->lineEdit_password->clear();
|
||||||
ui->lineEdit_title->setText(QString(TAG_TITLE));
|
ui->lineEdit_title->setText(dynamic[QString("TAG_TITLE")]);
|
||||||
ui->textEdit->setPlainText(QString(TAG_BODY));
|
ui->textEdit->setPlainText(dynamic[QString("TAG_BODY")]);
|
||||||
ui->lineEdit_captcha->clear();
|
ui->lineEdit_captcha->clear();
|
||||||
|
|
||||||
// it is out of conditional because I don't want a lot of ifdef/endif
|
// it is out of conditional because I don't want a lot of ifdef/endif
|
||||||
@ -311,7 +341,7 @@ void Reportabug::updateTabs(const int index)
|
|||||||
ui->lineEdit_password->setPlaceholderText(QApplication::translate("Reportabug", "email"));
|
ui->lineEdit_password->setPlaceholderText(QApplication::translate("Reportabug", "email"));
|
||||||
ui->lineEdit_password->setEchoMode(QLineEdit::Normal);
|
ui->lineEdit_password->setEchoMode(QLineEdit::Normal);
|
||||||
|
|
||||||
gitreport->webView->load(QUrl(parseString(QString(PUBLIC_URL))));
|
gitreport->webView->load(QUrl(parseString(dynamic[QString("PUBLIC_URL")])));
|
||||||
disconnect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportLoaded(bool)));
|
disconnect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportLoaded(bool)));
|
||||||
disconnect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportFinished(bool)));
|
disconnect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportFinished(bool)));
|
||||||
connect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportLoaded(bool)));
|
connect(gitreport->webView, SIGNAL(loadFinished(bool)), gitreport, SLOT(gitreportLoaded(bool)));
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#define REPORTABUG_H
|
#define REPORTABUG_H
|
||||||
|
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QLocale>
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
|
||||||
@ -49,9 +48,11 @@ public:
|
|||||||
* @brief Reportabug class constructor
|
* @brief Reportabug class constructor
|
||||||
* @param parent parent object
|
* @param parent parent object
|
||||||
* @param debugCmd show debug messages
|
* @param debugCmd show debug messages
|
||||||
|
* @param params dynamic parametrs. Needed keys are the same as in config.h
|
||||||
*/
|
*/
|
||||||
explicit Reportabug(QWidget *parent = 0,
|
explicit Reportabug(QWidget *parent = 0,
|
||||||
bool debugCmd = false);
|
bool debugCmd = false,
|
||||||
|
QMap<QString, QString> params = QMap<QString, QString>());
|
||||||
/**
|
/**
|
||||||
* @brief Reportabug class destructor
|
* @brief Reportabug class destructor
|
||||||
*/
|
*/
|
||||||
@ -86,6 +87,10 @@ private:
|
|||||||
* @brief show debug messages
|
* @brief show debug messages
|
||||||
*/
|
*/
|
||||||
bool debug;
|
bool debug;
|
||||||
|
/**
|
||||||
|
* @brief dynamic parametrs
|
||||||
|
*/
|
||||||
|
QMap<QString, QString> dynamic;
|
||||||
/**
|
/**
|
||||||
* @brief contains information about enabled modules
|
* @brief contains information about enabled modules
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user