[vlc-devel] [PATCH] qt: fix missing return value in ChapterModel

Abel Tesfaye abeltesfaye45 at gmail.com
Fri Jun 14 17:38:44 CEST 2019


if the first patch's name is "qt: fix missing return value in
ChapterModel", what should the second one be called?

On Fri, 14 Jun 2019 at 18:37, Abel Tesfaye <abeltesfaye45 at gmail.com> wrote:

>
>
> On Fri, 14 Jun 2019 at 18:33, Hugo Beauzée-Luyssen <hugo at beauzee.fr>
> wrote:
>
>> On Fri, Jun 14, 2019, at 5:30 PM, Hugo Beauzée-Luyssen wrote:
>> > On Fri, Jun 14, 2019, at 5:27 PM, Abel Tesfaye wrote:
>> > > From: Abel Tesfaye <Abeltesfaye45 at gmail.com>
>> > >
>> > > ---
>> > >  modules/gui/qt/util/input_models.cpp | 23 ++++++++++++-----------
>> > >  1 file changed, 12 insertions(+), 11 deletions(-)
>> > >
>> > > diff --git a/modules/gui/qt/util/input_models.cpp
>> > > b/modules/gui/qt/util/input_models.cpp
>> > > index 918f93193d..6b0a0b8bf1 100644
>> > > --- a/modules/gui/qt/util/input_models.cpp
>> > > +++ b/modules/gui/qt/util/input_models.cpp
>> > > @@ -346,24 +346,25 @@ void ChapterListModel::resetTitle(const
>> > > vlc_player_title *newTitle)
>> > >
>> > >  QString ChapterListModel::getNameAtPosition(float pos) const
>> > >  {
>> > > -    if(m_title == nullptr)
>> > > -        return qtr("nothing found");
>> > > +    if(m_title != nullptr){
>> > >
>> > > -    vlc_tick_t posTime = pos * m_title->length;
>> > > -    int prevChapterIndex = 0;
>> > > +        vlc_tick_t posTime = pos * m_title->length;
>> > > +        int prevChapterIndex = 0;
>> > >
>> > > -    for(unsigned int i=0;i<m_title->chapter_count;i++){
>> > > +        for(unsigned int i=0;i<m_title->chapter_count;i++){
>> > >
>> > > -        vlc_tick_t currentChapterTime = m_title->chapters[i].time;
>> > > +            vlc_tick_t currentChapterTime =
>> m_title->chapters[i].time;
>> > >
>> > > -        if(currentChapterTime > posTime)
>> > > -           return qfu(m_title->chapters[prevChapterIndex].name);
>> > > +            if(currentChapterTime > posTime)
>> > > +                return qfu(m_title->chapters[prevChapterIndex].name);
>> > >
>> > > -        else if(i == (m_title->chapter_count - 1))
>> > > -            return qfu(m_title->chapters[i].name);
>> > > +            else if(i == (m_title->chapter_count - 1))
>> > > +                return qfu(m_title->chapters[i].name);
>> > >
>> > > -        prevChapterIndex = i;
>> > > +            prevChapterIndex = i;
>> > > +        }
>> > >      }
>> > > +    return QString();
>> > >  }
>> > >
>> > >  //***************************
>> >
>> > Hi,
>> >
>> > Could you split the patch in 2, one for the actual change, and one for
>> > the indentation fix? That eases up reading tge change quite a lot :)
>>
>
> Sure, i'll send the two patches now
>
>
>> >
>>
>> That being said, in this specific case, wouldn't it be simpler to just
>> add a return QString{} at the bottom of the function? (I'm not entirely
>> sure we need a translatable string for that error)
>>
>
> the "nothing found" error was removed in this patch
>
>
>>
>> --
>>   Hugo Beauzée-Luyssen
>>   hugo at beauzee.fr
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190614/a3e6808b/attachment.html>


More information about the vlc-devel mailing list