DailymotionComment::DailymotionComment(const QVariantMap &comment, QObject *parent) :
    CTComment(parent),
    m_request(0)
{
    setService(Resources::DAILYMOTION);
    loadComment(comment);
}
DailymotionComment::DailymotionComment(const QString &id, QObject *parent) :
    CTComment(parent),
    m_request(0)
{
    setService(Resources::DAILYMOTION);
    loadComment(id);
}
示例#3
0
void PluginTrack::loadTrack(const QString &service, const QVariantMap &track) {
    setService(service);
    setArtist(track.value("artist").toString());
    setArtistId(track.value("artistId").toString());
    setDate(track.value("date").toString());
    setDescription(track.value("description").toString());
    setDownloadable(track.value("downloadable", true).toBool());
    setFormat(track.value("format").toString());
    setGenre(track.value("genre").toString());
    setId(track.value("id").toString());
    setLargeThumbnailUrl(track.value("largeThumbnailUrl").toString());
    setPlayCount(track.value("playCount").toLongLong());
    setStreamUrl(track.value("streamUrl").toString());
    setThumbnailUrl(track.value("thumbnailUrl").toString());
    setTitle(track.value("title").toString());
    setUrl(track.value("url").toString());
        
    if (track.value("duration").type() == QVariant::String) {
        setDurationString(track.value("duration").toString());
    }
    else {
        setDuration(track.value("duration").toLongLong());
    }
    
    if (track.value("size").type() == QVariant::String) {
        setSizeString(track.value("size").toString());
    }
    else {
        setSize(track.value("size").toLongLong());
    }
}
PluginTransfer::PluginTransfer(const QString &service, QObject *parent) :
    Transfer(parent),
    m_streamsRequest(0),
    m_subtitlesRequest(0)
{
    setService(service);
}
示例#5
0
void PluginArtist::loadArtist(const QString &service, const QVariantMap &artist) {
    setService(service);
    setDescription(artist.value("description").toString());
    setId(artist.value("id").toString());
    setLargeThumbnailUrl(artist.value("largeThumbnailUrl").toString());
    setName(artist.value("name").toString());
    setThumbnailUrl(artist.value("thumbnailUrl").toString());
}
示例#6
0
bool MainWindow::search(const QString &service, const QString &query, const QString &type, const QString &order) {
    clearWindows();
    
    if (service != Settings::currentService()) {
        setService(service);
    }
    
    return QMetaObject::invokeMethod(centralWidget(), "search", Qt::QueuedConnection, Q_ARG(QString, query),
                                     Q_ARG(QString, type), Q_ARG(QString, order));
}
示例#7
0
MainWindow::MainWindow() :
    StackedWindow(),
    m_serviceModel(new ServiceModel(this)),
    m_serviceAction(new ValueSelectorAction(this)),
    m_nowPlayingAction(new NowPlayingAction(this)),
    m_playFolderAction(new QAction(tr("Play folder"), this)),
    m_queueFolderAction(new QAction(tr("Queue folder"), this)),
    m_playUrlAction(new QAction(tr("Play URL"), this)),
    m_queueUrlAction(new QAction(tr("Queue URL"), this)),
    m_transfersAction(new QAction(tr("Transfers"), this)),
    m_settingsAction(new QAction(tr("Settings"), this)),
    m_aboutAction(new QAction(tr("About"), this))
{
    m_serviceAction->setText(tr("Service"));
    m_serviceAction->setModel(m_serviceModel);
    m_serviceAction->setValue(Settings::currentService());
    
    menuBar()->addAction(m_serviceAction);
    menuBar()->addAction(m_playFolderAction);
    menuBar()->addAction(m_queueFolderAction);
    menuBar()->addAction(m_playUrlAction);
    menuBar()->addAction(m_queueUrlAction);
    menuBar()->addAction(m_transfersAction);
    menuBar()->addAction(m_settingsAction);
    menuBar()->addAction(m_aboutAction);
    menuBar()->addAction(m_nowPlayingAction);
    
    connect(m_serviceAction, SIGNAL(valueChanged(QVariant)), this, SLOT(setService(QVariant)));
    connect(m_playFolderAction, SIGNAL(triggered()), this, SLOT(playFolder()));
    connect(m_queueFolderAction, SIGNAL(triggered()), this, SLOT(queueFolder()));
    connect(m_playUrlAction, SIGNAL(triggered()), this, SLOT(playUrl()));
    connect(m_queueUrlAction, SIGNAL(triggered()), this, SLOT(queueUrl()));
    connect(m_transfersAction, SIGNAL(triggered()), this, SLOT(showTransfers()));
    connect(m_settingsAction, SIGNAL(triggered()), this, SLOT(showSettingsDialog()));
    connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(showAboutDialog()));
    connect(AudioPlayer::instance(), SIGNAL(statusChanged(AudioPlayer::Status)),
            this, SLOT(onPlayerStatusChanged(AudioPlayer::Status)));
    connect(Transfers::instance(), SIGNAL(transferAdded(Transfer*)), this, SLOT(onTransferAdded(Transfer*)));
    
    setService(Settings::currentService());
}
Application::Application(): KApplication(true)
{
	registerQMLTypes();
	setService(new Forecast::Forecast(this));
	service()->setMaxCalls(MAX_API_CALLS);
#ifdef FORECAST_API_KEY
	service()->setApiKey(FORECAST_API_KEY);
#endif
	Weather::Location::setDefaultService(service());
	Weather::Location::setAutoRefresh(AUTO_REFRESH);
	Weather::Location::setHtml(true);
}
void PluginPlaylist::loadPlaylist(const QString &service, const QVariantMap &playlist) {
    setService(service);
    setDate(playlist.value("date").toString());
    setDescription(playlist.value("description").toString());
    setId(playlist.value("id").toString());
    setLargeThumbnailUrl(playlist.value("largeThumbnailUrl").toString());
    setThumbnailUrl(playlist.value("thumbnailUrl").toString());
    setTitle(playlist.value("title").toString());
    setUserId(playlist.value("userId").toString());
    setUsername(playlist.value("username").toString());
    setVideoCount(playlist.value("videoCount").toInt());    
}
示例#10
0
bool MainWindow::showResource(const QVariantMap &resource) {
    clearWindows();
    activateWindow();
    
    const QVariant service = resource.value("service");
    
    if (service != Settings::currentService()) {
        setService(service);
    }
    
    return QMetaObject::invokeMethod(centralWidget(), "showResource", Qt::QueuedConnection,
                                     Q_ARG(QString, resource.value("type").toString()),
                                     Q_ARG(QString, resource.value("id").toString()));
}
示例#11
0
void PluginVideo::loadVideo(const QString &service, const QVariantMap &video) {
    setService(service);
    setDate(video.value("date").toString());
    setDescription(video.value("description").toString());
    setDownloadable(video.value("downloadable", true).toBool());
    setDuration(video.value("duration").toString());
    setId(video.value("id").toString());
    setLargeThumbnailUrl(video.value("largeThumbnailUrl").toString());
    setStreamUrl(video.value("streamUrl").toString());
    setThumbnailUrl(video.value("thumbnailUrl").toString());
    setTitle(video.value("title").toString());
    setUrl(video.value("url").toString());
    setUserId(video.value("userId").toString());
    setUsername(video.value("username").toString());
    setViewCount(video.value("viewCount").toLongLong());    
}
示例#12
0
/***********************************************************************
 * Factory routine -- connect to server and create remote device
 **********************************************************************/
static SoapySDR::Device *makeRemote(const SoapySDR::Kwargs &args)
{
    if (args.count(SOAPY_REMOTE_KWARG_STOP) != 0) //probably wont happen
    {
        throw std::runtime_error("SoapyRemoteDevice() -- factory loop");
    }

    if (args.count("remote") == 0)
    {
        throw std::runtime_error("SoapyRemoteDevice() -- missing URL");
    }

    auto url = SoapyURL(args.at("remote"));

    //default url parameters when not specified
    if (url.getScheme().empty()) url.setScheme("tcp");
    if (url.getService().empty()) url.setService(SOAPY_REMOTE_DEFAULT_SERVICE);

    return new SoapyRemoteDevice(url.toString(), translateArgs(args));
}
void MServiceFwBaseIf::handleServiceUnavailable(const QString &service)
{
    Q_D(MServiceFwBaseIf);
    bool noCurrentService      = d->service.isEmpty();
    bool currentServiceHasGone = (service == d->service);

    if (noCurrentService || currentServiceHasGone) {
        // get new service for this interface
        d->service = d->serviceFwProxyPtr->serviceName(d->interface);

        bool noMoreServicesForThisInterface = d->service.isEmpty();
        if (noMoreServicesForThisInterface) {
            if (!noCurrentService)
                emit serviceUnavailable(service);
        } else {
            setService(d->service);
            emit serviceChanged(d->service);
        }
    }
}
void MServiceFwBaseIf::handleServiceAvailable(const QString &service, const QString &interface)
{
    Q_D(MServiceFwBaseIf);
    bool newServiceIsForThisInterface = (interface == d->interface);
    if (newServiceIsForThisInterface) {
        QString previousService = d->service;

        // let service mappper choose which service to use
        d->service = d->serviceFwProxyPtr->serviceName(d->interface);

        bool interfaceWasDead = previousService.isEmpty();
        if (interfaceWasDead) {
            emit serviceAvailable(service);
        }

        bool serviceHasChanged = (previousService != d->service);
        if (serviceHasChanged) {
            setService(d->service);
            emit serviceChanged(d->service);
        }
    }
}
示例#15
0
文件: renderaf.cpp 项目: RISEFX/cgru
void RenderAf::v_action( Action & i_action)
{
	const JSON & operation = (*i_action.data)["operation"];
	if( operation.IsObject())
	{
		std::string type;
		af::jr_string("type", type, operation);
		if( type == "exit")
		{
			if( false == isOnline()) return;
			appendLog("Exit by " + i_action.author);
			exitClient("exit", i_action.jobs, i_action.monitors);
			return;
		}
		else if( type == "launch_cmd")
		{
			if( false == isOnline()) return;
			std::string cmd;
			if( af::jr_string("cmd", cmd, operation))
			{
				bool exit = false;
				af::jr_bool("exit", exit, operation);
				if( exit )
					appendLog("Launch command and exit request by " + i_action.author + "\n" + cmd);
				else
					appendLog("Launch command request by " + i_action.author + "\n" + cmd);
				launchAndExit( cmd, exit, i_action.jobs, i_action.monitors);
			}
			else
			{
				appendLog("Launch command exit request by " + i_action.author + "has no 'cmd'");
			}
			return;
		}
		else if( type == "eject_tasks")
		{
			if( false == isBusy()) return;
			appendLog("Task(s) ejected by " + i_action.author);
			ejectTasks( i_action.jobs, i_action.monitors, af::TaskExec::UPEject);
			return;
		}
		else if( type == "eject_tasks_keep_my")
		{
			if( false == isBusy()) return;
			appendLog("Task(s) ejected keeping own by " + i_action.author);
			ejectTasks( i_action.jobs, i_action.monitors, af::TaskExec::UPEject, &i_action.user_name);
			return;
		}
		else if( type == "delete")
		{
			if( isOnline() ) return;
			appendLog( std::string("Deleted by ") + i_action.author);
			offline( NULL, 0, i_action.monitors, true);
//AFCommon::QueueDBDelItem( this);
			return;
		}
		else if( type == "reboot")
		{
			if( false == isOnline() ) return;
			appendLog( std::string("Reboot computer by ") + i_action.author);
			exitClient("reboot", i_action.jobs, i_action.monitors);
			return;
		}
		else if( type == "shutdown")
		{
			if( false == isOnline() ) return;
			appendLog( std::string("Shutdown computer by ") + i_action.author);
			exitClient("shutdown", i_action.jobs, i_action.monitors);
			return;
		}
		else if( type == "wol_sleep")
			wolSleep( i_action.monitors);
		else if( type == "wol_wake")
			wolWake( i_action.monitors);
		else if( type == "service")
		{
			af::RegExp service_mask; bool enable;
			af::jr_regexp("name", service_mask, operation);
			af::jr_bool("enable", enable, operation);
			for (int i = 0 ; i < m_host.getServicesNum() ; ++i)
			{
				std::string service = m_host.getServiceName(i);
				if( service_mask.match( service))
					setService( service, enable);
			}
		}
		else if( type == "restore_defaults")
		{
			m_max_tasks = -1;
			m_capacity = -1;
			m_services_disabled.clear();
			disableServices(); // Dirty check exists in that function
		}
		else
		{
			appendLog("Unknown operation \"" + type + "\" by " + i_action.author);
			return;
		}
		appendLog("Operation \"" + type + "\" by " + i_action.author);
		i_action.monitors->addEvent( af::Monitor::EVT_renders_change, m_id);
		store();
		return;
	}

	const JSON & params = (*i_action.data)["params"];
	if( params.IsObject())
		jsonRead( params, &i_action.log);

	if( i_action.log.size() )
	{
		store();
		i_action.monitors->addEvent( af::Monitor::EVT_renders_change, m_id);
	}
}
DailymotionComment::DailymotionComment(QObject *parent) :
    CTComment(parent),
    m_request(0)
{
    setService(Resources::DAILYMOTION);
}
示例#17
0
/***********************************************************************
 * Discovery routine -- connect to server when key specified
 **********************************************************************/
