connection feedbacks + pages after connection (to design)

This commit is contained in:
Gaelle Braud 2023-10-31 13:49:31 +01:00
parent 46e91b46a8
commit 22724d8cd2
36 changed files with 546 additions and 112 deletions

View file

@ -25,19 +25,27 @@
#include "model/account/AccountManager.hpp"
DEFINE_ABSTRACT_OBJECT(LoginPage)
LoginPage::LoginPage(QObject *parent) : QObject(parent) {
mustBeInMainThread(getClassName());
}
bool LoginPage::isLogged() const {
LoginPage::~LoginPage() {
mustBeInMainThread("~" + getClassName());
}
linphone::RegistrationState LoginPage::getRegistrationState() const {
// View thread
return mIsLogged;
return mRegistrationState;
}
void LoginPage::setIsLogged(bool status) {
void LoginPage::setRegistrationState(linphone::RegistrationState status) {
// Should be view thread only because of object updates.
if (mIsLogged != status) {
mIsLogged = status;
emit isLoggedChanged();
mustBeInMainThread(log().arg(Q_FUNC_INFO));
if (mRegistrationState != status) {
mRegistrationState = status;
emit registrationStateChanged();
}
}
@ -45,11 +53,25 @@ void LoginPage::login(const QString &username, const QString &password) {
App::postModelAsync([=]() {
// Create on Model thread.
AccountManager *accountManager = new AccountManager();
connect(accountManager, &AccountManager::logged, this, [accountManager, this](bool isLoggued) mutable {
// View thread
setIsLogged(isLoggued);
accountManager->deleteLater();
});
accountManager->login(username, password);
connect(accountManager, &AccountManager::registrationStateChanged, this,
[accountManager, this](linphone::RegistrationState state) mutable {
// View thread
setRegistrationState(state);
switch (state) {
case linphone::RegistrationState::Ok:
case linphone::RegistrationState::Cleared:
case linphone::RegistrationState::Failed: {
accountManager->deleteLater();
break;
}
case linphone::RegistrationState::None:
case linphone::RegistrationState::Progress:
case linphone::RegistrationState::Refreshing:
break;
}
});
if (!accountManager->login(username, password)) {
emit accountManager->registrationStateChanged(linphone::RegistrationState::Failed);
}
});
}

View file

@ -18,23 +18,34 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#ifndef LOGINPAGE_H_
#define LOGINPAGE_H_
class LoginPage : public QObject {
#include "tool/AbstractObject.hpp"
#include <QObject>
#include <linphone++/linphone.hh>
class LoginPage : public QObject, public AbstractObject {
Q_OBJECT
public:
LoginPage(QObject *parent = nullptr);
~LoginPage();
Q_PROPERTY(bool isLogged READ isLogged NOTIFY isLoggedChanged)
Q_INVOKABLE void login(const QString& username, const QString& password);
Q_PROPERTY(linphone::RegistrationState registrationState READ getRegistrationState NOTIFY registrationStateChanged)
bool isLogged() const;
void setIsLogged(bool status);
Q_INVOKABLE void login(const QString &username, const QString &password);
linphone::RegistrationState getRegistrationState() const;
void setRegistrationState(linphone::RegistrationState status);
signals:
void isLoggedChanged();
void registrationStateChanged();
private:
bool mIsLogged = false;
linphone::RegistrationState mRegistrationState = linphone::RegistrationState::None;
DECLARE_ABSTRACT_OBJECT
};
#endif

View file

@ -15,6 +15,8 @@ list(APPEND _LINPHONEAPP_RC_FILES data/assistant/use-app-sip-account.rc
"data/image/caret-left.svg"
"data/image/verif_page_image.svg"
"data/image/check.svg"
"data/image/chiffrement.svg"
"data/image/interoperable.svg"
)
set(_LINPHONEAPP_RC_FILES ${_LINPHONEAPP_RC_FILES} PARENT_SCOPE)

View file

@ -0,0 +1,16 @@
<svg width="112" height="112" viewBox="0 0 112 112" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_4118_695)">
<path d="M101.5 28V84C101.5 85.8565 100.763 87.637 99.4499 88.9497C98.1371 90.2625 96.3566 91 94.5001 91H30.0632L22.0589 103.298C22.042 103.316 22.0229 103.333 22.002 103.346C20.7451 104.414 19.1494 105 17.5001 105C16.4732 104.998 15.4592 104.771 14.5295 104.335C13.3203 103.778 12.2972 102.884 11.5826 101.76C10.868 100.637 10.4922 99.3314 10.5001 98V28C10.5001 26.1435 11.2376 24.363 12.5504 23.0503C13.8631 21.7375 15.6436 21 17.5001 21H94.5001C96.3566 21 98.1371 21.7375 99.4499 23.0503C100.763 24.363 101.5 26.1435 101.5 28Z" fill="url(#paint0_linear_4118_695)"/>
<path d="M70.7369 43.6211H41.5579C40.8544 43.6211 40.1797 43.9006 39.6822 44.398C39.1847 44.8955 38.9053 45.5702 38.9053 46.2737V67.4948C38.9053 68.1983 39.1847 68.873 39.6822 69.3705C40.1797 69.8679 40.8544 70.1474 41.5579 70.1474H70.7369C71.4404 70.1474 72.1151 69.8679 72.6125 69.3705C73.11 68.873 73.3895 68.1983 73.3895 67.4948V46.2737C73.3895 45.5702 73.11 44.8955 72.6125 44.398C72.1151 43.9006 71.4404 43.6211 70.7369 43.6211ZM45.5369 63.5158C45.5369 63.8676 45.3971 64.2049 45.1484 64.4537C44.8997 64.7024 44.5623 64.8421 44.2105 64.8421C43.8588 64.8421 43.5214 64.7024 43.2727 64.4537C43.024 64.2049 42.8842 63.8676 42.8842 63.5158V50.2527C42.8842 49.9009 43.024 49.5636 43.2727 49.3148C43.5214 49.0661 43.8588 48.9264 44.2105 48.9264C44.5623 48.9264 44.8997 49.0661 45.1484 49.3148C45.3971 49.5636 45.5369 49.9009 45.5369 50.2527V63.5158ZM57.6892 56.9158L55.6401 57.5789L56.9067 59.3197C57.0091 59.4612 57.0827 59.6215 57.1232 59.7915C57.1637 59.9614 57.1703 60.1377 57.1426 60.3102C57.115 60.4827 57.0537 60.648 56.9621 60.7968C56.8706 60.9456 56.7506 61.0749 56.6091 61.1774C56.4676 61.2798 56.3073 61.3534 56.1373 61.3938C55.9674 61.4343 55.7911 61.4409 55.6186 61.4133C55.4461 61.3857 55.2808 61.3243 55.132 61.2328C54.9832 61.1412 54.8539 61.0213 54.7514 60.8798L53.4947 59.1406L52.2298 60.8831C52.0229 61.1689 51.711 61.3608 51.3626 61.4166C51.0142 61.4724 50.6579 61.3876 50.3721 61.1807C50.0863 60.9738 49.8944 60.6619 49.8386 60.3135C49.7828 59.9651 49.8676 59.6088 50.0745 59.323L51.3411 57.5822L49.292 56.9191C49.1264 56.8646 48.9732 56.7781 48.841 56.6645C48.7089 56.5508 48.6004 56.4123 48.5218 56.2567C48.3631 55.9425 48.3357 55.5782 48.4456 55.2438C48.5001 55.0782 48.5866 54.925 48.7002 54.7928C48.8139 54.6607 48.9524 54.5522 49.108 54.4736C49.4222 54.3149 49.7865 54.2875 50.1209 54.3974L52.1684 55.0606V52.9053C52.1684 52.5535 52.3082 52.2162 52.5569 51.9675C52.8056 51.7187 53.143 51.579 53.4947 51.579C53.8465 51.579 54.1839 51.7187 54.4326 51.9675C54.6813 52.2162 54.8211 52.5535 54.8211 52.9053V55.0606L56.8686 54.3974C57.0341 54.343 57.2088 54.3217 57.3826 54.3348C57.5564 54.3478 57.7259 54.395 57.8815 54.4736C58.0371 54.5522 58.1756 54.6607 58.2893 54.7928C58.4029 54.925 58.4894 55.0782 58.5439 55.2438C58.5983 55.4093 58.6196 55.584 58.6065 55.7578C58.5934 55.9316 58.5462 56.1011 58.4677 56.2567C58.3891 56.4123 58.2806 56.5508 58.1485 56.6645C58.0163 56.7781 57.8631 56.8646 57.6975 56.9191L57.6892 56.9158ZM69.6261 56.9158L67.5769 57.5789L68.8435 59.3197C68.946 59.4612 69.0195 59.6215 69.06 59.7915C69.1005 59.9614 69.1071 60.1377 69.0795 60.3102C69.0518 60.4827 68.9905 60.648 68.899 60.7968C68.8074 60.9456 68.6875 61.0749 68.5459 61.1774C68.4044 61.2798 68.2441 61.3534 68.0742 61.3938C67.9042 61.4343 67.728 61.4409 67.5555 61.4133C67.383 61.3857 67.2176 61.3243 67.0688 61.2328C66.92 61.1412 66.7907 61.0213 66.6883 60.8798L65.4316 59.1406L64.1666 60.8831C63.9597 61.1689 63.6478 61.3608 63.2994 61.4166C62.951 61.4724 62.5947 61.3876 62.3089 61.1807C62.0231 60.9738 61.8312 60.6619 61.7754 60.3135C61.7196 59.9651 61.8045 59.6088 62.0114 59.323L63.278 57.5822L61.2288 56.9191C61.0632 56.8646 60.91 56.7781 60.7779 56.6645C60.6457 56.5508 60.5373 56.4123 60.4587 56.2567C60.3 55.9425 60.2725 55.5782 60.3825 55.2438C60.4369 55.0782 60.5234 54.925 60.6371 54.7928C60.7507 54.6607 60.8893 54.5522 61.0448 54.4736C61.359 54.3149 61.7234 54.2875 62.0578 54.3974L64.1053 55.0606V52.9053C64.1053 52.5535 64.245 52.2162 64.4937 51.9675C64.7425 51.7187 65.0798 51.579 65.4316 51.579C65.7833 51.579 66.1207 51.7187 66.3694 51.9675C66.6182 52.2162 66.7579 52.5535 66.7579 52.9053V55.0606L68.8054 54.3974C68.971 54.343 69.1457 54.3217 69.3195 54.3348C69.4933 54.3478 69.6628 54.395 69.8183 54.4736C69.9739 54.5522 70.1125 54.6607 70.2261 54.7928C70.3398 54.925 70.4263 55.0782 70.4807 55.2438C70.5351 55.4093 70.5564 55.584 70.5433 55.7578C70.5303 55.9316 70.4831 56.1011 70.4045 56.2567C70.3259 56.4123 70.2174 56.5508 70.0853 56.6645C69.9532 56.7781 69.7999 56.8646 69.6344 56.9191L69.6261 56.9158Z" fill="white"/>
<path d="M107.579 82.8211H102.274V78.8422C102.274 76.7316 101.435 74.7075 99.9428 73.2151C98.4504 71.7227 96.4263 70.8843 94.3157 70.8843C92.2051 70.8843 90.181 71.7227 88.6886 73.2151C87.1962 74.7075 86.3578 76.7316 86.3578 78.8422V82.8211H81.0525C80.349 82.8211 79.6743 83.1006 79.1768 83.5981C78.6794 84.0955 78.3999 84.7702 78.3999 85.4738V104.042C78.3999 104.746 78.6794 105.42 79.1768 105.918C79.6743 106.415 80.349 106.695 81.0525 106.695H107.579C108.282 106.695 108.957 106.415 109.455 105.918C109.952 105.42 110.231 104.746 110.231 104.042V85.4738C110.231 84.7702 109.952 84.0955 109.455 83.5981C108.957 83.1006 108.282 82.8211 107.579 82.8211ZM95.642 95.8571V100.063C95.642 100.415 95.5023 100.752 95.2535 101.001C95.0048 101.25 94.6675 101.39 94.3157 101.39C93.9639 101.39 93.6266 101.25 93.3778 101.001C93.1291 100.752 92.9894 100.415 92.9894 100.063V95.8571C92.1044 95.5443 91.3586 94.9286 90.8837 94.119C90.4088 93.3094 90.2353 92.358 90.394 91.4329C90.5528 90.5078 91.0334 89.6686 91.751 89.0636C92.4687 88.4586 93.3771 88.1268 94.3157 88.1268C95.2543 88.1268 96.1627 88.4586 96.8803 89.0636C97.598 89.6686 98.0786 90.5078 98.2373 91.4329C98.3961 92.358 98.2226 93.3094 97.7477 94.119C97.2728 94.9286 96.5269 95.5443 95.642 95.8571ZM99.621 82.8211H89.0104V78.8422C89.0104 77.4351 89.5694 76.0857 90.5643 75.0908C91.5592 74.0959 92.9086 73.5369 94.3157 73.5369C95.7227 73.5369 97.0721 74.0959 98.0671 75.0908C99.062 76.0857 99.621 77.4351 99.621 78.8422V82.8211Z" fill="#02528D"/>
</g>
<defs>
<linearGradient id="paint0_linear_4118_695" x1="101.389" y1="8.8421" x2="-21.2211" y2="145.6" gradientUnits="userSpaceOnUse">
<stop stop-color="#4AA8FF"/>
<stop offset="1" stop-color="#4AA8FF" stop-opacity="0.37"/>
</linearGradient>
<clipPath id="clip0_4118_695">
<rect width="112" height="112" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

@ -0,0 +1 @@

View file

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="#4e6074" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg>

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 373 B

View file

@ -0,0 +1,16 @@
<svg width="131" height="113" viewBox="0 0 131 113" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M76.7875 21.6829V64.0485C76.7875 65.453 76.2295 66.7999 75.2364 67.7931C74.2433 68.7862 72.8963 69.3441 71.4918 69.3441H22.7434L16.688 78.648C16.6752 78.6619 16.6607 78.6741 16.6449 78.6844C15.694 79.4923 14.4869 79.9357 13.2391 79.9355C12.4623 79.9342 11.6951 79.7625 10.9918 79.4324C10.077 79.0109 9.30297 78.3346 8.76237 77.4847C8.22177 76.6348 7.93746 75.6471 7.94345 74.6398V21.6829C7.94345 20.2784 8.50139 18.9314 9.49452 17.9383C10.4877 16.9451 11.8346 16.3872 13.2391 16.3872H71.4918C72.8963 16.3872 74.2433 16.9451 75.2364 17.9383C76.2295 18.9314 76.7875 20.2784 76.7875 21.6829Z" fill="url(#paint0_linear_4118_716)"/>
<path d="M52.8457 44.3151H32.7778C32.2456 44.3151 31.7351 44.5266 31.3588 44.9029C30.9824 45.2793 30.771 45.7897 30.771 46.3219V52.3423C30.771 52.8745 30.9824 53.385 31.3588 53.7613C31.7351 54.1377 32.2456 54.3491 32.7778 54.3491H52.8457C53.3779 54.3491 53.8883 54.1377 54.2647 53.7613C54.641 53.385 54.8525 52.8745 54.8525 52.3423V46.3219C54.8525 45.7897 54.641 45.2793 54.2647 44.9029C53.8883 44.5266 53.3779 44.3151 52.8457 44.3151ZM52.8457 52.3423H32.7778V46.3219H52.8457V52.3423ZM52.8457 32.2744H32.7778C32.2456 32.2744 31.7351 32.4858 31.3588 32.8622C30.9824 33.2385 30.771 33.749 30.771 34.2812V40.3016C30.771 40.8338 30.9824 41.3442 31.3588 41.7206C31.7351 42.0969 32.2456 42.3084 32.7778 42.3084H52.8457C53.3779 42.3084 53.8883 42.0969 54.2647 41.7206C54.641 41.3442 54.8525 40.8338 54.8525 40.3016V34.2812C54.8525 33.749 54.641 33.2385 54.2647 32.8622C53.8883 32.4858 53.3779 32.2744 52.8457 32.2744ZM52.8457 40.3016H32.7778V34.2812H52.8457V40.3016ZM50.8389 37.2914C50.8389 37.5891 50.7506 37.8801 50.5852 38.1276C50.4199 38.3751 50.1848 38.568 49.9098 38.6819C49.6348 38.7958 49.3321 38.8256 49.0402 38.7676C48.7482 38.7095 48.48 38.5661 48.2695 38.3556C48.059 38.1452 47.9157 37.877 47.8576 37.585C47.7996 37.2931 47.8294 36.9904 47.9433 36.7154C48.0572 36.4404 48.2501 36.2053 48.4976 36.0399C48.7451 35.8746 49.0361 35.7863 49.3338 35.7863C49.733 35.7863 50.1158 35.9449 50.3981 36.2271C50.6803 36.5094 50.8389 36.8922 50.8389 37.2914ZM50.8389 49.3321C50.8389 49.6298 50.7506 49.9208 50.5852 50.1683C50.4199 50.4158 50.1848 50.6087 49.9098 50.7226C49.6348 50.8366 49.3321 50.8664 49.0402 50.8083C48.7482 50.7502 48.48 50.6069 48.2695 50.3964C48.059 50.1859 47.9157 49.9177 47.8576 49.6258C47.7996 49.3338 47.8294 49.0312 47.9433 48.7561C48.0572 48.4811 48.2501 48.2461 48.4976 48.0807C48.7451 47.9153 49.0361 47.827 49.3338 47.827C49.733 47.827 50.1158 47.9856 50.3981 48.2679C50.6803 48.5501 50.8389 48.9329 50.8389 49.3321Z" fill="white"/>
<path d="M61.372 54.8001V96.7635C61.372 98.1547 61.93 99.4889 62.9231 100.473C63.9163 101.456 65.2633 102.009 66.6679 102.009H115.418L121.473 111.225C121.486 111.238 121.501 111.25 121.516 111.261C122.467 112.061 123.675 112.5 124.922 112.5C125.699 112.499 126.466 112.328 127.17 112.002C128.085 111.584 128.859 110.914 129.399 110.072C129.94 109.23 130.224 108.252 130.218 107.254V54.8001C130.218 53.4089 129.66 52.0747 128.667 51.091C127.674 50.1073 126.327 49.5547 124.922 49.5547H66.6679C65.2633 49.5547 63.9163 50.1073 62.9231 51.091C61.93 52.0747 61.372 53.4089 61.372 54.8001Z" fill="url(#paint1_linear_4118_716)"/>
<path d="M84.2856 78.3185H106.583C107.175 78.3185 107.742 78.5535 108.16 78.9716C108.578 79.3898 108.813 79.9569 108.813 80.5483V87.2376C108.813 87.829 108.578 88.3961 108.16 88.8143C107.742 89.2324 107.175 89.4674 106.583 89.4674H84.2856C83.6942 89.4674 83.127 89.2324 82.7089 88.8143C82.2907 88.3961 82.0558 87.829 82.0558 87.2376V80.5483C82.0558 79.9569 82.2907 79.3898 82.7089 78.9716C83.127 78.5535 83.6942 78.3185 84.2856 78.3185ZM84.2856 87.2376H106.583V80.5483H84.2856V87.2376ZM84.2856 64.9399H106.583C107.175 64.9399 107.742 65.1749 108.16 65.593C108.578 66.0112 108.813 66.5783 108.813 67.1697V73.859C108.813 74.4504 108.578 75.0175 108.16 75.4357C107.742 75.8538 107.175 76.0888 106.583 76.0888H84.2856C83.6942 76.0888 83.127 75.8538 82.7089 75.4357C82.2907 75.0175 82.0558 74.4504 82.0558 73.859V67.1697C82.0558 66.5783 82.2907 66.0112 82.7089 65.593C83.127 65.1749 83.6942 64.9399 84.2856 64.9399ZM84.2856 73.859H106.583V67.1697H84.2856V73.859ZM86.5153 70.5144C86.5153 70.8451 86.6134 71.1684 86.7972 71.4434C86.9809 71.7185 87.2421 71.9328 87.5477 72.0594C87.8533 72.186 88.1895 72.2191 88.5139 72.1545C88.8383 72.09 89.1363 71.9307 89.3702 71.6969C89.604 71.463 89.7633 71.165 89.8278 70.8406C89.8924 70.5162 89.8593 70.18 89.7327 69.8744C89.6061 69.5688 89.3918 69.3076 89.1167 69.1239C88.8417 68.9401 88.5184 68.842 88.1877 68.842C87.7441 68.842 87.3188 69.0182 87.0051 69.3318C86.6915 69.6455 86.5153 70.0708 86.5153 70.5144ZM86.5153 83.893C86.5153 84.2237 86.6134 84.547 86.7972 84.822C86.9809 85.0971 87.2421 85.3114 87.5477 85.438C87.8533 85.5646 88.1895 85.5977 88.5139 85.5331C88.8383 85.4686 89.1363 85.3093 89.3702 85.0755C89.604 84.8416 89.7633 84.5436 89.8278 84.2192C89.8924 83.8948 89.8593 83.5586 89.7327 83.253C89.6061 82.9474 89.3918 82.6862 89.1167 82.5025C88.8417 82.3187 88.5184 82.2206 88.1877 82.2206C87.7441 82.2206 87.3188 82.3968 87.0051 82.7104C86.6915 83.0241 86.5153 83.4494 86.5153 83.893Z" fill="white"/>
<defs>
<linearGradient id="paint0_linear_4118_716" x1="121.299" y1="-19.1218" x2="-31.6628" y2="110.651" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF9730"/>
<stop offset="1" stop-color="#FFB266" stop-opacity="0.7"/>
</linearGradient>
<linearGradient id="paint1_linear_4118_716" x1="16.859" y1="14.3827" x2="168.599" y2="144.356" gradientUnits="userSpaceOnUse">
<stop stop-color="#FF9730"/>
<stop offset="1" stop-color="#FFB266" stop-opacity="0.7"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -91,14 +91,13 @@ void AccountManager::onRegistrationStateChanged(const std::shared_ptr<linphone::
core->removeAccount(account);
emit mAccountModel->removeListener();
mAccountModel = nullptr;
emit logged(false);
break;
case linphone::RegistrationState::Ok:
emit mAccountModel->removeListener();
mAccountModel = nullptr;
emit logged(true);
break;
default: {
}
}
emit registrationStateChanged(state);
}

View file

@ -41,7 +41,7 @@ public:
linphone::RegistrationState state,
const std::string &message);
signals:
void logged(bool isLoggued);
void registrationStateChanged(linphone::RegistrationState state);
private:
std::shared_ptr<AccountModel> mAccountModel;

View file

@ -1,6 +1,7 @@
list(APPEND _LINPHONEAPP_SOURCES
tool/Constants.cpp
tool/Utils.cpp
tool/LinphoneEnums.cpp
tool/thread/Thread.cpp
tool/providers/ImageProvider.cpp

View file

@ -0,0 +1,35 @@
/**
* Qml template used for welcome and login/register pages
**/
import QtQuick 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2 as Control
import Linphone
Item {
id: mainItem
RowLayout {
spacing: 10
Layout.fillHeight: true
VerticalTabBar {
Layout.fillHeight: true
}
ColumnLayout {
Layout.fillHeight: true
TextInput {
fillWidth: true
placeholderText: qsTr("Rechercher un contact, appeler ou envoyer un message...")
}
Image {
//avatar
}
Button {
// color: DefaultStyle.moreButtonBackground
}
}
}
}

View file

@ -10,6 +10,7 @@ Window {
height: 641
visible: true
title: qsTr("Linphone")
property bool firstConnection: true
StackView {
id: mainWindowStackView
@ -29,6 +30,13 @@ Window {
LoginPage {
onUseSIPButtonClicked: mainWindowStackView.push(sipLoginPage)
onGoToRegister: mainWindowStackView.replace(registerPage)
onConnectionSucceed: {
if (mainWindow.firstConnection) {
mainWindowStackView.replace(securityModePage)
} else {
mainWindowStackView.replace(callPage)
}
}
}
}
Component {
@ -36,6 +44,14 @@ Window {
SIPLoginPage {
onReturnToLogin: mainWindowStackView.pop()
onGoToRegister: mainWindowStackView.replace(registerPage)
onConnectionSucceed: {
if (mainWindow.firstConnection) {
mainWindowStackView.replace(securityModePage)
} else {
mainWindowStackView.replace(callPage)
}
}
}
}
Component {
@ -53,5 +69,20 @@ Window {
onReturnToRegister: mainWindowStackView.pop()
}
}
Component {
id: securityModePage
SecurityModePage {
onModeSelected: (index) => {
var selectedMode = index == 0 ? "chiffrement" : "interoperable"
console.debug("[SelectMode]User: User selected mode " + selectedMode)
mainWindowStackView.replace(callPage)
}
}
}
Component {
id: callPage
CallPage {
}
}
}

View file

@ -2,6 +2,7 @@
list(APPEND _LINPHONEAPP_QML_FILES
view/App/Main.qml
view/App/Layout/LoginLayout.qml
view/App/Layout/OverviewLayout.qml
view/Item/Button.qml
view/Item/Carousel.qml
@ -10,11 +11,13 @@ list(APPEND _LINPHONEAPP_QML_FILES
view/Item/DigitInput.qml
view/Item/PhoneNumberComboBox.qml
view/Item/PhoneNumberInput.qml
view/Item/RadioButton.qml
view/Item/RectangleTest.qml
view/Item/TabBar.qml
view/Item/Text.qml
view/Item/TextInput.qml
view/Item/ToolTip.qml
view/Item/VerticalTabBar.qml
view/Item/Form/LoginForm.qml
@ -22,9 +25,12 @@ list(APPEND _LINPHONEAPP_QML_FILES
view/Page/Login/LoginPage.qml
view/Page/Login/RegisterPage.qml
view/Page/Login/SIPLoginPage.qml
view/Page/Login/RegisterCheckingPage.qml
view/Page/Login/SIPLoginPage.qml
view/Page/Login/SecurityModePage.qml
view/Page/Login/WelcomePage.qml
view/Page/Overview/CallPage.qml
# Prototypes
view/Prototype/PhoneNumberPrototype.qml

View file

@ -19,6 +19,12 @@ Control.Button {
: DefaultStyle.buttonBackground
radius: 24
border.color: inversedColors ? DefaultStyle.buttonBackground : DefaultStyle.buttonInversedBackground
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: hovered ? Qt.PointingHandCursor : Qt.ArrowCursor
}
}
leftPadding: 13

View file

@ -13,7 +13,7 @@ Control.CheckBox {
radius: 3
border.color: DefaultStyle.checkboxBorderColor
border.width: DefaultStyle.checkboxBorderWidth
// color: checkbox.checked ? DefaultStyle.checkboxBorderColor : "transparent"
// color: mainItem.checked ? DefaultStyle.checkboxBorderColor : "transparent"
Text {
visible: mainItem.checked

View file

@ -172,4 +172,4 @@ ColumnLayout {
}
}
}
}
}

View file

@ -3,8 +3,12 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls as Control
import Linphone
ColumnLayout {
id: mainItem
spacing: 15
signal connectionSucceed()
TextInput {
id: username
label: "Username"
@ -19,13 +23,66 @@ ColumnLayout {
textInputWidth: 250
}
Text {
id: errorText
text: "Connection has failed. Please verify your credentials"
color: DefaultStyle.errorMessageColor
opacity: 0
states: [
State{
name: "Visible"
PropertyChanges{target: errorText; opacity: 1.0}
},
State{
name:"Invisible"
PropertyChanges{target: errorText; opacity: 0.0}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
NumberAnimation {
property: "opacity"
duration: 1000
}
}
]
Timer {
id: autoHideErrorMessage
interval: 2500
onTriggered: errorText.state = "Invisible"
}
Connections {
target: LoginPageCpp
onRegistrationStateChanged: {
if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Failed) {
errorText.state = "Visible"
autoHideErrorMessage.restart()
} else if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Ok) {
mainItem.connectionSucceed()
}
}
}
}
RowLayout {
id: lastFormLineLayout
Button {
text: 'Log in'
text: "Log in"
Layout.rightMargin: 20
onClicked: {
LoginPageCpp.login(username.inputText, password.inputText);
username.errorMessage = ""
password.errorMessage = ""
if (username.inputText.length == 0 || password.inputText.length == 0) {
if (username.inputText.length == 0)
username.errorMessage = qsTr("You must enter a username")
if (password.inputText.length == 0)
password.errorMessage = qsTr("You must enter a password")
return
}
LoginPageCpp.login(username.inputText, password.inputText)
}
}
Button {

View file

@ -152,4 +152,4 @@ ColumnLayout {
}
}
}
}
}

View file

@ -74,4 +74,4 @@ ColumnLayout {
}
Layout.preferredWidth: mainItem.textInputWidth
}
}
}

