Пример #1
0
	void FinalPage::initializePage ()
	{
		auto wiz = qobject_cast<ReportWizard*> (wizard ());

		QString title;
		QString desc;
		const auto type = wiz->GetReportTypePage ()->GetReportType ();
		switch (type)
		{
		case ReportTypePage::Type::Bug:
			title = wiz->GetBugReportPage ()->GetTitle ();
			desc = wiz->GetBugReportPage ()->GetText ();
			break;
		case ReportTypePage::Type::Feature:
			title = wiz->GetFRPage ()->GetTitle ();
			desc = wiz->GetFRPage ()->GetText ();
			break;
		}

		const auto& data = XMLGenerator ().CreateIssue (title, desc, ReportTypePage::Type::Bug);
		auto reply = wiz->PostRequest ("/issues.xml", data);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
	}
void WebPageManager::requestCreated(QByteArray &url, QNetworkReply *reply) {
  logger() << "Started request to" << url;
  if (reply->isFinished())
    replyFinished(reply);
  else {
    connect(reply, SIGNAL(finished()), SLOT(handleReplyFinished()));
  }
}
Пример #3
0
	void StreamListFetcherBase::Request (const QNetworkRequest& req)
	{
		auto reply = NAM_->get (req);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
	}
	void PendingRecommendedArtists::request ()
	{
		QList<QPair<QString, QString>> params;
		params << QPair<QString, QString> ("limit", QString::number (NumGet_));
		auto reply = Request ("user.getRecommendedArtists", NAM_, params);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleReplyError ()));
	}
Пример #5
0
	void WebPageSslWatcher::handleReplyCreated (QNetworkAccessManager::Operation,
			const QNetworkRequest& req, QNetworkReply *reply)
	{
		if (!CheckReplyFrame (req.originatingObject (), Page_->mainFrame ()))
			return;

		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (sslErrors (QList<QSslError>)),
				this,
				SLOT (handleSslErrors (QList<QSslError>)));
	}
Пример #6
0
	PendingSimilarArtists::PendingSimilarArtists (const QString& name, int num, QObject *parent)
	: QObject (parent)
	, SourceName_ (name)
	, NumGet_ (num)
	, InfosWaiting_ (0)
	{
		auto reply = lastfm::Artist (name).getSimilar ();
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleReplyError ()));
	}
	RecentReleasesFetcher::RecentReleasesFetcher (bool withRecs, int num, QNetworkAccessManager *nam, QObject *parent)
	: QObject (parent)
	, MaxNum_ (num)
	{
		const auto& user = XmlSettingsManager::Instance ()
				.property ("lastfm.login").toString ();
		QList<QPair<QString, QString>> params;
		params << QPair<QString, QString> ("user", user);
		params << QPair<QString, QString> ("userecs", withRecs ? "1" : "0");
		auto reply = Request ("user.getNewReleases", nam, params);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleReplyError ()));
	}
	PendingSimilarArtists::PendingSimilarArtists (const QString& name,
			int num, QNetworkAccessManager *nam, QObject *parent)
	: BaseSimilarArtists (name, num, parent)
	, NAM_ (nam)
	{
		QMap<QString, QString> params;
		params ["artist"] = name;
		params ["autocorrect"] = "1";
		params ["limit"] = QString::number (num);
		auto reply = Request ("artist.getSimilar", nam, params);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleReplyError ()));
	}
void WebPageManager::handleReplyFinished() {
  QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender());
  disconnect(reply, SIGNAL(finished()), this, SLOT(handleReplyFinished()));
  replyFinished(reply);
}
Пример #10
0
	ConcreteSite::ConcreteSite (const Media::LyricsQuery& query,
			const ConcreteSiteDesc& desc, ICoreProxy_ptr proxy, QObject *parent)
	: QObject (parent)
	, Query_ (query)
	, Desc_ (desc)
	{
		auto replace = [this] (QString str) -> QString
		{
			for (const auto& c : Desc_.Replacements_.keys ())
				str.replace (c, Desc_.Replacements_ [c]);
			return str;
		};

		const auto& artist = replace (query.Artist_.toLower ());
		const auto& album = replace (query.Album_.toLower ());
		const auto& title = replace (query.Title_.toLower ());

		auto urlStr = Desc_.URLTemplate_;
		urlStr.replace ("{artist}", artist);
		urlStr.replace ("{album}", album);
		urlStr.replace ("{title}", title);
		if (!artist.isEmpty ())
			urlStr.replace ("{a}", artist.at (0).toLower ());

		auto cap = [] (QString str) -> QString
		{
			if (!str.isEmpty ())
				str [0] = str [0].toUpper ();
			return str;
		};
		urlStr.replace ("{Artist}", cap (artist));
		urlStr.replace ("{Album}", cap (album));
		urlStr.replace ("{Title}", cap (title));

#ifdef QT_DEBUG
		qDebug () << Q_FUNC_INFO
				<< "requesting"
				<< urlStr
				<< "from"
				<< Desc_.Name_
				<< "for"
				<< artist
				<< album
				<< title;
#endif

		auto nam = proxy->GetNetworkAccessManager ();

		QUrl url { urlStr };
		QNetworkRequest req { url };

		url.setPath ({});
#if QT_VERSION < 0x050000
		url.setQueryItems ({});
#else
		url.setQuery ({});
#endif
		req.setRawHeader ("Referer", url.toString ().toUtf8 ());

		auto reply = nam->get (req);
		connect (reply,
				SIGNAL (finished ()),
				this,
				SLOT (handleReplyFinished ()));
		connect (reply,
				SIGNAL (error (QNetworkReply::NetworkError)),
				this,
				SLOT (handleReplyError ()));
	}