Commit 2771e2ee authored by Andreas Traczyk's avatar Andreas Traczyk

ui: settings, chatview, and smartlist touch-ups

Change-Id: I9ff6fa1f7c14b5549b869a0c357e9e4a708cca82
parent e83f7882
This diff is collapsed.
......@@ -111,8 +111,6 @@ CallWidget::CallWidget(QWidget* parent) :
ui->mainActivitySplitter->setCollapsible(0, false);
ui->mainActivitySplitter->setCollapsible(1, false);
ui->splitter->setCollapsible(0, false);
ui->splitter->setCollapsible(1, false);
//disable dropdown shadow on combobox
ui->currentAccountComboBox->view()->window()->setWindowFlags(Qt::Popup | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint);
......@@ -221,6 +219,8 @@ CallWidget::CallWidget(QWidget* parent) :
setCallPanelVisibility(false);
ui->containerWidget->setVisible(false);
ui->smartListWidget->setStyleSheet("border-right: 2px solid rgb(240, 240, 240);");
}
CallWidget::~CallWidget()
......@@ -850,6 +850,7 @@ CallWidget::showIMOutOfCall(const QModelIndex& nodeIdx)
auto convModel = LRCInstance::getCurrentConversationModel();
auto currentConversation = Utils::getConversationFromUid(LRCInstance::getSelectedConvUid(),
*convModel);
ui->messageView->clear();
ui->messageView->printHistory(*convModel, currentConversation->interactions, true);
......@@ -891,9 +892,7 @@ CallWidget::on_ringContactLineEdit_textChanged(const QString& text)
void
CallWidget::backToWelcomePage()
{
qDebug() << "backToWelcomePage";
deselectConversation();
ui->messageView->hideMessages();
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
}
......@@ -909,7 +908,17 @@ CallWidget::hideMiniSpinner()
void
CallWidget::on_imBackButton_clicked()
{
backToWelcomePage();
ui->messageView->clear();
QMetaObject::Connection* const connection = new QMetaObject::Connection;
*connection = connect(ui->messageView, &MessageWebView::messagesCleared,
[this, connection] {
qDebug() << "messagesCleared";
if (connection) {
QObject::disconnect(*connection);
delete connection;
}
backToWelcomePage();
});
}
void
......@@ -1225,8 +1234,8 @@ void
CallWidget::setCallPanelVisibility(bool visible)
{
ui->stackedWidget->setCurrentWidget(ui->mainActivityWidget);
ui->callStackWidget->setVisible(visible);
ui->imBackButton->setVisible(!visible);
ui->btnAudioCall->setVisible(!visible);
ui->btnVideoCall->setVisible(!visible);
ui->callStackWidget->setVisible(visible);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -184,13 +184,13 @@ ConversationItemDelegate::paintRingConversationItem(QPainter* painter,
QRect rectName1(rect.left() + leftMargin,
rect.top() + topMargin,
rect.width() - leftMargin - infoTextWidth_ - infoTextWidthModifier,
rect.width() - leftMargin - infoTextWidth_ - infoTextWidthModifier - 2,
rect.height() / 2 - 2);
QRect rectName2(rectName1.left(),
rectName1.top() + rectName1.height(),
rectName1.top() + rectName1.height() - infoText2HeightModifier,
rectName1.width(),
rectName1.height() - bottomMargin);
rectName1.height() - bottomMargin + infoText2HeightModifier);
QRect rectInfo1(rectName1.left() + rectName1.width(),
rect.top() + topMargin,
......@@ -269,6 +269,7 @@ ConversationItemDelegate::paintRingConversationItem(QPainter* painter,
emojiMsgFont.setItalic(false);
emojiMsgFont.setBold(false);
emojiMsgFont.setPointSize(scalingRatio > 1.0 ? fontSize_ - 2 : fontSize_);
rectInfo2.setTop(rectInfo2.top() - 6);
painter->setOpacity(0.7);
painter->setFont(emojiMsgFont);
}
......
......@@ -140,7 +140,7 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
}
if (QWidget* popupWidget = this->findChild<QFrame*>()) {
popupWidget->setStyleSheet("QFrame{border: 0px;border-bottom: 1px solid #f0f0f0;}");
popupWidget->setStyleSheet("QFrame{border: 0px;border-bottom: 1px solid #f0f0f0;border-right: 1px solid #f0f0f0; }");
}
}
......
......@@ -228,12 +228,24 @@ MessageWebView::setInvitation(bool show, const std::string& contactUri, const st
}
void
MessageWebView::hideMessages()
MessageWebView::setMessagesVisibility(bool visible)
{
QString s = QString::fromLatin1("hideBody();");
QString s = QString::fromLatin1(visible ? "showMessagesDiv();" : "hideMessagesDiv();");
page()->runJavaScript(s, QWebEngineScript::MainWorld);
}
void
MessageWebView::hideEvent(QHideEvent*)
{
setMessagesVisibility(false);
}
void
MessageWebView::showEvent(QShowEvent*)
{
setMessagesVisibility(true);
}
// JS bridging incoming
Q_INVOKABLE int
PrivateBridging::log(const QString& arg)
......@@ -242,6 +254,15 @@ PrivateBridging::log(const QString& arg)
return 0;
}
Q_INVOKABLE int
PrivateBridging::messagesCleared()
{
if (auto messageView = qobject_cast<MessageWebView*>(this->parent())) {
emit messageView->messagesCleared();
}
return 0;
}
Q_INVOKABLE int
PrivateBridging::deleteInteraction(const QString& arg)
{
......
......@@ -42,6 +42,7 @@ public:
Q_INVOKABLE int acceptInvitation();
Q_INVOKABLE int refuseInvitation();
Q_INVOKABLE int blockConversation();
Q_INVOKABLE int messagesCleared();
};
class MessageWebView : public QWebEngineView
......@@ -74,10 +75,15 @@ public:
void setInvitation(bool show,
const std::string& contactUri = "",
const std::string& contactId = "");
void hideMessages();
void setMessagesVisibility(bool visible);
protected:
void hideEvent(QHideEvent*);
void showEvent(QShowEvent*);
signals:
void conversationRemoved();
void messagesCleared();
private slots:
void slotLoadFinished();
......
......@@ -29,7 +29,6 @@
#include "utils.h"
#include "lrcinstance.h"
PhotoboothWidget::PhotoboothWidget(QWidget *parent) :
QWidget(parent),
fileName_(""),
......@@ -91,7 +90,7 @@ PhotoboothWidget::on_importButton_clicked()
auto picturesDir = QStandardPaths::standardLocations(QStandardPaths::PicturesLocation).first();
fileName_ = QFileDialog::getOpenFileName(this, tr("Choose File"),
picturesDir,
tr("Image Files (*.jpg, *.jpeg, *png)"));
tr("Image Files (*.jpg, *.jpeg, *.png)"));
if (fileName_.isEmpty()) {
Video::PreviewManager::instance().startPreview();
return;
......
......@@ -47,7 +47,6 @@
#include "deleteaccountdialog.h"
#include "ui_deleteaccountdialog.h"
// general Settings
#include "winsparkle.h"
#include "media/recordingmodel.h"
......@@ -83,12 +82,10 @@ SettingsWidget::SettingsWidget(QWidget* parent)
ui->exitSettingsButton->setIconSize(QSize(24, 24));
ui->exitSettingsButton->setIcon(QPixmap(":/images/icons/round-close-24px.svg"));
// display name (aka alias)
ui->displayNameLineEdit->setAlignment(Qt::AlignHCenter);
ui->displayNameLineEdit->setPlaceholderText(tr("Enter the displayed name"));
setSelected(Button::accountSettingsButton);
ui->currentRegisteredID->setReadOnly(true);
......@@ -106,18 +103,18 @@ SettingsWidget::SettingsWidget(QWidget* parent)
ui->currentAccountAvatar->setMask(avatarClickableRegion);
QString styleS(
"QPushButton{"
" background-color: rgb(245, 245, 245);"
" border: 0px;"
"QPushButton {"
" background-color: white;"
" border-right: 1px solid #f0f0f0;"
"}"
" QPushButton:hover{"
" background-color: rgb(250, 250, 250);"
" border: 0px;"
" QPushButton:hover {"
" background-color: rgb(245, 245, 245);"
" border-right: 1px solid #f0f0f0;"
" }"
"QPushButton:checked{"
" background-color: white;"
" border: 0px;"
"QPushButton:checked {"
" background-color: rgb(237, 237, 237);"
" border-right: 1px solid #f0f0f0;"
"}"
);
......@@ -332,7 +329,8 @@ SettingsWidget::avatarClicked()
SetAvatarDialog avatarDialog(this);
// return new avatar pixmap from setAvatarDialog
connect(&avatarDialog, &SetAvatarDialog::pixmapSignal, [&](const std::string& pixString) {
connect(&avatarDialog, &SetAvatarDialog::pixmapSignal,
[this](const std::string& pixString) {
if (!pixString.empty()) {
LRCInstance::setCurrAccAvatar(pixString);
updateAccountInfoDisplayed();
......@@ -734,7 +732,6 @@ SettingsWidget::setConnections()
connect(ui->recordPathButton, &QPushButton::clicked, this, &SettingsWidget::openRecordFolderSlot);
}
// ************************* General Settings *************************
void SettingsWidget::populateGeneralSettings()
......@@ -843,7 +840,6 @@ SettingsWidget::openRecordFolderSlot()
}
}
// ************************* Audio/Visual Settings *************************
void
......@@ -887,7 +883,6 @@ SettingsWidget::populateAVSettings()
showPreview();
}
void
SettingsWidget::saveSizeIndex()
{
......
This diff is collapsed.
......@@ -32,7 +32,16 @@ QPushButton#refuseButton:pressed, QPushButton#cancelButton:pressed{
background-color: #db3c30;
}
QPushButton#btnConversations, QPushButton#btnInvites {
QPushButton {
background-color: rgb(242, 242, 242);
border-style: solid;
border-width: 0px;
border-radius: 15px;
color: rgb(32, 32, 32);
}
QPushButton#btnConversations, QPushButton#btnInvites,
QPushButton#btnExportAccount, QPushButton#btnDeletAccount {
background-color: rgb(242, 242, 242);
border-style: solid;
border-width: 0px;
......@@ -41,15 +50,18 @@ QPushButton#btnConversations, QPushButton#btnInvites {
color: rgb(32, 32, 32);
}
QPushButton#btnConversations:hover, QPushButton#btnInvites:hover {
QPushButton#btnConversations:hover, QPushButton#btnInvites:hover,
QPushButton#btnExportAccount:hover, QPushButton#btnDeletAccount:hover {
background-color: rgb(237, 237, 237);
}
QPushButton#btnConversations:pressed, QPushButton#btnInvites:pressed {
QPushButton#btnConversations:pressed, QPushButton#btnInvites:pressed,
QPushButton#btnExportAccount:pressed, QPushButton#btnDeletAccount:pressed {
background-color: rgb(212, 212, 212);
}
QPushButton#btnConversations:checked, QPushButton#btnInvites:checked {
QPushButton#btnConversations:checked, QPushButton#btnInvites:checked,
QPushButton#btnExportAccount:checked, QPushButton#btnDeletAccount:checked {
background-color: rgb(237, 237, 237);
}
......@@ -172,6 +184,10 @@ QWidget#messagingHeaderWidget {
border-bottom: 2px solid rgb(240, 240, 240);
}
QWidget#sidePanelLayoutWidget, QWidget#leftSettingsWidget {
border-right: 2px solid rgb(240, 240, 240);
}
QWidget#messageViewLayoutWidget, QWidget#welcomePage {
background-color: rgba(255, 255, 255, 255);
}
......
......@@ -358,6 +358,16 @@ Utils::formatTimeString(const std::time_t& timestamp)
}
}
const lrc::api::conversation::Info*
Utils::getConversationPtrFromUid(const std::string& uid, const lrc::api::ConversationModel& model) {
auto currentConversation = Utils::getConversationFromUid(LRCInstance::getSelectedConvUid(), model);
auto conversations = model.allFilteredConversations();
if (currentConversation == conversations.end()) {
return nullptr;
}
return &(conversations[std::distance(model.allFilteredConversations().begin(), currentConversation)]);
}
lrc::api::ConversationModel::ConversationQueue::const_iterator
Utils::getConversationFromUid(const std::string& uid, const lrc::api::ConversationModel& model) {
return std::find_if(model.allFilteredConversations().begin(), model.allFilteredConversations().end(),
......
......@@ -71,6 +71,7 @@ namespace Utils
std::string secondBestNameForAccount(const lrc::api::account::Info& account); // returns empty string if only infoHash is available
lrc::api::profile::Type profileType(const lrc::api::conversation::Info & conv, const lrc::api::ConversationModel & model);
std::string formatTimeString(const std::time_t& timestamp);
const lrc::api::conversation::Info * getConversationPtrFromUid(const std::string & uid, const lrc::api::ConversationModel & model);
lrc::api::ConversationModel::ConversationQueue::const_iterator getConversationFromUid(const std::string& uid, const lrc::api::ConversationModel& model);
lrc::api::ConversationModel::ConversationQueue::const_iterator getConversationFromUri(const std::string& uri, const lrc::api::ConversationModel& model);
bool isInteractionGenerated(const lrc::api::interaction::Type& interaction);
......
......@@ -55,14 +55,8 @@ body {
padding-bottom: var(--messagebar-size);
/* disable selection highlight because it looks very bad */
-webkit-user-select: none;
opacity: 1;
transition: 0.5s opacity;
}
body.fade {
opacity: 0;
transition: none;
}
}
::-webkit-scrollbar-track {
background-color: var(--bg-color);
......@@ -77,7 +71,6 @@ body {
background-color: #f0f0f0;
}
/** Navbar */
.navbar-wrapper {
......@@ -335,8 +328,15 @@ a:hover {
overflow: hidden;
height: auto;
padding-top: 0.5em;
opacity: 1;
transition: 0.5s opacity;
}
#messages.fade {
opacity: 0;
transition: none;
}
#messages:hover {
overflow-y: overlay;
}
......@@ -487,7 +487,6 @@ a:hover {
border-radius: 20px 4px 20px 20px;
}
.first_of_sequence.message_out .message_wrapper {
border-radius: 20px 20px 4px 20px;
}
......
......@@ -41,6 +41,7 @@ var isBanned = false
var isAccountEnabled = true
var isInitialLoading = false
var imagesLoadingCounter = 0
var canLazyLoad = false;
/* Set the default target to _self and handle with QWebEnginePage::acceptNavigationRequest */
var linkifyOptions = {
......@@ -68,6 +69,8 @@ new QWebChannel(qt.webChannelTransport, function(channel) {
});
function onScrolled_() {
if (!canLazyLoad)
return;
if (messages.scrollTop == 0 && historyBufferIndex != historyBuffer.length) {
/* At the top and there's something to print */
printHistoryPart(messages, messages.scrollHeight)
......@@ -198,7 +201,6 @@ function process_messagebar_keydown(key) {
return true
}
/**
* Disable or enable textarea.
*
......@@ -290,6 +292,9 @@ function clearMessages()
while (messages.firstChild) {
messages.removeChild(messages.firstChild)
}
canLazyLoad = false
window.jsbridge.messagesCleared()
}
/**
......@@ -303,7 +308,6 @@ function escapeHtml(html)
return div.innerHTML
}
/**
* Get the youtube video id from a URL.
* @param url
......@@ -544,7 +548,6 @@ function updateFileInteraction(message_div, message_object, forceTypeToFile = fa
var message_id = message_object["id"]
var message_text = message_object["text"]
if (isImage(message_text) && message_delivery_status === "finished" && displayLinksEnabled && !forceTypeToFile) {
// Replace the old wrapper by the downloaded image
var old_wrapper = message_div.querySelector(".internal_mes_wrapper")
......@@ -1381,6 +1384,8 @@ function on_image_load_finished() {
* available in the DOM.
*/
function check_lazy_loading() {
if (!canLazyLoad)
return;
if (messages.scrollHeight < initialScrollBufferFactor * messages.clientHeight
&& historyBufferIndex !== historyBuffer.length) {
/* Not enough messages loaded, print a new batch. Enable isInitialLoading
......@@ -1408,7 +1413,6 @@ function printHistoryPart(messages_div, fixedAt)
if (historyBufferIndex === historyBuffer.length) {
return
}
/* If first element is a spinner, remove it */
if (messages_div.firstChild && messages_div.firstChild.id === "lazyloading-icon") {
messages_div.removeChild(messages_div.firstChild)
......@@ -1462,10 +1466,17 @@ function printHistoryPart(messages_div, fixedAt)
}
}
function hideBody()
function hideMessagesDiv()
{
if (!messages.classList.contains('fade')) {
messages.classList.add('fade');
}
}
function showMessagesDiv()
{
if (!document.body.classList.contains('fade')) {
document.body.classList.add('fade');
if (messages.classList.contains('fade')) {
messages.classList.remove('fade');
}
}
......@@ -1481,9 +1492,8 @@ function hideBody()
/* exported printHistory */
function printHistory(messages_array, fadein = false)
{
if (fadein) {
hideBody()
}
if(fadein)
hideMessagesDiv()
historyBuffer = messages_array
historyBufferIndex = 0
......@@ -1492,9 +1502,10 @@ function printHistory(messages_array, fadein = false)
printHistoryPart(messages, 0)
isInitialLoading = false
if (fadein) {
document.body.classList.remove('fade');
}
canLazyLoad = true
if(fadein)
showMessagesDiv()
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment