Add support for more image uploader services (#1741)

The list of links that have been uploaded is now also stored in the json format instead of csv
This commit is contained in:
Paweł
2020-07-05 14:32:10 +02:00
committed by GitHub
parent b66c2478a0
commit 682caf6b69
11 changed files with 255 additions and 86 deletions
+26 -25
View File
@@ -207,33 +207,34 @@ Split::Split(QWidget *parent)
[this] { this->focused.invoke(); });
this->input_->ui_.textEdit->focusLost.connect(
[this] { this->focusLost.invoke(); });
this->input_->ui_.textEdit->imagePasted.connect([this](const QMimeData
*source) {
if (getSettings()->askOnImageUpload.getValue())
{
QMessageBox msgBox;
msgBox.setText("Image upload");
msgBox.setInformativeText(
"You are uploading an image to i.nuuls.com. You won't be able "
"to remove the image from the site. Are you okay with this?");
msgBox.addButton(QMessageBox::Cancel);
msgBox.addButton(QMessageBox::Yes);
msgBox.addButton("Yes, don't ask again", QMessageBox::YesRole);
msgBox.setDefaultButton(QMessageBox::Yes);
auto picked = msgBox.exec();
if (picked == QMessageBox::Cancel)
this->input_->ui_.textEdit->imagePasted.connect(
[this](const QMimeData *source) {
if (getSettings()->askOnImageUpload.getValue())
{
return;
QMessageBox msgBox;
msgBox.setText("Image upload");
msgBox.setInformativeText(
"You are uploading an image to an external server. You may "
"not be able to remove the image from the site. Are you "
"okay with this?");
msgBox.addButton(QMessageBox::Cancel);
msgBox.addButton(QMessageBox::Yes);
msgBox.addButton("Yes, don't ask again", QMessageBox::YesRole);
msgBox.setDefaultButton(QMessageBox::Yes);
auto picked = msgBox.exec();
if (picked == QMessageBox::Cancel)
{
return;
}
else if (picked == 0) // don't ask again button
{
getSettings()->askOnImageUpload.setValue(false);
}
}
else if (picked == 0) // don't ask again button
{
getSettings()->askOnImageUpload.setValue(false);
}
}
upload(source, this->getChannel(), *this->input_->ui_.textEdit);
});
upload(source, this->getChannel(), *this->input_->ui_.textEdit);
});
setAcceptDrops(true);
}