mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +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
|
textFormat: TextEdit.RichText
|
||||||
readOnly: true
|
readOnly: true
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
selectByMouse: true
|
selectByMouse: !Settings.mobileMode
|
||||||
color: colors.text
|
color: colors.text
|
||||||
onLinkActivated: {
|
onLinkActivated: {
|
||||||
if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) {
|
if (/^https:\/\/matrix.to\/#\/(@.*)$/.test(link)) {
|
||||||
|
|
|
@ -75,6 +75,7 @@ UserSettings::load()
|
||||||
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
|
decryptSidebar_ = settings.value("user/decrypt_sidebar", true).toBool();
|
||||||
shareKeysWithTrustedUsers_ =
|
shareKeysWithTrustedUsers_ =
|
||||||
settings.value("user/share_keys_with_trusted_users", true).toBool();
|
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();
|
emojiFont_ = settings.value("user/emoji_font_family", "default").toString();
|
||||||
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
baseFontSize_ = settings.value("user/font_size", QFont().pointSizeF()).toDouble();
|
||||||
presence_ =
|
presence_ =
|
||||||
|
@ -123,6 +124,16 @@ UserSettings::setStartInTray(bool state)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettings::setMobileMode(bool state)
|
||||||
|
{
|
||||||
|
if (state == mobileMode_)
|
||||||
|
return;
|
||||||
|
mobileMode_ = state;
|
||||||
|
emit mobileModeChanged(state);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::setGroupView(bool state)
|
UserSettings::setGroupView(bool state)
|
||||||
{
|
{
|
||||||
|
@ -389,6 +400,7 @@ UserSettings::save()
|
||||||
settings.setValue("avatar_circles", avatarCircles_);
|
settings.setValue("avatar_circles", avatarCircles_);
|
||||||
settings.setValue("decrypt_sidebar", decryptSidebar_);
|
settings.setValue("decrypt_sidebar", decryptSidebar_);
|
||||||
settings.setValue("share_keys_with_trusted_users", shareKeysWithTrustedUsers_);
|
settings.setValue("share_keys_with_trusted_users", shareKeysWithTrustedUsers_);
|
||||||
|
settings.setValue("mobile_mode", mobileMode_);
|
||||||
settings.setValue("font_size", baseFontSize_);
|
settings.setValue("font_size", baseFontSize_);
|
||||||
settings.setValue("typing_notifications", typingNotifications_);
|
settings.setValue("typing_notifications", typingNotifications_);
|
||||||
settings.setValue("minor_events", sortByImportance_);
|
settings.setValue("minor_events", sortByImportance_);
|
||||||
|
@ -470,6 +482,7 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
desktopNotifications_ = new Toggle{this};
|
desktopNotifications_ = new Toggle{this};
|
||||||
alertOnNotification_ = new Toggle{this};
|
alertOnNotification_ = new Toggle{this};
|
||||||
useStunServer_ = new Toggle{this};
|
useStunServer_ = new Toggle{this};
|
||||||
|
mobileMode_ = new Toggle{this};
|
||||||
scaleFactorCombo_ = new QComboBox{this};
|
scaleFactorCombo_ = new QComboBox{this};
|
||||||
fontSizeCombo_ = new QComboBox{this};
|
fontSizeCombo_ = new QComboBox{this};
|
||||||
fontSelectionCombo_ = new QFontComboBox{this};
|
fontSelectionCombo_ = new QFontComboBox{this};
|
||||||
|
@ -637,6 +650,9 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
formLayout_->addRow(uiLabel_);
|
formLayout_->addRow(uiLabel_);
|
||||||
formLayout_->addRow(new HorizontalLine{this});
|
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)
|
#if !defined(Q_OS_MAC)
|
||||||
boxWrap(tr("Scale factor"),
|
boxWrap(tr("Scale factor"),
|
||||||
scaleFactorCombo_,
|
scaleFactorCombo_,
|
||||||
|
@ -728,6 +744,10 @@ UserSettingsPage::UserSettingsPage(QSharedPointer<UserSettings> settings, QWidge
|
||||||
settings_->setStartInTray(!disabled);
|
settings_->setStartInTray(!disabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(mobileMode_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
|
settings_->setMobileMode(!disabled);
|
||||||
|
});
|
||||||
|
|
||||||
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
connect(groupViewToggle_, &Toggle::toggled, this, [this](bool disabled) {
|
||||||
settings_->setGroupView(!disabled);
|
settings_->setGroupView(!disabled);
|
||||||
});
|
});
|
||||||
|
@ -820,6 +840,7 @@ UserSettingsPage::showEvent(QShowEvent *)
|
||||||
typingNotifications_->setState(!settings_->typingNotifications());
|
typingNotifications_->setState(!settings_->typingNotifications());
|
||||||
sortByImportance_->setState(!settings_->sortByImportance());
|
sortByImportance_->setState(!settings_->sortByImportance());
|
||||||
timelineButtonsToggle_->setState(!settings_->buttonsInTimeline());
|
timelineButtonsToggle_->setState(!settings_->buttonsInTimeline());
|
||||||
|
mobileMode_->setState(!settings_->mobileMode());
|
||||||
readReceipts_->setState(!settings_->readReceipts());
|
readReceipts_->setState(!settings_->readReceipts());
|
||||||
markdown_->setState(!settings_->markdown());
|
markdown_->setState(!settings_->markdown());
|
||||||
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
desktopNotifications_->setState(!settings_->hasDesktopNotifications());
|
||||||
|
|
|
@ -67,6 +67,7 @@ class UserSettings : public QObject
|
||||||
decryptSidebarChanged)
|
decryptSidebarChanged)
|
||||||
Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY
|
Q_PROPERTY(int timelineMaxWidth READ timelineMaxWidth WRITE setTimelineMaxWidth NOTIFY
|
||||||
timelineMaxWidthChanged)
|
timelineMaxWidthChanged)
|
||||||
|
Q_PROPERTY(bool mobileMode READ mobileMode WRITE setMobileMode NOTIFY mobileModeChanged)
|
||||||
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(
|
Q_PROPERTY(
|
||||||
|
@ -99,6 +100,7 @@ public:
|
||||||
void setEnlargeEmojiOnlyMessages(bool state);
|
void setEnlargeEmojiOnlyMessages(bool state);
|
||||||
void setTray(bool state);
|
void setTray(bool state);
|
||||||
void setStartInTray(bool state);
|
void setStartInTray(bool state);
|
||||||
|
void setMobileMode(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);
|
||||||
|
@ -130,6 +132,7 @@ public:
|
||||||
bool typingNotifications() const { return typingNotifications_; }
|
bool typingNotifications() const { return typingNotifications_; }
|
||||||
bool sortByImportance() const { return sortByImportance_; }
|
bool sortByImportance() const { return sortByImportance_; }
|
||||||
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
bool buttonsInTimeline() const { return buttonsInTimeline_; }
|
||||||
|
bool mobileMode() const { return mobileMode_; }
|
||||||
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_; }
|
||||||
|
@ -163,6 +166,7 @@ signals:
|
||||||
void avatarCirclesChanged(bool state);
|
void avatarCirclesChanged(bool state);
|
||||||
void decryptSidebarChanged(bool state);
|
void decryptSidebarChanged(bool state);
|
||||||
void timelineMaxWidthChanged(int state);
|
void timelineMaxWidthChanged(int state);
|
||||||
|
void mobileModeChanged(bool mode);
|
||||||
void fontSizeChanged(double state);
|
void fontSizeChanged(double state);
|
||||||
void fontChanged(QString state);
|
void fontChanged(QString state);
|
||||||
void emojiFontChanged(QString state);
|
void emojiFontChanged(QString state);
|
||||||
|
@ -193,6 +197,7 @@ private:
|
||||||
bool avatarCircles_;
|
bool avatarCircles_;
|
||||||
bool decryptSidebar_;
|
bool decryptSidebar_;
|
||||||
bool shareKeysWithTrustedUsers_;
|
bool shareKeysWithTrustedUsers_;
|
||||||
|
bool mobileMode_;
|
||||||
int timelineMaxWidth_;
|
int timelineMaxWidth_;
|
||||||
double baseFontSize_;
|
double baseFontSize_;
|
||||||
QString font_;
|
QString font_;
|
||||||
|
@ -256,6 +261,7 @@ private:
|
||||||
Toggle *useStunServer_;
|
Toggle *useStunServer_;
|
||||||
Toggle *decryptSidebar_;
|
Toggle *decryptSidebar_;
|
||||||
Toggle *shareKeysWithTrustedUsers_;
|
Toggle *shareKeysWithTrustedUsers_;
|
||||||
|
Toggle *mobileMode_;
|
||||||
QLabel *deviceFingerprintValue_;
|
QLabel *deviceFingerprintValue_;
|
||||||
QLabel *deviceIdValue_;
|
QLabel *deviceIdValue_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue