fix meeting setup ui + force meeting end before midnight

This commit is contained in:
Gaelle Braud 2024-08-12 12:56:12 +02:00
parent c843829920
commit 8cffd73df5
5 changed files with 354 additions and 319 deletions

View file

@ -1294,6 +1294,11 @@ QDateTime Utils::addYears(QDateTime date, int years) {
return date;
}
int Utils::timeOffset(QDateTime start, QDateTime end) {
qDebug() << "offset between times" << start.msecsTo(end);
return start.msecsTo(end);
}
int Utils::getYear(const QDate &date) {
return date.year();
}

View file

@ -112,11 +112,12 @@ public:
Q_INVOKABLE static int secsTo(const QString &start, const QString &end);
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
Q_INVOKABLE static QDateTime addYears(QDateTime date, int years);
Q_INVOKABLE static int timeOffset(QDateTime start, QDateTime end);
Q_INVOKABLE static QString interpretUrl(const QString &uri);
Q_INVOKABLE static bool isValidSIPAddress(const QString &uri);
Q_INVOKABLE static bool isValidIPAddress(const QString &host);
Q_INVOKABLE static bool isValidHostname(const QString& hostname);
Q_INVOKABLE static bool isValidURL(const QString& url);
Q_INVOKABLE static bool isValidHostname(const QString &hostname);
Q_INVOKABLE static bool isValidURL(const QString &url);
Q_INVOKABLE static QString findAvatarByAddress(const QString &address);
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
static QString generateSavedFilename(const QString &from, const QString &to);

View file

