mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
add option to open image with external program by default
This commit is contained in:
parent
a35f5e81cd
commit
74a4e36f90
5 changed files with 44 additions and 1 deletions
|
@ -2908,6 +2908,11 @@ Reason: %4</translation>
|
||||||
<source>Use identicons</source>
|
<source>Use identicons</source>
|
||||||
<translation>Use identicons</translation>
|
<translation>Use identicons</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+2"/>
|
||||||
|
<source>Open images with external program</source>
|
||||||
|
<translation>Open images with external program</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+2"/>
|
<location line="+2"/>
|
||||||
<source>Decrypt messages in sidebar</source>
|
<source>Decrypt messages in sidebar</source>
|
||||||
|
|
|
@ -68,7 +68,7 @@ Item {
|
||||||
TapHandler {
|
TapHandler {
|
||||||
//enabled: type == MtxEvent.ImageMessage && (img.status == Image.Ready || mxcimage.loaded)
|
//enabled: type == MtxEvent.ImageMessage && (img.status == Image.Ready || mxcimage.loaded)
|
||||||
onSingleTapped: {
|
onSingleTapped: {
|
||||||
TimelineManager.openImageOverlay(room, url, eventId);
|
Settings.openImageExternal ? room.openMedia(eventId) : TimelineManager.openImageOverlay(room, url, eventId);
|
||||||
eventPoint.accepted = true;
|
eventPoint.accepted = true;
|
||||||
}
|
}
|
||||||
gesturePolicy: TapHandler.ReleaseWithinBounds
|
gesturePolicy: TapHandler.ReleaseWithinBounds
|
||||||
|
|
|
@ -84,6 +84,7 @@ UserSettings::load(std::optional<QString> profile)
|
||||||
|
|
||||||
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool();
|
avatarCircles_ = settings.value(QStringLiteral("user/avatar_circles"), true).toBool();
|
||||||
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool();
|
useIdenticon_ = settings.value(QStringLiteral("user/use_identicon"), true).toBool();
|
||||||
|
openImageExternal_ = settings.value(QStringLiteral("user/open_image_external"), false).toBool();
|
||||||
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool();
|
decryptSidebar_ = settings.value(QStringLiteral("user/decrypt_sidebar"), true).toBool();
|
||||||
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool();
|
privacyScreen_ = settings.value(QStringLiteral("user/privacy_screen"), false).toBool();
|
||||||
privacyScreenTimeout_ =
|
privacyScreenTimeout_ =
|
||||||
|
@ -687,6 +688,16 @@ UserSettings::setUseIdenticon(bool state)
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UserSettings::setOpenImageExternal(bool state)
|
||||||
|
{
|
||||||
|
if (state == openImageExternal_)
|
||||||
|
return;
|
||||||
|
openImageExternal_ = state;
|
||||||
|
emit openImageExternalChanged(openImageExternal_);
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UserSettings::applyTheme()
|
UserSettings::applyTheme()
|
||||||
{
|
{
|
||||||
|
@ -764,6 +775,7 @@ UserSettings::save()
|
||||||
settings.setValue(QStringLiteral("use_stun_server"), useStunServer_);
|
settings.setValue(QStringLiteral("use_stun_server"), useStunServer_);
|
||||||
settings.setValue(QStringLiteral("currentProfile"), profile_);
|
settings.setValue(QStringLiteral("currentProfile"), profile_);
|
||||||
settings.setValue(QStringLiteral("use_identicon"), useIdenticon_);
|
settings.setValue(QStringLiteral("use_identicon"), useIdenticon_);
|
||||||
|
settings.setValue(QStringLiteral("open_image_external"), openImageExternal_);
|
||||||
|
|
||||||
settings.endGroup(); // user
|
settings.endGroup(); // user
|
||||||
|
|
||||||
|
@ -868,6 +880,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return tr("Circular Avatars");
|
return tr("Circular Avatars");
|
||||||
case UseIdenticon:
|
case UseIdenticon:
|
||||||
return tr("Use identicons");
|
return tr("Use identicons");
|
||||||
|
case OpenImageExternal:
|
||||||
|
return tr("Open images with external program");
|
||||||
case DecryptSidebar:
|
case DecryptSidebar:
|
||||||
return tr("Decrypt messages in sidebar");
|
return tr("Decrypt messages in sidebar");
|
||||||
case PrivacyScreen:
|
case PrivacyScreen:
|
||||||
|
@ -992,6 +1006,8 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
return i->avatarCircles();
|
return i->avatarCircles();
|
||||||
case UseIdenticon:
|
case UseIdenticon:
|
||||||
return i->useIdenticon();
|
return i->useIdenticon();
|
||||||
|
case OpenImageExternal:
|
||||||
|
return i->openImageExternal();
|
||||||
case DecryptSidebar:
|
case DecryptSidebar:
|
||||||
return i->decryptSidebar();
|
return i->decryptSidebar();
|
||||||
case PrivacyScreen:
|
case PrivacyScreen:
|
||||||
|
@ -1134,6 +1150,9 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
"Change the appearance of user avatars in chats.\nOFF - square, ON - circle.");
|
"Change the appearance of user avatars in chats.\nOFF - square, ON - circle.");
|
||||||
case UseIdenticon:
|
case UseIdenticon:
|
||||||
return tr("Display an identicon instead of a letter when no avatar is set.");
|
return tr("Display an identicon instead of a letter when no avatar is set.");
|
||||||
|
case OpenImageExternal:
|
||||||
|
return tr("Click to open image with external program. \nSame as Right-Click>Open "
|
||||||
|
"in External Program");
|
||||||
case DecryptSidebar:
|
case DecryptSidebar:
|
||||||
return tr("Decrypt the messages shown in the sidebar.\nOnly affects messages in "
|
return tr("Decrypt the messages shown in the sidebar.\nOnly affects messages in "
|
||||||
"encrypted chats.");
|
"encrypted chats.");
|
||||||
|
@ -1230,6 +1249,7 @@ UserSettingsModel::data(const QModelIndex &index, int role) const
|
||||||
case AlertOnNotification:
|
case AlertOnNotification:
|
||||||
case AvatarCircles:
|
case AvatarCircles:
|
||||||
case UseIdenticon:
|
case UseIdenticon:
|
||||||
|
case OpenImageExternal:
|
||||||
case DecryptSidebar:
|
case DecryptSidebar:
|
||||||
case PrivacyScreen:
|
case PrivacyScreen:
|
||||||
case MobileMode:
|
case MobileMode:
|
||||||
|
@ -1522,6 +1542,13 @@ UserSettingsModel::setData(const QModelIndex &index, const QVariant &value, int
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
case OpenImageExternal: {
|
||||||
|
if (value.userType() == QMetaType::Bool) {
|
||||||
|
i->setOpenImageExternal(value.toBool());
|
||||||
|
return true;
|
||||||
|
} else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case DecryptSidebar: {
|
case DecryptSidebar: {
|
||||||
if (value.userType() == QMetaType::Bool) {
|
if (value.userType() == QMetaType::Bool) {
|
||||||
i->setDecryptSidebar(value.toBool());
|
i->setDecryptSidebar(value.toBool());
|
||||||
|
@ -1782,6 +1809,9 @@ UserSettingsModel::UserSettingsModel(QObject *p)
|
||||||
connect(s.get(), &UserSettings::useIdenticonChanged, this, [this]() {
|
connect(s.get(), &UserSettings::useIdenticonChanged, this, [this]() {
|
||||||
emit dataChanged(index(UseIdenticon), index(UseIdenticon), {Value});
|
emit dataChanged(index(UseIdenticon), index(UseIdenticon), {Value});
|
||||||
});
|
});
|
||||||
|
connect(s.get(), &UserSettings::openImageExternalChanged, this, [this]() {
|
||||||
|
emit dataChanged(index(OpenImageExternal), index(OpenImageExternal), {Value});
|
||||||
|
});
|
||||||
connect(s.get(), &UserSettings::privacyScreenChanged, this, [this]() {
|
connect(s.get(), &UserSettings::privacyScreenChanged, this, [this]() {
|
||||||
emit dataChanged(index(PrivacyScreen), index(PrivacyScreen), {Value});
|
emit dataChanged(index(PrivacyScreen), index(PrivacyScreen), {Value});
|
||||||
emit dataChanged(index(PrivacyScreenTimeout), index(PrivacyScreenTimeout), {Enabled});
|
emit dataChanged(index(PrivacyScreenTimeout), index(PrivacyScreenTimeout), {Enabled});
|
||||||
|
|
|
@ -105,6 +105,7 @@ class UserSettings : public QObject
|
||||||
Q_PROPERTY(bool disableCertificateValidation READ disableCertificateValidation WRITE
|
Q_PROPERTY(bool disableCertificateValidation READ disableCertificateValidation WRITE
|
||||||
setDisableCertificateValidation NOTIFY disableCertificateValidationChanged)
|
setDisableCertificateValidation NOTIFY disableCertificateValidationChanged)
|
||||||
Q_PROPERTY(bool useIdenticon READ useIdenticon WRITE setUseIdenticon NOTIFY useIdenticonChanged)
|
Q_PROPERTY(bool useIdenticon READ useIdenticon WRITE setUseIdenticon NOTIFY useIdenticonChanged)
|
||||||
|
Q_PROPERTY(bool openImageExternal READ openImageExternal WRITE setOpenImageExternal NOTIFY openImageExternalChanged)
|
||||||
|
|
||||||
Q_PROPERTY(QStringList hiddenPins READ hiddenPins WRITE setHiddenPins NOTIFY hiddenPinsChanged)
|
Q_PROPERTY(QStringList hiddenPins READ hiddenPins WRITE setHiddenPins NOTIFY hiddenPinsChanged)
|
||||||
Q_PROPERTY(QStringList recentReactions READ recentReactions WRITE setRecentReactions NOTIFY
|
Q_PROPERTY(QStringList recentReactions READ recentReactions WRITE setRecentReactions NOTIFY
|
||||||
|
@ -184,6 +185,7 @@ public:
|
||||||
void setHiddenWidgets(QStringList hiddenTags);
|
void setHiddenWidgets(QStringList hiddenTags);
|
||||||
void setRecentReactions(QStringList recent);
|
void setRecentReactions(QStringList recent);
|
||||||
void setUseIdenticon(bool state);
|
void setUseIdenticon(bool state);
|
||||||
|
void setOpenImageExternal(bool state);
|
||||||
void setCollapsedSpaces(QList<QStringList> spaces);
|
void setCollapsedSpaces(QList<QStringList> spaces);
|
||||||
|
|
||||||
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
QString theme() const { return !theme_.isEmpty() ? theme_ : defaultTheme_; }
|
||||||
|
@ -246,6 +248,7 @@ public:
|
||||||
QStringList hiddenWidgets() const { return hiddenWidgets_; }
|
QStringList hiddenWidgets() const { return hiddenWidgets_; }
|
||||||
QStringList recentReactions() const { return recentReactions_; }
|
QStringList recentReactions() const { return recentReactions_; }
|
||||||
bool useIdenticon() const { return useIdenticon_ && JdenticonProvider::isAvailable(); }
|
bool useIdenticon() const { return useIdenticon_ && JdenticonProvider::isAvailable(); }
|
||||||
|
bool openImageExternal() const { return openImageExternal_; }
|
||||||
QList<QStringList> collapsedSpaces() const { return collapsedSpaces_; }
|
QList<QStringList> collapsedSpaces() const { return collapsedSpaces_; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -297,6 +300,7 @@ signals:
|
||||||
void homeserverChanged(QString homeserver);
|
void homeserverChanged(QString homeserver);
|
||||||
void disableCertificateValidationChanged(bool disabled);
|
void disableCertificateValidationChanged(bool disabled);
|
||||||
void useIdenticonChanged(bool state);
|
void useIdenticonChanged(bool state);
|
||||||
|
void openImageExternalChanged(bool state);
|
||||||
void hiddenPinsChanged();
|
void hiddenPinsChanged();
|
||||||
void hiddenWidgetsChanged();
|
void hiddenWidgetsChanged();
|
||||||
void recentReactionsChanged();
|
void recentReactionsChanged();
|
||||||
|
@ -361,6 +365,7 @@ private:
|
||||||
QStringList recentReactions_;
|
QStringList recentReactions_;
|
||||||
QList<QStringList> collapsedSpaces_;
|
QList<QStringList> collapsedSpaces_;
|
||||||
bool useIdenticon_;
|
bool useIdenticon_;
|
||||||
|
bool openImageExternal_;
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
|
@ -384,6 +389,7 @@ class UserSettingsModel : public QAbstractListModel
|
||||||
EmojiFont,
|
EmojiFont,
|
||||||
AvatarCircles,
|
AvatarCircles,
|
||||||
UseIdenticon,
|
UseIdenticon,
|
||||||
|
OpenImageExternal,
|
||||||
PrivacyScreen,
|
PrivacyScreen,
|
||||||
PrivacyScreenTimeout,
|
PrivacyScreenTimeout,
|
||||||
|
|
||||||
|
@ -491,3 +497,4 @@ public:
|
||||||
Q_INVOKABLE void requestCrossSigningSecrets();
|
Q_INVOKABLE void requestCrossSigningSecrets();
|
||||||
Q_INVOKABLE void downloadCrossSigningSecrets();
|
Q_INVOKABLE void downloadCrossSigningSecrets();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -133,3 +133,4 @@ Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationMac)
|
||||||
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationReady)
|
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationReady)
|
||||||
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationRequest)
|
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationRequest)
|
||||||
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationStart)
|
Q_DECLARE_METATYPE(mtx::events::msg::KeyVerificationStart)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue