removed default image uploader

This commit is contained in:
fourtf 2020-08-22 18:33:37 +02:00
parent a569ee915f
commit a8c61980ac
3 changed files with 18 additions and 6 deletions

View file

@ -281,10 +281,11 @@ public:
QStringSetting customURIScheme = {"/external/urischeme"};
// Image Uploader
QStringSetting imageUploaderUrl = {"/external/imageUploader/url",
"https://i.nuuls.com/upload"};
BoolSetting imageUploaderEnabled = {"/external/imageUploader/enabled",
false};
QStringSetting imageUploaderUrl = {"/external/imageUploader/url", ""};
QStringSetting imageUploaderFormField = {
"/external/imageUploader/formField", "attachment"};
"/external/imageUploader/formField", ""};
QStringSetting imageUploaderHeaders = {"/external/imageUploader/headers",
""};
QStringSetting imageUploaderLink = {"/external/imageUploader/link", ""};

View file

@ -119,6 +119,9 @@ ExternalToolsPage::ExternalToolsPage()
groupLayout->setWidget(0, QFormLayout::SpanningRole, description);
groupLayout->addRow(this->createCheckBox(
"Enable image uploader", getSettings()->imageUploaderEnabled));
groupLayout->addRow(
"Request URL: ",
this->createLineEdit(getSettings()->imageUploaderUrl));

View file

@ -209,6 +209,9 @@ Split::Split(QWidget *parent)
[this] { this->focusLost.invoke(); });
this->input_->ui_.textEdit->imagePasted.connect(
[this](const QMimeData *source) {
if (!getSettings()->imageUploaderEnabled)
return;
if (getSettings()->askOnImageUpload.getValue())
{
QMessageBox msgBox;
@ -235,7 +238,10 @@ Split::Split(QWidget *parent)
}
upload(source, this->getChannel(), *this->input_->ui_.textEdit);
});
setAcceptDrops(true);
getSettings()->imageUploaderEnabled.connect(
[this](const bool &val) { this->setAcceptDrops(val); },
this->managedConnections_);
}
Split::~Split()
@ -742,7 +748,8 @@ void Split::reloadChannelAndSubscriberEmotes()
void Split::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasImage() || event->mimeData()->hasUrls())
if (getSettings()->imageUploaderEnabled &&
(event->mimeData()->hasImage() || event->mimeData()->hasUrls()))
{
event->acceptProposedAction();
}
@ -754,7 +761,8 @@ void Split::dragEnterEvent(QDragEnterEvent *event)
void Split::dropEvent(QDropEvent *event)
{
if (event->mimeData()->hasImage() || event->mimeData()->hasUrls())
if (getSettings()->imageUploaderEnabled &&
(event->mimeData()->hasImage() || event->mimeData()->hasUrls()))
{
this->input_->ui_.textEdit->imagePasted.invoke(event->mimeData());
}