Skip to content

Commit a9a9526

Browse files
authored
refactor(chatview): Add ability to select and copy/quote multiple messages (#137)
This pull-request adds a lot of enhancement to the ChatView: * It is now possible to select multiple messages to copy * You can also right click when multiple messages are selected to choose between "Copy selection in clipboard", "Copy quote in clipboard" or directly "Quote selection" in the chat entry! * Quick typo fix in the fr translation. * Unread messages count are now displayed in badges!
1 parent 34fa539 commit a9a9526

33 files changed

Lines changed: 667 additions & 254 deletions

IMessage.vala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* An interface.
3+
*/
4+
public interface IMessage {
5+
6+
}

docs/user_manual_en.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- [Introduction]
55
1. [Basic Tox concepts]
66
2. [Definition table]
7+
3. [Keyboard shortcuts]
78
- [Create a profile]
89
- [Customize your profile]
910
1. [Name]
@@ -38,7 +39,7 @@
3839
1. [Themes system]
3940
2. [Choose a language]
4041
3. [Configure the Ricin interface]
41-
42+
4243
## Introduction
4344
**Ricin** aims to be a popular instant messaging client for the Tox network. We built it in order to offer the most intuitive and performing talk app. The point of Ricin is to provide the highest quality when chatting with your friends, contacts, employees, and other people that matters in your life.
4445

@@ -64,6 +65,16 @@ This ToxID is composed of a **Public Key** (64 chars), a **nospam** (6 chars) an
6465

6566
**TODO:** Add definitions here as I write the manual.
6667

68+
### Keyboard shortcuts
69+
**Note**: The _Global_ context means that you can use the shortcut in the whole app.
70+
71+
| Shortcut | Context | Comments |
72+
|:--------------:|:-------------------|:--------------------------------------:|
73+
| `Ctrl+UP` | Global | Quickly switch to the previous contact.|
74+
| `Ctrl+DOWN` | Global | Quickly switch to the next contact. |
75+
| `Ctrl+Shift+Q` | Messages selection | Quote a selection of messages. |
76+
| `Ctrl+C` | Messages selection | Copy a selection of messages. |
77+
6778
## Create a profile
6879
The first time you launch Ricin, if you never used Tox before, you'll have to create a profile. A profile is a single `.tox` file that contains your name, your status message, your friends list, etc. This file **must not** be modified by hand, only Ricin (or another Tox client) should write in it. Editing this file by hand *may* expose you to profile corruption.
6980

@@ -127,6 +138,7 @@ The other way to add a friend is by only knowing it's Public Key. The difference
127138
[Introduction]: #introduction
128139
[Basic Tox concepts]: #basic-tox-concepts
129140
[Definition table]: #definition-table
141+
[Keyboard Shortcuts]: #keyboard-shortcuts
130142
[Create a profile]: #create-a-profile
131143

132144
[Customize your profile]: #customize-your-profile

po/fr_FR.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Ricin.
22
# Copyright (C) 2016 SkyzohKey and contributors
33
# This file is distributed under the same license as the Ricin package.
4-
#
4+
#
55
# Translators:
66
# SkyzohKey <SkyzohKey@users.noreply.github.com>, 2016
77
msgid ""
@@ -24,7 +24,7 @@ msgstr " est maintenant "
2424

2525
#: src/Wrapper.vala:219
2626
msgid " is now known as "
27-
msgstr " s'appel désormais "
27+
msgstr " s'appelle désormais "
2828

2929
#: res/ui/chat-view.ui:517
3030
msgid "**bold**"

res/themes/app.css

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@
77
/** GTK reset **/
88
@import url("reset.css");
99

10+
.badge {
11+
background-color: @ui_system_color;
12+
color: #ffffff;
13+
border-radius: 0px;
14+
padding: 3px 5px;
15+
font-size: 7px;
16+
}
17+
*:link {
18+
color: @ui_system_color;
19+
}
20+
1021
GtkEntry,
1122
GtkEntry:focus,
1223
GtkComboBox,
@@ -208,10 +219,6 @@ RicinProfileChooser .notebook .entry:hover {
208219
background-color: @ui_main;
209220
}
210221

211-
GtkLabel.info-message {
212-
color: #2a92c6;
213-
}
214-
215222
.ricin-navigation {
216223
background-color: @ui_dark;
217224
}
@@ -479,6 +486,9 @@ GtkScrolledWindow {
479486
.message-list GtkLabel {
480487
color: @ui_text;
481488
}
489+
.message-list GtkLabel:link {
490+
color: @ui_system_color;
491+
}
482492

483493
.entry-principal {
484494
background-image: none;
@@ -625,9 +635,18 @@ GtkScrolledWindow {
625635
color: @ui_text;
626636
}
627637

628-
/** ENTRIES SELECTION COLOR **/
629-
GtkSearchEntry:selected,
630-
GtkEntry:selected {
638+
/** SELECTION COLOR **/
639+
.message-list .activatable:selected *,
640+
.message-list .activatable:selected,
641+
:selected:not(.friendlist-row),
642+
.entry:selected {
643+
color: #ffffff;
631644
background-color: @selected_text_color;
632-
color: @ui_text;
645+
outline: none;
646+
}
647+
.message-list .activatable {
648+
outline: none;
649+
}
650+
.message-list .info-message {
651+
color: @ui_system_color;
633652
}

res/themes/clearer.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@define-color ui_main #333333;
1919
@define-color ui_text #FFFFFF;
2020
@define-color selected_text_color #5688F9;
21+
@define-color ui_system_color #2a92c6;
2122

2223
/** Non standard Ricin colors names, only used for this theme. */
2324
@define-color quote_background #444444;

res/themes/dark.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@define-color ui_main #333333;
1919
@define-color ui_text #FFFFFF;
2020
@define-color selected_text_color #5688F9;
21+
@define-color ui_system_color #2a92c6;
2122

2223
@define-color plain_color @ui_text;
2324
@define-color quote_color @ui_green;

res/themes/white.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@define-color ui_main #FFFFFF;
1919
@define-color ui_text #000000;
2020
@define-color selected_text_color #5688F9;
21+
@define-color ui_system_color #2a92c6;
2122

2223
@define-color plain_color @ui_text;
2324
@define-color quote_color @ui_green;

res/ui/chat-view.ui

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,10 @@
951951
<child>
952952
<object class="GtkListBox" id="messages_list">
953953
<property name="visible">True</property>
954-
<property name="can_focus">False</property>
954+
<property name="can_focus">True</property>
955+
<property name="has_focus">True</property>
955956
<property name="selection_mode">multiple</property>
957+
<property name="activate_on_single_click">False</property>
956958
<signal name="size-allocate" handler="scroll_to_bottom" swapped="no"/>
957959
<style>
958960
<class name="message-list"/>

res/ui/friend-list-row.ui

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,22 @@
9393
<property name="position">1</property>
9494
</packing>
9595
</child>
96+
<child>
97+
<object class="GtkLabel" id="label_unread_count">
98+
<property name="can_focus">False</property>
99+
<property name="halign">start</property>
100+
<property name="valign">center</property>
101+
<property name="label" translatable="yes">10</property>
102+
<style>
103+
<class name="badge"/>
104+
</style>
105+
</object>
106+
<packing>
107+
<property name="expand">False</property>
108+
<property name="fill">True</property>
109+
<property name="position">2</property>
110+
</packing>
111+
</child>
96112
<child>
97113
<object class="GtkImage" id="userstatus">
98114
<property name="width_request">16</property>

res/ui/main-window.ui

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<property name="width_request">922</property>
5353
<property name="height_request">500</property>
5454
<property name="can_focus">False</property>
55+
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
5556
<property name="window_position">center</property>
5657
<property name="default_width">900</property>
5758
<property name="default_height">500</property>

0 commit comments

Comments
 (0)