View file

@ -0,0 +1,100 @@
import QtQuick 2.7
import QtQuick.Controls 2.2 as Control
import QtQuick.Layouts
import Linphone
Control.RadioButton {
id: mainItem
property bool inversedColors: false
property string title
property string contentText
property string imgUrl
hoverEnabled: true
MouseArea {
anchors.fill: parent
hoverEnabled: false
cursorShape: mainItem.hovered ? Qt.PointingHandCursor : Qt.ArrowCursor
onClicked: if (!mainItem.checked) mainItem.toggle()
}
background: Rectangle {
color: DefaultStyle.formItemBackgroundColor
border.color: mainItem.checked ? DefaultStyle.radioButtonCheckedColor : "transparent"
radius: 20
}
indicator: RowLayout {
anchors.left: parent.left
anchors.leftMargin: 13
anchors.top: parent.top
anchors.topMargin: 8
spacing: 4
Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: implicitWidth/2
border.color: mainItem.checked ? DefaultStyle.radioButtonCheckedColor : DefaultStyle.radioButtonUncheckedColor
Rectangle {
width: parent.width/2
height: parent.height/2
x: parent.width/4
y: parent.width/4
radius: width/2
color: DefaultStyle.radioButtonCheckedColor
visible: mainItem.checked
}
}
Text {
text: mainItem.title
font.bold: true
color: DefaultStyle.radioButtonTitleColor
font.pointSize: DefaultStyle.radioButtonTitleSize
}
Control.Button {
padding: 0
background: Item {
visible: false
}
contentItem: Image {
fillMode: Image.PreserveAspectFit
source: AppIcons.info
width: 2
height: 2
}
}
}
contentItem: ColumnLayout {
anchors.top: indicator.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: 13
RowLayout {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.bottomMargin: 10
Layout.rightMargin: 10
Layout.alignment: Qt.AlignVCenter
Text {
id: innerText
verticalAlignment: Text.AlignVCenter
Layout.preferredWidth: 220
Layout.preferredHeight: 100
font.pointSize: DefaultStyle.defaultTextSize
text: mainItem.contentText
Layout.fillHeight: true
}
Image {
id: image
Layout.fillHeight: true
Layout.preferredWidth: 100
Layout.preferredHeight: 100
fillMode: Image.PreserveAspectFit
source: mainItem.imgUrl
}
}
}
}

View file

@ -87,4 +87,4 @@ Control.TabBar {
}
}
}
}
}

View file

@ -0,0 +1,60 @@
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2 as Control
import Linphone
Control.TabBar {
id: mainItem
spacing: 40
property color tabBarColor: DefaultStyle.verticalTabBarColor
function appendTab(label) {
var newTab = tab.createObject(mainItem, {title: label, index: mainItem.count})
}
contentItem: ListView {
orientation: ListView.Vertical
model: mainItem.model
}
background: Item {
anchors.fill: parent
Rectangle {
id: barBG
height: 4
color: mainItem.tabBarColor
anchors.bottom: parent.bottom
width: parent.width
}
}
Component {
id: tab
Control.TabButton {
property string title
property int index
width: txtMeter. advanceWidth
background: Item {
visible: false
}
contentItem: Text {
id: tabText
anchors.fill: parent
font.bold: true
font.pointSize: DefaultStyle.tabButtonTextSize
text: txtMeter.text
bottomPadding: 5
width: txtMeter.advanceWidth
}
TextMetrics {
id: txtMeter
font: tabText.font
text: title
}
}
}
}

View file

@ -1,60 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.0
import QtQuick.Controls as Control
import Linphone
RowLayout {
Layout.alignment: Qt.AlignBottom
ColumnLayout {
FormTextInputCell {
id: username
label: "Username"
mandatory: true
textInputWidth: 250
}
FormTextInputCell {
id: password
label: "Password"
mandatory: true
hidden: true
textInputWidth: 250
}
RowLayout {
id: lastFormLineLayout
Button {
text: 'Log in'
Layout.rightMargin: 20
onClicked: {
console.debug("[LoginItem] User: Log in")
LoginPageCpp.login(username.inputText, password.inputText);
}
}
Text {
color: DefaultStyle.grayColor
text: "Forgotten password?"
font.underline: true
font.pointSize: DefaultStyle.defaultTextSize
}
}
Button {
Layout.topMargin: 40
inversedColors: true
text: "Use SIP Account"
onClicked: {
console.debug("[LoginItem] User: click use Sip")
root.useSIP()
}
}
}
Item {
Layout.fillWidth: true
}
Image {
Layout.rightMargin: 40
Layout.preferredWidth: 300
fillMode: Image.PreserveAspectFit
source: AppIcons.loginImage
}
}

View file

@ -32,7 +32,7 @@ Item {
fillMode: Image.PreserveAspectFit
source: AppIcons.info
}
onClicked: console.debug("[LoginLayout] Userr: open about popup")
onClicked: console.debug("[LoginLayout] User: open about popup")
}
Text {

View file

@ -7,6 +7,7 @@ LoginLayout {
id: mainItem
signal useSIPButtonClicked()
signal goToRegister()
signal connectionSucceed()
titleContent: RowLayout {
Image {
@ -37,18 +38,15 @@ LoginLayout {
}
}
}
centerContent: ColumnLayout {
signal useSIPButtonClicked()
Layout.alignment: Qt.AlignBottom
RowLayout {
ColumnLayout {
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
spacing: 15
LoginForm{}
LoginForm {
onConnectionSucceed: mainItem.connectionSucceed()
}
Button {
Layout.topMargin: 40
inversedColors: true

View file

@ -38,7 +38,7 @@ LoginLayout {
inversedColors: true
text: "Log in"
onClicked: {
console.debug("[LoginItem] User: return")
console.debug("[RegisterPage] User: return")
returnToLogin()
}
}

View file

@ -8,6 +8,8 @@ LoginLayout {
id: mainItem
signal returnToLogin()
signal goToRegister()
signal connectionSucceed()
titleContent: RowLayout {
Control.Button {
Layout.preferredHeight: 40
@ -19,7 +21,7 @@ LoginLayout {
color: "transparent"
}
onClicked: {
console.debug("[LoginItem] User: return")
console.debug("[SIPLoginPage] User: return")
mainItem.returnToLogin()
}
}
@ -103,7 +105,7 @@ LoginLayout {
inversedColors: true
text: "I prefer creating an account"
onClicked: {
console.debug("[LoginItem] User: click register")
console.debug("[SIPLoginPage] User: click register")
mainItem.goToRegister()
}
}
@ -148,11 +150,50 @@ LoginLayout {
ComboBox {
label: "Transport"
backgroundWidth: 250
modelList:[
{text:"TCP"},
{text:"UDP"},
{text:"TLS"}
modelList:[ "TCP", "UDP", "TLS"]
}
Text {
id: errorText
text: "Connection has failed. Please verify your credentials"
color: DefaultStyle.errorMessageColor
opacity: 0
states: [
State{
name: "Visible"
PropertyChanges{target: errorText; opacity: 1.0}
},
State{
name:"Invisible"
PropertyChanges{target: errorText; opacity: 0.0}
}
]
transitions: [
Transition {
from: "Visible"
to: "Invisible"
NumberAnimation {
property: "opacity"
duration: 1000
}
}
]
Timer {
id: autoHideErrorMessage
interval: 2500
onTriggered: errorText.state = "Invisible"
}
Connections {
target: LoginPageCpp
onRegistrationStateChanged: {
if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Failed) {
errorText.state = "Visible"
autoHideErrorMessage.restart()
} else if (LoginPageCpp.registrationState === LinphoneEnums.RegistrationState.Ok) {
mainItem.connectionSucceed()
}
}
}
}
Button {

View file

@ -0,0 +1,70 @@
import QtQuick 2.15
import QtQuick.Layouts 1.0
import QtQuick.Controls as Control
import Linphone
LoginLayout {
id: mainItem
signal modeSelected(int index)
titleContent: RowLayout {
Image {
fillMode: Image.PreserveAspectFit
source: AppIcons.profile
}
ColumnLayout {
Text {
text: qsTr("Choisir votre mode")
font.pointSize: DefaultStyle.title2FontPointSize
font.bold: true
scaleLettersFactor: 1.1
}
Text {
text: qsTr("Vous pourrez changer de mode plus tard.")
font.bold: true
scaleLettersFactor: 1.1
}
}
}
centerContent: ColumnLayout {
spacing: 80
Layout.topMargin: 70
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
RowLayout {
id: radioButtonsLayout
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
spacing: 70
Repeater {
model: [
{checked: true, title: qsTr("Chiffrement de bout en bout"), text: qsTr("Ce mode vous garanti la confidentialité de tous vos échanges. Notre technologie de chiffrement de bout en bout assure un niveau de sécurité maximal pour tous vos échanges."), imgUrl: AppIcons.chiffrement},
{checked: false, title: qsTr("Interoperable"), text: qsTr("Ce mode vous permet de profiter de toute les fonctionnalités de Linphone, toute en restant interopérable avec nimporte quelle autre service SIP."), imgUrl: AppIcons.interoperable}
]
RadioButton {
title: modelData.title
contentText: modelData.text
imgUrl: modelData.imgUrl
checked: modelData.checked
onCheckedChanged: {
if (checked) continueButton.selectedIndex = index
}
}
}
}
Button {
id: continueButton
property int selectedIndex: 0
Layout.alignment: Qt.AlignHCenter
leftPadding: 100
rightPadding: 100
text: qsTr("Continuer")
onClicked: mainItem.modeSelected(selectedIndex)
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
}
}
}

View file

@ -41,7 +41,7 @@ LoginLayout {
font.underline: true
}
onClicked: {
console.debug("[LoginItem] User: Click skip")
console.debug("[WelcomePage] User: Click skip")
mainItem.startButtonPressed()
}
}

View file

@ -0,0 +1,9 @@
import QtQuick 2.15
import QtQuick.Layouts 1.0
import QtQuick.Controls as Control
import Linphone
OverviewLayout {
id: mainItem
}

View file

@ -15,4 +15,6 @@ QtObject {
property string profile: "image://internal/user-circle.svg"
property string verif_page_image: "image://internal/verif_page_image.svg"
property string check: "image://internal/check.svg"
property string chiffrement: "image://internal/chiffrement.svg"
property string interoperable: "image://internal/interoperable.svg"
}

View file

@ -10,11 +10,15 @@ QtObject {
property color buttonInversedBackground: "white"
property color buttonPressedInversedBackground: "#fff1e8"
property color buttonTextColor: "white"
property color radioButtonCheckedColor: "#4AA8FF"
property color radioButtonUncheckedColor: "#FE5E00"
property color radioButtonTitleColor: "#070707"
property int radioButtonTextSize: 8
property int radioButtonTitleSize: 9
property color buttonInversedTextColor: "#FE5E00"
property color checkboxBorderColor: "#FE5E00"
property double checkboxBorderWidth: 2
property int buttonTextSize: 10
property int tabButtonTextSize: 11
property color carouselLightGrayColor: "#DFECF2"
property color formItemLabelColor: "#4E6074"
property int formItemLabelSize: 8
@ -24,6 +28,9 @@ QtObject {
property color formItemBorderColor: "#EDEDED"
property color formItemFocusBorderColor: "#FE5E00"
property int tabButtonTextSize: 11
property color verticalTabBarColor: "#FE5E00"
property color comboBoxHighlightColor: "#C0D1D9"
property color comboBoxHoverColor: "#6C7A87"