mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Merge pull request #201 from lkito/master
Implemented message background highlight feature as per issue #193
This commit is contained in:
commit
883567b0b9
4 changed files with 30 additions and 6 deletions
|
@ -13,6 +13,7 @@ MouseArea {
|
||||||
height: row.height
|
height: row.height
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
preventStealing: true
|
preventStealing: true
|
||||||
|
hoverEnabled: true
|
||||||
|
|
||||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -23,7 +24,10 @@ MouseArea {
|
||||||
if (mouse.source === Qt.MouseEventNotSynthesized)
|
if (mouse.source === Qt.MouseEventNotSynthesized)
|
||||||
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
messageContextMenu.show(model.id, model.type, model.isEncrypted, row)
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
color: (timelineSettings.message_hover_highlight && parent.containsMouse) ? colors.base : "transparent"
|
||||||
|
anchors.fill: row
|
||||||
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: row
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ Page {
|
||||||
id: timelineSettings
|
id: timelineSettings
|
||||||
category: "user/timeline"
|
category: "user/timeline"
|
||||||
property bool buttons: true
|
property bool buttons: true
|
||||||
|
property bool message_hover_highlight: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
Menu {
|
||||||
|
@ -97,6 +98,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
|
visible: running
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
running: timelineManager.isInitialSync
|
running: timelineManager.isInitialSync
|
||||||
height: 200
|
height: 200
|
||||||
|
|
|
@ -56,6 +56,8 @@ UserSettings::load()
|
||||||
isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).toBool();
|
isStartInTrayEnabled_ = settings.value("user/window/start_in_tray", false).toBool();
|
||||||
isGroupViewEnabled_ = settings.value("user/group_view", true).toBool();
|
isGroupViewEnabled_ = settings.value("user/group_view", true).toBool();
|
||||||
isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool();
|
isButtonsInTimelineEnabled_ = settings.value("user/timeline/buttons", true).toBool();
|
||||||
|
isMessageHoverHighlightEnabled_ =
|
||||||
|
settings.value("user/timeline/message_hover_highlight", false).toBool();
|
||||||
isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool();
|
isMarkdownEnabled_ = settings.value("user/markdown_enabled", true).toBool();
|
||||||
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
|
isTypingNotificationsEnabled_ = settings.value("user/typing_notifications", true).toBool();
|
||||||
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
sortByImportance_ = settings.value("user/sort_by_unread", true).toBool();
|
||||||
|
@ -165,6 +167,7 @@ UserSettings::save()
|
||||||
|
|
||||||
settings.beginGroup("timeline");
|
settings.beginGroup("timeline");
|
||||||
settings.setValue("buttons", isButtonsInTimelineEnabled_);
|
settings.setValue("buttons", isButtonsInTimelineEnabled_);
|
||||||
|
settings.setValue("message_hover_highlight", isMessageHoverHighlightEnabled_);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
settings.setValue("avatar_circles", avatarCircles_);
|
settings.setValue("avatar_circles", avatarCircles_);
|
||||||
|
@ -235,6 +238,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
groupViewToggle_ = new Toggle{this};
|
groupViewToggle_ = new Toggle{this};
|
||||||
timelineButtonsToggle_ = new Toggle{this};
|
timelineButtonsToggle_ = new Toggle{this};
|
||||||
typingNotifications_ = new Toggle{this};
|
typingNotifications_ = new Toggle{this};
|
||||||
|
messageHoverHighlight_ = new Toggle{this};
|
||||||
sortByImportance_ = new Toggle{this};
|
sortByImportance_ = new Toggle{this};
|
||||||
readReceipts_ = new Toggle{this};
|
readReceipts_ = new Toggle{this};
|
||||||
markdownEnabled_ = new Toggle{this};
|
markdownEnabled_ = new Toggle{this};
|
||||||
|
@ -345,6 +349,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
boxWrap(tr("Read receipts"), readReceipts_);
|
boxWrap(tr("Read receipts"), readReceipts_);
|
||||||
boxWrap(tr("Send messages as Markdown"), markdownEnabled_);
|
boxWrap(tr("Send messages as Markdown"), markdownEnabled_);
|
||||||
boxWrap(tr("Desktop notifications"), desktopNotifications_);
|
boxWrap(tr("Desktop notifications"), desktopNotifications_);
|
||||||
|
boxWrap(tr("Highlight message on hover"), messageHoverHighlight_);
|
||||||
formLayout_->addRow(uiLabel_);
|
formLayout_->addRow(uiLabel_);
|
||||||
formLayout_->addRow(new HorizontalLine{this});
|
formLayout_->addRow(new HorizontalLine{this});
|
||||||
|
|
||||||
|
@ -463,6 +468,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
settings_->setDesktopNotifications(!isDisabled);
|
settings_->setDesktopNotifications(!isDisabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(messageHoverHighlight_, &Toggle::toggled, this, [this](bool isDisabled) {
|
||||||
|
settings_->setMessageHoverHighlight(!isDisabled);
|
||||||
|
});
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
sessionKeysImportBtn, &QPushButton::clicked, this, &UserSettingsPage::importSessionKeys);
|
sessionKeysImportBtn, &QPushButton::clicked, this, &UserSettingsPage::importSessionKeys);
|
||||||
|
|
||||||
|
@ -495,6 +504,7 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
readReceipts_->setState(!settings_->isReadReceiptsEnabled());
|
readReceipts_->setState(!settings_->isReadReceiptsEnabled());
|
||||||
markdownEnabled_->setState(!settings_->isMarkdownEnabled());
|
markdownEnabled_->setState(!settings_->isMarkdownEnabled());
|
||||||
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
||||||
|
messageHoverHighlight_->setState(!settings_->isMessageHoverHighlightEnabled());
|
||||||
deviceIdValue_->setText(QString::fromStdString(http::client()->device_id()));
|
deviceIdValue_->setText(QString::fromStdString(http::client()->device_id()));
|
||||||
|
|
||||||
deviceFingerprintValue_->setText(
|
deviceFingerprintValue_->setText(
|
||||||
|
|
|
@ -44,6 +44,11 @@ public:
|
||||||
void load();
|
void load();
|
||||||
void applyTheme();
|
void applyTheme();
|
||||||
void setTheme(QString theme);
|
void setTheme(QString theme);
|
||||||
|
void setMessageHoverHighlight(bool state)
|
||||||
|
{
|
||||||
|
isMessageHoverHighlightEnabled_ = state;
|
||||||
|
save();
|
||||||
|
}
|
||||||
void setTray(bool state)
|
void setTray(bool state)
|
||||||
{
|
{
|
||||||
isTrayEnabled_ = state;
|
isTrayEnabled_ = state;
|
||||||
|
@ -118,6 +123,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
||||||
|
bool isMessageHoverHighlightEnabled() const { return isMessageHoverHighlightEnabled_; }
|
||||||
bool isTrayEnabled() const { return isTrayEnabled_; }
|
bool isTrayEnabled() const { return isTrayEnabled_; }
|
||||||
bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; }
|
bool isStartInTrayEnabled() const { return isStartInTrayEnabled_; }
|
||||||
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
bool isGroupViewEnabled() const { return isGroupViewEnabled_; }
|
||||||
|
@ -144,6 +150,7 @@ private:
|
||||||
? "light"
|
? "light"
|
||||||
: "system";
|
: "system";
|
||||||
QString theme_;
|
QString theme_;
|
||||||
|
bool isMessageHoverHighlightEnabled_;
|
||||||
bool isTrayEnabled_;
|
bool isTrayEnabled_;
|
||||||
bool isStartInTrayEnabled_;
|
bool isStartInTrayEnabled_;
|
||||||
bool isGroupViewEnabled_;
|
bool isGroupViewEnabled_;
|
||||||
|
@ -203,6 +210,7 @@ private:
|
||||||
Toggle *groupViewToggle_;
|
Toggle *groupViewToggle_;
|
||||||
Toggle *timelineButtonsToggle_;
|
Toggle *timelineButtonsToggle_;
|
||||||
Toggle *typingNotifications_;
|
Toggle *typingNotifications_;
|
||||||
|
Toggle *messageHoverHighlight_;
|
||||||
Toggle *sortByImportance_;
|
Toggle *sortByImportance_;
|
||||||
Toggle *readReceipts_;
|
Toggle *readReceipts_;
|
||||||
Toggle *markdownEnabled_;
|
Toggle *markdownEnabled_;
|
||||||
|
|
Loading…
Reference in a new issue