Пример #1
0
void CoverWidget::setEnabled(bool e)
{
    if (e) {
        connect(CurrentCover::self(), SIGNAL(coverImage(QImage)), this, SLOT(coverImage(QImage)));
        coverImage(QImage());
    } else {
        label->deletePix();
        disconnect(CurrentCover::self(), SIGNAL(coverImage(QImage)), this, SLOT(coverImage(QImage)));
    }
    setVisible(e);
    label->setEnabled(e);
}
Пример #2
0
void FBReaderNode::drawCoverReal(ZLPaintContext &context, int vOffset) {
	shared_ptr<const ZLImage> cover = coverImage();
	if (cover.isNull()) {
		return;
	}

	shared_ptr<ZLImageData> coverData = ZLImageManager::Instance().imageData(*cover);
	if (coverData.isNull()) {
		return;
	}

	const FBTextStyle &style = FBTextStyle::Instance();
	const int unit = unitSize(context, style);
	const int h = unit * 9 / 2, w = h * 3 / 4;
	vOffset += unit / 2;
	const int hOffset = level() * unit * 3 - unit * 2;

	const int origWidth = context.imageWidth(*coverData);
	const int origHeight = context.imageHeight(*coverData);
	if (origWidth == 0 || origHeight == 0) {
		return;
	}

	int coeff = std::min(w / origWidth, h / origHeight);
	if (coeff == 0) {
		coeff = 1;
	}
	int width = coeff * origWidth;
	int height = coeff * origHeight;
	if (width > w || height > h) {
		width = context.imageWidth(*coverData, w, h, ZLPaintContext::SCALE_REDUCE_SIZE);
		height = context.imageHeight(*coverData, w, h, ZLPaintContext::SCALE_REDUCE_SIZE);
	}
	context.drawImage(hOffset + (w - width) / 2, vOffset + (h + height) / 2, *coverData, width, height, ZLPaintContext::SCALE_FIT_TO_SIZE);
}
Пример #3
0
PlayQueueView::PlayQueueView(QWidget *parent)
    : QStackedWidget(parent)
    , mode(ItemView::Mode_Count)
    , groupedView(0)
    , treeView(0)
    , spinner(0)
    , msgOverlay(0)
    , backgroundImageType(BI_None)
    , fadeValue(1.0)
    , backgroundOpacity(15)
    , backgroundBlur(0)
{
    removeFromAction = new Action(Icon("list-remove"), i18n("Remove"), this);
    setMode(ItemView::Mode_GroupedTree);
    animator.setPropertyName("fade");
    animator.setTargetObject(this);
    connect(CurrentCover::self(), SIGNAL(coverImage(QImage)), this, SLOT(setImage(QImage)));
}