This repository has been archived by the owner on Oct 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
[Updated] Implements #132: Pasting images into room #180
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3f0116c
Support pasting images into rooms
christarazi 1f7d238
Use generic QIODevice for uploading media
christarazi 47a27ca
Use new QIODevice api for pasted images
christarazi 6190254
Address the issues pointed out in review
christarazi 334d73c
Address the issues pointed out in review (2)
christarazi 59f8b57
Address the issues pointed out in review (3)
christarazi 9b49b7f
Address the issues pointed out in review (4)
christarazi f503e1f
Revert unnecessary changes from make lint
christarazi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* nheko Copyright (C) 2017 Konstantinos Sideris <siderisk@auth.gr> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <QLabel> | ||
#include <QLineEdit> | ||
#include <QPixmap> | ||
#include <QWidget> | ||
|
||
#include "FlatButton.h" | ||
|
||
class QMimeData; | ||
|
||
namespace dialogs { | ||
|
||
class PreviewImageOverlay : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
PreviewImageOverlay(QWidget *parent = nullptr); | ||
|
||
void setImageAndCreate(const QByteArray data, const QString &type); | ||
void setImageAndCreate(const QString &path); | ||
|
||
signals: | ||
void confirmImageUpload(const QByteArray data, const QString &img_name); | ||
|
||
private: | ||
void init(); | ||
|
||
QPixmap image_; | ||
QByteArray imageData_; | ||
QString imagePath_; | ||
|
||
QLabel titleLabel_; | ||
QLabel imageLabel_; | ||
QLineEdit imageName_; | ||
|
||
FlatButton upload_; | ||
FlatButton cancel_; | ||
}; | ||
} // dialogs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,16 +85,13 @@ dialogs--LeaveRoom, | |
dialogs--CreateRoom, | ||
dialogs--InviteUsers, | ||
dialogs--ReadReceipts, | ||
dialogs--JoinRoom { | ||
background-color: #383c4a; | ||
color: #caccd1; | ||
} | ||
|
||
QListWidget { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this line deleted? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops that was accidental. It probably slipped in when I was doing a rebase onto upstream from my previous PR. It has been fixed. Thanks for catching this. |
||
dialogs--JoinRoom, | ||
dialogs--PreviewImageOverlay { | ||
background-color: #383c4a; | ||
color: #caccd1; | ||
} | ||
|
||
QListWidget, | ||
WelcomePage, | ||
LoginPage, | ||
RegisterPage { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed? Unlike with image/audio/video, I'm not sure we can/should do much in the client with the data of an arbitrary opaque file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed because
TimelineView::addUserMessage
takes in a generic typeWidget
, which happens to be one of the fourFileItem
,ImageItem
,AudioItem
, andVideoItem
. Therefore, we need those types to have the same interface (parameters to the constructor).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not particularly happy about having never-used arguments making things confusing on both ends for the sake of convenience to a template. That said, any refactoring of
addUserMessage
is probably best done separately from this PR.