SearchCommand

Stores search parameters and search results.

Synopsis:

#include <qplayer/qplayer.h>

namespace QPlayer {

    class SearchCommand : public BaseCommand
    {
        Q_OBJECT

    public:

        explicit SearchCommand( int mediaSourceId, 
                                QString searchTerm, 
                                QString filter = "", 
                                int limit = -1, 
                                int offset = 0 );
    
        inline QList< MediaNode > result()
        {
            return m_result;
        }
    
        inline void setResult( QList< MediaNode > result )
        {
            m_result = result;
        }
    
        int mediaSourceId() const;

        QString searchTerm() const;

        QString filter() const;

        int limit() const;

        int offset() const;
    
    signals:

        void complete( SearchCommand *command );
    
        void error( SearchCommand *command );
    
    };

}

Library:

libqplayer

Description:

Stores search parameters and search results. The results are returned in a single media node, which you must browse to view individual media nodes found to have metadata matching the search parameters. This design allows clients to create tracksessions containing all the results of a search operation by providing the ID of the media node returned by that operation to a CreateTrackSessionCommand object.

When creating a SearchCommand object, you must provide a search string and the ID of the media source that you want to search. A media node is added to the results if one of its metadata fields has a value matching the search string. You can specify which fields to examine; by default, the underlying player examines all metadata fields. You can also specify a limit on how many nodes can be stored in the results as well as the offset to start searching from within the root folder of the media source.

When the underlying player has finished searching the media source, the object emits a complete signal to notify clients that the search results can now be read. Clients can then call the result() method to retrieve the media node containing the search results, which they can browse to read information about individual media nodes matching the search parameters.

If the search() command fails, the object emits an error signal. You can then call errorMessage() to retrieve a QString describing the error.