static std::vector<SoapySDR::Kwargs> findRemote(const SoapySDR::Kwargs &args)
{
    std::vector<SoapySDR::Kwargs> result;

    if (args.count(SOAPY_REMOTE_KWARG_STOP) != 0) return result;

    //no remote specified, use the discovery protocol
    if (args.count("remote") == 0)
    {
        //On non-windows platforms the endpoint instance can last the
        //duration of the process because it can be cleaned up safely.
        //Windows has issues cleaning up threads and sockets on exit.
        #ifndef _MSC_VER
        static
        #endif //_MSC_VER
        auto ssdpEndpoint = SoapySSDPEndpoint::getInstance();

        //enable forces new search queries
        ssdpEndpoint->enablePeriodicSearch(true);

        //wait maximum timeout for replies
        std::this_thread::sleep_for(std::chrono::microseconds(SOAPY_REMOTE_SOCKET_TIMEOUT_US));

        for (const auto &url : SoapySSDPEndpoint::getInstance()->getServerURLs())
        {
            auto argsWithURL = args;
            argsWithURL["remote"] = url;
            const auto subResult = findRemote(argsWithURL);
            result.insert(result.end(), subResult.begin(), subResult.end());
        }

        return result;
    }

    //otherwise connect to a specific url and enumerate
    auto url = SoapyURL(args.at("remote"));

    //default url parameters when not specified
    if (url.getScheme().empty()) url.setScheme("tcp");
    if (url.getService().empty()) url.setService(SOAPY_REMOTE_DEFAULT_SERVICE);

    //try to connect to the remote server
    SoapySocketSession sess;
    SoapyRPCSocket s;
    int ret = s.connect(url.toString());
    if (ret != 0)
    {
        SoapySDR::logf(SOAPY_SDR_ERROR, "SoapyRemote::find() -- connect(%s) FAIL: %s", url.toString().c_str(), s.lastErrorMsg());
        return result;
    }

    //find transaction
    try
    {
        SoapyLogAcceptor logAcceptor(url.toString(), s);

        SoapyRPCPacker packer(s);
        packer & SOAPY_REMOTE_FIND;
        packer & translateArgs(args);
        packer();
        SoapyRPCUnpacker unpacker(s);
        unpacker & result;

        //graceful disconnect
        SoapyRPCPacker packerHangup(s);
        packerHangup & SOAPY_REMOTE_HANGUP;
        packerHangup();
        SoapyRPCUnpacker unpackerHangup(s);
    }
    catch (const std::exception &ex)
    {
        SoapySDR::logf(SOAPY_SDR_ERROR, "SoapyRemote::find() -- transact FAIL: %s", ex.what());
    }

    //remove instances of the stop key from the result
    for (auto &resultArgs : result)
    {
        resultArgs.erase(SOAPY_REMOTE_KWARG_STOP);
        if (resultArgs.count("driver") != 0)
        {
            resultArgs["remote:driver"] = resultArgs.at("driver");
            resultArgs.erase("driver");
        }
        if (resultArgs.count("type") != 0)
        {
            resultArgs["remote:type"] = resultArgs.at("type");
            resultArgs.erase("type");
        }
        resultArgs["remote"] = url.toString();
    }

    return result;
}
示例#18
0
MainWindowModel::MainWindowModel()
{
    setStatusInfo(QString());
    setRemoteService(false);
    setService(QString());
}
示例#19
0
void MainWindowModel::setRemoteService(bool rs, const QString& srv)
{
    m_bRemoteService = rs;

    setService(srv);
}
int MoinLelaRequest::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 28)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 28;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = logged(); break;
        case 1: *reinterpret_cast< bool*>(_v) = active(); break;
        case 2: *reinterpret_cast< bb::cascades::DataModel**>(_v) = model(); break;
        case 3: *reinterpret_cast< QString*>(_v) = budget(); break;
        case 4: *reinterpret_cast< QString*>(_v) = service(); break;
        case 5: *reinterpret_cast< QString*>(_v) = quality(); break;
        case 6: *reinterpret_cast< QString*>(_v) = privacy(); break;
        case 7: *reinterpret_cast< QString*>(_v) = ambience(); break;
        case 8: *reinterpret_cast< QString*>(_v) = itemName(); break;
        case 9: *reinterpret_cast< QString*>(_v) = itemLabel(); break;
        case 10: *reinterpret_cast< QString*>(_v) = itemCountry(); break;
        case 11: *reinterpret_cast< QString*>(_v) = itemRegion(); break;
        case 12: *reinterpret_cast< QString*>(_v) = itemZipcode(); break;
        case 13: *reinterpret_cast< QString*>(_v) = itemTown(); break;
        case 14: *reinterpret_cast< QString*>(_v) = itemAddress(); break;
        case 15: *reinterpret_cast< QString*>(_v) = itemPhone(); break;
        case 16: *reinterpret_cast< QString*>(_v) = itemMobile(); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 3: setBudget(*reinterpret_cast< QString*>(_v)); break;
        case 4: setService(*reinterpret_cast< QString*>(_v)); break;
        case 5: setQuality(*reinterpret_cast< QString*>(_v)); break;
        case 6: setPrivacy(*reinterpret_cast< QString*>(_v)); break;
        case 7: setAmbience(*reinterpret_cast< QString*>(_v)); break;
        case 8: setItemName(*reinterpret_cast< QString*>(_v)); break;
        case 9: setItemLabel(*reinterpret_cast< QString*>(_v)); break;
        case 10: setItemCountry(*reinterpret_cast< QString*>(_v)); break;
        case 11: setItemRegion(*reinterpret_cast< QString*>(_v)); break;
        case 12: setItemZipcode(*reinterpret_cast< QString*>(_v)); break;
        case 13: setItemTown(*reinterpret_cast< QString*>(_v)); break;
        case 14: setItemAddress(*reinterpret_cast< QString*>(_v)); break;
        case 15: setItemPhone(*reinterpret_cast< QString*>(_v)); break;
        case 16: setItemMobile(*reinterpret_cast< QString*>(_v)); break;
        }
        _id -= 17;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 17;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 17;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}