mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-11-04 08:10:18 +08:00
Compare commits
8 Commits
nightly/20
...
nightly/20
| Author | SHA1 | Date | |
|---|---|---|---|
| b77012baae | |||
| bc34abc8f4 | |||
| 69b59ad2dd | |||
| 1f2401bc7e | |||
| 06b0f1d39c | |||
| d5b36e7a6d | |||
| 4e2ae6cde0 | |||
| 0895a9f183 |
2
daemon
2
daemon
Submodule daemon updated: 459e58a6d2...80be6f46b4
@ -723,6 +723,7 @@ Item {
|
||||
property string showMore: qsTr("Show more")
|
||||
property string showLess: qsTr("Show less")
|
||||
|
||||
property string showPreview: qsTr("Show preview")
|
||||
property string bold: qsTr("Bold")
|
||||
property string italic: qsTr("Italic")
|
||||
property string strikethrough: qsTr("Strikethrough")
|
||||
|
||||
@ -79,6 +79,8 @@ Rectangle {
|
||||
var editedMessageBody = MessagesAdapter.dataForInteraction(MessagesAdapter.editId, MessageList.Body);
|
||||
messageBar.textAreaObj.insertText(editedMessageBody);
|
||||
messageBar.textAreaObj.forceActiveFocus();
|
||||
} else {
|
||||
messageBar.textAreaObj.clearText();
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +117,6 @@ Rectangle {
|
||||
|
||||
EditContainer {
|
||||
id: editContainer
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.preferredWidth: footerColumnLayout.width
|
||||
Layout.maximumWidth: JamiTheme.chatViewMaximumWidth
|
||||
|
||||
@ -190,8 +190,12 @@ RowLayout {
|
||||
onSendMessagesRequired: {
|
||||
sendMessageButtonClicked();
|
||||
}
|
||||
onTextChanged: MessagesAdapter.userIsComposing(text ? true : false)
|
||||
|
||||
onTextChanged: {
|
||||
MessagesAdapter.userIsComposing(text ? true : false);
|
||||
if (!text) {
|
||||
messageBarTextArea.heightBinding();
|
||||
}
|
||||
}
|
||||
property var markdownShortCut: {
|
||||
"Bold": function () {
|
||||
if (!showPreview) {
|
||||
@ -1161,6 +1165,7 @@ RowLayout {
|
||||
imageColor: (hovered || showPreview) ? JamiTheme.chatViewFooterImgHoverColor : JamiTheme.chatViewFooterImgColor
|
||||
hoveredColor: JamiTheme.hoveredButtonColor
|
||||
pressedColor: hoveredColor
|
||||
toolTipText: JamiStrings.showPreview
|
||||
|
||||
onClicked: {
|
||||
showPreview = !showPreview;
|
||||
|
||||
@ -48,7 +48,7 @@ JamiFlickable {
|
||||
signal sendMessagesRequired
|
||||
|
||||
function heightBinding() {
|
||||
textArea.height = Qt.binding(() => textArea.paintedHeight);
|
||||
textArea.height = Qt.binding(() => textArea.lineCount === 1 ? 35 : textArea.paintedHeight);
|
||||
}
|
||||
|
||||
function selectText(start, end) {
|
||||
@ -60,7 +60,11 @@ JamiFlickable {
|
||||
}
|
||||
|
||||
function clearText() {
|
||||
var multiLine = textArea.lineCount !== 1;
|
||||
textArea.clear();
|
||||
if (multiLine) {
|
||||
heightBinding();
|
||||
}
|
||||
}
|
||||
|
||||
function pasteText() {
|
||||
|
||||
@ -59,7 +59,28 @@ void
|
||||
NetworkManager::sendGetRequest(const QUrl& url,
|
||||
std::function<void(const QByteArray&)>&& onDoneCallback)
|
||||
{
|
||||
auto* const reply = manager_->get(QNetworkRequest(url));
|
||||
QNetworkRequest request = QNetworkRequest(url);
|
||||
sendGetRequest(request, std::move(onDoneCallback));
|
||||
}
|
||||
|
||||
void
|
||||
NetworkManager::sendGetRequest(const QUrl& url,
|
||||
const QMap<QString, QByteArray>& header,
|
||||
std::function<void(const QByteArray&)>&& onDoneCallback)
|
||||
{
|
||||
QNetworkRequest request = QNetworkRequest(url);
|
||||
for (auto it = header.begin(); it != header.end(); ++it) {
|
||||
request.setRawHeader(QByteArray(it.key().toStdString().c_str(), it.key().size()),
|
||||
it.value());
|
||||
}
|
||||
sendGetRequest(request, std::move(onDoneCallback));
|
||||
}
|
||||
|
||||
void
|
||||
NetworkManager::sendGetRequest(const QNetworkRequest& request,
|
||||
std::function<void(const QByteArray&)>&& onDoneCallback)
|
||||
{
|
||||
auto* const reply = manager_->get(request);
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [reply, onDoneCallback, this]() {
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
onDoneCallback(reply->readAll());
|
||||
|
||||
@ -39,7 +39,11 @@ public:
|
||||
Q_ENUM(GetError)
|
||||
|
||||
void sendGetRequest(const QUrl& url, std::function<void(const QByteArray&)>&& onDoneCallback);
|
||||
|
||||
void sendGetRequest(const QUrl& url,
|
||||
const QMap<QString, QByteArray>& header,
|
||||
std::function<void(const QByteArray&)>&& onDoneCallback);
|
||||
void sendGetRequest(const QNetworkRequest& request,
|
||||
std::function<void(const QByteArray&)>&& onDoneCallback);
|
||||
int downloadFile(const QUrl& url,
|
||||
int replyId,
|
||||
std::function<void(bool, const QString&)>&& onDoneCallback,
|
||||
|
||||
@ -23,21 +23,27 @@
|
||||
#include "pluginstorelistmodel.h"
|
||||
#include "networkmanager.h"
|
||||
#include "lrcinstance.h"
|
||||
#include "appsettingsmanager.h"
|
||||
#include "utilsadapter.h"
|
||||
#include "qmlregister.h"
|
||||
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QtNetwork>
|
||||
#include <QJsonObject>
|
||||
#include <QDir>
|
||||
#include <QString>
|
||||
|
||||
PluginAdapter::PluginAdapter(LRCInstance* instance, QObject* parent, QString baseUrl)
|
||||
PluginAdapter::PluginAdapter(LRCInstance* instance,
|
||||
AppSettingsManager* settingsManager,
|
||||
QObject* parent,
|
||||
QString baseUrl)
|
||||
: QmlAdapterBase(instance, parent)
|
||||
, pluginStoreListModel_(new PluginStoreListModel(instance, this))
|
||||
, pluginVersionManager_(new PluginVersionManager(instance, baseUrl, this))
|
||||
, pluginListModel_(new PluginListModel(instance, this))
|
||||
, lrcInstance_(instance)
|
||||
, settingsManager_(settingsManager)
|
||||
, tempPath_(QDir::tempPath())
|
||||
, baseUrl_(baseUrl)
|
||||
|
||||
@ -89,9 +95,13 @@ PluginAdapter::getPluginsFromStore()
|
||||
[this](NetworkManager::GetError error, const QString& msg) {
|
||||
Q_EMIT storeNotAvailable();
|
||||
});
|
||||
QMap<QString, QByteArray> header;
|
||||
const auto& language = settingsManager_->getLanguage();
|
||||
header["Accept-Language"] = QByteArray(language.toStdString().c_str(), language.size());
|
||||
pluginVersionManager_
|
||||
->sendGetRequest(QUrl(baseUrl_
|
||||
+ "?arch=" + lrcInstance_->pluginModel().getPlatformInfo()["os"]),
|
||||
header,
|
||||
[this, errorHandler](const QByteArray& data) {
|
||||
auto result = QJsonDocument::fromJson(data).array();
|
||||
auto pluginsInstalled = lrcInstance_->pluginModel().getPluginsId();
|
||||
@ -113,9 +123,13 @@ PluginAdapter::getPluginsFromStore()
|
||||
void
|
||||
PluginAdapter::getPluginDetails(const QString& pluginId)
|
||||
{
|
||||
QMap<QString, QByteArray> header;
|
||||
const auto& language = settingsManager_->getLanguage();
|
||||
header["Accept-Language"] = QByteArray(language.toStdString().c_str(), language.size());
|
||||
pluginVersionManager_
|
||||
->sendGetRequest(QUrl(baseUrl_ + "/details/" + pluginId
|
||||
+ "?arch=" + lrcInstance_->pluginModel().getPlatformInfo()["os"]),
|
||||
header,
|
||||
[this](const QByteArray& data) {
|
||||
auto result = QJsonDocument::fromJson(data).object();
|
||||
// my response is a json object and I want to convert
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
class PluginVersionManager;
|
||||
class PluginStoreListModel;
|
||||
class AppSettingsManager;
|
||||
|
||||
class PluginAdapter final : public QmlAdapterBase
|
||||
{
|
||||
@ -41,6 +42,7 @@ class PluginAdapter final : public QmlAdapterBase
|
||||
|
||||
public:
|
||||
explicit PluginAdapter(LRCInstance* instance,
|
||||
AppSettingsManager* settingsManager,
|
||||
QObject* parent = nullptr,
|
||||
QString baseUrl = "https://plugins.jami.net");
|
||||
~PluginAdapter() = default;
|
||||
@ -79,4 +81,5 @@ private:
|
||||
std::mutex mtx_;
|
||||
QString tempPath_;
|
||||
QString baseUrl_;
|
||||
AppSettingsManager* settingsManager_;
|
||||
};
|
||||
|
||||
@ -123,7 +123,7 @@ registerTypes(QQmlEngine* engine,
|
||||
auto contactAdapter = new ContactAdapter(lrcInstance, parent);
|
||||
auto accountAdapter = new AccountAdapter(settingsManager, systemTray, lrcInstance, parent);
|
||||
auto utilsAdapter = new UtilsAdapter(settingsManager, systemTray, lrcInstance, parent);
|
||||
auto pluginAdapter = new PluginAdapter(lrcInstance, parent);
|
||||
auto pluginAdapter = new PluginAdapter(lrcInstance, settingsManager, parent);
|
||||
auto currentCall = new CurrentCall(lrcInstance, parent);
|
||||
auto currentConversation = new CurrentConversation(lrcInstance, parent);
|
||||
auto currentAccount = new CurrentAccount(lrcInstance, settingsManager, parent);
|
||||
|
||||
@ -35,8 +35,8 @@ ItemDelegate {
|
||||
property string pluginAuthor
|
||||
property string pluginShortDescription
|
||||
property int pluginStatus
|
||||
property string backgroundLocalPath: UtilsAdapter.getCachePath() + '/backgrounds/' + pluginName + '.jpg'
|
||||
property string iconLocalPath: UtilsAdapter.getCachePath() + '/icons/' + pluginName + '.svg'
|
||||
property string backgroundLocalPath: UtilsAdapter.getCachePath() + '/backgrounds/' + pluginId + '.jpg'
|
||||
property string iconLocalPath: UtilsAdapter.getCachePath() + '/icons/' + pluginId + '.svg'
|
||||
readonly property real scalingFactor: 1 + hovered * 0.02
|
||||
property string installButtonStatus: {
|
||||
switch (pluginStatus) {
|
||||
@ -172,7 +172,7 @@ ItemDelegate {
|
||||
defaultImage: JamiResources.plugins_default_icon_svg
|
||||
width: 65
|
||||
height: 65
|
||||
downloadUrl: PluginAdapter.getIconUrl(pluginName)
|
||||
downloadUrl: PluginAdapter.getIconUrl(pluginId)
|
||||
localPath: root.iconLocalPath
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user