@ -7,6 +7,7 @@ import Linphone
ComboBox {
id: mainItem
readonly property var selectedDate: calendar.selectedDate
onSelectedDateChanged: popupItem.close()
property alias calendar: calendar
property alias contentText: contentText
contentItem: Text {

View file

@ -6,7 +6,7 @@ import Linphone
import UtilsCpp
import SettingsCpp
FocusScope{
FocusScope {
id: mainItem
property bool isCreation
property ConferenceInfoGui conferenceInfoGui
@ -14,349 +14,363 @@ FocusScope{
signal returnRequested()
signal saveSucceed(bool isCreation)
Connections {
target: mainItem.conferenceInfoGui.core
function onSchedulerStateChanged() {
if (mainItem.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) {
mainItem.saveSucceed(isCreation)
}
}
}
Component.onCompleted: {
endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime
startHour.selectedDateTime = mainItem.conferenceInfoGui.core.dateTime
endDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.endDateTime
startDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.dateTime
}
component CheckableButton: Button {
id: checkableButton
checkable: true
autoExclusive: true
contentImageColor: checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
inversedColors: !checked
topPadding: 10 * DefaultStyle.dp
bottomPadding: 10 * DefaultStyle.dp
leftPadding: 16 * DefaultStyle.dp
rightPadding: 16 * DefaultStyle.dp
contentItem: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: checkableButton.icon.source
colorizationColor: checkableButton.checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp
}
Text {
text: checkableButton.text
color: checkableButton.checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
font {
pixelSize: 16 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
ColumnLayout {
Connections {
target: mainItem.conferenceInfoGui.core
function onSchedulerStateChanged() {
if (mainItem.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) {
mainItem.saveSucceed(isCreation)
}
}
}
}
RowLayout {
visible: mainItem.isCreation && !SettingsCpp.disableBroadcastFeature
Layout.topMargin: 20 * DefaultStyle.dp
Layout.bottomMargin: 20 * DefaultStyle.dp
spacing: 18 * DefaultStyle.dp
CheckableButton {
Layout.preferredWidth: 151 * DefaultStyle.dp
icon.source: AppIcons.usersThree
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
enabled: false
text: qsTr("Réunion")
checked: true
Component.onCompleted: {
endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime
startHour.selectedDateTime = mainItem.conferenceInfoGui.core.dateTime
endDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.endDateTime
startDate.calendar.selectedDate = mainItem.conferenceInfoGui.core.dateTime
}
CheckableButton {
Layout.preferredWidth: 151 * DefaultStyle.dp
enabled: false
icon.source: AppIcons.slide
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
text: qsTr("Broadcast")
}
}
Section {
visible: mainItem.isCreation
content: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.usersThree
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
TextInput {
id: confTitle
text: qsTr("Ajouter un titre")
color: DefaultStyle.main2_600
font {
pixelSize: 20 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp
}
focus: true
onActiveFocusChanged: if(activeFocus) selectAll()
onEditingFinished: mainItem.conferenceInfoGui.core.subject = text
KeyNavigation.down: allDaySwitch
}
}
}
Section {
Layout.topMargin: 10 * DefaultStyle.dp
content: [
RowLayout {
component CheckableButton: Button {
id: checkableButton
checkable: true
autoExclusive: true
contentImageColor: checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
inversedColors: !checked
topPadding: 10 * DefaultStyle.dp
bottomPadding: 10 * DefaultStyle.dp
leftPadding: 16 * DefaultStyle.dp
rightPadding: 16 * DefaultStyle.dp
contentItem: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.clock
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
colorizationColor: DefaultStyle.main2_600
imageSource: checkableButton.icon.source
colorizationColor: checkableButton.checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
width: 24 * DefaultStyle.dp
height: 24 * DefaultStyle.dp
}
Text {
text: qsTr("Toute la journée")
text: checkableButton.text
color: checkableButton.checked ? DefaultStyle.grey_0 : DefaultStyle.main1_500_main
font {
pixelSize: 14 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
pixelSize: 16 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
}
}
Item{Layout.fillWidth: true}
Switch {
id: allDaySwitch
readonly property bool isAllDay: position === 1
KeyNavigation.up: confTitle
KeyNavigation.down: startDate
onPositionChanged: if (position === 1) {
mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(startDate.selectedDate, 0, 0)
mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(endDate.selectedDate, 23, 59)
}
Component.onCompleted: if (mainItem.conferenceInfoGui.core.isAllDayConf()) toggle
}
},
RowLayout {
spacing: 8 * DefaultStyle.dp
CalendarComboBox {
id: startDate
background.visible: mainItem.isCreation
indicator.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
Layout.preferredWidth: 200 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
KeyNavigation.up: allDaySwitch
KeyNavigation.down: endDate
KeyNavigation.left: startHour
KeyNavigation.right: startHour
onSelectedDateChanged: {
if (!selectedDate || selectedDate == mainItem.conferenceInfoGui.core.dateTime) return
mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(selectedDate, allDaySwitch.isAllDay ? 0 : startHour.selectedHour, allDaySwitch.isAllDay ? 0 : startHour.selectedMin)
if (isCreation) {
startHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, startHour.selectedMin)
if (allDaySwitch.position === 0) endDate.calendar.selectedDate = UtilsCpp.addSecs(startHour.selectedDateTime, 3600)
else endDate.calendar.selectedDate = UtilsCpp.createDateTime(selectedDate, 23, 59)
}
}
}
Item{Layout.fillWidth: true}
TimeComboBox {
id: startHour
visible: allDaySwitch.position === 0
indicator.visible: mainItem.isCreation
// Layout.fillWidth: true
Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
KeyNavigation.up: allDaySwitch
KeyNavigation.down: endDate
KeyNavigation.left: startDate
KeyNavigation.right: startDate
onSelectedHourChanged: {
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
endDate.calendar.selectedDate = UtilsCpp.addSecs(selectedDateTime, 3600)
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)//Qt.formatDateTime(UtilsCpp.createDateTime(new Date(), selectedHour == 23 ? 23 : selectedHour + 1, selectedHour == 23 ? 59 : selectedMin), "hh:mm")
}
onSelectedMinChanged: {
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
endDate.calendar.selectedDate = UtilsCpp.addSecs(selectedDateTime, 3600)
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)//UtilsCpp.createDateTime(selectedDateTime, selectedHour == 23 ? 23 : selectedHour + 1, selectedHour == 23 ? 59 : selectedMin)
}
}
},
RowLayout {
spacing: 8 * DefaultStyle.dp
CalendarComboBox {
id: endDate
background.visible: mainItem.isCreation
indicator.visible: mainItem.isCreation
// Layout.fillWidth: true
Layout.preferredWidth: 200 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
onSelectedDateChanged: if (selectedDate) mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, endHour.selectedMin)
}
Item{Layout.fillWidth: true}
TimeComboBox {
id: endHour
visible: allDaySwitch.position === 0
indicator.visible: mainItem.isCreation
Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
onSelectedHourChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
onSelectedMinChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
}
},
ComboBox {
id: timeZoneCbox
Layout.preferredWidth: 307 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
hoverEnabled: true
listView.implicitHeight: 250 * DefaultStyle.dp
constantImageSource: AppIcons.globe
weight: 700 * DefaultStyle.dp
leftMargin: 0
currentIndex: mainItem.conferenceInfoGui ? model.getIndex(mainItem.conferenceInfoGui.core.timeZoneModel) : -1
background: Rectangle {
visible: parent.hovered || parent.down
anchors.fill: parent
color: DefaultStyle.grey_100
}
model: TimeZoneProxy{
}
onCurrentIndexChanged: {
var modelIndex = timeZoneCbox.model.index(currentIndex, 0)
mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1)
}
}
]
}
Section {
content: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.note
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
TextArea {
id: descriptionEdit
Layout.fillWidth: true
Layout.preferredWidth: 275 * DefaultStyle.dp
leftPadding: 8 * DefaultStyle.dp
rightPadding: 8 * DefaultStyle.dp
hoverEnabled: true
placeholderText: qsTr("Ajouter une description")
placeholderTextColor: DefaultStyle.main2_600
placeholderWeight: 700 * DefaultStyle.dp
color: DefaultStyle.main2_600
font {
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
}
onEditingFinished: mainItem.conferenceInfoGui.core.description = text
Keys.onPressed: (event)=> {
if (event.key == Qt.Key_Escape) {
text = mainItem.conferenceInfoGui.core.description
nextItemInFocusChain().forceActiveFocus()
event.accepted = true;
}
}
background: Rectangle {
anchors.fill: parent
color: descriptionEdit.hovered || descriptionEdit.activeFocus ? DefaultStyle.grey_100 : "transparent"
radius: 4 * DefaultStyle.dp
}
}
}
}
Section {
content: [
Button {
id: addParticipantsButton
Layout.fillWidth: true
Layout.preferredHeight: 30 * DefaultStyle.dp
background: Rectangle {
anchors.fill: parent
color: addParticipantsButton.hovered || addParticipantsButton.activeFocus ? DefaultStyle.grey_100 : "transparent"
radius: 4 * DefaultStyle.dp
RowLayout {
visible: mainItem.isCreation && !SettingsCpp.disableBroadcastFeature
Layout.topMargin: 20 * DefaultStyle.dp
Layout.bottomMargin: 20 * DefaultStyle.dp
spacing: 18 * DefaultStyle.dp
CheckableButton {
Layout.preferredWidth: 151 * DefaultStyle.dp
icon.source: AppIcons.usersThree
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
enabled: false
text: qsTr("Réunion")
checked: true
}
CheckableButton {
Layout.preferredWidth: 151 * DefaultStyle.dp
enabled: false
icon.source: AppIcons.slide
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
text: qsTr("Broadcast")
}
}
Section {
visible: mainItem.isCreation
content: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.usersThree
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
contentItem: RowLayout {
spacing: 8 * DefaultStyle.dp
TextInput {
id: confTitle
text: qsTr("Ajouter un titre")
color: DefaultStyle.main2_600
font {
pixelSize: 20 * DefaultStyle.dp
weight: 800 * DefaultStyle.dp
}
focus: true
onActiveFocusChanged: if(activeFocus) selectAll()
onEditingFinished: mainItem.conferenceInfoGui.core.subject = text
KeyNavigation.down: allDaySwitch
}
}
}
Section {
Layout.topMargin: 10 * DefaultStyle.dp
content: [
RowLayout {
EffectImage {
imageSource: AppIcons.usersThree
imageSource: AppIcons.clock
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
Text {
CalendarComboBox {
id: startDate
background.visible: mainItem.isCreation
indicator.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
Layout.fillWidth: true
text: qsTr("Ajouter des participants")
font {
pixelSize: 14 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
KeyNavigation.up: allDaySwitch
KeyNavigation.down: endDate
KeyNavigation.left: startHour
KeyNavigation.right: startHour
onSelectedDateChanged: {
if (!selectedDate || selectedDate == mainItem.conferenceInfoGui.core.dateTime) return
mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(selectedDate, allDaySwitch.isAllDay ? 0 : startHour.selectedHour, allDaySwitch.isAllDay ? 0 : startHour.selectedMin)
if (isCreation) {
startHour.selectedDateTime = UtilsCpp.createDateTime(selectedDate, startHour.selectedHour, startHour.selectedMin)
if (allDaySwitch.position === 0) endDate.calendar.selectedDate = UtilsCpp.addSecs(startHour.selectedDateTime, 3600)
else endDate.calendar.selectedDate = UtilsCpp.createDateTime(selectedDate, 23, 59)
}
}
}
}
onClicked: mainItem.addParticipantsRequested()
},
ListView {
id: participantList
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
Layout.maximumHeight: 250 * DefaultStyle.dp
clip: true
model: mainItem.conferenceInfoGui.core.participants
delegate: Item {
height: 56 * DefaultStyle.dp
width: participantList.width
},
RowLayout {
Item {
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
RowLayout {
anchors.fill: parent
spacing: 16 * DefaultStyle.dp
Avatar {
Layout.preferredWidth: 45 * DefaultStyle.dp
Layout.preferredHeight: 45 * DefaultStyle.dp
address: modelData.address
visible: allDaySwitch.position === 0
TimeComboBox {
id: startHour
visible: allDaySwitch.position === 0
indicator.visible: mainItem.isCreation
// Layout.fillWidth: true
Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
KeyNavigation.up: allDaySwitch
KeyNavigation.down: endDate
KeyNavigation.left: startDate
KeyNavigation.right: startDate
onSelectedDateTimeChanged: {
endHour.minTime = selectedDateTime
endHour.maxTime = UtilsCpp.createDateTime(selectedDateTime, 23, 59)
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime
endDate.calendar.selectedDate = UtilsCpp.addSecs(selectedDateTime, 3600)
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)
}
}
Text {
text: modelData.displayName
font.pixelSize: 14 * DefaultStyle.dp
font.capitalization: Font.Capitalize
TimeComboBox {
id: endHour
visible: allDaySwitch.position === 0
indicator.visible: mainItem.isCreation
Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
onSelectedDateTimeChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime
}
Item {
Layout.fillWidth: true
}
Button {
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
Layout.rightMargin: 10 * DefaultStyle.dp
background: Item{}
icon.source: AppIcons.closeX
contentImageColor: DefaultStyle.main1_500_main
onClicked: mainItem.conferenceInfoGui.core.removeParticipant(index)
Text {
property int durationSec: UtilsCpp.secsTo(startHour.selectedTime, endHour.selectedTime)
property int hour: durationSec/3600
property int min: (durationSec - hour*3600)/60
text: (hour > 0 ? hour + "h" : "") + (min > 0 ? min + "mn" : "")
font {
pixelSize: 14 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
}
}
}
CalendarComboBox {
id: endDate
visible: allDaySwitch.position === 1
background.visible: mainItem.isCreation
indicator.visible: mainItem.isCreation
Layout.fillWidth: true
Layout.preferredHeight: 30 * DefaultStyle.dp
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
onSelectedDateChanged: if (selectedDate) mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(selectedDate, endHour.selectedHour, endHour.selectedMin)
}
},
RowLayout {
Item {
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
RowLayout {
Switch {
id: allDaySwitch
text: qsTr("Toute la journée")
onPositionChanged: {
if (position == 1) {
mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(startDate.selectedDate, 0, 0)
mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(endDate.selectedDate, 23, 59)
} else {
mainItem.conferenceInfoGui.core.dateTime = UtilsCpp.createDateTime(startDate.selectedDate, startHour.selectedHour, startHour.selectedMin)
mainItem.conferenceInfoGui.core.endDateTime = UtilsCpp.createDateTime(endDate.selectedDate, endHour.selectedHour, endHour.selectedMin)
}
}
}
}
},
ComboBox {
id: timeZoneCbox
Layout.preferredWidth: 307 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp
hoverEnabled: true
listView.implicitHeight: 250 * DefaultStyle.dp
constantImageSource: AppIcons.globe
weight: 700 * DefaultStyle.dp
leftMargin: 0
currentIndex: mainItem.conferenceInfoGui ? model.getIndex(mainItem.conferenceInfoGui.core.timeZoneModel) : -1
background: Rectangle {
visible: parent.hovered || parent.down
anchors.fill: parent
color: DefaultStyle.grey_100
}
model: TimeZoneProxy{
}
onCurrentIndexChanged: {
var modelIndex = timeZoneCbox.model.index(currentIndex, 0)
mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1)
}
}
]
}
Section {
content: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.note
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
TextArea {
id: descriptionEdit
Layout.fillWidth: true
Layout.preferredWidth: 275 * DefaultStyle.dp
leftPadding: 8 * DefaultStyle.dp
rightPadding: 8 * DefaultStyle.dp
hoverEnabled: true
placeholderText: qsTr("Ajouter une description")
placeholderTextColor: DefaultStyle.main2_600
placeholderWeight: 700 * DefaultStyle.dp
color: DefaultStyle.main2_600
font {
pixelSize: 14 * DefaultStyle.dp
weight: 400 * DefaultStyle.dp
}
onEditingFinished: mainItem.conferenceInfoGui.core.description = text
Keys.onPressed: (event)=> {
if (event.key == Qt.Key_Escape) {
text = mainItem.conferenceInfoGui.core.description
nextItemInFocusChain().forceActiveFocus()
event.accepted = true;
}
}
background: Rectangle {
anchors.fill: parent
color: descriptionEdit.hovered || descriptionEdit.activeFocus ? DefaultStyle.grey_100 : "transparent"
radius: 4 * DefaultStyle.dp
}
}
}
]
}
Switch {
text: qsTr("Send invitation to participants")
checked: mainItem.conferenceInfoGui.core.inviteEnabled
onToggled: mainItem.conferenceInfoGui.core.inviteEnabled = checked
}
Item {
Layout.fillHeight: true
Layout.minimumHeight: 1 * DefaultStyle.dp
}
Section {
content: [
Button {
id: addParticipantsButton
Layout.fillWidth: true
Layout.preferredHeight: 30 * DefaultStyle.dp
background: Rectangle {
anchors.fill: parent
color: addParticipantsButton.hovered || addParticipantsButton.activeFocus ? DefaultStyle.grey_100 : "transparent"
radius: 4 * DefaultStyle.dp
}
contentItem: RowLayout {
spacing: 8 * DefaultStyle.dp
EffectImage {
imageSource: AppIcons.usersThree
colorizationColor: DefaultStyle.main2_600
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
}
Text {
Layout.fillWidth: true
text: qsTr("Ajouter des participants")
font {
pixelSize: 14 * DefaultStyle.dp
weight: 700 * DefaultStyle.dp
}
}
}
onClicked: mainItem.addParticipantsRequested()
},
ListView {
id: participantList
Layout.fillWidth: true
Layout.preferredHeight: contentHeight
Layout.maximumHeight: 250 * DefaultStyle.dp
clip: true
model: mainItem.conferenceInfoGui.core.participants
delegate: Item {
height: 56 * DefaultStyle.dp
width: participantList.width
RowLayout {
anchors.fill: parent
spacing: 16 * DefaultStyle.dp
Avatar {
Layout.preferredWidth: 45 * DefaultStyle.dp
Layout.preferredHeight: 45 * DefaultStyle.dp
address: modelData.address
}
Text {
text: modelData.displayName
font.pixelSize: 14 * DefaultStyle.dp
font.capitalization: Font.Capitalize
}
Item {
Layout.fillWidth: true
}
Button {
Layout.preferredWidth: 24 * DefaultStyle.dp
Layout.preferredHeight: 24 * DefaultStyle.dp
icon.width: 24 * DefaultStyle.dp
icon.height: 24 * DefaultStyle.dp
Layout.rightMargin: 10 * DefaultStyle.dp
background: Item{}
icon.source: AppIcons.closeX
contentImageColor: DefaultStyle.main1_500_main
onClicked: mainItem.conferenceInfoGui.core.removeParticipant(index)
}
}
}
}
]
}
Switch {
text: qsTr("Send invitation to participants")
checked: mainItem.conferenceInfoGui.core.inviteEnabled
onToggled: mainItem.conferenceInfoGui.core.inviteEnabled = checked
}
Item {
Layout.fillHeight: true
Layout.minimumHeight: 1 * DefaultStyle.dp
}
}
}

View file

@ -5,13 +5,25 @@ import UtilsCpp 1.0
ComboBox {
id: mainItem
property var selectedDateTime
onSelectedDateTimeChanged: {
if (minTime != undefined) {
if (UtilsCpp.timeOffset(minTime, selectedDateTime) < 0)
selectedDateTime = minTime
}
if (maxTime != undefined) {
if (UtilsCpp.timeOffset(maxTime, selectedDateTime) > 0)
selectedDateTime = maxTime
}
}
readonly property string selectedTimeString: Qt.formatDateTime(selectedDateTime, "hh:mm")
property int selectedHour: input.hour*1
property int selectedMin: input.min*1
property alias contentText: input
property var minTime
property var maxTime
popup.width: 73 * DefaultStyle.dp
listView.model: 48
listView.implicitHeight: 204 * DefaultStyle.dp
listView.height: Math.min(204 * DefaultStyle.dp, listView.implicitHeight)
editable: true
popup.closePolicy: Popup.PressOutsideParent | Popup.CloseOnPressOutside
onCurrentTextChanged: input.text = currentText
@ -48,18 +60,20 @@ ComboBox {
focus = false
}
}
onEditingFinished: {
console.log("set time", hour, min)
onFocusChanged: if (!focus) {
mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min)
console.log("set time", hour, min)
}
}
listView.delegate: Text {
id: hourDelegate
property int hour: modelData /2
property int min: modelData%2 === 0 ? 0 : 30
text: Qt.formatDateTime(UtilsCpp.createDateTime(new Date(), hour, min), "hh:mm")
property var currentDateTime: UtilsCpp.createDateTime(new Date(), hour, min)
text: Qt.formatDateTime(currentDateTime, "hh:mm")
width: mainItem.width
height: 25 * DefaultStyle.dp
visible: mainItem.minTime == undefined || UtilsCpp.timeOffset(mainItem.minTime, currentDateTime) > 0
height: visible ? 25 * DefaultStyle.dp : 0
verticalAlignment: TextInput.AlignVCenter
horizontalAlignment: TextInput.AlignHCenter
font {