[vlc-devel] [PATCH 4/4] Qt GUI: use callback to fetch cloud directory.

Paweł Wegner pawel.wegner95 at gmail.com
Wed Oct 19 19:55:21 CEST 2016


Here is how it looks like:​
 Screenshot from 2016-09-10 15-52-24.png
<https://drive.google.com/file/d/0B6EoXZNf-QgTNVE5QmEtOU5JSEk/view?usp=drive_web>
​

2016-10-19 19:50 GMT+02:00 Paweł Wegner <pawel.wegner95 at gmail.com>:

> ---
>  modules/gui/qt/components/open_panels.cpp | 29
> +++++++++++++++++++++++++----
>  1 file changed, 25 insertions(+), 4 deletions(-)
>
> diff --git a/modules/gui/qt/components/open_panels.cpp
> b/modules/gui/qt/components/open_panels.cpp
> index 2232dbe..db118e9 100644
> --- a/modules/gui/qt/components/open_panels.cpp
> +++ b/modules/gui/qt/components/open_panels.cpp
> @@ -1433,6 +1433,29 @@ public:
>      {
>      }
>  };
> +
> +class CloudListDirectoryCallback : public cloudstorage::IListDirectoryCallback
> {
> +public:
> +    CloudListDirectoryCallback(DirectoryModel* model) : model(model)
> +    {
> +    }
> +
> +    void receivedItem(IItem::Pointer item) override
> +    {
> +        model->addItem(item);
> +    }
> +
> +    void done(const std::vector<IItem::Pointer>&) override
> +    {
> +    }
> +
> +    void error(const std::string&) override
> +    {
> +    }
> +
> +private:
> +    DirectoryModel* model;
> +};
>  } // namespace
>
>  CloudOpenPanel::CloudOpenPanel( QWidget *parent, intf_thread_t *t ) :
> @@ -1535,11 +1558,9 @@ void CloudOpenPanel::itemClicked(const
> QModelIndex& index)
>  void CloudOpenPanel::listDirectory()
>  {
>      directoryModel.clear();
> +    std::unique_ptr<CloudListDirectoryCallback> callback(new
> CloudListDirectoryCallback(&directoryModel));
>      listDirectoryRequest = currentProvider->listDirectoryAsync(
> currentDirectory,
> -
>  [this](const std::vector<cloudstorage::IItem::Pointer>& d) {
> -        for (auto i : d)
> -            directoryModel.addItem(i);
> -    });
> +
>  std::move(callback));
>  }
>
>  void CloudOpenPanel::updateMRL()
> --
> 2.9.3
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20161019/56c10791/attachment.html>


More information about the vlc-devel mailing list