KexiReportView::KexiReportView(QWidget *parent) : KexiView(parent) { m_preRenderer = 0; setObjectName("KexiReportDesigner_DataView"); m_scrollArea = new QScrollArea(this); m_scrollArea->setBackgroundRole(QPalette::Dark); m_scrollArea->viewport()->setAutoFillBackground(true); m_pageSelector = new KexiRecordNavigator(this, 0); layout()->addWidget(m_scrollArea); layout()->addWidget(m_pageSelector); m_pageSelector->setRecordCount(0); m_pageSelector->setInsertingButtonVisible(false); m_pageSelector->setLabelText(i18n("Page")); // -- setup local actions QList<QAction*> viewActions; QAction* a; viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this)); a->setObjectName("pgzkexirpt_print_report"); a->setToolTip(i18n("Print Report")); a->setWhatsThis(i18n("Prints the current report.")); connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); viewActions << (a = new KAction(KIcon("kword"), i18n("Open in KWord"), this)); a->setObjectName("pgzkexirpt_open_kword"); a->setToolTip(i18n("Open the report in KWord")); a->setWhatsThis(i18n("Opens the current report in KWord.")); a->setEnabled(false); //! @todo connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKWord())); #ifdef HAVE_KSPREAD viewActions << (a = new KAction(KIcon("kspread"), i18n("Open in KSpread"), this)); a->setObjectName("pgzkexirpt_open_kspread"); a->setToolTip(i18n("Open the report in KSpread")); a->setWhatsThis(i18n("Opens the current report in KSpread.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread())); #endif viewActions << (a = new KAction(KIcon("text-html"), i18n("Export to HTML"), this)); a->setObjectName("pgzkexirpt_export_html"); a->setToolTip(i18n("Export the report to HTML")); a->setWhatsThis(i18n("Exports the report to a HTML file.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML())); setViewActions(viewActions); connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage())); connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage())); connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage())); connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage())); }
void LibraryPageHandler::goToFirstPage() { qDebug() << Q_FUNC_INFO; previousPageTimer.stop(); m_firstPageLaunched = true; m_currentPage = 0; emit firstPage(); }
KexiReportView::KexiReportView(QWidget *parent) : KexiView(parent), m_preRenderer(0), m_reportDocument(0), m_kexi(0), m_functions(0) { setObjectName("KexiReportDesigner_DataView"); m_scrollArea = new QScrollArea(this); m_scrollArea->setBackgroundRole(QPalette::Dark); m_scrollArea->viewport()->setAutoFillBackground(true); layout()->addWidget(m_scrollArea); #ifndef KEXI_MOBILE m_pageSelector = new KexiRecordNavigator(this, 0); layout()->addWidget(m_pageSelector); m_pageSelector->setRecordCount(0); m_pageSelector->setInsertingButtonVisible(false); m_pageSelector->setLabelText(i18n("Page")); #endif // -- setup local actions QList<QAction*> viewActions; QAction* a; viewActions << (a = new KAction(KIcon("printer"), i18n("Print"), this)); a->setObjectName("print_report"); a->setToolTip(i18n("Print Report")); a->setWhatsThis(i18n("Prints the current report.")); connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); viewActions << (a = new KAction(KIcon("kword"), i18n("Save to KWord"), this)); a->setObjectName("save_to_kword"); a->setToolTip(i18n("Save the report to a KWord document")); a->setWhatsThis(i18n("Save the report to a KWord document")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotRenderODT())); viewActions << (a = new KAction(KIcon("kspread"), i18n("Save to KSpread"), this)); a->setObjectName("save_to_kspread"); a->setToolTip(i18n("Save the report to a KSpread document")); a->setWhatsThis(i18n("Saves the current report to a KSpread document.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotRenderKSpread())); viewActions << (a = new KAction(KIcon("text-html"), i18n("Export as Web Page"), this)); a->setObjectName("export_as_web_page"); a->setToolTip(i18n("Export the report as web page")); a->setWhatsThis(i18n("Exports the report to a web page file.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportHTML())); setViewActions(viewActions); #ifndef KEXI_MOBILE connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage())); connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage())); connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage())); connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage())); #endif }
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())); }
void TopLevel::setupMenuBar() { // File menu KStdAction::open( this, SLOT( faxOpen() ), actionCollection() ); actRecent = KStdAction::openRecent( this, SLOT( faxOpen( const KURL & ) ), actionCollection() ); actSave = KStdAction::save( this, SLOT( faxSave() ), actionCollection() ); actSaveAs = KStdAction::saveAs( this, SLOT( faxSaveAs() ), actionCollection() ); actPrint = KStdAction::print( this, SLOT( print() ), actionCollection() ); KStdAction::quit( this, SLOT( close() ), actionCollection() ); actAdd = new KAction( i18n( "A&dd..." ), "filenew", KShortcut(), this, SLOT( faxAdd() ), actionCollection(), "file_add_fax" ); actRecent->setMaxItems( 5 ); // View Menu actSize = KStdAction::actualSize( this, SLOT( actualSize() ), actionCollection() ); actZoomIn = KStdAction::zoomIn( this, SLOT( zoomin() ), actionCollection() ); actZoomOut = KStdAction::zoomOut( this, SLOT( zoomout() ), actionCollection() ); actRotate = new KAction( i18n( "&Rotate Page" ), "rotate", KShortcut(), this, SLOT( rotatePage() ), actionCollection(), "view_rotate" ); actMirror = new KAction( i18n( "Mirror Page" ), KShortcut(), this, SLOT( mirrorPage() ), actionCollection(), "view_mirror" ); actFlip = new KAction( i18n( "&Flip Page" ), KShortcut(), this, SLOT( flipPage() ), actionCollection(), "view_flip" ); // Go menu actNext = KStdAction::next( this, SLOT( nextPage() ), actionCollection() ); actPrev = KStdAction::prior( this, SLOT( prevPage() ), actionCollection() ); actFirst = KStdAction::firstPage( this, SLOT( firstPage() ), actionCollection() ); actLast = KStdAction::lastPage( this, SLOT( lastPage() ), actionCollection() ); // Settings menu KStdAction::preferences( this, SLOT( faxoptions() ), actionCollection() ); }
void LibraryPageHandler::nextPage() { nextPageTimer.stop(); //We emit the signal because the limit is get by the scroll bar maximum value. if(b_scrollBar) emit nextPageReq(); else if(m_currentPage + 1 < m_totalPages) { m_currentPage++; m_strPagesText = QString(tr("%1 of %2")).arg(m_currentPage).arg(m_totalPages); emit nextPageReq(); } else if(m_loopable) { m_currentPage = 0; m_strPagesText = QString(tr("1 of %1")).arg(m_totalPages); emit firstPage(); } }
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); }
void MainWindow::createToolBars() { QAction *act = 0; m_pm_zoom = new QMenu(tr("Zoom")); act = m_pm_zoom->addAction(tr("Fit to width")); act->setData(QVariant(1)); act = m_pm_zoom->addAction(tr("Fit to page")); act->setData(QVariant(2)); m_pm_zoom->addSeparator(); act = m_pm_zoom->addAction(tr("50%")); act->setData(QVariant(50)); act = m_pm_zoom->addAction(tr("75%")); act->setData(QVariant(75)); act = m_pm_zoom->addAction(tr("100%")); act->setData(QVariant(100)); act = m_pm_zoom->addAction(tr("125%")); act->setData(QVariant(125)); act = m_pm_zoom->addAction(tr("150%")); act->setData(QVariant(150)); act = m_pm_zoom->addAction(tr("200%")); act->setData(QVariant(200)); connect(m_pm_zoom, SIGNAL(triggered(QAction*)), this, SLOT(setZoom(QAction*))); m_tb_menu = addToolBar(tr("menu")); m_tb_menu->addAction(tr("Zoom"))->setMenu(m_pm_zoom); m_tb_menu->setMovable(false); m_tb_tool = addToolBar(tr("tool")); m_tb_tool->setMovable(false); m_tb_tool->addAction(QIcon(tr(":/fileopen")), tr("Open..."), this, SLOT(openFile())); m_tb_tool->addSeparator(); m_to_find = m_tb_tool->addAction(QIcon(tr(":/find")), tr("Find..."), this, SLOT(toggleFindBar())); m_to_find->setCheckable(true); m_tb_tool->addSeparator(); m_to_full = m_tb_tool->addAction(QIcon(tr(":/fullscreen")), tr("Fullscreen"), this, SLOT(toggleFullscreen())); m_to_full->setCheckable(true); m_tb_tool->addSeparator(); m_tb_tool->addAction(QIcon(tr(":/fastback")), tr("First page"), this, SLOT(firstPage())); m_tb_tool->addAction(QIcon(tr(":/back")), tr("Previous page"), this, SLOT(prevPage())); m_tb_tool->addAction(QIcon(tr(":/down")), tr("Goto Page..."), this, SLOT(gotoPageDialog())); m_tb_tool->addAction(QIcon(tr(":/forward")), tr("Next page"), this, SLOT(nextPage())); m_tb_tool->addAction(QIcon(tr(":/fastforward")), tr("Last page"), this, SLOT(lastPage())); addToolBarBreak(); m_tb_find = addToolBar(tr("search")); m_tb_find->setMovable(false); m_tb_find->hide(); m_findedit = new QLineEdit(); m_tb_find->addWidget(m_findedit); m_tb_find->addAction(QIcon(tr(":/find")), tr("Find..."), this, SLOT(findText())); m_tb_find->addAction(QIcon(tr(":/next")), tr("Next"), this, SLOT(findText())); }
KexiReportView::KexiReportView(QWidget *parent) : KexiView(parent), m_preRenderer(0), m_reportDocument(0) //! @todo KEXI3, m_kexi(0), m_functions(0) { setObjectName("KexiReportDesigner_DataView"); m_reportView = new KReportView(this); layout()->addWidget(m_reportView); #ifndef KEXI_MOBILE m_pageSelector = new KexiRecordNavigator(*m_reportView->scrollArea(), m_reportView); m_pageSelector->setInsertingButtonVisible(false); m_pageSelector->setInsertingEnabled(false); m_pageSelector->setLabelText(xi18nc("Page selector label", "Page:")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonFirst, xi18n("Go to first page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonFirst, xi18n("Goes to first page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonPrevious, xi18n("Go to previous page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonPrevious, xi18n("Goes to previous page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonNext, xi18n("Go to next page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonNext, xi18n("Goes to next page")); m_pageSelector->setButtonToolTipText(KexiRecordNavigator::ButtonLast, xi18n("Go to last page")); m_pageSelector->setButtonWhatsThisText(KexiRecordNavigator::ButtonLast, xi18n("Goes to last page")); m_pageSelector->setNumberFieldToolTips(xi18n("Current page number"), xi18n("Number of pages")); m_pageSelector->setRecordHandler(this); #endif // -- setup local actions QList<QAction*> viewActions; QAction* a; #ifndef KEXI_MOBILE viewActions << (a = new QAction(koIcon("document-print"), xi18n("Print"), this)); a->setObjectName("print_report"); a->setToolTip(xi18n("Print report")); a->setWhatsThis(xi18n("Prints the current report.")); connect(a, SIGNAL(triggered()), this, SLOT(slotPrintReport())); KActionMenu *exportMenu = new KActionMenu(koIcon("document-export"), xi18nc("@title:menu","E&xport As"), this); exportMenu->setObjectName("report_export_as"); exportMenu->setDelayed(false); #endif #ifdef KEXI_MOBILE viewActions << (a = new QAction(xi18n("Export:"), this)); a->setEnabled(false); //!TODO this is a bit of a dirty way to add what looks like a label to the toolbar! // " ", not "", is said to be needed in maemo, the icon didn't display properly without it viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.text"), xi18nc("open dialog to export as text document", "Text Document..."), this)); #endif a->setObjectName("export_as_text_document"); a->setToolTip(xi18n("Export the report as a text document (in OpenDocument Text format)")); a->setWhatsThis(xi18n("Exports the report as a text document (in OpenDocument Text format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsTextDocument())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("application-pdf"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-pdf"), xi18nc("Portable Document Format...", "PDF..."), this)); #endif a->setObjectName("export_as_pdf"); a->setToolTip(xi18n("Export as PDF")); a->setWhatsThis(xi18n("Exports the current report as PDF.")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsPdf())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("application-vnd.oasis.opendocument.spreadsheet"), xi18nc("open dialog to export as spreadsheet", "Spreadsheet..."), this)); #endif a->setObjectName("export_as_spreadsheet"); a->setToolTip(xi18n("Export the report as a spreadsheet (in OpenDocument Spreadsheet format)")); a->setWhatsThis(xi18n("Exports the report as a spreadsheet (in OpenDocument Spreadsheet format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsSpreadsheet())); #ifdef KEXI_MOBILE viewActions << (a = new QAction(koIcon("text-html"), QLatin1String(" "), this)); #else exportMenu->addAction(a = new QAction(koIcon("text-html"), xi18nc("open dialog to export as web page", "Web Page..."), this)); #endif a->setObjectName("export_as_web_page"); a->setToolTip(xi18n("Export the report as a web page (in HTML format)")); a->setWhatsThis(xi18n("Exports the report as a web page (in HTML format).")); a->setEnabled(true); connect(a, SIGNAL(triggered()), this, SLOT(slotExportAsWebPage())); setViewActions(viewActions); #ifndef KEXI_MOBILE // setup main menu actions QList<QAction*> mainMenuActions; mainMenuActions << exportMenu; setMainMenuActions(mainMenuActions); connect(m_pageSelector, SIGNAL(nextButtonClicked()), this, SLOT(nextPage())); connect(m_pageSelector, SIGNAL(prevButtonClicked()), this, SLOT(prevPage())); connect(m_pageSelector, SIGNAL(firstButtonClicked()), this, SLOT(firstPage())); connect(m_pageSelector, SIGNAL(lastButtonClicked()), this, SLOT(lastPage())); #endif }
/** 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(); }
void kdvi::makeMenuBar() { if (menuBar) delete menuBar; menuBar = new KMenuBar( this ); CHECK_PTR( menuBar ); QPopupMenu *p = new QPopupMenu; CHECK_PTR( p ); m_fn = p->insertItem( i18n("&New"), this, SLOT(fileNew()) ); m_fo = p->insertItem( i18n("&Open ..."), this, SLOT(fileOpen()) ); recentmenu = new QPopupMenu; CHECK_PTR( recentmenu ); connect( recentmenu, SIGNAL(activated(int)), SLOT(openRecent(int)) ); m_fr = p->insertItem( i18n("Open &recent"), recentmenu ); m_fp = p->insertItem( i18n("&Print ..."), this, SLOT(filePrint())); m_fx = p->insertItem( i18n("E&xit"), this, SLOT(fileExit())); m_f = p; menuBar->insertItem( i18n("&File"), p, -2 ); p = new QPopupMenu; CHECK_PTR( p ); m_vi = p->insertItem( i18n("Zoom &in"), dviwin, SLOT(prevShrink()) ); m_vo = p->insertItem( i18n("Zoom &out"), dviwin, SLOT(nextShrink()) ); m_vf = p->insertItem( i18n("&Fit to page"), this, SLOT(viewFitPage()) ); m_vw = p->insertItem( i18n("Fit to page &width"), this, SLOT(viewFitPageWidth())); p->insertSeparator(); m_vr = p->insertItem( i18n("&Redraw page"), dviwin, SLOT(drawPage()) ); m_v = p; menuBar->insertItem( i18n("&View"), p, -2 ); p = new QPopupMenu; CHECK_PTR( p ); m_pp = p->insertItem( i18n("&Previous"), dviwin, SLOT(prevPage()) ); m_pn = p->insertItem( i18n("&Next"), dviwin, SLOT(nextPage()) ); m_pf = p->insertItem( i18n("&First"), dviwin, SLOT(firstPage()) ); m_pl = p->insertItem( i18n("&Last"), dviwin, SLOT(lastPage()) ); m_pg = p->insertItem( i18n("&Go to ..."), this, SLOT(pageGoto()) ); m_p = p; menuBar->insertItem( i18n("&Page"), p, -2 ); p = new QPopupMenu; CHECK_PTR( p ); p->setCheckable( TRUE ); m_op = p->insertItem( i18n("&Preferences ..."), this, SLOT(optionsPreferences())); m_ok = p->insertItem( i18n("&Keys ..."), this, SLOT(configKeys())); p->insertSeparator(); m_of = p->insertItem( i18n("Make PK-&fonts"), this, SLOT(toggleMakePK()) ); p->setItemChecked( m_of, makepk ); m_o0 = p->insertItem( i18n("Show PS"), this, SLOT(toggleShowPS())); p->setItemChecked( m_o0, showPS ); m_om = p->insertItem( i18n("Show &Menubar"), this, SLOT(toggleShowMenubar()) ); p->setItemChecked( m_om, !hideMenubar ); m_ob = p->insertItem( i18n("Show &Buttons"), this, SLOT(toggleShowButtons()) ); p->setItemChecked( m_ob, !hideButtons ); m_ot = p->insertItem( i18n("Show Page Lis&t"), this, SLOT(toggleVertToolbar()) ); p->setItemChecked( m_ol, vertToolbar ); m_os = p->insertItem( i18n("Show &Statusbar"), this, SLOT(toggleShowStatusbar()) ); p->setItemChecked( m_os, !hideStatusbar ); m_ol = p->insertItem( i18n("Show Scro&llbars"), this, SLOT(toggleShowScrollbars()) ); p->setItemChecked( m_ol, !hideScrollbars ); m_o = p; menuBar->insertItem( i18n("&Options"), p, -2 ); optionsmenu = p; menuBar->insertSeparator(); QPopupMenu *help = kapp->getHelpMenu(true, QString(i18n("DVI Viewer")) + " " + KDVI_VERSION + i18n("\n\nby Markku Hihnala") + " ([email protected])"); m_h = p; menuBar->insertItem( i18n("&Help"), help ); if ( hideMenubar ) menuBar->hide(); setMenu( menuBar ); }
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())); }