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
3ea594a0
Commit
3ea594a0
authored
Jun 17, 2015
by
Edric Milaret
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
settings: bump serializer and add hideLabel
Refs #75422 Change-Id: Ie2a329d147370ea5bdd790193ef52d9e2cb2464d
parent
bd0baf8b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
174 additions
and
57 deletions
+174
-57
accountdetails.ui
accountdetails.ui
+69
-1
accountserializationadapter.cpp
accountserializationadapter.cpp
+105
-56
No files found.
accountdetails.ui
View file @
3ea594a0
...
...
@@ -68,6 +68,9 @@
<property
name=
"text"
>
<string>
Alias
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_alias
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
...
...
@@ -78,6 +81,9 @@
<property
name=
"text"
>
<string>
Hash
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_username
</cstring>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
...
...
@@ -135,6 +141,9 @@
<property
name=
"text"
>
<string>
Hostname
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_hostname
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
...
...
@@ -145,6 +154,9 @@
<property
name=
"text"
>
<string>
Username
</string>
</property>
<property
name=
"buddy"
>
<cstring>
usernameEdit
</cstring>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
...
...
@@ -155,6 +167,9 @@
<property
name=
"text"
>
<string>
Password
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_password
</cstring>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
...
...
@@ -169,6 +184,9 @@
<property
name=
"text"
>
<string>
Proxy
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_proxy
</cstring>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
...
...
@@ -179,6 +197,9 @@
<property
name=
"text"
>
<string>
Voicemail number
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_mailbox
</cstring>
</property>
</widget>
</item>
<item
row=
"4"
column=
"1"
>
...
...
@@ -431,6 +452,9 @@
<property
name=
"text"
>
<string>
Registration expire timeout (seconds):
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_registrationExpire
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
...
...
@@ -465,6 +489,9 @@
<property
name=
"text"
>
<string>
Local Port:
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_localPort
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
...
...
@@ -556,6 +583,9 @@
<property
name=
"text"
>
<string>
Adress
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_publishedAddress
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -576,6 +606,9 @@
<property
name=
"text"
>
<string>
Port
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_publishedPort
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -702,6 +735,9 @@
<property
name=
"text"
>
<string>
Min
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_audioPortMin
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -722,6 +758,9 @@
<property
name=
"text"
>
<string>
Max
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_audioPortMax
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -778,6 +817,9 @@
<property
name=
"text"
>
<string>
Min
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_videoPortMin
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -798,6 +840,9 @@
<property
name=
"text"
>
<string>
Max
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_videoPortMax
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -862,6 +907,9 @@
<property
name=
"text"
>
<string>
Key exchange protocol
</string>
</property>
<property
name=
"buddy"
>
<cstring>
keyExchangeModelCombo
</cstring>
</property>
</widget>
</item>
<item>
...
...
@@ -910,6 +958,9 @@
<property
name=
"text"
>
<string>
CA certificate
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsCaListCertificate
</cstring>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
...
...
@@ -917,6 +968,9 @@
<property
name=
"text"
>
<string>
User certificate
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsCertificate
</cstring>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
...
...
@@ -924,6 +978,9 @@
<property
name=
"text"
>
<string>
Private key
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsPrivateKeyCertificate
</cstring>
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
>
...
...
@@ -931,6 +988,9 @@
<property
name=
"text"
>
<string>
Private key password
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsPassword
</cstring>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
>
...
...
@@ -938,6 +998,9 @@
<property
name=
"text"
>
<string>
TLS protocol method
</string>
</property>
<property
name=
"buddy"
>
<cstring>
tlsProtocoCombo
</cstring>
</property>
</widget>
</item>
<item
row=
"5"
column=
"0"
>
...
...
@@ -945,6 +1008,9 @@
<property
name=
"text"
>
<string>
Outgoing TLS server name
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsServerName
</cstring>
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
...
...
@@ -952,6 +1018,9 @@
<property
name=
"text"
>
<string>
Negotiation timeout (seconds)
</string>
</property>
<property
name=
"buddy"
>
<cstring>
lrcfg_tlsNegotiationTimeoutSec
</cstring>
</property>
</widget>
</item>
<item
row=
"3"
column=
"1"
>
...
...
@@ -1413,6 +1482,5 @@
<buttongroups>
<buttongroup
name=
"publishGroup"
/>
<buttongroup
name=
"dtmfGroup"
/>
<buttongroup
name=
"cipherGroup"
/>
</buttongroups>
</ui>
accountserializationadapter.cpp
View file @
3ea594a0
...
...
@@ -21,7 +21,10 @@
#include <QtWidgets/QLayout>
#include <QtWidgets/QLineEdit>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QGroupBox>
#include <QtWidgets/QFormLayout>
#include <QtWidgets/QAbstractButton>
#include <QtWidgets/QLabel>
#include <account.h>
#include <accountmodel.h>
...
...
@@ -49,62 +52,94 @@ static void avoidDuplicate(QWidget* w)
/**
* This check for some supported widgets and bind the widgets and property
*/
static
void
setupWidget
(
QWidget
*
w
,
Account
*
a
,
const
QHash
<
QByteArray
,
int
>&
roles
)
static
void
setupWidget
(
QWidget
*
w
,
Account
*
a
,
const
QHash
<
QByteArray
,
int
>&
roles
)
{
if
(
w
->
objectName
().
left
(
LRC_CFG_LEN
)
==
LRC_CFG
)
{
const
QByteArray
prop
=
w
->
objectName
().
mid
(
LRC_CFG_LEN
,
999
).
toLatin1
();
if
(
roles
.
contains
(
prop
))
{
const
int
role
=
roles
[
prop
];
auto
roleState
=
a
->
roleState
(
static_cast
<
Account
::
Role
>
(
role
));
if
(
roleState
==
Account
::
RoleState
::
READ_WRITE
||
roleState
==
Account
::
RoleState
::
READ_ONLY
)
{
if
(
qobject_cast
<
QLineEdit
*>
(
w
))
{
QLineEdit
*
le
=
qobject_cast
<
QLineEdit
*>
(
w
);
avoidDuplicate
(
le
);
le
->
setText
(
a
->
roleData
(
role
).
toString
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
le
,
&
QLineEdit
::
textChanged
,
[
a
,
role
](
const
QString
&
text
)
{
if
(
a
->
roleData
(
role
)
!=
text
)
a
->
setRoleData
(
role
,
text
);
})
};
le
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
}
else
if
(
qobject_cast
<
QSpinBox
*>
(
w
))
{
QSpinBox
*
sb
=
qobject_cast
<
QSpinBox
*>
(
w
);
avoidDuplicate
(
sb
);
sb
->
setValue
(
a
->
roleData
(
role
).
toInt
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
sb
,
static_cast
<
void
(
QSpinBox
::*
)
(
int
)
>
(
&
QSpinBox
::
valueChanged
),
[
a
,
role
](
int
value
)
{
if
(
a
->
roleData
(
role
).
toInt
()
!=
value
)
a
->
setRoleData
(
role
,
value
);
})
};
sb
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
if
(
qobject_cast
<
QLineEdit
*>
(
w
))
{
QLineEdit
*
le
=
qobject_cast
<
QLineEdit
*>
(
w
);
avoidDuplicate
(
le
);
le
->
setText
(
a
->
roleData
(
role
).
toString
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
le
,
&
QLineEdit
::
textChanged
,
[
a
,
role
](
const
QString
&
text
)
{
if
(
a
->
roleData
(
role
)
!=
text
)
a
->
setRoleData
(
role
,
text
);
})
};
le
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
}
else
if
(
qobject_cast
<
QSpinBox
*>
(
w
))
{
QSpinBox
*
sb
=
qobject_cast
<
QSpinBox
*>
(
w
);
avoidDuplicate
(
sb
);
sb
->
setValue
(
a
->
roleData
(
role
).
toInt
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
sb
,
static_cast
<
void
(
QSpinBox
::*
)(
int
)
>
(
&
QSpinBox
::
valueChanged
),
[
a
,
role
](
int
value
)
{
if
(
a
->
roleData
(
role
).
toInt
()
!=
value
)
a
->
setRoleData
(
role
,
value
);
})
};
sb
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
}
else
if
(
qobject_cast
<
QAbstractButton
*>
(
w
))
{
//QCheckBox, QRadioButton, QToolButton, QPushButton
QAbstractButton
*
b
=
qobject_cast
<
QAbstractButton
*>
(
w
);
avoidDuplicate
(
b
);
b
->
setChecked
(
a
->
roleData
(
role
).
toBool
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
b
,
&
QAbstractButton
::
toggled
,[
a
,
role
](
bool
c
)
{
if
(
a
->
roleData
(
role
).
toBool
()
!=
c
)
a
->
setRoleData
(
role
,
c
);
})
};
b
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
}
else
if
(
qobject_cast
<
QGroupBox
*>
(
w
))
{
QGroupBox
*
b
=
qobject_cast
<
QGroupBox
*>
(
w
);
avoidDuplicate
(
b
);
b
->
setChecked
(
a
->
roleData
(
role
).
toBool
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
b
,
&
QGroupBox
::
toggled
,[
a
,
role
](
bool
c
)
{
if
(
a
->
roleData
(
role
).
toBool
()
!=
c
)
a
->
setRoleData
(
role
,
c
);
})
};
b
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
}
else
{
qDebug
()
<<
"Unsupported widget type"
<<
w
;
}
//Check if the field is required for this account type
if
(
a
->
roleState
((
Account
::
Role
)
role
)
==
Account
::
RoleState
::
UNAVAILABLE
)
{
w
->
setProperty
(
"lrcfgVisible"
,
w
->
isVisible
()
?
2
:
1
);
w
->
setVisible
(
false
);
QFormLayout
*
fm
=
qobject_cast
<
QFormLayout
*>
(
w
->
parentWidget
()
->
layout
());
//There is many of corner case here, this only handle the one that's
//created by Qt Designer
if
(
!
fm
)
{
QLayoutItem
*
il
=
w
->
parentWidget
()
->
layout
()
->
itemAt
(
0
);
if
(
il
&&
il
->
layout
())
fm
=
qobject_cast
<
QFormLayout
*>
(
il
->
layout
());
}
else
if
(
qobject_cast
<
QAbstractButton
*>
(
w
))
{
//QCheckBox, QRadioButton, QToolButton, QPushButton
QAbstractButton
*
b
=
qobject_cast
<
QAbstractButton
*>
(
w
);
avoidDuplicate
(
b
);
b
->
setChecked
(
a
->
roleData
(
role
).
toBool
());
ConnHolder
*
c
=
new
ConnHolder
{
QObject
::
connect
(
b
,
&
QAbstractButton
::
toggled
,
[
a
,
role
](
bool
c
)
{
if
(
a
->
roleData
(
role
).
toBool
()
!=
c
)
a
->
setRoleData
(
role
,
c
);
})
};
b
->
setProperty
(
"lrcfgConn"
,
QVariant
::
fromValue
(
c
));
if
(
fm
)
{
QWidget
*
buddy
=
fm
->
labelForField
(
w
);
qDebug
()
<<
"BUDDY "
<<
buddy
;
if
(
buddy
)
buddy
->
setVisible
(
false
);
}
w
->
setVisible
(
true
);
w
->
setEnabled
(
roleState
==
Account
::
RoleState
::
READ_WRITE
);
}
else
{
w
->
setVisible
(
false
);
}
else
{
//0 = unset, 1=invisible, 2=visible
const
int
oldVisibleState
=
w
->
property
(
"lrcfgVisible"
).
toInt
();
if
(
oldVisibleState
)
w
->
setVisible
(
oldVisibleState
-
1
);
}
}
else
{
...
...
@@ -120,9 +155,7 @@ static void clearConnections(QWidget* w)
}
}
static
void
drill
(
QWidget
*
w
,
Account
*
a
,
const
QHash
<
QByteArray
,
int
>&
roles
,
bool
clear
=
false
)
static
void
drill
(
QWidget
*
w
,
Account
*
a
,
const
QHash
<
QByteArray
,
int
>&
roles
,
bool
clear
=
false
)
{
for
(
QObject
*
object
:
w
->
children
())
{
if
(
!
object
->
isWidgetType
())
...
...
@@ -138,9 +171,22 @@ static void drill(QWidget* w, Account* a,
}
}
AccountSerializationAdapter
::
AccountSerializationAdapter
(
Account
*
a
,
QWidget
*
w
)
:
QObject
(
w
)
static
void
hideLabel
(
QWidget
*
w
)
{
for
(
QObject
*
object
:
w
->
children
())
{
if
(
!
object
->
isWidgetType
())
continue
;
QWidget
*
w2
=
qobject_cast
<
QWidget
*>
(
object
);
if
(
w2
)
{
QLabel
*
l
=
qobject_cast
<
QLabel
*>
(
w2
);
if
(
l
&&
l
->
buddy
())
{
l
->
setVisible
(
!
l
->
buddy
()
->
isHidden
());
}
}
hideLabel
(
w2
);
}
}
AccountSerializationAdapter
::
AccountSerializationAdapter
(
Account
*
a
,
QWidget
*
w
)
:
QObject
(
w
)
{
static
QHash
<
QByteArray
,
int
>
reverse
;
if
(
reverse
.
isEmpty
())
{
...
...
@@ -151,7 +197,10 @@ AccountSerializationAdapter::AccountSerializationAdapter(Account* a,
}
drill
(
w
,
a
,
reverse
);
hideLabel
(
w
);
}
AccountSerializationAdapter
::~
AccountSerializationAdapter
()
{}
{
}
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