void ExportDialog::exportOneFileFinished(bool isSuccess, bool addPer) { if(addPer){ ui->exportProgressBar->setValue(ui->exportProgressBar->value()+per); if(isSuccess) log.append("OK\n"); else log.append("Failed\n"); } if(stack.isEmpty()){ ui->exportProgressBar->setValue(100); QMessageBox::information(this, tr("Export Result"), log); close(); } else { ExportType et = stack.pop(); if(et==HTML){ log.append(tr("Export to Html file: ")); emit exportToHtml(ui->htmlLineEdit->text()); }else if(et==PDF){ log.append(tr("Export to Pdf file: ")); emit exportToPdf(ui->pdfLineEdit->text()); }else if (et==ODT){ log.append(tr("Export to Odt file: ")); emit exportToOdt(ui->odtLineEdit->text()); }else{ } } }
//------------------------------------------------------------------------- void QGuidoItemContainer::exportToPdf(const QString& fileName) { QPrinter printer; printer.setFullPage(true); printer.setOutputFileName( fileName ); printer.setOutputFormat( QPrinter::PdfFormat ); exportToPdf( &printer ); }
QtGnuplotWindow::QtGnuplotWindow(int id, QtGnuplotEventHandler* eventHandler, QWidget* parent) : QMainWindow(parent) { m_eventHandler = eventHandler; m_id = id; setAttribute(Qt::WA_DeleteOnClose); setWindowIcon(QIcon(":/images/gnuplot")); // Register as the main event receiver if not already created if (m_eventHandler == 0) m_eventHandler = new QtGnuplotEventHandler(this, "qtgnuplot" + QString::number(QCoreApplication::applicationPid())); // Central widget m_widget = new QtGnuplotWidget(m_id, m_eventHandler, this); connect(m_widget, SIGNAL(statusTextChanged(const QString&)), this, SLOT(on_setStatusText(const QString&))); setCentralWidget(m_widget); // Bars m_toolBar = new QToolBar(this); addToolBar(m_toolBar); statusBar()->showMessage(tr("Qt frontend for gnuplot")); // Actions QAction* copyToClipboardAction = new QAction(QIcon(":/images/clipboard" ), tr("Copy to clipboard"), this); QAction* printAction = new QAction(QIcon(":/images/print" ), tr("Print" ), this); QAction* exportAction = new QAction(QIcon(":/images/export" ), tr("Export" ), this); QAction* exportPdfAction = new QAction(QIcon(":/images/exportPDF" ), tr("Export to PDF" ), this); QAction* exportEpsAction = new QAction(QIcon(":/images/exportVector"), tr("Export to EPS" ), this); QAction* exportSvgAction = new QAction(QIcon(":/images/exportVector"), tr("Export to SVG" ), this); QAction* exportPngAction = new QAction(QIcon(":/images/exportRaster"), tr("Export to image" ), this); QAction* settingsAction = new QAction(QIcon(":/images/settings" ), tr("Settings" ), this); connect(copyToClipboardAction, SIGNAL(triggered()), m_widget, SLOT(copyToClipboard())); connect(printAction, SIGNAL(triggered()), m_widget, SLOT(print())); connect(exportPdfAction, SIGNAL(triggered()), m_widget, SLOT(exportToPdf())); connect(exportEpsAction, SIGNAL(triggered()), m_widget, SLOT(exportToEps())); connect(exportSvgAction, SIGNAL(triggered()), m_widget, SLOT(exportToSvg())); connect(exportPngAction, SIGNAL(triggered()), m_widget, SLOT(exportToImage())); connect(settingsAction, SIGNAL(triggered()), m_widget, SLOT(showSettingsDialog())); QMenu* exportMenu = new QMenu(this); exportMenu->addAction(copyToClipboardAction); exportMenu->addAction(printAction); exportMenu->addAction(exportPdfAction); // exportMenu->addAction(exportEpsAction); exportMenu->addAction(exportSvgAction); exportMenu->addAction(exportPngAction); exportAction->setMenu(exportMenu); m_toolBar->addAction(exportAction); createAction(tr("Replot") , 'e', ":/images/replot"); createAction(tr("Show grid") , 'g', ":/images/grid"); createAction(tr("Previous zoom"), 'p', ":/images/zoomPrevious"); createAction(tr("Next zoom") , 'n', ":/images/zoomNext"); createAction(tr("Autoscale") , 'a', ":/images/autoscale"); m_toolBar->addAction(settingsAction); }
/*! * \fn void exportToPdfLocale(char *filename, char *export_filename) * Export the csu file named filename into a pdf file named export_filename * \param[in] filename the csu filename * \param[in] export_filename the pdf filename */ void exportToPdfLocale(char *filename, char *export_filename) { csuStruct *ptr_csu_struct; ptr_csu_struct=readCsuFile(filename); if (ptr_csu_struct == NULL) { systemPause(); return; } if (exportToPdf(ptr_csu_struct,export_filename)) printf(_("The file was well export to %s\n"),export_filename); else printf(_("There is an error when exporting the file %s into a pdf file.\n"),filename); }
/*! * \fn void exportCsu() * Export a csu file into a csv or pdf file */ void exportCsu() { csuStruct *ptr_csu_struct; char filename[SIZE_MAX_FILE_NAME]; char export_filename[SIZE_MAX_FILE_NAME]; FileType type; clearScreen(); // Get the filename menuFileName(filename); #ifndef PORTABLE if(readSystemPath(filename)==false) return; #endif // PORTABLE ptr_csu_struct=readCsuFile(filename); // Read the file if (ptr_csu_struct == NULL) { systemPause(); return; } // Prepare the exportation strcpy(export_filename,filename); removeFileExtension(export_filename); type = menuChooseExportFileType(); if (type == pdf_file) { addFilePdfExtension(export_filename); if (exportToPdf(ptr_csu_struct,export_filename)) printf(_("The file was well export to %s\n"),export_filename); else printf(_("There is an error when exporting the file %s into a pdf file.\n"),filename); } else if (type == gnuplot_file) { if (exportToGnuplotFile(ptr_csu_struct,export_filename)) printf(_("The file was well export to %s\n"),export_filename); else printf(_("There is an error when exporting the file %s into gnuplot files.\n"),filename); } else if (type == csv_file) { addFileCsvExtension(export_filename); if (exportToCsv(ptr_csu_struct,export_filename)) printf(_("The file was well export to %s\n"),export_filename); else printf(_("There is an error when exporting the file %s into a csv file.\n"),filename); } else { addFileExtension(export_filename,"m"); if (exportToM(ptr_csu_struct,export_filename)) printf(_("The file was well export to %s\n"),export_filename); else printf(_("There is an error when exporting the file %s into a m file.\n"),filename); } closeCsuStruct(ptr_csu_struct); systemPause(); }