diff --git a/linphone-app/src/components/other/colors/ColorListModel.cpp b/linphone-app/src/components/other/colors/ColorListModel.cpp index 911fd1f79..664d6c02f 100644 --- a/linphone-app/src/components/other/colors/ColorListModel.cpp +++ b/linphone-app/src/components/other/colors/ColorListModel.cpp @@ -106,7 +106,7 @@ QString ColorListModel::buildDescription(QString description){ return description; } -ColorModel * ColorListModel::add(const QString& id, const QString& idLink, QString description, QString colorValue){ +ColorModel * ColorListModel::add(const QString& id, const QString& idLink, QString description, QString colorValue, const int& overrideAlpha){ ColorModel * color = getColor(id); if( description == "") description = buildDescription(id); @@ -121,11 +121,15 @@ ColorModel * ColorListModel::add(const QString& id, const QString& idLink, QStri addLink(id, idLink); } auto colorShared = QSharedPointer::create(id, colorValue, description); + if(overrideAlpha>=0) + colorShared->setAlpha(overrideAlpha* 255 / 100); add(colorShared); color = colorShared.get(); emit colorChanged(); }else if( description != color->getDescription()) { color->setDescription(description); + if(overrideAlpha>=0) + color->setAlpha(overrideAlpha* 255 / 100); emit colorChanged(); } return color; @@ -138,6 +142,12 @@ ColorModel * ColorListModel::addImageColor(const QString& id, const QString& ima return model; } +void ColorListModel::updateLinkIndexToColor(const QString& id, const int& index){ + auto colorModel = getColor(id); + if(colorModel) + colorModel->setLinkIndex(index); +} + void ColorListModel::addLink(const QString& a, const QString& b){ int index = 0; if( mColorLinkIndexes.contains(b)){ @@ -146,14 +156,17 @@ void ColorListModel::addLink(const QString& a, const QString& b){ index = mColorLinks.size(); mColorLinks.push_back(QStringList(b)); mColorLinkIndexes[b] = index; + updateLinkIndexToColor(b, index); } mColorLinks[index].push_back(a); mColorLinkIndexes[a] = index; + updateLinkIndexToColor(a, index); } void ColorListModel::removeLink(const QString& a){ mColorLinks[mColorLinkIndexes[a]].removeOne(a); mColorLinkIndexes.remove(a); + updateLinkIndexToColor(a, -1); } void ColorListModel::updateLink(const QString& id, const QString& newLink){ @@ -234,6 +247,9 @@ void ColorListModel::overrideColors (const std::shared_ptr &co } mColorLinks = colorLinks; mColorLinkIndexes = colorLinksIndexes; + for(auto it = mColorLinkIndexes.begin() ; it != mColorLinkIndexes.end() ; ++it){ + updateLinkIndexToColor(it.key(), it.value()); + } }else{ bool haveColor = false; QString qtConfigId = QString::fromStdString(configId); diff --git a/linphone-app/src/components/other/colors/ColorListModel.hpp b/linphone-app/src/components/other/colors/ColorListModel.hpp index 4d9f25498..7bef9db98 100644 --- a/linphone-app/src/components/other/colors/ColorListModel.hpp +++ b/linphone-app/src/components/other/colors/ColorListModel.hpp @@ -41,10 +41,12 @@ // Alpha is in percent. #define ADD_COLOR_WITH_ALPHA(COLOR, ALPHA, DESCRIPTION) \ + add(COLOR + QString::number(ALPHA), COLOR, DESCRIPTION, "", ALPHA); +/* \ color = QSharedPointer::create(COLOR + QString::number(ALPHA), mData[COLOR].value()->getColor().name(), DESCRIPTION); \ color->setAlpha(ALPHA * 255 / 100); \ add(color); - + */ class ColorModel; @@ -53,8 +55,6 @@ class ColorListModel : public ProxyListModel { void init() { QSharedPointer 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", "Text (Ephemerals)") @@ -64,7 +64,19 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("h", "#687680", "Others") // Primary color. - ADD_COLOR("i", "#FE5E00", "Primary color.") + ADD_COLOR("i", "#FF5E00", "Primary color.") + ADD_COLOR_WITH_ALPHA("i", 80, "") + ADD_COLOR("m", "#FF8600", "Primary color for clicked items.") + ADD_COLOR("b", "#D64D00", "Primary color for hovered items.")// #DC4100 + ADD_COLOR("secondary_h", "#4B5964", "Secondary color for hovered items.") + ADD_COLOR("n", "#A1A1A1", "Primary color for pressed button") + ADD_COLOR("o", "#D0D8DE", "Primary color for disabled button") + + ADD_COLOR("outgoing_bg","#F3F3F3","Outgoing message background") + ADD_COLOR("incoming_bg","#D0D8DE","Incoming message background") + + ADD_COLOR("primary_accept", "#9ECD1D", "Primary color for accepting button") + ADD_COLOR_WITH_ALPHA("primary_accept", 80, "") ADD_COLOR("j", "#4B5964", "Username, Background cancel button hovered.") @@ -73,12 +85,6 @@ class ColorListModel : public ProxyListModel { 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", "Pressed button") - ADD_COLOR("o", "#D0D8DE", "Disabled button") - ADD_COLOR("p", "#17A81A", "Progress bar.") ADD_COLOR("q", "#FFFFFF", "Fields, backgrounds and text color on some items") @@ -102,7 +108,7 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("aa", "#E1E1E1", "Chat text outside background") ADD_COLOR("ab", "#979797", "Chat heading section text") ADD_COLOR("ac", "#B1B1B1", "Chat bubble author/ text") - ADD_COLOR("ad", "#FF5E00", "Ephemeral main color") + ADD_COLOR_WITH_LINK("ad", "", "Ephemeral main color", "i") ADD_COLOR("ae", "#FF0000", "Important message") ADD_COLOR("af", "#9FA6AB", "Admin Status") ADD_COLOR("ag", "#EBEBEB", "Line between items in list") @@ -143,7 +149,7 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("timeline_bg_1", "#EFF0F2", "Timeline background color 1") ADD_COLOR("timeline_bg_2", "#FFFFFF", "Timeline background color 2") - ADD_COLOR("message_banner_bg", "#9ECD1D", "Message banner background") + ADD_COLOR_WITH_LINK("message_banner_bg", "", "Message banner background", "primary_accept") ADD_COLOR("message_banner_fg", "#FFFFFF", "Message banner foreground") ADD_COLOR("incall_message_banner_bg", "#FC4607", "Incall message banner background") ADD_COLOR("incall_message_banner_fg", "#FFFFFF", "Incall message banner foreground") @@ -161,45 +167,33 @@ class ColorListModel : public ProxyListModel { // inv=inverse // bg=background, fg=foreground -// Standard actions : +// Standard actions : ADD_COLOR("s_n_b_bg", "#96A5B1", "[M] Standard normal button : background") ADD_COLOR("s_d_b_bg", "#D0D8DE", "[M] Standard disabled button : background") ADD_COLOR("s_h_b_bg", "#4B5964", "[M] Standard hovered button : background") - ADD_COLOR("s_p_b_bg", "#FF5E00", "[M] Standard pressed button : background") + ADD_COLOR_WITH_LINK("s_p_b_bg", "", "[M] Standard pressed button : background", "i") ADD_COLOR("s_n_b_fg", "white", "[M] Standard normal button : foreground") ADD_COLOR("s_d_b_fg", "white", "[M] Standard disabled button : foreground") ADD_COLOR("s_h_b_fg", "white", "[M] Standard hovered button : foreground") ADD_COLOR("s_p_b_fg", "white", "[M] Standard pressed button : foreground") - /* -// Inverse - ADD_COLOR("s_n_b_inv_bg", "transparent", "Standard normal button : inverse background") - ADD_COLOR("s_d_b_inv_bg", "transparent", "Standard disabled button : inverse background") - ADD_COLOR("s_h_b_inv_bg", "transparent", "Standard hovered button : inverse background") - ADD_COLOR("s_p_b_inv_bg", "transparent", "Standard pressed button : inverse background") - - ADD_COLOR("s_n_b_inv_fg", "black", "Standard normal button : inverse foreground") - ADD_COLOR("s_d_b_inv_fg", "black", "Standard disabled button : inverse foreground") - ADD_COLOR("s_h_b_inv_fg", "black", "Standard hovered button : inverse foreground") - ADD_COLOR("s_p_b_inv_fg", "black", "Standard pressed button : inverse foreground") - */ //---------------------------- // Main Actions : like home button - ADD_COLOR("ma_n_b_bg", "#FF5E00", "[M] Main normal button : background") - ADD_COLOR("ma_d_b_bg", "#FFCEB2", "[M] Main disabled button : background") - ADD_COLOR("ma_h_b_bg", "#4B5964", "[M] Main hovered button : background") - ADD_COLOR("ma_p_b_bg", "#DC4100", "[M] Main pressed button : background") + ADD_COLOR_WITH_LINK("ma_n_b_bg", "", "[M] Main normal button : background", "i") + ADD_COLOR_WITH_LINK("ma_d_b_bg", "", "[M] Main disabled button : background", "i80") // "#FFCEB2" + ADD_COLOR_WITH_LINK("ma_h_b_bg", "", "[M] Main hovered button : background", "secondary_h") + ADD_COLOR_WITH_LINK("ma_p_b_bg", "", "[M] Main pressed button : background", "b") ADD_COLOR("ma_n_b_fg", "white", "[M] Main normal button : foreground") ADD_COLOR("ma_d_b_fg", "white", "[M] Main disabled button : foreground") ADD_COLOR("ma_h_b_fg", "white", "[M] Main hovered button : foreground") ADD_COLOR("ma_p_b_fg", "white", "[M] Main pressed button : foreground") //------------------------------------- -// Accept Actions : like accepting a call - ADD_COLOR("a_n_b_bg", "#9ECD1D", "[M] Accept normal button : background") - ADD_COLOR("a_d_b_bg", "#809ECD1D", "[M] Accept disabled button : background") +// Accept Actions : like accepting a call + ADD_COLOR_WITH_LINK("a_n_b_bg", "", "[M] Accept normal button : background", "primary_accept") + ADD_COLOR_WITH_LINK("a_d_b_bg", "", "[M] Accept disabled button : background", "primary_accept80") ADD_COLOR("a_h_b_bg", "#7D9F21", "[M] Accept hovered button : background") - ADD_COLOR("a_p_b_bg", "#9ECD1D", "[M] Accept pressed button : background") + ADD_COLOR_WITH_LINK("a_p_b_bg", "", "[M] Accept pressed button : background", "a_n_b_bg") ADD_COLOR("a_n_b_fg", "white", "[M] Accept normal button : foreground") ADD_COLOR("a_d_b_fg", "white", "[M] Accept disabled button : foreground") @@ -207,10 +201,10 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("a_p_b_fg", "white", "[M] Accept pressed button : foreground") //------------------------------------- // Reject Actions : like rejecting a call - ADD_COLOR("r_n_b_bg", "#FF5E00", "[M] Reject normal button : background") - ADD_COLOR("r_d_b_bg", "#80FF5E00", "[M] Reject disabled button : background") - ADD_COLOR("r_h_b_bg", "#DC4100", "[M] Reject hovered button : background") - ADD_COLOR("r_p_b_bg", "#FF5E00", "[M] Reject pressed button : background") + ADD_COLOR_WITH_LINK("r_n_b_bg", "", "[M] Reject normal button : background", "i") + ADD_COLOR_WITH_LINK("r_d_b_bg", "", "[M] Reject disabled button : background", "i80") + ADD_COLOR_WITH_LINK("r_h_b_bg", "", "[M] Reject hovered button : background", "b") + ADD_COLOR_WITH_LINK("r_p_b_bg", "", "[M] Reject pressed button : background", "r_n_b_bg") ADD_COLOR("r_n_b_fg", "white", "[M] Reject normal button : foreground") ADD_COLOR("r_d_b_fg", "white", "[M] Reject disabled button : foreground") @@ -227,7 +221,7 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("l_n_b_fg", "#4B5964", "[M] List normal button : foreground") ADD_COLOR("l_d_b_fg", "#8096A5B1", "[M] List disabled button : foreground") ADD_COLOR("l_h_b_fg", "#96A5B1", "[M] List hovered button : foreground") - ADD_COLOR("l_p_b_fg", "#FF5E00", "[M] List pressed button : foreground") + ADD_COLOR_WITH_LINK("l_p_b_fg", "", "[M] List pressed button : foreground", "i") ADD_COLOR_WITH_LINK("l_u_b_fg", "", "[M] List updating button : foreground", "l_p_b_fg") //------------------------------------- @@ -239,20 +233,22 @@ class ColorListModel : public ProxyListModel { ADD_COLOR_WITH_LINK("me_u_b_bg", "", "[M] Menu updating button : background", "me_p_b_bg") ADD_COLOR("me_n_b_fg", "#4B5964", "[M] Menu normal button : foreground") - ADD_COLOR("me_d_b_fg", "#8096A5B1", "[M] Menu disabled button : foreground") ADD_COLOR("me_h_b_fg", "#96A5B1", "[M] Menu hovered button : foreground") - ADD_COLOR("me_p_b_fg", "#FF5E00", "[M] Menu pressed button : foreground") + ADD_COLOR_WITH_ALPHA("me_h_b_fg", 80, "") + ADD_COLOR_WITH_LINK("me_d_b_fg", "", "[M] Menu disabled button : foreground", "me_h_b_fg80") + ADD_COLOR_WITH_LINK("me_p_b_fg", "", "[M] Menu pressed button : foreground", "i") ADD_COLOR_WITH_LINK("me_u_b_fg", "", "[M] Menu updating button : background", "me_p_b_fg") // Inverse ADD_COLOR("me_n_b_inv_bg", "transparent", "[M] Menu normal button : inverse background") ADD_COLOR("me_d_b_inv_bg", "transparent", "[M] Menu disabled button : inverse background") ADD_COLOR("me_h_b_inv_bg", "transparent", "[M] Menu hovered button : inverse background") ADD_COLOR("me_p_b_inv_bg", "transparent", "[M] Menu pressed button : inverse background") - ADD_COLOR("me_c_b_inv_bg", "#FF5E00", "[M] Menu checked button : inverse background") + ADD_COLOR_WITH_LINK("me_c_b_inv_bg", "", "[M] Menu checked button : inverse foreground", "i") ADD_COLOR("me_n_b_inv_fg", "white", "[M] Menu normal button : inverse foreground") - ADD_COLOR("me_d_b_inv_fg", "#80FFFFFF", "[M] Menu disabled button : inverse foreground") - ADD_COLOR("me_h_b_inv_fg", "#B0FFFFFF", "[M] Menu hovered button : inverse foreground") + ADD_COLOR_WITH_ALPHA("me_n_b_inv_fg", 80, "") + ADD_COLOR_WITH_LINK("me_d_b_inv_fg", "", "[M] Menu disabled button : inverse foreground", "me_n_b_inv_fg80") + ADD_COLOR_WITH_LINK("me_h_b_inv_fg", "", "[M] Menu hovered button : inverse foreground", "me_n_b_inv_fg80") ADD_COLOR("me_p_b_inv_fg", "white", "[M] Menu pressed button : inverse foreground") ADD_COLOR("me_c_b_inv_fg", "white", "[M] Menu checked button : inverse foreground") //------------------------------------- @@ -276,58 +272,9 @@ class ColorListModel : public ProxyListModel { ADD_COLOR("wr_n_b_fg", "#96A5B1", "[M] Wave record normal button : foreground") ADD_COLOR("wr_d_b_fg", "#96A5B1", "[M] Wave record disabled button : foreground") ADD_COLOR("wr_h_b_fg", "#4B5964", "[M] Wave record hovered button : foreground") - ADD_COLOR("wr_p_b_fg", "#FF5E00", "[M] Wave record pressed button : foreground") + ADD_COLOR_WITH_LINK("wr_p_b_fg", "", "[M] Wave record pressed button : foreground", "i") //-------------------------------------------------------------------------------------------------------------------- -/* - ADD_COLOR("m_b_bg_h", "#4B5964", "Main color for hovered buttons(background)") - ADD_COLOR("m_b_bg_p", "#DC4100", "Main color for pressed buttons(background)") - ADD_COLOR("m_b_fg_n", "#FFFFFF", "Main color for normal buttons(foreground)") - ADD_COLOR_WITH_LINK("m_b_fg_h", "", "Main color for hovered buttons(foreground)", "m_b_fg_n") - ADD_COLOR_WITH_LINK("m_b_fg_p", "", "Main color for pressed buttons(foreground)", "m_b_fg_n") - - - - ADD_COLOR_WITH_LINK("m_b_bg_n", "", "Main color for normal buttons(background)", "i") - ADD_COLOR("m_b_bg_h", "#4B5964", "Main color for hovered buttons(background)") - ADD_COLOR("m_b_bg_p", "#DC4100", "Main color for pressed buttons(background)") - ADD_COLOR("m_b_fg_n", "#FFFFFF", "Main color for normal buttons(foreground)") - ADD_COLOR_WITH_LINK("m_b_fg_h", "", "Main color for hovered buttons(foreground)", "m_b_fg_n") - ADD_COLOR_WITH_LINK("m_b_fg_p", "", "Main color for pressed buttons(foreground)", "m_b_fg_n") - - ADD_COLOR("action_b_bg_n", "#96A6B1", "Action color for normal buttons(background)") - ADD_COLOR("action_b_bg_h", "#4B5964", "Action color for hovered buttons(background)") - ADD_COLOR("action_b_bg_p", "#FE5E00", "Action color for pressed buttons(background)") - ADD_COLOR("action_b_fg_n", "white", "Action color for normal buttons(foreground)") - ADD_COLOR_WITH_LINK("action_b_fg_h", "", "Action color for hovered buttons(foreground)", "action_b_fg_n") - ADD_COLOR_WITH_LINK("action_b_fg_p", "", "Action color for pressed buttons(foreground)", "action_b_fg_n") - - ADD_COLOR("noBackground_b_n", "transparent", "Buttons with no background(normal)") - ADD_COLOR_WITH_LINK("noBackground_b_h", "", "Buttons with no background(hovered)", "noBackground_b_n") - ADD_COLOR_WITH_LINK("noBackground_b_p", "", "Buttons with no background(pressed)", "noBackground_b_n") - ADD_COLOR("foreground_noBackground_b_n", "#96A6B1", "Normal buttons without background(foreground)") - ADD_COLOR("foreground_noBackground_b_h", "#4B5964", "Hovered buttons without background(foreground)") - ADD_COLOR("foreground_noBackground_b_p", "#DC4100", "Pressed buttons without background(foreground)") - ADD_COLOR("foreground_noBackground_b_activated", "#FF5E00", "Activated buttons without background(foreground)") - - ADD_COLOR("inv_noBackground_b_n", "transparent", "Inverse color for normal buttons with no background(normal)") - ADD_COLOR_WITH_LINK("inv_noBackground_b_h", "", "Inverse color for hovered buttons with no background(hovered)", "inv_noBackground_b_n") - ADD_COLOR_WITH_LINK("inv_noBackground_b_p", "", "Inverse color for pressed buttons with no background(pressed)", "inv_noBackground_b_n") - ADD_COLOR_WITH_LINK("inv_fg_noBackground_b_n", "", "Inverse color for normal buttons(foreground)", "foreground_noBackground_b_n") - ADD_COLOR("inv_fg_noBackground_b_h", "white", "Inverse color for hovered buttons(foreground)") - ADD_COLOR_WITH_LINK("inv_fg_noBackground_b_p", "", "Inverse color for pressed buttons(foreground)", "foreground_noBackground_b_p") - ADD_COLOR_WITH_LINK("inv_fg_noBackground_b_activated", "", "Inverse color for activated buttons without background(foreground)", "foreground_noBackground_b_activated") - - ADD_COLOR("inv_fg_noBackground_b_h", "white", "Inverse color for hovered buttons(foreground)") - - - ADD_COLOR("noBackground_b_n", "transparent", "Buttons with no background(normal)") - ADD_COLOR_WITH_LINK("noBackground_b_h", "", "Buttons with no background(hovered)", "noBackground_b_n") - ADD_COLOR_WITH_LINK("noBackground_b_p", "", "Buttons with no background(pressed)", "noBackground_b_n") - ADD_COLOR("foreground_noBackground_b_n", "#96A6B1", "Inverse color for normal buttons(foreground)") - ADD_COLOR("foreground_noBackground_b_h", "#4B5964", "Inverse color for hovered buttons(foreground)") - ADD_COLOR("foreground_noBackground_b_p", "#DC4100", "Inverse color for pressed buttons(foreground)") -*/ ADD_COLOR("border", "black", "Borders") ADD_COLOR("border_light", "#A8A8A8", "Lighter borders") @@ -367,7 +314,7 @@ public: // color : if empty, use the color from link // description : describe the color // idLink : link this color with another ID - Q_INVOKABLE ColorModel * add(const QString& id, const QString& idLink, QString description = "", QString color = ""); + Q_INVOKABLE ColorModel * add(const QString& id, const QString& idLink, QString description = "", QString color = "", const int& overrideAlpha = -1); Q_INVOKABLE ColorModel * addImageColor(const QString& id, const QString& imageId, const QString& idLink, QString description = "", QString color = ""); void addLink(const QString& a, const QString& b); @@ -391,6 +338,7 @@ signals: private: void add(QSharedPointer imdn); QString buildDescription(QString description); // return a description from id by splitting '_' + void updateLinkIndexToColor(const QString& id, const int& index); QStringList getColorNames () const; diff --git a/linphone-app/src/components/other/colors/ColorModel.cpp b/linphone-app/src/components/other/colors/ColorModel.cpp index 613d684b8..406259ad8 100644 --- a/linphone-app/src/components/other/colors/ColorModel.cpp +++ b/linphone-app/src/components/other/colors/ColorModel.cpp @@ -51,6 +51,9 @@ QString ColorModel::getDescription() const{ QString ColorModel::getLinkedToImage() const{ return mLinkedToImage; } +int ColorModel::getLinkIndex() const{ + return mLinkIndex; +} void ColorModel::setColor(const QColor& color){ if(color != mColor){ @@ -62,7 +65,9 @@ void ColorModel::setColor(const QColor& color){ void ColorModel::setInternalColor(const QColor& color){ if(color != mColor){ + auto backup = mColor.alpha(); mColor = color; + mColor.setAlpha(backup); emit colorChanged(); } } @@ -82,3 +87,9 @@ void ColorModel::setDescription(const QString& description){ void ColorModel::setLinkedToImage(const QString& id){ mLinkedToImage = id; } +void ColorModel::setLinkIndex(const int& index){ + if(index != mLinkIndex){ + mLinkIndex = index; + emit linkIndexChanged(); + } +} \ No newline at end of file diff --git a/linphone-app/src/components/other/colors/ColorModel.hpp b/linphone-app/src/components/other/colors/ColorModel.hpp index ce374a1fa..e18504b98 100644 --- a/linphone-app/src/components/other/colors/ColorModel.hpp +++ b/linphone-app/src/components/other/colors/ColorModel.hpp @@ -38,10 +38,12 @@ public: 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) + Q_PROPERTY(int linkIndex MEMBER mLinkIndex WRITE setLinkIndex NOTIFY linkIndexChanged) QColor getColor() const; QString getDescription() const; QString getName() const; + int getLinkIndex() const; Q_INVOKABLE QString toString(){return getName();} QString getLinkedToImage() const; @@ -49,18 +51,21 @@ public: void setInternalColor(const QColor& color); void setAlpha(const int& alpha); void setDescription(const QString& description); + void setLinkIndex(const int& index); void setLinkedToImage(const QString& id); signals: void colorChanged(); void uiColorChanged(const QString& id, const QColor& color); // UI request a change void descriptionChanged(); + void linkIndexChanged(); private: QString mName; QColor mColor; QString mDescription; QString mLinkedToImage; + int mLinkIndex = -1; }; Q_DECLARE_METATYPE(QSharedPointer); diff --git a/linphone-app/src/components/other/colors/ColorProxyModel.cpp b/linphone-app/src/components/other/colors/ColorProxyModel.cpp index 5e890651e..6c0777f7d 100644 --- a/linphone-app/src/components/other/colors/ColorProxyModel.cpp +++ b/linphone-app/src/components/other/colors/ColorProxyModel.cpp @@ -36,14 +36,49 @@ ColorProxyModel::ColorProxyModel (QObject *parent) : QSortFilterProxyModel(paren sort(0); } +int ColorProxyModel::getShowPageIndex()const{ + return mShowPageIndex; +} +void ColorProxyModel::setShowPageIndex(const int& index){ + if(mShowPageIndex != index){ + mShowPageIndex = index; + emit showPageIndexChanged(); + invalidate(); + } +} + +bool ColorProxyModel::getShowAll()const{ + return mShowAll; +} +void ColorProxyModel::setShowAll(const bool& show){ + if(mShowAll != show){ + mShowAll = show; + emit showAllChanged(); + invalidate(); + } +} + void ColorProxyModel::updateLink(const QString& id, const QString& newLink){ App::getInstance()->getColorListModel()->updateLink(id, newLink); invalidate(); } void ColorProxyModel::changeSort(){ - mSortMode = (mSortMode+1)%3; + mSortMode = (mSortMode+1)%4; invalidate(); + emit sortChanged(); +} + +QString ColorProxyModel::getSortDescription() const{ + switch(mSortMode){ + case 0: return "Link name"; + case 1: return "Name"; + case 2: return "Description"; + case 3: return "Color"; + default:{ + return "Name"; + } + } } bool ColorProxyModel::filterAcceptsRow ( @@ -55,7 +90,8 @@ bool ColorProxyModel::filterAcceptsRow ( const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); const ColorModel *model= index.data().value(); //return model->getLinkedToImage() == "";// Remove linked to image from list - return true; + int currentPage = sourceRow / 50; + return mShowAll || currentPage == mShowPageIndex; } bool ColorProxyModel::lessThan (const QModelIndex &left, const QModelIndex &right) const { @@ -64,11 +100,13 @@ bool ColorProxyModel::lessThan (const QModelIndex &left, const QModelIndex &righ const ColorModel *b = model->data(right).value(); switch(mSortMode){ case 0 : - return model->getLinkIndex(a->getName()) < model->getLinkIndex(b->getName()); + return a->getLinkIndex() < b->getLinkIndex(); case 1: return a->getName() < b->getName(); case 2: return a->getDescription() < b->getDescription(); + case 3: + return a->getColor().name() < b->getColor().name(); default: return a->getName() < b->getName(); } diff --git a/linphone-app/src/components/other/colors/ColorProxyModel.hpp b/linphone-app/src/components/other/colors/ColorProxyModel.hpp index 06b23debf..29965c984 100644 --- a/linphone-app/src/components/other/colors/ColorProxyModel.hpp +++ b/linphone-app/src/components/other/colors/ColorProxyModel.hpp @@ -38,9 +38,26 @@ class ColorProxyModel : public QSortFilterProxyModel { public: ColorProxyModel (QObject *parent = nullptr); + Q_PROPERTY(QString sortDescription READ getSortDescription NOTIFY sortChanged) + Q_PROPERTY(int showPageIndex READ getShowPageIndex WRITE setShowPageIndex NOTIFY showPageIndexChanged) + Q_PROPERTY(bool showAll READ getShowAll WRITE setShowAll NOTIFY showAllChanged) + Q_INVOKABLE void updateLink(const QString& id, const QString& newLink); + Q_INVOKABLE void changeSort(); + QString getSortDescription() const; + + int getShowPageIndex()const; + void setShowPageIndex(const int& index); + + bool getShowAll()const; + void setShowAll(const bool& showAll); + +signals: + void sortChanged(); + void showPageIndexChanged(); + void showAllChanged(); protected: virtual bool filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const override; @@ -48,6 +65,8 @@ protected: private: int mSortMode; + int mShowPageIndex = 0; + bool mShowAll = false; }; diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 3cf63bb4f..ab4211f7f 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -49,10 +49,11 @@ class SettingsModel : public QObject { Q_PROPERTY(bool useOtherSipAccountEnabled READ getUseOtherSipAccountEnabled WRITE setUseOtherSipAccountEnabled NOTIFY useOtherSipAccountEnabledChanged) Q_PROPERTY(bool assistantSupportsPhoneNumbers READ getAssistantSupportsPhoneNumbers WRITE setAssistantSupportsPhoneNumbers NOTIFY assistantSupportsPhoneNumbersChanged) +// Webviews config Q_PROPERTY(QString assistantRegistrationUrl READ getAssistantRegistrationUrl WRITE setAssistantRegistrationUrl NOTIFY assistantRegistrationUrlChanged) Q_PROPERTY(QString assistantLoginUrl READ getAssistantLoginUrl WRITE setAssistantLoginUrl NOTIFY assistantLoginUrlChanged) Q_PROPERTY(QString assistantLogoutUrl READ getAssistantLogoutUrl WRITE setAssistantLogoutUrl NOTIFY assistantLogoutUrlChanged) - +//---- Q_PROPERTY(bool cguAccepted READ isCguAccepted WRITE acceptCgu NOTIFY cguAcceptedChanged) // SIP Accounts. ------------------------------------------------------------- diff --git a/linphone-app/src/utils/Constants.hpp b/linphone-app/src/utils/Constants.hpp index d03cfa62f..4d490992b 100644 --- a/linphone-app/src/utils/Constants.hpp +++ b/linphone-app/src/utils/Constants.hpp @@ -82,11 +82,13 @@ public: Q_PROPERTY(QString ContactUrl MEMBER ContactUrl CONSTANT) Q_PROPERTY(QString TranslationUrl MEMBER TranslationUrl CONSTANT) Q_PROPERTY(int maxMosaicParticipants MEMBER MaxMosaicParticipants CONSTANT) - + +// For Webviews static constexpr char DefaultAssistantRegistrationUrl[] = "https://subscribe.linphone.org/register"; static constexpr char DefaultAssistantLoginUrl[] = "https://subscribe.linphone.org/login"; static constexpr char DefaultAssistantLogoutUrl[] = "https://subscribe.linphone.org/logout"; - +//-------------- + // Max image size in bytes. (100Kb) static constexpr qint64 MaxImageSize = 102400;// In Bytes. static constexpr qint64 FileSizeLimit = 524288000;// In Bytes. diff --git a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml index df5f4e642..5027e8946 100644 --- a/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml +++ b/linphone-app/ui/modules/Linphone/Styles/Chat/ChatStyle.qml @@ -247,7 +247,7 @@ QtObject { } property QtObject incoming: QtObject { - property color backgroundColor: ColorsList.add(sectionName+'_incoming_bg', 'o').color + property color backgroundColor: ColorsList.add(sectionName+'_incoming_bg', 'incoming_bg').color property int avatarSize: 20 property QtObject text: QtObject { @@ -257,7 +257,7 @@ QtObject { } property QtObject outgoing: QtObject { - property color backgroundColor: ColorsList.add(sectionName+'_outgoing_bg', 'e').color + property color backgroundColor: ColorsList.add(sectionName+'_outgoing_bg', 'outgoing_bg').color property int areaSize: 12 property int busyIndicatorSize: 12 property int sendIconSize: 60 diff --git a/linphone-app/ui/views/App/Calls/WaitingRoom.qml b/linphone-app/ui/views/App/Calls/WaitingRoom.qml index 4b9887076..f63a9142c 100644 --- a/linphone-app/ui/views/App/Calls/WaitingRoom.qml +++ b/linphone-app/ui/views/App/Calls/WaitingRoom.qml @@ -53,6 +53,7 @@ Rectangle { Layout.bottomMargin: (mainItem.conferenceInfoModel && mainItem.callModel ? 10 : 30) spacing: 10 BusyIndicator { + id: busyIndicator Layout.alignment: Qt.AlignCenter Layout.preferredHeight: WaitingRoomStyle.header.busyIndicator.height Layout.preferredWidth: WaitingRoomStyle.header.busyIndicator.width @@ -63,6 +64,7 @@ Rectangle { Text{ Layout.alignment: Qt.AlignCenter + Layout.topMargin: busyIndicator.visible ? 0 : 30 text: mainItem.callModel ? mainItem.isEnded //: "Call ended" : status of the call in waiting room when the call end. diff --git a/linphone-sdk b/linphone-sdk index f816e75e1..a286c00b6 160000 --- a/linphone-sdk +++ b/linphone-sdk @@ -1 +1 @@ -Subproject commit f816e75e1e3e09c3a68b33170e6e966581507a3e +Subproject commit a286c00b618e218fde8314498bb49101c8fd9214