Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
a01bc14d
Commit
a01bc14d
authored
3 years ago
by
Marcus Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
InputBar: run clang-format
parent
a9d8059f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2217
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/timeline/InputBar.cpp
+22
-20
22 additions, 20 deletions
src/timeline/InputBar.cpp
src/timeline/InputBar.h
+7
-7
7 additions, 7 deletions
src/timeline/InputBar.h
with
29 additions
and
27 deletions
src/timeline/InputBar.cpp
+
22
−
20
View file @
a01bc14d
...
...
@@ -155,7 +155,7 @@ InputBar::updateAtRoom(const QString &t)
}
void
InputBar
::
setText
(
const
QString
&
newText
)
InputBar
::
setText
(
const
QString
&
newText
)
{
if
(
history_
.
empty
())
history_
.
push_front
(
newText
);
...
...
@@ -170,7 +170,10 @@ InputBar::setText(const QString& newText)
emit
textChanged
(
newText
);
}
void
InputBar
::
updateState
(
int
selectionStart_
,
int
selectionEnd_
,
int
cursorPosition_
,
const
QString
&
text_
)
InputBar
::
updateState
(
int
selectionStart_
,
int
selectionEnd_
,
int
cursorPosition_
,
const
QString
&
text_
)
{
if
(
text_
.
isEmpty
())
stopTyping
();
...
...
@@ -288,7 +291,7 @@ InputBar::openFileSelection()
}
void
InputBar
::
message
(
const
QString
&
msg
,
MarkdownOverride
useMarkdown
,
bool
rainbowify
)
InputBar
::
message
(
const
QString
&
msg
,
MarkdownOverride
useMarkdown
,
bool
rainbowify
)
{
mtx
::
events
::
msg
::
Text
text
=
{};
text
.
body
=
msg
.
trimmed
().
toStdString
();
...
...
@@ -352,7 +355,7 @@ InputBar::message(const QString& msg, MarkdownOverride useMarkdown, bool rainbow
}
void
InputBar
::
emote
(
const
QString
&
msg
,
bool
rainbowify
)
InputBar
::
emote
(
const
QString
&
msg
,
bool
rainbowify
)
{
auto
html
=
utils
::
markdownToHtml
(
msg
,
rainbowify
);
...
...
@@ -380,7 +383,7 @@ InputBar::emote(const QString& msg, bool rainbowify)
}
void
InputBar
::
notice
(
const
QString
&
msg
,
bool
rainbowify
)
InputBar
::
notice
(
const
QString
&
msg
,
bool
rainbowify
)
{
auto
html
=
utils
::
markdownToHtml
(
msg
,
rainbowify
);
...
...
@@ -562,7 +565,7 @@ InputBar::sticker(CombinedImagePackModel *model, int row)
}
void
InputBar
::
command
(
const
QString
&
command
,
QString
args
)
InputBar
::
command
(
const
QString
&
command
,
QString
args
)
{
if
(
command
==
"me"
)
{
emote
(
args
,
false
);
...
...
@@ -591,15 +594,15 @@ InputBar::command(const QString& command, QString args)
.
toStdString
();
member
.
membership
=
mtx
::
events
::
state
::
Membership
::
Join
;
http
::
client
()
->
send_state_event
(
room
->
roomId
().
toStdString
(),
http
::
client
()
->
user_i
d
().
to
_s
tring
(),
member
,
[](
const
mtx
::
responses
::
EventId
&
,
mtx
::
http
::
RequestErr
err
)
{
if
(
err
)
nhlog
::
net
()
->
error
(
"Failed to set room displayname: {}"
,
err
->
matrix_error
.
error
);
});
http
::
client
()
->
send_state_event
(
room
->
roomI
d
().
to
StdS
tring
(),
http
::
client
()
->
user_id
().
to_string
()
,
member
,
[](
const
mtx
::
responses
::
EventId
&
,
mtx
::
http
::
RequestErr
err
)
{
if
(
err
)
nhlog
::
net
()
->
error
(
"Failed to set room displayname: {}"
,
err
->
matrix_error
.
error
);
});
}
else
if
(
command
==
"shrug"
)
{
message
(
"¯
\\
_(ツ)_/¯"
+
(
args
.
isEmpty
()
?
""
:
" "
+
args
));
}
else
if
(
command
==
"fliptable"
)
{
...
...
@@ -650,10 +653,9 @@ InputBar::command(const QString& command, QString args)
}
void
InputBar
::
showPreview
(
const
QMimeData
&
source
,
const
QString
&
path
,
const
QStringList
&
formats
)
InputBar
::
showPreview
(
const
QMimeData
&
source
,
const
QString
&
path
,
const
QStringList
&
formats
)
{
auto
*
previewDialog_
=
new
dialogs
::
PreviewUploadOverlay
(
ChatPage
::
instance
());
auto
*
previewDialog_
=
new
dialogs
::
PreviewUploadOverlay
(
ChatPage
::
instance
());
previewDialog_
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
// Force SVG to _not_ be handled as an image, but as raw data
...
...
@@ -668,7 +670,7 @@ InputBar::showPreview(const QMimeData &source, const QString& path, const QStrin
}
else
if
(
!
path
.
isEmpty
())
previewDialog_
->
setPreview
(
path
);
else
if
(
!
formats
.
isEmpty
())
{
const
auto
&
mime
=
formats
.
first
();
const
auto
&
mime
=
formats
.
first
();
previewDialog_
->
setPreview
(
source
.
data
(
mime
),
mime
);
}
else
{
setUploading
(
false
);
...
...
@@ -684,7 +686,7 @@ InputBar::showPreview(const QMimeData &source, const QString& path, const QStrin
previewDialog_
,
&
dialogs
::
PreviewUploadOverlay
::
confirmUpload
,
this
,
[
this
](
const
QByteArray
&
data
,
const
QString
&
mime
,
const
QString
&
fn
)
{
[
this
](
const
QByteArray
&
data
,
const
QString
&
mime
,
const
QString
&
fn
)
{
if
(
!
data
.
size
())
{
nhlog
::
ui
()
->
warn
(
"Attempted to upload zero-byte file?! Mimetype {}, filename {}"
,
mime
.
toStdString
(),
...
...
This diff is collapsed.
Click to expand it.
src/timeline/InputBar.h
+
7
−
7
View file @
a01bc14d
...
...
@@ -48,17 +48,17 @@ public slots:
[[
nodiscard
]]
QString
text
()
const
;
QString
previousText
();
QString
nextText
();
void
setText
(
const
QString
&
newText
);
void
setText
(
const
QString
&
newText
);
[[
nodiscard
]]
bool
containsAtRoom
()
const
{
return
containsAtRoom_
;
}
void
send
();
void
paste
(
bool
fromMouse
);
void
insertMimeData
(
const
QMimeData
*
data
);
void
updateState
(
int
selectionStart
,
int
selectionEnd
,
int
cursorPosition
,
const
QString
&
text
);
void
updateState
(
int
selectionStart
,
int
selectionEnd
,
int
cursorPosition
,
const
QString
&
text
);
void
openFileSelection
();
[[
nodiscard
]]
bool
uploading
()
const
{
return
uploading_
;
}
void
message
(
const
QString
&
body
,
void
message
(
const
QString
&
body
,
MarkdownOverride
useMarkdown
=
MarkdownOverride
::
NOT_SPECIFIED
,
bool
rainbowify
=
false
);
void
reaction
(
const
QString
&
reactedEvent
,
const
QString
&
reactionKey
);
...
...
@@ -75,9 +75,9 @@ signals:
void
containsAtRoomChanged
();
private
:
void
emote
(
const
QString
&
body
,
bool
rainbowify
);
void
notice
(
const
QString
&
body
,
bool
rainbowify
);
void
command
(
const
QString
&
name
,
QString
args
);
void
emote
(
const
QString
&
body
,
bool
rainbowify
);
void
notice
(
const
QString
&
body
,
bool
rainbowify
);
void
command
(
const
QString
&
name
,
QString
args
);
void
image
(
const
QString
&
filename
,
const
std
::
optional
<
mtx
::
crypto
::
EncryptedFile
>
&
file
,
const
QString
&
url
,
...
...
@@ -101,7 +101,7 @@ private:
const
QString
&
mime
,
uint64_t
dsize
);
void
showPreview
(
const
QMimeData
&
source
,
const
QString
&
path
,
const
QStringList
&
formats
);
void
showPreview
(
const
QMimeData
&
source
,
const
QString
&
path
,
const
QStringList
&
formats
);
void
setUploading
(
bool
value
)
{
if
(
value
!=
uploading_
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment