Exemplo n.º 1
0
void Trackball::click(int button, int state, int x, int y)
{
	btn = button;
	
	clock_t clickTime = clock();
	
	switch (btn)
	{
		case GLUT_LEFT_BUTTON:
			if (state == GLUT_DOWN) {
				start(x, y);
			}
			else {
				stop(x, y);
			}
			
			if (state == GLUT_UP)
			{
				if (clickTime - lastClickTime < 3 * 1000)
					doubleClick(button, state, x, y);
				lastClickTime = clickTime;
			}
			break;
			
		case GLUT_RIGHT_BUTTON:
			break;
			
		default:
			break;
	}
}
Exemplo n.º 2
0
MainWindow::MainWindow(QWidget *parent, bool fullscreen) :
	QMainWindow(parent),
	currentLanguage("en"),
	nextState(CORE_POWERDOWN),
	lastUIState(UISTATE_MENU),
	dialogDisasm(0),
	memoryWindow(0),
	memoryTexWindow(0),
	displaylistWindow(0)
{
	QDesktopWidget *desktop = QApplication::desktop();
	int screenNum = QProcessEnvironment::systemEnvironment().value("SDL_VIDEO_FULLSCREEN_HEAD", "0").toInt();
	
	// Move window to top left coordinate of selected screen
	QRect rect = desktop->screenGeometry(screenNum);
	move(rect.topLeft());

	SetGameTitle("");
	emugl = new MainUI(this);

	setCentralWidget(emugl);
	createMenus();
	updateMenus();

	SetWindowScale(-1);
	
	if(fullscreen)
	  fullscrAct();

	QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct()));
	QObject::connect(emugl, SIGNAL(newFrame()), this, SLOT(newFrame()));
}
Exemplo n.º 3
0
void MacOSMouseOStream::clickMouse(pair<uint32_t, uint32_t> mouse) {
#if __APPLE__
    if (ofGetElapsedTimeMillis() < elapsed_time_ + kGracePeriod) {
        return;
    }
    elapsed_time_ = ofGetElapsedTimeMillis();

    doubleClick(mouse);
#endif
}
Exemplo n.º 4
0
int MyListWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QListWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: click(); break;
        case 1: doubleClick(); break;
        }
        _id -= 2;
    }
    return _id;
}
Exemplo n.º 5
0
    NameFinderWidget::NameFinderWidget ( QWidget *parent ) :
            QWidget ( parent ),
            m_ui ( new Ui::NameFinderWidgetUi )
    {
        m_ui->setupUi ( this );
        model = new NameFinderTableModel();
        m_ui->tableView->setModel ( model );
        m_ui->tableView->horizontalHeader()->setStretchLastSection(true);
//        m_ui->tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
        m_ui->tableView->verticalHeader()->setVisible(false);
        selection = m_ui->tableView->selectionModel();
        connect(selection, SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)), this,SLOT(selection_selectionChanged(const QItemSelection&,const QItemSelection&)));
        connect(m_ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT (doubleClick()));
    }
Exemplo n.º 6
0
// TODO: Make this class thread-aware. Can't send events to a different thread. Currently only works on X11.
// Needs to use QueuedConnection for signals/slots.
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	ui(new Ui::MainWindow),
	nextState(CORE_POWERDOWN),
	dialogDisasm(0),
	memoryWindow(0),
	memoryTexWindow(0),
	timer(this),
	displaylistWindow(0),
	lastUIState(UISTATE_MENU)
{
	ui->setupUi(this);

	controls = new Controls(this);
#if QT_HAS_SDL
	gamePadDlg = new GamePadDialog(&input_state, this);
#endif

	host = new QtHost(this);
	emugl = ui->widget;
	emugl->init(&input_state);
	emugl->resize(pixel_xres, pixel_yres);
	emugl->setMinimumSize(pixel_xres, pixel_yres);
	emugl->setMaximumSize(pixel_xres, pixel_yres);
	QObject::connect( emugl, SIGNAL(doubleClick()), this, SLOT(on_action_OptionsFullScreen_triggered()) );

	createLanguageMenu();
	UpdateMenus();

	int zoom = g_Config.iWindowZoom;
	if (zoom < 1) zoom = 1;
	if (zoom > 4) zoom = 4;
	SetZoom(zoom);

	SetGameTitle(fileToStart);

	connect(&timer, SIGNAL(timeout()), this, SLOT(Update()));
	timer.setInterval(0);
	timer.start();

//	if (!fileToStart.isNull())
//	{
//		UpdateMenus();

//		if (stateToLoad != NULL)
//			SaveState::Load(stateToLoad);
//	}
}
Exemplo n.º 7
0
int MyWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: sizeChanged(); break;
        case 1: doubleClick(); break;
        case 2: mouseInArea((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
Exemplo n.º 8
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), ui->RArea, SLOT(next_generation()));
    pause = true;
    settings_dialog = new myDialog();
    ui->RArea->setAreaSize(((myDialog*)settings_dialog)->getAreaWidth(), ((myDialog*)settings_dialog)->getAreaHeight());
    ui->RArea->setBar(ui->statusBar);
    ui->RArea->setAreaColor(((myDialog*)settings_dialog)->getAreaColor());
    ui->RArea->setCellColor(((myDialog*)settings_dialog)->getCellColor());
    timerSpeed = ((myDialog*)settings_dialog)->getAreaSpeed();
    connect(ui->RArea, SIGNAL(doubleClick()), this, SLOT(fullScreenArea()));
    ui->playPauseButton->setIcon(QIcon(":/img/media-playback-start.svg"));
    fullMode = false;
}
Exemplo n.º 9
0
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	currentLanguage("en"),
	nextState(CORE_POWERDOWN),
	lastUIState(UISTATE_MENU),
	dialogDisasm(0),
	memoryWindow(0),
	memoryTexWindow(0),
	displaylistWindow(0)
{
	SetGameTitle("");
	emugl = new MainUI(this);

	setCentralWidget(emugl);
	createMenus();
	updateMenus();

	SetZoom(g_Config.iInternalResolution);

	QObject::connect(emugl, SIGNAL(doubleClick()), this, SLOT(fullscrAct()));
	QObject::connect(emugl, SIGNAL(newFrame()), this, SLOT(newFrame()));
}
Exemplo n.º 10
0
	bool TitleWidgetEventFilter::eventFilter(QObject* obj, QEvent* event)
	{
		switch (event->type())
		{
		case QEvent::MouseButtonDblClick:
			emit doubleClick();
			break;

		case QEvent::MouseButtonPress:
			clickPos = static_cast<QMouseEvent*>(event)->pos();
			event->accept();
			break;

		case QEvent::MouseMove:
			emit moveRequest(static_cast<QMouseEvent*>(event)->globalPos() - clickPos - QPoint(get_gui_settings()->get_shadow_width(), get_gui_settings()->get_shadow_width()));
			break;

		default:
			break;
		}

		return QObject::eventFilter(obj, event);
	}
Exemplo n.º 11
0
void TransferFunctionPropertyDialog::generateWidget() {
    vec2 minEditorDims = vec2(255.0f, 100.0f);

    tfEditorView_ = new TransferFunctionEditorView(tfProperty_);
    tfProperty_->get().addObserver(tfEditorView_);
    // put origin to bottom left corner
    tfEditorView_->scale(1.0, -1.0);
    tfEditorView_->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    tfEditorView_->setMinimumSize(minEditorDims.x, minEditorDims.y);
    tfEditorView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tfEditorView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    
    tfEditor_ = new TransferFunctionEditor(&tfProperty_->get(), tfEditorView_);
    connect(tfEditor_, SIGNAL(doubleClick()), this, SLOT(showColorDialog()));
    connect(tfEditor_, SIGNAL(selectionChanged()), this, SLOT(updateColorWheel()));
    tfEditorView_->setScene(tfEditor_);

    zoomVSlider_ = new RangeSliderQt(Qt::Vertical, this);
    zoomVSlider_->setRange(0, sliderRange_);
    zoomVSlider_->setMinSeparation(5);
    // flip slider values to compensate for vertical slider layout
    zoomVSlider_->setValue(sliderRange_ - static_cast<int>(tfProperty_->getZoomV().y*sliderRange_),
                           sliderRange_ - static_cast<int>(tfProperty_->getZoomV().x*sliderRange_));
    connect(zoomVSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeVerticalZoom(int, int)));
    
    zoomHSlider_ = new RangeSliderQt(Qt::Horizontal, this);
    zoomHSlider_->setRange(0, sliderRange_);
    zoomHSlider_->setMinSeparation(5);
    zoomHSlider_->setValue(static_cast<int>(tfProperty_->getZoomH().x*sliderRange_),
                           static_cast<int>(tfProperty_->getZoomH().y*sliderRange_));
    connect(zoomHSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeHorizontalZoom(int, int)));

    maskSlider_ = new RangeSliderQt(Qt::Horizontal, this);
    maskSlider_->setRange(0, sliderRange_);
    maskSlider_->setValue(static_cast<int>(tfProperty_->getMask().x*sliderRange_),
                          static_cast<int>(tfProperty_->getMask().y*sliderRange_));
    connect(maskSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeMask(int, int)));
    
    colorWheel_ = new ColorWheel();
    connect(colorWheel_, SIGNAL(colorChange(QColor)), this, SLOT(setPointColor(QColor)));
    
    btnClearTF_ = new QPushButton("Reset");
    connect(btnClearTF_, SIGNAL(clicked()), tfEditor_, SLOT(resetTransferFunction()));
    btnClearTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
    
    btnImportTF_ = new QPushButton("Import");
    connect(btnImportTF_, SIGNAL(clicked()), this, SLOT(importTransferFunction()));
    btnImportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
    
    btnExportTF_ = new QPushButton("Export");
    connect(btnExportTF_, SIGNAL(clicked()), this, SLOT(exportTransferFunction()));
    btnExportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));

    tfPreview_ = new QLabel();
    tfPreview_->setMinimumSize(1,20);
    QSizePolicy sliderPol = tfPreview_->sizePolicy();
    sliderPol.setHorizontalStretch(3);
    tfPreview_->setSizePolicy(sliderPol);
    
    cmbInterpolation_ = new QComboBox();
    cmbInterpolation_->addItem("Interpolation: Linear");
    //cmbInterpolation_->addItem("Interpolation: Cubic"); // Not implemented... (yet)
    cmbInterpolation_->setCurrentIndex(tfProperty_->get().getInterpolationType());
    connect(cmbInterpolation_, SIGNAL(currentIndexChanged(int)),
            this, SLOT(switchInterpolationType(int)));
    
    chkShowHistogram_ = new QComboBox();
    chkShowHistogram_->addItem("Histogram: Off");
    chkShowHistogram_->addItem("Histogram: 100%");
    chkShowHistogram_->addItem("Histogram: 99%");
    chkShowHistogram_->addItem("Histogram: 95%");
    chkShowHistogram_->addItem("Histogram: 90%");
    chkShowHistogram_->addItem("Histogram: Log");
    chkShowHistogram_->setCurrentIndex(tfProperty_->getShowHistogram());
    connect(chkShowHistogram_, SIGNAL(currentIndexChanged(int)), this, SLOT(showHistogram(int)));
    
    pointMoveMode_ = new QComboBox();
    pointMoveMode_->addItem("Point Movement: Free");
    pointMoveMode_->addItem("Point Movement: Restrict");
    pointMoveMode_->addItem("Point Movement: Push");
    pointMoveMode_->setCurrentIndex(0);
    connect(pointMoveMode_, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMoveMode(int)));

    colorDialog_ = new QColorDialog(this);
    colorDialog_->hide();
    colorDialog_->setOption(QColorDialog::ShowAlphaChannel, true);
    colorDialog_->setOption(QColorDialog::NoButtons, true);
    colorDialog_->setWindowModality(Qt::NonModal);
    colorDialog_->setWindowTitle(QString::fromStdString(tfProperty_->getDisplayName()));
    connect(colorDialog_, SIGNAL(currentColorChanged(QColor)),
            this, SLOT(setPointColorDialog(QColor)));
    
    QFrame* leftPanel = new QFrame(this);
    QGridLayout* leftLayout = new QGridLayout();
    leftLayout->setContentsMargins(0, 0, 0, 0);
    leftLayout->setSpacing(7);
    leftLayout->addWidget(zoomVSlider_,  0, 0);
    leftLayout->addWidget(tfEditorView_, 0, 1);
    leftLayout->addWidget(zoomHSlider_,  1, 1);
    leftLayout->addWidget(tfPreview_,    2, 1);
    leftLayout->addWidget(maskSlider_,   3, 1);
    leftPanel->setLayout(leftLayout);
    
    QFrame* rightPanel = new QFrame(this);
    QVBoxLayout* rightLayout = new QVBoxLayout();
    rightLayout->setContentsMargins(0, 0, 0, 0);
    rightLayout->setSpacing(7);
    rightLayout->setAlignment(Qt::AlignTop);
    rightLayout->addWidget(colorWheel_);
    rightLayout->addWidget(cmbInterpolation_);
    rightLayout->addWidget(chkShowHistogram_);
    rightLayout->addWidget(pointMoveMode_);
    rightLayout->addStretch(3);
    QHBoxLayout* rowLayout = new QHBoxLayout();
    rowLayout->addWidget(btnClearTF_);
    rowLayout->addWidget(btnImportTF_);
    rowLayout->addWidget(btnExportTF_);
    rightLayout->addLayout(rowLayout);


    rightPanel->setLayout(rightLayout);
    
    QWidget* mainPanel = new QWidget(this);
    QHBoxLayout* mainLayout = new QHBoxLayout();
    mainLayout->setContentsMargins(7, 7, 7, 7);
    mainLayout->setSpacing(7);
    mainLayout->addWidget(leftPanel);
    mainLayout->addWidget(rightPanel);
    mainPanel->setLayout(mainLayout);
    
    setWidget(mainPanel);
    connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
            this, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
    
    initialize(tfProperty_);
    setFloating(true);
    setVisible(false);
}
Exemplo n.º 12
0
void QtEmuGL::mouseDoubleClickEvent(QMouseEvent *)
{
	emit doubleClick();
}
Exemplo n.º 13
0
void TextField::enterEditMode()
{
    QMouseEvent doubleClick(QEvent::MouseButtonDblClick, QPointF(), Qt::LeftButton, 0, 0);
    QApplication::sendEvent(editBox, &doubleClick);
}
Exemplo n.º 14
0
void GraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
{
    QMouseEvent* me = new QMouseEvent(QEvent::MouseButtonDblClick, (event->pos() / parent->contentsScale()).toPoint(), event->button(), event->buttons(), 0);
    emit doubleClick(event->pos().x(), event->pos().y());
    delete me;
}
Exemplo n.º 15
0
void gameLoop() {
    col_s = getColumns();
    row_s = getRows();
    initRenderBuffer();
    int sx = col_s * 32;
    int sy = row_s * 32;
    win = SDL_CreateWindow("ProxySweep", 100, 100, sx, sy, SDL_WINDOW_SHOWN);
    SDL_PTR_ERR(__LINE__, win);
    ren = NULL;
    ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    SDL_PTR_ERR(__LINE__, ren);
    SDL_SetRenderDrawColor(ren, 0, 127, 127, 255);
    initTextures();
    SDL_Event e;
    int quit = 0;
    Uint32 ticks = 0;
    int game_state = ONGOING;
    board = getPointer();
    while (!quit) {
        while (SDL_PollEvent(&e)) {
            if (e.type == SDL_QUIT)
                quit = true;
            if (e.type == SDL_MOUSEBUTTONDOWN) {
                int x, y;
                Uint32 s = SDL_GetMouseState(&x, &y);
                int col = x/32;
                int row = y/32;
                if (s & SDL_BUTTON(1)) {
                    if (SDL_GetTicks() - ticks < CLICK_DELAY)
                        game_state = doubleClick(col, row);
                    else {
                        game_state = buttonPressed(col, row, LEFT);
                    }
                    ticks = SDL_GetTicks();
                }
                else if (s & SDL_BUTTON(3)) {
                    //right button
                    game_state = buttonPressed(col, row, RIGHT);
                }
            }
        }
        board = getPointer();
        renderBoard();
        switch (game_state) {
            case GAME_END_SUCCESS:
                printf("You won :)\n");
                showMessage("YOU WIN!!!", "Congratulations");
                quit = 1;
                break;
            case GAME_END_FAIL:
                printf("You lost :(\n");
                showMessage("YOU LOSE!!!", "I'm Sorry...");
                quit = 1;
                break;
            case ONGOING:
                //printf("Ongoing..\n");
                break;
        }
    }
    while (SDL_PollEvent(&e));
    freeRenderBuffer();
    SDL_DestroyWindow(win);
}
Exemplo n.º 16
0
void VideoWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
    emit doubleClick();

    Q_UNUSED(event);
}
Exemplo n.º 17
0
bool MainUI::event(QEvent *e)
{
    TouchInput input;
    QList<QTouchEvent::TouchPoint> touchPoints;
    switch(e->type())
    {
    case QEvent::TouchBegin:
    case QEvent::TouchUpdate:
    case QEvent::TouchEnd:
        touchPoints = static_cast<QTouchEvent *>(e)->touchPoints();
        foreach (const QTouchEvent::TouchPoint &touchPoint, touchPoints) {
            switch (touchPoint.state()) {
            case Qt::TouchPointStationary:
                break;
            case Qt::TouchPointPressed:
            case Qt::TouchPointReleased:
                input_state.pointer_down[touchPoint.id()] = (touchPoint.state() == Qt::TouchPointPressed);
                input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale * xscale;
                input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale * yscale;

                input.x = touchPoint.pos().x() * g_dpi_scale * xscale;
                input.y = touchPoint.pos().y() * g_dpi_scale * yscale;
                input.flags = (touchPoint.state() == Qt::TouchPointPressed) ? TOUCH_DOWN : TOUCH_UP;
                input.id = touchPoint.id();
                NativeTouch(input);
                break;
            case Qt::TouchPointMoved:
                input_state.pointer_x[touchPoint.id()] = touchPoint.pos().x() * g_dpi_scale * xscale;
                input_state.pointer_y[touchPoint.id()] = touchPoint.pos().y() * g_dpi_scale * yscale;

                input.x = touchPoint.pos().x() * g_dpi_scale * xscale;
                input.y = touchPoint.pos().y() * g_dpi_scale * yscale;
                input.flags = TOUCH_MOVE;
                input.id = touchPoint.id();
                NativeTouch(input);
                break;
            default:
                break;
            }
        }
        break;
    case QEvent::MouseButtonDblClick:
        if (!g_Config.bShowTouchControls || GetUIState() != UISTATE_INGAME)
            emit doubleClick();
        break;
    case QEvent::MouseButtonPress:
    case QEvent::MouseButtonRelease:
        input_state.pointer_down[0] = (e->type() == QEvent::MouseButtonPress);
        input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;

        input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;
        input.flags = (e->type() == QEvent::MouseButtonPress) ? TOUCH_DOWN : TOUCH_UP;
        input.id = 0;
        NativeTouch(input);
        break;
    case QEvent::MouseMove:
        input_state.pointer_x[0] = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input_state.pointer_y[0] = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;

        input.x = ((QMouseEvent*)e)->pos().x() * g_dpi_scale * xscale;
        input.y = ((QMouseEvent*)e)->pos().y() * g_dpi_scale * yscale;
        input.flags = TOUCH_MOVE;
        input.id = 0;
        NativeTouch(input);
        break;
    case QEvent::Wheel:
        NativeKey(KeyInput(DEVICE_ID_MOUSE, ((QWheelEvent*)e)->delta()<0 ? NKCODE_EXT_MOUSEWHEEL_DOWN : NKCODE_EXT_MOUSEWHEEL_UP, KEY_DOWN));
        break;
    case QEvent::KeyPress:
        NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KEY_DOWN));
        break;
    case QEvent::KeyRelease:
        NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(((QKeyEvent*)e)->key())->second, KEY_UP));
        break;
    default:
        return QWidget::event(e);
    }
    e->accept();
    return true;
}
Exemplo n.º 18
0
void DrawArea::mouseDoubleClickEvent(QMouseEvent* /*event*/)
{
    doubleClick();
}
Exemplo n.º 19
0
void AbstractNoteHead::mouseDoubleClickEvent(QMouseEvent *)
{
    emit doubleClick();
}
Exemplo n.º 20
0
void ServiceItem::mouseDoubleClickEvent( QMouseEvent *event )
{
    emit doubleClick( this->service );
    event->accept();
}
Exemplo n.º 21
0
DeviceView::DeviceView(Device *dev, QWidget *parent) :
    QFrame(parent)
{
    _dev = dev;
    _blinking = false;
    connect(_dev, SIGNAL(changed()), this, SLOT(onDevChanged()));
    connect(this, SIGNAL(doubleClick()), this, SLOT(onSettingsClick()));

    QColor color = palette().window().color();
    setStyleSheet("QFrame {background: rgb("+QString::number(color.red())+", "+QString::number(color.green())+", "+QString::number(color.blue())+"); }");

    setFrameStyle(QFrame::Panel | QFrame::Sunken);
    setLineWidth(1);

    QHBoxLayout *hlayout = new QHBoxLayout();
    setLayout(hlayout);

    hlayout->addStretch(1);

    QIcon icon;
    switch(dev->type()){
        case Device::ChapiDev:          icon.addFile(QStringLiteral(":/icons/imgs/chapi.png"), QSize(), QIcon::Normal, QIcon::Off); break;
        case Device::ChapiServer:       icon.addFile(QStringLiteral(":/icons/imgs/server.png"), QSize(), QIcon::Normal, QIcon::Off); break;
        case Device::VideoHub:          icon.addFile(QStringLiteral(":/icons/imgs/vh.png"), QSize(), QIcon::Normal, QIcon::Off); break;
        case Device::Atem:              icon.addFile(QStringLiteral(":/icons/imgs/atem.png"), QSize(), QIcon::Normal, QIcon::Off); break;
        case Device::Router:            icon.addFile(QStringLiteral(":/icons/imgs/router.png"), QSize(), QIcon::Normal, QIcon::Off); break;
        default:
            icon.addFile(QStringLiteral(":/icons/imgs/other.png"), QSize(), QIcon::Normal, QIcon::Off);
            break;
    }
    QClickableLabel *clickableLabel = new QClickableLabel();
    connect(clickableLabel, SIGNAL(doubleClick()), this, SLOT(onNameDoubleClick()));
    clickableLabel->setPixmap(icon.pixmap(32, 32));
    hlayout->addWidget(clickableLabel);

    _name = new QClickableLabel();
    connect(_name, SIGNAL(doubleClick()), this, SLOT(onNameDoubleClick()));
    QFont font(_name->font());
    font.setBold(true);
    _name->setFont(font);
    hlayout->addWidget(_name);

    hlayout->addStretch(1);

    _statusIcon = new QLabel();
    hlayout->addWidget(_statusIcon);

    if(_dev->isMonitorable()) {
        _monitorBtn = new QPushButton();
        _monitorBtn->setCheckable(true);
        _monitorBtn->setAutoDefault(false);
        _monitorBtn->setEnabled(false); //Not implemented
        QIcon icon2;
        icon2.addFile(QStringLiteral(":/icons/imgs/monitor.png"), QSize(), QIcon::Normal, QIcon::Off);
        _monitorBtn->setIcon(icon2);
        _monitorBtn->setIconSize(QSize(24,24));
        _monitorBtn->setToolTip("Surveiller le périphérique");
        hlayout->addWidget(_monitorBtn);
        connect(_monitorBtn, SIGNAL(clicked()), this, SLOT(onMonitorClick()));
    }
    else {
        hlayout->addSpacerItem(new QSpacerItem(42, 24));
    }

    if(_dev->isConfigurable()) {
        _settingsBtn = new QPushButton();
        _settingsBtn->setAutoDefault(false);
        QIcon icon3;
        icon3.addFile(QStringLiteral(":/icons/imgs/settings.png"), QSize(), QIcon::Normal, QIcon::Off);
        _settingsBtn->setIcon(icon3);
        _settingsBtn->setIconSize(QSize(24,24));
        hlayout->addWidget(_settingsBtn);
        _settingsBtn->setToolTip("Configurer le périphérique");
        connect(_settingsBtn, SIGNAL(clicked()), this, SLOT(onSettingsClick()));
    }
    else {
        hlayout->addSpacerItem(new QSpacerItem(42, 24));
    }

    if(_dev->isUpdatable()) {
        _updateBtn = new QPushButton();
        _updateBtn->setAutoDefault(false);
        QIcon icon4;
        icon4.addFile(QStringLiteral(":/icons/imgs/monitor.png"), QSize(), QIcon::Normal, QIcon::Off);
        _updateBtn->setIcon(icon4);
        _updateBtn->setIconSize(QSize(24,24));
        hlayout->addWidget(_updateBtn);
        _updateBtn->setToolTip("Mettre à jour");
        connect(_updateBtn, SIGNAL(clicked()), this, SLOT(onUpdateClick()));
    }
    else {
        hlayout->addSpacerItem(new QSpacerItem(42, 24));
    }

    if(_dev->isIdentifiable()) {
        _blinkBtn = new QPushButton();
        _blinkBtn->setAutoDefault(false);
        QIcon icon4;
        icon4.addFile(QStringLiteral(":/icons/imgs/blink.png"), QSize(), QIcon::Normal, QIcon::Off);
        _blinkBtn->setIcon(icon4);
        _blinkBtn->setIconSize(QSize(24,24));
        hlayout->addWidget(_blinkBtn);
        _blinkBtn->setToolTip("Faire clignoter le périphérique");
        connect(_blinkBtn, SIGNAL(clicked()), this, SLOT(onBlinkClick()));
    }
    else {
        hlayout->addSpacerItem(new QSpacerItem(42, 24));
    }

    onDevChanged();
}
Exemplo n.º 22
0
void DeviceView::mouseDoubleClickEvent(QMouseEvent * event){
    QFrame::mouseDoubleClickEvent(event);
    emit doubleClick();
}
Exemplo n.º 23
0
void ProgressBar::mouseDoubleClickEvent(QMouseEvent *e)
{
    QWidget::mouseDoubleClickEvent(e);
    emit doubleClick();
}
Exemplo n.º 24
0
void TPanelTitleBar::mouseDoubleClickEvent(QMouseEvent *me) {
  emit doubleClick(me);
  me->ignore();
}
Exemplo n.º 25
0
    MainWindow::MainWindow(QApplication* app)
		: main_page_(nullptr)
		, login_page_(nullptr)
#ifdef __APPLE__
        , accounts_page_(nullptr)
#endif //_APPLE__
		, app_(app)
		, event_filter_(new TitleWidgetEventFilter(this))
		, tray_icon_(new TrayIcon(this))
                , backgroundPixmap_(QPixmap())
        , Shadow_(0)
        , SkipRead_(false)
        , TaskBarIconHidden_(false)
        , liveChats_(new LiveChats(this))
	{
        Utils::InterConnector::instance().setMainWindow(this);

#ifdef _WIN32
        Utils::init_crash_handlers_in_core();
        core::dump::crash_handler chandler;
        chandler.set_process_exception_handlers();
        chandler.set_thread_exception_handlers();
#endif //_WIN32

		setStyleSheet(Utils::LoadStyle(":/main_window/main_window.qss", Utils::get_scale_coefficient(), true));
#ifdef __APPLE__
        mac_support_ = new MacSupport(this);
        mac_support_->enableMacCrashReport();
#endif

        app_->installNativeEventFilter(this);

        if (this->objectName().isEmpty())
            this->setObjectName(QStringLiteral("main_window"));
        this->resize(329, 331);
        QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
        sizePolicy.setHorizontalStretch(0);
        sizePolicy.setVerticalStretch(0);
        sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
        this->setSizePolicy(sizePolicy);
        this->setLayoutDirection(Qt::LeftToRight);
        this->setAutoFillBackground(false);
        main_widget_ = new QWidget(this);
        main_widget_->setObjectName(QStringLiteral("main_widget"));
        sizePolicy.setHeightForWidth(main_widget_->sizePolicy().hasHeightForWidth());
        main_widget_->setSizePolicy(sizePolicy);
        vertical_layout_ = new QVBoxLayout(main_widget_);
        vertical_layout_->setSpacing(0);
        vertical_layout_->setObjectName(QStringLiteral("verticalLayout_9"));
        vertical_layout_->setSizeConstraint(QLayout::SetDefaultConstraint);
        vertical_layout_->setContentsMargins(0, 0, 0, 0);
        title_widget_ = new QWidget(main_widget_);
        title_widget_->setObjectName(QStringLiteral("title_widget"));
        QSizePolicy sizePolicy1(QSizePolicy::Preferred, QSizePolicy::Fixed);
        sizePolicy1.setHorizontalStretch(0);
        sizePolicy1.setVerticalStretch(0);
        sizePolicy1.setHeightForWidth(title_widget_->sizePolicy().hasHeightForWidth());
        title_widget_->setSizePolicy(sizePolicy1);
        title_widget_->setProperty("TitleWidget", QVariant(true));
        horizontal_layout_ = new QHBoxLayout(title_widget_);
        horizontal_layout_->setSpacing(0);
        horizontal_layout_->setObjectName(QStringLiteral("horizontalLayout"));
        horizontal_layout_->setContentsMargins(0, 0, 0, 0);
        logo_ = new QPushButton(title_widget_);
        logo_->setObjectName(QStringLiteral("logo"));
        QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed);
        sizePolicy2.setHorizontalStretch(0);
        sizePolicy2.setVerticalStretch(0);
        sizePolicy2.setHeightForWidth(logo_->sizePolicy().hasHeightForWidth());
        logo_->setSizePolicy(sizePolicy2);
        logo_->setProperty("WindowIcon", QVariant(true));
        horizontal_layout_->addWidget(logo_);
        title_ = new QLabel(title_widget_);
        title_->setObjectName(QStringLiteral("title"));
        title_->setProperty("Title", QVariant(true));
        horizontal_layout_->addWidget(title_);
        horizontal_spacer_ = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        horizontal_layout_->addItem(horizontal_spacer_);
        hide_button_ = new QPushButton(title_widget_);
        hide_button_->setObjectName(QStringLiteral("hide_button"));
        hide_button_->setProperty("HideButton", QVariant(true));
        horizontal_layout_->addWidget(hide_button_);
        maximize_button_ = new QPushButton(title_widget_);
        maximize_button_->setObjectName(QStringLiteral("maximize_button"));
        sizePolicy2.setHeightForWidth(maximize_button_->sizePolicy().hasHeightForWidth());
        maximize_button_->setSizePolicy(sizePolicy2);
        maximize_button_->setProperty("MaximizeButton", QVariant(true));
        horizontal_layout_->addWidget(maximize_button_);
        close_button_ = new QPushButton(title_widget_);
        close_button_->setObjectName(QStringLiteral("close_button"));
        sizePolicy2.setHeightForWidth(close_button_->sizePolicy().hasHeightForWidth());
        close_button_->setSizePolicy(sizePolicy2);
        close_button_->setProperty("CloseButton", QVariant(true));
        horizontal_layout_->addWidget(close_button_);
        vertical_layout_->addWidget(title_widget_);
        stacked_widget_ = new BackgroundWidget(main_widget_, "");
        stacked_widget_->setObjectName(QStringLiteral("stacked_widget"));

        QPixmap p(":/resources/main_window/pat_100.png");
        setBackgroundPixmap(p, true);

        //Utils::InterConnector::instance().setMainWindow(this);
        get_qt_theme_settings()->setOrLoadDefaultTheme();
        vertical_layout_->addWidget(stacked_widget_);
        this->setCentralWidget(main_widget_);

        logo_->setText(QString());
        hide_button_->setText(QString());
        maximize_button_->setText(QString());
        close_button_->setText(QString());

        stacked_widget_->setCurrentIndex(-1);
        QMetaObject::connectSlotsByName(this);

        if (!get_gui_settings()->get_value(settings_keep_logged_in, true))// || !get_gui_settings()->contains_value(settings_keep_logged_in))
        {
            showLoginPage();
        }
        else
        {
            showMainPage();
        }

		title_widget_->installEventFilter(event_filter_);
		title_->setText("ICQ");
		title_->setAttribute(Qt::WA_TransparentForMouseEvents);
		logo_->setAttribute(Qt::WA_TransparentForMouseEvents);

		setWindowTitle("ICQ");
