Commit fd0d7c0a authored by Andreas Traczyk's avatar Andreas Traczyk

fix regression introduced by 37ccc1c3

Change-Id: I392b63a202673aa41b473e2a7073f7bdfc025211
parent 37ccc1c3
......@@ -170,8 +170,11 @@ CallWidget::CallWidget(QWidget* parent) :
this, &CallWidget::on_sendContactRequestButton_clicked);
// connect conversation filter buttons to act as radio buttons
connect(ui->buttonInvites, &ConversationFilterButton::clicked, ui->buttonConversations, &ConversationFilterButton::setUnselected);
connect(ui->buttonConversations, &ConversationFilterButton::clicked, ui->buttonInvites, &ConversationFilterButton::setUnselected);
connect(ui->buttonInvites, &ConversationFilterButton::clicked,
ui->buttonConversations, &ConversationFilterButton::setUnselected);
connect(ui->buttonConversations, &ConversationFilterButton::clicked,
ui->buttonInvites, &ConversationFilterButton::setUnselected);
connect(ui->currentAccountComboBox, QOverload<int>::of(&CurrentAccountComboBox::currentIndexChanged),
[this] {
......@@ -610,8 +613,8 @@ void CallWidget::slotShowIncomingCallView(const std::string& accountId,
}
ui->videoWidget->pushRenderer(convInfo.callId);
// TODO:(new lrc) in call chat
//ui->instantMessagingWidget->setMediaText(actualCall_);
ui->instantMessagingWidget->setupCallMessaging(convInfo.callId, messageModel_.get());
disconnect(selectedCallChanged_);
selectedCallChanged_ = connect(
......
......@@ -93,13 +93,16 @@
<number>0</number>
</property>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="topMargin">
<number>4</number>
</property>
<item>
<widget class="CurrentAccountComboBox" name="currentAccountComboBox" native="true">
<property name="sizePolicy">
......@@ -240,7 +243,7 @@
</item>
<item>
<widget class="QWidget" name="smartListWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0">
<property name="spacing">
<number>0</number>
</property>
......@@ -256,22 +259,6 @@
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="QWidget" name="missingButtonsDummyWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="ConversationsFilterWidget" name="conversationsFilterWidget" native="true">
<layout class="QHBoxLayout" name="conversationFilterLayout">
......@@ -288,14 +275,14 @@
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
<number>0</number>
</property>
<item>
<widget class="ConversationFilterButton" name="buttonConversations">
<widget class="ConversationFilterButton" name="buttonConversations" native="true">
<property name="toolTip">
<string>Show conversations</string>
</property>
<property name="text">
<property name="text" stdset="0">
<string>Conversations</string>
</property>
</widget>
......@@ -314,59 +301,40 @@
</widget>
</item>
<item>
<widget class="SmartListView" name="smartList">
<property name="autoScrollMargin">
<number>16</number>
</property>
<property name="indentation">
<layout class="QVBoxLayout" name="verticalLayout_13">
<property name="spacing">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
<property name="topMargin">
<number>10</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
<item>
<widget class="SmartListView" name="smartList">
<property name="autoScrollMargin">
<number>16</number>
</property>
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_13">
<property name="topMargin">
<number>6</number>
</property>
<item>
<widget class="SmartListView" name="smartList">
<property name="autoScrollMargin">
<number>16</number>
</property>
<property name="indentation">
<number>0</number>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="itemsExpandable">
<bool>false</bool>
</property>
<property name="expandsOnDoubleClick">
<bool>false</bool>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
......@@ -2074,6 +2042,11 @@
<extends>QWidget</extends>
<header>currentaccountcombobox.h</header>
</customwidget>
<customwidget>
<class>ConversationFilterButton</class>
<extends>QWidget</extends>
<header>conversationfilterbutton.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="ressources.qrc"/>
......
......@@ -31,7 +31,6 @@
#undef REGISTERED
CurrentAccountComboBox::CurrentAccountComboBox(QWidget* parent)
{
Q_UNUSED(parent);
......@@ -75,9 +74,10 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
{
Q_UNUSED(e);
gearPoint_.setX(this->width() - gearSize_ - 2 * gearBorder_);
gearPoint_.setY(this->height() / 2 - gearLabel_.height() / 2 - gearBorder_);
gearLabel_.setGeometry(gearPoint_.x() - 3, gearPoint_.y(), gearSize_ + 2 * gearBorder_, gearSize_ + 2 * gearBorder_);
gearPoint_.setX(this->width() - gearSize_ - 4 * gearBorder_);
gearPoint_.setY(this->height() / 2 - gearLabel_.height() / 2 - 2 * gearBorder_);
gearLabel_.setGeometry(gearPoint_.x() - 3, gearPoint_.y(),
gearSize_ + 2 * gearBorder_, gearSize_ + 2 * gearBorder_);
gearLabel_.setMargin(gearBorder_);
QPoint p(12, 2);
......@@ -123,11 +123,13 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
// write primary and secondary account identifiers to combobox label
QString primaryAccountID = QString::fromStdString(Utils::bestNameForAccount(LRCInstance::getCurrentAccountInfo()));
painter.setPen(Qt::black);
primaryAccountID = fontMetricPrimary.elidedText(primaryAccountID, Qt::ElideRight, comboBoxRect.width() - elidConst - gearSize_*!popupPresent);
primaryAccountID = fontMetricPrimary.elidedText(primaryAccountID, Qt::ElideRight,
comboBoxRect.width() - elidConst - (popupPresent ? 0 : 2 * gearSize_));
painter.drawText(comboBoxRect, Qt::AlignLeft, primaryAccountID);
QString secondaryAccountID = QString::fromStdString(Utils::secondBestNameForAccount(LRCInstance::getCurrentAccountInfo()));
secondaryAccountID = fontMetricSecondary.elidedText(secondaryAccountID, Qt::ElideRight, comboBoxRect.width() - elidConst - 2 - gearSize_ *!popupPresent); // [screen awareness]
secondaryAccountID = fontMetricSecondary.elidedText(secondaryAccountID, Qt::ElideRight,
comboBoxRect.width() - elidConst - 2 - (popupPresent ? 0 : 2 * gearSize_)); // [screen awareness]
if (secondaryAccountID.length()) { // if secondary accound id exists
painter.setFont(fontSecondary);
......@@ -135,12 +137,8 @@ CurrentAccountComboBox::paintEvent(QPaintEvent* e)
painter.drawText(comboBoxRect, (Qt::AlignBottom | Qt::AlignLeft), secondaryAccountID);
}
if (LRCInstance::accountModel().getAccountList().size() <= 1) {
this->setDisabled(true);
}
else {
this->setEnabled(true);
}
this->setEnabled(LRCInstance::accountModel().getAccountList().size() > 1);
gearLabel_.setPixmap(gearPixmap_);
}
......@@ -166,51 +164,50 @@ CurrentAccountComboBox::accountListUpdate()
this->setModel(accountListModel_.get());
}
// if gearLabel is clicked
void
CurrentAccountComboBox::mousePressEvent(QMouseEvent* mouseEvent)
{
if (!gearLabel_.frameGeometry().contains(mouseEvent->localPos().toPoint())) {
QComboBox::mousePressEvent(mouseEvent);
}
else {
emit settingsButtonClicked();
}
}
// if gear label is hovered over
void
CurrentAccountComboBox::mouseMoveEvent(QMouseEvent* mouseEvent)
{
if (gearLabel_.frameGeometry().contains(mouseEvent->x(), mouseEvent->y())) {
QComboBox::mouseMoveEvent(mouseEvent);
gearLabel_.setStyleSheet("background: rgb(237, 237, 237); border-width: 0px; border-radius: 8px;");
return;
}
gearLabel_.setStyleSheet("background: transparent;");
}
void
CurrentAccountComboBox::showPopup()
{
gearPixmap_.load("");
popupPresent = true;
QComboBox::showPopup();
}
void
CurrentAccountComboBox::hidePopup()
{
gearPixmap_.load(":/images/icons/round-settings-24px.svg");
popupPresent = false;
QComboBox::hidePopup();
}
void
CurrentAccountComboBox::leaveEvent(QEvent* event)
{
gearLabel_.setStyleSheet("background: transparent;");
QComboBox::leaveEvent(event);
// if gearLabel is clicked
void
CurrentAccountComboBox::mousePressEvent(QMouseEvent* mouseEvent)
{
if (!gearLabel_.frameGeometry().contains(mouseEvent->localPos().toPoint())) {
QComboBox::mousePressEvent(mouseEvent);
} else {
emit settingsButtonClicked();
}
}
// if gear label is hovered over
void
CurrentAccountComboBox::mouseMoveEvent(QMouseEvent* mouseEvent)
{
if (gearLabel_.frameGeometry().contains(mouseEvent->x(), mouseEvent->y())) {
QComboBox::mouseMoveEvent(mouseEvent);
gearLabel_.setStyleSheet("background: rgb(237, 237, 237); border-width: 0px; border-radius: 8px;");
return;
}
gearLabel_.setStyleSheet("background: transparent;");
}
void
CurrentAccountComboBox::showPopup()
{
gearPixmap_.load("");
popupPresent = true;
QComboBox::showPopup();
}
void
CurrentAccountComboBox::hidePopup()
{
gearPixmap_.load(":/images/icons/round-settings-24px.svg");
popupPresent = false;
QComboBox::hidePopup();
}
void
CurrentAccountComboBox::leaveEvent(QEvent* event)
{
gearLabel_.setStyleSheet("background: transparent;");
QComboBox::leaveEvent(event);
}
\ No newline at end of file
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