I just killed a few hours in the future by making alot of merge conflicts

This commit is contained in:
ArsenArsen 2017-05-22 19:34:29 +02:00
parent c15594cd57
commit 4150551d78
10 changed files with 15 additions and 36 deletions

View File

@ -6,8 +6,7 @@
#include <QGraphicsTextItem>
#include <QTimer>
ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget)
: QGraphicsScene(), QGraphicsView(this, parentWidget) {
ColorPickerScene::ColorPickerScene(QPixmap *pixmap, QWidget *parentWidget) : QGraphicsScene(), QGraphicsView(this, parentWidget) {
setFrameShape(QFrame::NoFrame); // Time taken to solve: A george99g and 38 minutes.
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

View File

@ -108,8 +108,7 @@ void CropScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) {
initPos = p;
rect->setRect(p.x(), p.y(), 1, 1);
} else {
rect->setRect(QRect(qMin(initPos.x(), p.x()), qMin(initPos.y(), p.y()), qAbs(initPos.x() - p.x()),
qAbs(initPos.y() - p.y())));
rect->setRect(QRect(qMin(initPos.x(), p.x()), qMin(initPos.y(), p.y()), qAbs(initPos.x() - p.x()), qAbs(initPos.y() - p.y())));
}
}
QPolygonF poly;

View File

@ -15,8 +15,7 @@ void TextItem::mouseDragEvent(QGraphicsSceneMouseEvent *e, CropScene *scene) {
textItem->setPen(scene->pen());
textItem->setBrush(scene->brush());
} else {
auto ee
= 180 + qRadiansToDegrees(qAtan2((textItem->pos().y() - e->scenePos().y()), (textItem->pos().x() - e->scenePos().x())));
auto ee = 180 + qRadiansToDegrees(qAtan2((textItem->pos().y() - e->scenePos().y()), (textItem->pos().x() - e->scenePos().x())));
textItem->setRotation(ee);
}
}

View File

@ -8,9 +8,7 @@ namespace ioutils {
QNetworkAccessManager networkManager;
}
void ioutils::getJson(QUrl target,
QList<QPair<QString, QString>> headers,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
void ioutils::getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target);
for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());
@ -23,10 +21,7 @@ void ioutils::getJson(QUrl target,
});
}
void ioutils::postJson(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
void ioutils::postJson(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target);
for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());
@ -51,10 +46,7 @@ void ioutils::getData(QUrl target, QList<QPair<QString, QString>> headers, std::
});
}
void ioutils::postData(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QByteArray, QNetworkReply *)> callback) {
void ioutils::postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback) {
QNetworkRequest req(target);
for (auto header : headers) {
req.setRawHeader(header.first.toUtf8(), header.second.toUtf8());

View File

@ -10,10 +10,7 @@
namespace ioutils {
extern QNetworkAccessManager networkManager;
void getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
void postJson(QUrl target,
QList<QPair<QString, QString>> headers,
QByteArray body,
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
void postJson(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
void getData(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QByteArray, QNetworkReply *)> callback);
void postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback);
}

View File

@ -169,8 +169,7 @@ void MainWindow::on_hotkeys_doubleClicked(const QModelIndex &) {
QListWidgetItem *i = ui->hotkeys->selectedItems().at(0);
QString str = i->data(Qt::UserRole + 1).toString();
bool ok;
QString seq = QInputDialog::getText(ui->centralWidget, "Hotkey Input", "Insert hotkey:", QLineEdit::Normal,
hotkeying::sequence(str), &ok);
QString seq = QInputDialog::getText(ui->centralWidget, "Hotkey Input", "Insert hotkey:", QLineEdit::Normal, hotkeying::sequence(str), &ok);
if (ok && hotkeying::valid(seq)) hotkeying::hotkey(str, QKeySequence(seq), *fncs.value(str));
}
}

View File

@ -11,8 +11,7 @@ std::tuple<QPoint, QPixmap> PlatformBackend::getCursor() {
if (cursorInfo.flags == CURSOR_SHOWING) {
ICONINFO info; // It took me 5 hours to get to here
if (GetIconInfo(cursorInfo.hCursor, &info)) {
return std::tuple<QPoint, QPixmap>(QPoint(info.xHotspot, info.yHotspot),
QtWin::fromHBITMAP(info.hbmColor, QtWin::HBitmapAlpha));
return std::tuple<QPoint, QPixmap>(QPoint(info.xHotspot, info.yHotspot), QtWin::fromHBITMAP(info.hbmColor, QtWin::HBitmapAlpha));
} else
return std::tuple<QPoint, QPixmap>(QPoint(0, 0), QPixmap());
} else

View File

@ -78,8 +78,7 @@ CustomUploader::CustomUploader(QString absFilePath) {
error(absFilePath, "imageformat not string");
}
QString imageFormat = imageValue.toString();
if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat)
|| QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) {
if (imageFormat == "base64" || QRegExp("base64\\([^+]+\\+[^+]+)").exactMatch(imageFormat) || QRegExp("[^+]+\\+[^+]+").exactMatch(imageFormat)) {
this->iFormat = imageFormat;
} else
error(absFilePath, "imageformat invalid");
@ -231,8 +230,7 @@ void parseResult(QJsonDocument result, QByteArray data, QString returnPathspec,
} else
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result empty!");
} else {
notifications::notify("KShare Custom Uploader " + name,
"Upload done, but result is not JSON Object! Result in clipboard.");
notifications::notify("KShare Custom Uploader " + name, "Upload done, but result is not JSON Object! Result in clipboard.");
QApplication::clipboard()->setText(data);
}
}

View File

@ -16,13 +16,11 @@ void ImgurUploader::doUpload(QPixmap *pixmap) {
return;
}
ioutils::postJson(QUrl("https://api.imgur.com/3/image"),
QList<QPair<QString, QString>>()
<< QPair<QString, QString>("Content-Type", "application/x-www-form-urlencoded")
QList<QPair<QString, QString>>() << QPair<QString, QString>("Content-Type", "application/x-www-form-urlencoded")
<< QPair<QString, QString>("Authorization", "Client-ID 8a98f183fc895da"),
byteArray, [](QJsonDocument res, QByteArray, QNetworkReply *) {
QString result = res.object()["data"].toObject()["link"].toString();
screenshotutil::toClipboard(result);
notifications::notify("KShare imgur Uploader ",
result.isEmpty() ? "Failed upload!" : "Uploaded to imgur!");
notifications::notify("KShare imgur Uploader ", result.isEmpty() ? "Failed upload!" : "Uploaded to imgur!");
});
}

View File

@ -8,8 +8,7 @@
#include <formatter.hpp>
#include <settings.hpp>
UploaderSingleton::UploaderSingleton()
: QObject(), saveDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) {
UploaderSingleton::UploaderSingleton() : QObject(), saveDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation)) {
if (QStandardPaths::writableLocation(QStandardPaths::PicturesLocation).isEmpty()) {
qFatal("Cannot determine location for pictures");
}