Exemplo n.º 1
0
	void SummaryWidget::SetQuery (QStringList query)
	{
		if (query.isEmpty ())
			return;

		SearchWidget_->GetFilterLine ()->setText (query.takeFirst ());

		if (!query.isEmpty ())
			SearchWidget_->SelectCategories (query);

		feedFilterParameters ();

		emit tabRecoverDataChanged ();
	}
Exemplo n.º 2
0
	void PhotosTab::handleAccountChosen (int idx)
	{
		auto accVar = AccountsBox_->itemData (idx, AccountsManager::Role::AccountObj);
		auto accObj = accVar.value<QObject*> ();
		auto acc = qobject_cast<IAccount*> (accObj);
		if (acc == CurAcc_)
			return;

		if (CurAccObj_)
			disconnect (CurAccObj_,
					0,
					this,
					0);

		CurAccObj_ = accObj;
		CurAcc_ = acc;

		connect (CurAccObj_,
				SIGNAL (doneUpdating ()),
				this,
				SLOT (handleAccDoneUpdating ()));

		CurAcc_->UpdateCollections ();

		auto model = CurAcc_->GetCollectionsModel ();

		if (auto sel = Ui_.CollectionsTree_->selectionModel ())
			disconnect (sel,
					SIGNAL (currentRowChanged (QModelIndex, QModelIndex)),
					this,
					SLOT (handleRowChanged (QModelIndex)));
		Ui_.CollectionsTree_->setModel (model);
		connect (Ui_.CollectionsTree_->selectionModel (),
				SIGNAL (currentRowChanged (QModelIndex, QModelIndex)),
				this,
				SLOT (handleRowChanged (QModelIndex)));

		ProxyModel_->SetCurrentAccount (CurAccObj_);
		ProxyModel_->setSourceModel (model);

		ImagesView_->rootContext ()->setContextProperty ("collRootIndex", QVariant::fromValue (QModelIndex ()));
		HandleCollectionSelected ({});

		UploadAction_->setEnabled (qobject_cast<ISupportUploads*> (CurAccObj_));

		emit tabRecoverDataChanged ();
	}
Exemplo n.º 3
0
	void PhotosTab::HandleCollectionSelected (const QModelIndex& index)
	{
		auto rootCtx = ImagesView_->rootContext ();
		if (!rootCtx->contextProperty ("listingMode").toBool ())
		{
			QMetaObject::invokeMethod (ImagesView_->rootObject (),
					"showImage",
					Q_ARG (QVariant, QUrl ()));

			rootCtx->setContextProperty ("listingMode", true);
		}

		rootCtx->setContextProperty ("collRootIndex", QVariant::fromValue (index));

		SelectedID_.clear ();
		SelectedCollection_ = index.data (CollectionRole::ID).toString ();

		emit tabRecoverDataChanged ();
	}
Exemplo n.º 4
0
	void ArtistBrowserTab::on_ArtistNameEdit__returnPressed ()
	{
		auto provs = Core::Instance ().GetProxy ()->GetPluginsManager ()->
				GetAllCastableTo<Media::IArtistBioFetcher*> ();
		if (provs.isEmpty ())
		{
			QMessageBox::critical (this,
					"LeechCraft",
					tr ("There aren't any plugins that can fetch biography. Check if "
						"you have installed for example the LastFMScrobble plugin."));
			return;
		}

		auto artist = Ui_.ArtistNameEdit_->text ().trimmed ();

		BioMgr_->Request (provs.first (), artist);
		SimilarMgr_->DefaultRequest (artist);

		emit tabRecoverDataChanged ();
	}