コード例 #1
0
ファイル: SDLWindow.cpp プロジェクト: ardneran/Framework
void SDLWindow::handleWindowEvent() {
    switch (m_sdlEvent.window.event) {
        case SDL_WINDOWEVENT_MOVED:
            onMove(m_sdlEvent.window.data1, m_sdlEvent.window.data2);
            break;
        case SDL_WINDOWEVENT_RESIZED:
        case SDL_WINDOWEVENT_SIZE_CHANGED:
            onResize(m_sdlEvent.window.data1, m_sdlEvent.window.data2);
            break;
        case SDL_WINDOWEVENT_MINIMIZED:
            onMinimize();
            break;
        case SDL_WINDOWEVENT_MAXIMIZED:
            onMaximize();
            break;
        case SDL_WINDOWEVENT_RESTORED:
            onRestore();
            break;
		case SDL_WINDOWEVENT_SHOWN:
			onDisplay();
			break;
        default:
            break;
    }
}
コード例 #2
0
void QSkinDialog::mouseDoubleClickEvent(QMouseEvent* e)
{
	if((e->button() == Qt::LeftButton) && (ui->windowFrameTop->underMouse()  || ui->windowText->underMouse()) && !ui->windowIcon->underMouse() && !ui->closeButton->underMouse()
	        && !ui->minimizeButton->underMouse() && !ui->maximizeButton->underMouse() && dialogSizable)
	{
		onMaximize();
	}
}
コード例 #3
0
bool MainWindow::winEvent(MSG *message, long *result)
{
    if (message->message == WM_NCHITTEST)
    {
        QPoint cursorPos(GET_X_LPARAM(message->lParam), GET_Y_LPARAM(message->lParam));
        cursorPos = mapFromGlobal(cursorPos);
        *result = hitTest(cursorPos);
        return *result != HTCLIENT && *result != HTCAPTION;
    }
    else if (message->message == WM_LBUTTONDOWN)
    {
        QPoint cursorPos(GET_X_LPARAM(message->lParam), GET_Y_LPARAM(message->lParam));
        if (hitTest(cursorPos) == HTCAPTION)
        {
            PostMessage(message->hwnd, WM_SYSCOMMAND, HTCAPTION | SC_MOVE, 0);
            return true;
        }
    }
    else if (message->message == WM_LBUTTONDBLCLK)
    {
        QPoint cursorPos(GET_X_LPARAM(message->lParam), GET_Y_LPARAM(message->lParam));
        long ht = hitTest(cursorPos);
        if (ht == HTCAPTION)
        {
            onMaximize();
            return true;
        }
    }
    else if (message->message == WM_NCCALCSIZE)
    {
        *result = 0;
        QRect rect;
        if (message->wParam)
        {
            NCCALCSIZE_PARAMS *ncsp = reinterpret_cast<NCCALCSIZE_PARAMS*>(message->lParam);
            if (IsZoomed(message->hwnd))
            {
                QDesktopWidget desktopWidget;
                rect = desktopWidget.availableGeometry(this);
                ncsp->rgrc[0].left = rect.left();
                ncsp->rgrc[0].top = rect.top();
                ncsp->rgrc[0].right = rect.right();
                ncsp->rgrc[0].bottom = rect.bottom();
            }
        }
        return true;
    }
    return false;
}
コード例 #4
0
ファイル: SDL2Window.cpp プロジェクト: striezel/ArxLibertatis
void SDL2Window::tick() {

    SDL_Event event;
    while(SDL_PollEvent(&event)) {

        switch(event.type) {

        case SDL_WINDOWEVENT: {
            switch(event.window.event) {

            case SDL_WINDOWEVENT_SHOWN:
                onShow(true);
                break;
            case SDL_WINDOWEVENT_HIDDEN:
                onShow(false);
                break;
            case SDL_WINDOWEVENT_EXPOSED:
                onPaint();
                break;
            case SDL_WINDOWEVENT_MINIMIZED:
                onMinimize();
                break;
            case SDL_WINDOWEVENT_MAXIMIZED:
                onMaximize();
                break;
            case SDL_WINDOWEVENT_RESTORED:
                onRestore();
                break;
            case SDL_WINDOWEVENT_FOCUS_GAINED:
                onFocus(true);
                break;
            case SDL_WINDOWEVENT_FOCUS_LOST:
                onFocus(false);
                break;

            case SDL_WINDOWEVENT_MOVED: {
                onMove(event.window.data1, event.window.data2);
                break;
            }

            case SDL_WINDOWEVENT_SIZE_CHANGED: {
                Vec2i newSize(event.window.data1, event.window.data2);
                if(newSize != m_size && !m_fullscreen) {
                    m_renderer->beforeResize(false);
                    updateSize();
                } else {
                    // SDL regrettably sends resize events when a fullscreen window
                    // is minimized - we'll have none of that!
                }
                break;
            }

            case SDL_WINDOWEVENT_CLOSE: {
                // The user has requested to close a single window
                // TODO we only support one main window for now
                break;
            }

            }
            break;
        }

        case SDL_QUIT: {
            // The user has requested to close the whole program
            // TODO onDestroy() fits SDL_WINDOWEVENT_CLOSE better, but SDL captures Ctrl+C
            // evenst and *only* sends the SDL_QUIT event for them while normal close
            // generates *both* SDL_WINDOWEVENT_CLOSE and SDL_QUIT
            onDestroy();
            return; // abort event loop!
        }

        }

        if(m_input) {
            m_input->onEvent(event);
        }

    }

    if(!m_renderer->isInitialized()) {
        updateSize();
        m_renderer->afterResize();
        m_renderer->SetViewport(Rect(m_size.x, m_size.y));
    }
}
コード例 #5
0
void Ui::VideoPanelHeader::_onMaximize() {
    emit onMaximize();
}
コード例 #6
0
ファイル: oc3_screen_game.cpp プロジェクト: coniu/opencaesar3
void ScreenGame::initialize( GfxEngine& engine, GuiEnv& gui )
{
  _d->gui = &gui;
  _d->engine = &engine;
  _d->infoBoxMgr = InfoBoxManager::create( &gui );

  CityPtr city = _d->scenario->getCity();

  _d->gui->clear();

  /*new PopupMessageBox( _d->gui->getRootWidget(), "Test title", "This is test string for popup message box", 
                       "Sen 351 BC", "For New player" ); */

  const int topMenuHeight = 23;
  const Picture& rPanelPic = Picture::load( ResourceGroup::panelBackground, 14 );
  Rect rPanelRect( engine.getScreenWidth() - rPanelPic.getWidth(), topMenuHeight,
                   engine.getScreenWidth(), engine.getScreenHeight() );

  _d->rightPanel = MenuRigthPanel::create( gui.getRootWidget(), rPanelRect, rPanelPic);

  _d->topMenu = TopMenu::create( gui.getRootWidget(), topMenuHeight );
  _d->topMenu->setPopulation( city->getPopulation() );
  _d->topMenu->setFunds( city->getFunds().getValue() );
  _d->topMenu->setDate( GameDate::current() );

  _d->menu = Menu::create( gui.getRootWidget(), -1, _d->scenario->getCity() );
  _d->menu->setPosition( Point( engine.getScreenWidth() - _d->menu->getWidth() - _d->rightPanel->getWidth(), 
                                 _d->topMenu->getHeight() ) );

  _d->extMenu = ExtentMenu::create( gui.getRootWidget(), _d->mapRenderer, -1, _d->scenario->getCity() );
  _d->extMenu->setPosition( Point( engine.getScreenWidth() - _d->extMenu->getWidth() - _d->rightPanel->getWidth(), 
                                     _d->topMenu->getHeight() ) );

  _d->wndStackMsgs = WindowMessageStack::create( gui.getRootWidget(), -1 );
  _d->wndStackMsgs->setPosition( Point( gui.getRootWidget()->getWidth() / 4, 33 ) );
  _d->wndStackMsgs->sendToBack();
    
  _d->rightPanel->bringToFront();

  // 8*30: used for high buildings (granary...), visible even when not in tilemap_area.
  getMapArea().setViewSize( engine.getScreenSize() + Size( 180 ) );
        
  // here move camera to start position of map
  getMapArea().setCenterIJ( _d->scenario->getCity()->getCameraPos() ); 

  new SenatePopupInfo( _d->gui->getRootWidget(), _d->mapRenderer );

  //connect elements
  CONNECT( _d->topMenu, onSave(), _d.data(), Impl::showSaveDialog );
  CONNECT( _d->topMenu, onExit(), this, ScreenGame::resolveExitGame );
  CONNECT( _d->topMenu, onEnd(), this, ScreenGame::resolveEndGame );
  CONNECT( _d->topMenu, onRequestAdvisor(), _d.data(), Impl::showAdvisorsWindow );

  CONNECT( _d->menu, onCreateConstruction(), _d.data(), Impl::resolveCreateConstruction );
  CONNECT( _d->menu, onRemoveTool(), _d.data(), Impl::resolveRemoveTool );
  CONNECT( _d->menu, onMaximize(), _d->extMenu, ExtentMenu::maximize );

  CONNECT( _d->extMenu, onCreateConstruction(), _d.data(), Impl::resolveCreateConstruction );
  CONNECT( _d->extMenu, onRemoveTool(), _d.data(), Impl::resolveRemoveTool );

  CONNECT( city, onPopulationChanged(), _d->topMenu, TopMenu::setPopulation );
  CONNECT( city, onFundsChanged(), _d->topMenu, TopMenu::setFunds );
  CONNECT( &GameDate::instance(), onMonthChanged(), _d->topMenu, TopMenu::setDate );

  CONNECT( &_d->mapRenderer, onShowTileInfo(), _d.data(), Impl::showTileInfo );

  CONNECT( city, onWarningMessage(), _d->wndStackMsgs, WindowMessageStack::addMessage );
  CONNECT( &_d->mapRenderer, onWarningMessage(), _d->wndStackMsgs, WindowMessageStack::addMessage );
  CONNECT( _d->extMenu, onSelectOverlayType(), _d.data(), Impl::resolveSelectOverlayView );
  CONNECT( _d->extMenu, onEmpireMapShow(), _d.data(), Impl::showEmpireMapWindow );
  CONNECT( _d->extMenu, onAdvisorsWindowShow(), _d.data(), Impl::showAdvisorsWindow );
  CONNECT( _d->extMenu, onMissionTargetsWindowShow(), _d.data(), Impl::showMissionTaretsWindow );

  CONNECT( city, onDisasterEvent(), &_d->alarmsHolder, AlarmEventHolder::add );
  CONNECT( _d->extMenu, onSwitchAlarm(), &_d->alarmsHolder, AlarmEventHolder::next );
  CONNECT( &_d->alarmsHolder, onMoveToAlarm(), &_d->mapArea, TilemapArea::setCenterIJ );
  CONNECT( &_d->alarmsHolder, onAlarmChange(), _d->extMenu, ExtentMenu::setAlarmEnabled );
}
コード例 #7
0
void SDL2Window::tick() {
	
	SDL_Event event;
	while(SDL_PollEvent(&event)) {
		
		switch(event.type) {
			
			case SDL_WINDOWEVENT: {
				switch(event.window.event) {
					
					case SDL_WINDOWEVENT_SHOWN:        onShow(true);   break;
					case SDL_WINDOWEVENT_HIDDEN:       onShow(false);  break;
					case SDL_WINDOWEVENT_EXPOSED:      onPaint();      break;
					case SDL_WINDOWEVENT_MINIMIZED:    onMinimize();   break;
					case SDL_WINDOWEVENT_MAXIMIZED:    onMaximize();   break;
					case SDL_WINDOWEVENT_RESTORED:     onRestore();    break;
					case SDL_WINDOWEVENT_FOCUS_GAINED: onFocus(true);  break;
					case SDL_WINDOWEVENT_FOCUS_LOST:   onFocus(false); break;
					
					case SDL_WINDOWEVENT_MOVED: {
						onMove(event.window.data1, event.window.data2);
						break;
					}
					
					case SDL_WINDOWEVENT_SIZE_CHANGED: {
						Vec2i newSize(event.window.data1, event.window.data2);
						if(newSize != m_size && !m_fullscreen) {
							m_renderer->beforeResize(false);
							updateSize();
						} else {
							// SDL regrettably sends resize events when a fullscreen window
							// is minimized - we'll have none of that!
						}
						break;
					}
					
					case SDL_WINDOWEVENT_CLOSE: {
						// The user has requested to close a single window
						// TODO we only support one main window for now
						break;
					}
					
				}
				break;
			}
			
			#if ARX_PLATFORM == ARX_PLATFORM_WIN32
			case SDL_KEYDOWN: {
				// SDL2 is still eating our ALT+F4 under windows...
				// See bug report here: https://bugzilla.libsdl.org/show_bug.cgi?id=1555
				if(event.key.keysym.sym == SDLK_F4
				   && (event.key.keysym.mod & KMOD_ALT) != KMOD_NONE) {
					SDL_Event quitevent;
					quitevent.type = SDL_QUIT;
					SDL_PushEvent(&quitevent);
				}
				break;
			}
			#endif
			
			case SDL_QUIT: {
				// The user has requested to close the whole program
				// TODO onDestroy() fits SDL_WINDOWEVENT_CLOSE better, but SDL captures Ctrl+C
				// evenst and *only* sends the SDL_QUIT event for them while normal close
				// generates *both* SDL_WINDOWEVENT_CLOSE and SDL_QUIT
				onDestroy();
				return; // abort event loop!
			}
			
		}
		
		if(m_input) {
			m_input->onEvent(event);
		}
		
	}
	
	if(!m_renderer->isInitialized()) {
		updateSize();
		m_renderer->afterResize();
		m_renderer->SetViewport(Rect(m_size.x, m_size.y));
	}
}
コード例 #8
0
QSkinDialog::QSkinDialog(bool sizable, bool closable, bool mainDialog, bool preview, QWidget* parent) :
	QDialog(parent),
	ui(new Ui::QSkinDialog)
{
	ui->setupUi(this);
	maximized = false;
	minimized = false;
	movable = false;
	moving = false;
	dialogSizable = sizable;
	dialogClosable = closable;
	dialogPreview = preview;
	isMainDialog = mainDialog;
	sizableTopLeft = false;
	sizableLeft = false;
	sizableBottomLeft = false;
	sizableBottom = false;
	sizableTopRight = false;
	sizableRight = false;
	sizableBottomRight = false;

	systemMenu = new QMenu(this);
	systemRestoreAction = new QAction(tr("Restore"), this);
	systemRestoreAction->setIcon(style()->standardIcon(QStyle::SP_TitleBarNormalButton));
	systemRestoreAction->setEnabled(false);
	systemMenu->addAction(systemRestoreAction);
	systemMinimizeAction = new QAction(tr("Minimize"), this);
	systemMinimizeAction->setIcon(style()->standardIcon(QStyle::SP_TitleBarMinButton));
	systemMenu->addAction(systemMinimizeAction);
	systemMinimizeAction->setEnabled(dialogSizable);
	systemMaximizeAction = new QAction(tr("Maximize"), this);
	systemMaximizeAction->setIcon(style()->standardIcon(QStyle::SP_TitleBarMaxButton));
	systemMenu->addAction(systemMaximizeAction);
	systemMaximizeAction->setEnabled(dialogSizable);
	systemMenu->addSeparator();
	systemCloseAction = new QAction(tr("Close"), this);
	systemCloseAction->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
	systemCloseAction->setShortcut(QKeySequence::Close);
	systemCloseAction->setEnabled(dialogClosable);
	systemMenu->addAction(systemCloseAction);

	// We are using our own frame of course instead of the system frame
	if(!parent == 0)
	{
		this->setWindowFlags(Qt::FramelessWindowHint | Qt::Window);
	}
	else
	{
		this->setWindowFlags(Qt::FramelessWindowHint);
	}
	// To enable alpha blending and transparency in the frame
	setAttribute(Qt::WA_TranslucentBackground);
	setAttribute(Qt::WA_StaticContents);

	this->setMaximumSize(QApplication::desktop()->availableGeometry(this).width(), QApplication::desktop()->availableGeometry(this).height());

	ui->minimizeButton->setEnabled(dialogSizable);
	ui->maximizeButton->setEnabled(dialogSizable);
	ui->closeButton->setEnabled(dialogClosable);
	if(!dialogSizable)
	{
		ui->windowFrameTopLeft->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameLeft->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameBottomLeft->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameTop->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameBottom->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameTopRight->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameRight->setCursor(QCursor(Qt::ArrowCursor));
		ui->windowFrameBottomRight->setCursor(QCursor(Qt::ArrowCursor));
	}

	connect(systemRestoreAction, SIGNAL(triggered()), this, SLOT(onMaximize()));
	connect(systemMaximizeAction, SIGNAL(triggered()), this, SLOT(onMaximize()));
	connect(systemMinimizeAction, SIGNAL(triggered()), this, SLOT(onMinimize()));
	connect(systemCloseAction, SIGNAL(triggered()), this, SLOT(onClose()));
	connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(onClose()));
	connect(ui->minimizeButton, SIGNAL(clicked()), this, SLOT(onMinimize()));
	connect(ui->maximizeButton, SIGNAL(clicked()), this, SLOT(onMaximize()));
	connect(&skinSettings, SIGNAL(skinChanged()), this, SLOT(skinChangeEvent()));

	if(quazaaSettings.Skin.File.isEmpty())
	{
		quazaaSettings.loadSkinSettings();
	}

	skinSettings.loadSkin(quazaaSettings.Skin.File);
	quazaaSettings.saveSkinSettings();

	// Load the previously set skin

	if(!dialogPreview)
	{
		if(isMainDialog)
		{
			ui->windowFrameTopLeft->setStyleSheet(skinSettings.windowFrameTopLeftStyleSheet);
			ui->windowFrameLeft->setStyleSheet(skinSettings.windowFrameLeftStyleSheet);
			ui->windowFrameBottomLeft->setStyleSheet(skinSettings.windowFrameBottomLeftStyleSheet);
			ui->windowFrameTop->setStyleSheet(skinSettings.windowFrameTopStyleSheet);
			ui->windowFrameBottom->setStyleSheet(skinSettings.windowFrameBottomStyleSheet);
			ui->windowFrameTopRight->setStyleSheet(skinSettings.windowFrameTopRightStyleSheet);
			ui->windowFrameRight->setStyleSheet(skinSettings.windowFrameRightStyleSheet);
			ui->windowFrameBottomRight->setStyleSheet(skinSettings.windowFrameBottomRightStyleSheet);
			ui->titlebarButtonsFrame->setStyleSheet(skinSettings.titlebarButtonsFrameStyleSheet);
			ui->minimizeButton->setStyleSheet(skinSettings.minimizeButtonStyleSheet);
			ui->maximizeButton->setStyleSheet(skinSettings.maximizeButtonStyleSheet);
			ui->closeButton->setStyleSheet(skinSettings.closeButtonStyleSheet);
			ui->windowFrameTopSpacer->setStyleSheet(skinSettings.windowFrameTopSpacerStyleSheet);
			ui->windowText->setStyleSheet(skinSettings.windowTextStyleSheet);
			ui->windowIconFrame->setStyleSheet(skinSettings.windowIconFrameStyleSheet);
			ui->windowIcon->setVisible(skinSettings.windowIconVisible);
			quazaaSettings.loadSkinWindowSettings(this);
		}
		else
		{
			ui->windowFrameTopLeft->setStyleSheet(skinSettings.childWindowFrameTopLeftStyleSheet);
			ui->windowFrameLeft->setStyleSheet(skinSettings.childWindowFrameLeftStyleSheet);
			ui->windowFrameBottomLeft->setStyleSheet(skinSettings.childWindowFrameBottomLeftStyleSheet);
			ui->windowFrameTop->setStyleSheet(skinSettings.childWindowFrameTopStyleSheet);
			ui->windowFrameBottom->setStyleSheet(skinSettings.childWindowFrameBottomStyleSheet);
			ui->windowFrameTopRight->setStyleSheet(skinSettings.childWindowFrameTopRightStyleSheet);
			ui->windowFrameRight->setStyleSheet(skinSettings.childWindowFrameRightStyleSheet);
			ui->windowFrameBottomRight->setStyleSheet(skinSettings.childWindowFrameBottomRightStyleSheet);
			ui->titlebarButtonsFrame->setStyleSheet(skinSettings.childTitlebarButtonsFrameStyleSheet);
			ui->minimizeButton->setStyleSheet(skinSettings.childMinimizeButtonStyleSheet);
			ui->maximizeButton->setStyleSheet(skinSettings.childMaximizeButtonStyleSheet);
			ui->closeButton->setStyleSheet(skinSettings.childCloseButtonStyleSheet);
			ui->windowFrameTopSpacer->setStyleSheet(skinSettings.childWindowFrameTopSpacerStyleSheet);
			ui->windowText->setStyleSheet(skinSettings.childWindowTextStyleSheet);
			ui->windowIconFrame->setStyleSheet(skinSettings.childWindowIconFrameStyleSheet);
			ui->windowIcon->setVisible(skinSettings.childWindowIconVisible);
		}
	}
}
コード例 #9
0
acDockWidgetTitlebar::acDockWidgetTitlebar(QWidget *parent) : parent(parent)
{
    QString PushButtonStyle("QPushButton {border:none; margin: 0px; padding: 0px } QPushButton:hover {border:1px solid black}");

    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, Qt::lightGray);
    setAutoFillBackground(true);
    setPalette(Pal);
    setMaximumHeight(20);
    m_close = false;

    m_parent = parent;

    // Create a close button and set its icon to that of the OS 
    m_ToolBarIcon = new QIcon(":/CompressonatorGUI/Images/settings.png");

    m_buttonToolBar = new QPushButton(this);
    m_buttonToolBar->setIcon(*m_ToolBarIcon);
    m_buttonToolBar->setStyleSheet(PushButtonStyle);
    m_buttonToolBar->setToolTip("Show Tool Bar");
    m_buttonToolBarEnabled = true;


    // Get the OS close button icon
    QStyle*style = qApp->style();

    QIcon minimizeIcon = style->standardIcon(QStyle::SP_TitleBarMinButton);
    // Create a maximize button and set its icon to that of the OS 
    m_buttonMinimize = new QPushButton(this);
    m_buttonMinimize->setIcon(minimizeIcon);
    m_buttonMinimize->setStyleSheet(PushButtonStyle);
    m_buttonMinimize->setToolTip("Minimize Window");

    QIcon maximizeIcon = style->standardIcon(QStyle::SP_TitleBarMaxButton);
    // Create a maximize button and set its icon to that of the OS 
    m_buttonMaximize = new QPushButton(this);
    m_buttonMaximize->setIcon(maximizeIcon);
    m_buttonMaximize->setStyleSheet(PushButtonStyle);
    m_buttonMaximize->setToolTip("Maximize Window");

    QIcon normalIcon = style->standardIcon(QStyle::SP_TitleBarNormalButton);
    // Create a maximize button and set its icon to that of the OS 
    m_buttonNormal = new QPushButton(this);
    m_buttonNormal->setIcon(normalIcon);
    m_buttonNormal->setStyleSheet(PushButtonStyle);
    m_buttonNormal->setToolTip("Normal Window");
    m_buttonNormal->hide();

    QIcon closeIcon = style->standardIcon(QStyle::SP_TitleBarCloseButton);
    
    // Create a close button and set its icon to that of the OS 
    m_buttonClose = new QPushButton(this);
    //m_buttonClose->setIcon(QIcon(":/CompressonatorGUI/Images/cxClose.png"));
    m_buttonClose->setIcon(closeIcon);
    m_buttonClose->setStyleSheet(PushButtonStyle);
    m_buttonClose->setToolTip("Close Window");
    m_ButtonCloseEnabled = true;

    // Reserve a label for the Titlebar
    m_label = new QLabel("",this);

    // Set a layout for the new label and pushbutton
    m_layout = new QHBoxLayout(this);
    m_layout->addWidget(m_label,Qt::AlignLeading);
    m_layout->addWidget(m_buttonToolBar);
    m_layout->addWidget(m_buttonMinimize);
    m_layout->addWidget(m_buttonNormal);
    m_layout->addWidget(m_buttonMaximize);
    m_layout->addWidget(m_buttonClose);

    m_layout->setSpacing(0);
    m_layout->setMargin(0);
    m_layout->setContentsMargins(0, 0, 0, 0);

    setLayout(m_layout);

    connect(m_buttonMinimize, SIGNAL(clicked()), this, SLOT(onMinimize()));
    connect(m_buttonNormal, SIGNAL(clicked()), this, SLOT(onNormal()));
    connect(m_buttonMaximize, SIGNAL(clicked()), this, SLOT(onMaximize()));
    connect(m_buttonClose, SIGNAL(clicked()), this, SLOT(onClose()));
    connect(m_buttonToolBar, SIGNAL(clicked()), this, SLOT(OnToolBarClicked()));

    setButtonMinMaxEnabled(false);
    
}
コード例 #10
0
Ui::DetachedVideoWindow::DetachedVideoWindow(QWidget* parent)
    : AspectRatioResizebleWnd()
    , parent_(parent)
	, closed_manualy_(false)
	, show_panel_timer_(this)
	, video_panel_header_(new VideoPanelHeader(this, kVPH_ShowClose)) {

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("detachedVideoWnd"));
        this->resize(400, 300);
        this->setMinimumSize(QSize(0, 0));
        this->setMaximumSize(QSize(16777215, 16777215));
        this->setProperty("DetachedVideoWindowCommon", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(this);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setAlignment(Qt::AlignVCenter);
        QMetaObject::connectSlotsByName(this);
        
#ifdef _WIN32
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::SubWindow);
#else
        setWindowFlags(Qt::WindowStaysOnTopHint | Qt::Window | Qt::WindowDoesNotAcceptFocus/*| Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint*/);
        setAttribute(Qt::WA_ShowWithoutActivating);
        setAttribute(Qt::WA_X11DoNotAcceptFocus);
#endif

        video_panel_header_effect_ = new UIEffects(*video_panel_header_.get());
#ifndef __linux__
        std::vector<QWidget*> panels;
        panels.push_back(video_panel_header_.get());
        _rootWidget = platform_specific::GraphicsPanel::create(this, panels);
        _rootWidget->setContentsMargins(0, 0, 0, 0);
        //_rootWidget->setProperty("WidgetWithBG", true);
        _rootWidget->setAttribute(Qt::WA_UpdatesDisabled);
        _rootWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
        layout()->addWidget(_rootWidget);
#endif //__linux__
        std::vector<QWidget*> topPanels;
        topPanels.push_back(video_panel_header_.get());
        std::vector<QWidget*> bottomPanels;
        event_filter_ = new video_window::ResizeEventFilter(topPanels, bottomPanels, this);
		installEventFilter(event_filter_);

        setAttribute(Qt::WA_UpdatesDisabled);
        setAttribute(Qt::WA_ShowWithoutActivating);

		connect(&show_panel_timer_, SIGNAL(timeout()), this, SLOT(_check_panels_vis()), Qt::QueuedConnection);
		show_panel_timer_.setInterval(1500);

		assert(!!video_panel_header_);
		if (!!video_panel_header_) {
			//video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
			//video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
			//video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true); 

            video_panel_header_->setWindowFlags(Qt::SubWindow | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
            video_panel_header_->setAttribute(Qt::WA_NoSystemBackground, true);
            video_panel_header_->setAttribute(Qt::WA_TranslucentBackground, true);  

			connect(video_panel_header_.get(), SIGNAL(onMouseEnter()), this, SLOT(onPanelMouseEnter()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMouseLeave()), this, SLOT(onPanelMouseLeave()), Qt::QueuedConnection);

			connect(video_panel_header_.get(), SIGNAL(onClose()), this, SLOT(onPanelClickedClose()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMinimize()), this, SLOT(onPanelClickedMinimize()), Qt::QueuedConnection);
			connect(video_panel_header_.get(), SIGNAL(onMaximize()), this, SLOT(onPanelClickedMaximize()), Qt::QueuedConnection);
		}

        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowRemoveComplete(quintptr)), this, SLOT(onVoipWindowRemoveComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipWindowAddComplete(quintptr)), this, SLOT(onVoipWindowAddComplete(quintptr)), Qt::DirectConnection);
        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipCallDestroyed(const voip_manager::ContactEx&)), this, SLOT(onVoipCallDestroyed(const voip_manager::ContactEx&)), Qt::DirectConnection);

        setMinimumSize(Utils::scale_value(320), Utils::scale_value(80));
        
        QDesktopWidget dw;
        const auto screen_rect = dw.screenGeometry(dw.primaryScreen());
        const auto detached_wnd_rect = rect();

        auto detached_wnd_pos = screen_rect.topRight();
        detached_wnd_pos.setX(detached_wnd_pos.x() - detached_wnd_rect.width() - 0.01f * screen_rect.width());
        detached_wnd_pos.setY(detached_wnd_pos.y() + 0.05f * screen_rect.height());

        const QRect rc(detached_wnd_pos.x(), detached_wnd_pos.y(), detached_wnd_rect.width(), detached_wnd_rect.height());
        setGeometry(rc);
}