#ifdef _WIN32
        setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::WindowMinimizeButtonHint);
        fake_parent_window_ = Utils::create_fake_parent_window();
#else
        title_widget_->hide();
#endif

		title_->setMouseTracking(true);

		connect(hide_button_, SIGNAL(clicked()), this, SLOT(minimize()), Qt::QueuedConnection);
		connect(maximize_button_, SIGNAL(clicked()), this, SLOT(maximize()), Qt::QueuedConnection);
		connect(close_button_, SIGNAL(clicked()), this, SLOT(hideWindow()), Qt::QueuedConnection);

		hide_button_->setCursor(Qt::PointingHandCursor);
		maximize_button_->setCursor(Qt::PointingHandCursor);
		close_button_->setCursor(Qt::PointingHandCursor);

		connect(event_filter_, SIGNAL(doubleClick()), this, SLOT(maximize()), Qt::QueuedConnection);
		connect(event_filter_, SIGNAL(moveRequest(QPoint)), this, SLOT(moveRequest(QPoint)), Qt::QueuedConnection);

        connect(&Ui::GetDispatcher()->getVoipController(), SIGNAL(onVoipResetComplete()), this, SLOT(onVoipResetComplete()), Qt::QueuedConnection);

		connect(Ui::GetDispatcher(), SIGNAL(needLogin()), this, SLOT(showLoginPage()), Qt::DirectConnection);
		connect(&Utils::InterConnector::instance(), SIGNAL(showIconInTaskbar(bool)), this, SLOT(showIconInTaskbar(bool)), Qt::QueuedConnection);

        connect(this, SIGNAL(needActivate()), this, SLOT(activate()), Qt::QueuedConnection);

        connect(get_gui_settings(), SIGNAL(changed(QString)), this, SLOT(guiSettingsChanged(QString)), Qt::QueuedConnection);

		QFont f = QApplication::font();
		f.setStyleStrategy(QFont::PreferAntialias);
		QApplication::setFont(f);

        if (platform::is_windows())
        {
            int shadowWidth = get_gui_settings()->get_shadow_width();
            QBrush b = stacked_widget_->palette().background();
            QMatrix m;
            m.translate(shadowWidth, title_widget_->height() + shadowWidth);
            b.setMatrix(m);
            Shadow_ = new ShadowWindow(b, shadowWidth);
            QPoint pos = mapToGlobal(QPoint(rect().x(), rect().y()));
            Shadow_->move(pos.x(), pos.y());
            Shadow_->resize(rect().width(), rect().height());
            Shadow_->setActive(true);
            Shadow_->show();
        }

        initSettings();
#ifdef _WIN32
        DragAcceptFiles((HWND)winId(), TRUE);
#endif //_WIN32

        if (!get_gui_settings()->get_value<bool>(settings_show_in_taskbar, true))
            hide_taskbar_icon();

#ifdef __APPLE__
        mac_support_->enableMacUpdater();
        mac_support_->enableMacPreview(this->winId());
#endif

	}
Exemplo n.º 26
0
void QtEmuGL::mouseDoubleClickEvent(QMouseEvent *)
{
	if (!g_Config.bShowTouchControls || globalUIState != UISTATE_INGAME)
		emit doubleClick();
}