mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
Add mobile mode which improves scrolling
This commit is contained in:
parent
53734607cf
commit
3172811ca7
3 changed files with 28 additions and 1 deletions
|
@ -6,7 +6,7 @@ TextEdit {
|
|||
textFormat: TextEdit.RichText
|
||||
readOnly: true
|
||||
wrapMode: Text.Wrap
|
||||
selectByMouse: true
|
||||
selectByMouse: !Settings.mobileMode
|
||||
color: colors.text
|
||||
onLinkActivated: {
|
||||
if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) {
|
||||
|
|
|
@ -75,6 +75,7 @@ UserSettings::load()
|
|||
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
|
||||
shareKeysWithTrustedUsers_ =
|
||||
settings.value("user/share_keys_with_trusted_users", true).toBool();
|
||||
mobileMode_ = settings.value("user/mobile_mode", false).toBool();
|
||||
emojiFont_ = settings.value("user/emoji_font_family", "default").toString();
|
||||
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
||||
presence_ =
|
||||
|
@ -123,6 +124,16 @@ UserSettings::setStartInTray(bool state)
|
|||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setMobileMode(bool state)
|
||||
{
|
||||
if (state == mobileMode_)
|
||||
return;
|
||||
mobileMode_ = state;
|
||||
emit mobileModeChanged(state);
|
||||
save();
|
||||
}
|
||||
|
||||
void
|
||||
UserSettings::setGroupView(bool state)
|
||||
{
|
||||
|
@ -389,6 +400,7 @@ UserSettings::save()
|
|||
settings.setValue("avatar_circles", avatarCircles_);
|
||||
settings.setValue("decrypt_sidebar", decryptSidebar_);
|
||||
settings.setValue("share_keys_with_trusted_users", shareKeysWithTrustedUsers_);
|
||||
settings.setValue("mobile_mode", mobileMode_);
|
||||
settings.setValue("font_size", baseFontSize_);
|
||||
settings.setValue("typing_notifications", typingNotifications_);
|
||||
settings.setValue("minor_events", sortByImportance_);
|
||||
|
@ -470,6 +482,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
|||
desktopNotifications_ = new Toggle{this};
|
||||
alertOnNotification_ = new Toggle{this};
|
||||
useStunServer_ = new Toggle{this};
|
||||
mobileMode_ = new Toggle{this};
|
||||
scaleFactorCombo_ = new QComboBox{this};
|
||||
fontSizeCombo_ = new QComboBox{this};
|
||||
fontSelectionCombo_ = new QFontComboBox{this};
|
||||
|
@ -637,6 +650,9 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
|||
formLayout_->addRow(uiLabel_);
|
||||
formLayout_->addRow(new HorizontalLine{this});
|
||||
|
||||
boxWrap(tr("Mobile mode"),
|
||||
mobileMode_,
|
||||
tr("Will prevent text selection in the timeline to make scrolling easier."));
|
||||
#if !defined(Q_OS_MAC)
|
||||
boxWrap(tr("Scale factor"),
|
||||
scaleFactorCombo_,
|
||||
|
@ -728,6 +744,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
|||
settings_->setStartInTray(!disabled);
|
||||
});
|
||||
|
||||
connect(mobileMode_, &Toggle::toggled, this, [this](bool disabled) {
|
||||
settings_->setMobileMode(!disabled);
|
||||
});
|
||||
|
||||
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||
settings_->setGroupView(!disabled);
|
||||
});
|
||||
|
@ -820,6 +840,7 @@ UserSettingsPage::showEvent(QShowEvent *)
|
|||
typingNotifications_->setState(!settings_->typingNotifications());
|
||||
sortByImportance_->setState(!settings_->sortByImportance());
|
||||
timelineButtonsToggle_->setState(!settings_->buttonsInTimeline());
|
||||
mobileMode_->setState(!settings_->mobileMode());
|
||||
readReceipts_->setState(!settings_->readReceipts());
|
||||
markdown_->setState(!settings_->markdown());
|
||||
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
||||
|
|
|
@ -67,6 +67,7 @@ class UserSettings : public QObject
|
|||
decryptSidebarChanged)
|
||||
Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY
|
||||
timelineMaxWidthChanged)
|
||||
Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged)
|
||||
Q_PROPERTY(double fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
|
||||
Q_PROPERTY(QString font READ font WRITE setFontFamily NOTIFY fontChanged)
|
||||
Q_PROPERTY(
|
||||
|
@ -99,6 +100,7 @@ public:
|
|||
void setEnlargeEmojiOnlyMessages(bool state);
|
||||
void setTray(bool state);
|
||||
void setStartInTray(bool state);
|
||||
void setMobileMode(bool mode);
|
||||
void setFontSize(double size);
|
||||
void setFontFamily(QString family);
|
||||
void setEmojiFontFamily(QString family);
|
||||
|
@ -130,6 +132,7 @@ public:
|
|||
bool typingNotifications() const { return typingNotifications_; }
|
||||
bool sortByImportance() const { return sortByImportance_; }
|
||||
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
||||
bool mobileMode() const { return mobileMode_; }
|
||||
bool readReceipts() const { return readReceipts_; }
|
||||
bool hasDesktopNotifications() const { return hasDesktopNotifications_; }
|
||||
bool hasAlertOnNotification() const { return hasAlertOnNotification_; }
|
||||
|
@ -163,6 +166,7 @@ signals:
|
|||
void avatarCirclesChanged(bool state);
|
||||
void decryptSidebarChanged(bool state);
|
||||
void timelineMaxWidthChanged(int state);
|
||||
void mobileModeChanged(bool mode);
|
||||
void fontSizeChanged(double state);
|
||||
void fontChanged(QString state);
|
||||
void emojiFontChanged(QString state);
|
||||
|
@ -193,6 +197,7 @@ private:
|
|||
bool avatarCircles_;
|
||||
bool decryptSidebar_;
|
||||
bool shareKeysWithTrustedUsers_;
|
||||
bool mobileMode_;
|
||||
int timelineMaxWidth_;
|
||||
double baseFontSize_;
|
||||
QString font_;
|
||||
|
@ -256,6 +261,7 @@ private:
|
|||
Toggle *useStunServer_;
|
||||
Toggle *decryptSidebar_;
|
||||
Toggle *shareKeysWithTrustedUsers_;
|
||||
Toggle *mobileMode_;
|
||||
QLabel *deviceFingerprintValue_;
|
||||
QLabel *deviceIdValue_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue