Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
7aadfa9e
Commit
7aadfa9e
authored
9 years ago
by
Edric Milaret
Committed by
Alexandre Lision
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix ringtone model path
Tuleap:
#339
Change-Id: I71783ee048bde01b4696752fe651801fa33478b2
parent
0c8ce959
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/localringtonecollection.cpp
+6
-5
6 additions, 5 deletions
src/localringtonecollection.cpp
src/ringtone.cpp
+4
-3
4 additions, 3 deletions
src/ringtone.cpp
src/ringtone.h
+2
-2
2 additions, 2 deletions
src/ringtone.h
src/ringtonemodel.cpp
+9
-11
9 additions, 11 deletions
src/ringtonemodel.cpp
with
21 additions
and
21 deletions
src/localringtonecollection.cpp
+
6
−
5
View file @
7aadfa9e
...
...
@@ -120,15 +120,16 @@ bool LocalRingtoneCollection::load()
#elif defined(Q_OS_WIN)
QDir
ringtonesDir
(
QFileInfo
(
QCoreApplication
::
applicationFilePath
()).
path
()
+
"/ringtones/"
);
#elif defined(Q_OS_OSX)
QDir
ringtonesDir
(
QFileInfo
(
QCoreApplication
::
applicationFilePath
()).
path
()
+
"/ringtones/"
);
//FIXME
QDir
ringtonesDir
(
QCoreApplication
::
applicationDirPath
());
ringtonesDir
.
cdUp
();
ringtonesDir
.
cd
(
"Resources/ringtones/"
);
#endif
if
(
!
ringtonesDir
.
exists
())
return
true
;
const
QStringList
entries
=
ringtonesDir
.
entryList
({
"*.wav"
,
"*.ul"
,
"*.au"
,
".mp3"
,
".flac"
},
QDir
::
Files
);
const
QStringList
entries
=
ringtonesDir
.
entryList
({
"*.wav"
,
"*.ul"
,
"*.au"
,
"*.flac"
},
QDir
::
Files
);
for
(
const
QString
&
item
:
entries
)
{
QFileInfo
fileinfo
(
ringtonesDir
.
absolutePath
()
+
item
);
QFileInfo
fileinfo
(
ringtonesDir
.
absolutePath
()
+
"/"
+
item
);
Ringtone
*
info
=
new
Ringtone
();
info
->
setPath
(
fileinfo
.
absoluteFilePath
());
info
->
setName
(
item
);
...
...
@@ -270,7 +271,7 @@ void Serializable::RingtoneNode::read(const QJsonObject &json)
void
Serializable
::
RingtoneNode
::
write
(
QJsonObject
&
json
)
{
json
[
"path"
]
=
ringtone
->
path
()
.
path
()
;
json
[
"path"
]
=
ringtone
->
path
();
json
[
"name"
]
=
ringtone
->
name
();
}
...
...
This diff is collapsed.
Click to expand it.
src/ringtone.cpp
+
4
−
3
View file @
7aadfa9e
...
...
@@ -19,6 +19,7 @@
//Qt
#include
<QtCore/QUrl>
#include
<QtCore/QDir>
class
RingtonePrivate
{
...
...
@@ -44,7 +45,7 @@ Ringtone::~Ringtone()
delete
d_ptr
;
}
Q
Url
Ringtone
::
path
()
const
Q
String
Ringtone
::
path
()
const
{
return
d_ptr
->
m_Path
;
}
...
...
@@ -55,9 +56,9 @@ QString Ringtone::name() const
}
void
Ringtone
::
setPath
(
const
Q
Url
&
url
)
void
Ringtone
::
setPath
(
const
Q
String
&
path
)
{
d_ptr
->
m_Path
=
url
.
path
(
);
d_ptr
->
m_Path
=
QDir
::
toNativeSeparators
(
path
);
}
void
Ringtone
::
setName
(
const
QString
&
name
)
...
...
This diff is collapsed.
Click to expand it.
src/ringtone.h
+
2
−
2
View file @
7aadfa9e
...
...
@@ -30,12 +30,12 @@ public:
virtual
~
Ringtone
();
//Getter
Q
Url
path
()
const
;
Q
String
path
()
const
;
QString
name
()
const
;
bool
isPlaying
()
const
;
//Setter
void
setPath
(
const
Q
Url
&
url
);
void
setPath
(
const
Q
String
&
path
);
void
setName
(
const
QString
&
name
);
void
setIsPlaying
(
const
bool
value
);
...
...
This diff is collapsed.
Click to expand it.
src/ringtonemodel.cpp
+
9
−
11
View file @
7aadfa9e
...
...
@@ -71,8 +71,6 @@ RingtoneModel::RingtoneModel(QObject* parent)
,
CollectionManagerInterface
<
Ringtone
>
(
this
)
,
d_ptr
(
new
RingtoneModelPrivate
(
this
))
{
// ConfigurationManagerInterface& configurationManager = ConfigurationManager::instance();
d_ptr
->
m_pCollection
=
addCollection
<
LocalRingtoneCollection
>
();
}
...
...
@@ -175,10 +173,10 @@ int RingtoneModelPrivate::currentIndex(Account* a) const
const
QString
rt
=
a
->
ringtonePath
();
for
(
int
i
=
0
;
i
<
m_lRingtone
.
size
();
i
++
)
{
Ringtone
*
info
=
m_lRingtone
[
i
];
if
(
info
->
path
()
.
path
()
==
rt
)
if
(
info
->
path
()
==
rt
)
return
i
;
}
return
-
1
;
return
0
;
}
QItemSelectionModel
*
RingtoneModel
::
selectionModel
(
Account
*
a
)
const
...
...
@@ -189,7 +187,7 @@ QItemSelectionModel* RingtoneModel::selectionModel(Account* a) const
connect
(
d_ptr
->
m_hSelectionModels
[
a
],
&
QItemSelectionModel
::
currentChanged
,
[
a
,
this
](
const
QModelIndex
&
idx
)
{
if
(
idx
.
isValid
())
{
a
->
setRingtonePath
(
d_ptr
->
m_lRingtone
[
idx
.
row
()]
->
path
()
.
path
()
);
a
->
setRingtonePath
(
d_ptr
->
m_lRingtone
[
idx
.
row
()]
->
path
());
}
});
...
...
@@ -207,7 +205,7 @@ void RingtoneModel::play(const QModelIndex& idx)
return
;
}
CallManagerInterface
&
callManager
=
CallManager
::
instance
();
Q_NOREPLY
callManager
.
startRecordedFilePlayback
(
info
->
path
()
.
path
()
);
Q_NOREPLY
callManager
.
startRecordedFilePlayback
(
info
->
path
());
if
(
!
d_ptr
->
m_pTimer
)
{
d_ptr
->
m_pTimer
=
new
QTimer
(
this
);
d_ptr
->
m_pTimer
->
setInterval
(
10000
);
...
...
@@ -227,7 +225,7 @@ void RingtoneModelPrivate::slotStopTimer()
{
if
(
m_pCurrent
)
{
CallManagerInterface
&
callManager
=
CallManager
::
instance
();
callManager
.
stopRecordedFilePlayback
(
m_pCurrent
->
path
()
.
path
()
);
callManager
.
stopRecordedFilePlayback
(
m_pCurrent
->
path
());
m_pCurrent
->
setIsPlaying
(
false
);
const
QModelIndex
&
idx
=
q_ptr
->
index
(
m_lRingtone
.
indexOf
(
m_pCurrent
),
0
);
emit
q_ptr
->
dataChanged
(
idx
,
q_ptr
->
index
(
idx
.
row
(),
1
));
...
...
@@ -248,12 +246,12 @@ bool RingtoneModel::addItemCallback(const Ringtone* item)
d_ptr
->
m_lRingtone
<<
const_cast
<
Ringtone
*>
(
item
);
endInsertRows
();
if
(
Account
*
a
=
d_ptr
->
m_hPendingSelection
[
item
])
{
if
(
auto
a
=
d_ptr
->
m_hPendingSelection
[
item
])
{
if
(
auto
sm
=
d_ptr
->
m_hSelectionModels
[
a
])
sm
->
setCurrentIndex
(
index
(
rowCount
()
-
1
,
0
),
QItemSelectionModel
::
ClearAndSelect
);
else
a
->
setRingtonePath
(
item
->
path
()
.
path
()
);
a
->
setRingtonePath
(
item
->
path
());
d_ptr
->
m_hPendingSelection
[
item
]
=
nullptr
;
}
...
...
@@ -270,8 +268,8 @@ bool RingtoneModel::removeItemCallback(const Ringtone* item)
bool
RingtoneModel
::
add
(
const
QUrl
&
path
,
Account
*
autoSelect
)
{
auto
r
=
new
Ringtone
(
this
);
r
->
setPath
(
path
);
r
->
setName
(
QFile
(
path
.
path
()).
fileName
());
r
->
setPath
(
path
.
toLocalFile
()
);
r
->
setName
(
QFile
(
path
.
toLocalFile
()).
fileName
());
if
(
autoSelect
)
d_ptr
->
m_hPendingSelection
[
r
]
=
autoSelect
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment