Create uploader to i.nuuls.com (#1332)
This commit adds support for uploading images to i.nuuls.com from clipboard or by dragging an image into a split. Documentation for how to self-host the image uploader is available in ENV.md By default, you will be asked before an image upload takes place. There's an option in the dialog to not be asked again, if that option is chosen you can revert that choice in the settings dialog.
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
#include "widgets/helper/ResizingTextEdit.hpp"
|
||||
|
||||
#include "common/Common.hpp"
|
||||
#include "common/CompletionModel.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
|
||||
#include <QMimeData>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
ResizingTextEdit::ResizingTextEdit()
|
||||
@@ -257,20 +260,20 @@ void ResizingTextEdit::insertCompletion(const QString &completion)
|
||||
|
||||
bool ResizingTextEdit::canInsertFromMimeData(const QMimeData *source) const
|
||||
{
|
||||
if (source->hasImage())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (source->hasFormat("text/plain"))
|
||||
if (source->hasImage() || source->hasFormat("text/plain"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return QTextEdit::canInsertFromMimeData(source);
|
||||
}
|
||||
|
||||
void ResizingTextEdit::insertFromMimeData(const QMimeData *source)
|
||||
{
|
||||
if (!source->hasImage())
|
||||
if (source->hasImage() || source->hasUrls())
|
||||
{
|
||||
this->imagePasted.invoke(source);
|
||||
}
|
||||
else
|
||||
{
|
||||
insertPlainText(source->text());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
pajlada::Signals::Signal<QKeyEvent *> keyPressed;
|
||||
pajlada::Signals::NoArgSignal focused;
|
||||
pajlada::Signals::NoArgSignal focusLost;
|
||||
pajlada::Signals::Signal<const QMimeData *> imagePasted;
|
||||
|
||||
void setCompleter(QCompleter *c);
|
||||
QCompleter *getCompleter() const;
|
||||
|
||||
Reference in New Issue
Block a user