adapt_to_changes_in_tdlib #10

Merged
medvedych merged 12 commits from adapt_to_changes_in_tdlib into master 2023-11-19 16:35:17 +03:00
4 changed files with 35 additions and 0 deletions
Showing only changes of commit 46419b0960 - Show all commits

View file

@ -151,6 +151,9 @@ ListItem {
truncationMode: TruncationMode.Fade truncationMode: TruncationMode.Fade
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0) - (mutedImage.visible ? (mutedImage.width + primaryTextRow.spacing) : 0), implicitWidth) width: Math.min(contentColumn.width - (verifiedImage.visible ? (verifiedImage.width + primaryTextRow.spacing) : 0) - (mutedImage.visible ? (mutedImage.width + primaryTextRow.spacing) : 0), implicitWidth)
font.bold: appSettings.highlightUnreadConversations && ( !chatListViewItem.isMuted && (chatListViewItem.unreadCount > 0 || chatListViewItem.isMarkedAsUnread) )
font.italic: appSettings.highlightUnreadConversations && (chatListViewItem.unreadReactionCount > 0)
color: (appSettings.highlightUnreadConversations && (chatListViewItem.unreadCount > 0)) ? Theme.highlightColor : Theme.primaryColor
} }
Image { Image {

View file

@ -70,6 +70,18 @@ AccordionItem {
} }
} }
TextSwitch {
width: parent.columnWidth
checked: appSettings.highlightUnreadConversations
text: qsTr("Highlight unread messages")
description: qsTr("Highlight Conversations with unread messages")
automaticCheck: false
onClicked: {
appSettings.highlightUnreadConversations = !checked
}
}
TextSwitch { TextSwitch {
width: parent.columnWidth width: parent.columnWidth
checked: appSettings.useOpenWith checked: appSettings.useOpenWith

View file

@ -37,6 +37,7 @@ namespace {
const QString KEY_DELAY_MESSAGE_READ("delayMessageRead"); const QString KEY_DELAY_MESSAGE_READ("delayMessageRead");
const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen"); const QString KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN("focusTextAreaOnChatOpen");
const QString KEY_SPONSORED_MESS("sponsoredMess"); const QString KEY_SPONSORED_MESS("sponsoredMess");
const QString KEY_HIGHLIGHT_UNREADCONVS("highlightUnreadConversations");
} }
AppSettings::AppSettings(QObject *parent) : QObject(parent), settings(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/de.ygriega/fernschreiber/settings.conf", QSettings::NativeFormat) AppSettings::AppSettings(QObject *parent) : QObject(parent), settings(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + "/de.ygriega/fernschreiber/settings.conf", QSettings::NativeFormat)
@ -240,6 +241,20 @@ void AppSettings::setDelayMessageRead(bool enable)
} }
} }
bool AppSettings::highlightUnreadConversations() const
{
return settings.value(KEY_HIGHLIGHT_UNREADCONVS, true).toBool();
}
void AppSettings::setHighlightUnreadConversations(bool enable)
{
if (highlightUnreadConversations() != enable) {
LOG(KEY_HIGHLIGHT_UNREADCONVS << enable);
settings.setValue(KEY_HIGHLIGHT_UNREADCONVS, enable);
emit highlightUnreadConversationsChanged();
}
}
bool AppSettings::getFocusTextAreaOnChatOpen() const bool AppSettings::getFocusTextAreaOnChatOpen() const
{ {
return settings.value(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN, false).toBool(); return settings.value(KEY_FOCUS_TEXTAREA_ON_CHAT_OPEN, false).toBool();

View file

@ -40,6 +40,7 @@ class AppSettings : public QObject {
Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged) Q_PROPERTY(bool delayMessageRead READ delayMessageRead WRITE setDelayMessageRead NOTIFY delayMessageReadChanged)
Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged) Q_PROPERTY(bool focusTextAreaOnChatOpen READ getFocusTextAreaOnChatOpen WRITE setFocusTextAreaOnChatOpen NOTIFY focusTextAreaOnChatOpenChanged)
Q_PROPERTY(SponsoredMess sponsoredMess READ getSponsoredMess WRITE setSponsoredMess NOTIFY sponsoredMessChanged) Q_PROPERTY(SponsoredMess sponsoredMess READ getSponsoredMess WRITE setSponsoredMess NOTIFY sponsoredMessChanged)
Q_PROPERTY(bool highlightUnreadConversations READ highlightUnreadConversations WRITE setHighlightUnreadConversations NOTIFY highlightUnreadConversationsChanged)
public: public:
enum SponsoredMess { enum SponsoredMess {
@ -107,6 +108,9 @@ public:
SponsoredMess getSponsoredMess() const; SponsoredMess getSponsoredMess() const;
void setSponsoredMess(SponsoredMess sponsoredMess); void setSponsoredMess(SponsoredMess sponsoredMess);
bool highlightUnreadConversations() const;
void setHighlightUnreadConversations(bool enable);
signals: signals:
void sendByEnterChanged(); void sendByEnterChanged();
void focusTextAreaAfterSendChanged(); void focusTextAreaAfterSendChanged();
@ -124,6 +128,7 @@ signals:
void delayMessageReadChanged(); void delayMessageReadChanged();
void focusTextAreaOnChatOpenChanged(); void focusTextAreaOnChatOpenChanged();
void sponsoredMessChanged(); void sponsoredMessChanged();
void highlightUnreadConversationsChanged();
private: private:
QSettings settings; QSettings settings;