mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Smol fix.
This commit is contained in:
parent
e005fe806a
commit
736df48788
|
@ -147,11 +147,12 @@ void upload(const QMimeData *source, ChannelPtr channel,
|
||||||
// Each entry in source->urls() is a QUrl pointing to a file that was copied.
|
// Each entry in source->urls() is a QUrl pointing to a file that was copied.
|
||||||
for (const QUrl &path : source->urls())
|
for (const QUrl &path : source->urls())
|
||||||
{
|
{
|
||||||
if (!getImageFileFormat(path.toLocalFile()).isEmpty())
|
QString localPath = path.toLocalFile();
|
||||||
|
if (!getImageFileFormat(localPath).isEmpty())
|
||||||
{
|
{
|
||||||
channel->addMessage(makeSystemMessage(
|
channel->addMessage(makeSystemMessage(
|
||||||
QString("Uploading image: %1").arg(path.toLocalFile())));
|
QString("Uploading image: %1").arg(localPath)));
|
||||||
QImage img = QImage(path.toLocalFile());
|
QImage img = QImage(localPath);
|
||||||
if (img.isNull())
|
if (img.isNull())
|
||||||
{
|
{
|
||||||
channel->addMessage(
|
channel->addMessage(
|
||||||
|
@ -170,14 +171,14 @@ void upload(const QMimeData *source, ChannelPtr channel,
|
||||||
channel->addMessage(makeSystemMessage(
|
channel->addMessage(makeSystemMessage(
|
||||||
QString("Cannot upload file: %1, Couldn't convert "
|
QString("Cannot upload file: %1, Couldn't convert "
|
||||||
"image to png.")
|
"image to png.")
|
||||||
.arg(path.toLocalFile())));
|
.arg(localPath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (path.toLocalFile().endsWith(".gif"))
|
else if (localPath.endsWith(".gif"))
|
||||||
{
|
{
|
||||||
channel->addMessage(makeSystemMessage(
|
channel->addMessage(makeSystemMessage(
|
||||||
QString("Uploading GIF: %1").arg(path.toLocalFile())));
|
QString("Uploading GIF: %1").arg(localPath)));
|
||||||
QFile file(path.toLocalFile());
|
QFile file(localPath);
|
||||||
bool isOkay = file.open(QIODevice::ReadOnly);
|
bool isOkay = file.open(QIODevice::ReadOnly);
|
||||||
if (!isOkay)
|
if (!isOkay)
|
||||||
{
|
{
|
||||||
|
@ -194,7 +195,7 @@ void upload(const QMimeData *source, ChannelPtr channel,
|
||||||
{
|
{
|
||||||
channel->addMessage(makeSystemMessage(
|
channel->addMessage(makeSystemMessage(
|
||||||
QString("Cannot upload file: %1, not an image")
|
QString("Cannot upload file: %1, not an image")
|
||||||
.arg(path.toLocalFile())));
|
.arg(localPath)));
|
||||||
isUploading = false;
|
isUploading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue