From 1cbdc96b30897947bae7ea6cf052e78550e7e123 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Sun, 1 Aug 2021 21:33:24 +0200 Subject: [PATCH] Colors/Images rework Remove Call and notices logs from db Delete empty chat rooms after requesting it Option of showing/hidding empty chat rooms Many fixes on notifications count, imdn states, synchronizations behaviors, mouse cursor, etc. Fix crashes Fix timeline times --- linphone-app/CMakeLists.txt | 14 +- linphone-app/src/app/App.cpp | 18 +- linphone-app/src/app/App.hpp | 20 +- .../src/app/providers/ImageProvider.cpp | 469 +++++----- linphone-app/src/components/Components.hpp | 7 +- .../components/chat-events/ChatCallModel.cpp | 4 + .../components/chat-events/ChatCallModel.hpp | 2 + .../chat-events/ChatMessageModel.cpp | 8 +- .../chat-events/ChatNoticeModel.cpp | 4 + .../chat-events/ChatNoticeModel.hpp | 1 + .../components/chat-room/ChatRoomModel.cpp | 58 +- .../components/chat-room/ChatRoomModel.hpp | 1 + .../src/components/core/CoreHandlers.cpp | 1 - .../src/components/core/CoreManager.cpp | 4 +- .../src/components/core/CoreManager.hpp | 3 +- .../AbstractEventCountNotifier.cpp | 2 +- .../AbstractEventCountNotifier.hpp | 2 +- .../src/components/notifier/Notifier.cpp | 2 + .../other/colors/ColorListModel.cpp | 158 ++++ .../other/colors/ColorListModel.hpp | 139 +++ .../components/other/colors/ColorModel.cpp | 70 ++ .../components/other/colors/ColorModel.hpp | 63 ++ .../other/colors/ColorProxyModel.cpp | 54 ++ .../colors/ColorProxyModel.hpp} | 46 +- .../src/components/other/colors/Colors.cpp | 96 -- .../src/components/other/colors/Colors.hpp | 156 ---- .../other/images/ImageListModel.cpp | 154 ++++ .../other/images/ImageListModel.hpp | 73 ++ .../components/other/images/ImageModel.cpp | 75 ++ .../components/other/images/ImageModel.hpp | 64 ++ .../other/images/ImageProxyModel.cpp | 54 ++ .../images/ImageProxyModel.hpp} | 38 +- .../ParticipantImdnStateListModel.cpp | 10 +- .../participant/ParticipantModel.cpp | 3 +- .../participant/ParticipantProxyModel.cpp | 5 +- .../settings/AccountSettingsModel.cpp | 575 ++++++------ .../settings/AccountSettingsModel.hpp | 1 + .../src/components/settings/SettingsModel.cpp | 11 + .../src/components/settings/SettingsModel.hpp | 6 + .../components/timeline/TimelineListModel.cpp | 8 +- .../src/components/timeline/TimelineModel.cpp | 6 +- .../src/components/timeline/TimelineModel.hpp | 1 + .../timeline/TimelineProxyModel.cpp | 4 + linphone-app/ui/dev-modules/Colors/Colors.qml | 42 - linphone-app/ui/dev-modules/Colors/qmldir | 7 - linphone-app/ui/dev-modules/Tools/Tools.qml | 8 - linphone-app/ui/dev-modules/Tools/qmldir | 7 - .../ui/modules/Common/Form/ActionButton.qml | 4 +- .../Common/Form/Buttons/TextButtonB.qml | 8 +- linphone-app/ui/modules/Common/Image/Icon.qml | 2 + .../Styles/Animations/BusyIndicatorStyle.qml | 4 +- .../Common/Styles/Dialog/DialogStyle.qml | 5 +- .../Form/Buttons/ExclusiveButtonsStyle.qml | 9 +- .../Form/Buttons/FileChooserButtonStyle.qml | 8 +- .../Styles/Form/Buttons/SmallButtonStyle.qml | 9 +- .../Styles/Form/Buttons/TextButtonAStyle.qml | 17 +- .../Styles/Form/Buttons/TextButtonBStyle.qml | 18 +- .../Common/Styles/Form/CheckBoxTextStyle.qml | 7 +- .../Common/Styles/Form/ComboBoxStyle.qml | 9 +- .../Styles/Form/CommonItemDelegateStyle.qml | 11 +- .../Styles/Form/DroppableTextAreaStyle.qml | 9 +- .../Styles/Form/Fields/NumericFieldStyle.qml | 7 +- .../Styles/Form/Fields/TextAreaFieldStyle.qml | 9 +- .../Styles/Form/Fields/TextFieldStyle.qml | 25 +- .../Common/Styles/Form/ListFormStyle.qml | 5 +- .../Form/Placements/FormHGroupStyle.qml | 3 +- .../Styles/Form/Placements/FormStyle.qml | 5 +- .../Styles/Form/Placements/FormTableStyle.qml | 3 +- .../Form/Placements/FormVGroupStyle.qml | 5 +- .../Common/Styles/Form/SearchBoxStyle.qml | 3 +- .../Common/Styles/Form/SliderStyle.qml | 13 +- .../Common/Styles/Form/SwitchStyle.qml | 54 +- .../Common/Styles/Form/Tab/TabButtonStyle.qml | 21 +- .../Styles/Form/Tab/TabContainerStyle.qml | 6 +- .../Styles/Form/TransparentTextInputStyle.qml | 9 +- .../Common/Styles/Indicators/VuMeterStyle.qml | 14 +- .../Styles/Menus/ApplicationMenuStyle.qml | 17 +- .../Styles/Menus/DropDownStaticMenuStyle.qml | 9 +- .../Common/Styles/Menus/MenuItemStyle.qml | 57 +- .../modules/Common/Styles/Menus/MenuStyle.qml | 13 +- .../Styles/Misc/ForceScrollBarStyle.qml | 10 +- .../modules/Common/Styles/Misc/PanedStyle.qml | 8 +- .../Common/Styles/Popup/PopupStyle.qml | 5 +- .../Common/Styles/Tooltip/TooltipStyle.qml | 5 +- .../Common/Styles/Window/WindowStyle.qml | 3 +- .../ui/modules/Linphone/Chat/Notice.qml | 1 - .../Linphone/Contact/ContactDescription.qml | 3 +- .../Linphone/Notifications/Notification.qml | 4 +- .../NotificationReceivedMessage.qml | 1 + .../Styles/Account/AccountStatusStyle.qml | 5 +- .../Linphone/Styles/Blocks/CardBlockStyle.qml | 5 +- .../Styles/Blocks/RequestBlockStyle.qml | 3 +- .../Styles/Calls/CallControlsStyle.qml | 3 +- .../Styles/Calls/CallStatisticsStyle.qml | 9 +- .../Linphone/Styles/Calls/CallsStyle.qml | 15 +- .../Styles/Calls/ConferenceControlsStyle.qml | 3 +- .../Linphone/Styles/Chat/ChatStyle.qml | 31 +- .../Styles/Codecs/CodecsViewerStyle.qml | 9 +- .../Linphone/Styles/Contact/AvatarStyle.qml | 5 +- .../Contact/ContactDescriptionStyle.qml | 7 +- .../Contact/ContactMessageCounterStyle.qml | 2 - .../Dialog/OnlineInstallerDialogStyle.qml | 9 +- .../Linphone/Styles/History/HistoryStyle.qml | 11 +- .../Styles/Menus/SipAddressesMenuStyle.qml | 9 +- .../Styles/Misc/MessageCounterStyle.qml | 3 +- .../Notifications/NotificationBasicStyle.qml | 3 +- .../NotificationReceivedFileMessageStyle.qml | 7 +- .../NotificationReceivedMessageStyle.qml | 7 +- .../Notifications/NotificationStyle.qml | 6 +- .../Styles/TelKeypad/TelKeypadStyle.qml | 13 +- .../Styles/Timeline/TimelineStyle.qml | 23 +- .../Styles/View/ParticipantsViewStyle.qml | 3 +- .../Styles/View/SipAddressesViewStyle.qml | 17 +- .../ui/modules/Linphone/Timeline/Timeline.qml | 2 +- .../Linphone/View/ParticipantsView.qml | 7 +- .../Linphone/View/SipAddressesView.qml | 7 +- linphone-app/ui/scripts/Utils/utils.js | 3 +- .../views/App/Calls/AbstractStartingCall.qml | 4 +- linphone-app/ui/views/App/Calls/Incall.qml | 858 +++++++++--------- .../ui/views/App/Main/Conversation.qml | 5 +- .../Main/Dialogs/AuthenticationRequest.qml | 2 +- .../App/Main/Dialogs/EphemeralChatRoom.qml | 3 +- .../views/App/Main/Dialogs/InfoChatRoom.qml | 2 +- .../views/App/Main/Dialogs/InfoEncryption.qml | 5 +- .../ui/views/App/Main/Dialogs/NewChatRoom.qml | 24 +- .../App/Main/Dialogs/ParticipantsDevices.qml | 42 +- linphone-app/ui/views/App/Main/MainWindow.qml | 4 +- .../views/App/Settings/SettingsCallsChat.qml | 641 ++++++------- .../ui/views/App/Styles/Calls/CallStyle.qml | 19 +- .../App/Styles/Calls/CallsWindowStyle.qml | 7 +- .../App/Styles/Calls/ConferenceStyle.qml | 3 +- .../Calls/Dialogs/ConferenceManagerStyle.qml | 3 +- .../ActivateAppSipAccountWithEmailStyle.qml | 3 +- ...ivateAppSipAccountWithPhoneNumberStyle.qml | 3 +- .../Assistant/AssistantAbstractViewStyle.qml | 5 +- .../Main/Assistant/AssistantHomeStyle.qml | 5 +- .../views/App/Styles/Main/AssistantStyle.qml | 4 +- .../App/Styles/Main/ContactEditStyle.qml | 9 +- .../views/App/Styles/Main/ContactsStyle.qml | 17 +- .../App/Styles/Main/ConversationStyle.qml | 13 +- .../App/Styles/Main/Dialogs/AboutStyle.qml | 9 +- .../Styles/Main/Dialogs/InfoChatRoomStyle.qml | 31 +- .../Main/Dialogs/InfoEncryptionStyle.qml | 17 +- .../App/Styles/Main/HistoryViewStyle.qml | 11 +- .../ui/views/App/Styles/Main/HomeStyle.qml | 3 +- .../App/Styles/Main/InviteFriendsStyle.qml | 3 +- .../views/App/Styles/Main/MainWindowStyle.qml | 5 +- .../Styles/Settings/SettingsAdvancedStyle.qml | 5 +- .../Styles/Settings/SettingsWindowStyle.qml | 3 +- 149 files changed, 2814 insertions(+), 2173 deletions(-) create mode 100644 linphone-app/src/components/other/colors/ColorListModel.cpp create mode 100644 linphone-app/src/components/other/colors/ColorListModel.hpp create mode 100644 linphone-app/src/components/other/colors/ColorModel.cpp create mode 100644 linphone-app/src/components/other/colors/ColorModel.hpp create mode 100644 linphone-app/src/components/other/colors/ColorProxyModel.cpp rename linphone-app/src/components/{chat-message/ChatMessageModel.hpp => other/colors/ColorProxyModel.hpp} (53%) delete mode 100644 linphone-app/src/components/other/colors/Colors.cpp delete mode 100644 linphone-app/src/components/other/colors/Colors.hpp create mode 100644 linphone-app/src/components/other/images/ImageListModel.cpp create mode 100644 linphone-app/src/components/other/images/ImageListModel.hpp create mode 100644 linphone-app/src/components/other/images/ImageModel.cpp create mode 100644 linphone-app/src/components/other/images/ImageModel.hpp create mode 100644 linphone-app/src/components/other/images/ImageProxyModel.cpp rename linphone-app/src/components/{chat-message/ChatMessageModel.cpp => other/images/ImageProxyModel.hpp} (61%) delete mode 100644 linphone-app/ui/dev-modules/Colors/Colors.qml delete mode 100644 linphone-app/ui/dev-modules/Colors/qmldir delete mode 100644 linphone-app/ui/dev-modules/Tools/Tools.qml delete mode 100644 linphone-app/ui/dev-modules/Tools/qmldir diff --git a/linphone-app/CMakeLists.txt b/linphone-app/CMakeLists.txt index 9924517dd..ef18d84a3 100644 --- a/linphone-app/CMakeLists.txt +++ b/linphone-app/CMakeLists.txt @@ -155,7 +155,12 @@ set(SOURCES src/components/ldap/LdapProxyModel.cpp src/components/notifier/Notifier.cpp src/components/other/clipboard/Clipboard.cpp - src/components/other/colors/Colors.cpp + src/components/other/colors/ColorModel.cpp + src/components/other/colors/ColorListModel.cpp + src/components/other/colors/ColorProxyModel.cpp + src/components/other/images/ImageModel.cpp + src/components/other/images/ImageListModel.cpp + src/components/other/images/ImageProxyModel.cpp src/components/other/text-to-speech/TextToSpeech.cpp src/components/other/units/Units.cpp src/components/participant/ParticipantModel.cpp @@ -250,7 +255,12 @@ set(HEADERS src/components/ldap/LdapProxyModel.hpp src/components/notifier/Notifier.hpp src/components/other/clipboard/Clipboard.hpp - src/components/other/colors/Colors.hpp + src/components/other/colors/ColorModel.hpp + src/components/other/colors/ColorListModel.hpp + src/components/other/colors/ColorProxyModel.hpp + src/components/other/images/ImageModel.hpp + src/components/other/images/ImageListModel.hpp + src/components/other/images/ImageProxyModel.hpp src/components/other/desktop-tools/DesktopTools.hpp src/components/other/text-to-speech/TextToSpeech.hpp src/components/other/units/Units.hpp diff --git a/linphone-app/src/app/App.cpp b/linphone-app/src/app/App.cpp index ac6e7ad91..c378af506 100644 --- a/linphone-app/src/app/App.cpp +++ b/linphone-app/src/app/App.cpp @@ -359,12 +359,13 @@ void App::initContentApp () { #ifndef Q_OS_MACOS mustBeIconified = mParser->isSet("iconified"); #endif // ifndef Q_OS_MACOS - - mColors = new Colors(this); + mColorListModel = new ColorListModel(); + mImageListModel = new ImageListModel(); } // Change colors if necessary. - mColors->useConfig(config); + mColorListModel->useConfig(config); + mImageListModel->useConfig(config); // Init core. CoreManager::init(this, Utils::coreStringToAppString(configPath)); @@ -395,6 +396,8 @@ void App::initContentApp () { mEngine->addImageProvider(ThumbnailProvider::ProviderId, new ThumbnailProvider()); mEngine->rootContext()->setContextProperty("applicationUrl", APPLICATION_URL); + mEngine->rootContext()->setContextProperty("Colors", mColorListModel->getQmlData()); + mEngine->rootContext()->setContextProperty("Images", mImageListModel->getQmlData()); registerTypes(); registerSharedTypes(); @@ -619,6 +622,8 @@ void App::registerTypes () { registerType("SearchSipAddressesProxyModel"); + registerType("ColorProxyModel"); + registerType("ImageProxyModel"); registerType("TimelineProxyModel"); registerType("ParticipantProxyModel"); registerType("SoundPlayer"); @@ -636,6 +641,8 @@ void App::registerTypes () { registerUncreatableType("ChatMessageModel"); registerUncreatableType("ChatNoticeModel"); registerUncreatableType("ChatRoomModel"); + registerUncreatableType("ColorModel"); + registerUncreatableType("ImageModel"); registerUncreatableType("ConferenceAddModel"); registerUncreatableType("ContactModel"); registerUncreatableType("ContactsImporterModel"); @@ -673,6 +680,7 @@ void App::registerSharedTypes () { registerSharedSingletonType("ContactsImporterListModel"); registerSharedSingletonType("LdapListModel"); registerSharedSingletonType("TimelineListModel"); +// registerSharedSingletonType("ColorCpp"); } void App::registerToolTypes () { @@ -684,12 +692,14 @@ void App::registerToolTypes () { registerToolType("Units"); registerToolType("ContactsImporterPluginsManager"); registerToolType("UtilsCpp"); + //registerToolType("ColorsCpp"); } void App::registerSharedToolTypes () { qInfo() << QStringLiteral("Registering shared tool types..."); - registerSharedToolType("Colors"); + //registerSharedToolType("Colors"); + //registerSharedToolType("ColorsCpp"); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/app/App.hpp b/linphone-app/src/app/App.hpp index d465f595d..2383e99d6 100644 --- a/linphone-app/src/app/App.hpp +++ b/linphone-app/src/app/App.hpp @@ -36,10 +36,12 @@ namespace linphone { class Config; } -class Colors; +class ColorListModel; class DefaultTranslator; +class ImageListModel; class Notifier; + class App : public SingleApplication { Q_OBJECT; @@ -74,9 +76,16 @@ public: return mNotifier; } - Colors *getColors () const { - return mColors; - } + ColorListModel *getColorListModel () const { + return mColorListModel; + } + ImageListModel *getImageListModel () const { + return mImageListModel; + } + + //static ColorListModel *getColorListModel () const { + //return App::getInstance()-getColorListModel(); + //} QSystemTrayIcon *getSystemTrayIcon () const { return mSystemTrayIcon; @@ -174,7 +183,8 @@ private: QQuickWindow *mCallsWindow = nullptr; QQuickWindow *mSettingsWindow = nullptr; - Colors *mColors = nullptr; + ColorListModel * mColorListModel; + ImageListModel * mImageListModel; QSystemTrayIcon *mSystemTrayIcon = nullptr; diff --git a/linphone-app/src/app/providers/ImageProvider.cpp b/linphone-app/src/app/providers/ImageProvider.cpp index 73db5e7e7..a12d39fbe 100644 --- a/linphone-app/src/app/providers/ImageProvider.cpp +++ b/linphone-app/src/app/providers/ImageProvider.cpp @@ -23,213 +23,217 @@ #include #include #include +#include #include "app/App.hpp" -#include "components/other/colors/Colors.hpp" #include "ImageProvider.hpp" +#include "components/other/colors/ColorListModel.hpp" +#include "components/other/colors/ColorModel.hpp" +#include "components/other/images/ImageListModel.hpp" +#include "components/other/images/ImageModel.hpp" // ============================================================================= using namespace std; namespace { - // Max image size in bytes. (100Kb) - constexpr qint64 MaxImageSize = 102400; +// Max image size in bytes. (100Kb) +constexpr qint64 MaxImageSize = 102400; } static void removeAttribute (QXmlStreamAttributes &readerAttributes, const QString &name) { - auto it = find_if(readerAttributes.cbegin(), readerAttributes.cend(), [&name](const QXmlStreamAttribute &attribute) { - return name == attribute.name() && !attribute.prefix().length(); - }); - if (it != readerAttributes.cend()) - readerAttributes.remove(int(distance(readerAttributes.cbegin(), it))); + auto it = find_if(readerAttributes.cbegin(), readerAttributes.cend(), [&name](const QXmlStreamAttribute &attribute) { + return name == attribute.name() && !attribute.prefix().length(); + }); + if (it != readerAttributes.cend()) + readerAttributes.remove(int(distance(readerAttributes.cbegin(), it))); } static QByteArray buildByteArrayAttribute (const QByteArray &name, const QByteArray &value) { - QByteArray attribute = name; - attribute.append("=\""); - attribute.append(value); - attribute.append("\" "); - return attribute; + QByteArray attribute = name; + attribute.append("=\""); + attribute.append(value); + attribute.append("\" "); + return attribute; } -static QByteArray parseFillAndStroke (QXmlStreamAttributes &readerAttributes, const Colors &colors) { - static QRegExp regex("^color-([^-]+)-(fill|stroke)$"); - - QByteArray attributes; - - for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) { - regex.indexIn(classValue.trimmed()); - if (Q_LIKELY(regex.pos() == -1)) - continue; - - const QStringList list = regex.capturedTexts(); - - const QVariant colorValue = colors.property(list[1].toStdString().c_str()); - if (Q_UNLIKELY(!colorValue.isValid())) { - qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]); - continue; - } - - removeAttribute(readerAttributes, list[2]); - attributes.append(buildByteArrayAttribute(list[2].toLatin1(), colorValue.value().name().toLatin1())); - } - - return attributes; +static QByteArray parseFillAndStroke (QXmlStreamAttributes &readerAttributes, const ColorListModel *colors) { + static QRegExp regex("^color-([^-]+)-(fill|stroke)$"); + + QByteArray attributes; + + for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) { + regex.indexIn(classValue.trimmed()); + if (Q_LIKELY(regex.pos() == -1)) + continue; + + const QStringList list = regex.capturedTexts(); + + const QVariant colorValue = colors->getQmlData()->value(list[1]); + if (Q_UNLIKELY(!colorValue.isValid())) { + qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]); + continue; + } + + removeAttribute(readerAttributes, list[2]); + attributes.append(buildByteArrayAttribute(list[2].toLatin1(), colorValue.value()->getColor().name().toLatin1())); + } + + return attributes; } -static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const Colors &colors) { - static QRegExp regex("^color-([^-]+)-style-(fill|stroke)$"); - - QByteArray attribute; - - QSet overrode; - for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) { - regex.indexIn(classValue.trimmed()); - if (Q_LIKELY(regex.pos() == -1)) - continue; - - const QStringList list = regex.capturedTexts(); - - overrode.insert(list[2]); - - const QVariant colorValue = colors.property(list[1].toStdString().c_str()); - if (Q_UNLIKELY(!colorValue.isValid())) { - qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]); - continue; - } - - attribute.append(list[2].toLatin1()); - attribute.append(":"); - attribute.append(colorValue.value().name().toLatin1()); - attribute.append(";"); - } - - const QByteArrayList styleValues = readerAttributes.value("style").toLatin1().split(';'); - for (const auto &styleValue : styleValues) { - const QByteArrayList list = styleValue.split(':'); - if (Q_UNLIKELY(list.length() > 0 && !overrode.contains(list[0]))) { - attribute.append(styleValue); - attribute.append(";"); - } - } - - removeAttribute(readerAttributes, "style"); - - if (attribute.length() > 0) { - attribute.prepend("style=\""); - attribute.append("\" "); - } - - return attribute; +static QByteArray parseStyle (QXmlStreamAttributes &readerAttributes, const ColorListModel *colors) { + static QRegExp regex("^color-([^-]+)-style-(fill|stroke)$"); + + QByteArray attribute; + + QSet overrode; + for (const auto &classValue : readerAttributes.value("class").toLatin1().split(' ')) { + regex.indexIn(classValue.trimmed()); + if (Q_LIKELY(regex.pos() == -1)) + continue; + + const QStringList list = regex.capturedTexts(); + + overrode.insert(list[2]); + + const QVariant colorValue = colors->getQmlData()->value(list[1]); + if (Q_UNLIKELY(!colorValue.isValid())) { + qWarning() << QStringLiteral("Color name `%1` does not exist.").arg(list[1]); + continue; + } + + attribute.append(list[2].toLatin1()); + attribute.append(":"); + attribute.append(colorValue.value()->getColor().name().toLatin1()); + attribute.append(";"); + } + + const QByteArrayList styleValues = readerAttributes.value("style").toLatin1().split(';'); + for (const auto &styleValue : styleValues) { + const QByteArrayList list = styleValue.split(':'); + if (Q_UNLIKELY(list.length() > 0 && !overrode.contains(list[0]))) { + attribute.append(styleValue); + attribute.append(";"); + } + } + + removeAttribute(readerAttributes, "style"); + + if (attribute.length() > 0) { + attribute.prepend("style=\""); + attribute.append("\" "); + } + + return attribute; } -static QByteArray parseAttributes (const QXmlStreamReader &reader, const Colors &colors) { - QXmlStreamAttributes readerAttributes = reader.attributes(); - - QByteArray attributes = parseFillAndStroke(readerAttributes, colors); - attributes.append(parseStyle(readerAttributes, colors)); - - for (const auto &attribute : readerAttributes) { - const QByteArray prefix = attribute.prefix().toLatin1(); - if (Q_UNLIKELY(prefix.length() > 0)) { - attributes.append(prefix); - attributes.append(":"); - } - - attributes.append( - buildByteArrayAttribute(attribute.name().toLatin1(), attribute.value().toLatin1()) - ); - } - - return attributes; +static QByteArray parseAttributes (const QXmlStreamReader &reader, const ColorListModel *colors) { + QXmlStreamAttributes readerAttributes = reader.attributes(); + + QByteArray attributes = parseFillAndStroke(readerAttributes, colors); + attributes.append(parseStyle(readerAttributes, colors)); + + for (const auto &attribute : readerAttributes) { + const QByteArray prefix = attribute.prefix().toLatin1(); + if (Q_UNLIKELY(prefix.length() > 0)) { + attributes.append(prefix); + attributes.append(":"); + } + + attributes.append( + buildByteArrayAttribute(attribute.name().toLatin1(), attribute.value().toLatin1()) + ); + } + + return attributes; } static QByteArray parseDeclarations (const QXmlStreamReader &reader) { - QByteArray declarations; - for (const auto &declaration : reader.namespaceDeclarations()) { - const QByteArray prefix = declaration.prefix().toLatin1(); - if (Q_UNLIKELY(prefix.length() > 0)) { - declarations.append("xmlns:"); - declarations.append(prefix); - } else - declarations.append("xmlns"); - - declarations.append("=\""); - declarations.append(declaration.namespaceUri().toLatin1()); - declarations.append("\" "); - } - - return declarations; + QByteArray declarations; + for (const auto &declaration : reader.namespaceDeclarations()) { + const QByteArray prefix = declaration.prefix().toLatin1(); + if (Q_UNLIKELY(prefix.length() > 0)) { + declarations.append("xmlns:"); + declarations.append(prefix); + } else + declarations.append("xmlns"); + + declarations.append("=\""); + declarations.append(declaration.namespaceUri().toLatin1()); + declarations.append("\" "); + } + + return declarations; } static QByteArray parseStartDocument (const QXmlStreamReader &reader) { - QByteArray startDocument = ""); - return startDocument; + QByteArray startDocument = ""); + return startDocument; } -static QByteArray parseStartElement (const QXmlStreamReader &reader, const Colors &colors) { - QByteArray startElement = "<"; - startElement.append(reader.name().toLatin1()); - startElement.append(" "); - startElement.append(parseAttributes(reader, colors)); - startElement.append(" "); - startElement.append(parseDeclarations(reader)); - startElement.append(">"); - return startElement; +static QByteArray parseStartElement (const QXmlStreamReader &reader, const ColorListModel *colors) { + QByteArray startElement = "<"; + startElement.append(reader.name().toLatin1()); + startElement.append(" "); + startElement.append(parseAttributes(reader, colors)); + startElement.append(" "); + startElement.append(parseDeclarations(reader)); + startElement.append(">"); + return startElement; } static QByteArray parseEndElement (const QXmlStreamReader &reader) { - QByteArray endElement = ""); - return endElement; + QByteArray endElement = ""); + return endElement; } // ----------------------------------------------------------------------------- static QByteArray computeContent (QFile &file) { - const Colors *colors = App::getInstance()->getColors(); - - QByteArray content; - QXmlStreamReader reader(&file); - while (!reader.atEnd()) - switch (reader.readNext()) { - case QXmlStreamReader::Comment: - case QXmlStreamReader::DTD: - case QXmlStreamReader::EndDocument: - case QXmlStreamReader::Invalid: - case QXmlStreamReader::NoToken: - case QXmlStreamReader::ProcessingInstruction: - break; - - case QXmlStreamReader::StartDocument: - content.append(parseStartDocument(reader)); - break; - - case QXmlStreamReader::StartElement: - content.append(parseStartElement(reader, *colors)); - break; - - case QXmlStreamReader::EndElement: - content.append(parseEndElement(reader)); - break; - - case QXmlStreamReader::Characters: - content.append(reader.text().toLatin1()); - break; - - case QXmlStreamReader::EntityReference: - content.append(reader.name().toLatin1()); - break; - } - - return reader.hasError() ? QByteArray() : content; + const ColorListModel *colors = App::getInstance()->getColorListModel(); + + QByteArray content; + QXmlStreamReader reader(&file); + while (!reader.atEnd()) + switch (reader.readNext()) { + case QXmlStreamReader::Comment: + case QXmlStreamReader::DTD: + case QXmlStreamReader::EndDocument: + case QXmlStreamReader::Invalid: + case QXmlStreamReader::NoToken: + case QXmlStreamReader::ProcessingInstruction: + break; + + case QXmlStreamReader::StartDocument: + content.append(parseStartDocument(reader)); + break; + + case QXmlStreamReader::StartElement: + content.append(parseStartElement(reader, colors)); + break; + + case QXmlStreamReader::EndElement: + content.append(parseEndElement(reader)); + break; + + case QXmlStreamReader::Characters: + content.append(reader.text().toLatin1()); + break; + + case QXmlStreamReader::EntityReference: + content.append(reader.name().toLatin1()); + break; + } + + return reader.hasError() ? QByteArray() : content; } // ----------------------------------------------------------------------------- @@ -237,70 +241,79 @@ static QByteArray computeContent (QFile &file) { const QString ImageProvider::ProviderId = "internal"; ImageProvider::ImageProvider () : QQuickImageProvider( - QQmlImageProviderBase::Image, - QQmlImageProviderBase::ForceAsynchronousImageLoading -) {} + QQmlImageProviderBase::Image, + QQmlImageProviderBase::ForceAsynchronousImageLoading + ) {} // ----------------------------------------------------------------------------- QImage ImageProvider::requestImage (const QString &id, QSize *size, const QSize &requestedSize) { - const QString path = QStringLiteral(":%1").arg(id); -// qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).") -// .arg(path).arg(requestedSize.width()).arg(requestedSize.height()); - - QElapsedTimer timer; - timer.start(); - - // 1. Read and update XML content. - *size = QSize(); - QFile file(path); - if (Q_UNLIKELY(QFileInfo(file).size() > MaxImageSize)) { - qWarning() << QStringLiteral("Unable to open large file: `%1`.").arg(path); - return QImage(); - } - - if (Q_UNLIKELY(!file.open(QIODevice::ReadOnly))) { - qWarning() << QStringLiteral("Unable to open file: `%1`.").arg(path); - return QImage(); - } - - const QByteArray content = computeContent(file); - if (Q_UNLIKELY(!content.length())) { - qWarning() << QStringLiteral("Unable to parse file: `%1`.").arg(path); - return QImage(); - } - - // 2. Build svg renderer. - QSvgRenderer renderer(content); - if (Q_UNLIKELY(!renderer.isValid())) { - qWarning() << QStringLiteral("Invalid svg file: `%1`.").arg(path); - return QImage(); - } - - QSize askedSize = !requestedSize.isEmpty() - ? requestedSize - : renderer.defaultSize() * QGuiApplication::primaryScreen()->devicePixelRatio(); - - // 3. Create image. - QImage image(askedSize, QImage::Format_ARGB32_Premultiplied); - if (Q_UNLIKELY(image.isNull())) { - qWarning() << QStringLiteral("Unable to create image from path: `%1`.") - .arg(path); - return QImage(); // Memory cannot be allocated. - } - image.fill(Qt::transparent);// Fill with transparent to set alpha channel - - *size = image.size(); - - // 4. Paint! - QPainter painter(&image); - renderer.render(&painter); - -// qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed()); - - return image; + ImageModel * model = App::getInstance()->getImageListModel()->getImageModel(id); + if(!model) + return QImage(); + const QString path = model->getPath(); + //qDebug() << QStringLiteral("Image `%1` requested with size: (%2, %3).") + // .arg(path).arg(requestedSize.width()).arg(requestedSize.height()); + + QElapsedTimer timer; + timer.start(); + + // 1. Read and update XML content. + *size = QSize(); + QFile file(path); + + if(!file.exists()){ + qWarning() << QStringLiteral("File doesn't exist: `%1`.").arg(path); + return QImage(); + } + + if (Q_UNLIKELY(QFileInfo(file).size() > MaxImageSize)) { + qWarning() << QStringLiteral("Unable to open large file: `%1`.").arg(path); + return QImage(); + } + + if (Q_UNLIKELY(!file.open(QIODevice::ReadOnly))) { + qWarning() << QStringLiteral("Unable to open file: `%1`.").arg(path); + return QImage(); + } + + const QByteArray content = computeContent(file); + if (Q_UNLIKELY(!content.length())) { + qWarning() << QStringLiteral("Unable to parse file: `%1`.").arg(path); + return QImage(); + } + + // 2. Build svg renderer. + QSvgRenderer renderer(content); + if (Q_UNLIKELY(!renderer.isValid())) { + qWarning() << QStringLiteral("Invalid svg file: `%1`.").arg(path); + return QImage(); + } + + QSize askedSize = !requestedSize.isEmpty() + ? requestedSize + : renderer.defaultSize() * QGuiApplication::primaryScreen()->devicePixelRatio(); + + // 3. Create image. + QImage image(askedSize, QImage::Format_ARGB32_Premultiplied); + if (Q_UNLIKELY(image.isNull())) { + qWarning() << QStringLiteral("Unable to create image from path: `%1`.") + .arg(path); + return QImage(); // Memory cannot be allocated. + } + image.fill(Qt::transparent);// Fill with transparent to set alpha channel + + *size = image.size(); + + // 4. Paint! + QPainter painter(&image); + renderer.render(&painter); + + // qDebug() << QStringLiteral("Image `%1` loaded in %2 milliseconds.").arg(path).arg(timer.elapsed()); + + return image; } QPixmap ImageProvider::requestPixmap (const QString &id, QSize *size, const QSize &requestedSize) { - return QPixmap::fromImage(requestImage(id, size, requestedSize)); + return QPixmap::fromImage(requestImage(id, size, requestedSize)); } diff --git a/linphone-app/src/components/Components.hpp b/linphone-app/src/components/Components.hpp index 8d626a259..1eb47f2e9 100644 --- a/linphone-app/src/components/Components.hpp +++ b/linphone-app/src/components/Components.hpp @@ -77,9 +77,14 @@ #include "timeline/TimelineListModel.hpp" #include "url-handlers/UrlHandlers.hpp" -#include "other/colors/Colors.hpp" +#include "other/colors/ColorModel.hpp" +#include "other/colors/ColorListModel.hpp" +#include "other/colors/ColorProxyModel.hpp" #include "other/clipboard/Clipboard.hpp" #include "other/desktop-tools/DesktopTools.hpp" +#include "other/images/ImageModel.hpp" +#include "other/images/ImageListModel.hpp" +#include "other/images/ImageProxyModel.hpp" #include "other/text-to-speech/TextToSpeech.hpp" #include "other/units/Units.hpp" diff --git a/linphone-app/src/components/chat-events/ChatCallModel.cpp b/linphone-app/src/components/chat-events/ChatCallModel.cpp index 6ea663675..d0444c6ba 100644 --- a/linphone-app/src/components/chat-events/ChatCallModel.cpp +++ b/linphone-app/src/components/chat-events/ChatCallModel.cpp @@ -21,6 +21,7 @@ #include #include "app/App.hpp" +#include "components/core/CoreManager.hpp" #include "ChatCallModel.hpp" @@ -78,4 +79,7 @@ void ChatCallModel::setIsOutgoing(const bool& data){ bool ChatCallModel::update(){ setIsOutgoing(mCallLog->getDir() == linphone::Call::Dir::Outgoing); setStatus(LinphoneEnums::fromLinphone(mCallLog->getStatus())); +} +void ChatCallModel::deleteEvent(){ + CoreManager::getInstance()->getCore()->removeCallLog(mCallLog); } \ No newline at end of file diff --git a/linphone-app/src/components/chat-events/ChatCallModel.hpp b/linphone-app/src/components/chat-events/ChatCallModel.hpp index d3b648900..72b40888f 100644 --- a/linphone-app/src/components/chat-events/ChatCallModel.hpp +++ b/linphone-app/src/components/chat-events/ChatCallModel.hpp @@ -50,6 +50,8 @@ public: bool update(); + virtual void deleteEvent() override; + bool mIsStart; LinphoneEnums::CallStatus mStatus; bool mIsOutgoing; diff --git a/linphone-app/src/components/chat-events/ChatMessageModel.cpp b/linphone-app/src/components/chat-events/ChatMessageModel.cpp index 0d2b18a83..6219f3b4e 100644 --- a/linphone-app/src/components/chat-events/ChatMessageModel.cpp +++ b/linphone-app/src/components/chat-events/ChatMessageModel.cpp @@ -147,13 +147,7 @@ void ContentModel::createThumbnail () { auto chatMessageFileContentModel = mChatMessageModel->getFileContentModel(); if( chatMessageFileContentModel && chatMessageFileContentModel->getContent() == mContent){ QString id; - auto a = chatMessageFileContentModel->getContent(); - auto b = mChatMessageModel->getChatMessage()->getFileTransferInformation(); - if( a == b) - qWarning() << "OK"; - else - qWarning() << "NOOOOOOOOOO"; - QString path = Utils::coreStringToAppString(b->getFilePath()); + QString path = Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getFileTransferInformation()->getFilePath()); auto appdata = ChatMessageModel::AppDataManager(Utils::coreStringToAppString(mChatMessageModel->getChatMessage()->getAppdata())); diff --git a/linphone-app/src/components/chat-events/ChatNoticeModel.cpp b/linphone-app/src/components/chat-events/ChatNoticeModel.cpp index f00060bd3..e76ae7010 100644 --- a/linphone-app/src/components/chat-events/ChatNoticeModel.cpp +++ b/linphone-app/src/components/chat-events/ChatNoticeModel.cpp @@ -137,4 +137,8 @@ void ChatNoticeModel::setEventLogType(const LinphoneEnums::EventLogType& data){ mEventLogType = data; emit eventLogTypeChanged(); } +} + +void ChatNoticeModel::deleteEvent(){ + mEventLog->deleteFromDatabase(); } \ No newline at end of file diff --git a/linphone-app/src/components/chat-events/ChatNoticeModel.hpp b/linphone-app/src/components/chat-events/ChatNoticeModel.hpp index 5bc8eb5fb..286c19ccc 100644 --- a/linphone-app/src/components/chat-events/ChatNoticeModel.hpp +++ b/linphone-app/src/components/chat-events/ChatNoticeModel.hpp @@ -55,6 +55,7 @@ public: void setEventLogType(const LinphoneEnums::EventLogType& data); bool update(); // Update data from eventLog + virtual void deleteEvent() override; QString mName; NoticeType mStatus; diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index 98b935652..cd39a9075 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -47,6 +47,7 @@ #include "components/core/CoreHandlers.hpp" #include "components/core/CoreManager.hpp" #include "components/notifier/Notifier.hpp" +#include "components/settings/AccountSettingsModel.hpp" #include "components/settings/SettingsModel.hpp" #include "components/participant/ParticipantModel.hpp" #include "components/participant/ParticipantListModel.hpp" @@ -95,21 +96,19 @@ ChatRoomModel::ChatRoomModel (std::shared_ptr chatRoom){ setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount()); setMissedCallsCount(0); - qWarning() << "Creation ChatRoom with unreadmessages: " << mChatRoom->getUnreadMessagesCount(); - // Get messages. mEntries.clear(); QElapsedTimer timer; timer.start(); - { - CoreHandlers *coreHandlers = mCoreHandlers.get(); - //QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &ChatRoomModel::handleMessageReceived); - QObject::connect(coreHandlers, &CoreHandlers::callCreated, this, &ChatRoomModel::handleCallCreated); - QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &ChatRoomModel::handleCallStateChanged); - QObject::connect(coreHandlers, &CoreHandlers::presenceStatusReceived, this, &ChatRoomModel::handlePresenceStatusReceived); + CoreHandlers *coreHandlers = mCoreHandlers.get(); + //QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &ChatRoomModel::handleMessageReceived); + QObject::connect(coreHandlers, &CoreHandlers::callCreated, this, &ChatRoomModel::handleCallCreated); + QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &ChatRoomModel::handleCallStateChanged); + QObject::connect(coreHandlers, &CoreHandlers::presenceStatusReceived, this, &ChatRoomModel::handlePresenceStatusReceived); //QObject::connect(coreHandlers, &CoreHandlers::isComposingChanged, this, &ChatRoomModel::handleIsComposingChanged); - } + + //QObject::connect(this, &ChatRoomModel::messageCountReset, coreManager, &CoreManager::eventCountChanged ); if(mChatRoom){ mParticipantListModel = std::make_shared(this); connect(mParticipantListModel.get(), &ParticipantListModel::participantsChanged, this, &ChatRoomModel::fullPeerAddressChanged); @@ -197,14 +196,13 @@ bool ChatRoomModel::removeRows (int row, int count, const QModelIndex &parent) { } void ChatRoomModel::removeAllEntries () { - qInfo() << QStringLiteral("Removing all chat entries of: (%1, %2).") + qInfo() << QStringLiteral("Removing all entries of: (%1, %2).") .arg(getPeerAddress()).arg(getLocalAddress()); beginResetModel(); for (auto &entry : mEntries) entry->deleteEvent(); mEntries.clear(); - endResetModel(); emit allEntriesRemoved(mSelf.lock()); emit focused();// Removing all entries is like having focus. Don't wait asynchronous events. @@ -356,6 +354,10 @@ bool ChatRoomModel::isMeAdmin() const{ return mChatRoom->getMe()->isAdmin(); } +bool ChatRoomModel::isCurrentProxy() const{ + return mChatRoom->getLocalAddress()->weakEqual(CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddress()); +} + bool ChatRoomModel::canHandleParticipants() const{ return mChatRoom->canHandleParticipants(); } @@ -501,6 +503,7 @@ void ChatRoomModel::resetMessageCount () { } setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount()); setMissedCallsCount(0); + CoreManager::getInstance()->updateUnreadMessageCount(); emit messageCountReset(); } } @@ -566,6 +569,7 @@ void ChatRoomModel::insertMessageAtEnd (const shared_ptr if(mIsInitialized){ std::shared_ptr model = ChatMessageModel::create(message, this); if(model){ + setUnreadMessagesCount(mChatRoom->getUnreadMessagesCount()); int row = mEntries.count(); beginInsertRows(QModelIndex(), row, row); mEntries << model; @@ -618,13 +622,15 @@ void ChatRoomModel::handlePresenceStatusReceived(std::shared_ptrgetNbParticipants() == 1){ auto participants = mChatRoom->getParticipants(); auto contact = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(QString::fromStdString((*participants.begin())->getAddress()->asString())); - auto friendsAddresses = contact->getVcardModel()->getSipAddresses(); - for(auto friendAddress = friendsAddresses.begin() ; !canUpdatePresence && friendAddress != friendsAddresses.end() ; ++friendAddress){ - shared_ptr lAddress = CoreManager::getInstance()->getCore()->interpretUrl( - Utils::appStringToCoreString(friendAddress->toString()) - ); - canUpdatePresence = lAddress->weakEqual(*itContactAddress); - } + if(contact){ + auto friendsAddresses = contact->getVcardModel()->getSipAddresses(); + for(auto friendAddress = friendsAddresses.begin() ; !canUpdatePresence && friendAddress != friendsAddresses.end() ; ++friendAddress){ + shared_ptr lAddress = CoreManager::getInstance()->getCore()->interpretUrl( + Utils::appStringToCoreString(friendAddress->toString()) + ); + canUpdatePresence = lAddress->weakEqual(*itContactAddress); + } + } } } if(canUpdatePresence) { @@ -639,7 +645,6 @@ void ChatRoomModel::handlePresenceStatusReceived(std::shared_ptr & chatRoom, const std::shared_ptr & remoteAddress, bool isComposing){ - //ContactModel * model = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString(remoteAddress->asString())); if(!isComposing) { auto it = mComposers.begin(); while(it != mComposers.end() && !it.key()->weakEqual(remoteAddress)) @@ -648,26 +653,23 @@ void ChatRoomModel::onIsComposingReceived(const std::shared_ptr & chatRoom, const std::shared_ptr & message){ - qWarning() << "M1"; setUnreadMessagesCount(chatRoom->getUnreadMessagesCount()); } void ChatRoomModel::onNewEvent(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "New Event" <<(int) eventLog->getType(); if( eventLog->getType() == linphone::EventLog::Type::ConferenceCallEnd ){ setMissedCallsCount(mMissedCallsCount+1); + setLastUpdateTime(QDateTime::fromMSecsSinceEpoch(chatRoom->getLastUpdateTime())); }else if( eventLog->getType() == linphone::EventLog::Type::ConferenceCreated ){ emit fullPeerAddressChanged(); } } void ChatRoomModel::onChatMessageReceived(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog) { - qWarning() << "M2"; auto message = eventLog->getChatMessage(); if(message){ insertMessageAtEnd(message); @@ -677,7 +679,6 @@ void ChatRoomModel::onChatMessageReceived(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "S1"; auto message = eventLog->getChatMessage(); if(message){ insertMessageAtEnd(message); @@ -687,7 +688,6 @@ void ChatRoomModel::onChatMessageSending(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "S2"; } void ChatRoomModel::onParticipantAdded(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ @@ -723,7 +723,6 @@ void ChatRoomModel::onSecurityEvent(const std::shared_ptr & if( e != events.end() ) insertNotice(*e); emit securityLevelChanged((int)chatRoom->getSecurityLevel()); - //emit securityEvent(chatRoom, eventLog); } void ChatRoomModel::onSubjectChanged(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog) { emit subjectChanged(getSubject()); @@ -742,7 +741,6 @@ void ChatRoomModel::onParticipantDeviceRemoved(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "onConferenceJoined"; auto events = chatRoom->getHistoryEvents(0); auto e = std::find(events.begin(), events.end(), eventLog); if(e != events.end() ) @@ -760,7 +758,6 @@ void ChatRoomModel::onConferenceJoined(const std::shared_ptr } void ChatRoomModel::onConferenceLeft(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "onConferenceLeft"; if( chatRoom->getState() != linphone::ChatRoom::State::Deleted) { auto events = chatRoom->getHistoryEvents(0); auto e = std::find(events.begin(), events.end(), eventLog); @@ -785,15 +782,12 @@ void ChatRoomModel::onEphemeralEvent(const std::shared_ptr & } void ChatRoomModel::onEphemeralMessageTimerStarted(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "onEphemeralMessageTimerStarted"; } void ChatRoomModel::onEphemeralMessageDeleted(const std::shared_ptr & chatRoom, const std::shared_ptr & eventLog){ - qWarning() << "onEphemeralMessageDeleted"; } void ChatRoomModel::onConferenceAddressGeneration(const std::shared_ptr & chatRoom){ - qWarning() << "onConferenceAddressGeneration"; } void ChatRoomModel::onParticipantRegistrationSubscriptionRequested(const std::shared_ptr & chatRoom, const std::shared_ptr & participantAddress){ @@ -805,7 +799,7 @@ void ChatRoomModel::onParticipantRegistrationUnsubscriptionRequested(const std:: } void ChatRoomModel::onChatMessageShouldBeStored(const std::shared_ptr & chatRoom, const std::shared_ptr & message){ - qWarning() << "onChatMessageShouldBeStored"; + } void ChatRoomModel::onChatMessageParticipantImdnStateChanged(const std::shared_ptr & chatRoom, const std::shared_ptr & message, const std::shared_ptr & state){ diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.hpp b/linphone-app/src/components/chat-room/ChatRoomModel.hpp index bbad57214..f43f0b3c9 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.hpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.hpp @@ -123,6 +123,7 @@ public: int getSecurityLevel() const; bool isGroupEnabled() const; bool isMeAdmin() const; + bool isCurrentProxy() const; // Return true if this chat room is Me() is the current proxy bool canHandleParticipants() const; bool getIsRemoteComposing () const; ParticipantListModel* getParticipants() const; diff --git a/linphone-app/src/components/core/CoreHandlers.cpp b/linphone-app/src/components/core/CoreHandlers.cpp index 6c886b9cb..7a8f979f6 100644 --- a/linphone-app/src/components/core/CoreHandlers.cpp +++ b/linphone-app/src/components/core/CoreHandlers.cpp @@ -106,7 +106,6 @@ void CoreHandlers::onChatRoomStateChanged( const std::shared_ptr & chatRoom, linphone::ChatRoom::State state ) { - qWarning() << "ChatRoomState : " << (int)state; emit chatRoomStateChanged(chatRoom, state); } diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 588b5e840..a90e0c00b 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -294,7 +294,9 @@ void CoreManager::forceRefreshRegisters () { qInfo() << QStringLiteral("Refresh registers."); mCore->refreshRegisters(); } - +void CoreManager::updateUnreadMessageCount(){ + mEventCountNotifier->updateUnreadMessageCount(); +} // ----------------------------------------------------------------------------- void CoreManager::sendLogs () const { diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index c58e9c080..02a20d79d 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -150,6 +150,7 @@ public: Q_INVOKABLE VcardModel *createDetachedVcardModel () const; Q_INVOKABLE void forceRefreshRegisters (); + void updateUnreadMessageCount(); Q_INVOKABLE void sendLogs () const; Q_INVOKABLE void cleanLogs () const; @@ -176,7 +177,7 @@ signals: void logsUploaded (const QString &url); - void eventCountChanged (int count); + void eventCountChanged (); private: CoreManager (QObject *parent, const QString &configPath); diff --git a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp index e80f7d37f..9fe2f4537 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp @@ -72,7 +72,7 @@ void AbstractEventCountNotifier::internalnotifyEventCount () { n = n > 99 ? 99 : n; notifyEventCount(CoreManager::getInstance()->getSettingsModel()->getChatEnabled() ? n : 0); - emit eventCountChanged(n); + emit eventCountChanged(); } // Get missed call from a chat (useful for showing bubbles on Timelines) diff --git a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp index 03680c97e..7d0ef85c5 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.hpp @@ -57,7 +57,7 @@ public: int getMissedCallCountFromLocal(const QString &localAddress) const;// Get missed call count from a chat (useful for showing bubbles on Timelines) signals: - void eventCountChanged (int count); + void eventCountChanged (); protected: virtual void notifyEventCount (int n) = 0; diff --git a/linphone-app/src/components/notifier/Notifier.cpp b/linphone-app/src/components/notifier/Notifier.cpp index 312b0c718..6617e64fc 100644 --- a/linphone-app/src/components/notifier/Notifier.cpp +++ b/linphone-app/src/components/notifier/Notifier.cpp @@ -286,6 +286,8 @@ void Notifier::notifyReceivedMessage (const shared_ptr &m void Notifier::notifyReceivedFileMessage (const shared_ptr &message) { QVariantMap map; + shared_ptr chatRoom(message->getChatRoom()); + map["timelineModel"].setValue(CoreManager::getInstance()->getTimelineListModel()->getTimeline(chatRoom, true).get()); map["fileUri"] = Utils::coreStringToAppString(message->getFileTransferInformation()->getFilePath()); if( Utils::getImage(map["fileUri"].toString()).isNull()) map["imageUri"] = ""; diff --git a/linphone-app/src/components/other/colors/ColorListModel.cpp b/linphone-app/src/components/other/colors/ColorListModel.cpp new file mode 100644 index 000000000..a73877eb4 --- /dev/null +++ b/linphone-app/src/components/other/colors/ColorListModel.cpp @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ColorListModel.hpp" + +#include + +#include +#include +#if LINPHONE_FRIDAY + #include +#endif // if LINPHONE_FRIDAY + + +#include "app/App.hpp" + + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" + +namespace { + constexpr char ColorsSection[] = "ui_colors"; +} + +// ============================================================================= + +ColorListModel::ColorListModel ( QObject *parent) : QAbstractListModel(parent) { + init(); +} + +int ColorListModel::rowCount (const QModelIndex &index) const{ + return mList.count(); +} + +QHash ColorListModel::roleNames () const { + QHash roles; + roles[Qt::DisplayRole] = "$color"; + return roles; +} + +QVariant ColorListModel::data (const QModelIndex &index, int role) const { + int row = index.row(); + + if (!index.isValid() || row < 0 || row >= mList.count()) + return QVariant(); + + //if (role == Qt::DisplayRole) + return QVariant::fromValue(mList[row].get()); + + //return QVariant(); +} + +void ColorListModel::add(std::shared_ptr color){ + int row = mList.count(); + beginInsertRows(QModelIndex(), row, row); + setProperty(color->getName().toStdString().c_str(), QVariant::fromValue(color.get())); + + mData.insert(color->getName(), QVariant::fromValue(color.get())); + mList << color; + + endInsertRows(); + resetInternalData(); +} + +bool ColorListModel::removeRow (int row, const QModelIndex &parent){ + return removeRows(row, 1, parent); +} + +bool ColorListModel::removeRows (int row, int count, const QModelIndex &parent) { + int limit = row + count - 1; + if (row < 0 || count < 0 || limit >= mList.count()) + return false; + beginRemoveRows(parent, row, limit); + + for (int i = 0; i < count; ++i) + mList.takeAt(row); + + endRemoveRows(); + return true; +} + +void ColorListModel::useConfig (const std::shared_ptr &config) { + #if LINPHONE_FRIDAY + if (!isLinphoneFriday()) + overrideColors(config); + #else + overrideColors(config); + #endif // if LINPHONE_FRIDAY +} + +QString ColorListModel::getNames(){ + QStringList names; + qWarning() << "A"; + const QMetaObject *info = metaObject(); + + for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) { + const QMetaProperty metaProperty = info->property(i); + const std::string colorName = metaProperty.name(); + names << QString::fromStdString(colorName); + } + return names.join(", "); +} + +QQmlPropertyMap * ColorListModel::getQmlData() { + return &mData; +} + +const QQmlPropertyMap * ColorListModel::getQmlData() const{ + return &mData; +} + +void ColorListModel::overrideColors (const std::shared_ptr &config) { + if (!config) + return; + for(auto color : mList){ + QString name = color->getName(); + const std::string colorValue = config->getString(ColorsSection, name.toStdString(), ""); + if(!colorValue.empty()){ + color->setColor(QColor(QString::fromStdString(colorValue))); + } + } +} + +//-------------------------------------------------------------------------------- +/* +std::shared_ptr ColorListModel::getImdnState(const std::shared_ptr & state){ + std::shared_ptr imdn; + auto imdnAddress = state->getParticipant()->getAddress(); + auto it = mList.begin(); + while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress)) + ++it; + if(it != mList.end()) + imdn = *it; + else{// Create the new one + imdn = std::make_shared(state); + add(imdn); + } + return imdn; +} +*/ +//-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/linphone-app/src/components/other/colors/ColorListModel.hpp b/linphone-app/src/components/other/colors/ColorListModel.hpp new file mode 100644 index 000000000..282079053 --- /dev/null +++ b/linphone-app/src/components/other/colors/ColorListModel.hpp @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef COLOR_LIST_MODEL_H_ +#define COLOR_LIST_MODEL_H_ + +// ============================================================================= +#include +#include +#include +#include +#include +#include + +#include "ColorModel.hpp" + +#define ADD_COLOR(COLOR, VALUE, DESCRIPTION) \ + color = std::make_shared(COLOR, VALUE, DESCRIPTION); \ + add(color); + +// Alpha is in percent. +#define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA, DESCRIPTION) \ + color = std::make_shared(COLOR + QString::number(ALPHA), mData[COLOR].value()->getColor().name(), DESCRIPTION); \ + color->setAlpha(ALPHA * 255 / 100); \ + add(color); + + +class ColorModel; + +class ColorListModel : public QAbstractListModel { + Q_OBJECT + void init() { + std::shared_ptr color; + ADD_COLOR("a", "transparent", "Generic transparent color.") + // Primary color for hovered items. + ADD_COLOR("b", "#D64D00", "Primary color for hovered items.") + + ADD_COLOR("c", "#CBCBCB", "Button pressed, separatos, fields.") + ADD_COLOR("d", "#5A585B", "") + ADD_COLOR("e", "#F3F3F3", "") + ADD_COLOR("f", "#E8E8E8", "") + ADD_COLOR("g", "#6B7A86", "SIP Address, Contact Text.") + ADD_COLOR("h", "#687680", "") + + // Primary color. + ADD_COLOR("i", "#FE5E00", "Primary color.") + + ADD_COLOR("j", "#4B5964", "Username, Background cancel button hovered.") + + // Popups, home, call, assistant and settings background. + ADD_COLOR("k", "#FFFFFF", "Popups, home, call, assistant and settings background.") + + ADD_COLOR("l", "#000000", "Generic Black color") + + // Primary color for clicked items. + ADD_COLOR("m", "#FF8600", "Primary color for clicked items.") + + ADD_COLOR("n", "#A1A1A1", "") + ADD_COLOR("o", "#D0D8DE", "Disabled button") + + ADD_COLOR("p", "#17A81A", "Progress bar.") + + ADD_COLOR("q", "#FFFFFF", "Fields, backgrounds and text color on some items") + + ADD_COLOR("r", "#909fab", "Background button normal.") + + ADD_COLOR("s", "#96be64", "Security") + + ADD_COLOR("t", "#C2C2C2", "Title Header") + ADD_COLOR("u", "#D2D2D2", "Menu border (message)") + ADD_COLOR("v", "#E7E7E7", "Menu pressed (message)") + ADD_COLOR("w", "#EDEDED", "Menu background (conversation)") + + // Field error. + ADD_COLOR("error", "#FF0000", "Error Generic button.") + + ADD_COLOR_WITH_ALPHA("g", 10, "") + ADD_COLOR_WITH_ALPHA("g", 20, "") + ADD_COLOR_WITH_ALPHA("g", 90, "") + ADD_COLOR_WITH_ALPHA("i", 30, "") + ADD_COLOR_WITH_ALPHA("l", 50, "") + ADD_COLOR_WITH_ALPHA("l", 80, "") + ADD_COLOR_WITH_ALPHA("q", 50, "") + } +public: + + ColorListModel (QObject *parent = nullptr); + + int rowCount (const QModelIndex &index = QModelIndex()) const override; + + virtual QHash roleNames () const override; + virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override; + + void useConfig (const std::shared_ptr &config); + + Q_INVOKABLE QString getNames(); + + QQmlPropertyMap * getQmlData(); + const QQmlPropertyMap * getQmlData() const; + + +signals: + void colorChanged(); + +private: + void add(std::shared_ptr imdn); + bool removeRow (int row, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; + + QList> mList; + + void overrideColors (const std::shared_ptr &config); + + QStringList getColorNames () const; + + QQmlPropertyMap mData; + +}; +#undef ADD_COLOR +Q_DECLARE_METATYPE(std::shared_ptr) + +#endif diff --git a/linphone-app/src/components/other/colors/ColorModel.cpp b/linphone-app/src/components/other/colors/ColorModel.cpp new file mode 100644 index 000000000..8ab67f9b2 --- /dev/null +++ b/linphone-app/src/components/other/colors/ColorModel.cpp @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ColorModel.hpp" + +#include +#include "app/App.hpp" + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" +#include "components/core/CoreManager.hpp" + +// ============================================================================= + +ColorModel::ColorModel (const QString& name, const QColor& color, const QString& description, QObject * parent) : QObject(parent) { + App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE + mName = name; + setColor(color); + setDescription(description) ; +} + +// ----------------------------------------------------------------------------- + +QString ColorModel::getName() const{ + return mName; +} + +QColor ColorModel::getColor() const{ + return mColor; +} +QString ColorModel::getDescription() const{ + return mDescription; +} + + +void ColorModel::setColor(const QColor& color){ + if(color != mColor){ + mColor = color; + emit colorChanged(); + } +} + +void ColorModel::setAlpha(const int& alpha){ + mColor.setAlpha(alpha); + emit colorChanged(); +} + +void ColorModel::setDescription(const QString& description){ + if(description != mDescription){ + mDescription = description; + emit descriptionChanged(); + } +} diff --git a/linphone-app/src/components/other/colors/ColorModel.hpp b/linphone-app/src/components/other/colors/ColorModel.hpp new file mode 100644 index 000000000..a506511ba --- /dev/null +++ b/linphone-app/src/components/other/colors/ColorModel.hpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef COLOR_MODEL_H +#define COLOR_MODEL_H + +// ============================================================================= +#include +#include +#include +#include + +#include "utils/LinphoneEnums.hpp" + +class ColorModel : public QObject { + Q_OBJECT + +public: + ColorModel (const QString& name, const QColor& color, const QString& description, QObject * parent = nullptr); + + Q_PROPERTY(QColor color MEMBER mColor WRITE setColor NOTIFY colorChanged) + Q_PROPERTY(QString description MEMBER mDescription WRITE setDescription NOTIFY descriptionChanged) + Q_PROPERTY(QString name MEMBER mName CONSTANT) + + QColor getColor() const; + QString getDescription() const; + QString getName() const; + + + void setColor(const QColor& color); + void setAlpha(const int& alpha); + void setDescription(const QString& description); + +signals: + void colorChanged(); + void descriptionChanged(); + +private: + QString mName; + QColor mColor; + QString mDescription; +}; + +Q_DECLARE_METATYPE(std::shared_ptr); + +#endif diff --git a/linphone-app/src/components/other/colors/ColorProxyModel.cpp b/linphone-app/src/components/other/colors/ColorProxyModel.cpp new file mode 100644 index 000000000..fea76bccc --- /dev/null +++ b/linphone-app/src/components/other/colors/ColorProxyModel.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ColorProxyModel.hpp" +#include + +#include "app/App.hpp" + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" +#include "ColorListModel.hpp" +#include "ColorModel.hpp" + +// ============================================================================= + +ColorProxyModel::ColorProxyModel (QObject *parent) : QSortFilterProxyModel(parent){ + setSourceModel(App::getInstance()->getColorListModel()); +} + +bool ColorProxyModel::filterAcceptsRow ( + int sourceRow, + const QModelIndex &sourceParent +) const { + Q_UNUSED(sourceRow) + Q_UNUSED(sourceParent) + //const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + //const ParticipantDeviceModel *device = index.data().value(); + return true; +} + +bool ColorProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { + const ColorModel *a = sourceModel()->data(left).value(); + const ColorModel *b = sourceModel()->data(right).value(); + + return a->getName() < b->getName() ; +} +//--------------------------------------------------------------------------------- diff --git a/linphone-app/src/components/chat-message/ChatMessageModel.hpp b/linphone-app/src/components/other/colors/ColorProxyModel.hpp similarity index 53% rename from linphone-app/src/components/chat-message/ChatMessageModel.hpp rename to linphone-app/src/components/other/colors/ColorProxyModel.hpp index e2eca1b5a..954e09523 100644 --- a/linphone-app/src/components/chat-message/ChatMessageModel.hpp +++ b/linphone-app/src/components/other/colors/ColorProxyModel.hpp @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2021 Belledonne Communications SARL. * * This file is part of linphone-desktop @@ -18,37 +18,31 @@ * along with this program. If not, see . */ -#ifndef CHAT_MESSAGE_MODEL_H -#define CHAT_MESSAGE_MODEL_H +#ifndef COLOR_PROXY_MODEL_H_ +#define COLOR_PROXY_MODEL_H_ -#include "utils/LinphoneEnums.hpp" +#include // ============================================================================= +#include +#include +#include +#include +class ColorListModel; +class ChatMessageModel; -class ChatMessageModel : public QObject { - Q_OBJECT - +class ColorProxyModel : public QSortFilterProxyModel { + Q_OBJECT + public: - ChatMessageModel (std::shared_ptr chatMessage, QObject * parent = nullptr); - - Q_PROPERTY(bool isEphemeral READ isEphemeral NOTIFY isEphemeralChanged) - Q_PROPERTY(qint64 ephemeralExpireTime READ getEphemeralExpireTime NOTIFY ephemeralExpireTimeChanged) - - std::shared_ptr getChatMessage(); - - bool isEphemeral() const; - qint64 getEphemeralExpireTime() const; - -signals: - void isEphemeralChanged(); - void ephemeralExpireTimeChanged(); - - -private: - std::shared_ptr mChatMessage; + ColorProxyModel (QObject *parent = nullptr); + + +protected: + virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; + virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; + }; -Q_DECLARE_METATYPE(std::shared_ptr) - #endif diff --git a/linphone-app/src/components/other/colors/Colors.cpp b/linphone-app/src/components/other/colors/Colors.cpp deleted file mode 100644 index fd6b5d556..000000000 --- a/linphone-app/src/components/other/colors/Colors.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2010-2020 Belledonne Communications SARL. - * - * This file is part of linphone-desktop - * (see https://www.linphone.org). - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -#if LINPHONE_FRIDAY - #include -#endif // if LINPHONE_FRIDAY - -#include "utils/Utils.hpp" - -#include "Colors.hpp" - -// ============================================================================= - -using namespace std; - -namespace { - constexpr char ColorsSection[] = "ui_colors"; -} - -#if LINPHONE_FRIDAY - static inline bool isLinphoneFriday () { - return QDate::currentDate().dayOfWeek() == 5; - } -#endif // if LINPHONE_FRIDAY - -Colors::Colors (QObject *parent) : QObject(parent) { - #if LINPHONE_FRIDAY - if (isLinphoneFriday()) { - setProperty("i", QColor("#F48D8D")); - setProperty("b", QColor("#F58585")); - setProperty("m", QColor("#FFC5C5")); - } - #endif // if LINPHONE_FRIDAY -} - -void Colors::useConfig (const shared_ptr &config) { - #if LINPHONE_FRIDAY - if (!isLinphoneFriday()) - overrideColors(config); - #else - overrideColors(config); - #endif // if LINPHONE_FRIDAY -} - -// ----------------------------------------------------------------------------- - -void Colors::overrideColors (const shared_ptr &config) { - if (!config) - return; - - const QMetaObject *info = metaObject(); - - for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) { - const QMetaProperty metaProperty = info->property(i); - const string colorName = metaProperty.name(); - const string colorValue = config->getString(ColorsSection, colorName, ""); - - if (!colorValue.empty()) - setProperty(colorName.c_str(), QColor(Utils::coreStringToAppString(colorValue))); - } -} - -QStringList Colors::getColorNames () const { - static QStringList colorNames; - if (!colorNames.isEmpty()) - return colorNames; - - const QMetaObject *info = metaObject(); - for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) { - const QMetaProperty metaProperty = info->property(i); - if (metaProperty.isWritable()) - colorNames << QString::fromLatin1(metaProperty.name()); - } - - return colorNames; -} diff --git a/linphone-app/src/components/other/colors/Colors.hpp b/linphone-app/src/components/other/colors/Colors.hpp deleted file mode 100644 index a71913cd8..000000000 --- a/linphone-app/src/components/other/colors/Colors.hpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2010-2020 Belledonne Communications SARL. - * - * This file is part of linphone-desktop - * (see https://www.linphone.org). - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef COLORS_H_ -#define COLORS_H_ - -#include - -#include -#include - -// ============================================================================= - -#define ADD_COLOR(COLOR, VALUE) \ - Q_PROPERTY(QColor COLOR MEMBER m ## COLOR WRITE set ## COLOR NOTIFY colorT ## COLOR ## Changed); \ - void set ## COLOR(const QColor &color) { \ - m ## COLOR = color; \ - emit colorT ## COLOR ## Changed(m ## COLOR); \ - } \ - QColor m ## COLOR = VALUE; - -// Alpha is in percent. -#define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA) \ - Q_PROPERTY(QColor COLOR ## ALPHA READ get ## COLOR ## ALPHA NOTIFY colorT ## COLOR ## Changed); \ - QColor get ## COLOR ## ALPHA() { \ - QColor color = m ## COLOR; \ - color.setAlpha(ALPHA * 255 / 100); \ - return color; \ - } - -// ----------------------------------------------------------------------------- - -namespace linphone { - class Config; -} - -class Colors : public QObject { - Q_OBJECT - - Q_PROPERTY(QStringList colorNames READ getColorNames CONSTANT) - - ADD_COLOR(a, "transparent") - - // Primary color for hovered items. - ADD_COLOR(b, "#D64D00") - - ADD_COLOR(c, "#CBCBCB") // Button pressed / separators / fields - ADD_COLOR(d, "#5A585B") - ADD_COLOR(e, "#F3F3F3") - ADD_COLOR(f, "#E8E8E8") - ADD_COLOR(g, "#6B7A86")// SipAddress / Contact Text - ADD_COLOR(h, "#687680") - - // Primary color. - ADD_COLOR(i, "#FE5E00") - - ADD_COLOR(j, "#4B5964")// Username, Background cancel button hovered - - // Popups, home, call, assistant and settings background. - ADD_COLOR(k, "#FFFFFF") - - ADD_COLOR(l, "#000000") - - // Primary color for clicked items. - ADD_COLOR(m, "#FF8600") - - ADD_COLOR(n, "#A1A1A1") - ADD_COLOR(o, "#D0D8DE")// Disabled button - - // Progress bar. - ADD_COLOR(p, "#17A81A") - - // Fields, backgrounds and text color on some items. - ADD_COLOR(q, "#FFFFFF") - - ADD_COLOR(r, "#909fab")//Background button normal - - ADD_COLOR(s, "#96be64")// Security - - ADD_COLOR(t, "#C2C2C2")// Title Header - ADD_COLOR(u, "#D2D2D2")// Menu border (message) - ADD_COLOR(v, "#E7E7E7")// Menu pressed (message) - ADD_COLOR(w, "#EDEDED")// Menu background (conversation) - - // Field error. - ADD_COLOR(error, "#FF0000") - - ADD_COLOR_WITH_ALPHA(g, 10) - ADD_COLOR_WITH_ALPHA(g, 20) - ADD_COLOR_WITH_ALPHA(g, 90) - ADD_COLOR_WITH_ALPHA(i, 30) - ADD_COLOR_WITH_ALPHA(l, 50) - ADD_COLOR_WITH_ALPHA(l, 80) - ADD_COLOR_WITH_ALPHA(q, 50) - -public: - Colors (QObject *parent = Q_NULLPTR); - - void useConfig (const std::shared_ptr &config); - -signals: - void colorTaChanged (const QColor &color); - void colorTbChanged (const QColor &color); - void colorTcChanged (const QColor &color); - void colorTdChanged (const QColor &color); - void colorTeChanged (const QColor &color); - void colorTfChanged (const QColor &color); - void colorTgChanged (const QColor &color); - void colorThChanged (const QColor &color); - void colorTiChanged (const QColor &color); - void colorTjChanged (const QColor &color); - void colorTkChanged (const QColor &color); - void colorTlChanged (const QColor &color); - void colorTmChanged (const QColor &color); - void colorTnChanged (const QColor &color); - void colorToChanged (const QColor &color); - void colorTpChanged (const QColor &color); - void colorTqChanged (const QColor &color); - void colorTrChanged (const QColor &color); - void colorTsChanged (const QColor &color); - void colorTtChanged (const QColor &color); - void colorTuChanged (const QColor &color); - void colorTvChanged (const QColor &color); - void colorTwChanged (const QColor &color); - - void colorTerrorChanged (const QColor &color); - -private: - void overrideColors (const std::shared_ptr &config); - - QStringList getColorNames () const; -}; - -// ----------------------------------------------------------------------------- - -#undef ADD_COLOR_WITH_ALPHA -#undef ADD_COLOR - -#endif // COLORS_H_ diff --git a/linphone-app/src/components/other/images/ImageListModel.cpp b/linphone-app/src/components/other/images/ImageListModel.cpp new file mode 100644 index 000000000..1b79b4bba --- /dev/null +++ b/linphone-app/src/components/other/images/ImageListModel.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ImageListModel.hpp" + +#include + +#include +#include +#include +#if LINPHONE_FRIDAY + #include +#endif // if LINPHONE_FRIDAY + + +#include "app/App.hpp" + + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" +#include "ImageModel.hpp" + +namespace { + constexpr char ImagesSection[] = "ui_images"; +} + +// ============================================================================= + +ImageListModel::ImageListModel ( QObject *parent) : QAbstractListModel(parent), mData(this) { +// Get all internals + QString path = ":/assets/images/"; + QStringList filters; + filters << "*.svg"; + + QFileInfoList files = QDir(path).entryInfoList(filters, QDir::Files , QDir::Name); + for(QFileInfo file : files){ + std::shared_ptr model = std::make_shared(file.completeBaseName(), path+file.fileName(), ""); + add(model); + } + mData.insert("areReadOnlyImages", QVariant::fromValue(true)); +} + +int ImageListModel::rowCount (const QModelIndex &index) const{ + return mList.count(); +} + +QHash ImageListModel::roleNames () const { + QHash roles; + roles[Qt::DisplayRole] = "$image"; + return roles; +} + +QVariant ImageListModel::data (const QModelIndex &index, int role) const { + int row = index.row(); + + if (!index.isValid() || row < 0 || row >= mList.count()) + return QVariant(); + return QVariant::fromValue(mList[row].get()); +} + +void ImageListModel::add(std::shared_ptr image){ + int row = mList.count(); + beginInsertRows(QModelIndex(), row, row); + setProperty(image->getId().toStdString().c_str(), QVariant::fromValue(image.get())); + + mData.insert(image->getId(), QVariant::fromValue(image.get())); + mList << image; + + endInsertRows(); + resetInternalData(); +} + +bool ImageListModel::removeRow (int row, const QModelIndex &parent){ + return removeRows(row, 1, parent); +} + +bool ImageListModel::removeRows (int row, int count, const QModelIndex &parent) { + int limit = row + count - 1; + if (row < 0 || count < 0 || limit >= mList.count()) + return false; + beginRemoveRows(parent, row, limit); + + for (int i = 0; i < count; ++i) + mList.takeAt(row); + + endRemoveRows(); + return true; +} + +void ImageListModel::useConfig (const std::shared_ptr &config) { + #if LINPHONE_FRIDAY + if (!isLinphoneFriday()) + overrideImages(config); + #else + overrideImages(config); + #endif // if LINPHONE_FRIDAY +} + +QString ImageListModel::getIds(){ + QStringList ids; + const QMetaObject *info = metaObject(); + + for (int i = info->propertyOffset(); i < info->propertyCount(); ++i) { + const QMetaProperty metaProperty = info->property(i); + const std::string id = metaProperty.name(); + ids << QString::fromStdString(id); + } + return ids.join(", "); +} + +QQmlPropertyMap * ImageListModel::getQmlData() { + return &mData; +} + +const QQmlPropertyMap * ImageListModel::getQmlData() const{ + return &mData; +} + +ImageModel * ImageListModel::getImageModel(const QString& id){ + for(auto image : mList) + if(image->getId() == id) + return image.get(); + return nullptr; +} + + +void ImageListModel::overrideImages (const std::shared_ptr &config) { + if (!config) + return; + for(auto image : mList){ + QString id = image->getId(); + const std::string pathValue = config->getString(ImagesSection, id.toStdString(), ""); + if(!pathValue.empty()){ + image->setPath(QString::fromStdString(pathValue)); + } + } +} diff --git a/linphone-app/src/components/other/images/ImageListModel.hpp b/linphone-app/src/components/other/images/ImageListModel.hpp new file mode 100644 index 000000000..0c6a69031 --- /dev/null +++ b/linphone-app/src/components/other/images/ImageListModel.hpp @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef IMAGE_LIST_MODEL_H_ +#define IMAGE_LIST_MODEL_H_ + +// ============================================================================= +#include +#include +#include +#include +#include +#include + +#include "ImageModel.hpp" + +class ImageModel; + +class ImageListModel : public QAbstractListModel { + Q_OBJECT +public: + + ImageListModel (QObject *parent = nullptr); + + int rowCount (const QModelIndex &index = QModelIndex()) const override; + + virtual QHash roleNames () const override; + virtual QVariant data (const QModelIndex &index, int role = Qt::DisplayRole) const override; + + void useConfig (const std::shared_ptr &config); + + Q_INVOKABLE QString getIds(); + + QQmlPropertyMap * getQmlData(); + const QQmlPropertyMap * getQmlData() const; + + ImageModel * getImageModel(const QString& id); + +private: + void add(std::shared_ptr imdn); + bool removeRow (int row, const QModelIndex &parent = QModelIndex()); + virtual bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()) override; + + QList> mList; + + void overrideImages (const std::shared_ptr &config); + + QStringList getImagesIds () const; + + QQmlPropertyMap mData; + bool mAreReadOnlyImages = true; + +}; +Q_DECLARE_METATYPE(std::shared_ptr) + +#endif diff --git a/linphone-app/src/components/other/images/ImageModel.cpp b/linphone-app/src/components/other/images/ImageModel.cpp new file mode 100644 index 000000000..aefa737c2 --- /dev/null +++ b/linphone-app/src/components/other/images/ImageModel.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ImageModel.hpp" + +#include +#include "app/App.hpp" + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" +#include "components/core/CoreManager.hpp" + +// ============================================================================= + +ImageModel::ImageModel (const QString& id, const QString& path, const QString& description, QObject * parent) : QObject(parent) { + App::getInstance()->getEngine()->setObjectOwnership(this, QQmlEngine::CppOwnership);// Avoid QML to destroy it when passing by Q_INVOKABLE + mId = id; + //setPath(path); + mPath = path; + setDescription(description) ; +} + +// ----------------------------------------------------------------------------- + +QString ImageModel::getId() const{ + return mId; +} + +QString ImageModel::getPath() const{ + return mPath; +} +QString ImageModel::getDescription() const{ + return mDescription; +} + + +void ImageModel::setPath(const QString& data){ + if(data != mPath){ + mPath = data; + emit pathChanged(); + QString old = mId; + mId="";// Force change + emit idChanged(); + mId=old; + emit idChanged(); + } +} + +void ImageModel::setDescription(const QString& data){ + if(data != mDescription){ + mDescription = data; + emit descriptionChanged(); + } +} + +void ImageModel::setUrl(const QUrl& url){ + setPath(url.toString(QUrl::RemoveScheme)); +} diff --git a/linphone-app/src/components/other/images/ImageModel.hpp b/linphone-app/src/components/other/images/ImageModel.hpp new file mode 100644 index 000000000..259eb8776 --- /dev/null +++ b/linphone-app/src/components/other/images/ImageModel.hpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef IMAGE_MODEL_H +#define IMAGE_MODEL_H + +// ============================================================================= +#include +#include +#include +#include + +#include "utils/LinphoneEnums.hpp" + +class ImageModel : public QObject { + Q_OBJECT + +public: + ImageModel (const QString& id, const QString& path, const QString& description, QObject * parent = nullptr); + + Q_PROPERTY(QString path MEMBER mPath WRITE setPath NOTIFY pathChanged) + Q_PROPERTY(QString description MEMBER mDescription WRITE setDescription NOTIFY descriptionChanged) + Q_PROPERTY(QString id MEMBER mId NOTIFY idChanged) + + QString getPath() const; + QString getDescription() const; + QString getId() const; + + + void setPath(const QString& path); + void setDescription(const QString& description); + Q_INVOKABLE void setUrl(const QUrl& url); + +signals: + void pathChanged(); + void descriptionChanged(); + void idChanged(); + +private: + QString mId; + QString mPath; + QString mDescription; +}; + +Q_DECLARE_METATYPE(std::shared_ptr); + +#endif diff --git a/linphone-app/src/components/other/images/ImageProxyModel.cpp b/linphone-app/src/components/other/images/ImageProxyModel.cpp new file mode 100644 index 000000000..b1cec6656 --- /dev/null +++ b/linphone-app/src/components/other/images/ImageProxyModel.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2021 Belledonne Communications SARL. + * + * This file is part of linphone-desktop + * (see https://www.linphone.org). + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include "ImageProxyModel.hpp" +#include + +#include "app/App.hpp" + +#include "utils/Utils.hpp" + +#include "components/Components.hpp" +#include "ImageListModel.hpp" +#include "ImageModel.hpp" + +// ============================================================================= + +ImageProxyModel::ImageProxyModel (QObject *parent) : QSortFilterProxyModel(parent){ + setSourceModel(App::getInstance()->getImageListModel()); +} + +bool ImageProxyModel::filterAcceptsRow ( + int sourceRow, + const QModelIndex &sourceParent +) const { + Q_UNUSED(sourceRow) + Q_UNUSED(sourceParent) + //const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + //const ParticipantDeviceModel *device = index.data().value(); + return true; +} + +bool ImageProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { + const ImageModel *a = sourceModel()->data(left).value(); + const ImageModel *b = sourceModel()->data(right).value(); + + return a->getId() < b->getId() ; +} +//--------------------------------------------------------------------------------- diff --git a/linphone-app/src/components/chat-message/ChatMessageModel.cpp b/linphone-app/src/components/other/images/ImageProxyModel.hpp similarity index 61% rename from linphone-app/src/components/chat-message/ChatMessageModel.cpp rename to linphone-app/src/components/other/images/ImageProxyModel.hpp index 7a40395e2..efb2ce8e6 100644 --- a/linphone-app/src/components/chat-message/ChatMessageModel.cpp +++ b/linphone-app/src/components/other/images/ImageProxyModel.hpp @@ -18,26 +18,30 @@ * along with this program. If not, see . */ -#include +#ifndef IMAGE_PROXY_MODEL_H_ +#define IMAGE_PROXY_MODEL_H_ -#include "app/App.hpp" - -#include "ChatMessageModel.hpp" +#include // ============================================================================= +#include +#include +#include +#include -ChatMessageModel::ChatMessageModel ( std::shared_ptr chatMessage, QObject * parent) : QObject(parent) { - mChatMessage = chatMessage; -} +class ImageListModel; -std::shared_ptr ChatMessageModel::getChatMessage(){ - return mChatMessage; -} +class ImageProxyModel : public QSortFilterProxyModel { + Q_OBJECT + +public: + ImageProxyModel (QObject *parent = nullptr); + + +protected: + virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; + virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override; + +}; -bool ChatMessageModel::isEphemeral() const{ - return mChatMessage->isEphemeral(); -} - -qint64 ChatMessageModel::getEphemeralExpireTime() const{ - return mChatMessage->getEphemeralExpireTime(); -} \ No newline at end of file +#endif diff --git a/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp b/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp index 5540cfc94..a3cf37578 100644 --- a/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp +++ b/linphone-app/src/components/participant-imdn/ParticipantImdnStateListModel.cpp @@ -98,10 +98,14 @@ bool ParticipantImdnStateListModel::removeRows (int row, int count, const QModel std::shared_ptr ParticipantImdnStateListModel::getImdnState(const std::shared_ptr & state){ std::shared_ptr imdn; - auto imdnAddress = state->getParticipant()->getAddress(); + auto participant = state->getParticipant(); auto it = mList.begin(); - while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress)) - ++it; + if( participant){ + auto imdnAddress = state->getParticipant()->getAddress(); + while(it != mList.end() && !(*it)->getAddress()->equal(imdnAddress)) + ++it; + }else + it = mList.end(); if(it != mList.end()) imdn = *it; else{// Create the new one diff --git a/linphone-app/src/components/participant/ParticipantModel.cpp b/linphone-app/src/components/participant/ParticipantModel.cpp index 2478bb2d1..aea6fff99 100644 --- a/linphone-app/src/components/participant/ParticipantModel.cpp +++ b/linphone-app/src/components/participant/ParticipantModel.cpp @@ -57,8 +57,7 @@ int ParticipantModel::getDeviceCount() const{ } bool ParticipantModel::getInviting() const{ - bool is = !mParticipant; - return is; + return !mParticipant; } QString ParticipantModel::getSipAddress() const{ diff --git a/linphone-app/src/components/participant/ParticipantProxyModel.cpp b/linphone-app/src/components/participant/ParticipantProxyModel.cpp index b01c5dc36..f248799aa 100644 --- a/linphone-app/src/components/participant/ParticipantProxyModel.cpp +++ b/linphone-app/src/components/participant/ParticipantProxyModel.cpp @@ -93,7 +93,10 @@ void ParticipantProxyModel::add(const QString& address){ void ParticipantProxyModel::remove(ParticipantModel * participant){ if(participant) { - if(mChatRoomModel && mChatRoomModel->getChatRoom() && participant->getParticipant() ) + if( !mChatRoomModel){ + ParticipantListModel * participantsModel = dynamic_cast(sourceModel()); + participantsModel->remove(participant); + }else if(mChatRoomModel->getChatRoom() && participant->getParticipant() ) mChatRoomModel->getChatRoom()->removeParticipant(participant->getParticipant()); //dynamic_cast(sourceModel())->remove(participant); } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index ad4f2e77c..25b8fe1d1 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -36,47 +36,47 @@ using namespace std; static inline AccountSettingsModel::RegistrationState mapLinphoneRegistrationStateToUi (linphone::RegistrationState state) { - switch (state) { - case linphone::RegistrationState::None: - case linphone::RegistrationState::Cleared: - case linphone::RegistrationState::Failed: - return AccountSettingsModel::RegistrationStateNotRegistered; - - case linphone::RegistrationState::Progress: - return AccountSettingsModel::RegistrationStateInProgress; - - case linphone::RegistrationState::Ok: - break; - } - - return AccountSettingsModel::RegistrationStateRegistered; + switch (state) { + case linphone::RegistrationState::None: + case linphone::RegistrationState::Cleared: + case linphone::RegistrationState::Failed: + return AccountSettingsModel::RegistrationStateNotRegistered; + + case linphone::RegistrationState::Progress: + return AccountSettingsModel::RegistrationStateInProgress; + + case linphone::RegistrationState::Ok: + break; + } + + return AccountSettingsModel::RegistrationStateRegistered; } // ----------------------------------------------------------------------------- AccountSettingsModel::AccountSettingsModel (QObject *parent) : QObject(parent) { - CoreManager *coreManager = CoreManager::getInstance(); - QObject::connect( - coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged, - this, &AccountSettingsModel::handleRegistrationStateChanged - ); - QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); }); + CoreManager *coreManager = CoreManager::getInstance(); + QObject::connect( + coreManager->getHandlers().get(), &CoreHandlers::registrationStateChanged, + this, &AccountSettingsModel::handleRegistrationStateChanged + ); + QObject::connect(coreManager, &CoreManager::eventCountChanged, this, [this]() { emit accountSettingsUpdated(); }); } // ----------------------------------------------------------------------------- shared_ptr AccountSettingsModel::getUsedSipAddress () const { - shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr proxyConfig = core->getDefaultProxyConfig(); - - return proxyConfig?proxyConfig->getIdentityAddress():core->createPrimaryContactParsed(); + shared_ptr core = CoreManager::getInstance()->getCore(); + shared_ptr proxyConfig = core->getDefaultProxyConfig(); + + return proxyConfig?proxyConfig->getIdentityAddress():core->createPrimaryContactParsed(); } void AccountSettingsModel::setUsedSipAddress (const shared_ptr &address) { - shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr proxyConfig = core->getDefaultProxyConfig(); - - proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString()); + shared_ptr core = CoreManager::getInstance()->getCore(); + shared_ptr proxyConfig = core->getDefaultProxyConfig(); + + proxyConfig ? proxyConfig->setIdentityAddress(address) : core->setPrimaryContact(address->asString()); } QString AccountSettingsModel::getUsedSipAddressAsStringUriOnly () const { @@ -89,250 +89,251 @@ QString AccountSettingsModel::getUsedSipAddressAsString () const { // ----------------------------------------------------------------------------- bool AccountSettingsModel::addOrUpdateProxyConfig (const shared_ptr &proxyConfig) { - Q_CHECK_PTR(proxyConfig); - - CoreManager *coreManager = CoreManager::getInstance(); - shared_ptr core = coreManager->getCore(); - - list> proxyConfigs = core->getProxyConfigList(); - if (find(proxyConfigs.cbegin(), proxyConfigs.cend(), proxyConfig) != proxyConfigs.cend()) { - if (proxyConfig->done() == -1) { - qWarning() << QStringLiteral("Unable to update proxy config: `%1`.") - .arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString())); - return false; - } - coreManager->getSettingsModel()->configureRlsUri(); - } else { - if (core->addProxyConfig(proxyConfig) == -1) { - qWarning() << QStringLiteral("Unable to add proxy config: `%1`.") - .arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString())); - return false; - } - coreManager->getSettingsModel()->configureRlsUri(proxyConfig); - } - emit accountSettingsUpdated(); - - return true; + Q_CHECK_PTR(proxyConfig); + + CoreManager *coreManager = CoreManager::getInstance(); + shared_ptr core = coreManager->getCore(); + + list> proxyConfigs = core->getProxyConfigList(); + if (find(proxyConfigs.cbegin(), proxyConfigs.cend(), proxyConfig) != proxyConfigs.cend()) { + if (proxyConfig->done() == -1) { + qWarning() << QStringLiteral("Unable to update proxy config: `%1`.") + .arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString())); + return false; + } + coreManager->getSettingsModel()->configureRlsUri(); + } else { + if (core->addProxyConfig(proxyConfig) == -1) { + qWarning() << QStringLiteral("Unable to add proxy config: `%1`.") + .arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString())); + return false; + } + coreManager->getSettingsModel()->configureRlsUri(proxyConfig); + } + emit accountSettingsUpdated(); + + return true; } QVariantMap AccountSettingsModel::getProxyConfigDescription (const shared_ptr &proxyConfig) { - Q_CHECK_PTR(proxyConfig); - - QVariantMap map; - - { - const shared_ptr address = proxyConfig->getIdentityAddress(); - map["sipAddress"] = address - ? QString::fromStdString(proxyConfig->getIdentityAddress()->asString()) - : QString(""); - } - map["serverAddress"] = Utils::coreStringToAppString(proxyConfig->getServerAddr()); - map["registrationDuration"] = proxyConfig->getPublishExpires(); - - if( map["serverAddress"].toString().toUpper().contains("TRANSPORT="))// transport has been specified : let the RFC select the transport + Q_CHECK_PTR(proxyConfig); + + QVariantMap map; + + { + const shared_ptr address = proxyConfig->getIdentityAddress(); + map["sipAddress"] = address + ? QString::fromStdString(proxyConfig->getIdentityAddress()->asString()) + : QString(""); + } + map["serverAddress"] = Utils::coreStringToAppString(proxyConfig->getServerAddr()); + map["registrationDuration"] = proxyConfig->getPublishExpires(); + + if( map["serverAddress"].toString().toUpper().contains("TRANSPORT="))// transport has been specified : let the RFC select the transport map["transport"] = Utils::coreStringToAppString(proxyConfig->getTransport()); - else// Set to TLS as default - map["transport"] = "tls"; - if( proxyConfig->getRoutes().size() > 0) - map["route"] = Utils::coreStringToAppString(proxyConfig->getRoutes().front()); - else - map["route"] = ""; - map["conferenceUri"] = Utils::coreStringToAppString(proxyConfig->getConferenceFactoryUri()); - map["contactParams"] = Utils::coreStringToAppString(proxyConfig->getContactParameters()); - map["avpfInterval"] = proxyConfig->getAvpfRrInterval(); - map["registerEnabled"] = proxyConfig->registerEnabled(); - map["publishPresence"] = proxyConfig->publishEnabled(); - map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::Enabled; - map["registrationState"] = mapLinphoneRegistrationStateToUi(proxyConfig->getState()); - - shared_ptr natPolicy = proxyConfig->getNatPolicy(); - bool createdNat = !natPolicy; - if (createdNat) - natPolicy = proxyConfig->getCore()->createNatPolicy(); - map["iceEnabled"] = natPolicy->iceEnabled(); - map["turnEnabled"] = natPolicy->turnEnabled(); - - const string &turnUser(natPolicy->getStunServerUsername()); - const string &stunServer(natPolicy->getStunServer()); - - map["turnUser"] = Utils::coreStringToAppString(turnUser); - map["stunServer"] = Utils::coreStringToAppString(stunServer); - - if (createdNat) - proxyConfig->setNatPolicy(natPolicy); - - shared_ptr authInfo = CoreManager::getInstance()->getCore()->findAuthInfo( - "", turnUser, stunServer - ); - map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString(""); - - return map; + else// Set to TLS as default + map["transport"] = "tls"; + if( proxyConfig->getRoutes().size() > 0) + map["route"] = Utils::coreStringToAppString(proxyConfig->getRoutes().front()); + else + map["route"] = ""; + map["conferenceUri"] = Utils::coreStringToAppString(proxyConfig->getConferenceFactoryUri()); + map["contactParams"] = Utils::coreStringToAppString(proxyConfig->getContactParameters()); + map["avpfInterval"] = proxyConfig->getAvpfRrInterval(); + map["registerEnabled"] = proxyConfig->registerEnabled(); + map["publishPresence"] = proxyConfig->publishEnabled(); + map["avpfEnabled"] = proxyConfig->getAvpfMode() == linphone::AVPFMode::Enabled; + map["registrationState"] = mapLinphoneRegistrationStateToUi(proxyConfig->getState()); + + shared_ptr natPolicy = proxyConfig->getNatPolicy(); + bool createdNat = !natPolicy; + if (createdNat) + natPolicy = proxyConfig->getCore()->createNatPolicy(); + map["iceEnabled"] = natPolicy->iceEnabled(); + map["turnEnabled"] = natPolicy->turnEnabled(); + + const string &turnUser(natPolicy->getStunServerUsername()); + const string &stunServer(natPolicy->getStunServer()); + + map["turnUser"] = Utils::coreStringToAppString(turnUser); + map["stunServer"] = Utils::coreStringToAppString(stunServer); + + if (createdNat) + proxyConfig->setNatPolicy(natPolicy); + + shared_ptr authInfo = CoreManager::getInstance()->getCore()->findAuthInfo( + "", turnUser, stunServer + ); + map["turnPassword"] = authInfo ? Utils::coreStringToAppString(authInfo->getPassword()) : QString(""); + + return map; } void AccountSettingsModel::setDefaultProxyConfig (const shared_ptr &proxyConfig) { - shared_ptr core = CoreManager::getInstance()->getCore(); - if (core->getDefaultProxyConfig() != proxyConfig) { - core->setDefaultProxyConfig(proxyConfig); - emit accountSettingsUpdated(); - emit defaultProxyChanged(); - } + shared_ptr core = CoreManager::getInstance()->getCore(); + if (core->getDefaultProxyConfig() != proxyConfig) { + core->setDefaultProxyConfig(proxyConfig); + emit accountSettingsUpdated(); + emit defaultProxyChanged(); + } } void AccountSettingsModel::setDefaultProxyConfigFromSipAddress (const QString &sipAddress) { - shared_ptr core = CoreManager::getInstance()->getCore(); - if (Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly()) == sipAddress) { - setDefaultProxyConfig(nullptr); - return; - } - - for (const auto &proxyConfig : core->getProxyConfigList()) - if (Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly()) == sipAddress) { - setDefaultProxyConfig(proxyConfig); - return; - } - - qWarning() << "Unable to set default proxy config from:" << sipAddress; + shared_ptr core = CoreManager::getInstance()->getCore(); + auto address = Utils::interpretUrl(sipAddress); + if ( core->createPrimaryContactParsed()->weakEqual(address)) { + setDefaultProxyConfig(nullptr); + return; + } + + for (const auto &proxyConfig : core->getProxyConfigList()) + if (proxyConfig->getIdentityAddress()->weakEqual(address)) { + setDefaultProxyConfig(proxyConfig); + return; + } + + qWarning() << "Unable to set default proxy config from:" << sipAddress; } void AccountSettingsModel::removeProxyConfig (const shared_ptr &proxyConfig) { - Q_CHECK_PTR(proxyConfig); - - CoreManager *coreManager = CoreManager::getInstance(); - std::list> allProxies = coreManager->getCore()->getProxyConfigList(); - std::shared_ptr proxyAddress = proxyConfig->getIdentityAddress(); - - coreManager->getCore()->removeProxyConfig(proxyConfig);// Remove first to avoid requesting password when deleting it - if(proxyConfig->findAuthInfo()) - coreManager->getCore()->removeAuthInfo(proxyConfig->findAuthInfo());// Remove passwords - - coreManager->getSettingsModel()->configureRlsUri(); - - emit accountSettingsUpdated(); + Q_CHECK_PTR(proxyConfig); + + CoreManager *coreManager = CoreManager::getInstance(); + std::list> allProxies = coreManager->getCore()->getProxyConfigList(); + std::shared_ptr proxyAddress = proxyConfig->getIdentityAddress(); + + coreManager->getCore()->removeProxyConfig(proxyConfig);// Remove first to avoid requesting password when deleting it + if(proxyConfig->findAuthInfo()) + coreManager->getCore()->removeAuthInfo(proxyConfig->findAuthInfo());// Remove passwords + + coreManager->getSettingsModel()->configureRlsUri(); + + emit accountSettingsUpdated(); } bool AccountSettingsModel::addOrUpdateProxyConfig ( - const shared_ptr &proxyConfig, - const QVariantMap &data -) { - Q_CHECK_PTR(proxyConfig); - bool newPublishPresence = false; - - proxyConfig->edit(); - - QString literal = data["sipAddress"].toString(); - - // Sip address. - { - shared_ptr address = linphone::Factory::get()->createAddress(literal.toStdString()); - if (!address) { - qWarning() << QStringLiteral("Unable to create sip address object from: `%1`.").arg(literal); - return false; - } - - if (proxyConfig->setIdentityAddress(address)) { - qWarning() << QStringLiteral("Unable to set identity address: `%1`.") - .arg(Utils::coreStringToAppString(address->asStringUriOnly())); - return false; - } - } - - // Server address. - { - QString serverAddress = data["serverAddress"].toString(); - - if (proxyConfig->setServerAddr(Utils::appStringToCoreString(serverAddress))) { - qWarning() << QStringLiteral("Unable to add server address: `%1`.").arg(serverAddress); - return false; - } - } - - proxyConfig->setPublishExpires(data["registrationDuration"].toInt()); - proxyConfig->setRoute(Utils::appStringToCoreString(data["route"].toString())); - proxyConfig->setConferenceFactoryUri(Utils::appStringToCoreString(data["conferenceUri"].toString())); - proxyConfig->setContactParameters(Utils::appStringToCoreString(data["contactParams"].toString())); - proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt())); - proxyConfig->enableRegister(data["registerEnabled"].toBool()); - newPublishPresence = proxyConfig->publishEnabled() != data["publishPresence"].toBool(); - proxyConfig->enablePublish(data["publishPresence"].toBool()); - proxyConfig->setAvpfMode(data["avpfEnabled"].toBool() - ? linphone::AVPFMode::Enabled - : linphone::AVPFMode::Default - ); - - shared_ptr natPolicy = proxyConfig->getNatPolicy(); - bool createdNat = !natPolicy; - if (createdNat) - natPolicy = proxyConfig->getCore()->createNatPolicy(); - natPolicy->enableIce(data["iceEnabled"].toBool()); - natPolicy->enableStun(data["iceEnabled"].toBool()); - - const string turnUser(Utils::appStringToCoreString(data["turnUser"].toString())); - const string stunServer(Utils::appStringToCoreString(data["stunServer"].toString())); - - natPolicy->enableTurn(data["turnEnabled"].toBool()); - natPolicy->setStunServerUsername(turnUser); - natPolicy->setStunServer(stunServer); - - if( createdNat) - proxyConfig->setNatPolicy(natPolicy); - - shared_ptr core(proxyConfig->getCore()); - shared_ptr authInfo(core->findAuthInfo("", turnUser, stunServer)); - if (authInfo) { - shared_ptr clonedAuthInfo(authInfo->clone()); - clonedAuthInfo->setUserid(turnUser); - clonedAuthInfo->setUsername(turnUser); - clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString())); - - core->addAuthInfo(clonedAuthInfo); - core->removeAuthInfo(authInfo); - } else - core->addAuthInfo(linphone::Factory::get()->createAuthInfo( - turnUser, - turnUser, - Utils::appStringToCoreString(data["turnPassword"].toString()), - "", - stunServer, - "" + const shared_ptr &proxyConfig, + const QVariantMap &data + ) { + Q_CHECK_PTR(proxyConfig); + bool newPublishPresence = false; + + proxyConfig->edit(); + + QString literal = data["sipAddress"].toString(); + + // Sip address. + { + shared_ptr address = linphone::Factory::get()->createAddress(literal.toStdString()); + if (!address) { + qWarning() << QStringLiteral("Unable to create sip address object from: `%1`.").arg(literal); + return false; + } + + if (proxyConfig->setIdentityAddress(address)) { + qWarning() << QStringLiteral("Unable to set identity address: `%1`.") + .arg(Utils::coreStringToAppString(address->asStringUriOnly())); + return false; + } + } + + // Server address. + { + QString serverAddress = data["serverAddress"].toString(); + + if (proxyConfig->setServerAddr(Utils::appStringToCoreString(serverAddress))) { + qWarning() << QStringLiteral("Unable to add server address: `%1`.").arg(serverAddress); + return false; + } + } + + proxyConfig->setPublishExpires(data["registrationDuration"].toInt()); + proxyConfig->setRoute(Utils::appStringToCoreString(data["route"].toString())); + proxyConfig->setConferenceFactoryUri(Utils::appStringToCoreString(data["conferenceUri"].toString())); + proxyConfig->setContactParameters(Utils::appStringToCoreString(data["contactParams"].toString())); + proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt())); + proxyConfig->enableRegister(data["registerEnabled"].toBool()); + newPublishPresence = proxyConfig->publishEnabled() != data["publishPresence"].toBool(); + proxyConfig->enablePublish(data["publishPresence"].toBool()); + proxyConfig->setAvpfMode(data["avpfEnabled"].toBool() + ? linphone::AVPFMode::Enabled + : linphone::AVPFMode::Default + ); + + shared_ptr natPolicy = proxyConfig->getNatPolicy(); + bool createdNat = !natPolicy; + if (createdNat) + natPolicy = proxyConfig->getCore()->createNatPolicy(); + natPolicy->enableIce(data["iceEnabled"].toBool()); + natPolicy->enableStun(data["iceEnabled"].toBool()); + + const string turnUser(Utils::appStringToCoreString(data["turnUser"].toString())); + const string stunServer(Utils::appStringToCoreString(data["stunServer"].toString())); + + natPolicy->enableTurn(data["turnEnabled"].toBool()); + natPolicy->setStunServerUsername(turnUser); + natPolicy->setStunServer(stunServer); + + if( createdNat) + proxyConfig->setNatPolicy(natPolicy); + + shared_ptr core(proxyConfig->getCore()); + shared_ptr authInfo(core->findAuthInfo("", turnUser, stunServer)); + if (authInfo) { + shared_ptr clonedAuthInfo(authInfo->clone()); + clonedAuthInfo->setUserid(turnUser); + clonedAuthInfo->setUsername(turnUser); + clonedAuthInfo->setPassword(Utils::appStringToCoreString(data["turnPassword"].toString())); + + core->addAuthInfo(clonedAuthInfo); + core->removeAuthInfo(authInfo); + } else + core->addAuthInfo(linphone::Factory::get()->createAuthInfo( + turnUser, + turnUser, + Utils::appStringToCoreString(data["turnPassword"].toString()), + "", + stunServer, + "" )); - if( newPublishPresence) - emit publishPresenceChanged(); - return addOrUpdateProxyConfig(proxyConfig); + if( newPublishPresence) + emit publishPresenceChanged(); + return addOrUpdateProxyConfig(proxyConfig); } shared_ptr AccountSettingsModel::createProxyConfig () { - shared_ptr core = CoreManager::getInstance()->getCore(); - - core->getConfig()->loadFromXmlFile( - Paths::getAssistantConfigDirPath() + "create-app-sip-account.rc" + shared_ptr core = CoreManager::getInstance()->getCore(); + + core->getConfig()->loadFromXmlFile( + Paths::getAssistantConfigDirPath() + "create-app-sip-account.rc" ); - - return core->createProxyConfig(); + + return core->createProxyConfig(); } void AccountSettingsModel::addAuthInfo ( - const shared_ptr &authInfo, - const QString &password, - const QString &userId -) { - authInfo->setPassword(Utils::appStringToCoreString(password)); - authInfo->setUserid(Utils::appStringToCoreString(userId)); - - CoreManager::getInstance()->getCore()->addAuthInfo(authInfo); + const shared_ptr &authInfo, + const QString &password, + const QString &userId + ) { + authInfo->setPassword(Utils::appStringToCoreString(password)); + authInfo->setUserid(Utils::appStringToCoreString(userId)); + + CoreManager::getInstance()->getCore()->addAuthInfo(authInfo); } void AccountSettingsModel::eraseAllPasswords () { - CoreManager::getInstance()->getCore()->clearAllAuthInfo(); + CoreManager::getInstance()->getCore()->clearAllAuthInfo(); } // ----------------------------------------------------------------------------- QString AccountSettingsModel::getUsername () const { - shared_ptr address = getUsedSipAddress(); - const string displayName = address->getDisplayName(); - - return QString::fromStdString( - displayName.empty() ? address->getUsername() : displayName - ); + shared_ptr address = getUsedSipAddress(); + const string displayName = address->getDisplayName(); + + return QString::fromStdString( + displayName.empty() ? address->getUsername() : displayName + ); } void AccountSettingsModel::setUsername (const QString &username) { @@ -342,7 +343,7 @@ void AccountSettingsModel::setUsername (const QString &username) { if( oldUsername != username) { if (newAddress->setDisplayName(username.toStdString())) { qWarning() << QStringLiteral("Unable to set displayName on sip address: `%1`.") - .arg(Utils::coreStringToAppString(newAddress->asStringUriOnly())); + .arg(Utils::coreStringToAppString(newAddress->asStringUriOnly())); } else { setUsedSipAddress(newAddress); emit accountSettingsUpdated(); @@ -351,40 +352,40 @@ void AccountSettingsModel::setUsername (const QString &username) { } AccountSettingsModel::RegistrationState AccountSettingsModel::getRegistrationState () const { - shared_ptr proxyConfig = CoreManager::getInstance()->getCore()->getDefaultProxyConfig(); - return proxyConfig ? mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNoProxy; + shared_ptr proxyConfig = CoreManager::getInstance()->getCore()->getDefaultProxyConfig(); + return proxyConfig ? mapLinphoneRegistrationStateToUi(proxyConfig->getState()) : RegistrationStateNoProxy; } // ----------------------------------------------------------------------------- QString AccountSettingsModel::getPrimaryUsername () const { - return QString::fromStdString( - CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getUsername() - ); + return QString::fromStdString( + CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getUsername() + ); } void AccountSettingsModel::setPrimaryUsername (const QString &username) { shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr primary = core->createPrimaryContactParsed(); - + QString oldUsername = Utils::coreStringToAppString(primary->getUsername()); if(oldUsername != username){ primary->setUsername(Utils::appStringToCoreString( - username.isEmpty() ? APPLICATION_NAME : username - )); + username.isEmpty() ? APPLICATION_NAME : username + )); core->setPrimaryContact(primary->asString()); emit accountSettingsUpdated(); } } QString AccountSettingsModel::getPrimaryDisplayName () const { - return QString::fromStdString(CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getDisplayName()); + return QString::fromStdString(CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->getDisplayName()); } void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) { shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr primary = core->createPrimaryContactParsed(); - + QString oldDisplayName = Utils::coreStringToAppString(primary->getDisplayName()); if(oldDisplayName != displayName){ primary->setDisplayName(displayName.toStdString()); @@ -394,47 +395,51 @@ void AccountSettingsModel::setPrimaryDisplayName (const QString &displayName) { } QString AccountSettingsModel::getPrimarySipAddress () const { - return QString::fromStdString( - CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->asString() - ); + return QString::fromStdString( + CoreManager::getInstance()->getCore()->createPrimaryContactParsed()->asString() + ); } // ----------------------------------------------------------------------------- QVariantList AccountSettingsModel::getAccounts () const { - shared_ptr core = CoreManager::getInstance()->getCore(); - QVariantList accounts; - - if(CoreManager::getInstance()->getSettingsModel()->getShowLocalSipAccount()) { - QVariantMap account; - account["sipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly()); - account["fullSipAddress"] = QString::fromStdString(core->createPrimaryContactParsed()->asString()); - account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->createPrimaryContactParsed()); - account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); - account["proxyConfig"].setValue(nullptr); - accounts << account; - } - - for (const auto &proxyConfig : core->getProxyConfigList()) { - QVariantMap account; - account["sipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly()); - account["fullSipAddress"] = QString::fromStdString(proxyConfig->getIdentityAddress()->asString()); - account["proxyConfig"].setValue(proxyConfig); - account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount(); - account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); - accounts << account; - } - - return accounts; + shared_ptr core = CoreManager::getInstance()->getCore(); + QVariantList accounts; + + if(CoreManager::getInstance()->getSettingsModel()->getShowLocalSipAccount()) { + QVariantMap account; + account["sipAddress"] = Utils::coreStringToAppString(core->createPrimaryContactParsed()->asStringUriOnly()); + account["fullSipAddress"] = QString::fromStdString(core->createPrimaryContactParsed()->asString()); + account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->createPrimaryContactParsed()); + account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); + account["proxyConfig"].setValue(nullptr); + accounts << account; + } + + for (const auto &proxyConfig : core->getProxyConfigList()) { + QVariantMap account; + account["sipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly()); + account["fullSipAddress"] = QString::fromStdString(proxyConfig->getIdentityAddress()->asString()); + account["proxyConfig"].setValue(proxyConfig); + account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount(); + account["missedCallCount"] = CoreManager::getInstance()->getMissedCallCountFromLocal(account["sipAddress"].toString()); + accounts << account; + } + + return accounts; } // ----------------------------------------------------------------------------- void AccountSettingsModel::handleRegistrationStateChanged ( - const shared_ptr & proxy, - linphone::RegistrationState core -) { - Q_UNUSED(proxy) - Q_UNUSED(core) - emit accountSettingsUpdated(); + const shared_ptr & proxy, + linphone::RegistrationState state + ) { + Q_UNUSED(proxy) + Q_UNUSED(state) + shared_ptr core = CoreManager::getInstance()->getCore(); + shared_ptr defaultProxyConfig = core->getDefaultProxyConfig(); + if(defaultProxyConfig == proxy) + emit defaultRegistrationChanged(); + emit accountSettingsUpdated(); } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index ca740e70e..a46d5074f 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -86,6 +86,7 @@ signals: void accountSettingsUpdated (); void defaultProxyChanged(); void publishPresenceChanged(); + void defaultRegistrationChanged(); private: QString getUsername () const; diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 51d887ac1..5a8058035 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -614,6 +614,17 @@ void SettingsModel::setChatEnabled (bool status) { // ----------------------------------------------------------------------------- +bool SettingsModel::getHideEmptyChatRooms() const{ + return !!mConfig->getInt("misc", "hide_empty_chat_rooms", 1); +} + +void SettingsModel::setHideEmptyChatRooms(const bool& status){ + mConfig->setInt("misc", "hide_empty_chat_rooms", status); + emit hideEmptyChatRoomsChanged(status); +} + +// ----------------------------------------------------------------------------- + bool SettingsModel::getConferenceEnabled () const { return !!mConfig->getInt(UiSection, "conference_enabled", 1); } diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 0a1b466fe..4ca15aa7e 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -103,6 +103,8 @@ class SettingsModel : public QObject { Q_PROPERTY(bool muteMicrophoneEnabled READ getMuteMicrophoneEnabled WRITE setMuteMicrophoneEnabled NOTIFY muteMicrophoneEnabledChanged) Q_PROPERTY(bool chatEnabled READ getChatEnabled WRITE setChatEnabled NOTIFY chatEnabledChanged) + Q_PROPERTY(bool hideEmptyChatRooms READ getHideEmptyChatRooms WRITE setHideEmptyChatRooms NOTIFY hideEmptyChatRoomsChanged) + Q_PROPERTY(bool conferenceEnabled READ getConferenceEnabled WRITE setConferenceEnabled NOTIFY conferenceEnabledChanged) @@ -320,6 +322,9 @@ public: bool getChatEnabled () const; void setChatEnabled (bool status); + + bool getHideEmptyChatRooms() const; + void setHideEmptyChatRooms(const bool& data); bool getConferenceEnabled () const; void setConferenceEnabled (bool status); @@ -536,6 +541,7 @@ signals: void muteMicrophoneEnabledChanged (bool status); void chatEnabledChanged (bool status); + void hideEmptyChatRoomsChanged (bool status); void conferenceEnabledChanged (bool status); diff --git a/linphone-app/src/components/timeline/TimelineListModel.cpp b/linphone-app/src/components/timeline/TimelineListModel.cpp index d82a99847..2ee30a8c9 100644 --- a/linphone-app/src/components/timeline/TimelineListModel.cpp +++ b/linphone-app/src/components/timeline/TimelineListModel.cpp @@ -23,6 +23,7 @@ #include "components/core/CoreManager.hpp" #include "components/core/CoreHandlers.hpp" #include "components/settings/AccountSettingsModel.hpp" +#include "components/settings/SettingsModel.hpp" #include "components/sip-addresses/SipAddressesModel.hpp" #include "components/contacts/ContactsListModel.hpp" #include "utils/Utils.hpp" @@ -43,6 +44,8 @@ TimelineListModel::TimelineListModel (QObject *parent) : QAbstractListModel(pare connect(coreHandlers, &CoreHandlers::messageReceived, this, &TimelineListModel::update); connect(coreHandlers, &CoreHandlers::messageReceived, this, &TimelineListModel::updated); + connect(CoreManager::getInstance()->getSettingsModel(), &SettingsModel::hideEmptyChatRoomsChanged, this, &TimelineListModel::update); + connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultRegistrationChanged, this, &TimelineListModel::update); updateTimelines (); } @@ -153,7 +156,7 @@ QVariantList TimelineListModel::getLastChatRooms(const int& maxCount) const{ for(auto timeline : mTimelines){ auto chatRoom = timeline->getChatRoomModel(); - if(chatRoom && !chatRoom->isGroupEnabled() && !chatRoom->haveEncryption()) { + if(chatRoom && chatRoom->isCurrentProxy() && !chatRoom->isGroupEnabled() && !chatRoom->haveEncryption()) { sortedData.insert(chatRoom->mLastUpdateTime.secsTo(currentDateTime),chatRoom); } } @@ -223,6 +226,7 @@ void TimelineListModel::selectedHasChanged(bool selected){ void TimelineListModel::updateTimelines () { CoreManager *coreManager = CoreManager::getInstance(); std::list> allChatRooms = coreManager->getCore()->getChatRooms(); + //Remove no more chat rooms auto itTimeline = mTimelines.begin(); @@ -287,7 +291,7 @@ void TimelineListModel::remove(std::shared_ptr model){ } } void TimelineListModel::removeChatRoomModel(std::shared_ptr model){ - if(model->getChatRoom()->isEmpty() && model->hasBeenLeft()){ + if(model->getChatRoom()->isEmpty() && (model->hasBeenLeft() || !model->isGroupEnabled())){ auto itTimeline = mTimelines.begin(); while(itTimeline != mTimelines.end()) { if((*itTimeline)->mChatRoomModel == model){ diff --git a/linphone-app/src/components/timeline/TimelineModel.cpp b/linphone-app/src/components/timeline/TimelineModel.cpp index 4f35a0df1..3cdf7b3d3 100644 --- a/linphone-app/src/components/timeline/TimelineModel.cpp +++ b/linphone-app/src/components/timeline/TimelineModel.cpp @@ -53,6 +53,7 @@ TimelineModel::TimelineModel (std::shared_ptr chatRoom, QObj if( mChatRoomModel ){ QObject::connect(mChatRoomModel.get(), &ChatRoomModel::unreadMessagesCountChanged, this, &TimelineModel::updateUnreadCount); QObject::connect(mChatRoomModel.get(), &ChatRoomModel::missedCallsCountChanged, this, &TimelineModel::updateUnreadCount); + QObject::connect(CoreManager::getInstance()->getAccountSettingsModel(), &AccountSettingsModel::defaultProxyChanged, this, &TimelineModel::onDefaultProxyChanged); } //QObject::connect(mChatRoomModel.get(), &ChatRoomModel::conferenceLeft, this, &TimelineModel::onConferenceLeft); @@ -62,7 +63,6 @@ TimelineModel::TimelineModel (std::shared_ptr chatRoom, QObj TimelineModel::~TimelineModel(){ mChatRoomModel->getChatRoom()->removeListener(mChatRoomModel); - qWarning() << "Destroying Timeline"; } QString TimelineModel::getFullPeerAddress() const{ @@ -103,6 +103,10 @@ void TimelineModel::updateUnreadCount(){ mChatRoomModel->resetMessageCount(); } } +void TimelineModel::onDefaultProxyChanged(){ + if( mSelected && !mChatRoomModel->isCurrentProxy()) + setSelected(false); +} //---------------------------------------------------------- //------ CHAT ROOM HANDLERS //---------------------------------------------------------- diff --git a/linphone-app/src/components/timeline/TimelineModel.hpp b/linphone-app/src/components/timeline/TimelineModel.hpp index 2fcf2e1d2..87e368cb2 100644 --- a/linphone-app/src/components/timeline/TimelineModel.hpp +++ b/linphone-app/src/components/timeline/TimelineModel.hpp @@ -98,6 +98,7 @@ public: public slots: void updateUnreadCount(); + void onDefaultProxyChanged(); //void chatRoomDeleted(); signals: diff --git a/linphone-app/src/components/timeline/TimelineProxyModel.cpp b/linphone-app/src/components/timeline/TimelineProxyModel.cpp index 2127d6ef9..d36d490ab 100644 --- a/linphone-app/src/components/timeline/TimelineProxyModel.cpp +++ b/linphone-app/src/components/timeline/TimelineProxyModel.cpp @@ -103,6 +103,8 @@ bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sou const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); auto timeline = sourceModel()->data(index).value(); bool show = (mFilterFlags==0);// Show all at 0 (no hide all) + auto currentAddress = Utils::interpretUrl(CoreManager::getInstance()->getAccountSettingsModel()->getUsedSipAddressAsStringUriOnly()); + if( !show && ( (mFilterFlags & TimelineFilter::SimpleChatRoom) == TimelineFilter::SimpleChatRoom)) show = !timeline->getChatRoomModel()->isGroupEnabled() && !timeline->getChatRoomModel()->haveEncryption(); if( !show && ( (mFilterFlags & TimelineFilter::SecureChatRoom) == TimelineFilter::SecureChatRoom)) @@ -119,6 +121,8 @@ bool TimelineProxyModel::filterAcceptsRow (int sourceRow, const QModelIndex &sou || timeline->getChatRoomModel()->getUsername().contains(search); //|| timeline->getChatRoomModel()->getFullPeerAddress().contains(search); not enough significant? } + if(show) + show = timeline->getChatRoomModel()->isCurrentProxy(); return show; } diff --git a/linphone-app/ui/dev-modules/Colors/Colors.qml b/linphone-app/ui/dev-modules/Colors/Colors.qml deleted file mode 100644 index d8e4165a9..000000000 --- a/linphone-app/ui/dev-modules/Colors/Colors.qml +++ /dev/null @@ -1,42 +0,0 @@ -pragma Singleton -import QtQml 2.2 - -// ============================================================================= - -QtObject { - property color a: '#000000' - property color b: '#000000' - property color c: '#000000' - property color d: '#000000' - property color e: '#000000' - property color f: '#000000' - property color g: '#000000' - property color g10: '#000000' - property color g20: '#000000' - property color g90: '#000000' - property color h: '#000000' - property color i: '#000000' - property color i30: '#000000' - property color j: '#000000' - property color j75: '#000000' - property color k: '#000000' - property color l: '#000000' - property color l50: '#000000' - property color l80: '#000000' - property color m: '#000000' - property color n: '#000000' - property color o: '#000000' - property color p: '#000000' - property color q: '#000000' - property color r: '#000000' - property color s: '#000000' - property color t: '#000000' - property color u: '#000000' - property color v: '#000000' - property color w: '#000000' - property color x: '#000000' - property color y: '#000000' - property color z: '#000000' - - property color error: '#000000' -} diff --git a/linphone-app/ui/dev-modules/Colors/qmldir b/linphone-app/ui/dev-modules/Colors/qmldir deleted file mode 100644 index a101f9a40..000000000 --- a/linphone-app/ui/dev-modules/Colors/qmldir +++ /dev/null @@ -1,7 +0,0 @@ -# ============================================================================== -# Colors component to export. -# ============================================================================== - -module Colors - -singleton Colors 1.0 Colors.qml diff --git a/linphone-app/ui/dev-modules/Tools/Tools.qml b/linphone-app/ui/dev-modules/Tools/Tools.qml deleted file mode 100644 index 57e98f355..000000000 --- a/linphone-app/ui/dev-modules/Tools/Tools.qml +++ /dev/null @@ -1,8 +0,0 @@ -pragma Singleton -import QtQml 2.2 - -// ============================================================================= - -QtObject { - property real dp: 1.0 -} diff --git a/linphone-app/ui/dev-modules/Tools/qmldir b/linphone-app/ui/dev-modules/Tools/qmldir deleted file mode 100644 index eb78aca0a..000000000 --- a/linphone-app/ui/dev-modules/Tools/qmldir +++ /dev/null @@ -1,7 +0,0 @@ -# ============================================================================== -# Tools component to export. -# ============================================================================== - -module Tools - -singleton Tools 1.0 Tools.qml diff --git a/linphone-app/ui/modules/Common/Form/ActionButton.qml b/linphone-app/ui/modules/Common/Form/ActionButton.qml index c663fa0a7..fdc3390bb 100644 --- a/linphone-app/ui/modules/Common/Form/ActionButton.qml +++ b/linphone-app/ui/modules/Common/Form/ActionButton.qml @@ -33,6 +33,8 @@ Item { // --------------------------------------------------------------------------- function _getIcon () { + if(wrappedButton.icon == '') + return wrappedButton.icon; if (wrappedButton.updating) { return wrappedButton.icon + '_updating' } @@ -74,7 +76,7 @@ Item { id: icon anchors.centerIn: parent - icon: _getIcon() + icon: Images[_getIcon()].id iconSize: wrappedButton.iconSize || ( parent.width > parent.height ? parent.height : parent.width ) diff --git a/linphone-app/ui/modules/Common/Form/Buttons/TextButtonB.qml b/linphone-app/ui/modules/Common/Form/Buttons/TextButtonB.qml index df3158cd7..37d5d32c9 100644 --- a/linphone-app/ui/modules/Common/Form/Buttons/TextButtonB.qml +++ b/linphone-app/ui/modules/Common/Form/Buttons/TextButtonB.qml @@ -15,8 +15,8 @@ AbstractTextButton { textColorNormal: textButtonStyle.textColor.normal textColorPressed: textButtonStyle.textColor.pressed - borderColorDisabled: textButtonStyle.borderColor.disabled - borderColorHovered: textButtonStyle.borderColor.hovered - borderColorNormal: textButtonStyle.borderColor.normal - borderColorPressed: textButtonStyle.borderColor.pressed + borderColorDisabled: (textButtonStyle.borderColor?textButtonStyle.borderColor.disabled:colorDisabled) + borderColorHovered: (textButtonStyle.borderColor?textButtonStyle.borderColor.hovered:colorHovered) + borderColorNormal: (textButtonStyle.borderColor?textButtonStyle.borderColor.normal:colorNormal) + borderColorPressed: (textButtonStyle.borderColor?textButtonStyle.borderColor.pressed:colorPressed) } diff --git a/linphone-app/ui/modules/Common/Image/Icon.qml b/linphone-app/ui/modules/Common/Image/Icon.qml index f63c8c668..a88a72316 100644 --- a/linphone-app/ui/modules/Common/Image/Icon.qml +++ b/linphone-app/ui/modules/Common/Image/Icon.qml @@ -15,7 +15,9 @@ Item { width: iconSize Image { + id:image mipmap: Qt.platform.os === 'osx' + cache: Images.areReadOnlyImages function getIconSize () { Utils.assert( (icon == null || icon == '' || iconSize != null && iconSize >= 0), diff --git a/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml b/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml index 0c6fc3336..99b7794a6 100644 --- a/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Animations/BusyIndicatorStyle.qml @@ -1,12 +1,10 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { - property color color: Colors.i + property color color: Colors.i.color property int duration: 1250 property int nSpheres: 6 } diff --git a/linphone-app/ui/modules/Common/Styles/Dialog/DialogStyle.qml b/linphone-app/ui/modules/Common/Styles/Dialog/DialogStyle.qml index bfea21488..f6ba3fd7a 100644 --- a/linphone-app/ui/modules/Common/Styles/Dialog/DialogStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Dialog/DialogStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property QtObject buttons: QtObject { property int bottomMargin: 30 @@ -28,7 +27,7 @@ QtObject { } property QtObject description: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int leftMargin: 50 property int pointSize: Units.dp * 11 property int rightMargin: 50 diff --git a/linphone-app/ui/modules/Common/Styles/Form/Buttons/ExclusiveButtonsStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Buttons/ExclusiveButtonsStyle.qml index d28e7e5a0..2090ef060 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Buttons/ExclusiveButtonsStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Buttons/ExclusiveButtonsStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= @@ -10,10 +9,10 @@ QtObject { property QtObject button: QtObject { property QtObject color: QtObject { - property color hovered: Colors.n - property color normal: Colors.c - property color pressed: Colors.i - property color selected: Colors.g + property color hovered: Colors.n.color + property color normal: Colors.c.color + property color pressed: Colors.i.color + property color selected: Colors.g.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Buttons/FileChooserButtonStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Buttons/FileChooserButtonStyle.qml index 9dca09a03..37a784b6d 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Buttons/FileChooserButtonStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Buttons/FileChooserButtonStyle.qml @@ -1,8 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { @@ -13,9 +11,9 @@ QtObject { property int iconSize: 16 property QtObject color: QtObject { - property color hovered: Colors.c - property color normal: Colors.f - property color pressed: Colors.c + property color hovered: Colors.c.color + property color normal: Colors.f.color + property color pressed: Colors.c.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Buttons/SmallButtonStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Buttons/SmallButtonStyle.qml index 7ee91ba76..bf73c286b 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Buttons/SmallButtonStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Buttons/SmallButtonStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -15,14 +14,14 @@ QtObject { property int radius: 10 property QtObject color: QtObject { - property color hovered: Colors.c - property color normal: Colors.f - property color pressed: Colors.i + property color hovered: Colors.c.color + property color normal: Colors.f.color + property color pressed: Colors.i.color } } property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSize: Units.dp * 8 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonAStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonAStyle.qml index 034a52d47..3ff03e60a 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonAStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonAStyle.qml @@ -1,23 +1,22 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { property QtObject backgroundColor: QtObject { - property color disabled: Colors.o - property color hovered: Colors.j - property color normal: Colors.r - property color pressed: Colors.i + property color disabled: Colors.o.color + property color hovered: Colors.j.color + property color normal: Colors.r.color + property color pressed: Colors.i.color } property QtObject textColor: QtObject { - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.q - property color pressed: Colors.q + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.q.color + property color pressed: Colors.q.color } property QtObject borderColor : backgroundColor } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonBStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonBStyle.qml index bcb82e20a..e662527ab 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonBStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Buttons/TextButtonBStyle.qml @@ -2,23 +2,21 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { property QtObject backgroundColor: QtObject { - property color disabled: Colors.i30 - property color hovered: Colors.b - property color normal: Colors.i - property color pressed: Colors.m + property color disabled: Colors.i30.color + property color hovered: Colors.b.color + property color normal: Colors.i.color + property color pressed: Colors.m.color } property QtObject textColor: QtObject { - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.q - property color pressed: Colors.q + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.q.color + property color pressed: Colors.q.color } property QtObject borderColor : backgroundColor } diff --git a/linphone-app/ui/modules/Common/Styles/Form/CheckBoxTextStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/CheckBoxTextStyle.qml index 7dc85806e..5e7dc72be 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/CheckBoxTextStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/CheckBoxTextStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -12,8 +11,8 @@ QtObject { property int size: 18 property QtObject color: QtObject { - property color pressed: Colors.i - property color hovered: Colors.h - property color normal: Colors.g + property color pressed: Colors.i.color + property color hovered: Colors.h.color + property color normal: Colors.g.color } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/ComboBoxStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/ComboBoxStyle.qml index a93b1df56..a32c81e94 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/ComboBoxStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/ComboBoxStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,13 +13,13 @@ QtObject { property int width: 200 property QtObject border: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int width: 1 } property QtObject color: QtObject { - property color normal: Colors.q - property color readOnly: Colors.e + property color normal: Colors.q.color + property color readOnly: Colors.e.color } } @@ -30,7 +29,7 @@ QtObject { property int spacing: 5 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/CommonItemDelegateStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/CommonItemDelegateStyle.qml index 543f778af..69d2570ce 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/CommonItemDelegateStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/CommonItemDelegateStyle.qml @@ -1,15 +1,14 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { property QtObject color: QtObject { - property color hovered: Colors.o - property color normal: Colors.q + property color hovered: Colors.o.color + property color normal: Colors.q.color } property QtObject contentItem: QtObject { @@ -17,18 +16,18 @@ QtObject { property int spacing: 5 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } property QtObject indicator: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int width: 5 } property QtObject separator: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int height: 1 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/DroppableTextAreaStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/DroppableTextAreaStyle.qml index 438a84d9b..a4c192dcc 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/DroppableTextAreaStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/DroppableTextAreaStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.q + property color backgroundColor: Colors.q.color property QtObject fileChooserButton: QtObject { property int margins: 6 @@ -15,16 +14,16 @@ QtObject { } property QtObject hoverContent: QtObject { - property color backgroundColor: Colors.q + property color backgroundColor: Colors.q.color property QtObject text: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int pointSize: Units.dp * 11 } } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Fields/NumericFieldStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Fields/NumericFieldStyle.qml index 7b3204d5d..311b70756 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Fields/NumericFieldStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Fields/NumericFieldStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -12,12 +11,12 @@ QtObject { property QtObject button: QtObject { property QtObject color: QtObject { - property color normal: Colors.f - property color pressed: Colors.c + property color normal: Colors.f.color + property color pressed: Colors.c.color } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 9 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Fields/TextAreaFieldStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Fields/TextAreaFieldStyle.qml index c4021b2e5..5cc153338 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Fields/TextAreaFieldStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Fields/TextAreaFieldStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,18 +13,18 @@ QtObject { property int radius: 4 property QtObject border: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int width: 1 } property QtObject color: QtObject { - property color normal: Colors.q - property color readOnly: Colors.e + property color normal: Colors.q.color + property color readOnly: Colors.e.color } } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int padding: 8 } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml index 6463c568e..cafd9a521 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Fields/TextFieldStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -15,22 +14,22 @@ QtObject { property QtObject border: QtObject { property QtObject color: QtObject { - property color error: Colors.error - property color normal: Colors.c - property color selected: Colors.i + property color error: Colors.error.color + property color normal: Colors.c.color + property color selected: Colors.i.color } property int width: 1 } property QtObject color: QtObject { - property color normal: Colors.q - property color readOnly: Colors.e + property color normal: Colors.q.color + property color readOnly: Colors.e.color } } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int rightPadding: 10 } @@ -44,22 +43,22 @@ QtObject { property QtObject border: QtObject { property QtObject color: QtObject { - property color error: Colors.error - property color normal: Colors.c - property color selected: Colors.i + property color error: Colors.error.color + property color normal: Colors.c.color + property color selected: Colors.i.color } property int width: 0 } property QtObject color: QtObject { - property color normal: Colors.q - property color readOnly: Colors.e + property color normal: Colors.q.color + property color readOnly: Colors.e.color } } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int rightPadding: 10 } diff --git a/linphone-app/ui/modules/Common/Styles/Form/ListFormStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/ListFormStyle.qml index 088fc1199..c3efb9eff 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/ListFormStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/ListFormStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -11,7 +10,7 @@ QtObject { property QtObject value: QtObject { property QtObject placeholder: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int pointSize: Units.dp * 10 } @@ -25,7 +24,7 @@ QtObject { property int iconSize: 18 property QtObject text: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 9 property int width: 130 } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormHGroupStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormHGroupStyle.qml index bb1f0ae10..0cdb90719 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormHGroupStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormHGroupStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,7 +13,7 @@ QtObject { } property QtObject legend: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 property int height: 36 property int width: 200 diff --git a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormStyle.qml index 5af7a6d6d..46ef7f68d 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,12 +13,12 @@ QtObject { property int spacing: 5 property QtObject separator: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int height: 2 } property QtObject title: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int pointSize: Units.dp * 12 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml index c05824fc4..70dd96818 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormTableStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -15,7 +14,7 @@ QtObject { property int maxWidth: 400 property QtObject text: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormVGroupStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormVGroupStyle.qml index 0b04cd2d4..25329c338 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Placements/FormVGroupStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Placements/FormVGroupStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,13 +13,13 @@ QtObject { } property QtObject error: QtObject { - property color color: Colors.error + property color color: Colors.error.color property int pointSize: Units.dp * 10 property int height: 11 } property QtObject legend: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml index 31d40eb3c..95639e95c 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/SearchBoxStyle.qml @@ -1,10 +1,9 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color shadowColor: Colors.l + property color shadowColor: Colors.l.color } diff --git a/linphone-app/ui/modules/Common/Styles/Form/SliderStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/SliderStyle.qml index 7e0316e0a..7b19fa769 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/SliderStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/SliderStyle.qml @@ -1,19 +1,18 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { property QtObject background: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int height: 4 property int radius: 2 property int width: 200 property QtObject content: QtObject { - property color color: Colors.m + property color color: Colors.m.color property int radius: 2 } } @@ -25,14 +24,14 @@ QtObject { property QtObject border: QtObject { property QtObject color: QtObject { - property color normal: Colors.c - property color pressed: Colors.c + property color normal: Colors.c.color + property color pressed: Colors.c.color } } property QtObject color: QtObject { - property color normal: Colors.e - property color pressed: Colors.f + property color normal: Colors.e.color + property color pressed: Colors.f.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/SwitchStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/SwitchStyle.qml index 264383e8c..2d17d68a2 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/SwitchStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/SwitchStyle.qml @@ -1,8 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject{ property QtObject normal :QtObject { @@ -16,16 +14,16 @@ QtObject{ property int width: 48 property QtObject border: QtObject { property QtObject color: QtObject { - property color checked: Colors.i - property color disabled: Colors.c - property color normal: Colors.c + property color checked: Colors.i.color + property color disabled: Colors.c.color + property color normal: Colors.c.color } } property QtObject color: QtObject { - property color checked: Colors.i - property color disabled: Colors.e - property color normal: Colors.q + property color checked: Colors.i.color + property color disabled: Colors.e.color + property color normal: Colors.q.color } } @@ -34,17 +32,17 @@ QtObject{ property QtObject border: QtObject { property QtObject color: QtObject { - property color checked: Colors.i - property color disabled: Colors.c - property color normal: Colors.n - property color pressed: Colors.n + property color checked: Colors.i.color + property color disabled: Colors.c.color + property color normal: Colors.n.color + property color pressed: Colors.n.color } } property QtObject color: QtObject { - property color pressed: Colors.c - property color disabled: Colors.e - property color normal: Colors.q + property color pressed: Colors.c.color + property color disabled: Colors.e.color + property color normal: Colors.q.color } } } @@ -59,16 +57,16 @@ QtObject{ property int width: 48 property QtObject border: QtObject { property QtObject color: QtObject { - property color checked: Colors.s - property color disabled: Colors.c - property color normal: Colors.c + property color checked: Colors.s.color + property color disabled: Colors.c.color + property color normal: Colors.c.color } } property QtObject color: QtObject { - property color checked: Colors.s - property color disabled: Colors.e - property color normal: Colors.q + property color checked: Colors.s.color + property color disabled: Colors.e.color + property color normal: Colors.q.color } } @@ -77,17 +75,17 @@ QtObject{ property QtObject border: QtObject { property QtObject color: QtObject { - property color checked: Colors.s - property color disabled: Colors.c - property color normal: Colors.n - property color pressed: Colors.n + property color checked: Colors.s.color + property color disabled: Colors.c.color + property color normal: Colors.n.color + property color pressed: Colors.n.color } } property QtObject color: QtObject { - property color pressed: Colors.c - property color disabled: Colors.e - property color normal: Colors.q + property color pressed: Colors.c.color + property color disabled: Colors.e.color + property color normal: Colors.q.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml index 48cf670b2..6238dd0c6 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -10,11 +9,11 @@ QtObject { property int spacing: 8 property QtObject backgroundColor: QtObject { - property color disabled: Colors.i30 - property color hovered: Colors.b - property color normal: Colors.i - property color pressed: Colors.m - property color selected: Colors.k + property color disabled: Colors.i30.color + property color hovered: Colors.b.color + property color normal: Colors.i.color + property color pressed: Colors.m.color + property color selected: Colors.k.color } property QtObject icon: QtObject { @@ -28,11 +27,11 @@ QtObject { property int rightPadding: 10 property QtObject color: QtObject { - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.q - property color pressed: Colors.q - property color selected: Colors.i + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.q.color + property color pressed: Colors.q.color + property color selected: Colors.i.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml index 6088f614b..a35d77306 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml @@ -1,12 +1,10 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int bottomMargin: 30 property int leftMargin: 30 property int rightMargin: 40 @@ -14,6 +12,6 @@ QtObject { property QtObject separator: QtObject { property int height: 2 - property color color: Colors.f + property color color: Colors.f.color } } diff --git a/linphone-app/ui/modules/Common/Styles/Form/TransparentTextInputStyle.qml b/linphone-app/ui/modules/Common/Styles/Form/TransparentTextInputStyle.qml index 6b0fec317..ffded571d 100644 --- a/linphone-app/ui/modules/Common/Styles/Form/TransparentTextInputStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Form/TransparentTextInputStyle.qml @@ -1,18 +1,17 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.f + property color backgroundColor: Colors.f.color property int iconSize: 12 property int padding: 10 property QtObject placeholder: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int pointSize: Units.dp * 10 } @@ -20,8 +19,8 @@ QtObject { property int pointSize: Units.dp * 10 property QtObject color: QtObject { - property color focused: Colors.l - property color normal: Colors.d + property color focused: Colors.l.color + property color normal: Colors.d.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Indicators/VuMeterStyle.qml b/linphone-app/ui/modules/Common/Styles/Indicators/VuMeterStyle.qml index 4d7574a0f..7c7782815 100644 --- a/linphone-app/ui/modules/Common/Styles/Indicators/VuMeterStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Indicators/VuMeterStyle.qml @@ -1,8 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { @@ -12,26 +10,26 @@ QtObject { property QtObject high: QtObject { property QtObject background: QtObject { property QtObject color: QtObject { - property color disabled: Colors.o - property color enabled: Colors.n + property color disabled: Colors.o.color + property color enabled: Colors.n.color } } property QtObject contentItem: QtObject { - property color color: Colors.b + property color color: Colors.b.color } } property QtObject low: QtObject { property QtObject background: QtObject { property QtObject color: QtObject { - property color disabled: Colors.o - property color enabled: Colors.n + property color disabled: Colors.o.color + property color enabled: Colors.n.color } } property QtObject contentItem: QtObject { - property color color: Colors.j + property color color: Colors.j.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Menus/ApplicationMenuStyle.qml b/linphone-app/ui/modules/Common/Styles/Menus/ApplicationMenuStyle.qml index 045115752..b01b941e9 100644 --- a/linphone-app/ui/modules/Common/Styles/Menus/ApplicationMenuStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Menus/ApplicationMenuStyle.qml @@ -1,14 +1,13 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { property int spacing: 1 - property color backgroundColor: Colors.n + property color backgroundColor: Colors.n.color property QtObject entry: QtObject { property int iconSize: 24 @@ -17,14 +16,14 @@ QtObject { property int spacing: 18 property QtObject color: QtObject { - property color hovered: Colors.h - property color normal: Colors.g - property color pressed: Colors.i - property color selected: Colors.j + property color hovered: Colors.h.color + property color normal: Colors.g.color + property color pressed: Colors.i.color + property color selected: Colors.j.color } property QtObject indicator: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int width: 5 } @@ -32,8 +31,8 @@ QtObject { property int pointSize: Units.dp * 10 property QtObject color: QtObject { - property color normal: Colors.q //q50 - property color selected: Colors.q + property color normal: Colors.q.color //q50 + property color selected: Colors.q.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml b/linphone-app/ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml index 558c5d4c9..2e4e22e45 100644 --- a/linphone-app/ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Menus/DropDownStaticMenuStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,13 +13,13 @@ QtObject { property int rightMargin: 8 property QtObject color: QtObject { - property color hovered: Colors.j - property color normal: Colors.g - property color pressed: Colors.i + property color hovered: Colors.j.color + property color normal: Colors.g.color + property color pressed: Colors.i.color } property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSize: Units.dp * 9 } } diff --git a/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml b/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml index 24c9c1725..f276c81dd 100644 --- a/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Menus/MenuItemStyle.qml @@ -2,7 +2,6 @@ pragma Singleton import QtQml 2.2 import QtQuick 2.3 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -16,9 +15,9 @@ QtObject { property int height: 30 property QtObject color: QtObject { - property color hovered: Colors.o - property color normal: Colors.q - property color pressed: Colors.o + property color hovered: Colors.o.color + property color normal: Colors.q.color + property color pressed: Colors.o.color } } @@ -27,10 +26,10 @@ QtObject { property int weight : Font.Bold property QtObject color: QtObject { - property color hovered: Colors.j - property color normal: Colors.j - property color pressed: Colors.j - property color disabled: Colors.l50 + property color hovered: Colors.j.color + property color normal: Colors.j.color + property color pressed: Colors.j.color + property color disabled: Colors.l50.color } } } @@ -42,9 +41,9 @@ QtObject { property int height: 40 property QtObject color: QtObject { - property color hovered: Colors.v - property color normal: Colors.a - property color pressed: Colors.v + property color hovered: Colors.v.color + property color normal: Colors.a.color + property color pressed: Colors.v.color } } @@ -53,10 +52,10 @@ QtObject { property int weight : Font.Normal property QtObject color: QtObject { - property color hovered: Colors.j - property color normal: Colors.j - property color pressed: Colors.j - property color disabled: Colors.l50 + property color hovered: Colors.j.color + property color normal: Colors.j.color + property color pressed: Colors.j.color + property color disabled: Colors.l50.color } } } @@ -68,9 +67,9 @@ QtObject { property int height: 40 property QtObject color: QtObject { - property color hovered: Colors.v - property color normal: Colors.a - property color pressed: Colors.v + property color hovered: Colors.v.color + property color normal: Colors.a.color + property color pressed: Colors.v.color } } @@ -79,10 +78,10 @@ QtObject { property int weight : Font.Normal property QtObject color: QtObject { - property color hovered: Colors.error - property color normal: Colors.error - property color pressed: Colors.error - property color disabled: Colors.l50 + property color hovered: Colors.error.color + property color normal: Colors.error.color + property color pressed: Colors.error.color + property color disabled: Colors.l50.color } } } @@ -94,9 +93,9 @@ QtObject { property int height: 50 property QtObject color: QtObject { - property color hovered: Colors.w - property color normal: Colors.w - property color pressed: Colors.w + property color hovered: Colors.w.color + property color normal: Colors.w.color + property color pressed: Colors.w.color } } @@ -105,10 +104,10 @@ QtObject { property int weight : Font.Normal property QtObject color: QtObject { - property color hovered: Colors.m - property color normal: Colors.j - property color pressed: Colors.m - property color disabled: Colors.l50 + property color hovered: Colors.m.color + property color normal: Colors.j.color + property color pressed: Colors.m.color + property color disabled: Colors.l50.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Menus/MenuStyle.qml b/linphone-app/ui/modules/Common/Styles/Menus/MenuStyle.qml index 8c4dfc804..888173630 100644 --- a/linphone-app/ui/modules/Common/Styles/Menus/MenuStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Menus/MenuStyle.qml @@ -1,41 +1,40 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { property QtObject normal : QtObject { - property color color: Colors.q + property color color: Colors.q.color property int width: 130 property bool shadowEnabled: true property int radius : 0 property QtObject border : QtObject { - property color color: Colors.u + property color color: Colors.u.color property int width: 0 } } property QtObject aux : QtObject { - property color color: Colors.q + property color color: Colors.q.color property int width: 200 property bool shadowEnabled: false property int radius : 5 property QtObject border : QtObject { - property color color: Colors.u + property color color: Colors.u.color property int width: 1 } } property QtObject aux2 : QtObject { - property color color: Colors.q + property color color: Colors.q.color property int width: 250 property bool shadowEnabled: false property int radius : 0 property QtObject border : QtObject { - property color color: Colors.u + property color color: Colors.u.color property int width: 0 } } diff --git a/linphone-app/ui/modules/Common/Styles/Misc/ForceScrollBarStyle.qml b/linphone-app/ui/modules/Common/Styles/Misc/ForceScrollBarStyle.qml index 9ce327dbf..7f6494af8 100644 --- a/linphone-app/ui/modules/Common/Styles/Misc/ForceScrollBarStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Misc/ForceScrollBarStyle.qml @@ -1,13 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { property QtObject background : QtObject { - property color color: Colors.g20 + property color color: Colors.g20.color property int radius : 10 } @@ -18,8 +16,8 @@ QtObject { } property QtObject color: QtObject { - property color hovered: Colors.h - property color normal: Colors.g20 - property color pressed: Colors.d + property color hovered: Colors.h.color + property color normal: Colors.g20.color + property color pressed: Colors.d.color } } diff --git a/linphone-app/ui/modules/Common/Styles/Misc/PanedStyle.qml b/linphone-app/ui/modules/Common/Styles/Misc/PanedStyle.qml index 01f04b547..a15bc57e5 100644 --- a/linphone-app/ui/modules/Common/Styles/Misc/PanedStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Misc/PanedStyle.qml @@ -1,8 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { @@ -12,9 +10,9 @@ QtObject { property int width: 5 property QtObject color: QtObject { - property color hovered: Colors.h - property color normal: Colors.c - property color pressed: Colors.d + property color hovered: Colors.h.color + property color normal: Colors.c.color + property color pressed: Colors.d.color } } } diff --git a/linphone-app/ui/modules/Common/Styles/Popup/PopupStyle.qml b/linphone-app/ui/modules/Common/Styles/Popup/PopupStyle.qml index 9c16ad641..71cd84339 100644 --- a/linphone-app/ui/modules/Common/Styles/Popup/PopupStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Popup/PopupStyle.qml @@ -1,15 +1,14 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.k + property color backgroundColor: Colors.k.color property QtObject shadow: QtObject { - property color color: Colors.l + property color color: Colors.l.color property int horizontalOffset: 2 property int radius: 10 property int samples: 15 diff --git a/linphone-app/ui/modules/Common/Styles/Tooltip/TooltipStyle.qml b/linphone-app/ui/modules/Common/Styles/Tooltip/TooltipStyle.qml index 0e59f41d8..17d88d98b 100644 --- a/linphone-app/ui/modules/Common/Styles/Tooltip/TooltipStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Tooltip/TooltipStyle.qml @@ -1,14 +1,13 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.g - property color color: Colors.q + property color backgroundColor: Colors.g.color + property color color: Colors.q.color property int arrowSize: 8 property int delay: 1000 property int pointSize: Units.dp * 9 diff --git a/linphone-app/ui/modules/Common/Styles/Window/WindowStyle.qml b/linphone-app/ui/modules/Common/Styles/Window/WindowStyle.qml index 0c2e2fa71..daf194d73 100644 --- a/linphone-app/ui/modules/Common/Styles/Window/WindowStyle.qml +++ b/linphone-app/ui/modules/Common/Styles/Window/WindowStyle.qml @@ -1,12 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { property QtObject transientWindow: QtObject { - property color color: Colors.l80 + property color color: Colors.l80.color } } diff --git a/linphone-app/ui/modules/Linphone/Chat/Notice.qml b/linphone-app/ui/modules/Linphone/Chat/Notice.qml index 015cc8fa9..fc1e2fd12 100644 --- a/linphone-app/ui/modules/Linphone/Chat/Notice.qml +++ b/linphone-app/ui/modules/Linphone/Chat/Notice.qml @@ -6,7 +6,6 @@ import Linphone 1.0 import Linphone.Styles 1.0 import Utils 1.0 import LinphoneEnums 1.0 -import Colors 1.0 import Units 1.0 // ============================================================================= diff --git a/linphone-app/ui/modules/Linphone/Contact/ContactDescription.qml b/linphone-app/ui/modules/Linphone/Contact/ContactDescription.qml index 8ffaecf0a..9a2530fd0 100644 --- a/linphone-app/ui/modules/Linphone/Contact/ContactDescription.qml +++ b/linphone-app/ui/modules/Linphone/Contact/ContactDescription.qml @@ -29,7 +29,7 @@ Column { Text { id: username - + anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined) color: usernameColor elide: Text.ElideRight font.weight: contactDescriptionStyle.username.weight @@ -55,6 +55,7 @@ Column { Text { id:address + anchors.horizontalCenter: (horizontalTextAlignment == Text.AlignHCenter ? parent.horizontalCenter : undefined) text: SipAddressesModel.cleanSipAddress(sipAddress) color: sipAddressColor elide: Text.ElideRight diff --git a/linphone-app/ui/modules/Linphone/Notifications/Notification.qml b/linphone-app/ui/modules/Linphone/Notifications/Notification.qml index 8570dde1f..35bfa20b7 100644 --- a/linphone-app/ui/modules/Linphone/Notifications/Notification.qml +++ b/linphone-app/ui/modules/Linphone/Notifications/Notification.qml @@ -9,7 +9,9 @@ DesktopPopup { id: notification property alias icon: iconSign.icon - property var notificationData: ({}) + property var notificationData: ({ + timelineModel : null + }) property int overrodeHeight default property alias _content: content.data diff --git a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml index 906cd654d..92de4f662 100644 --- a/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml +++ b/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml @@ -76,6 +76,7 @@ Notification { onClicked: notification._close(function () { AccountSettingsModel.setDefaultProxyConfigFromSipAddress(notification.localAddress) + notification.timelineModel.selected = true notification.notificationData.window.setView('Conversation', { chatRoomModel:notification.timelineModel.getChatRoomModel()/*, peerAddress: notification.peerAddress, diff --git a/linphone-app/ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml index 3652edc48..cc0a672a9 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -16,12 +15,12 @@ QtObject { } property QtObject sipAddress: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 10 } property QtObject username: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 11 } property QtObject messageCounter: QtObject { diff --git a/linphone-app/ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml index 6f0200ce8..2934e0097 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Blocks/CardBlockStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -15,7 +14,7 @@ QtObject { } property QtObject description: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int pointSize: Units.dp * 10 property int height: 40 } @@ -26,7 +25,7 @@ QtObject { } property QtObject title: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int bottomMargin: 10 property int pointSize: Units.dp * 10 property int height: 20 diff --git a/linphone-app/ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml index efd19a8fe..ce434fe3a 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Blocks/RequestBlockStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -10,7 +9,7 @@ QtObject { property int height: 60 property QtObject error: QtObject { - property color color: Colors.error + property color color: Colors.error.color property int pointSize: Units.dp * 11 property int padding: 4 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml index c22e48f49..12a2fc43f 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Calls/CallControlsStyle.qml @@ -1,12 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color color: Colors.e + property color color: Colors.e.color property int height: 60 property int leftMargin: 12 property int rightMargin: 12 diff --git a/linphone-app/ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml index 208567dc8..841451ab8 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Calls/CallStatisticsStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.e + property color color: Colors.e.color property int height: 280 property int leftMargin: 12 property int rightMargin: 12 @@ -15,19 +14,19 @@ QtObject { property int topMargin: 10 property QtObject title: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int bottomMargin: 20 property int pointSize: Units.dp * 16 } property QtObject key: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int width: 200 } property QtObject value: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Calls/CallsStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Calls/CallsStyle.qml index a17d7ac3a..86021f937 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Calls/CallsStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Calls/CallsStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= @@ -13,24 +12,24 @@ QtObject { property int width: 200 property QtObject color: QtObject { - property color normal: Colors.e - property color selected: Colors.j + property color normal: Colors.e.color + property color selected: Colors.j.color } property QtObject endCallAnimation: QtObject { - property color blinkColor: Colors.i + property color blinkColor: Colors.i.color property int duration: 300 property int loops: 3 } property QtObject sipAddressColor: QtObject { - property color normal: Colors.n - property color selected: Colors.q + property color normal: Colors.n.color + property color selected: Colors.q.color } property QtObject usernameColor: QtObject { - property color normal: Colors.j - property color selected: Colors.q + property color normal: Colors.j.color + property color selected: Colors.q.color } } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Calls/ConferenceControlsStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Calls/ConferenceControlsStyle.qml index f9248b924..ab4b00687 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Calls/ConferenceControlsStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Calls/ConferenceControlsStyle.qml @@ -1,12 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color color: Colors.e + property color color: Colors.e.color property int height: 60 property int leftMargin: 12 property int rightMargin: 12 diff --git a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml index cf40be3ff..9cba068b9 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml @@ -1,26 +1,25 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.q + property color color: Colors.q.color property QtObject sectionHeading: QtObject { property int padding: 5 property int bottomMargin: 20 property QtObject border: QtObject { - property color color: Colors.g10 + property color color: Colors.g10.color property int width: 1 } property QtObject text: QtObject { property int pointSize: Units.dp * 10 - property color color: Colors.g + property color color: Colors.g.color } } @@ -28,13 +27,13 @@ QtObject { property int height: 80 property QtObject border: QtObject { - property color color: Colors.f + property color color: Colors.f.color property int width: 1 } } property QtObject composingText: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int height: 25 property int leftPadding: 20 property int pointSize: Units.dp * 9 @@ -51,7 +50,7 @@ QtObject { property int iconSize: 18 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } @@ -80,11 +79,11 @@ QtObject { property QtObject extension: QtObject { property QtObject background: QtObject { - property color color: Colors.l50 + property color color: Colors.l50.color } property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color } } @@ -96,11 +95,11 @@ QtObject { property int radius: 3 property QtObject background: QtObject { - property color color: Colors.f + property color color: Colors.f.color } property QtObject contentItem: QtObject { - property color color: Colors.p + property color color: Colors.p.color } } } @@ -111,30 +110,30 @@ QtObject { } property QtObject incoming: QtObject { - property color backgroundColor: Colors.o + property color backgroundColor: Colors.o.color property int avatarSize: 20 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } property QtObject outgoing: QtObject { - property color backgroundColor: Colors.e + property color backgroundColor: Colors.e.color property int areaSize: 16 property int busyIndicatorSize: 16 property int sendIconSize: 12 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } } property QtObject time: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int width: 44 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml index 250a7779b..adb0661ad 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Codecs/CodecsViewerStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -14,8 +13,8 @@ QtObject { property QtObject background: QtObject { property QtObject color: QtObject { - property color normal: Colors.a - property color hovered: Colors.o + property color normal: Colors.a.color + property color hovered: Colors.o.color } } @@ -24,7 +23,7 @@ QtObject { } property QtObject text: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 } } @@ -39,7 +38,7 @@ QtObject { } property QtObject legend: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 property int height: 50 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml index 4aa8f1744..19915c0f8 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Contact/AvatarStyle.qml @@ -1,16 +1,15 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.d + property color backgroundColor: Colors.d.color property QtObject initials: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSize: Units.dp * 10 property int ratio: 30 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml index 12b3ecbbf..370f1464e 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Contact/ContactDescriptionStyle.qml @@ -2,24 +2,23 @@ pragma Singleton import QtQml 2.2 import QtQuick 2.7 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { property QtObject sipAddress: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int pointSize: Units.dp * 10 property int weight: Font.Normal } property QtObject username: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 11 property int weight: Font.Bold property QtObject status : QtObject{ - property color color : Colors.g + property color color : Colors.g.color property int pointSize : Units.dp * 9 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Contact/ContactMessageCounterStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Contact/ContactMessageCounterStyle.qml index c88e12764..18b121163 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Contact/ContactMessageCounterStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Contact/ContactMessageCounterStyle.qml @@ -1,8 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 -import Units 1.0 // ============================================================================= diff --git a/linphone-app/ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml index 8d975cbc6..4df18e665 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -18,19 +17,19 @@ QtObject { property int radius: 6 property QtObject background: QtObject { - property color color: Colors.f + property color color: Colors.f.color } property QtObject contentItem: QtObject { property QtObject color: QtObject { - property color failed: Colors.error - property color normal: Colors.p + property color failed: Colors.error.color + property color normal: Colors.p.color } } } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 11 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/History/HistoryStyle.qml b/linphone-app/ui/modules/Linphone/Styles/History/HistoryStyle.qml index e459a0ef3..8952a6e00 100644 --- a/linphone-app/ui/modules/Linphone/Styles/History/HistoryStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/History/HistoryStyle.qml @@ -1,26 +1,25 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.q + property color color: Colors.q.color property QtObject sectionHeading: QtObject { property int padding: 5 property int bottomMargin: 20 property QtObject border: QtObject { - property color color: Colors.g10 + property color color: Colors.g10.color property int width: 1 } property QtObject text: QtObject { property int pointSize: Units.dp * 10 - property color color: Colors.g + property color color: Colors.g.color } } @@ -36,7 +35,7 @@ QtObject { property int iconSize: 18 property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } @@ -53,7 +52,7 @@ QtObject { } property QtObject time: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int width: 44 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml index a1cda29b2..16a6656db 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -17,13 +16,13 @@ QtObject { property int width: 300 property QtObject color: QtObject { - property color hovered: Colors.j - property color normal: Colors.g - property color pressed: Colors.i + property color hovered: Colors.j.color + property color normal: Colors.g.color + property color pressed: Colors.i.color } property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Misc/MessageCounterStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Misc/MessageCounterStyle.qml index 62ca53a13..d0c5a02e4 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Misc/MessageCounterStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Misc/MessageCounterStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -13,7 +12,7 @@ QtObject { } property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSize: Units.dp * 6 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationBasicStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationBasicStyle.qml index fcc16bdff..e2c7c6ecc 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationBasicStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationBasicStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -12,7 +11,7 @@ QtObject { property int overrodeHeight: 55 property QtObject message: QtObject { - property color color: Colors.h + property color color: Colors.h.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml index b7782a5eb..957699799 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedFileMessageStyle.qml @@ -1,25 +1,24 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int leftMargin: 25 property int overrodeHeight: 55 property int rightMargin: 15 property int spacing: 10 property QtObject fileName: QtObject { - property color color: Colors.h + property color color: Colors.h.color property int pointSize: Units.dp * 10 } property QtObject fileSize: QtObject { - property color color: Colors.h + property color color: Colors.h.color property int pointSize: Units.dp * 9 property int width: 100 } diff --git a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml index df081addf..5ade58321 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationReceivedMessageStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int bottomMargin: 15 property int leftMargin: 15 property int overrodeHeight: 55 @@ -15,12 +14,12 @@ QtObject { property int spacing: 0 property QtObject messageContainer: QtObject { - property color color: Colors.o + property color color: Colors.o.color property int radius: 6 property int margins: 10 property QtObject text: QtObject { - property color color: Colors.l + property color color: Colors.l.color property int pointSize: Units.dp * 9 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationStyle.qml index 8a17b30f1..0c82e6b89 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Notifications/NotificationStyle.qml @@ -1,18 +1,16 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int height: 120 property int iconSize: 40 property int width: 300 property QtObject border: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int width: 1 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/TelKeypad/TelKeypadStyle.qml b/linphone-app/ui/modules/Linphone/Styles/TelKeypad/TelKeypadStyle.qml index 10d25033b..eddac5783 100644 --- a/linphone-app/ui/modules/Linphone/Styles/TelKeypad/TelKeypadStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/TelKeypad/TelKeypadStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -11,19 +10,19 @@ QtObject { property int height: 180 property int rowSpacing: 0 property int width: 180 - property color color: Colors.k - property color selectedColor : Colors.m + property color color: Colors.k.color + property color selectedColor : Colors.m.color property int selectedBorderWidth: 2 property real radius : 5.0 property QtObject button: QtObject { property QtObject color: QtObject { - property color normal: Colors.q - property color pressed: Colors.i + property color normal: Colors.q.color + property color pressed: Colors.i.color } property QtObject line: QtObject { - property color color: Colors.l50 + property color color: Colors.l50.color property int bottomMargin: 4 property int height: 2 property int leftMargin: 8 @@ -32,7 +31,7 @@ QtObject { } property QtObject text: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 11 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml index d3ddbf0ab..b0cf7476e 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Timeline/TimelineStyle.qml @@ -1,44 +1,43 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color color: Colors.q + property color color: Colors.q.color property QtObject contact: QtObject { property int height: 60 property QtObject backgroundColor: QtObject { - property color a: Colors.g10 - property color b: Colors.a - property color selected: Colors.i + property color a: Colors.g10.color + property color b: Colors.a.color + property color selected: Colors.i.color } property QtObject sipAddress: QtObject { property QtObject color: QtObject { - property color normal: Colors.n - property color selected: Colors.q + property color normal: Colors.n.color + property color selected: Colors.q.color } } property QtObject username: QtObject { property QtObject color: QtObject { - property color normal: Colors.j - property color selected: Colors.q + property color normal: Colors.j.color + property color selected: Colors.q.color } } } property QtObject legend: QtObject { property QtObject backgroundColor: QtObject { - property color normal: Colors.f - property color hovered: Colors.c + property color normal: Colors.f.color + property color hovered: Colors.c.color } - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 property int height: 30 property int iconSize: 14 diff --git a/linphone-app/ui/modules/Linphone/Styles/View/ParticipantsViewStyle.qml b/linphone-app/ui/modules/Linphone/Styles/View/ParticipantsViewStyle.qml index 0e7676a89..12b0b8f49 100644 --- a/linphone-app/ui/modules/Linphone/Styles/View/ParticipantsViewStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/View/ParticipantsViewStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -10,7 +9,7 @@ QtObject { property QtObject entry: QtObject { property QtObject status: QtObject { - property color color : Colors.g + property color color : Colors.g.color property int pointSize : Units.dp * 8 } } diff --git a/linphone-app/ui/modules/Linphone/Styles/View/SipAddressesViewStyle.qml b/linphone-app/ui/modules/Linphone/Styles/View/SipAddressesViewStyle.qml index f160136f5..56b5d8309 100644 --- a/linphone-app/ui/modules/Linphone/Styles/View/SipAddressesViewStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/View/SipAddressesViewStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -13,17 +12,17 @@ QtObject { property int rightMargin: 10 property QtObject color: QtObject { - property color hovered: Colors.o - property color normal: Colors.q + property color hovered: Colors.o.color + property color normal: Colors.q.color } property QtObject indicator: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int width: 5 } property QtObject separator: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int height: 1 } } @@ -38,16 +37,16 @@ QtObject { } property QtObject color: QtObject { - property color normal: Colors.j - property color pressed: Colors.i + property color normal: Colors.j.color + property color pressed: Colors.i.color } property QtObject text: QtObject { property int pointSize: Units.dp * 9 property QtObject color: QtObject { - property color normal: Colors.q - property color pressed: Colors.q + property color normal: Colors.q.color + property color pressed: Colors.q.color } } } diff --git a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml index 088346145..cca72e11f 100644 --- a/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml +++ b/linphone-app/ui/modules/Linphone/Timeline/Timeline.qml @@ -223,7 +223,7 @@ Rectangle { width: parent ? parent.width : 0 Contact { - property bool isSelected: modelData.selected //view.currentIndex === index + property bool isSelected: modelData != undefined && modelData.selected //view.currentIndex === index anchors.fill: parent color: isSelected diff --git a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml index 3b7e14ac8..963a9b66f 100644 --- a/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml +++ b/linphone-app/ui/modules/Linphone/View/ParticipantsView.qml @@ -31,6 +31,8 @@ ScrollableListView { property bool showSeparator : true property bool showAdminStatus : false property bool isSelectable : true + property bool showInvitingIndicator : true + property int hoveredCursor : Qt.PointingHandCursor property var switchHandler : function(checked, index){ } @@ -234,13 +236,14 @@ ScrollableListView { MouseArea { anchors.fill: parent onClicked: sipAddressesView.entryClicked(parent.entry, index) + cursorShape: sipAddressesView.hoveredCursor } BusyIndicator{ anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter width:15 height:15 - running: modelData.inviting + running: sipAddressesView.showInvitingIndicator && modelData.inviting } } @@ -277,7 +280,7 @@ ScrollableListView { visible: { var visible = sipAddressesView.actions[index].visible return visible === undefined || visible - } + } onClicked: { sipAddressesView.actions[index].handler(contactView.entry) diff --git a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml index 44d5c299e..4aebc5c7d 100644 --- a/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml +++ b/linphone-app/ui/modules/Linphone/View/SipAddressesView.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3 import Common 1.0 import Linphone 1.0 import LinphoneEnums 1.0 +import UtilsCpp 1.0 import Linphone.Styles 1.0 import Common.Styles 1.0 @@ -117,7 +118,7 @@ ScrollableListView { icon: modelData.icon visible: { var visible = sipAddressesView.actions[index].visible - return (visible === undefined || visible) && (modelData.secure==0 || !$sipAddress.contactModel || $sipAddress.contactModel.hasCapability(LinphoneEnums.FriendCapabilityLimeX3Dh)) + return (visible === undefined || visible) && (modelData.secure==0 || UtilsCpp.hasCapability(sipAddressesView.interpretableSipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh)) } onClicked: sipAddressesView.actions[index].handler({ @@ -239,7 +240,7 @@ ScrollableListView { MouseArea { anchors.fill: parent - onClicked: sipAddressesView.entryClicked($sipAddress.sipAddress, ) + onClicked: sipAddressesView.entryClicked($sipAddress.sipAddress, index) } } @@ -280,8 +281,6 @@ ScrollableListView { } onClicked: { - console.log($sipAddress) - console.log($sipAddress.sipAddress) sipAddressesView.actions[index].handler($sipAddress) } Icon{ diff --git a/linphone-app/ui/scripts/Utils/utils.js b/linphone-app/ui/scripts/Utils/utils.js index 74f0aa134..53085ae58 100644 --- a/linphone-app/ui/scripts/Utils/utils.js +++ b/linphone-app/ui/scripts/Utils/utils.js @@ -211,7 +211,8 @@ function openWindow (window, parent, options, fullscreen) { function resolveImageUri (name) { return name - ? 'image://internal/' + removeScheme(Qt.resolvedUrl('/assets/images/' + name + '.svg')) + //? 'image://internal/' + removeScheme(Qt.resolvedUrl('/assets/images/' + name + '.svg')) + ? 'image://internal/' + name : '' } diff --git a/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml b/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml index 6b9fee5eb..09be11770 100644 --- a/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml +++ b/linphone-app/ui/views/App/Calls/AbstractStartingCall.qml @@ -38,12 +38,12 @@ Rectangle { ContactDescription { id: contactDescription - + anchors.horizontalCenter: parent.horizontalCenter height: CallStyle.header.contactDescription.height horizontalTextAlignment: Text.AlignHCenter sipAddress: call.peerAddress username: LinphoneUtils.getContactUsername(_sipAddressObserver) - width: parent.width + width: contentWidth } BusyIndicator { diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index ff24d1f71..90ad4243e 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -15,433 +15,433 @@ import 'Incall.js' as Logic // ============================================================================= Rectangle { - id: incall - - // --------------------------------------------------------------------------- - - // Used by `IncallFullscreenWindow.qml`. - readonly property bool cameraActivated: - cameraLoader.status !== Loader.Null || - cameraPreviewLoader.status !== Loader.Null - - property var call - - property var _sipAddressObserver: SipAddressesModel.getSipAddressObserver(call.fullPeerAddress, call.fullLocalAddress) - property var _fullscreen: null - - // --------------------------------------------------------------------------- - - color: CallStyle.backgroundColor - anchors.fill:parent - - // --------------------------------------------------------------------------- - - Connections { - target: call - - onCameraFirstFrameReceived: Logic.handleCameraFirstFrameReceived(width, height) - onStatusChanged: Logic.handleStatusChanged (status) - onVideoRequested: Logic.handleVideoRequested() - } - - ColumnLayout { - anchors { - fill: parent - topMargin: CallStyle.header.topMargin - } - - spacing: 0 - - // ------------------------------------------------------------------------- - // Call info. - // ------------------------------------------------------------------------- - - Item { - id: info - - Layout.fillWidth: true - Layout.leftMargin: CallStyle.header.leftMargin - Layout.rightMargin: CallStyle.header.rightMargin - Layout.preferredHeight: CallStyle.header.contactDescription.height - - ActionBar { - id: leftActions - - anchors.left: parent.left - iconSize: CallStyle.header.iconSize - - ActionButton { - id: callQuality - - icon: 'call_quality_0' - useStates: false - - onClicked: Logic.openCallStatistics() - - // See: http://www.linphone.org/docs/liblinphone/group__call__misc.html#ga62c7d3d08531b0cc634b797e273a0a73 - Timer { - interval: 500 - repeat: true - running: true - triggeredOnStart: true - - onTriggered: Logic.updateCallQualityIcon(callQuality, call) - } - - CallStatistics { - id: callStatistics - - call: incall.call - width: container.width - - relativeTo: callQuality - relativeY: CallStyle.header.stats.relativeY - - onClosed: Logic.handleCallStatisticsClosed() - } - } - - ActionButton { - icon: 'tel_keypad' - - onClicked: telKeypad.visible = !telKeypad.visible - } - - ActionButton { - id: callSecure - - icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure' - - onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZrtp) - - TooltipArea { - text: Logic.makeReadableSecuredString(incall.call.securedString) - } - } - } - - ContactDescription { - id: contactDescription - - anchors.centerIn: parent - horizontalTextAlignment: Text.AlignHCenter - sipAddress: _sipAddressObserver.peerAddress - username: LinphoneUtils.getContactUsername(_sipAddressObserver) - - height: parent.height - width: parent.width - rightActions.width - leftActions.width - Text { - id: elapsedTime - color: CallStyle.header.elapsedTime.color - font.pointSize: CallStyle.header.elapsedTime.pointSize - horizontalAlignment: Text.AlignHCenter - width: parent.width - - Timer { - interval: 1000 - repeat: true - running: true - triggeredOnStart: true - - onTriggered: {elapsedTime.text = Utils.formatElapsedTime(call.duration);} - } - } - } - - // ----------------------------------------------------------------------- - // Video actions. - // ----------------------------------------------------------------------- - - ActionBar { - id: rightActions - - anchors.right: parent.right - iconSize: CallStyle.header.buttonIconSize - - ActionButton { - icon: 'screenshot' - visible: incall.call.videoEnabled - - onClicked: incall.call.takeSnapshot() - - TooltipArea { - text: qsTr('takeSnapshotLabel') - } - } - - ActionSwitch { - id: recordingSwitch - - enabled: incall.call.recording - icon: 'record' - useStates: false - visible: SettingsModel.callRecorderEnabled - - onClicked: { - var call = incall.call - return !enabled - ? call.startRecording() - : call.stopRecording() - } - - onVisibleChanged: { - if (!visible) { - call.stopRecording() - } - } - - TooltipArea { - text: !recordingSwitch.enabled - ? qsTr('startRecordingLabel') - : qsTr('stopRecordingLabel') - } - } - - ActionButton { - icon: 'fullscreen' - visible: incall.call.videoEnabled - - onClicked: Logic.showFullscreen(contactDescription.mapToGlobal(0,0)) - } - } - } - - // ------------------------------------------------------------------------- - // Contact visual. - // ------------------------------------------------------------------------- - - Item { - id: container - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.margins: CallStyle.container.margins - - Component { - id: avatar - - IncallAvatar { - call: incall.call - height: Logic.computeAvatarSize(CallStyle.container.avatar.maxSize) - width: height - } - } - - Loader { - id: cameraLoader - - anchors.centerIn: parent - - active: incall.call.videoEnabled && !_fullscreen - sourceComponent: camera - - Component { - id: camera - - Camera { - call: incall.call - height: container.height - width: container.width - } - } - } - - Loader { - anchors.centerIn: parent - - active: !call.videoEnabled || _fullscreen - sourceComponent: avatar - } - } - - // ------------------------------------------------------------------------- - // Zrtp. - // ------------------------------------------------------------------------- - - ZrtpTokenAuthentication { - id: zrtp - - Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter - Layout.margins: CallStyle.container.margins - - call: incall.call - visible: !call.isSecured && call.encryption !== CallModel.CallEncryptionNone - z: Constants.zPopup - } - - // ------------------------------------------------------------------------- - // Action Buttons. - // ------------------------------------------------------------------------- - - Item { - Layout.fillWidth: true - Layout.preferredHeight: CallStyle.actionArea.height - - GridLayout { - anchors { - left: parent.left - leftMargin: CallStyle.actionArea.leftButtonsGroupMargin - verticalCenter: parent.verticalCenter - } - - columns: incall.width < CallStyle.actionArea.lowWidth ? 2 : 4 - rowSpacing: ActionBarStyle.spacing - - Row { - spacing: CallStyle.actionArea.vu.spacing - visible: SettingsModel.muteMicrophoneEnabled - - VuMeter { - Timer { - interval: 50 - repeat: true - running: micro.enabled - - onTriggered: parent.value = incall.call.microVu - } - - enabled: micro.enabled - } - - ActionSwitch { - id: micro - - enabled: !call.microMuted - icon: 'micro' - iconSize: CallStyle.actionArea.iconSize - - onClicked: incall.call.microMuted = enabled - } - } - - Row { - spacing: CallStyle.actionArea.vu.spacing - - VuMeter { - Timer { - interval: 50 - repeat: true - running: speaker.enabled - - onTriggered: parent.value = incall.call.speakerVu - } - - enabled: speaker.enabled - } - - ActionSwitch { - id: speaker - - enabled: !call.speakerMuted - icon: 'speaker' - iconSize: CallStyle.actionArea.iconSize - - onClicked: incall.call.speakerMuted = enabled - } - } - - ActionSwitch { - enabled: incall.call.videoEnabled - icon: 'camera' - iconSize: CallStyle.actionArea.iconSize - updating: incall.call.updating - visible: SettingsModel.videoSupported - - onClicked: incall.call.videoEnabled = !enabled - - TooltipArea { - text: qsTr('pendingRequestLabel') - visible: parent.updating - } - } - - ActionButton { - Layout.preferredHeight: CallStyle.actionArea.iconSize - Layout.preferredWidth: CallStyle.actionArea.iconSize - - icon: 'options' - iconSize: CallStyle.actionArea.iconSize - - onClicked: Logic.openMediaParameters(window, incall) - } - } - - // ----------------------------------------------------------------------- - // Preview. - // ----------------------------------------------------------------------- - - Loader { - id: cameraPreviewLoader - - anchors.centerIn: parent - height: CallStyle.actionArea.userVideo.height - width: CallStyle.actionArea.userVideo.width - active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !_fullscreen - sourceComponent: cameraPreview - Component { - id: cameraPreview - - Camera { - anchors.fill: parent - call: incall.call - isPreview: true - } - } - } - - ActionBar { - id: bottomActions - - anchors { - right: parent.right - rightMargin: CallStyle.actionArea.rightButtonsGroupMargin - verticalCenter: parent.verticalCenter - } - iconSize: CallStyle.actionArea.iconSize - - ActionSwitch { - enabled: !call.pausedByUser - icon: 'pause' - updating: incall.call.updating - visible: SettingsModel.callPauseEnabled - - onClicked: incall.call.pausedByUser = enabled - - TooltipArea { - text: qsTr('pendingRequestLabel') - visible: parent.updating - } - } - - ActionButton { - icon: 'hangup' - - onClicked: incall.call.terminate() - } - - ActionButton { - icon: SettingsModel.chatEnabled && SettingsModel.showStartChatButton ? 'chat' : 'history' - - onClicked: { - if (window.chatIsOpened) { - window.closeChat() - } else { - window.openChat() - } - } - } - } - } - } - - // --------------------------------------------------------------------------- - // TelKeypad. - // --------------------------------------------------------------------------- - - TelKeypad { - id: telKeypad - - call: incall.call - visible: SettingsModel.showTelKeypadAutomatically - } + id: incall + + // --------------------------------------------------------------------------- + + // Used by `IncallFullscreenWindow.qml`. + readonly property bool cameraActivated: + cameraLoader.status !== Loader.Null || + cameraPreviewLoader.status !== Loader.Null + + property var call + + property var _sipAddressObserver: SipAddressesModel.getSipAddressObserver(call.fullPeerAddress, call.fullLocalAddress) + property var _fullscreen: null + + // --------------------------------------------------------------------------- + + color: CallStyle.backgroundColor + anchors.fill:parent + + // --------------------------------------------------------------------------- + + Connections { + target: call + + onCameraFirstFrameReceived: Logic.handleCameraFirstFrameReceived(width, height) + onStatusChanged: Logic.handleStatusChanged (status) + onVideoRequested: Logic.handleVideoRequested() + } + + ColumnLayout { + anchors { + fill: parent + topMargin: CallStyle.header.topMargin + } + + spacing: 0 + + // ------------------------------------------------------------------------- + // Call info. + // ------------------------------------------------------------------------- + + Item { + id: info + + Layout.fillWidth: true + Layout.leftMargin: CallStyle.header.leftMargin + Layout.rightMargin: CallStyle.header.rightMargin + Layout.preferredHeight: CallStyle.header.contactDescription.height + + ActionBar { + id: leftActions + + anchors.left: parent.left + iconSize: CallStyle.header.iconSize + + ActionButton { + id: callQuality + + icon: 'call_quality_0' + useStates: false + + onClicked: Logic.openCallStatistics() + + // See: http://www.linphone.org/docs/liblinphone/group__call__misc.html#ga62c7d3d08531b0cc634b797e273a0a73 + Timer { + interval: 500 + repeat: true + running: true + triggeredOnStart: true + + onTriggered: Logic.updateCallQualityIcon(callQuality, call) + } + + CallStatistics { + id: callStatistics + + call: incall.call + width: container.width + + relativeTo: callQuality + relativeY: CallStyle.header.stats.relativeY + + onClosed: Logic.handleCallStatisticsClosed() + } + } + + ActionButton { + icon: 'tel_keypad' + + onClicked: telKeypad.visible = !telKeypad.visible + } + + ActionButton { + id: callSecure + + icon: incall.call.isSecured ? 'call_chat_secure' : 'call_chat_unsecure' + + onClicked: zrtp.visible = (incall.call.encryption === CallModel.CallEncryptionZrtp) + + TooltipArea { + text: Logic.makeReadableSecuredString(incall.call.securedString) + } + } + } + + ContactDescription { + id: contactDescription + + anchors.centerIn: parent + horizontalTextAlignment: Text.AlignHCenter + sipAddress: _sipAddressObserver.peerAddress + username: LinphoneUtils.getContactUsername(_sipAddressObserver) + + height: parent.height + width: parent.width - rightActions.width - leftActions.width + Text { + id: elapsedTime + color: CallStyle.header.elapsedTime.color + font.pointSize: CallStyle.header.elapsedTime.pointSize + horizontalAlignment: Text.AlignHCenter + width: parent.width + + Timer { + interval: 1000 + repeat: true + running: true + triggeredOnStart: true + + onTriggered: {elapsedTime.text = Utils.formatElapsedTime(call.duration);} + } + } + } + + // ----------------------------------------------------------------------- + // Video actions. + // ----------------------------------------------------------------------- + + ActionBar { + id: rightActions + + anchors.right: parent.right + iconSize: CallStyle.header.buttonIconSize + + ActionButton { + icon: 'screenshot' + visible: incall.call.videoEnabled + + onClicked: incall.call.takeSnapshot() + + TooltipArea { + text: qsTr('takeSnapshotLabel') + } + } + + ActionSwitch { + id: recordingSwitch + + enabled: incall.call.recording + icon: 'record' + useStates: false + visible: SettingsModel.callRecorderEnabled + + onClicked: { + var call = incall.call + return !enabled + ? call.startRecording() + : call.stopRecording() + } + + onVisibleChanged: { + if (!visible) { + call.stopRecording() + } + } + + TooltipArea { + text: !recordingSwitch.enabled + ? qsTr('startRecordingLabel') + : qsTr('stopRecordingLabel') + } + } + + ActionButton { + icon: 'fullscreen' + visible: incall.call.videoEnabled + + onClicked: Logic.showFullscreen(contactDescription.mapToGlobal(0,0)) + } + } + } + + // ------------------------------------------------------------------------- + // Contact visual. + // ------------------------------------------------------------------------- + + Item { + id: container + + Layout.fillWidth: true + Layout.fillHeight: true + Layout.margins: CallStyle.container.margins + + Component { + id: avatar + + IncallAvatar { + call: incall.call + height: Logic.computeAvatarSize(CallStyle.container.avatar.maxSize) + width: height + } + } + + Loader { + id: cameraLoader + + anchors.centerIn: parent + + active: incall.call.videoEnabled && !_fullscreen + sourceComponent: camera + + Component { + id: camera + + Camera { + call: incall.call + height: container.height + width: container.width + } + } + } + + Loader { + anchors.centerIn: parent + + active: !call.videoEnabled || _fullscreen + sourceComponent: avatar + } + } + + // ------------------------------------------------------------------------- + // Zrtp. + // ------------------------------------------------------------------------- + + ZrtpTokenAuthentication { + id: zrtp + + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter + Layout.margins: CallStyle.container.margins + + call: incall.call + visible: !call.isSecured && call.encryption !== CallModel.CallEncryptionNone + z: Constants.zPopup + } + + // ------------------------------------------------------------------------- + // Action Buttons. + // ------------------------------------------------------------------------- + + Item { + Layout.fillWidth: true + Layout.preferredHeight: CallStyle.actionArea.height + + GridLayout { + anchors { + left: parent.left + leftMargin: CallStyle.actionArea.leftButtonsGroupMargin + verticalCenter: parent.verticalCenter + } + + columns: incall.width < CallStyle.actionArea.lowWidth ? 2 : 4 + rowSpacing: ActionBarStyle.spacing + + Row { + spacing: CallStyle.actionArea.vu.spacing + visible: SettingsModel.muteMicrophoneEnabled + + VuMeter { + Timer { + interval: 50 + repeat: true + running: micro.enabled + + onTriggered: parent.value = incall.call.microVu + } + + enabled: micro.enabled + } + + ActionSwitch { + id: micro + + enabled: !call.microMuted + icon: 'micro' + iconSize: CallStyle.actionArea.iconSize + + onClicked: incall.call.microMuted = enabled + } + } + + Row { + spacing: CallStyle.actionArea.vu.spacing + + VuMeter { + Timer { + interval: 50 + repeat: true + running: speaker.enabled + + onTriggered: parent.value = incall.call.speakerVu + } + + enabled: speaker.enabled + } + + ActionSwitch { + id: speaker + + enabled: !call.speakerMuted + icon: 'speaker' + iconSize: CallStyle.actionArea.iconSize + + onClicked: incall.call.speakerMuted = enabled + } + } + + ActionSwitch { + enabled: incall.call.videoEnabled + icon: 'camera' + iconSize: CallStyle.actionArea.iconSize + updating: incall.call.updating + visible: SettingsModel.videoSupported + + onClicked: incall.call.videoEnabled = !enabled + + TooltipArea { + text: qsTr('pendingRequestLabel') + visible: parent.updating + } + } + + ActionButton { + Layout.preferredHeight: CallStyle.actionArea.iconSize + Layout.preferredWidth: CallStyle.actionArea.iconSize + + icon: 'options' + iconSize: CallStyle.actionArea.iconSize + + onClicked: Logic.openMediaParameters(window, incall) + } + } + + // ----------------------------------------------------------------------- + // Preview. + // ----------------------------------------------------------------------- + + Loader { + id: cameraPreviewLoader + + anchors.centerIn: parent + height: CallStyle.actionArea.userVideo.height + width: CallStyle.actionArea.userVideo.width + active: incall.width >= CallStyle.actionArea.lowWidth && incall.call.videoEnabled && !_fullscreen + sourceComponent: cameraPreview + Component { + id: cameraPreview + + Camera { + anchors.fill: parent + call: incall.call + isPreview: true + } + } + } + + ActionBar { + id: bottomActions + + anchors { + right: parent.right + rightMargin: CallStyle.actionArea.rightButtonsGroupMargin + verticalCenter: parent.verticalCenter + } + iconSize: CallStyle.actionArea.iconSize + + ActionSwitch { + enabled: !call.pausedByUser + icon: 'pause' + updating: incall.call.updating + visible: SettingsModel.callPauseEnabled + + onClicked: incall.call.pausedByUser = enabled + + TooltipArea { + text: qsTr('pendingRequestLabel') + visible: parent.updating + } + } + + ActionButton { + icon: 'hangup' + + onClicked: incall.call.terminate() + } + + ActionButton { + icon: SettingsModel.chatEnabled && SettingsModel.showStartChatButton ? 'chat' : 'history' + + onClicked: { + if (window.chatIsOpened) { + window.closeChat() + } else { + window.openChat() + } + } + } + } + } + } + + // --------------------------------------------------------------------------- + // TelKeypad. + // --------------------------------------------------------------------------- + + TelKeypad { + id: telKeypad + + call: incall.call + visible: SettingsModel.showTelKeypadAutomatically + } } diff --git a/linphone-app/ui/views/App/Main/Conversation.qml b/linphone-app/ui/views/App/Main/Conversation.qml index 635af428b..f01f55f70 100644 --- a/linphone-app/ui/views/App/Main/Conversation.qml +++ b/linphone-app/ui/views/App/Main/Conversation.qml @@ -8,7 +8,6 @@ import Utils 1.0 import App.Styles 1.0 import Common.Styles 1.0 import Units 1.0 -import Colors 1.0 import 'Conversation.js' as Logic @@ -262,7 +261,7 @@ ColumnLayout { Rectangle{ height:1 width:parent.width - color:Colors.u + color:Colors.u.color } MenuItem{ text:"Conversation's devices" @@ -278,7 +277,7 @@ ColumnLayout { Rectangle{ height:1 width:parent.width - color:Colors.u + color:Colors.u.color } MenuItem{ text:'Ephemeral messages' diff --git a/linphone-app/ui/views/App/Main/Dialogs/AuthenticationRequest.qml b/linphone-app/ui/views/App/Main/Dialogs/AuthenticationRequest.qml index ced9eeddc..2b68a3685 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/AuthenticationRequest.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/AuthenticationRequest.qml @@ -37,7 +37,7 @@ DialogPlus { buttonsAlignment: Qt.AlignCenter descriptionText: qsTr('authenticationRequestDescription') - height: AuthenticationRequestStyle.height + 30 + height: AuthenticationRequestStyle.height + 60 width: AuthenticationRequestStyle.width // --------------------------------------------------------------------------- diff --git a/linphone-app/ui/views/App/Main/Dialogs/EphemeralChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/EphemeralChatRoom.qml index b8e7b6319..24bcaea89 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/EphemeralChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/EphemeralChatRoom.qml @@ -8,7 +8,6 @@ import LinphoneEnums 1.0 import App.Styles 1.0 import Common.Styles 1.0 -import Colors 1.0 import Units 1.0 @@ -80,7 +79,7 @@ DialogPlus { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter font.pointSize: Units.dp * 11 - color: Colors.d + color: Colors.d.color } ComboBox{ Layout.alignment: Qt.AlignCenter diff --git a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml index b1bad8b4e..d96acabfa 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/InfoChatRoom.qml @@ -8,7 +8,6 @@ import LinphoneEnums 1.0 import App.Styles 1.0 import Common.Styles 1.0 -import Colors 1.0 import Units 1.0 @@ -135,6 +134,7 @@ DialogPlus { showSeparator: false showAdminStatus:!dialog.adminMode isSelectable: false + hoveredCursor:Qt.WhatsThisCursor actions: dialog.adminMode ? [{ diff --git a/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml b/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml index 97ec07ec4..0d861a155 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/InfoEncryption.qml @@ -8,7 +8,6 @@ import LinphoneEnums 1.0 import App.Styles 1.0 import Common.Styles 1.0 -import Colors 1.0 import Units 1.0 @@ -74,7 +73,7 @@ DialogPlus { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter font.pointSize: Units.dp * 11 - color: Colors.d + color: Colors.d.color wrapMode: Text.Wrap @@ -89,7 +88,7 @@ DialogPlus { verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter font.pointSize: Units.dp * 11 - color: Colors.d + color: Colors.d.color wrapMode: Text.Wrap text :"To do so, call the contact and follow the authentification process." diff --git a/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml b/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml index 67481fda9..e4dea5fa0 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/NewChatRoom.qml @@ -8,7 +8,6 @@ import LinphoneEnums 1.0 import App.Styles 1.0 import Common.Styles 1.0 -import Colors 1.0 import Units 1.0 import UtilsCpp 1.0 @@ -72,7 +71,7 @@ DialogPlus { Text { Layout.fillWidth: true text:'Would you like to encrypt your chat?' - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 11 font.weight: Font.DemiBold } @@ -123,7 +122,7 @@ DialogPlus { Text{ textFormat: Text.RichText text :'Nom du groupe' +'*' - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 11 font.weight: Font.DemiBold } @@ -151,7 +150,7 @@ DialogPlus { spacing:20 Text{ text :'Contacts récents' - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 11 font.weight: Font.DemiBold } @@ -185,7 +184,7 @@ DialogPlus { anchors.topMargin: -5 visible: UtilsCpp.hasCapability(modelData.sipAddress, LinphoneEnums.FriendCapabilityLimeX3Dh) icon: 'secure_on' - iconSize:20 + iconSize:20/* Rectangle{ id:secureMask anchors.fill:parent @@ -198,7 +197,7 @@ DialogPlus { secureMask.visible=smartSearchBar.isIgnored(modelData.sipAddress) } } - } + }*/ } } Text{ @@ -214,7 +213,7 @@ DialogPlus { font.weight: Font.DemiBold lineHeight: 0.8 - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 9 clip:false } @@ -223,6 +222,7 @@ DialogPlus { Rectangle{ id:mask anchors.fill:parent + anchors.topMargin: -5 color:'white' opacity: 0.5 visible: smartSearchBar.isIgnored(modelData.sipAddress) @@ -337,7 +337,10 @@ DialogPlus { }] onEntryClicked: { - selectedParticipants.append({$sipAddress:entry}) + selectedParticipants.add(entry) + smartSearchBar.addAddressToIgnore(entry); + ++lastContacts.reloadCount + //selectedParticipants.append({$sipAddress:entry}) } //resultExceptions: selectedParticipants } @@ -360,7 +363,7 @@ DialogPlus { Layout.topMargin: ConferenceManagerStyle.columns.selector.spacing text : 'Admin' - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 11 font.weight: Font.Light visible: participantView.count > 0 @@ -382,6 +385,7 @@ DialogPlus { showSwitch : true showSeparator: false isSelectable: false + showInvitingIndicator: false actions: [{ @@ -477,7 +481,7 @@ DialogPlus { textFormat: Text.RichText text : '* Obligatoire' //font.weight: Font.DemiBold - color: Colors.g + color: Colors.g.color font.pointSize: Units.dp * 8 } } diff --git a/linphone-app/ui/views/App/Main/Dialogs/ParticipantsDevices.qml b/linphone-app/ui/views/App/Main/Dialogs/ParticipantsDevices.qml index d05929d69..7ddef36b5 100644 --- a/linphone-app/ui/views/App/Main/Dialogs/ParticipantsDevices.qml +++ b/linphone-app/ui/views/App/Main/Dialogs/ParticipantsDevices.qml @@ -38,6 +38,7 @@ DialogPlus { ScrollableListView { id: view + property var window : dialog.window anchors.fill: parent model: ParticipantProxyModel{ chatRoomModel : dialog.chatRoomModel @@ -45,6 +46,11 @@ DialogPlus { delegate: ColumnLayout{ + id:mainHeader + property var window : ListView.view.window + property int securityLevel : modelData.securityLevel + property string addressToCall : modelData.sipAddress + width:parent.width spacing: 0 RowLayout { @@ -61,19 +67,40 @@ DialogPlus { LinphoneUtils.getContactUsername(modelData.sipAddress) ):'' Icon{ + property int securityLevel : modelData.securityLevel anchors.right: parent.right anchors.top:parent.top anchors.topMargin: -5 - visible: modelData && modelData.securityLevel !== 1 - icon: modelData?(modelData.securityLevel === 2?'secure_level_1': modelData.securityLevel===3? 'secure_level_2' : 'secure_level_unsafe'):'secure_level_unsafe' + visible: modelData && securityLevel !== 1 + icon: modelData?(securityLevel === 2?'secure_level_1': securityLevel===3? 'secure_level_2' : 'secure_level_unsafe'):'secure_level_unsafe' iconSize:15 + Timer{// Workaround : no security events are send when device's security change. + onTriggered: parent.securityLevel = modelData.securityLevel + repeat:true + running:true + interval:500 + } } } - ContactDescription{ + Item{ Layout.fillHeight: true Layout.fillWidth: true Layout.leftMargin: 14 - username: avatar.username + ContactDescription{ + id:contactDescription + anchors.fill:parent + username: avatar.username + } + MouseArea{ + anchors.fill:contactDescription + onClicked: { + //mainHeader.window.detachVirtualWindow() + mainHeader.window.attachVirtualWindow(Qt.resolvedUrl('InfoEncryption.qml') + ,{securityLevel : mainHeader.securityLevel + , addressToCall : mainHeader.addressToCall} + ) + } + } } ActionButton { @@ -81,7 +108,7 @@ DialogPlus { Layout.preferredWidth: 20 Layout.leftMargin: 14 Layout.rightMargin: 14 - icon: modelData.deviceCount > 1? + icon: modelData.deviceCount > 0? (participantDevices.visible ? 'expanded' : 'collapsed') : (modelData.securityLevel === 2?'secure_level_1': (modelData.securityLevel===3? 'secure_level_2' : 'secure_level_unsafe') @@ -102,6 +129,8 @@ DialogPlus { property var window : dialog.window + visible: view.count < 4 + Layout.fillWidth: true Layout.preferredHeight: item.height * count @@ -135,7 +164,7 @@ DialogPlus { MouseArea{ anchors.fill:parent onClicked: { - mainRectangle.window.detachVirtualWindow() + //mainRectangle.window.detachVirtualWindow() mainRectangle.window.attachVirtualWindow(Qt.resolvedUrl('InfoEncryption.qml') ,{securityLevel : mainRectangle.securityLevel , addressToCall : mainRectangle.addressToCall} @@ -168,7 +197,6 @@ DialogPlus { visible: (index !== (model.count - 1)) } } - visible:true } } } diff --git a/linphone-app/ui/views/App/Main/MainWindow.qml b/linphone-app/ui/views/App/Main/MainWindow.qml index a5664b4db..3be33607b 100644 --- a/linphone-app/ui/views/App/Main/MainWindow.qml +++ b/linphone-app/ui/views/App/Main/MainWindow.qml @@ -58,7 +58,6 @@ ApplicationWindow { sequence: StandardKey.Close onActivated: window.hide() } - // --------------------------------------------------------------------------- Loader { @@ -307,7 +306,8 @@ ApplicationWindow { chatRoomModel:entry.chatRoomModel }): - setView('HistoryView', {})) + //setView('HistoryView', {})) + setView('Home', {})) menu.resetSelectedEntry() } } diff --git a/linphone-app/ui/views/App/Settings/SettingsCallsChat.qml b/linphone-app/ui/views/App/Settings/SettingsCallsChat.qml index cfdc70550..e026490b0 100644 --- a/linphone-app/ui/views/App/Settings/SettingsCallsChat.qml +++ b/linphone-app/ui/views/App/Settings/SettingsCallsChat.qml @@ -9,318 +9,331 @@ import App.Styles 1.0 // ============================================================================= TabContainer { - Column { - anchors.fill: parent - spacing: SettingsWindowStyle.forms.spacing - - Form { - title: qsTr('callsTitle') - width: parent.width - - FormLine { - visible: !!encryption.encryptions.length - - FormGroup { - label: qsTr('encryptionLabel') - - ExclusiveButtons { - id: encryption - - property var encryptions: (function () { - var encryptions = SettingsModel.supportedMediaEncryptions - if (encryptions.length) { - encryptions.unshift([ SettingsModel.MediaEncryptionNone, qsTr('noEncryption') ]) - } - - return encryptions - })() - - texts: encryptions.map(function (value) { - return value[1] - }) - - onClicked: SettingsModel.mediaEncryption = encryptions[button][0] - - Binding { - property: 'selectedButton' - target: encryption - value: { - var toFound = SettingsModel.mediaEncryption - return Number( - Utils.findIndex(encryption.encryptions, function (value) { - return toFound === value[0] - }) - ) - } - } - } - } - FormGroup { - label: qsTr('encryptionMandatoryLabel') - - Switch { - id: encryptionMandatory - - checked: SettingsModel.mediaEncryptionMandatory - - onClicked: SettingsModel.mediaEncryptionMandatory = !checked - } - } - } - - FormLine { - FormGroup { - label: qsTr('autoAnswerLabel') - - Switch { - id: autoAnswer - - checked: SettingsModel.autoAnswerStatus - - onClicked: SettingsModel.autoAnswerStatus = !checked - } - } - - FormGroup { - label: qsTr('autoAnswerDelayLabel') - - NumericField { - readOnly: !autoAnswer.checked - - minValue: 0 - maxValue: 30000 - step: 1000 - - text: SettingsModel.autoAnswerDelay - - onEditingFinished: SettingsModel.autoAnswerDelay = text - } - } - } - - FormLine { - FormGroup { - label: qsTr('autoAnswerWithVideoLabel') - visible: SettingsModel.videoSupported - - Switch { - checked: SettingsModel.autoAnswerVideoStatus - enabled: autoAnswer.checked - - onClicked: SettingsModel.autoAnswerVideoStatus = !checked - } - } - } - - FormLine { - FormGroup { - label: qsTr('showTelKeypadAutomaticallyLabel') - - Switch { - checked: SettingsModel.showTelKeypadAutomatically - - onClicked: SettingsModel.showTelKeypadAutomatically = !checked - } - } - - FormGroup { - label: qsTr('keepCallsWindowInBackgroundLabel') - - Switch { - checked: SettingsModel.keepCallsWindowInBackground - - onClicked: SettingsModel.keepCallsWindowInBackground = !checked - } - } - } - - FormLine { - visible: SettingsModel.developerSettingsEnabled - - FormGroup { - label: qsTr('outgoingCallsEnabledLabel') - - Switch { - checked: SettingsModel.outgoingCallsEnabled - - onClicked: SettingsModel.outgoingCallsEnabled = !checked - } - } - } - - FormLine { - visible: SettingsModel.developerSettingsEnabled - - FormGroup { - label: qsTr('callRecorderEnabledLabel') - - Switch { - checked: SettingsModel.callRecorderEnabled - - onClicked: SettingsModel.callRecorderEnabled = !checked - } - } - - FormGroup { - label: qsTr('callPauseEnabledLabel') - - Switch { - checked: SettingsModel.callPauseEnabled - - onClicked: SettingsModel.callPauseEnabled = !checked - } - } - } - - FormLine { - visible: SettingsModel.developerSettingsEnabled - - FormGroup { - label: qsTr('muteMicrophoneEnabledLabel') - - Switch { - checked: SettingsModel.muteMicrophoneEnabled - - onClicked: SettingsModel.muteMicrophoneEnabled = !checked - } - } - } - - FormLine { - visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled - - FormGroup { - label: qsTr('automaticallyRecordCallsLabel') - - Switch { - checked: SettingsModel.automaticallyRecordCalls - - onClicked: SettingsModel.automaticallyRecordCalls = !checked - } - } - } - } - - Form { - title: qsTr('chatTitle') - visible: SettingsModel.chatEnabled || SettingsModel.developerSettingsEnabled - width: parent.width - - FormLine { - visible: SettingsModel.developerSettingsEnabled - - FormGroup { - label: qsTr('chatEnabledLabel') - - Switch { - checked: SettingsModel.chatEnabled - - onClicked: SettingsModel.chatEnabled = !checked - } - } - - FormGroup { - label: qsTr('conferenceEnabledLabel') - - Switch { - checked: SettingsModel.conferenceEnabled - - onClicked: SettingsModel.conferenceEnabled = !checked - } - } - } - - FormLine { - FormGroup { - label: qsTr('chatNotificationSoundEnabledLabel') - - Switch { - id: enableChatNotificationSound - - checked: SettingsModel.chatNotificationSoundEnabled - - onClicked: SettingsModel.chatNotificationSoundEnabled = !checked - } - } - - FormGroup { - label: qsTr('chatNotificationSoundLabel') - - FileChooserButton { - readOnly: !enableChatNotificationSound.checked - selectedFile: SettingsModel.chatNotificationSoundPath - - onAccepted: SettingsModel.chatNotificationSoundPath = selectedFile - } - } - } - - FormLine { - FormGroup { - label: qsTr('fileServerLabel') - - TextField { - text: SettingsModel.fileTransferUrl - - onEditingFinished: SettingsModel.fileTransferUrl = text - } - } - } - - FormLine { - visible: false // TODO: Use `SettingsModel.limeIsSupported` binding in V2. - - FormGroup { - label: qsTr('encryptWithLimeLabel') - - ExclusiveButtons { - id: lime - - property var limeStates: ([ - [ SettingsModel.LimeStateDisabled, qsTr('limeDisabled') ], - [ SettingsModel.LimeStateMandatory, qsTr('limeRequired') ], - [ SettingsModel.LimeStatePreferred, qsTr('limePreferred') ] - ]) - - texts: limeStates.map(function (value) { - return value[1] - }) - - onClicked: SettingsModel.limeState = limeStates[button][0] - - Binding { - property: 'selectedButton' - target: lime - value: { - var toFound = SettingsModel.limeState - return Number( - Utils.findIndex(lime.limeStates, function (value) { - return toFound === value[0] - }) - ) - } - } - } - } - } - } - - Form { - title: qsTr('contactsTitle') - visible: SettingsModel.developerSettingsEnabled - width: parent.width - - FormLine { - FormGroup { - label: qsTr('contactsEnabledLabel') - - Switch { - checked: SettingsModel.contactsEnabled - - onClicked: SettingsModel.contactsEnabled = !checked - } - } - } - } - } + Column { + anchors.fill: parent + spacing: SettingsWindowStyle.forms.spacing + + Form { + title: qsTr('callsTitle') + width: parent.width + + FormLine { + visible: !!encryption.encryptions.length + + FormGroup { + label: qsTr('encryptionLabel') + + ExclusiveButtons { + id: encryption + + property var encryptions: (function () { + var encryptions = SettingsModel.supportedMediaEncryptions + if (encryptions.length) { + encryptions.unshift([ SettingsModel.MediaEncryptionNone, qsTr('noEncryption') ]) + } + + return encryptions + })() + + texts: encryptions.map(function (value) { + return value[1] + }) + + onClicked: SettingsModel.mediaEncryption = encryptions[button][0] + + Binding { + property: 'selectedButton' + target: encryption + value: { + var toFound = SettingsModel.mediaEncryption + return Number( + Utils.findIndex(encryption.encryptions, function (value) { + return toFound === value[0] + }) + ) + } + } + } + } + FormGroup { + label: qsTr('encryptionMandatoryLabel') + + Switch { + id: encryptionMandatory + + checked: SettingsModel.mediaEncryptionMandatory + + onClicked: SettingsModel.mediaEncryptionMandatory = !checked + } + } + } + + FormLine { + FormGroup { + label: qsTr('autoAnswerLabel') + + Switch { + id: autoAnswer + + checked: SettingsModel.autoAnswerStatus + + onClicked: SettingsModel.autoAnswerStatus = !checked + } + } + + FormGroup { + label: qsTr('autoAnswerDelayLabel') + + NumericField { + readOnly: !autoAnswer.checked + + minValue: 0 + maxValue: 30000 + step: 1000 + + text: SettingsModel.autoAnswerDelay + + onEditingFinished: SettingsModel.autoAnswerDelay = text + } + } + } + + FormLine { + FormGroup { + label: qsTr('autoAnswerWithVideoLabel') + visible: SettingsModel.videoSupported + + Switch { + checked: SettingsModel.autoAnswerVideoStatus + enabled: autoAnswer.checked + + onClicked: SettingsModel.autoAnswerVideoStatus = !checked + } + } + } + + FormLine { + FormGroup { + label: qsTr('showTelKeypadAutomaticallyLabel') + + Switch { + checked: SettingsModel.showTelKeypadAutomatically + + onClicked: SettingsModel.showTelKeypadAutomatically = !checked + } + } + + FormGroup { + label: qsTr('keepCallsWindowInBackgroundLabel') + + Switch { + checked: SettingsModel.keepCallsWindowInBackground + + onClicked: SettingsModel.keepCallsWindowInBackground = !checked + } + } + } + + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('outgoingCallsEnabledLabel') + + Switch { + checked: SettingsModel.outgoingCallsEnabled + + onClicked: SettingsModel.outgoingCallsEnabled = !checked + } + } + } + + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('callRecorderEnabledLabel') + + Switch { + checked: SettingsModel.callRecorderEnabled + + onClicked: SettingsModel.callRecorderEnabled = !checked + } + } + + FormGroup { + label: qsTr('callPauseEnabledLabel') + + Switch { + checked: SettingsModel.callPauseEnabled + + onClicked: SettingsModel.callPauseEnabled = !checked + } + } + } + + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('muteMicrophoneEnabledLabel') + + Switch { + checked: SettingsModel.muteMicrophoneEnabled + + onClicked: SettingsModel.muteMicrophoneEnabled = !checked + } + } + } + + FormLine { + visible: SettingsModel.callRecorderEnabled || SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('automaticallyRecordCallsLabel') + + Switch { + checked: SettingsModel.automaticallyRecordCalls + + onClicked: SettingsModel.automaticallyRecordCalls = !checked + } + } + } + } + + Form { + title: qsTr('chatTitle') + visible: SettingsModel.chatEnabled || SettingsModel.developerSettingsEnabled + width: parent.width + + FormLine { + visible: SettingsModel.developerSettingsEnabled + + FormGroup { + label: qsTr('chatEnabledLabel') + + Switch { + checked: SettingsModel.chatEnabled + + onClicked: SettingsModel.chatEnabled = !checked + } + } + + FormGroup { + label: qsTr('conferenceEnabledLabel') + + Switch { + checked: SettingsModel.conferenceEnabled + + onClicked: SettingsModel.conferenceEnabled = !checked + } + } + } + + FormLine { + FormGroup { + label: qsTr('chatNotificationSoundEnabledLabel') + + Switch { + id: enableChatNotificationSound + + checked: SettingsModel.chatNotificationSoundEnabled + + onClicked: SettingsModel.chatNotificationSoundEnabled = !checked + } + } + + FormGroup { + label: qsTr('chatNotificationSoundLabel') + + FileChooserButton { + readOnly: !enableChatNotificationSound.checked + selectedFile: SettingsModel.chatNotificationSoundPath + + onAccepted: SettingsModel.chatNotificationSoundPath = selectedFile + } + } + } + + FormLine { + FormGroup { + label: qsTr('fileServerLabel') + + TextField { + text: SettingsModel.fileTransferUrl + + onEditingFinished: SettingsModel.fileTransferUrl = text + } + } + } + FormLine { + FormGroup { + label: 'Hide empty chat rooms' + + Switch { + id: hideEmptyChatRooms + + checked: SettingsModel.hideEmptyChatRooms + + onClicked: SettingsModel.hideEmptyChatRooms = !checked + } + } + } + + FormLine { + visible: false // TODO: Use `SettingsModel.limeIsSupported` binding in V2. + + FormGroup { + label: qsTr('encryptWithLimeLabel') + + ExclusiveButtons { + id: lime + + property var limeStates: ([ + [ SettingsModel.LimeStateDisabled, qsTr('limeDisabled') ], + [ SettingsModel.LimeStateMandatory, qsTr('limeRequired') ], + [ SettingsModel.LimeStatePreferred, qsTr('limePreferred') ] + ]) + + texts: limeStates.map(function (value) { + return value[1] + }) + + onClicked: SettingsModel.limeState = limeStates[button][0] + + Binding { + property: 'selectedButton' + target: lime + value: { + var toFound = SettingsModel.limeState + return Number( + Utils.findIndex(lime.limeStates, function (value) { + return toFound === value[0] + }) + ) + } + } + } + } + } + } + + Form { + title: qsTr('contactsTitle') + visible: SettingsModel.developerSettingsEnabled + width: parent.width + + FormLine { + FormGroup { + label: qsTr('contactsEnabledLabel') + + Switch { + checked: SettingsModel.contactsEnabled + + onClicked: SettingsModel.contactsEnabled = !checked + } + } + } + } + } } diff --git a/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml b/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml index 57f91d3b1..0dc3acfb8 100644 --- a/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/CallStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.f + property color backgroundColor: Colors.f.color property QtObject actionArea: QtObject { property int height: 100 @@ -28,7 +27,7 @@ QtObject { } property QtObject callError: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int pointSize: Units.dp * 12 } } @@ -37,15 +36,15 @@ QtObject { property int margins: 15 property QtObject avatar: QtObject { - property color backgroundColor: Colors.n + property color backgroundColor: Colors.n.color property int maxSize: 300 } property QtObject pause: QtObject { - property color color: Colors.g90 + property color color: Colors.g90.color property QtObject text: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int pointSizeFactor: 10 } } @@ -60,7 +59,7 @@ QtObject { property int topMargin: 26 property QtObject busyIndicator: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int height: 30 property int width: 30 } @@ -71,7 +70,7 @@ QtObject { } property QtObject elapsedTime: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 property QtObject fullscreen: QtObject { @@ -92,8 +91,8 @@ QtObject { } property QtObject text: QtObject { - property color colorA: Colors.j - property color colorB: Colors.i + property color colorA: Colors.j.color + property color colorB: Colors.i.color property int pointSize: Units.dp * 10 property int wordsSpacing: 5 } diff --git a/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml b/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml index 1b3a80ad8..2448a111b 100644 --- a/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/CallsWindowStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= @@ -14,14 +13,14 @@ QtObject { } property QtObject callsList: QtObject { - property color color: Colors.q + property color color: Colors.q.color property int defaultWidth: 250 property int maximumWidth: 250 property int minimumWidth: 110 property QtObject header: QtObject { - property color color1: Colors.q - property color color2: Colors.f + property color color1: Colors.q.color + property color color2: Colors.f.color property int height: 60 property int iconSize: 40 property int leftMargin: 10 diff --git a/linphone-app/ui/views/App/Styles/Calls/ConferenceStyle.qml b/linphone-app/ui/views/App/Styles/Calls/ConferenceStyle.qml index 3f27b74ae..24801c721 100644 --- a/linphone-app/ui/views/App/Styles/Calls/ConferenceStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/ConferenceStyle.qml @@ -1,14 +1,13 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { property QtObject description: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 12 property int height: 60 property int width: 150 diff --git a/linphone-app/ui/views/App/Styles/Calls/Dialogs/ConferenceManagerStyle.qml b/linphone-app/ui/views/App/Styles/Calls/Dialogs/ConferenceManagerStyle.qml index 8ad62238c..480e531f8 100644 --- a/linphone-app/ui/views/App/Styles/Calls/Dialogs/ConferenceManagerStyle.qml +++ b/linphone-app/ui/views/App/Styles/Calls/Dialogs/ConferenceManagerStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= @@ -15,7 +14,7 @@ QtObject { } property QtObject separator: QtObject { - property color color: Colors.c + property color color: Colors.c.color property int leftMargin: 25 property int rightMargin: 25 property int width: 1 diff --git a/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithEmailStyle.qml b/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithEmailStyle.qml index 599f4719c..9bd94bc38 100644 --- a/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithEmailStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithEmailStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -10,7 +9,7 @@ QtObject { property int spacing: 20 property QtObject activationSteps: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithPhoneNumberStyle.qml b/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithPhoneNumberStyle.qml index 599f4719c..9bd94bc38 100644 --- a/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithPhoneNumberStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Assistant/ActivateAppSipAccountWithPhoneNumberStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -10,7 +9,7 @@ QtObject { property int spacing: 20 property QtObject activationSteps: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml b/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml index e57bc967f..79d473163 100644 --- a/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantAbstractViewStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -20,12 +19,12 @@ QtObject { property int spacing: 20 property QtObject description: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 11 } property QtObject title: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 11 } } diff --git a/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml b/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml index bcb5ba425..6c5ad8ed6 100644 --- a/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Assistant/AssistantHomeStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -12,13 +11,13 @@ QtObject { property int iconSize: 150 property QtObject description: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 10 property int height: 40 } property QtObject title: QtObject { - property color color: Colors.g + property color color: Colors.g.color property int pointSize: Units.dp * 11 property int height: 40 } diff --git a/linphone-app/ui/views/App/Styles/Main/AssistantStyle.qml b/linphone-app/ui/views/App/Styles/Main/AssistantStyle.qml index d36f032ed..46abd32a9 100644 --- a/linphone-app/ui/views/App/Styles/Main/AssistantStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/AssistantStyle.qml @@ -1,12 +1,10 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 - // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int bottomMargin: 35 property int leftMargin: 90 property int rightMargin: 90 diff --git a/linphone-app/ui/views/App/Styles/Main/ContactEditStyle.qml b/linphone-app/ui/views/App/Styles/Main/ContactEditStyle.qml index 5058029f1..6de64797f 100644 --- a/linphone-app/ui/views/App/Styles/Main/ContactEditStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/ContactEditStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -13,7 +12,7 @@ QtObject { } property QtObject bar: QtObject { - property color color: Colors.e + property color color: Colors.e.color property int avatarSize: 60 property int height: 80 property int leftMargin: 40 @@ -42,13 +41,13 @@ QtObject { } property QtObject username: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 13 } } property QtObject content: QtObject { - property color color: Colors.k + property color color: Colors.k.color } property QtObject values: QtObject { @@ -58,7 +57,7 @@ QtObject { property int topMargin: 20 property QtObject separator: QtObject { - property color color: Colors.f + property color color: Colors.f.color property int height: 1 } } diff --git a/linphone-app/ui/views/App/Styles/Main/ContactsStyle.qml b/linphone-app/ui/views/App/Styles/Main/ContactsStyle.qml index 30aa939a2..8ddbfc054 100644 --- a/linphone-app/ui/views/App/Styles/Main/ContactsStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/ContactsStyle.qml @@ -1,17 +1,16 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { - property color backgroundColor: Colors.k + property color backgroundColor: Colors.k.color property int spacing: 20 property QtObject bar: QtObject { - property color backgroundColor: Colors.e + property color backgroundColor: Colors.e.color property int height: 60 property int leftMargin: 18 property int rightMargin: 18 @@ -28,27 +27,27 @@ QtObject { property int spacing: 15 property QtObject backgroundColor: QtObject { - property color normal: Colors.k - property color hovered: Colors.g10 + property color normal: Colors.k.color + property color hovered: Colors.g10.color } property QtObject border: QtObject { - property color color: Colors.f + property color color: Colors.f.color property int width: 1 } property QtObject indicator: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int width: 5 } property QtObject presence: QtObject { property int pointSize: Units.dp * 10 - property color color: Colors.n + property color color: Colors.n.color } property QtObject username: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 10 property int width: 220 } diff --git a/linphone-app/ui/views/App/Styles/Main/ConversationStyle.qml b/linphone-app/ui/views/App/Styles/Main/ConversationStyle.qml index a1bb21bc5..8e5e18254 100644 --- a/linphone-app/ui/views/App/Styles/Main/ConversationStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/ConversationStyle.qml @@ -2,14 +2,13 @@ pragma Singleton import QtQml 2.2 import QtQuick 2.7 -import Colors 1.0 import Units 1.0 // ============================================================================= QtObject { property QtObject bar: QtObject { - property color backgroundColor: Colors.e + property color backgroundColor: Colors.e.color property int avatarSize: 60 property int groupChatSize: 55 property int height: 80 @@ -35,17 +34,17 @@ QtObject { property QtObject contactDescription : QtObject { property QtObject sipAddress: QtObject { - property color color: Colors.n + property color color: Colors.n.color property int pointSize: Units.dp * 10 property int weight: Font.Light } property QtObject username: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 11 property int weight: Font.Normal property QtObject status : QtObject{ - property color color : Colors.g + property color color : Colors.g.color property int pointSize : Units.dp * 9 } } @@ -53,12 +52,12 @@ QtObject { } property QtObject filters: QtObject { - property color backgroundColor: Colors.q + property color backgroundColor: Colors.q.color property int height: 51 property int leftMargin: 40 property QtObject border: QtObject { - property color color: Colors.g10 + property color color: Colors.g10.color property int bottomWidth: 1 property int topWidth: 0 } diff --git a/linphone-app/ui/views/App/Styles/Main/Dialogs/AboutStyle.qml b/linphone-app/ui/views/App/Styles/Main/Dialogs/AboutStyle.qml index 86dba8229..3a957539a 100644 --- a/linphone-app/ui/views/App/Styles/Main/Dialogs/AboutStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Dialogs/AboutStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -15,12 +14,12 @@ QtObject { property int spacing: 10 property QtObject license: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } property QtObject url: QtObject { - property color color: Colors.i + property color color: Colors.i.color property int pointSize: Units.dp * 10 } } @@ -30,12 +29,12 @@ QtObject { property int spacing: 10 property QtObject appVersion: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } property QtObject coreVersion: QtObject { - property color color: Colors.d + property color color: Colors.d.color property int pointSize: Units.dp * 10 } } diff --git a/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoChatRoomStyle.qml b/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoChatRoomStyle.qml index 92a9227db..d36dc6bc0 100644 --- a/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoChatRoomStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoChatRoomStyle.qml @@ -2,7 +2,6 @@ pragma Singleton import QtQml 2.2 import QtQuick 2.7 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -22,17 +21,17 @@ QtObject { } property QtObject results : QtObject{ property int topMargin : 10 - property color color : Colors.g + property color color : Colors.g.color property QtObject title : QtObject{ property int topMargin: 10 property int leftMargin: 20 - property color color: Colors.j + property color color: Colors.j.color property int pointSize : Units.dp * 11 property int weight : Font.DemiBold } property QtObject header: QtObject{ property int rightMargin: 55 - property color color: Colors.t + property color color: Colors.t.color property int weight : Font.Light property int pointSize : Units.dp * 10 @@ -42,23 +41,23 @@ QtObject { property QtObject leaveButton : QtObject { property QtObject backgroundColor: QtObject { - property color disabled: Colors.o - property color hovered: Colors.j - property color normal: Colors.k - property color pressed: Colors.i + property color disabled: Colors.o.color + property color hovered: Colors.j.color + property color normal: Colors.k.color + property color pressed: Colors.i.color } property QtObject textColor: QtObject { - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.i - property color pressed: Colors.q + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.i.color + property color pressed: Colors.q.color } property QtObject borderColor : QtObject{ - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.i - property color pressed: Colors.q + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.i.color + property color pressed: Colors.q.color } } } \ No newline at end of file diff --git a/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoEncryptionStyle.qml b/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoEncryptionStyle.qml index 890470f7b..a13420e25 100644 --- a/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoEncryptionStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/Dialogs/InfoEncryptionStyle.qml @@ -2,7 +2,6 @@ pragma Singleton import QtQml 2.2 import QtQuick 2.7 -import Colors 1.0 import Units 1.0 @@ -11,17 +10,17 @@ import Units 1.0 QtObject { property QtObject okButton : QtObject{ property QtObject backgroundColor: QtObject { - property color disabled: Colors.i30 - property color hovered: Colors.b - property color normal: Colors.s - property color pressed: Colors.m + property color disabled: Colors.i30.color + property color hovered: Colors.b.color + property color normal: Colors.s.color + property color pressed: Colors.m.color } property QtObject textColor: QtObject { - property color disabled: Colors.q - property color hovered: Colors.q - property color normal: Colors.q - property color pressed: Colors.q + property color disabled: Colors.q.color + property color hovered: Colors.q.color + property color normal: Colors.q.color + property color pressed: Colors.q.color } } } \ No newline at end of file diff --git a/linphone-app/ui/views/App/Styles/Main/HistoryViewStyle.qml b/linphone-app/ui/views/App/Styles/Main/HistoryViewStyle.qml index 0cbc42ecc..7781cd2d3 100644 --- a/linphone-app/ui/views/App/Styles/Main/HistoryViewStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/HistoryViewStyle.qml @@ -1,13 +1,12 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { property QtObject bar: QtObject { - property color backgroundColor: Colors.e + property color backgroundColor: Colors.e.color property int avatarSize: 60 property int height: 80 property int leftMargin: 40 @@ -31,18 +30,18 @@ QtObject { } property QtObject description: QtObject { - property color sipAddressColor: Colors.g - property color usernameColor: Colors.j + property color sipAddressColor: Colors.g.color + property color usernameColor: Colors.j.color } } property QtObject filters: QtObject { - property color backgroundColor: Colors.q + property color backgroundColor: Colors.q.color property int height: 51 property int leftMargin: 40 property QtObject border: QtObject { - property color color: Colors.g10 + property color color: Colors.g10.color property int bottomWidth: 1 property int topWidth: 0 } diff --git a/linphone-app/ui/views/App/Styles/Main/HomeStyle.qml b/linphone-app/ui/views/App/Styles/Main/HomeStyle.qml index 89d47b67a..5a2fa4334 100644 --- a/linphone-app/ui/views/App/Styles/Main/HomeStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/HomeStyle.qml @@ -1,11 +1,10 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int spacing: 20 } diff --git a/linphone-app/ui/views/App/Styles/Main/InviteFriendsStyle.qml b/linphone-app/ui/views/App/Styles/Main/InviteFriendsStyle.qml index 69006542e..7dc053000 100644 --- a/linphone-app/ui/views/App/Styles/Main/InviteFriendsStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/InviteFriendsStyle.qml @@ -1,12 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int width: 400 property QtObject message: QtObject { diff --git a/linphone-app/ui/views/App/Styles/Main/MainWindowStyle.qml b/linphone-app/ui/views/App/Styles/Main/MainWindowStyle.qml index 644fb1474..586d1eb35 100644 --- a/linphone-app/ui/views/App/Styles/Main/MainWindowStyle.qml +++ b/linphone-app/ui/views/App/Styles/Main/MainWindowStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQuick 2.7 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -25,7 +24,7 @@ QtObject { property QtObject text: QtObject { property int pointSize: Units.dp * 8 - property color color: Colors.i + property color color: Colors.i.color } } @@ -45,7 +44,7 @@ QtObject { property int spacing: 16 property var background: Rectangle { - color: Colors.f + color: Colors.f.color } } } diff --git a/linphone-app/ui/views/App/Styles/Settings/SettingsAdvancedStyle.qml b/linphone-app/ui/views/App/Styles/Settings/SettingsAdvancedStyle.qml index 8b58ee3d0..eb6ebf6c8 100644 --- a/linphone-app/ui/views/App/Styles/Settings/SettingsAdvancedStyle.qml +++ b/linphone-app/ui/views/App/Styles/Settings/SettingsAdvancedStyle.qml @@ -1,7 +1,6 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 import Units 1.0 // ============================================================================= @@ -11,10 +10,10 @@ QtObject { } property QtObject error: QtObject { - property color color: Colors.error + property color color: Colors.error.color } property QtObject info: QtObject { - property color color: Colors.j + property color color: Colors.j.color property int pointSize: Units.dp * 11 } property QtObject lists: QtObject { diff --git a/linphone-app/ui/views/App/Styles/Settings/SettingsWindowStyle.qml b/linphone-app/ui/views/App/Styles/Settings/SettingsWindowStyle.qml index 29c15a2bd..4ebd32e88 100644 --- a/linphone-app/ui/views/App/Styles/Settings/SettingsWindowStyle.qml +++ b/linphone-app/ui/views/App/Styles/Settings/SettingsWindowStyle.qml @@ -1,12 +1,11 @@ pragma Singleton import QtQml 2.2 -import Colors 1.0 // ============================================================================= QtObject { - property color color: Colors.k + property color color: Colors.k.color property int height: 640 property int width: 1024