fix meeting setup ui + force meeting end before midnight
This commit is contained in:
parent
c843829920
commit
8cffd73df5
5 changed files with 354 additions and 319 deletions
|
|
@ -1294,6 +1294,11 @@ QDateTime Utils::addYears(QDateTime date, int years) {
|
||||||
return date;
|
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) {
|
int Utils::getYear(const QDate &date) {
|
||||||
return date.year();
|
return date.year();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,11 +112,12 @@ public:
|
||||||
Q_INVOKABLE static int secsTo(const QString &start, const QString &end);
|
Q_INVOKABLE static int secsTo(const QString &start, const QString &end);
|
||||||
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
|
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
|
||||||
Q_INVOKABLE static QDateTime addYears(QDateTime date, int years);
|
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 QString interpretUrl(const QString &uri);
|
||||||
Q_INVOKABLE static bool isValidSIPAddress(const QString &uri);
|
Q_INVOKABLE static bool isValidSIPAddress(const QString &uri);
|
||||||
Q_INVOKABLE static bool isValidIPAddress(const QString &host);
|
Q_INVOKABLE static bool isValidIPAddress(const QString &host);
|
||||||
Q_INVOKABLE static bool isValidHostname(const QString& hostname);
|
Q_INVOKABLE static bool isValidHostname(const QString &hostname);
|
||||||
Q_INVOKABLE static bool isValidURL(const QString& url);
|
Q_INVOKABLE static bool isValidURL(const QString &url);
|
||||||
Q_INVOKABLE static QString findAvatarByAddress(const QString &address);
|
Q_INVOKABLE static QString findAvatarByAddress(const QString &address);
|
||||||
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
||||||
static QString generateSavedFilename(const QString &from, const QString &to);
|
static QString generateSavedFilename(const QString &from, const QString &to);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import Linphone
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
readonly property var selectedDate: calendar.selectedDate
|
readonly property var selectedDate: calendar.selectedDate
|
||||||
|
onSelectedDateChanged: popupItem.close()
|
||||||
property alias calendar: calendar
|
property alias calendar: calendar
|
||||||
property alias contentText: contentText
|
property alias contentText: contentText
|
||||||
contentItem: Text {
|
contentItem: Text {
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import Linphone
|
||||||
import UtilsCpp
|
import UtilsCpp
|
||||||
import SettingsCpp
|
import SettingsCpp
|
||||||
|
|
||||||
FocusScope{
|
FocusScope {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
property bool isCreation
|
property bool isCreation
|
||||||
property ConferenceInfoGui conferenceInfoGui
|
property ConferenceInfoGui conferenceInfoGui
|
||||||
|
|
@ -14,6 +14,7 @@ FocusScope{
|
||||||
signal returnRequested()
|
signal returnRequested()
|
||||||
signal saveSucceed(bool isCreation)
|
signal saveSucceed(bool isCreation)
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
Connections {
|
Connections {
|
||||||
target: mainItem.conferenceInfoGui.core
|
target: mainItem.conferenceInfoGui.core
|
||||||
function onSchedulerStateChanged() {
|
function onSchedulerStateChanged() {
|
||||||
|
|
@ -111,41 +112,18 @@ FocusScope{
|
||||||
Layout.topMargin: 10 * DefaultStyle.dp
|
Layout.topMargin: 10 * DefaultStyle.dp
|
||||||
content: [
|
content: [
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 8 * DefaultStyle.dp
|
|
||||||
EffectImage {
|
EffectImage {
|
||||||
imageSource: AppIcons.clock
|
imageSource: AppIcons.clock
|
||||||
|
colorizationColor: DefaultStyle.main2_600
|
||||||
Layout.preferredWidth: 24 * DefaultStyle.dp
|
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||||
Layout.preferredHeight: 24 * DefaultStyle.dp
|
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||||
colorizationColor: DefaultStyle.main2_600
|
|
||||||
}
|
}
|
||||||
Text {
|
|
||||||
text: qsTr("Toute la journée")
|
|
||||||
font {
|
|
||||||
pixelSize: 14 * DefaultStyle.dp
|
|
||||||
weight: 700 * 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 {
|
CalendarComboBox {
|
||||||
id: startDate
|
id: startDate
|
||||||
background.visible: mainItem.isCreation
|
background.visible: mainItem.isCreation
|
||||||
indicator.visible: mainItem.isCreation
|
indicator.visible: mainItem.isCreation
|
||||||
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
|
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
|
||||||
Layout.preferredWidth: 200 * DefaultStyle.dp
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 30 * DefaultStyle.dp
|
Layout.preferredHeight: 30 * DefaultStyle.dp
|
||||||
KeyNavigation.up: allDaySwitch
|
KeyNavigation.up: allDaySwitch
|
||||||
KeyNavigation.down: endDate
|
KeyNavigation.down: endDate
|
||||||
|
|
@ -161,7 +139,14 @@ FocusScope{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item{Layout.fillWidth: true}
|
},
|
||||||
|
RowLayout {
|
||||||
|
Item {
|
||||||
|
Layout.preferredWidth: 24 * DefaultStyle.dp
|
||||||
|
Layout.preferredHeight: 24 * DefaultStyle.dp
|
||||||
|
}
|
||||||
|
RowLayout {
|
||||||
|
visible: allDaySwitch.position === 0
|
||||||
TimeComboBox {
|
TimeComboBox {
|
||||||
id: startHour
|
id: startHour
|
||||||
visible: allDaySwitch.position === 0
|
visible: allDaySwitch.position === 0
|
||||||
|
|
@ -175,31 +160,14 @@ FocusScope{
|
||||||
KeyNavigation.down: endDate
|
KeyNavigation.down: endDate
|
||||||
KeyNavigation.left: startDate
|
KeyNavigation.left: startDate
|
||||||
KeyNavigation.right: startDate
|
KeyNavigation.right: startDate
|
||||||
onSelectedHourChanged: {
|
onSelectedDateTimeChanged: {
|
||||||
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
|
endHour.minTime = selectedDateTime
|
||||||
|
endHour.maxTime = UtilsCpp.createDateTime(selectedDateTime, 23, 59)
|
||||||
|
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime
|
||||||
endDate.calendar.selectedDate = UtilsCpp.addSecs(selectedDateTime, 3600)
|
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")
|
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)
|
||||||
}
|
|
||||||
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 {
|
TimeComboBox {
|
||||||
id: endHour
|
id: endHour
|
||||||
visible: allDaySwitch.position === 0
|
visible: allDaySwitch.position === 0
|
||||||
|
|
@ -208,10 +176,55 @@ FocusScope{
|
||||||
Layout.preferredHeight: 30 * DefaultStyle.dp
|
Layout.preferredHeight: 30 * DefaultStyle.dp
|
||||||
background.visible: mainItem.isCreation
|
background.visible: mainItem.isCreation
|
||||||
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
|
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
|
||||||
onSelectedHourChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
|
onSelectedDateTimeChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime
|
||||||
onSelectedMinChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime//UtilsCpp.createDateTime(startDate.selectedDate, selectedHour, selectedMin)
|
}
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
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 {
|
ComboBox {
|
||||||
id: timeZoneCbox
|
id: timeZoneCbox
|
||||||
|
|
@ -359,4 +372,5 @@ FocusScope{
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.minimumHeight: 1 * DefaultStyle.dp
|
Layout.minimumHeight: 1 * DefaultStyle.dp
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,25 @@ import UtilsCpp 1.0
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
property var selectedDateTime
|
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")
|
readonly property string selectedTimeString: Qt.formatDateTime(selectedDateTime, "hh:mm")
|
||||||
property int selectedHour: input.hour*1
|
property int selectedHour: input.hour*1
|
||||||
property int selectedMin: input.min*1
|
property int selectedMin: input.min*1
|
||||||
property alias contentText: input
|
property alias contentText: input
|
||||||
|
property var minTime
|
||||||
|
property var maxTime
|
||||||
popup.width: 73 * DefaultStyle.dp
|
popup.width: 73 * DefaultStyle.dp
|
||||||
listView.model: 48
|
listView.model: 48
|
||||||
listView.implicitHeight: 204 * DefaultStyle.dp
|
listView.height: Math.min(204 * DefaultStyle.dp, listView.implicitHeight)
|
||||||
editable: true
|
editable: true
|
||||||
popup.closePolicy: Popup.PressOutsideParent | Popup.CloseOnPressOutside
|
popup.closePolicy: Popup.PressOutsideParent | Popup.CloseOnPressOutside
|
||||||
onCurrentTextChanged: input.text = currentText
|
onCurrentTextChanged: input.text = currentText
|
||||||
|
|
@ -48,18 +60,20 @@ ComboBox {
|
||||||
focus = false
|
focus = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onEditingFinished: {
|
onFocusChanged: if (!focus) {
|
||||||
console.log("set time", hour, min)
|
|
||||||
mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min)
|
mainItem.selectedDateTime = UtilsCpp.createDateTime(mainItem.selectedDateTime, hour, min)
|
||||||
|
console.log("set time", hour, min)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
listView.delegate: Text {
|
listView.delegate: Text {
|
||||||
id: hourDelegate
|
id: hourDelegate
|
||||||
property int hour: modelData /2
|
property int hour: modelData /2
|
||||||
property int min: modelData%2 === 0 ? 0 : 30
|
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
|
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
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
font {
|
font {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue