Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
J
jami-client-windows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
savoirfairelinux
jami-client-windows
Commits
0280dca7
Commit
0280dca7
authored
Mar 20, 2019
by
Ming Rui Zhang
Committed by
Andreas Traczyk
Apr 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
newwizardwidget: add create SIP account Page
Change-Id: I2b29023891075c63e398bd218a980e8d4f7bf71f
parent
2311f488
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
893 additions
and
70 deletions
+893
-70
newwizardwidget.cpp
newwizardwidget.cpp
+90
-35
newwizardwidget.h
newwizardwidget.h
+6
-5
newwizardwidget.ui
newwizardwidget.ui
+780
-10
stylesheet.css
stylesheet.css
+17
-20
No files found.
newwizardwidget.cpp
View file @
0280dca7
...
...
@@ -169,6 +169,12 @@ NewWizardWidget::on_newAccountButton_clicked()
changePage
(
ui
->
createRingAccountPage
);
}
void
NewWizardWidget
::
on_newSIPAccountButton_clicked
()
{
changePage
(
ui
->
createRingSIPAccountPage
);
}
void
NewWizardWidget
::
changePage
(
QWidget
*
toPage
)
{
if
(
toPage
==
ui
->
spinnerPage
)
{
...
...
@@ -194,6 +200,16 @@ void NewWizardWidget::changePage(QWidget* toPage)
this
,
&
NewWizardWidget
::
slotRegisteredNameFound
);
validateWizardProgression
();
ui
->
setAvatarWidget
->
startBooth
();
}
else
if
(
toPage
==
ui
->
createRingSIPAccountPage
)
{
ui
->
SIPusernameEdit
->
clear
();
ui
->
SIPpasswordEdit
->
clear
();
ui
->
SIPservernameEdit
->
clear
();
ui
->
SIPproxyEdit
->
clear
();
ui
->
SIPfullNameEdit
->
setText
(
QString
());
ui
->
SIPusernameEdit
->
setEnabled
(
true
);
setNavBarVisibility
(
true
);
ui
->
nextButton
->
setEnabled
(
true
);
ui
->
setSIPAvatarWidget
->
startBooth
();
}
else
if
(
toPage
==
ui
->
linkRingAccountPage
)
{
fileToImport_
=
QString
(
""
);
ui
->
fileImportBtn
->
setText
(
tr
(
"(None)"
));
...
...
@@ -238,9 +254,12 @@ NewWizardWidget::on_nextButton_clicked()
if
(
curWidget
==
ui
->
createRingAccountPage
)
{
wizardMode_
=
WizardMode
::
CREATE
;
processWizardInformations
();
}
if
(
curWidget
==
ui
->
linkRingAccountPage
)
{
}
else
if
(
curWidget
==
ui
->
linkRingAccountPage
)
{
wizardMode_
=
WizardMode
::
IMPORT
;
processWizardInformations
();
}
else
if
(
curWidget
==
ui
->
createRingSIPAccountPage
)
{
wizardMode_
=
WizardMode
::
CREATESIP
;
processWizardInformations
();
}
}
...
...
@@ -248,12 +267,13 @@ void
NewWizardWidget
::
on_previousButton_clicked
()
{
const
QWidget
*
curWidget
=
ui
->
stackedWidget
->
currentWidget
();
ui
->
setAvatarWidget
->
stopBooth
();
if
(
curWidget
==
ui
->
createRingAccountPage
)
{
ui
->
setAvatarWidget
->
stopBooth
();
}
if
(
curWidget
==
ui
->
createRingSIPAccountPage
)
{
ui
->
setSIPAvatarWidget
->
stopBooth
();
}
disconnect
(
registeredNameFoundConnection_
);
lookupStatusLabel_
->
hide
();
passwordStatusLabel_
->
hide
();
if
(
curWidget
==
ui
->
createRingAccountPage
||
curWidget
==
ui
->
linkRingAccountPage
)
{
curWidget
==
ui
->
linkRingAccountPage
||
curWidget
==
ui
->
createRingSIPAccountPage
)
{
changePage
(
ui
->
welcomePage
);
}
}
...
...
@@ -379,66 +399,88 @@ NewWizardWidget::validateWizardProgression()
void
NewWizardWidget
::
processWizardInformations
()
{
QString
alias
,
password
,
archivePin
;
inputPara_
.
clear
();
switch
(
wizardMode_
)
{
case
WizardMode
::
CREATE
:
ui
->
progressLabel
->
setText
(
tr
(
"Generating your Jami account..."
));
alias
=
ui
->
fullNameEdit
->
text
();
password
=
ui
->
passwordEdit
->
text
();
inputPara_
[
"alias"
]
=
ui
->
fullNameEdit
->
text
();
inputPara_
[
"password"
]
=
ui
->
passwordEdit
->
text
();
ui
->
fullNameEdit
->
clear
();
ui
->
passwordEdit
->
clear
();
ui
->
confirmPasswordEdit
->
clear
();
break
;
case
WizardMode
::
IMPORT
:
ui
->
progressLabel
->
setText
(
tr
(
"Importing account archive..."
));
password
=
ui
->
importPasswordEdit
->
text
();
archivePin
=
ui
->
pinEdit
->
text
();
inputPara_
[
"password"
]
=
ui
->
importPasswordEdit
->
text
();
inputPara_
[
"archivePin"
]
=
ui
->
pinEdit
->
text
();
ui
->
pinEdit
->
clear
();
ui
->
importPasswordEdit
->
clear
();
break
;
case
WizardMode
::
MIGRATE
:
ui
->
progressLabel
->
setText
(
tr
(
"Migrating your Jami account..."
));
break
;
case
WizardMode
::
CREATESIP
:
ui
->
progressLabel
->
setText
(
tr
(
"Generating your SIP account..."
));
if
(
ui
->
SIPfullNameEdit
->
text
().
isEmpty
())
{
inputPara_
[
"alias"
]
=
"SIP"
;
}
else
{
inputPara_
[
"alias"
]
=
ui
->
SIPfullNameEdit
->
text
();
}
inputPara_
[
"hostname"
]
=
ui
->
SIPservernameEdit
->
text
();
inputPara_
[
"username"
]
=
ui
->
SIPusernameEdit
->
text
();
inputPara_
[
"password"
]
=
ui
->
SIPpasswordEdit
->
text
();
inputPara_
[
"proxy"
]
=
ui
->
SIPproxyEdit
->
text
();
break
;
}
inputPara_
[
"archivePath"
]
=
fileToImport_
;
if
(
inputPara_
.
find
(
"archivePin"
)
==
inputPara_
.
end
())
{
inputPara_
[
"archivePin"
]
=
""
;
}
changePage
(
ui
->
spinnerPage
);
create
RingAccount
(
alias
,
password
,
archivePin
,
fileToImport_
);
create
Account
(
);
Utils
::
CreateStartupLink
();
}
void
NewWizardWidget
::
createRingAccount
(
const
QString
&
displayName
,
const
QString
&
password
,
const
QString
&
pin
,
const
QString
&
archivePath
)
NewWizardWidget
::
createAccount
()
{
bool
isRing
=
wizardMode_
==
WizardMode
::
CREATE
||
wizardMode_
==
WizardMode
::
IMPORT
;
Utils
::
oneShotConnect
(
&
LRCInstance
::
accountModel
(),
&
lrc
::
api
::
NewAccountModel
::
accountAdded
,
[
this
](
const
std
::
string
&
accountId
)
{
[
this
,
isRing
](
const
std
::
string
&
accountId
)
{
//set default ringtone
auto
confProps
=
LRCInstance
::
accountModel
().
getAccountConfig
(
accountId
);
if
(
confProps
.
username
.
empty
())
return
;
confProps
.
Ringtone
.
ringtonePath
=
Utils
::
GetRingtonePath
().
toStdString
();
if
(
!
isRing
)
{
// set SIP details
confProps
.
hostname
=
inputPara_
[
"hostname"
].
toStdString
();
confProps
.
username
=
inputPara_
[
"username"
].
toStdString
();
confProps
.
password
=
inputPara_
[
"password"
].
toStdString
();
confProps
.
proxyServer
=
inputPara_
[
"proxy"
].
toStdString
();
}
LRCInstance
::
accountModel
().
setAccountConfig
(
accountId
,
confProps
);
connect
(
LRCInstance
::
editableAccountModel
(),
&
lrc
::
api
::
NewAccountModel
::
nameRegistrationEnded
,
[
this
]
{
// RING SPECIFIC
if
(
isRing
)
{
connect
(
LRCInstance
::
editableAccountModel
(),
&
lrc
::
api
::
NewAccountModel
::
nameRegistrationEnded
,
[
this
]
{
lrc
::
api
::
account
::
ConfProperties_t
accountProperties
=
LRCInstance
::
accountModel
().
getAccountConfig
(
LRCInstance
::
getCurrAccId
());
LRCInstance
::
accountModel
().
setAccountConfig
(
LRCInstance
::
getCurrAccId
(),
accountProperties
);
emit
NavigationRequested
(
ScreenEnum
::
CallScreen
);
emit
LRCInstance
::
instance
().
accountOnBoarded
();
});
LRCInstance
::
editableAccountModel
()
->
registerName
(
LRCInstance
::
getCurrAccId
(),
""
,
registeredName_
.
toStdString
()
);
if
(
ui
->
setAvatarWidget
->
hasAvatar
())
{
LRCInstance
::
editableAccountModel
()
->
registerName
(
LRCInstance
::
getCurrAccId
(),
""
,
registeredName_
.
toStdString
()
);
}
// END RING SPECIFIC
if
(
ui
->
setSIPAvatarWidget
->
hasAvatar
()
&&
wizardMode_
==
WizardMode
::
CREATESIP
)
{
LRCInstance
::
setCurrAccAvatar
(
ui
->
setSIPAvatarWidget
->
getAvatarPixmap
());
}
else
if
(
ui
->
setAvatarWidget
->
hasAvatar
()
&&
wizardMode_
==
WizardMode
::
CREATE
)
{
LRCInstance
::
setCurrAccAvatar
(
ui
->
setAvatarWidget
->
getAvatarPixmap
());
}
});
});
Utils
::
oneShotConnect
(
&
LRCInstance
::
accountModel
(),
&
lrc
::
api
::
NewAccountModel
::
accountRemoved
,
[
this
](
const
std
::
string
&
accountId
)
{
Q_UNUSED
(
accountId
);
...
...
@@ -452,15 +494,28 @@ NewWizardWidget::createRingAccount(const QString &displayName,
reportFailure
();
});
QtConcurrent
::
run
(
[
=
]
{
LRCInstance
::
accountModel
().
createNewAccount
(
lrc
::
api
::
profile
::
Type
::
RING
,
displayName
.
toStdString
(),
archivePath
.
toStdString
(),
password
.
toStdString
(),
pin
.
toStdString
()
);
});
[
this
,
isRing
]
{
if
(
isRing
)
{
LRCInstance
::
accountModel
().
createNewAccount
(
lrc
::
api
::
profile
::
Type
::
RING
,
inputPara_
[
"alias"
].
toStdString
(),
inputPara_
[
"archivePath"
].
toStdString
(),
inputPara_
[
"password"
].
toStdString
(),
inputPara_
[
"archivePin"
].
toStdString
()
);
}
else
{
LRCInstance
::
accountModel
().
createNewAccount
(
lrc
::
api
::
profile
::
Type
::
SIP
,
inputPara_
[
"alias"
].
toStdString
(),
inputPara_
[
"archivePath"
].
toStdString
(),
""
,
""
,
inputPara_
[
"username"
].
toStdString
()
);
QThread
::
sleep
(
2
);
emit
NavigationRequested
(
ScreenEnum
::
CallScreen
);
}
});
changePage
(
ui
->
spinnerPage
);
repaint
();
}
...
...
@@ -480,4 +535,4 @@ NewWizardWidget::reportFailure()
ui
->
progressLabel
->
setStyleSheet
(
""
);
ui
->
spinnerLabel
->
setMovie
(
creationSpinnerMovie_
);
});
}
\ No newline at end of file
}
newwizardwidget.h
View file @
0280dca7
...
...
@@ -20,6 +20,7 @@
#include <QLabel>
#include <QtConcurrent/QtConcurrent>
#include <map>
#include "lrcinstance.h"
#include "navwidget.h"
...
...
@@ -38,7 +39,7 @@ public:
using
AccountInfo
=
Info
;
enum
WizardMode
{
CREATE
,
IMPORT
,
MIGRATE
};
enum
WizardMode
{
CREATE
,
IMPORT
,
MIGRATE
,
CREATESIP
};
private:
enum
NameRegistrationUIState
{
BLANK
,
INVALID
,
TAKEN
,
FREE
,
SEARCHING
};
...
...
@@ -55,6 +56,8 @@ public:
//UI Slots
private
slots
:
void
on_newSIPAccountButton_clicked
();
void
on_existingPushButton_clicked
();
void
on_newAccountButton_clicked
();
void
on_nextButton_clicked
();
...
...
@@ -90,15 +93,13 @@ private:
QMetaObject
::
Connection
registeredNameFoundConnection_
;
QString
fileToImport_
;
QLabel
*
passwordStatusLabel_
;
std
::
map
<
std
::
string
,
QString
>
inputPara_
;
void
updateNameRegistrationUi
(
NameRegistrationUIState
state
);
void
changePage
(
QWidget
*
toPage
);
void
setNavBarVisibility
(
bool
visible
,
bool
back
=
false
);
void
validateWizardProgression
();
void
createRingAccount
(
const
QString
&
displayName
=
QString
(),
const
QString
&
password
=
QString
(),
const
QString
&
pin
=
QString
(),
const
QString
&
archivePath
=
QString
());
void
createAccount
();
void
reportFailure
();
void
processWizardInformations
();
};
newwizardwidget.ui
View file @
0280dca7
This diff is collapsed.
Click to expand it.
stylesheet.css
View file @
0280dca7
...
...
@@ -309,12 +309,11 @@ QDialog#DeleteAccountDialog {
QPushButton
#nextButton
,
QPushButton
#playButton
,
QPushButton
#clearHistoryButton
,
QPushButton
#doTransferButton
,
QPushButton
#photoButton
,
QPushButton
#existingPushButton
,
QPushButton
#newAccountButton
,
QPushButton
#previousButton
,
QPushButton
#exportButton
,
QPushButton
#existingPushButton
,
QPushButton
#newAccountButton
,
QPushButton
#previousButton
,
QPushButton
#exportButton
,
QPushButton
#newSIPAccountButton
,
QPushButton
#cancelAddButton
,
QPushButton
#exportOnRingButton
,
QPushButton
#addDeviceButton
,
QPushButton
#exportEndedOkButton
,
QPushButton
#errorPushButton
,
QPushButton
#registerButton
,
QPushButton
#acceptCRButton
,
QPushButton
#discardCRButton
,
QPushButton
#deleteCancelBtn
,
QPushButton
#dhtImportBtn
,
QPushButton
#fileImportBtn
,
QPushButton
#changePassBtn
,
QPushButton
#confirmChangeBtn
,
QPushButton
#backButton
{
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#109ede
,
stop
:
1.0
#2b5084
);
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#109ede
,
stop
:
1.0
#2b5084
);
border
:
0px
;
border-radius
:
15px
;
height
:
30px
;
...
...
@@ -322,17 +321,17 @@ QPushButton#dhtImportBtn, QPushButton#fileImportBtn, QPushButton#changePassBtn,
font
:
14px
;
}
QPushButton
#nextButton
:disabled
,
QPushButton
#playButton
:disabled
,
QPushButton
#clearHistoryButton
:disabled
,
QPushButton
#doTransferButton
:disabled
,
QPushButton
#photoButton
:disabled
,
QPushButton
#existingPushButton
:disabled
,
QPushButton
#newAccountButton
:disabled
,
QPushButton
#previous
Button
:disabled
,
QPushButton
#exportButton
:disabled
,
QPushButton
#cancelAddButton
:disabled
,
QPushButton
#exportOnRingButton
:disabled
,
QPushButton
#addDeviceButton
:disabled
,
QPushButton
#exportEndedOkButton
:disabled
,
QPushButton
#errorPushButton
:disabled
,
QPushButton
#registerButton
:disabled
,
QPushButton
#acceptCRButton
:disabled
,
QPushButton
#discardCRButton
:disabled
,
QPushButton
#deleteCancelBtn
:disabled
,
QPushButton
#dhtImportBtn
:disabled
,
QPushButton
#fileImportBtn
:disabled
,
QPushButton
#changePassBtn
:disabled
,
QPushButton
#confirmChangeBtn
:disabled
,
QPushButton
#backButton
:disabled
{
background
:
rgba
(
242
,
242
,
242
,
0.8
);
color
:
grey
;
}
QPushButton
#nextButton
:disabled
,
QPushButton
#playButton
:disabled
,
QPushButton
#clearHistoryButton
:disabled
,
QPushButton
#doTransferButton
:disabled
,
QPushButton
#photoButton
:disabled
,
QPushButton
#existingPushButton
:disabled
,
QPushButton
#newAccountButton
:disabled
,
QPushButton
#previousButton
:disabled
,
QPushButton
#newSIPAccount
Button
:disabled
,
QPushButton
#exportButton
:disabled
,
QPushButton
#cancelAddButton
:disabled
,
QPushButton
#exportOnRingButton
:disabled
,
QPushButton
#addDeviceButton
:disabled
,
QPushButton
#exportEndedOkButton
:disabled
,
QPushButton
#errorPushButton
:disabled
,
QPushButton
#registerButton
:disabled
,
QPushButton
#acceptCRButton
:disabled
,
QPushButton
#discardCRButton
:disabled
,
QPushButton
#deleteCancelBtn
:disabled
,
QPushButton
#dhtImportBtn
:disabled
,
QPushButton
#fileImportBtn
:disabled
,
QPushButton
#changePassBtn
:disabled
,
QPushButton
#confirmChangeBtn
:disabled
,
QPushButton
#backButton
:disabled
{
background
:
rgba
(
242
,
242
,
242
,
0.8
);
color
:
grey
;
}
QPushButton
#blockCRButton
,
QPushButton
#debanButton
,
QPushButton
#deleteBanBtn
,
QPushButton
#cancelChangeBtn
{
...
...
@@ -344,14 +343,13 @@ QPushButton#cancelChangeBtn {
QPushButton
#nextButton
:hover
,
QPushButton
#playButton
:hover
,
QPushButton
#clearHistoryButton
:hover
,
QPushButton
#doTransferButton
:hover
,
QPushButton
#photoButton
:hover
,
QPushButton
#existingPushButton
:hover
,
QPushButton
#newAccountButton
:hover
,
QPushButton
#previousButton
:hover
,
QPushButton
#existingPushButton
:hover
,
QPushButton
#newAccountButton
:hover
,
QPushButton
#previousButton
:hover
,
QPushButton
#newSIPAccountButton
:hover
,
QPushButton
#exportButton
:hover
,
QPushButton
#cancelAddButton
:hover
,
QPushButton
#exportOnRingButton
:hover
,
QPushButton
#addDeviceButton
:hover
,
QPushButton
#exportEndedOkButton
:hover
,
QPushButton
#errorPushButton
:hover
,
QPushButton
#registerButton
:hover
,
QPushButton
#acceptCRButton
:hover
,
QPushButton
#discardCRButton
:hover
,
QPushButton
#deleteCancelBtn
:hover
,
QPushButton
#dhtImportBtn
:hover
,
QPushButton
#fileImportBtn
:hover
,
QPushButton
#changePassBtn
:hover
,
QPushButton
#confirmChangeBtn
:hover
,
QPushButton
#backButton
:hover
{
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#2b4b7e
,
stop
:
1.0
#001d4d
);
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#2b4b7e
,
stop
:
1.0
#001d4d
);
color
:
white
;
}
...
...
@@ -362,14 +360,13 @@ QPushButton#deleteButton:hover, QPushButton#deleteBanBtn:hover, QPushButton#canc
QPushButton
#nextButton
:pressed
,
QPushButton
#playButton
:pressed
,
QPushButton
#clearHistoryButton
:pressed
,
QPushButton
#doTransferButton
:pressed
,
QPushButton
#photoButton
:pressed
,
QPushButton
#existingPushButton
:pressed
,
QPushButton
#newAccountButton
:pressed
,
QPushButton
#previousButton
:pressed
,
QPushButton
#existingPushButton
:pressed
,
QPushButton
#newAccountButton
:pressed
,
QPushButton
#previousButton
:pressed
,
QPushButton
#newSIPAccountButton
:pressed
,
QPushButton
#exportButton
:pressed
,
QPushButton
#cancelAddButton
:pressed
,
QPushButton
#exportOnRingButton
:pressed
,
QPushButton
#addDeviceButton
:pressed
,
QPushButton
#exportEndedOkButton
:pressed
,
QPushButton
#errorPushButton
:pressed
,
QPushButton
#registerButton
:pressed
,
QPushButton
#acceptCRButton
:pressed
,
QPushButton
#discardCRButton
:pressed
,
QPushButton
#deleteCancelBtn
:pressed
,
QPushButton
#dhtImportBtn
:pressed
,
QPushButton
#fileImportBtn
:pressed
,
QPushButton
#changePassBtn
:pressed
,
QPushButton
#confirmChangeBtn
:pressed
,
QPushButton
#backButton
:pressed
{
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#043161
,
stop
:
1.0
#00113f
);
background
:
qlineargradient
(
x1
:
0
,
y1
:
0
,
x2
:
1
,
y2
:
0
,
stop
:
0
#043161
,
stop
:
1.0
#00113f
);
color
:
white
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment