Ejemplo n.º 1
0
void QSkinDialog::onMaximize()
{
	setMaximized(!maximized);
}
Ejemplo n.º 2
0
void EmulatedCardWindow::resizeWindowBufferEvent(int w, int h, QRect windowScreenBounds, bool forceSync, bool ignoreFixedOrient)
{
	bool directRendering = m_maximized;
	bool visible = isVisible() && this->sceneBoundingRect().intersects(WindowServer::instance()->sceneRect());
	bool obscured = SystemUiController::instance()->maximizedCardWindow() ? (SystemUiController::instance()->maximizedCardWindow() != this) : false;
	bool synch = forceSync || m_maximized || (visible  && !obscured);

	if((w == (int)m_bufWidth) && (h == (int)m_bufHeight)) {
		// already the right size, so do nothing
		return;
	}

	if(Settings::LunaSettings()->displayUiRotates) {
		if(directRendering)
			setMaximized(false); // disable direct rendering for the resize event

			//Emulated cards cannot resize to full screen, ever.
			int maxWidth = Settings::LunaSettings()->emulatedCardWidth;
			int maxHeight = Settings::LunaSettings()->emulatedCardHeight;

			m_screenMidLine = (SystemUiController::instance()->currentUiHeight() - Settings::LunaSettings()->positiveSpaceTopPadding)/2;

			if (!m_fullScreenMode) {
				maxHeight = maxHeight - Settings::LunaSettings()->positiveSpaceTopPadding;

			}

			w = (w > maxWidth ? maxWidth : w);
			h = (h > maxHeight ? maxHeight : h);

			if (w>h) {
				//Going to a landscape card
				setNewEmuRect(maxHeight, maxWidth);
				HostWindow::resizeEventSync(maxHeight,maxWidth);
			} else {
				//Going to a portrait card
				setNewEmuRect(maxWidth, maxHeight);
				HostWindow::resizeEventSync(maxWidth,maxHeight);
			}


		setBoundingRect(windowScreenBounds.width(), windowScreenBounds.height());
		setVisibleDimensions(windowScreenBounds.width(), windowScreenBounds.height());

		m_paintPath = QPainterPath();
		m_paintPath.addRoundedRect(m_boundingRect, 25, 25);

		// reconstruct shadow
		CardDropShadowEffect* shadow = static_cast<CardDropShadowEffect*>(graphicsEffect());
		if (shadow) {
			bool enable = shadow->isEnabled();
			setGraphicsEffect(0);
			shadow = new CardDropShadowEffect(this);
			setGraphicsEffect(shadow);
			shadow->setEnabled(enable);
		}

		if(directRendering)
			setMaximized(true); // re-enable direct rendering
	}

}