mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
disable swipe motions toggle
This commit is contained in:
parent
9abc44efe9
commit
000681b25e
5 changed files with 43 additions and 1 deletions
|
@ -4786,6 +4786,11 @@ Reason: %4</translation>
|
||||||
<source>Touchscreen mode</source>
|
<source>Touchscreen mode</source>
|
||||||
<translation>Touchscreen mode</translation>
|
<translation>Touchscreen mode</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+2"/>
|
||||||
|
<source>Disable swipe motions</source>
|
||||||
|
<translation>Disable swipe motions</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+2"/>
|
<location line="+2"/>
|
||||||
<source>Font size</source>
|
<source>Font size</source>
|
||||||
|
|
|
@ -272,6 +272,7 @@ TimelineEvent {
|
||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
id: replyDragHandler
|
id: replyDragHandler
|
||||||
|
enabled: !Settings.disableSwipe
|
||||||
yAxis.enabled: false
|
yAxis.enabled: false
|
||||||
xAxis.enabled: true
|
xAxis.enabled: true
|
||||||
xAxis.minimum: wrapper.avatarMargin - 100
|
xAxis.minimum: wrapper.avatarMargin - 100
|
||||||
|
|
|
@ -126,7 +126,7 @@ Container {
|
||||||
snapMode: ListView.SnapOneItem
|
snapMode: ListView.SnapOneItem
|
||||||
orientation: ListView.Horizontal
|
orientation: ListView.Horizontal
|
||||||
highlightRangeMode: ListView.StrictlyEnforceRange
|
highlightRangeMode: ListView.StrictlyEnforceRange
|
||||||
interactive: singlePageMode
|
interactive: !Settings.disableSwipe && singlePageMode
|
||||||
highlightMoveDuration: (container.singlePageMode && !Settings.reducedMotion) ? 200 : 0
|
highlightMoveDuration: (container.singlePageMode && !Settings.reducedMotion) ? 200 : 0
|
||||||
currentIndex: container.singlePageMode ? container.pageIndex : 0
|
currentIndex: container.singlePageMode ? container.pageIndex : 0
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
|
|
@ -94,6 +94,7 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
expireEvents_ = settings.value("user/expired_events_background_maintenance", false).toBool();
|
expireEvents_ = settings.value("user/expired_events_background_maintenance", false).toBool();
|
||||||
|
|
||||||
mobileMode_ = settings.value("user/mobile_mode", false).toBool();
|
mobileMode_ = settings.value("user/mobile_mode", false).toBool();
|
||||||
|
disableSwipe_ = settings.value("user/disable_swipe", false).toBool();
|
||||||
emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString();
|
emojiFont_ = settings.value("user/emoji_font_family", "emoji").toString();
|
||||||
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
||||||
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
|
auto tempPresence = settings.value("user/presence", "").toString().toStdString();
|
||||||
|
@ -206,6 +207,16 @@ UserSettings::setMobileMode(bool state)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettings::setDisableSwipe(bool state)
|
||||||
|
{
|
||||||
|
if (state == disableSwipe_)
|
||||||
|
return;
|
||||||
|
disableSwipe_ = state;
|
||||||
|
emit disableSwipeChanged(state);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setGroupView(bool state)
|
UserSettings::setGroupView(bool state)
|
||||||
{
|
{
|
||||||
|
@ -884,6 +895,7 @@ UserSettings::save()
|
||||||
settings.setValue("privacy_screen", privacyScreen_);
|
settings.setValue("privacy_screen", privacyScreen_);
|
||||||
settings.setValue("privacy_screen_timeout", privacyScreenTimeout_);
|
settings.setValue("privacy_screen_timeout", privacyScreenTimeout_);
|
||||||
settings.setValue("mobile_mode", mobileMode_);
|
settings.setValue("mobile_mode", mobileMode_);
|
||||||
|
settings.setValue("disable_swipe", disableSwipe_);
|
||||||
settings.setValue("font_size", baseFontSize_);
|
settings.setValue("font_size", baseFontSize_);
|
||||||
settings.setValue("typing_notifications", typingNotifications_);
|
settings.setValue("typing_notifications", typingNotifications_);
|
||||||
settings.setValue("sort_by_unread", sortByImportance_);
|
settings.setValue("sort_by_unread", sortByImportance_);
|
||||||
|
@ -1056,6 +1068,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr("Privacy screen timeout (in seconds [0 - 3600])");
|
return tr("Privacy screen timeout (in seconds [0 - 3600])");
|
||||||
case MobileMode:
|
case MobileMode:
|
||||||
return tr("Touchscreen mode");
|
return tr("Touchscreen mode");
|
||||||
|
case DisableSwipe:
|
||||||
|
return tr("Disable swipe motions");
|
||||||
case FontSize:
|
case FontSize:
|
||||||
return tr("Font size");
|
return tr("Font size");
|
||||||
case Font:
|
case Font:
|
||||||
|
@ -1208,6 +1222,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return i->privacyScreenTimeout();
|
return i->privacyScreenTimeout();
|
||||||
case MobileMode:
|
case MobileMode:
|
||||||
return i->mobileMode();
|
return i->mobileMode();
|
||||||
|
case DisableSwipe:
|
||||||
|
return i->disableSwipe();
|
||||||
case FontSize:
|
case FontSize:
|
||||||
return i->fontSize();
|
return i->fontSize();
|
||||||
case Font: {
|
case Font: {
|
||||||
|
@ -1400,6 +1416,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
case MobileMode:
|
case MobileMode:
|
||||||
return tr(
|
return tr(
|
||||||
"Will prevent text selection in the timeline to make touch scrolling easier.");
|
"Will prevent text selection in the timeline to make touch scrolling easier.");
|
||||||
|
case DisableSwipe:
|
||||||
|
return tr(
|
||||||
|
"Will prevent swipe motions like swiping left/right between Rooms and Timeline, or swiping a message to reply.");
|
||||||
case ScaleFactor:
|
case ScaleFactor:
|
||||||
return tr("Change the scale factor of the whole user interface.");
|
return tr("Change the scale factor of the whole user interface.");
|
||||||
case UseStunServer:
|
case UseStunServer:
|
||||||
|
@ -1517,6 +1536,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
case DecryptNotifications:
|
case DecryptNotifications:
|
||||||
case PrivacyScreen:
|
case PrivacyScreen:
|
||||||
case MobileMode:
|
case MobileMode:
|
||||||
|
case DisableSwipe:
|
||||||
case UseStunServer:
|
case UseStunServer:
|
||||||
case OnlyShareKeysWithVerifiedUsers:
|
case OnlyShareKeysWithVerifiedUsers:
|
||||||
case ShareKeysWithTrustedUsers:
|
case ShareKeysWithTrustedUsers:
|
||||||
|
@ -1913,6 +1933,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
case DisableSwipe: {
|
||||||
|
if (value.userType() == QMetaType::Bool) {
|
||||||
|
i->setDisableSwipe(value.toBool());
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case FontSize: {
|
case FontSize: {
|
||||||
if (value.canConvert(QMetaType::fromType<double>())) {
|
if (value.canConvert(QMetaType::fromType<double>())) {
|
||||||
i->setFontSize(value.toDouble());
|
i->setFontSize(value.toDouble());
|
||||||
|
@ -2154,6 +2181,9 @@ UserSettingsModel::UserSettingsModel(QObject *p)
|
||||||
connect(s.get(), &UserSettings::mobileModeChanged, this, [this]() {
|
connect(s.get(), &UserSettings::mobileModeChanged, this, [this]() {
|
||||||
emit dataChanged(index(MobileMode), index(MobileMode), {Value});
|
emit dataChanged(index(MobileMode), index(MobileMode), {Value});
|
||||||
});
|
});
|
||||||
|
connect(s.get(), &UserSettings::disableSwipeChanged, this, [this]() {
|
||||||
|
emit dataChanged(index(DisableSwipe), index(DisableSwipe), {Value});
|
||||||
|
});
|
||||||
|
|
||||||
connect(s.get(), &UserSettings::fontChanged, this, [this]() {
|
connect(s.get(), &UserSettings::fontChanged, this, [this]() {
|
||||||
emit dataChanged(index(Font), index(Font), {Value});
|
emit dataChanged(index(Font), index(Font), {Value});
|
||||||
|
|
|
@ -70,6 +70,7 @@ class UserSettings final : public QObject
|
||||||
Q_PROPERTY(int communityListWidth READ communityListWidth WRITE setCommunityListWidth NOTIFY
|
Q_PROPERTY(int communityListWidth READ communityListWidth WRITE setCommunityListWidth NOTIFY
|
||||||
communityListWidthChanged)
|
communityListWidthChanged)
|
||||||
Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged)
|
Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged)
|
||||||
|
Q_PROPERTY(bool disableSwipe READ disableSwipe WRITE setDisableSwipe NOTIFY disableSwipeChanged)
|
||||||
Q_PROPERTY(double fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
Q_PROPERTY(double fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||||
Q_PROPERTY(QString font READ font WRITE setFontFamily NOTIFY fontChanged)
|
Q_PROPERTY(QString font READ font WRITE setFontFamily NOTIFY fontChanged)
|
||||||
Q_PROPERTY(QString emojiFont READ emojiFont WRITE setEmojiFontFamily NOTIFY emojiFontChanged)
|
Q_PROPERTY(QString emojiFont READ emojiFont WRITE setEmojiFontFamily NOTIFY emojiFontChanged)
|
||||||
|
@ -165,6 +166,7 @@ public:
|
||||||
void setTray(bool state);
|
void setTray(bool state);
|
||||||
void setStartInTray(bool state);
|
void setStartInTray(bool state);
|
||||||
void setMobileMode(bool mode);
|
void setMobileMode(bool mode);
|
||||||
|
void setDisableSwipe(bool mode);
|
||||||
void setFontSize(double size);
|
void setFontSize(double size);
|
||||||
void setFontFamily(QString family);
|
void setFontFamily(QString family);
|
||||||
void setEmojiFontFamily(QString family);
|
void setEmojiFontFamily(QString family);
|
||||||
|
@ -252,6 +254,7 @@ public:
|
||||||
bool sortByAlphabet() const { return sortByAlphabet_; }
|
bool sortByAlphabet() const { return sortByAlphabet_; }
|
||||||
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
||||||
bool mobileMode() const { return mobileMode_; }
|
bool mobileMode() const { return mobileMode_; }
|
||||||
|
bool disableSwipe() const { return disableSwipe_; }
|
||||||
bool readReceipts() const { return readReceipts_; }
|
bool readReceipts() const { return readReceipts_; }
|
||||||
bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
|
bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
|
||||||
bool hasAlertOnNotification() const { return hasAlertOnNotification_; }
|
bool hasAlertOnNotification() const { return hasAlertOnNotification_; }
|
||||||
|
@ -335,6 +338,7 @@ signals:
|
||||||
void roomListWidthChanged(int state);
|
void roomListWidthChanged(int state);
|
||||||
void communityListWidthChanged(int state);
|
void communityListWidthChanged(int state);
|
||||||
void mobileModeChanged(bool mode);
|
void mobileModeChanged(bool mode);
|
||||||
|
void disableSwipeChanged(bool state);
|
||||||
void fontSizeChanged(double state);
|
void fontSizeChanged(double state);
|
||||||
void fontChanged(QString state);
|
void fontChanged(QString state);
|
||||||
void emojiFontChanged(QString state);
|
void emojiFontChanged(QString state);
|
||||||
|
@ -406,6 +410,7 @@ private:
|
||||||
bool onlyShareKeysWithVerifiedUsers_;
|
bool onlyShareKeysWithVerifiedUsers_;
|
||||||
bool useOnlineKeyBackup_;
|
bool useOnlineKeyBackup_;
|
||||||
bool mobileMode_;
|
bool mobileMode_;
|
||||||
|
bool disableSwipe_;
|
||||||
int timelineMaxWidth_;
|
int timelineMaxWidth_;
|
||||||
int roomListWidth_;
|
int roomListWidth_;
|
||||||
int communityListWidth_;
|
int communityListWidth_;
|
||||||
|
@ -459,6 +464,7 @@ class UserSettingsModel : public QAbstractListModel
|
||||||
GeneralSection,
|
GeneralSection,
|
||||||
Theme,
|
Theme,
|
||||||
MobileMode,
|
MobileMode,
|
||||||
|
DisableSwipe,
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
ScaleFactor,
|
ScaleFactor,
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue