bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e) { switch (e->type()) { case QEvent::ShortcutOverride: if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) d->m_escapePressed = true; break; case QEvent::KeyPress: if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) d->m_escapePressed = true; if (d->m_model->size() > 1) { QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (ke->key() == Qt::Key_Up) { previousPage(); return true; } else if (ke->key() == Qt::Key_Down) { nextPage(); return true; } return false; } break; case QEvent::KeyRelease: if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape && d->m_escapePressed) { abort(); return false; } d->m_assistant->notifyChange(); break; case QEvent::WindowDeactivate: case QEvent::FocusOut: if (obj != d->m_underlyingWidget) break; abort(); break; case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::Wheel: { QWidget *widget = qobject_cast<QWidget *>(obj); if (!d->m_popupFrame->isAncestorOf(widget)) { abort(); } else if (e->type() == QEvent::Wheel) { if (static_cast<QWheelEvent*>(e)->delta() > 0) previousPage(); else nextPage(); return true; } } break; default: break; } return false; }
// ------------------ // HintProposalWidget // ------------------ FunctionHintProposalWidget::FunctionHintProposalWidget() : d(new FunctionHintProposalWidgetPrivate) { QToolButton *downArrow = new QToolButton; downArrow->setArrowType(Qt::DownArrow); downArrow->setFixedSize(16, 16); downArrow->setAutoRaise(true); QToolButton *upArrow = new QToolButton; upArrow->setArrowType(Qt::UpArrow); upArrow->setFixedSize(16, 16); upArrow->setAutoRaise(true); QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager); pagerLayout->setMargin(0); pagerLayout->setSpacing(0); pagerLayout->addWidget(upArrow); pagerLayout->addWidget(d->m_numberLabel); pagerLayout->addWidget(downArrow); QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame); popupLayout->setMargin(0); popupLayout->setSpacing(0); popupLayout->addWidget(d->m_pager); popupLayout->addWidget(d->m_hintLabel); connect(upArrow, SIGNAL(clicked()), SLOT(previousPage())); connect(downArrow, SIGNAL(clicked()), SLOT(nextPage())); qApp->installEventFilter(this); setFocusPolicy(Qt::NoFocus); }
void searchTab::mouseReleaseEvent(QMouseEvent *e) { if (e->button() == Qt::XButton1) { previousPage(); } else if (e->button() == Qt::XButton2) { nextPage(); } }
UBWebPluginPDFWidget::UBWebPluginPDFWidget(const QUrl &url, QWidget *parent) : UBWebPluginWidget(url, parent) , mPreviousPageButton(this) , mNextPageButton(this) , mPreviousPageAction(0) , mNextPageAction(0) , mRenderer(0) , mScale(1.5) , mPageNumber(1) { QIcon previousPageIcon; QIcon nextPageIcon; previousPageIcon.addFile(":/images/toolbar/previousPage.png", QSize(32, 32), QIcon::Normal); nextPageIcon.addFile(":/images/toolbar/nextPage.png", QSize(32, 32), QIcon::Normal); mPreviousPageAction = new QAction(previousPageIcon, QString(), this); mNextPageAction = new QAction(nextPageIcon, QString(), this); connect(mPreviousPageAction, SIGNAL(triggered()), this, SLOT(previousPage())); connect(mNextPageAction, SIGNAL(triggered()), this, SLOT(nextPage())); mPreviousPageButton.setFixedSize(32, 32); mNextPageButton.setFixedSize(32, 32); mPreviousPageButton.setDefaultAction(mPreviousPageAction); mNextPageButton.setDefaultAction(mNextPageAction); mNextPageButton.move(mPreviousPageButton.x() + mPreviousPageButton.width() + 10, mNextPageButton.y()); }
void EPlaybackWing::applyExtraButtons(const QByteArray& data) { /* Check that there's enough data for flags */ if (data.size() < EWING_PLAYBACK_BYTE_EXTRA_BUTTONS + 1) return; if (!(data[EWING_PLAYBACK_BYTE_EXTRA_BUTTONS] & EWING_PLAYBACK_BIT_PAGEUP)) { nextPage(); sendPageData(); } else if (!(data[EWING_PLAYBACK_BYTE_EXTRA_BUTTONS] & EWING_PLAYBACK_BIT_PAGEDOWN)) { previousPage(); sendPageData(); } else if (!(data[EWING_PLAYBACK_BYTE_EXTRA_BUTTONS] & EWING_PLAYBACK_BIT_BACK)) { /** @todo */ } else if (!(data[EWING_PLAYBACK_BYTE_EXTRA_BUTTONS] & EWING_PLAYBACK_BIT_GO)) { /** @todo */ } }
void GUIManager::sideBarGUIEvent(ofxUIEventArgs &e) //---------------- Top bar { string name = e.widget->getName(); if (name == SIDE_AUTO_SAVE) { ofxUIToggle *toggle = (ofxUIToggle *)e.widget; isAutoSave = toggle->getValue(); } else if (name == SIDE_SAVE) { saveSettings(); } else if (name == SIDE_NEXT) { ofxUIButton *button = (ofxUIButton *)e.widget; if (button->getValue()) nextPage(); } else if (name == SIDE_PREVIOUS) { ofxUIButton *button = (ofxUIButton *)e.widget; if (button->getValue()) previousPage(); } else { for (int i = 0; i < (int)guiPages.size(); i++) if (name == guiPages[i]->getName()) currentUIID = i; showGUI(name); } }
void LibraryPageHandler::previousPageReleased() { if(previousPageTimer.isActive() && !m_lastPageLaunched) { previousPageTimer.stop(); previousPage(); } m_firstPageLaunched = false; }
SettingsGeneralTermsInfo::SettingsGeneralTermsInfo(QWidget* parent) : FullScreenWidget(parent){ qDebug() << "--->" << Q_FUNC_INFO; setupUi(this); connect(backBtn,SIGNAL(clicked()),this, SIGNAL(hideMe())); connect(verticalPage, SIGNAL(previousPageReq()), this , SLOT(previousPage())); connect(verticalPage, SIGNAL(nextPageReq()), this, SLOT(nextPage())); generalTermsResult->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); vbar = generalTermsResult->verticalScrollBar(); }
BrowserPageSlider::BrowserPageSlider(QWidget *parent) : QFrame(parent) { setupUi(this); connect(label, SIGNAL(clicked()), this, SIGNAL(buttonClicked())); connect(QBookApp::instance(),SIGNAL(swipe(int)),this,SLOT(handleSwipe(int))); connect(downPageBtn, SIGNAL(clicked()), this, SLOT(nextPage())); connect(upPageBtn, SIGNAL(clicked()), this, SLOT(previousPage())); noteMode->setStyleSheet("background:none;"); m_isShowPageOnly = false; }
void GUIManager::keyPressed(ofKeyEventArgs& eventArgs) //int key) { printf("keyPressed - key = %c \n", eventArgs.key); switch (eventArgs.key) { case '[': previousPage(); break; case ']': nextPage(); break; case ' ': toggleVisible(); } }
void ShortcutWing::applyPageButtons(const QByteArray& data) { /* Check that there's enough data for flags */ if (data.size() < WING_BYTE_FLAGS + 1) return; if ((data[WING_BYTE_FLAGS] & WING_SHORTCUT_PAGE_UP) == 0) { nextPage(); sendPageData(); } else if ((data[WING_BYTE_FLAGS] & WING_SHORTCUT_PAGE_DOWN) == 0) { previousPage(); sendPageData(); } }
Tutorial::Tutorial() { using kbd = tank::Keyboard; using key = tank::Key; finished_ = false; tut1_ = makeEntity<tank::Entity>(tank::Vectorf{}); tut1_->makeGraphic<tank::Image>(res::tut1); connect(kbd::KeyPress(key::Space) or kbd::KeyPress(key::Return) or kbd::KeyPress(key::Right) or kbd::KeyPress(key::SemiColon), [this]{nextPage();}); connect(kbd::KeyPress(key::A) or kbd::KeyPress(key::Left) or kbd::KeyPress(key::Escape), [this]{previousPage();}); }
//------------------------------------------------------------------------- void QGuidoItemContainer::keyPressEvent ( QKeyEvent * event ) { if ( mIsStorageModeOn ) return; QLanguageItem::keyPressEvent( event ); int key = event->key(); if ( ( key == Qt::Key_PageUp ) || ( key == Qt::Key_PageDown ) ) { int pageIncrement; switch (key) { case Qt::Key_PageUp: pageIncrement = -1; break; case Qt::Key_PageDown: pageIncrement = 1; break; default: pageIncrement = 0; break; } if ( pageIncrement == 1 ) nextPage(); else previousPage(); event->accept(); } else if ( key == Qt::Key_G ) { mResizeMode = RESIZE_GRID; mResizer->setKeepAspectRatio(false); event->accept(); } else if ( key == Qt::Key_F ) { mResizeMode = RESIZE_FORMAT; mResizer->setKeepAspectRatio(false); event->accept(); } else { event->ignore(); } }
void UBWebPluginPDFWidget::keyReleaseEvent(QKeyEvent *keyEvent) { // TOOD: why is it not called? switch (keyEvent->key()) { case Qt::Key_Right: if (nextPage()) { keyEvent->accept(); } break; case Qt::Key_Left: if (previousPage()) { keyEvent->accept(); } break; default: break; } }
void Spellbook::clicked( int mouseX, int mouseY, uint8_t mouseState ) { int spellSlotIndex = getMouseOverSpellSlotId( mouseX, mouseY ); if ( spellSlotIndex >= 0 && spellSlot[spellSlotIndex].action != NULL ) { floatingSpell = &spellSlot[spellSlotIndex]; } else if ( isMouseOverNextPageArea( mouseX, mouseY ) ) { nextPage(); } else if ( isMouseOverPreviousPageArea( mouseX, mouseY ) ) { previousPage(); } else { floatingSpell = NULL; } }
void BrowserPageSlider::handleSwipe(int direction) { qDebug()<< Q_FUNC_INFO << "Direction" << direction; switch(direction) { case MouseFilter::SWIPE_R2L: case MouseFilter::SWIPE_D2U: nextPage(); break; case MouseFilter::SWIPE_L2R: case MouseFilter::SWIPE_U2D: previousPage(); break; default: //ignore break; } }
DictionaryLayer::DictionaryLayer(QWidget *parent) : PopUp(parent) , m_dictionarySelected(-1) , m_page(0) { setupUi(this); m_buttonGroup = new QButtonGroup(this); m_buttonGroup->setExclusive(false); m_buttonGroup->addButton(dictBtn0,0); m_buttonGroup->addButton(dictBtn1,1); m_buttonGroup->addButton(dictBtn2,2); m_buttonGroup->addButton(dictBtn3,3); m_buttonGroup->addButton(dictBtn4,4); connect(m_buttonGroup, SIGNAL(buttonClicked(int)),this, SLOT(handleChangeDictionary(int))); connect(VerticalPagerPopup, SIGNAL(previousPageReq()), this, SLOT(previousPage())); connect(VerticalPagerPopup, SIGNAL(nextPageReq()), this, SLOT(nextPage())); connect(VerticalPagerPopup, SIGNAL(firstPage()), this, SLOT(firstPage())); connect(VerticalPagerPopup, SIGNAL(lastPage()), this, SLOT(lastPage())); }
BookmarksImportDialog::BookmarksImportDialog(QWidget* parent) : QDialog(parent) , ui(new Ui::BookmarksImportDialog) , m_currentPage(0) , m_importer(0) , m_importedFolder(0) , m_model(0) { setAttribute(Qt::WA_DeleteOnClose); ui->setupUi(this); ui->browserList->setCurrentRow(0); connect(ui->nextButton, SIGNAL(clicked()), this, SLOT(nextPage())); connect(ui->backButton, SIGNAL(clicked()), this, SLOT(previousPage())); connect(ui->chooseFile, SIGNAL(clicked()), this, SLOT(setFile())); connect(ui->cancelButton, SIGNAL(rejected()), this, SLOT(close())); #ifndef Q_OS_WIN ui->browserList->setItemHidden(ui->browserList->item(IE), true); #endif }
void LibraryPageHandler::handleSwipe(int direction) { if(!isVisible() || m_totalPages <= 1) return; qDebug()<< Q_FUNC_INFO << "Direction" << direction; switch(direction) { case MouseFilter::SWIPE_R2L: case MouseFilter::SWIPE_D2U: nextPage(); break; case MouseFilter::SWIPE_L2R: case MouseFilter::SWIPE_U2D: previousPage(); break; default: //ignore break; } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); createStatusBar(); // Recent files for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); printer = new QPrinter; printer->setFullPage(true); printer->setPaperSize(QPrinter::Letter); printer->setPageMargins(.5, .5, .5, .5, QPrinter::Inch); report = new Report(printer, this); view = new ReportView(report, this); preview = new QPrintPreviewWidget(printer, this); setCentralWidget(preview); preview->fitToWidth(); QFontComboBox* fontComboBox = new QFontComboBox; fontComboBox->setFontFilters(QFontComboBox::MonospacedFonts | QFontComboBox::ScalableFonts); fontComboBox->setCurrentFont(report->font().family()); ui->fontToolBar->insertWidget(ui->actionBold, fontComboBox); connect(fontComboBox, SIGNAL(currentFontChanged(QFont)), report, SLOT(setFont(QFont))); pageNumberComboBox = new QComboBox; ui->viewToolBar->insertWidget(ui->actionNextPage, pageNumberComboBox); connect(pageNumberComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(currentPageChanged(int))); const qreal zoomFactors[] = { 12.5, 25, 50, 100, 125, 150, 200, 400, 800 }; zoomComboBox = new QComboBox; for (unsigned int i = 0; i < sizeof(zoomFactors) / sizeof(*zoomFactors); ++i) { zoomComboBox->addItem(QString("%1%").arg(zoomFactors[i])); } zoomComboBox->setCurrentIndex(-1); ui->viewToolBar->insertWidget(ui->actionZoomOut, zoomComboBox); connect(zoomComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(zoomChanged(QString))); QActionGroup* orientationGroup = new QActionGroup(this); orientationGroup->addAction(ui->actionPortrait); orientationGroup->addAction(ui->actionLandscape); orientationChanged(report->orientation()); QActionGroup* heightGroup = new QActionGroup(this); heightGroup->addAction(ui->action6LPI); heightGroup->addAction(ui->action8LPI); heightGroup->addAction(ui->action9LPI); heightGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), heightGroup, SLOT(setDisabled(bool))); QActionGroup* widthGroup = new QActionGroup(this); widthGroup->addAction(ui->actionDefaultWidth); widthGroup->addAction(ui->action10CPI); widthGroup->addAction(ui->action12CPI); widthGroup->addAction(ui->action17CPI); widthGroup->setDisabled(ui->actionStretchFont->isEnabled()); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), widthGroup, SLOT(setDisabled(bool))); QActionGroup* pageGroup = new QActionGroup(this); pageGroup->addAction(ui->actionSinglePage); pageGroup->addAction(ui->actionFacingPages); pageGroup->addAction(ui->actionAllPages); ui->actionSinglePage->setChecked(preview->viewMode() == QPrintPreviewWidget::SinglePageView); ui->actionFacingPages->setChecked(preview->viewMode() == QPrintPreviewWidget::FacingPagesView); ui->actionAllPages->setChecked(preview->viewMode() == QPrintPreviewWidget::AllPagesView); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open())); connect(ui->actionOpenURL, SIGNAL(triggered()), this, SLOT(openUrl())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveAsPdf())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionPageSetup, SIGNAL(triggered()), this, SLOT(pageSetup())); connect(ui->actionEmail, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionCopy, SIGNAL(triggered()), this, SLOT(copy())); connect(ui->actionStretchFont, SIGNAL(toggled(bool)), report, SLOT(setStretchFont(bool))); connect(report, SIGNAL(stretchFontChanged(bool)), ui->actionStretchFont, SLOT(setChecked(bool))); connect(ui->actionBold, SIGNAL(toggled(bool)), report, SLOT(setBold(bool))); connect(ui->actionStripes, SIGNAL(toggled(bool)), report, SLOT(setStripes(bool))); connect(ui->actionStripeColor, SIGNAL(triggered()), this, SLOT(stripeColor())); connect(ui->actionColor, SIGNAL(triggered()), this, SLOT(fontColor())); connect(ui->action6LPI, SIGNAL(triggered()), this, SLOT(height6Lpi())); connect(ui->action8LPI, SIGNAL(triggered()), this, SLOT(height8Lpi())); connect(ui->action9LPI, SIGNAL(triggered()), this, SLOT(height9Lpi())); connect(ui->actionDefaultWidth, SIGNAL(toggled(bool)), this, SLOT(widthDefault())); connect(ui->action10CPI, SIGNAL(triggered()), this, SLOT(width10Cpi())); connect(ui->action12CPI, SIGNAL(triggered()), this, SLOT(width12Cpi())); connect(ui->action17CPI, SIGNAL(triggered()), this, SLOT(width17Cpi())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->actionFitWidth, SIGNAL(triggered()), preview, SLOT(fitToWidth())); connect(ui->actionFitHeight, SIGNAL(triggered()), preview, SLOT(fitInView())); connect(ui->actionPortrait, SIGNAL(triggered()), preview, SLOT(setPortraitOrientation())); connect(ui->actionLandscape, SIGNAL(triggered()), preview, SLOT(setLandscapeOrientation())); connect(ui->actionActualSize, SIGNAL(triggered()), this, SLOT(actualSize())); connect(ui->actionZoomIn, SIGNAL(triggered()), preview, SLOT(zoomIn())); connect(ui->actionZoomOut, SIGNAL(triggered()), preview, SLOT(zoomOut())); connect(ui->actionSinglePage, SIGNAL(triggered()), preview, SLOT(setSinglePageViewMode())); connect(ui->actionFacingPages, SIGNAL(triggered()), preview, SLOT(setFacingPagesViewMode())); connect(ui->actionAllPages, SIGNAL(triggered()), preview, SLOT(setAllPagesViewMode())); connect(ui->actionMainToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleMainToolbar(bool))); connect(ui->actionViewToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleViewToolbar(bool))); connect(ui->actionFontToolbar, SIGNAL(triggered(bool)), this, SLOT(toggleFontToolbar(bool))); connect(ui->actionStatusBar, SIGNAL(triggered(bool)), this, SLOT(toggleStatusBar(bool))); connect(ui->menuToolbars, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateToolbarMenu())); connect(preview, SIGNAL(previewChanged()), this, SLOT(previewChanged())); connect(preview, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paint(QPrinter*))); connect(report, SIGNAL(loaded()), preview, SLOT(updatePreview())); connect(report, SIGNAL(changed()), preview, SLOT(updatePreview())); connect(report, SIGNAL(loaded()), this, SLOT(documentLoaded())); connect(report, SIGNAL(orientationChanged(QPrinter::Orientation)), this, SLOT(orientationChanged(QPrinter::Orientation))); connect(report, SIGNAL(lpiChanged(int)), this, SLOT(lpiChanged(int))); connect(report, SIGNAL(cpiChanged(int)), this, SLOT(cpiChanged(int))); connect(report, SIGNAL(boldChanged(bool)), ui->actionBold, SLOT(setChecked(bool))); connect(report, SIGNAL(fontChanged(QFont)), fontComboBox, SLOT(setCurrentFont(QFont))); QSettings settings; restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("state").toByteArray()); recentFiles = settings.value("recentFiles").toStringList(); currentFolder = settings.value("currentFolder").toString(); ui->statusBar->setVisible(settings.value("statusBar", true).toBool()); updateRecentFileActions(); zoomTimer = new QTimer(this); connect(zoomTimer, SIGNAL(timeout()), this, SLOT(updateZoom())); connect(preview, SIGNAL(previewChanged()), this, SLOT(updateZoom())); zoomTimer->start(1000); }
int BndsTicketView::exec() { string t; char str [50]; int res; BndsTicketsListView *btlv; /// Muestra la pantalla. show(); while(1) { swiWaitForVBlank(); scanKeys(); /// Procesa los eventos de la pantalla tactil. int itemSelected = g_video->eventTemplateListB(); if (keysDown() & KEY_LEFT) { previousPage(); } else if (keysDown() & KEY_RIGHT) { nextPage(); } else if (keysDown() & KEY_L) { /// Vuelta a la pantalla anterior. g_video->resetBgSub(); break; } else if (keysDown() & KEY_R) { /// Seleccionar mesa y enviar. itemSelected = -10; } else if (keysDown() & KEY_UP) { itemSelected = -6; } else if (keysDown() & KEY_DOWN) { itemSelected = -7; } // end if switch (itemSelected) { case -1: /// Necesita repintarse. show(); break; case -2: if (m_currentLine == 0) break; /// Boton - cantidad. m_currentTicketLine->setQuantityArticle(m_currentTicketLine->quantityArticle() - 1); /// Si la cantidad es <= 0 entonces se borra la linea de ticket. if (m_currentTicketLine->quantityArticle() <= 0) { m_ticket->removeTicketLine( m_currentTicketLine ); /// Establece el numero de items a mostrar en la lista. setTotalItems( m_ticket->ticketLines().size() ); } // end if m_ticket->recalculeTotal(); show(); break; case -3: if (m_currentLine == 0) break; /// Boton + cantidad. m_currentTicketLine->setQuantityArticle(m_currentTicketLine->quantityArticle() + 1); m_ticket->recalculeTotal(); show(); break; case -4: if (m_currentLine == 0) break; /// Boton borrar linea m_ticket->removeTicketLine( m_currentTicketLine ); /// Establece el numero de items a mostrar en la lista. setTotalItems( m_ticket->ticketLines().size() ); m_ticket->recalculeTotal(); show(); break; case -5: /// Boton anterior. /// Vuelta a la pantalla anterior. g_video->resetBgSub(); return 0; break; case -6: /// Dibuja boton 'Sube linea'. lineUp(); break; case -7: /// Dibuja boton 'Baja linea'. lineDown(); break; case -10: /// Seleccionar mesa y enviar. g_video->resetBgMain(); g_video->resetBgSub(); /// Primero cambiar el nombre al ticket. Despues enviar los datos. /// TODO: Provisionalmente genera 40 mesas (40 nombres de tickets). /// luego comprueba que el nombre no exista en la base de datos (se esta usando). /// muestra la lista completa, pero solo deja elegir los que esten disponibles. btlv = new BndsTicketsListView(); res = btlv->exec(); delete btlv; /// TODO: manera nada adecuada de conseguir el nombre del ticket seleccionado. sprintf(str,"%i", res); t = string("MESA ") + string(str); m_ticket->setNomTicket(t); /// TODO: tecla provisional. Enviar ticket. g_db->saveTicket(); m_ticket->clearTicket(); setTotalItems( m_ticket->ticketLines().size() ); m_ticket->setNomTicket(m_ticket->defaultTicketName()); return 0; break; case 2: break; } // end switch } // end while return 0; }
int BndsArticlesView::exec() { /// Muestra la pantalla. show(); while(1) { swiWaitForVBlank(); scanKeys(); if (keysDown() & KEY_LEFT) { previousPage(); } else if (keysDown() & KEY_RIGHT) { nextPage(); } else if (keysDown() & KEY_L) { break; } // end if /// Procesa los eventos de la pantalla tactil. int itemSelected = g_video->eventTemplateListA(true, true); if (itemSelected == -1) { m_modifierActive = false; /// Necesita repintarse. show(); } // end if if (itemSelected == -2) { previousPage(); } // end if if (itemSelected == -3) { nextPage(); } // end if if (itemSelected == -4) { break; } // end if if (itemSelected == -10) { modifierChangeState(); } // end if /// itemSelected = 0 => No se ha pulsado ningun recuadro. No se hace nada. if (itemSelected > 0) { /// Devuelve la posicion de la categoria dentro de la lista de categorias. /// El primer elemento es el 1. /// Inserta el articulo en el ticket. int contador = 0; for (list<BndsArticle*>::iterator itArtic = m_listaArtic.begin(); itArtic != m_listaArtic.end(); itArtic++) { if (contador == (itemSelected - 1 + ((m_currentPage - 1) * m_maxItemsPerPage)) ) { if ( m_modifierActive ) { /// Se captura la informacion de los modificadores. /// 1) Captura info extra. /// 2) Guarda info si no se ha cancelado la accion. BndsModifier *mod = new BndsModifier(); int result = mod->exec(); if (result == 1) { /// Se pulso el boton 'aceptar'. Se guarda la informacion. g_db->currentTicket()->addArticle( *itArtic, mod ); } else { /// TODO: se pulso otro boton. g_db->currentTicket()->addArticle( *itArtic, 0 ); } // end if m_modifierActive = false; } else { g_db->currentTicket()->addArticle( *itArtic, 0 ); } // end if /// Refresca la informacion en pantalla. show(); /// Sale del for. break; } // end if contador++; } // end for } // end if } // end while return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActions[i] = new QAction(this); recentFileActions[i]->setVisible(false); connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile())); ui->menuFile->insertAction(ui->actionExit, recentFileActions[i]); } recentFilesSeparator = ui->menuFile->insertSeparator(ui->actionExit); form = new Form(this); view = new GraphicsView(form, this); setCentralWidget(view); itemWidget = new ItemWidget(ui->propertyWidget); itemWidget->setHidden(true); connect(view, SIGNAL(mouseDoubleClick()), itemWidget, SLOT(selectPicture())); formWidget = new FormWidget(ui->propertyWidget); formWidget->connectForm(form); formWidget->update(form); ui->propertyWidget->setWidget(formWidget); fontCombo = new QFontComboBox(this); ui->formatToolBar->insertWidget(ui->actionBold, fontCombo); insertGroup = new QActionGroup(this); insertGroup->addAction(ui->actionSelect); insertGroup->addAction(ui->actionPaint); connect(insertGroup, SIGNAL(triggered(QAction*)), this, SLOT(insertObject(QAction*))); ui->actionLeft->setData(Qt::AlignLeft); ui->actionCenter->setData(Qt::AlignHCenter); ui->actionRight->setData(Qt::AlignRight); zoomGroup = new QActionGroup(this); zoomGroup->addAction(ui->actionActualSize); zoomGroup->addAction(ui->actionFitWidth); zoomGroup->addAction(ui->actionFitHeight); connect(zoomGroup, SIGNAL(triggered(QAction*)), this, SLOT(zoom(QAction*))); ui->actionActualSize->setData(GraphicsView::ActualSize); ui->actionFitWidth->setData(GraphicsView::FitWidth); ui->actionFitHeight->setData(GraphicsView::FitHeight); horzAlignGroup = new QActionGroup(this); horzAlignGroup->addAction(ui->actionLeft); horzAlignGroup->addAction(ui->actionCenter); horzAlignGroup->addAction(ui->actionRight); connect(horzAlignGroup, SIGNAL(triggered(QAction*)), this, SLOT(horzAlign(QAction*))); sizeGroup = new QActionGroup(this); sizeGroup->addAction(ui->actionShrinkWidth); sizeGroup->addAction(ui->actionGrowWidth); sizeGroup->addAction(ui->actionPageWidth); sizeGroup->addAction(ui->actionShrinkHeight); sizeGroup->addAction(ui->actionGrowHeight); sizeGroup->addAction(ui->actionPageHeight); sizeGroup->addAction(ui->actionShrinkBoth); sizeGroup->addAction(ui->actionGrowBoth); sizeGroup->addAction(ui->actionPageBoth); ui->actionShrinkWidth->setData(Form::ShrinkWidth); ui->actionGrowWidth->setData(Form::GrowWidth); ui->actionPageWidth->setData(Form::PageWidth); ui->actionShrinkHeight->setData(Form::ShrinkHeight); ui->actionGrowHeight->setData(Form::GrowHeight); ui->actionPageHeight->setData(Form::PageHeight); ui->actionShrinkBoth->setData(Form::ShrinkBoth); ui->actionGrowBoth->setData(Form::GrowBoth); ui->actionPageBoth->setData(Form::PageBoth); connect(sizeGroup, SIGNAL(triggered(QAction*)), this, SLOT(size(QAction*))); connect(ui->actionNew, SIGNAL(triggered()), this, SLOT(newForm())); connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openForm())); connect(ui->actionReload, SIGNAL(triggered()), this, SLOT(reload())); connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(saveForm())); connect(ui->actionSaveAs, SIGNAL(triggered()), this, SLOT(saveFormAs())); connect(ui->actionSaveAsPDF, SIGNAL(triggered()), this, SLOT(saveFormAsPdf())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(about())); connect(ui->actionOpenPrintData, SIGNAL(triggered()), this, SLOT(openPrintData())); connect(ui->actionPageSetup, SIGNAL(triggered()), form, SLOT(pageSetup())); connect(ui->actionPagePreview, SIGNAL(triggered()), this, SLOT(preview())); connect(ui->actionSend, SIGNAL(triggered()), this, SLOT(email())); connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print())); connect(ui->actionFullScreen, SIGNAL(triggered()), this, SLOT(fullScreen())); connect(ui->actionMargins, SIGNAL(toggled(bool)), form, SLOT(showMargins(bool))); connect(ui->actionGrid, SIGNAL(toggled(bool)), form, SLOT(showGrid(bool))); connect(ui->actionPrintData, SIGNAL(toggled(bool)), form, SLOT(showData(bool))); connect(ui->actionSelectAll, SIGNAL(triggered()), form, SLOT(selectAll())); connect(ui->actionDelete, SIGNAL(triggered()), form, SLOT(deleteSelected())); connect(ui->actionProperties, SIGNAL(toggled(bool)), ui->propertyWidget, SLOT(setVisible(bool))); connect(ui->actionMoveForwards, SIGNAL(triggered()), form, SLOT(moveForwards())); connect(ui->actionMoveBackwards, SIGNAL(triggered()), form, SLOT(moveBackwards())); connect(ui->actionAlignLeft, SIGNAL(triggered()), form, SLOT(alignLeft())); connect(ui->actionAlignRight, SIGNAL(triggered()), form, SLOT(alignRight())); connect(ui->actionAlignTop, SIGNAL(triggered()), form, SLOT(alignTop())); connect(ui->actionAlignBottom, SIGNAL(triggered()), form, SLOT(alignBottom())); connect(ui->actionCut, SIGNAL(triggered()), form, SLOT(cut())); connect(ui->actionCopy, SIGNAL(triggered()), form, SLOT(copy())); connect(ui->actionPaste, SIGNAL(triggered()), this, SLOT(paste())); connect(ui->actionFirstPage, SIGNAL(triggered()), this, SLOT(firstPage())); connect(ui->actionPreviousPage, SIGNAL(triggered()), this, SLOT(previousPage())); connect(ui->actionNextPage, SIGNAL(triggered()), this, SLOT(nextPage())); connect(ui->actionLastPage, SIGNAL(triggered()), this, SLOT(lastPage())); connect(ui->menuView, SIGNAL(aboutToShow()), this, SLOT(updateViewMenu())); connect(form, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(form, SIGNAL(changed()), this, SLOT(formChanged())); connect(view, SIGNAL(doneRubberBanding(QRectF)), this, SLOT(doneRubberBanding(QRectF))); connectForm(); loadSettings(); QTimer::singleShot(0, this, SLOT(init())); }
/** Met en place le dialogue */ void QETPrintPreviewDialog::build() { preview_ = new QPrintPreviewWidget(printer_); diagrams_label_ = new QLabel(tr("Sch\351mas \340 imprimer\240:")); diagrams_list_ = new DiagramsChooser(project_); diagrams_select_all_ = new QPushButton(tr("Tout cocher")); diagrams_select_none_ = new QPushButton(tr("Tout d\351cocher")); toggle_diagrams_list_ = new QAction(QET::Icons::Diagram, tr("Cacher la liste des sch\351mas"), this); toggle_print_options_ = new QAction(QET::Icons::Configure, tr("Cacher les options d'impression"), this); adjust_width_ = new QAction(QET::Icons::ViewFitWidth, tr("Ajuster la largeur"), this); adjust_page_ = new QAction(QET::Icons::ViewFitWindow, tr("Ajuster la page"), this); zoom_out_ = new QAction(QET::Icons::ZoomOut, tr("Zoom arri\350re"), this); zoom_box_ = new QComboBox(this); zoom_in_ = new QAction(QET::Icons::ZoomIn, tr("Zoom avant"), this); landscape_ = new QAction(QET::Icons::PrintLandscape, tr("Paysage"), this); portrait_ = new QAction(QET::Icons::PrintPortrait, tr("Portrait"), this); first_page_ = new QAction(QET::Icons::ArrowLeftDouble, tr("Premi\350re page"), this); previous_page_ = new QAction(QET::Icons::ArrowLeft, tr("Page pr\351c\351dente"), this); next_page_ = new QAction(QET::Icons::ArrowRight, tr("Page suivante"), this); last_page_ = new QAction(QET::Icons::ArrowRightDouble, tr("Derni\350re page"), this); single_page_view_ = new QAction(QET::Icons::SinglePage, tr("Afficher une seule page"), this); facing_pages_view_ = new QAction(QET::Icons::PrintTwoPages, tr("Afficher deux pages"), this); all_pages_view_ = new QAction(QET::Icons::PrintAllPages, tr("Afficher un aper\347u de toutes les pages"), this); page_setup_ = new QAction(QET::Icons::DocumentPrintFrame, tr("Mise en page"), this); toggle_diagrams_list_ -> setCheckable(true); toggle_diagrams_list_ -> setChecked(true); toggle_print_options_ -> setCheckable(true); toggle_print_options_ -> setChecked(true); #ifdef Q_OS_WIN32 /* Sous Windows, le QPageSetupDialog utilise le dialogue natif ; ce dernier ne peut gerer que les imprimantes physiques ("native printers" ). cf avertissement : QAbstractPageSetupDialog::QAbstractPageSetupDialog: Page setup dialog cannot be used on non-native printers */ if (!(printer_ -> outputFileName().isEmpty())) { page_setup_ -> setEnabled(false); page_setup_ -> setText(tr("Mise en page (non disponible sous Windows pour l'impression PDF/PS)")); } #endif toolbar_ = new QToolBar(); toolbar_ -> addAction(toggle_diagrams_list_); toolbar_ -> addAction(toggle_print_options_); toolbar_ -> addSeparator(); toolbar_ -> addAction(adjust_width_); toolbar_ -> addAction(adjust_page_); toolbar_ -> addAction(zoom_out_); toolbar_ -> addWidget(zoom_box_); toolbar_ -> addAction(zoom_in_); toolbar_ -> addSeparator(); toolbar_ -> addAction(landscape_); toolbar_ -> addAction(portrait_); toolbar_ -> addSeparator(); toolbar_ -> addAction(first_page_); toolbar_ -> addAction(previous_page_); toolbar_ -> addAction(next_page_); toolbar_ -> addAction(last_page_); toolbar_ -> addSeparator(); toolbar_ -> addAction(single_page_view_); toolbar_ -> addAction(facing_pages_view_); toolbar_ -> addAction(all_pages_view_); toolbar_ -> addSeparator(); toolbar_ -> addAction(page_setup_); print_options_box_= new QGroupBox(tr("Options d'impression")); use_full_page_ = new QCheckBox(tr("Utiliser toute la feuille")); use_full_page_ -> setChecked(printer_ -> fullPage()); use_full_page_label_ = new QLabel(tr( "Si cette option est coch\351e, les marges de la feuille seront " "ignor\351es et toute sa surface sera utilis\351e pour l'impression. " "Cela peut ne pas \352tre support\351 par votre imprimante." )); use_full_page_label_ -> setWordWrap(true); use_full_page_label_ -> setContentsMargins(20, 0, 0, 0); fit_diagram_to_page_ = new QCheckBox(tr("Adapter le sch\351ma \340 la page")); fit_diagram_to_page_label_ = new QLabel(tr( "Si cette option est coch\351e, le sch\351ma sera agrandi ou " "r\351tr\351ci de fa\347on \340 remplir toute la surface imprimable " "d'une et une seule page." )); fit_diagram_to_page_label_ -> setWordWrap(true); fit_diagram_to_page_label_ -> setContentsMargins(20, 0, 0, 0); fit_diagram_to_page_ -> setChecked(true); // recupere les parametres d'export definis dans la configuration de l'application ExportProperties default_print_properties = QETDiagramEditor::defaultPrintProperties(); render_properties_ = new ExportPropertiesWidget(default_print_properties); render_properties_ -> setPrintingMode(true); buttons_ = new QDialogButtonBox(); buttons_ -> addButton(new QPushButton(QET::Icons::DocumentPrint, tr("Imprimer")), QDialogButtonBox::AcceptRole); buttons_ -> addButton(QDialogButtonBox::Cancel); connect(diagrams_select_all_, SIGNAL(released()), this, SLOT(selectAllDiagrams())); connect(diagrams_select_none_, SIGNAL(released()), this, SLOT(selectNoDiagram())); connect(toggle_diagrams_list_, SIGNAL(toggled(bool)), this, SLOT(setDiagramsListVisible(bool))); connect(toggle_print_options_, SIGNAL(toggled(bool)), this, SLOT(setPrintOptionsVisible(bool))); connect(adjust_width_, SIGNAL(triggered()), preview_, SLOT(fitToWidth())); connect(adjust_page_, SIGNAL(triggered()), preview_, SLOT(fitInView())); connect(zoom_out_, SIGNAL(triggered()), this, SLOT(zoomOut())); connect(zoom_in_, SIGNAL(triggered()), this, SLOT(zoomIn())); connect(landscape_, SIGNAL(triggered()), preview_, SLOT(setLandscapeOrientation())); connect(portrait_, SIGNAL(triggered()), preview_, SLOT(setPortraitOrientation())); connect(first_page_, SIGNAL(triggered()), this, SLOT(firstPage())); connect(previous_page_, SIGNAL(triggered()), this, SLOT(previousPage())); connect(next_page_, SIGNAL(triggered()), this, SLOT(nextPage())); connect(last_page_, SIGNAL(triggered()), this, SLOT(lastPage())); connect(single_page_view_, SIGNAL(triggered()), preview_, SLOT(setSinglePageViewMode())); connect(facing_pages_view_, SIGNAL(triggered()), preview_, SLOT(setFacingPagesViewMode())); connect(all_pages_view_, SIGNAL(triggered()), preview_, SLOT(setAllPagesViewMode())); connect(page_setup_, SIGNAL(triggered()), this, SLOT(pageSetup())); connect(use_full_page_, SIGNAL(toggled(bool)), this, SLOT(useFullPage(bool))); connect(fit_diagram_to_page_, SIGNAL(toggled(bool)), this, SLOT(fitDiagramToPage(bool))); connect(render_properties_, SIGNAL(optionChanged()), preview_, SLOT(updatePreview())); connect(preview_, SIGNAL(previewChanged()), this, SLOT(updateZoomList())); connect(zoom_box_, SIGNAL(currentIndexChanged(int)), this, SLOT(updatePreviewZoom())); connect(buttons_, SIGNAL(accepted()), this, SLOT(accept())); connect(buttons_, SIGNAL(rejected()), this, SLOT(reject())); hlayout0_ = new QHBoxLayout(); vlayout0_ = new QVBoxLayout(); vlayout1_ = new QVBoxLayout(); vlayout2_ = new QVBoxLayout(); vlayout1_ -> addWidget(use_full_page_); vlayout1_ -> addWidget(use_full_page_label_); vlayout1_ -> addWidget(fit_diagram_to_page_); vlayout1_ -> addWidget(fit_diagram_to_page_label_); print_options_box_ -> setLayout(vlayout1_); vlayout2_ -> addWidget(diagrams_label_); vlayout2_ -> addWidget(diagrams_list_); vlayout2_ -> addWidget(diagrams_select_all_); vlayout2_ -> addWidget(diagrams_select_none_); hlayout0_ -> addLayout(vlayout2_); hlayout0_ -> addWidget(preview_); vlayout0_ -> addWidget(toolbar_); vlayout0_ -> addLayout(hlayout0_); vlayout0_ -> addWidget(render_properties_); vlayout0_ -> addWidget(print_options_box_); vlayout0_ -> addWidget(buttons_); setLayout(vlayout0_); updateZoomList(); }