missed calls notification in navigation bar + fix notif ui
This commit is contained in:
parent
2459e5aba6
commit
0646040d25
11 changed files with 101 additions and 23 deletions
|
|
@ -112,6 +112,7 @@ void App::setSelf(QSharedPointer<App>(me)) {
|
||||||
new SafeConnection<App, CoreModel>(me, CoreModel::getInstance()), &QObject::deleteLater);
|
new SafeConnection<App, CoreModel>(me, CoreModel::getInstance()), &QObject::deleteLater);
|
||||||
mCoreModelConnection->makeConnectToModel(&CoreModel::callCreated,
|
mCoreModelConnection->makeConnectToModel(&CoreModel::callCreated,
|
||||||
[this](const std::shared_ptr<linphone::Call> &call) {
|
[this](const std::shared_ptr<linphone::Call> &call) {
|
||||||
|
if (call->getDir() == linphone::Call::Dir::Incoming) return;
|
||||||
auto callCore = CallCore::create(call);
|
auto callCore = CallCore::create(call);
|
||||||
mCoreModelConnection->invokeToCore([this, callCore] {
|
mCoreModelConnection->invokeToCore([this, callCore] {
|
||||||
auto callGui = new CallGui(callCore);
|
auto callGui = new CallGui(callCore);
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
|
||||||
&AccountModel::unreadNotificationsChanged, [this](int unreadMessagesCount, int unreadCallsCount) {
|
&AccountModel::unreadNotificationsChanged, [this](int unreadMessagesCount, int unreadCallsCount) {
|
||||||
mAccountModelConnection->invokeToCore([this, unreadMessagesCount, unreadCallsCount]() {
|
mAccountModelConnection->invokeToCore([this, unreadMessagesCount, unreadCallsCount]() {
|
||||||
this->setUnreadNotifications(unreadMessagesCount + unreadCallsCount);
|
this->setUnreadNotifications(unreadMessagesCount + unreadCallsCount);
|
||||||
|
this->setUnreadCallNotifications(unreadCallsCount);
|
||||||
|
this->setUnreadMessageNotifications(unreadMessagesCount);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -90,6 +92,9 @@ void AccountCore::setSelf(QSharedPointer<AccountCore> me) {
|
||||||
mAccountModelConnection->makeConnectToCore(&AccountCore::lSetDefaultAccount, [this]() {
|
mAccountModelConnection->makeConnectToCore(&AccountCore::lSetDefaultAccount, [this]() {
|
||||||
mAccountModelConnection->invokeToModel([this]() { mAccountModel->setDefault(); });
|
mAccountModelConnection->invokeToModel([this]() { mAccountModel->setDefault(); });
|
||||||
});
|
});
|
||||||
|
mAccountModelConnection->makeConnectToCore(&AccountCore::lResetMissedCalls, [this]() {
|
||||||
|
mAccountModelConnection->invokeToModel([this]() { mAccountModel->resetMissedCallsCount(); });
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AccountCore::getContactAddress() const {
|
QString AccountCore::getContactAddress() const {
|
||||||
|
|
@ -122,6 +127,26 @@ void AccountCore::setUnreadNotifications(int unread) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int AccountCore::getUnreadCallNotifications() const {
|
||||||
|
return mUnreadCallNotifications;
|
||||||
|
}
|
||||||
|
void AccountCore::setUnreadCallNotifications(int unread) {
|
||||||
|
if (mUnreadCallNotifications != unread) {
|
||||||
|
mUnreadCallNotifications = unread;
|
||||||
|
emit unreadNotificationsChanged(unread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int AccountCore::getUnreadMessageNotifications() const {
|
||||||
|
return mUnreadMessageNotifications;
|
||||||
|
}
|
||||||
|
void AccountCore::setUnreadMessageNotifications(int unread) {
|
||||||
|
if (mUnreadMessageNotifications != unread) {
|
||||||
|
mUnreadMessageNotifications = unread;
|
||||||
|
emit unreadNotificationsChanged(unread);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AccountCore::onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
void AccountCore::onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||||
linphone::RegistrationState state,
|
linphone::RegistrationState state,
|
||||||
const std::string &message) {
|
const std::string &message) {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ class AccountCore : public QObject, public AbstractObject {
|
||||||
LinphoneEnums::RegistrationState registrationState READ getRegistrationState NOTIFY registrationStateChanged)
|
LinphoneEnums::RegistrationState registrationState READ getRegistrationState NOTIFY registrationStateChanged)
|
||||||
Q_PROPERTY(bool isDefaultAccount READ getIsDefaultAccount NOTIFY defaultAccountChanged)
|
Q_PROPERTY(bool isDefaultAccount READ getIsDefaultAccount NOTIFY defaultAccountChanged)
|
||||||
Q_PROPERTY(int unreadNotifications READ getUnreadNotifications NOTIFY unreadNotificationsChanged)
|
Q_PROPERTY(int unreadNotifications READ getUnreadNotifications NOTIFY unreadNotificationsChanged)
|
||||||
|
Q_PROPERTY(int unreadCallNotifications READ getUnreadCallNotifications NOTIFY unreadNotificationsChanged)
|
||||||
|
Q_PROPERTY(int unreadMessageNotifications READ getUnreadMessageNotifications NOTIFY unreadNotificationsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
|
static QSharedPointer<AccountCore> create(const std::shared_ptr<linphone::Account> &account);
|
||||||
|
|
@ -53,6 +55,10 @@ public:
|
||||||
bool getIsDefaultAccount() const;
|
bool getIsDefaultAccount() const;
|
||||||
int getUnreadNotifications() const;
|
int getUnreadNotifications() const;
|
||||||
void setUnreadNotifications(int unread);
|
void setUnreadNotifications(int unread);
|
||||||
|
int getUnreadCallNotifications() const;
|
||||||
|
void setUnreadCallNotifications(int unread);
|
||||||
|
int getUnreadMessageNotifications() const;
|
||||||
|
void setUnreadMessageNotifications(int unread);
|
||||||
|
|
||||||
void onPictureUriChanged(QString uri);
|
void onPictureUriChanged(QString uri);
|
||||||
void onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
void onRegistrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||||
|
|
@ -71,6 +77,7 @@ signals:
|
||||||
// Account requests
|
// Account requests
|
||||||
void lSetPictureUri(QString pictureUri);
|
void lSetPictureUri(QString pictureUri);
|
||||||
void lSetDefaultAccount();
|
void lSetDefaultAccount();
|
||||||
|
void lResetMissedCalls();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mContactAddress;
|
QString mContactAddress;
|
||||||
|
|
@ -79,6 +86,8 @@ private:
|
||||||
bool mIsDefaultAccount = false;
|
bool mIsDefaultAccount = false;
|
||||||
LinphoneEnums::RegistrationState mRegistrationState;
|
LinphoneEnums::RegistrationState mRegistrationState;
|
||||||
int mUnreadNotifications = 0;
|
int mUnreadNotifications = 0;
|
||||||
|
int mUnreadCallNotifications = 0;
|
||||||
|
int mUnreadMessageNotifications = 0;
|
||||||
std::shared_ptr<AccountModel> mAccountModel;
|
std::shared_ptr<AccountModel> mAccountModel;
|
||||||
QSharedPointer<SafeConnection<AccountCore, AccountModel>> mAccountModelConnection;
|
QSharedPointer<SafeConnection<AccountCore, AccountModel>> mAccountModelConnection;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,3 +89,9 @@ void AccountModel::setDefault() {
|
||||||
void AccountModel::removeAccount() {
|
void AccountModel::removeAccount() {
|
||||||
CoreModel::getInstance()->getCore()->removeAccount(mMonitor);
|
CoreModel::getInstance()->getCore()->removeAccount(mMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountModel::resetMissedCallsCount() {
|
||||||
|
mMonitor->resetMissedCallsCount();
|
||||||
|
emit unreadNotificationsChanged(0 /*mMonitor->getUnreadChatMessageCount()*/,
|
||||||
|
mMonitor->getMissedCallsCount()); // TODO
|
||||||
|
}
|
||||||
|
|
@ -43,6 +43,7 @@ public:
|
||||||
void setPictureUri(QString uri);
|
void setPictureUri(QString uri);
|
||||||
void setDefault();
|
void setDefault();
|
||||||
void removeAccount();
|
void removeAccount();
|
||||||
|
void resetMissedCallsCount();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
void registrationStateChanged(const std::shared_ptr<linphone::Account> &account,
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@ void Utils::openCallsWindow(CallGui *call) {
|
||||||
QQuickWindow *Utils::getCallsWindow(CallGui *callGui) {
|
QQuickWindow *Utils::getCallsWindow(CallGui *callGui) {
|
||||||
auto app = App::getInstance();
|
auto app = App::getInstance();
|
||||||
auto window = app->getCallsWindow(QVariant::fromValue(callGui));
|
auto window = app->getCallsWindow(QVariant::fromValue(callGui));
|
||||||
smartShowWindow(window);
|
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,12 +121,14 @@ Item {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: 82 * DefaultStyle.dp
|
Layout.preferredWidth: 82 * DefaultStyle.dp
|
||||||
model: [
|
model: [
|
||||||
{icon: AppIcons.phone, selectedIcon: AppIcons.phoneSelected, label: qsTr("Appels")},
|
{icon: AppIcons.phone, selectedIcon: AppIcons.phoneSelected, label: qsTr("Appels"), unreadNotifications: accountProxy.defaultAccount.core.unreadCallNotifications},
|
||||||
{icon: AppIcons.adressBook, selectedIcon: AppIcons.adressBookSelected, label: qsTr("Contacts")},
|
{icon: AppIcons.adressBook, selectedIcon: AppIcons.adressBookSelected, label: qsTr("Contacts"), unreadNotifications: 0},
|
||||||
{icon: AppIcons.chatTeardropText, selectedIcon: AppIcons.chatTeardropTextSelected, label: qsTr("Conversations")},
|
{icon: AppIcons.chatTeardropText, selectedIcon: AppIcons.chatTeardropTextSelected, label: qsTr("Conversations"), unreadNotifications: accountProxy.defaultAccount.core.unreadMessageNotifications},
|
||||||
{icon: AppIcons.videoconference, selectedIcon: AppIcons.videoconferenceSelected, label: qsTr("Réunions")}
|
{icon: AppIcons.videoconference, selectedIcon: AppIcons.videoconferenceSelected, label: qsTr("Réunions"), unreadNotifications: 0}
|
||||||
]
|
]
|
||||||
|
onCurrentIndexChanged: {
|
||||||
|
if (currentIndex === 0) accountProxy.defaultAccount.core.lResetMissedCalls()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing:0
|
spacing:0
|
||||||
|
|
|
||||||
|
|
@ -96,22 +96,20 @@ Rectangle{
|
||||||
: qsTr("Erreur")
|
: qsTr("Erreur")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Item {
|
||||||
|
// Layout.fillWidth: true
|
||||||
|
// }
|
||||||
Item{
|
Item{
|
||||||
Layout.fillWidth: true
|
Layout.preferredWidth: 27 * DefaultStyle.dp
|
||||||
}
|
Layout.preferredHeight: 27 * DefaultStyle.dp
|
||||||
Item{
|
|
||||||
Layout.preferredWidth: 22 * DefaultStyle.dp
|
|
||||||
Layout.preferredHeight: 22 * DefaultStyle.dp
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id: unreadNotifications
|
id: unreadNotifications
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 10 * DefaultStyle.dp
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
property int unread: mainItem.account.core.unreadNotifications
|
property int unread: mainItem.account.core.unreadNotifications
|
||||||
visible: unread > 0
|
visible: unread > 0
|
||||||
width: 22 * DefaultStyle.dp
|
width: 27 * DefaultStyle.dp
|
||||||
height: 22 * DefaultStyle.dp
|
height: 27 * DefaultStyle.dp
|
||||||
radius: width/2
|
radius: width/2
|
||||||
color: DefaultStyle.danger_500main
|
color: DefaultStyle.danger_500main
|
||||||
border.color: DefaultStyle.grey_0
|
border.color: DefaultStyle.grey_0
|
||||||
|
|
@ -125,10 +123,18 @@ Rectangle{
|
||||||
color: DefaultStyle.grey_0
|
color: DefaultStyle.grey_0
|
||||||
minimumPixelSize: 5
|
minimumPixelSize: 5
|
||||||
fontSizeMode: Text.Fit
|
fontSizeMode: Text.Fit
|
||||||
font.pixelSize: 20 * DefaultStyle.dp
|
font.pixelSize: 11 * DefaultStyle.dp
|
||||||
text: parent.unread > 100 ? '+' : parent.unread
|
font.weight: 700 * DefaultStyle.dp
|
||||||
|
text: parent.unread > 100 ? '99+' : parent.unread
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
MultiEffect {
|
||||||
|
anchors.fill: unreadNotifications
|
||||||
|
source: unreadNotifications
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowBlur: 0.1
|
||||||
|
shadowOpacity: 0.15
|
||||||
|
}
|
||||||
}
|
}
|
||||||
EffectImage {
|
EffectImage {
|
||||||
id: manageAccount
|
id: manageAccount
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ ListView {
|
||||||
property string searchBarText
|
property string searchBarText
|
||||||
property bool hoverEnabled: true
|
property bool hoverEnabled: true
|
||||||
property var delegateButtons
|
property var delegateButtons
|
||||||
property ConferenceInfoGui selectedConference: currentIndex != -1 ? model.getAt(currentIndex) : null
|
property ConferenceInfoGui selectedConference: model && currentIndex != -1 ? model.getAt(currentIndex) : null
|
||||||
|
|
||||||
spacing: 8 * DefaultStyle.dp
|
spacing: 8 * DefaultStyle.dp
|
||||||
currentIndex: confInfoProxy.currentDateIndex
|
currentIndex: confInfoProxy.currentDateIndex
|
||||||
|
|
||||||
onCountChanged: selectedConference = currentIndex != -1 ? model.getAt(currentIndex) : null
|
onCountChanged: selectedConference = model && currentIndex != -1 ? model.getAt(currentIndex) : null
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
selectedConference = model.getAt(currentIndex)
|
selectedConference = model.getAt(currentIndex)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,26 @@ Control.TabBar {
|
||||||
property var model
|
property var model
|
||||||
readonly property alias cornerRadius: bottomLeftCorner.radius
|
readonly property alias cornerRadius: bottomLeftCorner.radius
|
||||||
|
|
||||||
|
component UnreadNotification: Rectangle {
|
||||||
|
id: unreadNotifications
|
||||||
|
property int unread: 0
|
||||||
|
visible: unread > 0
|
||||||
|
width: 15 * DefaultStyle.dp
|
||||||
|
height: 15 * DefaultStyle.dp
|
||||||
|
radius: width/2
|
||||||
|
color: DefaultStyle.danger_500main
|
||||||
|
Text{
|
||||||
|
id: unreadCount
|
||||||
|
anchors.fill: parent
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
color: DefaultStyle.grey_0
|
||||||
|
fontSizeMode: Text.Fit
|
||||||
|
font.pixelSize: 15 * DefaultStyle.dp
|
||||||
|
text: parent.unread > 100 ? '99+' : parent.unread
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
contentItem: ListView {
|
contentItem: ListView {
|
||||||
model: mainItem.contentModel
|
model: mainItem.contentModel
|
||||||
currentIndex: mainItem.currentIndex
|
currentIndex: mainItem.currentIndex
|
||||||
|
|
@ -61,6 +81,12 @@ Control.TabBar {
|
||||||
id: tabButton
|
id: tabButton
|
||||||
width: mainItem.width
|
width: mainItem.width
|
||||||
|
|
||||||
|
UnreadNotification {
|
||||||
|
unread: modelData.unreadNotifications
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: 15 * DefaultStyle.dp
|
||||||
|
anchors.top: parent.top
|
||||||
|
}
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
// height: tabButton.height
|
// height: tabButton.height
|
||||||
// width: tabButton.width
|
// width: tabButton.width
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ AbstractMainPage {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
onLaunchCall: {
|
onLaunchCall: {
|
||||||
mainItem.createCall(UtilsCpp.generateLinphoneSipAddress(searchBar.text))
|
UtilsCpp.createCall(searchBar.text)
|
||||||
// TODO : auto completion instead of sip linphone
|
// TODO : auto completion instead of sip linphone
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -315,7 +315,10 @@ AbstractMainPage {
|
||||||
icon.width: 24 * DefaultStyle.dp
|
icon.width: 24 * DefaultStyle.dp
|
||||||
icon.height: 24 * DefaultStyle.dp
|
icon.height: 24 * DefaultStyle.dp
|
||||||
onClicked: {
|
onClicked: {
|
||||||
mainItem.createCall(modelData.core.remoteAddress)
|
if (modelData.core.isConference) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else UtilsCpp.createCall(modelData.core.remoteAddress)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -408,7 +411,7 @@ AbstractMainPage {
|
||||||
searchBarColor: DefaultStyle.grey_100
|
searchBarColor: DefaultStyle.grey_100
|
||||||
|
|
||||||
onCallButtonPressed: (address) => {
|
onCallButtonPressed: (address) => {
|
||||||
mainItem.createCall(address)
|
UtilsCpp.createCall(address)
|
||||||
// var window = UtilsCpp.getCallsWindow()
|
// var window = UtilsCpp.getCallsWindow()
|
||||||
}
|
}
|
||||||
onGroupCallCreationRequested: {
|
onGroupCallCreationRequested: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue