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
82b1cc4e
Commit
82b1cc4e
authored
3 years ago
by
Guillaume Girol
Browse files
Options
Downloads
Patches
Plain Diff
add Alt+A keybinding to switch to next room with unread messages
parent
7bb1b1c6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1791
failed
3 years ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
resources/qml/Root.qml
+5
-0
5 additions, 0 deletions
resources/qml/Root.qml
src/timeline/RoomlistModel.cpp
+46
-0
46 additions, 0 deletions
src/timeline/RoomlistModel.cpp
src/timeline/RoomlistModel.h
+1
-0
1 addition, 0 deletions
src/timeline/RoomlistModel.h
with
52 additions
and
0 deletions
resources/qml/Root.qml
+
5
−
0
View file @
82b1cc4e
...
...
@@ -120,6 +120,11 @@ Page {
}
}
Shortcut
{
sequence
:
"
Alt+A
"
onActivated
:
Rooms
.
nextRoomWithActivity
()
}
Shortcut
{
sequence
:
"
Ctrl+Down
"
onActivated
:
Rooms
.
nextRoom
()
...
...
This diff is collapsed.
Click to expand it.
src/timeline/RoomlistModel.cpp
+
46
−
0
View file @
82b1cc4e
...
...
@@ -899,6 +899,52 @@ FilteredRoomlistModel::toggleTag(QString roomid, QString tag, bool on)
}
}
void
FilteredRoomlistModel
::
nextRoomWithActivity
()
{
int
roomWithMention
=
-
1
;
int
roomWithNotification
=
-
1
;
int
roomWithUnreadMessage
=
-
1
;
auto
r
=
currentRoom
();
int
currentRoomIdx
=
r
?
roomidToIndex
(
r
->
roomId
())
:
-
1
;
// first look for mentions
for
(
int
i
=
0
;
i
<
(
int
)
roomlistmodel
->
roomids
.
size
();
i
++
)
{
if
(
i
==
currentRoomIdx
)
continue
;
if
(
this
->
data
(
index
(
i
,
0
),
RoomlistModel
::
HasLoudNotification
).
toBool
())
{
roomWithMention
=
i
;
break
;
}
if
(
roomWithNotification
==
-
1
&&
this
->
data
(
index
(
i
,
0
),
RoomlistModel
::
NotificationCount
).
toInt
()
>
0
)
{
roomWithNotification
=
i
;
// don't break, we must continue looking for rooms with mentions
}
if
(
roomWithNotification
==
-
1
&&
roomWithUnreadMessage
==
-
1
&&
this
->
data
(
index
(
i
,
0
),
RoomlistModel
::
HasUnreadMessages
).
toBool
())
{
roomWithUnreadMessage
=
i
;
// don't break, we must continue looking for rooms with mentions
}
}
QString
targetRoomId
=
nullptr
;
if
(
roomWithMention
!=
-
1
)
{
targetRoomId
=
this
->
data
(
index
(
roomWithMention
,
0
),
RoomlistModel
::
RoomId
).
toString
();
nhlog
::
ui
()
->
debug
(
"choosing {} for mentions"
,
targetRoomId
.
toStdString
());
}
else
if
(
roomWithNotification
!=
-
1
)
{
targetRoomId
=
this
->
data
(
index
(
roomWithNotification
,
0
),
RoomlistModel
::
RoomId
).
toString
();
nhlog
::
ui
()
->
debug
(
"choosing {} for notifications"
,
targetRoomId
.
toStdString
());
}
else
if
(
roomWithUnreadMessage
!=
-
1
)
{
targetRoomId
=
this
->
data
(
index
(
roomWithUnreadMessage
,
0
),
RoomlistModel
::
RoomId
).
toString
();
nhlog
::
ui
()
->
debug
(
"choosing {} for unread messages"
,
targetRoomId
.
toStdString
());
}
if
(
targetRoomId
!=
nullptr
)
{
setCurrentRoom
(
targetRoomId
);
}
}
void
FilteredRoomlistModel
::
nextRoom
()
{
...
...
This diff is collapsed.
Click to expand it.
src/timeline/RoomlistModel.h
+
1
−
0
View file @
82b1cc4e
...
...
@@ -170,6 +170,7 @@ public slots:
void
setCurrentRoom
(
QString
roomid
)
{
roomlistmodel
->
setCurrentRoom
(
std
::
move
(
roomid
));
}
void
resetCurrentRoom
()
{
roomlistmodel
->
resetCurrentRoom
();
}
void
nextRoomWithActivity
();
void
nextRoom
();
void
previousRoom
();
...
...
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