- 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 search(QRegularExpression::escape(mFilterText),
QRegularExpression::CaseInsensitiveOption | QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption); QRegularExpression::UseUnicodePropertiesOption);
auto callLog = qobject_cast<CallHistoryList *>(sourceModel())->getAt<CallHistoryCore>(sourceRow); auto callLog = getItemAtSource<CallHistoryList, CallHistoryCore>(sourceRow);
show = show =
callLog->mIsConference ? callLog->mDisplayName.contains(search) : callLog->mRemoteAddress.contains(search); 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) { PhoneNumber::PhoneNumber(const std::shared_ptr<linphone::DialPlan> &dialPlan) : QObject(nullptr) {
// Should be call from model Thread // Should be call from model Thread
App::getInstance()->mEngine->setObjectOwnership(this, QQmlEngine::CppOwnership);
mustBeInLinphoneThread(getClassName()); mustBeInLinphoneThread(getClassName());
mFlag = Utils::coreStringToAppString(dialPlan->getFlag()); mFlag = Utils::coreStringToAppString(dialPlan->getFlag());
mNationalNumberLength = dialPlan->getNationalNumberLength(); 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) { auto it = std::find_if(list.begin(), list.end(), [countryCallingCode](const QSharedPointer<QObject> &a) {
return a.objectCast<PhoneNumber>()->mCountryCallingCode == countryCallingCode; 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(); return proxyModelIndex.row();
} }
@ -50,8 +51,7 @@ bool PhoneNumberProxy::SortFilterList::filterAcceptsRow(int sourceRow, const QMo
QRegularExpression search(QRegularExpression::escape(mFilterText), QRegularExpression search(QRegularExpression::escape(mFilterText),
QRegularExpression::CaseInsensitiveOption | QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption); 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); show = phoneNumber->mCountry.contains(search) || phoneNumber->mCountryCallingCode.contains(search);
} }

View file

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

View file

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

View file

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

View file

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