Exemple #1
0
SearchPage::SearchPage(QWidget *p)
    : QWidget(p)
    , state(-1)
    , model(this)
    , proxy(this)
{
    setupUi(this);
    addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction);
    replacePlayQueue->setDefaultAction(StdActions::self()->replacePlayQueueAction);
    locateAction=new Action(Icon("edit-find"), i18n("Locate In Library"), this);
    view->allowTableView(new SearchTableView(view));
    view->addAction(StdActions::self()->addToPlayQueueAction);
    view->addAction(StdActions::self()->replacePlayQueueAction);
    view->addAction(StdActions::self()->addWithPriorityAction);
    view->addAction(StdActions::self()->addToStoredPlaylistAction);
    #ifdef TAGLIB_FOUND
    #ifdef ENABLE_DEVICES_SUPPORT
    view->addAction(StdActions::self()->copyToDeviceAction);
    #endif
    #endif // TAGLIB_FOUND
    view->addAction(locateAction);

    connect(this, SIGNAL(add(const QStringList &, bool, quint8)), MPDConnection::self(), SLOT(add(const QStringList &, bool, quint8)));
    connect(this, SIGNAL(addSongsToPlaylist(const QString &, const QStringList &)), MPDConnection::self(), SLOT(addToPlaylist(const QString &, const QStringList &)));
    connect(&model, SIGNAL(searching()), view, SLOT(showSpinner()));
    connect(&model, SIGNAL(searched()), view, SLOT(hideSpinner()));
    connect(&model, SIGNAL(statsUpdated(int, quint32)), this, SLOT(statsUpdated(int, quint32)));
    connect(view, SIGNAL(itemsSelected(bool)), this, SLOT(controlActions()));
    connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
    connect(view, SIGNAL(searchItems()), this, SLOT(searchItems()));
    connect(MPDConnection::self(), SIGNAL(stateChanged(bool)), this, SLOT(setSearchCategories()));
    connect(locateAction, SIGNAL(triggered()), SLOT(locateSongs()));
    proxy.setSourceModel(&model);
    view->setModel(&proxy);
    view->setMode(ItemView::Mode_List);
    view->setPermanentSearch();
    setSearchCategories();
    view->setSearchCategory(Settings::self()->searchCategory());
    statsUpdated(0, 0);
}
Exemple #2
0
        std::vector<T> const get_values_of(std::string const& parameter_name) const{
            std::vector<T> return_values;
            std::map<std::string, std::pair<unsigned, std::pair<bool, std::vector<std::string> > > >::const_iterator searched(values_.find(parameter_name));

            if (searched != values_.end()) {
                if (searched->second.first) {
                    for (std::vector<std::string>::const_iterator it(searched->second.second.second.begin()); it != searched->second.second.second.end(); ++it) {
                        std::stringstream sstr(*it);
                        T new_value;
                        sstr >> new_value;
                        return_values.push_back(new_value);
                    }
                } else {
                    std::cout << "WARNING: parameter \""<< parameter_name << "\" has not been set! Returnig default value..."<<std::endl;
                }
            } else {
Exemple #3
0
        ////////////////////////////////////////////////////////////////////////
        ///\brief Checks whether a given parameter is set.
        ///
        /// This sets checks wheter the parsed char buffer contained the given
        /// parameter.
        ///
        ///\param parameter_name The name of the parameter to be checked.
        ////////////////////////////////////////////////////////////////////////
        bool is_set(std::string const& parameter_name) const{
            std::map<std::string, std::pair<unsigned, std::pair<bool, std::vector<std::string> > > >::const_iterator searched(values_.find(parameter_name));
            if (searched != values_.end())
                return !searched->second.second.second.empty();

            std::cout << "ERROR: parameter \""<< parameter_name << "\" has not been added to the list of possible parameters! Returnig default value..."<<std::endl;
            return false;
        }