// ------------------------------------------------------------------------ void MainWindow::setUpSignals() { // image control slots connect(this->imageList->getImageList(), SIGNAL(itemSelectionChanged()), this, SLOT(imageSelectionChanged())); connect(this->zSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderSelectionChanged())); connect(this->tSlider, SIGNAL(valueChanged(int)), this, SLOT(sliderSelectionChanged())); // button slots connect(this->addLineButton, SIGNAL(pressed()), this, SLOT(addLinePressed())); connect(this->removeLineButton, SIGNAL(pressed()), this, SLOT(removeLinePressed())); connect(this->propagateLineButton, SIGNAL(pressed()), this, SLOT(propagateLinePressed())); connect(this->lockLineButton, SIGNAL(pressed()), this, SLOT(lockLine())); connect(this->lineList->getWidget(), SIGNAL(itemSelectionChanged()), this, SLOT(lineChanged())); connect(this->controls, SIGNAL(rightPressed()), this, SLOT(tSliderRight())); connect(this->controls, SIGNAL(leftPressed()), this, SLOT(tSliderLeft())); connect(this->controls, SIGNAL(lockPressed()), this, SLOT(lockLine())); connect(this->controls, SIGNAL(propagatePressed()), this, SLOT(propagateLinePressed())); connect(this->imageTypeButton, SIGNAL(pressed()), this, SLOT(imageTypePressed())); // connect the load and save connect(this->saveAction, SIGNAL(triggered()), this, SLOT(saveActionPressed())); connect(this->newAction, SIGNAL(triggered()), this, SLOT(newActionPressed())); connect(this->loadAction, SIGNAL(triggered()), this, SLOT(loadActionPressed())); connect(this->saveAsAction, SIGNAL(triggered()), this, SLOT(saveAsActionPressed())); connect(this->processDicomAction, SIGNAL(triggered()), this, SLOT(processDicomPressed())); connect(this->exportVideos, SIGNAL(triggered()), this, SLOT(exportVideosPressed())); }
void MyDoubleSpinBox::focusInEvent(QFocusEvent *event) { QDoubleSpinBox::focusInEvent(event); QString type = GetType(objectName()); if (type != "text") { if (!slider) { QWidget *topWidget = window(); slider = new cFrameSliderPopup(topWidget); slider->setFocusPolicy(Qt::NoFocus); if (type == QString("spinboxd") || type == QString("spinboxd3") || type == QString("spinboxd4")) { int dialScale = pow(10.0, double(decimals())); slider->SetDialMode(dialScale, value()); hasDial = true; } slider->hide(); } QWidget *topWidget = window(); QPoint windowPoint = mapTo(topWidget, QPoint()); int width = this->width(); int hOffset = height(); slider->adjustSize(); QSize minimumSize = slider->minimumSizeHint(); width = max(width, int(minimumSize.width() * 0.6)); slider->setFixedWidth(width); if (windowPoint.y() + slider->height() + hOffset > topWidget->height()) hOffset = -slider->height(); slider->move(windowPoint.x(), windowPoint.y() + hOffset); slider->show(); connect(slider, SIGNAL(resetPressed()), this, SLOT(slotResetToDefault())); connect(slider, SIGNAL(intPressed()), this, SLOT(slotRoundValue())); if (hasDial) { connect(this, SIGNAL(valueChanged(double)), slider, SLOT(slotUpdateValue(double))); connect(slider, SIGNAL(valueChanged(double)), this, SLOT(setValue(double))); connect(slider, SIGNAL(upPressed()), this, SLOT(slotZeroValue())); connect(slider, SIGNAL(downPressed()), this, SLOT(slot180Value())); connect(slider, SIGNAL(rightPressed()), this, SLOT(slot90Value())); connect(slider, SIGNAL(leftPressed()), this, SLOT(slotMinus90Value())); } else { connect(slider, SIGNAL(timerTrigger()), this, SLOT(slotSliderTimerUpdateValue())); connect(slider, SIGNAL(zeroPressed()), this, SLOT(slotZeroValue())); connect(slider, SIGNAL(halfPressed()), this, SLOT(slotHalfValue())); connect(slider, SIGNAL(doublePressed()), this, SLOT(slotDoubleValue())); connect(slider, SIGNAL(minusPressed()), this, SLOT(slotInvertSign())); } }
void LauncherView::handleItemPressed(const QModelIndex & index) { if(QApplication::mouseButtons () & Qt::RightButton) { icons->setCurrentIndex( index ); emit rightPressed(model->content(index)); } }
EMenuScreen IMenuScreen::run(MainWindow& window, EMenuScreen) { IControllerToMenu* controller = PolyBomberApp::getIControllerToMenu(); EMenuScreen nextScreen = NONEMENU; try { while (nextScreen == NONEMENU) { window.clear(); window.display(this->widgets); loopAction(&nextScreen); window.clear(); window.display(this->widgets); EMenuKeys key = MENU_NONE; while ((key = controller->getKeyPressed()) == MENU_NONE && window.isOpen()); switch(key) { case MENU_DOWN: downPressed(); break; case MENU_UP: upPressed(); break; case MENU_LEFT: leftPressed(); break; case MENU_RIGHT: rightPressed(); break; case MENU_VALID: validPressed(&nextScreen); break; case MENU_BACK: backPressed(&nextScreen); break; default: break; } if (!window.isOpen()) nextScreen = EXIT; } } catch (PolyBomberException& e) { std::cerr << e.what() << std::endl; PolyBomberApp::getINetworkToMenu()->cancel(); nextScreen = GAMEMENU; } return nextScreen; }
void PanelBox::mousePressEvent(QMouseEvent *e) { switch(e->button()) { case Qt::RightButton: emit rightPressed(e->globalPos()); break; default: break; } QComboBox::mousePressEvent(e); }
ApplicationLauncherView::ApplicationLauncherView(QWidget *parent) : LauncherView(parent), rightMenu(0) { QMenu * softMenu = QSoftMenuBar::menuFor(this); rightMenu = new QMenu(this); QAction *a_speed = new QAction(QIcon(":icon/phone/speeddial"), tr("Add to Speed Dial..."), this ); connect( a_speed, SIGNAL(triggered()), this, SLOT(addSpeedDial())); softMenu->addAction(a_speed); rightMenu->addAction(a_speed); QObject::connect(this, SIGNAL(rightPressed(QContent)), this, SLOT(launcherRightPressed(QContent))); setViewMode(QListView::ListMode); }
ApplicationLauncherView::ApplicationLauncherView(const QString &category, QWidget *parent) : LauncherView(parent), rightMenu(0) { QMenu * softMenu = QSoftMenuBar::menuFor(this); rightMenu = new QMenu(this); QAction *a_speed = new QAction(QIcon(":icon/phone/speeddial"), tr("Add to Speed Dial..."), this ); connect( a_speed, SIGNAL(triggered()), this, SLOT(addSpeedDial())); softMenu->addAction(a_speed); rightMenu->addAction(a_speed); QObject::connect(this, SIGNAL(rightPressed(QContent)), this, SLOT(launcherRightPressed(QContent))); QContentFilter filters = (QContentFilter( QContent::Application ) | QContentFilter( QContent::Folder )) & QContentFilter( QContentFilter::Category, category ); contentSet->setCriteria( filters ); }
void RDPushButton::mousePressEvent(QMouseEvent *e) { switch(e->button()) { case Qt::LeftButton: QPushButton::mousePressEvent(e); break; case Qt::MidButton: emit centerPressed(); break; case Qt::RightButton: emit rightPressed(); break; default: break; } }
void AppFilter::whichKey(QEvent* event) { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if(keyEvent->key() == Qt::Key_Left) { emit leftPressed(); } else if(keyEvent->key() == Qt::Key_Up) { emit upPressed(); } else if(keyEvent->key() == Qt::Key_Down) { emit downPressed(); } else if(keyEvent->key() == Qt::Key_Right) { emit rightPressed(); } }
EMenuScreen WaitingMenu::run(MainWindow& window, EMenuScreen) { IControllerToMenu* controller = PolyBomberApp::getIControllerToMenu(); EMenuScreen nextScreen = NONEMENU; try { initWidgets(); sf::Clock clock; while (nextScreen == NONEMENU) { window.clear(); window.display(this->widgets); EMenuKeys key = MENU_NONE; while ((key = controller->getKeyPressed()) == MENU_NONE && window.isOpen()) { // On raffraichit les noms if (clock.getElapsedTime().asMilliseconds() > 250) { clock.restart(); update(); window.clear(); window.display(this->widgets); // On teste si la partie commence if (this->network->isStarted()) { nextScreen = start.activate(); break; } } } switch(key) { case MENU_DOWN: downPressed(); break; case MENU_UP: upPressed(); break; case MENU_LEFT: leftPressed(); break; case MENU_RIGHT: rightPressed(); break; case MENU_VALID: validPressed(&nextScreen); break; case MENU_BACK: backPressed(&nextScreen); break; default: break; } if (!window.isOpen()) nextScreen = EXIT; } } catch(PolyBomberException& e) { std::cerr << e.what() << std::endl; this->network->cancel(); nextScreen = GAMEMENU; } return nextScreen; }
MeasurePanel::MeasurePanel(const QString &title, QWidget *parent, TraceManager *trace_manager, const SweepSettings *sweep_settings) : DockPanel(title, parent), trace_manager_ptr(trace_manager), settings_ptr(sweep_settings) { DockPage *trace_page = new DockPage("Traces"); DockPage *marker_page = new DockPage("Markers"); DockPage *offset_page = new DockPage("Offsets"); channel_power_page = new DockPage("Channel Power"); occupied_bandwidth_page = new DockPage("Occupied Bandwidth"); QStringList string_list; trace_select = new ComboEntry("Trace"); trace_type = new ComboEntry("Type"); trace_avg_count = new NumericEntry("Avg Count", 10, ""); trace_color = new ColorEntry("Color"); //trace_active = new CheckBoxEntry("Active"); trace_updating = new CheckBoxEntry("Update"); export_clear = new DualButtonEntry("Export", "Clear"); string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six"; trace_select->setComboText(string_list); string_list.clear(); // Must match TraceType enum list string_list << "Off" << "Clear & Write" << "Max Hold" << "Min Hold" << "Min/Max Hold" << "Average"; trace_type->setComboText(string_list); string_list.clear(); trace_page->AddWidget(trace_select); trace_page->AddWidget(trace_type); trace_page->AddWidget(trace_avg_count); trace_page->AddWidget(trace_color); trace_page->AddWidget(trace_updating); trace_page->AddWidget(export_clear); AppendPage(trace_page); connect(trace_select, SIGNAL(comboIndexChanged(int)), this, SLOT(updateTraceView(int))); connect(trace_type, SIGNAL(comboIndexChanged(int)), trace_manager_ptr, SLOT(setType(int))); connect(trace_avg_count, SIGNAL(valueChanged(double)), trace_manager_ptr, SLOT(setAvgCount(double))); connect(trace_color, SIGNAL(colorChanged(QColor&)), trace_manager_ptr, SLOT(setColor(QColor&))); connect(trace_updating, SIGNAL(clicked(bool)), trace_manager_ptr, SLOT(setUpdate(bool))); connect(export_clear, SIGNAL(leftPressed()), trace_manager_ptr, SLOT(exportTrace())); connect(export_clear, SIGNAL(rightPressed()), trace_manager_ptr, SLOT(clearTrace())); // Marker stuff marker_select = new ComboEntry("Marker"); on_trace_select = new ComboEntry("Place On"); setMarkerFreq = new FrequencyEntry("Set Freq", 1.0e6); marker_update = new CheckBoxEntry("Update"); marker_active = new CheckBoxEntry("Active"); peak_delta = new DualButtonEntry("Peak Search", "Delta"); to_center_ref = new DualButtonEntry("To Center", "To Ref"); peak_left_right = new DualButtonEntry("Peak Left", "Peak Right"); string_list << "One" << "Two" << "Three" << "Four" << "Five" << "Six"; marker_select->setComboText(string_list); string_list.clear(); string_list << "Trace One" << "Trace Two" << "Trace Three" << "Trace Four" << "Trace Five" << "Trace Six"; on_trace_select->setComboText(string_list); string_list.clear(); marker_page->AddWidget(marker_select); marker_page->AddWidget(on_trace_select); marker_page->AddWidget(setMarkerFreq); marker_page->AddWidget(marker_update); marker_page->AddWidget(marker_active); marker_page->AddWidget(peak_delta); marker_page->AddWidget(to_center_ref); marker_page->AddWidget(peak_left_right); AppendPage(marker_page); connect(marker_select, SIGNAL(comboIndexChanged(int)), this, SLOT(updateMarkerView(int))); connect(on_trace_select, SIGNAL(comboIndexChanged(int)), trace_manager_ptr, SLOT(setMarkerOnTrace(int))); connect(setMarkerFreq, SIGNAL(freqViewChanged(Frequency)), this, SLOT(setMarkerFrequencyChanged(Frequency))); connect(marker_update, SIGNAL(clicked(bool)), trace_manager_ptr, SLOT(markerUpdate(bool))); connect(marker_active, SIGNAL(clicked(bool)), trace_manager_ptr, SLOT(markerActive(bool))); connect(peak_delta, SIGNAL(leftPressed()), trace_manager_ptr, SLOT(markerPeakSearch())); connect(peak_delta, SIGNAL(rightPressed()), trace_manager_ptr, SLOT(markerDeltaClicked())); connect(to_center_ref, SIGNAL(leftPressed()), trace_manager_ptr, SLOT(markerToCenter())); connect(to_center_ref, SIGNAL(rightPressed()), trace_manager_ptr, SLOT(markerToRef())); connect(peak_left_right, SIGNAL(leftPressed()), trace_manager_ptr, SLOT(markerPeakLeft())); connect(peak_left_right, SIGNAL(rightPressed()), trace_manager_ptr, SLOT(markerPeakRight())); ref_offset = new NumericEntry("Ref Offset", trace_manager_ptr->RefOffset(), "dB"); offset_page->AddWidget(ref_offset); AppendPage(offset_page); connect(ref_offset, SIGNAL(valueChanged(double)), trace_manager_ptr, SLOT(setRefOffset(double))); channel_width = new FrequencyEntry("Width", 20.0e6); channel_spacing = new FrequencyEntry("Spacing", 20.0e6); channel_power_enabled = new CheckBoxEntry("Enabled"); channel_power_page->AddWidget(channel_width); channel_power_page->AddWidget(channel_spacing); channel_power_page->AddWidget(channel_power_enabled); AppendPage(channel_power_page); connect(channel_width, SIGNAL(freqViewChanged(Frequency)), this, SLOT(channelPowerUpdated())); connect(channel_spacing, SIGNAL(freqViewChanged(Frequency)), this, SLOT(channelPowerUpdated())); connect(channel_power_enabled, SIGNAL(clicked(bool)), this, SLOT(channelPowerUpdated())); ocbw_enabled = new CheckBoxEntry("Enabled"); percentPower = new NumericEntry("% Power", 0.0, ""); percentPower->SetValue(99.0); occupied_bandwidth_page->AddWidget(ocbw_enabled); occupied_bandwidth_page->AddWidget(percentPower); AppendPage(occupied_bandwidth_page); connect(ocbw_enabled, SIGNAL(clicked(bool)), SLOT(occupiedBandwidthUpdated())); connect(percentPower, SIGNAL(valueChanged(double)), SLOT(occupiedBandwidthUpdated())); // Done connected DockPages to TraceManager updateTraceView(0); updateMarkerView(0); // Miscellaneous connects connect(trace_manager_ptr, SIGNAL(updated()), this, SLOT(updateTraceView())); connect(trace_manager_ptr, SIGNAL(updated()), this, SLOT(updateMarkerView())); }