- Buttons size.
- Crash on subscription.
- Hidden buttons text.
- Black icons.
This commit is contained in:
Julien Wadel 2024-10-15 12:59:34 +02:00
parent 804af1bdbb
commit b07eca28e4
7 changed files with 59 additions and 68 deletions

View file

@ -61,7 +61,7 @@ bool CallHistoryProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo
QRegularExpression search(QRegularExpression::escape(mFilterText),
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption);
auto callLog = qobject_cast<CallHistoryList *>(sourceModel())->getAt<CallHistoryCore>(sourceRow);
auto callLog = getItemAtSource<CallHistoryList, CallHistoryCore>(sourceRow);
show =
callLog->mIsConference ? callLog->mDisplayName.contains(search) : callLog->mRemoteAddress.contains(search);
}

View file

@ -32,6 +32,7 @@ QSharedPointer<PhoneNumber> PhoneNumber::create(const std::shared_ptr<linphone::
PhoneNumber::PhoneNumber(const std::shared_ptr<linphone::DialPlan> &dialPlan) : QObject(nullptr) {
// Should be call from model Thread
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
mustBeInLinphoneThread(getClassName());
mFlag = Utils::coreStringToAppString(dialPlan->getFlag());
mNationalNumberLength = dialPlan->getNationalNumberLength();

View file

@ -40,7 +40,8 @@ int PhoneNumberProxy::findIndexByCountryCallingCode(const QString &countryCallin
auto it = std::find_if(list.begin(), list.end(), [countryCallingCode](const QSharedPointer<QObject> &a) {
return a.objectCast<PhoneNumber>()->mCountryCallingCode == countryCallingCode;
});
auto proxyModelIndex = mapFromSource(model->index(it - list.begin()));
auto proxyModelIndex =
dynamic_cast<SortFilterList *>(sourceModel())->mapFromSource(model->index(it - list.begin()));
return proxyModelIndex.row();
}
@ -50,8 +51,7 @@ bool PhoneNumberProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo
QRegularExpression search(QRegularExpression::escape(mFilterText),
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption);
auto phoneNumber = qobject_cast<PhoneNumberList *>(sourceModel())->getAt<PhoneNumber>(sourceRow);
auto phoneNumber = getItemAtSource<PhoneNumberList, PhoneNumber>(sourceRow);
show = phoneNumber->mCountry.contains(search) || phoneNumber->mCountryCallingCode.contains(search);
}

View file

@ -46,14 +46,14 @@ Control.Button {
id: buttonBackground
anchors.fill: parent
color: mainItem.enabled
? inversedColors
? mainItem.pressed || mainItem.shadowEnabled
? DefaultStyle.grey_100
: mainItem.borderColor
: mainItem.pressed || mainItem.shadowEnabled
? mainItem.pressedColor
: mainItem.color
: mainItem.disabledColor
? inversedColors
? mainItem.pressed || mainItem.shadowEnabled
? DefaultStyle.grey_100
: mainItem.borderColor
: mainItem.pressed || mainItem.shadowEnabled
? mainItem.pressedColor
: mainItem.color
: mainItem.disabledColor
radius: mainItem.radius
border.color: inversedColors ? mainItem.color : mainItem.borderColor
@ -80,11 +80,7 @@ Control.Button {
component ButtonText: Text {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
width: mainItem.text != undefined ? implicitWidth : 0
height: implicitHeight
wrapMode: Text.WrapAnywhere
// Layout.fillWidth: true
// Layout.fillHeight: true
text: mainItem.text
maximumLineCount: 1
color: inversedColors ? mainItem.color : mainItem.textColor
@ -99,8 +95,6 @@ Control.Button {
}
component ButtonImage: EffectImage {
// Layout.fillWidth: true
// Layout.fillHeight: true
imageSource: mainItem.icon.source
imageWidth: mainItem.icon.width
imageHeight: mainItem.icon.height
@ -111,9 +105,10 @@ Control.Button {
contentItem: Control.StackView{
id: stacklayout
width: mainItem.width
height: mainItem.height
// TODO Qt bug : contentItem is never changed....
implicitHeight: contentItem && contentItem.implicitHeight? contentItem.implicitHeight : 0
implicitWidth: contentItem && contentItem.implicitWidth? contentItem.implicitWidth: 0
implicitHeight: !!contentItem && contentItem.implicitHeight ? contentItem.implicitHeight : 0
implicitWidth: !!contentItem && contentItem.implicitWidth ? contentItem.implicitWidth: 0
function updateComponent(){
var item
var component = mainItem.text.length != 0 && mainItem.icon.source.toString().length != 0
@ -127,9 +122,9 @@ Control.Button {
item = stacklayout.push(component, Control.StackView.Immediate)
else if( component != stacklayout.get(0))
item = stacklayout.replace(component, Control.StackView.Immediate)
if(item){// Workaround for Qt bug : set from the item and not from the contentItem
implicitHeight = item.implicitHeight
implicitWidth = item.implicitWidth
if(item){// Workaround for Qt bug : set from the item and not from the contentItem which seems to be lost
implicitHeight = Qt.binding(function() { return item.implicitHeight})
implicitWidth = Qt.binding(function() { return item.implicitWidth})
}
}
@ -146,27 +141,40 @@ Control.Button {
Component{
id: imageTextComponent
RowLayout {
width: stacklayout.width
height: stacklayout.height
spacing: mainItem.spacing
ButtonImage{
Layout.preferredWidth: mainItem.icon.width
Layout.preferredHeight: mainItem.icon.height
}
ButtonText{}
ButtonText{
Layout.fillHeight: true
Layout.fillWidth: true
}
}
}
Component{
id: textComponent
ButtonText {}
ButtonText {
width: stacklayout.width
height: stacklayout.height
// Hack for StackView binding loop
onImplicitHeightChanged: {implicitHeight}
}
}
Component{
id: imageComponent
ButtonImage{}
ButtonImage{
width: stacklayout.width
height: stacklayout.height
}
}
Component{
id: emptyComponent
Item {
Layout.fillWidth: true
Layout.fillHeight: true
width: stacklayout.width
height: stacklayout.height
}
}
}

View file

@ -79,6 +79,7 @@ Loader {
shadowColor: DefaultStyle.grey_1000
shadowBlur: 0
shadowOpacity: mainItem.shadowEnabled ? 0.7 : 0.0
z: mainItem.z - 1
}
}
}

View file

@ -33,27 +33,16 @@ Rectangle {
Button {
id: aboutButton
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
background: Item{}
contentItem: RowLayout {
spacing: 8 * DefaultStyle.dp
Image {
fillMode: Image.PreserveAspectFit
source: AppIcons.info
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
Text {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
text: qsTr("À propos")
font {
underline: aboutButton.underline
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
}
color: DefaultStyle.main2_500main
}
}
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
icon.source: AppIcons.info
text: qsTr("À propos")
textSize: 14 * DefaultStyle.dp
textWeight: 400 * DefaultStyle.dp
textColor: DefaultStyle.main2_500main
onClicked: console.debug("[LoginLayout]User: open about popup")
background: Item{}
}
}

View file

@ -584,29 +584,20 @@ AbstractMainPage {
KeyNavigation.down: shareNetworkButton
popup.contentItem: Button {
color: deletePopup.popupBackgroundColor
color: DefaultStyle.danger_500main
borderColor: deletePopup.popupBackgroundColor
textColor: DefaultStyle.danger_500main
contentImageColor: DefaultStyle.danger_500main
inversedColors: true
property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core.organizerAddress)
contentItem: RowLayout {
EffectImage {
imageSource: AppIcons.trashCan
width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
fillMode: Image.PreserveAspectFit
colorizationColor: DefaultStyle.danger_500main
}
Text {
text: qsTr("Delete this meeting")
color: DefaultStyle.danger_500main
font {
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
}
}
}
icon.source: AppIcons.trashCan
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
spacing: 10 * DefaultStyle.dp
textSize: 14 * DefaultStyle.dp
textWeight: 400 * DefaultStyle.dp
text: qsTr("Delete this meeting")
onClicked: {
if (mainItem.selectedConference) {
cancelAndDeleteConfDialog.cancel = isMeObj? isMeObj.value : false
@ -624,6 +615,7 @@ AbstractMainPage {
mainItem.selectedConference.core.lDeleteConferenceInfo()
}
}
background: Item{}
}
}
}