mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add confirmation box for uploads.
This commit is contained in:
parent
84007d2edb
commit
2b1c9794b7
|
@ -291,6 +291,7 @@ public:
|
||||||
"/misc/attachExtensionToAnyProcess", false};
|
"/misc/attachExtensionToAnyProcess", false};
|
||||||
BoolSetting hideViewerCountAndDuration = {
|
BoolSetting hideViewerCountAndDuration = {
|
||||||
"/misc/hideViewerCountAndDuration", false};
|
"/misc/hideViewerCountAndDuration", false};
|
||||||
|
BoolSetting askOnImageUpload = {"/misc/askOnImageUpload", true};
|
||||||
|
|
||||||
/// Debug
|
/// Debug
|
||||||
BoolSetting showUnhandledIrcMessages = {"/debug/showUnhandledIrcMessages",
|
BoolSetting showUnhandledIrcMessages = {"/debug/showUnhandledIrcMessages",
|
||||||
|
|
|
@ -545,6 +545,9 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||||
layout.addCheckbox(
|
layout.addCheckbox(
|
||||||
"Hide viewercount and stream length while hovering the split",
|
"Hide viewercount and stream length while hovering the split",
|
||||||
s.hideViewerCountAndDuration);
|
s.hideViewerCountAndDuration);
|
||||||
|
layout.addCheckbox(
|
||||||
|
"Ask for confirmation when uploading an image to i.nuuls.com",
|
||||||
|
s.askOnImageUpload);
|
||||||
|
|
||||||
layout.addTitle("Cache");
|
layout.addTitle("Cache");
|
||||||
layout.addDescription(
|
layout.addDescription(
|
||||||
|
|
|
@ -207,10 +207,33 @@ Split::Split(QWidget *parent)
|
||||||
[this] { this->focused.invoke(); });
|
[this] { this->focused.invoke(); });
|
||||||
this->input_->ui_.textEdit->focusLost.connect(
|
this->input_->ui_.textEdit->focusLost.connect(
|
||||||
[this] { this->focusLost.invoke(); });
|
[this] { this->focusLost.invoke(); });
|
||||||
this->input_->ui_.textEdit->imagePasted.connect(
|
this->input_->ui_.textEdit->imagePasted.connect([this](const QMimeData
|
||||||
[this](const QMimeData *source) {
|
*source) {
|
||||||
upload(source, this->getChannel(), *this->input_->ui_.textEdit);
|
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)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (picked == 0) // don't ask again button
|
||||||
|
{
|
||||||
|
getSettings()->askOnImageUpload.setValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upload(source, this->getChannel(), *this->input_->ui_.textEdit);
|
||||||
|
});
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue