Пример #1
1
// --------------------------------------------------------------------------------
void QmvFormTool::buildBackgroundPixmap( )
{
        // Determine page size using a QPinter object

    QPrinter* prt;
    QSize ps;

        // Set the page size
    prt = new QPrinter();
    prt->setFullPage(true);
    prt->setPageSize( (QPrinter::PageSize) fh->form_pagesize.toInt() );
    prt->setOrientation( (QPrinter::Orientation) fh->form_orientation.toInt() );

        // Get the page metrics
    QPaintDeviceMetrics pdm(prt);
    ps.setWidth(pdm.width());
    ps.setHeight(pdm.height());

    delete prt;

    background.resize( ps );
    pagesize = ps;
    
    background.fill( getTransparentColor() );

        // clear the canvas event index
    canvas_details.setAutoDelete(FALSE);
    canvas_details.clear();

}
void print_C(void)
{
	print_member_types<C> pdm;

	pdm(std::cout, true) << std::endl;
	pdm(std::cout,false) << std::endl;
}
Пример #3
0
/** Gets the metrics for the selected page size & orientation */
QSize MReportEngine::getPageMetrics( int size, int orientation ) {

  QSize ps;

  // Set the page size

  if (( QPrinter::PageSize ) size == QPrinter::Custom ) {
    ps.setWidth( customWidthMM / 25.4 * 78. );
    ps.setHeight( customHeightMM / 25.4 * 78. );
    return ps;
  }

#if defined(Q_OS_WIN32)
  if ( !printToPos ) {
    PSPrinter *printer = new PSPrinter( PSPrinter::HighResolution );
    printer->setFullPage( true );
    printer->setPageSize(( PSPrinter::PageSize ) size );
    printer->setOrientation(( PSPrinter::Orientation ) orientation );
    QPaintDeviceMetrics pdm( printer );
    ps.setWidth( pdm.widthMM() / 25.4 * 78. );
    ps.setHeight( pdm.heightMM() / 25.4 * 78. );
    delete printer;
  } else {
    FLPosPrinter * printer = new FLPosPrinter();
    QPaintDeviceMetrics pdm( printer );
    ps.setWidth( pdm.widthMM() / 25.4 * 78. );
    ps.setHeight( pdm.heightMM() / 25.4 * 78. );
    delete printer;
  }

#else
  if ( !printToPos ) {
    QPrinter * printer = new QPrinter( QPrinter::HighResolution );
    printer->setFullPage( true );
    printer->setPageSize(( QPrinter::PageSize ) size );
    printer->setOrientation(( QPrinter::Orientation ) orientation );
    QPaintDeviceMetrics pdm( printer );
    ps.setWidth( pdm.widthMM() / 25.4 * 78. );
    ps.setHeight( pdm.heightMM() / 25.4 * 78. );
    delete printer;
  } else {
    FLPosPrinter * printer = new FLPosPrinter();
    QPaintDeviceMetrics pdm( printer );
    ps.setWidth( pdm.widthMM() / 25.4 * 78. );
    ps.setHeight( pdm.heightMM() / 25.4 * 78. );
    delete printer;
  }

#endif

  return ps;
}
Пример #4
0
static bool
HasGMPFor(const nsACString& aAPI,
          const nsACString& aCodec,
          const nsACString& aGMP)
{
  MOZ_ASSERT(NS_IsMainThread());
#ifdef XP_WIN
  // gmp-clearkey uses WMF for decoding, so if we're using clearkey we must
  // verify that WMF works before continuing.
  if (aGMP.EqualsLiteral("org.w3.clearkey")) {
    RefPtr<WMFDecoderModule> pdm(new WMFDecoderModule());
    if (aCodec.EqualsLiteral("aac") &&
        !pdm->SupportsMimeType(NS_LITERAL_CSTRING("audio/mp4a-latm"))) {
      return false;
    }
    if (aCodec.EqualsLiteral("h264") &&
        !pdm->SupportsMimeType(NS_LITERAL_CSTRING("video/avc"))) {
      return false;
    }
  }
#endif
  nsTArray<nsCString> tags;
  tags.AppendElement(aCodec);
  tags.AppendElement(aGMP);
  nsCOMPtr<mozIGeckoMediaPluginService> mps =
    do_GetService("@mozilla.org/gecko-media-plugin-service;1");
  if (NS_WARN_IF(!mps)) {
    return false;
  }
  bool hasPlugin = false;
  if (NS_FAILED(mps->HasPluginForAPI(aAPI, &tags, &hasPlugin))) {
    return false;
  }
  return hasPlugin;
}
Пример #5
0
void MReportEngine::setRelDpi( float relDpi ) {
  relDpi_ = relDpi;
#if defined (Q_OS_LINUX)
  QPaintDeviceMetrics pdm( QApplication::desktop() );

  if ( pdm.logicalDpiX() < pdm.logicalDpiY() )
    relCalcDpi_ = relDpi_ / pdm.logicalDpiY();
  else
    relCalcDpi_ = relDpi_ / pdm.logicalDpiX();
#else
#if defined(Q_OS_WIN32)
  QPaintDeviceMetrics pdm( QApplication::desktop() );
  relCalcDpi_ = relDpi_ / pdm.logicalDpiY();
#else
  relCalcDpi_ = 1;
#endif
#endif

  if ( p )
    p->setRelDpi( relCalcDpi_ );
}
Пример #6
0
VideoDecoderParent::VideoDecoderParent(VideoDecoderManagerParent* aParent,
                                       const VideoInfo& aVideoInfo,
                                       const layers::TextureFactoryIdentifier& aIdentifier,
                                       TaskQueue* aManagerTaskQueue,
                                       TaskQueue* aDecodeTaskQueue,
                                       bool* aSuccess)
  : mParent(aParent)
  , mManagerTaskQueue(aManagerTaskQueue)
  , mDecodeTaskQueue(aDecodeTaskQueue)
  , mKnowsCompositor(new KnowsCompositorVideo)
  , mDestroyed(false)
{
  MOZ_COUNT_CTOR(VideoDecoderParent);
  MOZ_ASSERT(OnManagerThread());
  // We hold a reference to ourselves to keep us alive until IPDL
  // explictly destroys us. There may still be refs held by
  // tasks, but no new ones should be added after we're
  // destroyed.
  mIPDLSelfRef = this;

  mKnowsCompositor->IdentifyTextureHost(aIdentifier);

#ifdef XP_WIN
  // TODO: Ideally we wouldn't hardcode the WMF PDM, and we'd use the normal PDM
  // factory logic for picking a decoder.
  WMFDecoderModule::Init();
  RefPtr<WMFDecoderModule> pdm(new WMFDecoderModule());
  pdm->Startup();

  CreateDecoderParams params(aVideoInfo);
  params.mTaskQueue = mDecodeTaskQueue;
  params.mCallback = this;
  params.mKnowsCompositor = mKnowsCompositor;
  params.mImageContainer = new layers::ImageContainer();

  mDecoder = pdm->CreateVideoDecoder(params);
#else
  MOZ_ASSERT(false, "Can't use RemoteVideoDecoder on non-Windows platforms yet");
#endif

  *aSuccess = !!mDecoder;
}
Пример #7
0
bool MReportViewer::printPosReport()
{
  if (report == 0)
    return false;

  posprinter = new FLPosPrinter();
  posprinter->setPaperWidth((FLPosPrinter::PaperWidth) report->pageSize());
  posprinter->setPrinterName(printerName_);

  QPicture *page;
  QPainter painter;
  bool printRev = false;

  int viewIdx = report->getCurrentIndex();

  int printCopies = numCopies_;

  painter.begin(posprinter);
  QPaintDeviceMetrics pdm(posprinter);
  QSize dim(report->pageDimensions());
  painter.setWindow(0, 0, dim.width(), dim.height());
  painter.setViewport(0, 0, pdm.width(), pdm.height());

  for (int j = 0; j < printCopies; j++) {
    report->setCurrentPage(1);
    page = report->getCurrentPage();
    page->play(&painter);
  }

  painter.end();
  report->setCurrentPage(viewIdx);

  delete posprinter;

  return true;
}
Пример #8
0
void KdeGlWidget::initializeGL()
{
    if (!appCore->initRenderer())
    {
//        cerr << "Failed to initialize renderer.\n";
        exit(1);
    }

    time_t curtime=time(NULL);
    appCore->start(astro::UTCtoTDB((double) curtime / 86400.0 + (double) astro::Date(1970, 1, 1)));
    localtime(&curtime); /* Only doing this to set timezone as a side effect*/
    appCore->setTimeZoneBias(-timezone+3600*daylight);
    appCore->setTimeZoneName(tzname[daylight?0:1]);
    appCore->tick();

    KGlobal::config()->setGroup("Preferences");
    if (KGlobal::config()->hasKey("RendererFlags"))
        appRenderer->setRenderFlags(KGlobal::config()->readNumEntry("RendererFlags"));
    if (KGlobal::config()->hasKey("OrbitMask"))
        appRenderer->setOrbitMask(KGlobal::config()->readNumEntry("OrbitMask"));
    if (KGlobal::config()->hasKey("LabelMode"))
        appRenderer->setLabelMode(KGlobal::config()->readNumEntry("LabelMode"));
    if (KGlobal::config()->hasKey("AmbientLightLevel"))
        appRenderer->setAmbientLightLevel(KGlobal::config()->readDoubleNumEntry("AmbientLightLevel"));
    if (KGlobal::config()->hasKey("FaintestVisible"))
        appCore->setFaintest(KGlobal::config()->readDoubleNumEntry("FaintestVisible"));
    if (KGlobal::config()->hasKey("HudDetail"))
        appCore->setHudDetail(KGlobal::config()->readNumEntry("HudDetail"));
    if (KGlobal::config()->hasKey("TimeZoneBias"))
        appCore->setTimeZoneBias(KGlobal::config()->readNumEntry("TimeZoneBias"));
    if (KGlobal::config()->hasKey("MinFeatureSize"))
        appRenderer->setMinimumFeatureSize(KGlobal::config()->readNumEntry("MinFeatureSize"));


    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_Basic))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathBasic")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_Multitexture))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathMultitexture")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombiner")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_DOT3_ARBVP))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathDOT3ARBVP")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner_NvVP))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombinerNvVP")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner_ARBVP))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombinerARBVP")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_ARBFP_ARBVP))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathARBFPARBVP")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NV30))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNV30")))->setEnabled(false);
    if (!appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_GLSL))
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathGLSL")))->setEnabled(false);

    if (KGlobal::config()->hasKey("RenderPath")) {
       GLContext::GLRenderPath path = (GLContext::GLRenderPath)KGlobal::config()->readNumEntry("RenderPath");
       if (appCore->getRenderer()->getGLContext()->renderPathSupported(path)) {
            appCore->getRenderer()->getGLContext()->setRenderPath(path);
       }
    }

    switch (appCore->getRenderer()->getGLContext()->getRenderPath()) {
    case GLContext::GLPath_Basic:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathBasic")))->setChecked(true);
        break;
    case GLContext::GLPath_Multitexture:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathMultitexture")))->setChecked(true);
        break;
    case GLContext::GLPath_NvCombiner:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombiner")))->setChecked(true);
        break;
    case GLContext::GLPath_DOT3_ARBVP:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathDOT3ARBVP")))->setChecked(true);
        break;
    case GLContext::GLPath_NvCombiner_NvVP:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombinerNvVP")))->setChecked(true);
        break;
    case GLContext::GLPath_NvCombiner_ARBVP:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNvCombinerARBVP")))->setChecked(true);
        break;
    case GLContext::GLPath_ARBFP_ARBVP:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathARBFPARBVP")))->setChecked(true);
        break;
    case GLContext::GLPath_NV30:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathNV30")))->setChecked(true);
        break;
    case GLContext::GLPath_GLSL:
        ((KToggleAction*)(((KdeApp*)parentWidget())->action("renderPathGLSL")))->setChecked(true);
        break;
    }

    KGlobal::config()->setGroup(0);

    QPaintDeviceMetrics pdm(this);
    appCore->setScreenDpi(pdm.logicalDpiY());
}
Пример #9
0
/** Prints the rendered report to the selected printer - displays Qt print dialog */
bool MReportViewer::printReport()
{
  // Check for a report
  if (report == 0)
    return false;

  report->setPrintToPos(printToPos_);

  if (report->printToPos())
    return printPosReport();

#if defined(Q_OS_WIN32)
  bool gsOk = false;
  QProcess *procTemp = new QProcess();
  procTemp->addArgument(aqApp->gsExecutable());
  procTemp->addArgument("--version");
  gsOk = procTemp->start();
  delete procTemp;
  if (gsOk) {
    if (printGhostReport())
      return true;
  }

  QMessageBox *m = new QMessageBox(tr("Sugerencia"),
                                   tr("Si instala Ghostscript (http://www.ghostscript.com) y añade\n"
                                      "el directorio de instalación a la ruta de búsqueda de programas\n"
                                      "del sistema (PATH), Eneboo podrá utilizarlo para optimizar\n"
                                      "sustancialmente la calidad de impresión y para poder generar códigos\nde barras.\n\n"),
                                   QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this, 0, false);
  m->show();
#endif

  // Get the page count
  int cnt = report->pageCount();

  // Check if there is a report or any pages to print
  if (cnt == 0) {
    QMessageBox::critical(this, "Kugar", tr("No hay páginas en el\ninforme para."), QMessageBox::Ok,
                          QMessageBox::NoButton, QMessageBox::NoButton);
    return false;
  }

  // Set the printer dialog
  printer = new QPrinter(QPrinter::HighResolution);
  printer->setPageSize((QPrinter::PageSize) report->pageSize());
  if ((QPrinter::PageSize) report->pageSize() == QPrinter::Custom)
    printer->setCustomPaperSize(report->pageDimensions());
  printer->setOrientation((QPrinter::Orientation) report->pageOrientation());
  printer->setMinMax(1, cnt);
  printer->setFromTo(1, cnt);
  printer->setFullPage(true);
  printer->setColorMode((QPrinter::ColorMode) colorMode_);
  printer->setNumCopies(numCopies_);
  printer->setResolution(dpi_);
  if (!printerName_.isEmpty())
    printer->setPrinterName(printerName_);
  QString printProg(aqApp->printProgram());
  if (!printProg.isEmpty())
    printer->setPrintProgram(aqApp->printProgram());

  bool printNow = true;
  if (!printerName_.isNull())
    printNow = true;
  else
    printNow = printer->setup(qApp->focusWidget());

  if (printNow) {
    QPicture *page;
    QPainter painter;
    bool printRev = false;

    // Save the viewer's page index
    int viewIdx = report->getCurrentIndex();

    // Check the order we are printing the pages
    if (printer->pageOrder() == QPrinter::LastPageFirst)
      printRev = true;

    // Get the count of pages and copies to print
    int printFrom = printer->fromPage() - 1;
    int printTo = printer->toPage();
    int printCnt = (printTo - printFrom);
    int printCopies = printer->numCopies();
    int totalSteps = printCnt * printCopies;
    int currentStep = 1;

    // Set copies to 1, QPrinter copies does not appear to work ...
    printer->setNumCopies(1);

    // Setup the progress dialog
    QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true);
    progress.setMinimumDuration(M_PROGRESS_DELAY);
    QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting()));
    progress.setProgress(0);
    qApp->processEvents();

    // Start the printer
    painter.begin(printer);
    QPaintDeviceMetrics pdm(printer);
    QSize dim(report->pageDimensions());
    painter.setWindow(0, 0, dim.width(), dim.height());
    painter.setViewport(0, 0, pdm.width(), pdm.height());

    // Print each copy
    for (int j = 0; j < printCopies; j++) {
      // Print each page in the collection
      for (int i = printFrom; i < printTo; i++, currentStep++) {
        if (!printer->aborted()) {
          progress.setProgress(currentStep);
          qApp->processEvents();
          if (printRev)
            report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i);
          else
            report->setCurrentPage(i);

          page = report->getCurrentPage();
          page->play(&painter);
          if ((i - printFrom) < printCnt - 1)
            printer->newPage();
        } else {
          j = printCopies;
          break;
        }
      }
      if (j < printCopies - 1)
        printer->newPage();
    }

    // Cleanup printing
    painter.end();
    report->setCurrentPage(viewIdx);
    delete printer;
    return true;
  }
  delete printer;
  return false;
}
Пример #10
0
/** Imprime directamente sobre formato PS */
bool MReportViewer::printReportToPS(const QString &outPsFile)
{
  // Check for a report
  if (report == 0)
    return false;

#if defined(Q_OS_WIN32) || defined(Q_OS_MACX)
  return printGhostReportToPS(outPsFile);
#endif

  // Get the page count
  int cnt = report->pageCount();

  // Check if there is a report or any pages to print
  if (cnt == 0) {
    QMessageBox::critical(this, "Kugar", tr("No hay páginas en el\ninforme para."), QMessageBox::Ok,
                          QMessageBox::NoButton, QMessageBox::NoButton);
    return false;
  }

  // Set the printer dialog
  printer = new QPrinter(QPrinter::HighResolution);
  printer->setPageSize((QPrinter::PageSize) report->pageSize());
  if ((QPrinter::PageSize) report->pageSize() == QPrinter::Custom)
    printer->setCustomPaperSize(report->pageDimensions());
  printer->setOrientation((QPrinter::Orientation) report->pageOrientation());
  printer->setMinMax(1, cnt);
  printer->setFromTo(1, cnt);
  printer->setFullPage(true);
  printer->setColorMode((QPrinter::ColorMode) colorMode_);
  printer->setNumCopies(numCopies_);
  printer->setOutputToFile(true);
  printer->setOutputFileName(outPsFile);

  QPicture *page;
  QPainter painter;
  bool printRev = false;

  // Save the viewer's page index
  int viewIdx = report->getCurrentIndex();

  // Check the order we are printing the pages
  if (printer->pageOrder() == QPrinter::LastPageFirst)
    printRev = true;

  // Get the count of pages and copies to print
  int printFrom = printer->fromPage() - 1;
  int printTo = printer->toPage();
  int printCnt = (printTo - printFrom);
  int printCopies = printer->numCopies();
  int totalSteps = printCnt * printCopies;
  int currentStep = 1;

  // Set copies to 1, QPrinter copies does not appear to work ...
  printer->setNumCopies(numCopies_);
  printer->setResolution(dpi_);

  // Setup the progress dialog
  QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true);
  progress.setMinimumDuration(M_PROGRESS_DELAY);
  QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting()));
  progress.setProgress(0);
  qApp->processEvents();

  // Start the printer
  painter.begin(printer);
  QPaintDeviceMetrics pdm(printer);
  QSize dim(report->pageDimensions());
  painter.setWindow(0, 0, dim.width(), dim.height());
  painter.setViewport(0, 0, pdm.width(), pdm.height());

  // Print each page in the collection
  for (int j = 0; j < printCopies; j++) {
    for (int i = printFrom; i < printTo; i++, currentStep++) {
      if (!printer->aborted()) {
        progress.setProgress(currentStep);
        qApp->processEvents();
        if (printRev)
          report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i);
        else
          report->setCurrentPage(i);

        page = report->getCurrentPage();
        page->play(&painter);
        if ((i - printFrom) < printCnt - 1)
          printer->newPage();
      } else {
        j = printCopies;
        break;
      }
    }
    if (j < printCopies - 1)
      printer->newPage();
  }

  // Cleanup printing
  painter.end();
  report->setCurrentPage(viewIdx);
  delete printer;
  return true;
}
Пример #11
0
bool MReportViewer::printGhostReportToPS(const QString &outPsFile)
{
  if (report == 0)
    return false;

  int cnt = report->pageCount();

  if (cnt == 0)
    return false;

  psprinter = new PSPrinter(PSPrinter::HighResolution);
  psprinter->setPageSize((PSPrinter::PageSize) report->pageSize());
  if ((PSPrinter::PageSize) report->pageSize() == PSPrinter::Custom)
    psprinter->setCustomPaperSize(report->pageDimensions());
  psprinter->setOrientation((PSPrinter::Orientation) report->pageOrientation());
  psprinter->setMinMax(1, cnt);
  psprinter->setFromTo(1, cnt);
  psprinter->setFullPage(true);
  psprinter->setColorMode((PSPrinter::ColorMode) colorMode_);
  psprinter->setNumCopies(numCopies_);
  psprinter->setResolution(dpi_);

  QPicture *page;
  QPainter painter;
  bool printRev = false;

  int viewIdx = report->getCurrentIndex();

  if (psprinter->pageOrder() == QPrinter::LastPageFirst)
    printRev = true;

  int printFrom = psprinter->fromPage() - 1;
  int printTo = psprinter->toPage();
  int printCnt = (printTo - printFrom);
  int printCopies = psprinter->numCopies();
  int totalSteps = printCnt * printCopies;
  int currentStep = 1;

  psprinter->setNumCopies(1);
  psprinter->setOutputToFile(true);
  psprinter->setOutputFileName(outPsFile);

  QProgressDialog progress(tr("Imprimiendo Informe..."), tr("Cancelar"), totalSteps, this, tr("progreso"), true);
  progress.setMinimumDuration(M_PROGRESS_DELAY);
  QObject::connect(&progress, SIGNAL(cancelled()), this, SLOT(slotCancelPrinting()));
  progress.setProgress(0);
  qApp->processEvents();

  painter.begin(psprinter);
  QPaintDeviceMetrics pdm(psprinter);
  QSize dim(report->pageDimensions());
  painter.setWindow(0, 0, dim.width(), dim.height());
  painter.setViewport(0, 0, pdm.width(), pdm.height());

  for (int j = 0; j < printCopies; j++) {
    for (int i = printFrom; i < printTo; i++, currentStep++) {
      if (!psprinter->aborted()) {
        progress.setProgress(currentStep);
        qApp->processEvents();
        if (printRev)
          report->setCurrentPage((printCnt == 1) ? i : (printCnt - 1) - i);
        else
          report->setCurrentPage(i);
        page = report->getCurrentPage();
        page->play(&painter);
        if ((i - printFrom) < printCnt - 1)
          psprinter->newPage();
      } else {
        j = printCopies;
        break;
      }
    }
    if (j < printCopies - 1)
      psprinter->newPage();
  }

  painter.end();
  report->setCurrentPage(viewIdx);

  delete psprinter;
  return true;
}
Пример #12
0
int main(int argc, char *argv[])
{
  QApplication::setColorSpec(QApplication::ManyColor);

  DesignerApplication a(argc, argv);

  DesignerApplication::setOverrideCursor(Qt::WaitCursor);

  bool creatPid = FALSE;
  if (a.argc() > 1) {
    QString arg1 = a.argv()[ 1 ];
    if (arg1 == "-client") {
      QFile pf(QDir::homeDirPath() + "/.designerpid");
      if (pf.exists() && pf.open(IO_ReadOnly)) {
        QString pidStr;
        pf.readLine(pidStr, pf.size());
        QFile f(QDir::homeDirPath() + "/.designerargs");
        f.open(IO_WriteOnly);
        QTextStream ts(&f);
        for (int i = 1; i < a.argc(); ++i)
          ts << a.argv()[ i ] << " ";
        ts << endl;
        f.close();
#if defined(Q_OS_UNIX)
        if (kill(pidStr.toInt(), SIGUSR1) == -1)
          creatPid = TRUE;
        else
          return 0;
#elif defined(Q_OS_WIN32)
        if (!GetProcessVersion(pidStr.toUInt())) {
          creatPid = TRUE;
        } else {
          if (a.winVersion() & Qt::WV_NT_based)
            SendMessage(HWND_BROADCAST, RegisterWindowMessage((TCHAR *)"QT_DESIGNER_OPEN_FILE"), 0, 0);
          else
            SendMessage(HWND_BROADCAST, RegisterWindowMessageA("QT_DESIGNER_OPEN_FILE"), 0, 0);
          return 0;
        }
#endif
      } else {
        creatPid = TRUE;
      }
    } else if (arg1 == "-debug_stderr") {
      extern bool debugToStderr; //outputwindow.cpp
      debugToStderr = TRUE;
    }
  }

  if (creatPid) {
    QFile pf(QDir::homeDirPath() + "/.designerpid");
    pf.open(IO_WriteOnly);
    QTextStream ts(&pf);
#if defined(Q_OS_UNIX)
    signal(SIGUSR1, signalHandler);
#endif
    ts << getpid() << endl;

    pf.close();
    signal(SIGABRT, exitHandler);
    signal(SIGFPE, exitHandler);
    signal(SIGILL, exitHandler);
    signal(SIGINT, exitHandler);
    signal(SIGSEGV, exitHandler);
    signal(SIGTERM, exitHandler);
  }

  extern void qInitImages_designercore();
  qInitImages_designercore();

  QSettings settings;
  settings.setPath("InfoSiAL", "AbanQ", QSettings::User);
  QFont appFont;
  QString keybase("AbanQ/");

#if defined (Q_OS_LINUX)
  QPaintDeviceMetrics pdm(QApplication::desktop());
  float relDpi;
  if (pdm.logicalDpiX() < pdm.logicalDpiY())
    relDpi = 78. / pdm.logicalDpiY();
  else
    relDpi = 78. / pdm.logicalDpiX();
  int pointSize = 10 * relDpi;
#else
  int pointSize = 10;
#endif

#if defined(Q_OS_WIN32)
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Tahoma"));
  pointSize = 8;
#else

#if defined(Q_OS_MACX)
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Lucida Grande"));
  pointSize = 10;
#else
  appFont.setFamily(settings.readEntry(keybase + "fuente/familia", "Sans"));
#endif

#endif

  appFont.setPointSize(settings.readNumEntry(keybase + "fuente/puntos", pointSize));
  appFont.setBold(settings.readBoolEntry(keybase + "fuente/negrita", false));
  appFont.setItalic(settings.readBoolEntry(keybase + "fuente/cursiva", false));
  appFont.setUnderline(settings.readBoolEntry(keybase + "fuente/subrayado", false));
  appFont.setStrikeOut(settings.readBoolEntry(keybase + "fuente/tachado", false));

  a.setFont(appFont);

#if defined(Q_OS_WIN32)
  a.setStyle(settings.readEntry(keybase + "estilo", "Bluecurve"));
#else
  a.setStyle(settings.readEntry(keybase + "estilo", "Plastik"));
#endif

  keybase = DesignerApplication::settingsKey();
  QSettings config;
  config.insertSearchPath(QSettings::Windows, "/Trolltech");
  QStringList pluginPaths = config.readListEntry(keybase + "PluginPaths");
  pluginPaths << QString(qApp->applicationDirPath() + "/../plugins");
  if (pluginPaths.count())
    QApplication::setLibraryPaths(pluginPaths);

  QSplashScreen *splash = a.showSplash();

  MainWindow *mw = new MainWindow(creatPid);
  a.setMainWidget(mw);
#if defined(QT_NON_COMMERCIAL)
  mw->setCaption("Qt Designer by Trolltech for non-commercial use");
#else
  mw->setCaption("Qt Designer by Trolltech");
#endif
  if (config.readBoolEntry(keybase + "Geometries/MainwindowMaximized", FALSE)) {
    int x = config.readNumEntry(keybase + "Geometries/MainwindowX", 0);
    int y = config.readNumEntry(keybase + "Geometries/MainwindowY", 0);
    mw->move(x, y);
    mw->showMaximized();
  } else {
    mw->show();
  }
  if (splash)
    splash->finish(mw);
  delete splash;

  QApplication::restoreOverrideCursor();
  for (int i = 1; i < a.argc(); ++i) {
    QString arg = a.argv()[ i ];
    if (arg[0] != '-')
      mw->fileOpen("", "", arg);
  }

  return a.exec();
}
Пример #13
0
int main( int argc, char ** argv ) {
	QApplication a( argc, argv );

	QSettings settings;
	settings.setPath( "InfoSiAL", "FacturaLUX", QSettings::User );
	QFont appFont;
	QString keybase( "/facturalux/lite/" );

	a.setLibraryPaths( FLPREFIX "/plugins" );

#if defined (Q_OS_LINUX)
	QPaintDeviceMetrics pdm( QApplication::desktop() );
	float relDpi;
	if ( pdm.logicalDpiX() < pdm.logicalDpiY() )
		relDpi = 78. / pdm.logicalDpiY();
	else
		relDpi = 78. / pdm.logicalDpiX();
	int pointSize = 10 * relDpi;
#else
	int pointSize = 10;
#endif

#if defined(Q_OS_WIN32)
	appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Tahoma" ) );
	pointSize = 8;
#else

#if defined(Q_OS_MACX)
	appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Lucida Grande" ) );
	pointSize = 10;
#else
	appFont.setFamily( settings.readEntry( keybase + "fuente/familia", "Sans" ) );
#endif

#endif

	appFont.setPointSize( settings.readNumEntry( keybase + "fuente/puntos", pointSize ) );
	appFont.setBold( settings.readBoolEntry( keybase + "fuente/negrita", false ) );
	appFont.setItalic( settings.readBoolEntry( keybase + "fuente/cursiva", false ) );
	appFont.setUnderline( settings.readBoolEntry( keybase + "fuente/subrayado", false ) );
	appFont.setStrikeOut( settings.readBoolEntry( keybase + "fuente/tachado", false ) );

	a.setFont( appFont );

#if defined(Q_OS_WIN32)
	a.setStyle( settings.readEntry( keybase + "estilo", "Bluecurve" ) );
#else
	a.setStyle( settings.readEntry( keybase + "estilo", "Plastik" ) );
#endif

	if ( argc <= 1 ) {
		Teddy *mw = new Teddy();
		mw->setCaption( "Teddy" );
		mw->show();
	}
	else {
		for (int i = 1; i < argc; i++) {
			Teddy *mw = new Teddy();
			mw->load( argv[i] );
			mw->show();
		}
	}

	a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
	return a.exec();
}
void f()
{
    pointmemfun pmf(0);   // { dg-warning "zero as null pointer" }
    pointdmem   pdm(0);   // { dg-warning "zero as null pointer" }
    pointfun    pf(0);    // { dg-warning "zero as null pointer" }
    int*        p(0);     // { dg-warning "zero as null pointer" }

    pointmemfun pmfn(nullptr);
    pointdmem   pdmn(nullptr);
    pointfun    pfn(nullptr);
    int*        pn(nullptr);

    pmf = 0;              // { dg-warning "zero as null pointer" }

    pdm = 0;              // { dg-warning "zero as null pointer" }

    pf = 0;               // { dg-warning "zero as null pointer" }

    p = 0;                // { dg-warning "zero as null pointer" }

    pmf = nullptr;

    pdm = nullptr;

    pf = nullptr;

    p = nullptr;

    if (pmf)
        ;

    if (pdm)
        ;

    if (pf)
        ;

    if (p)
        ;

    if (!pmf)
        ;

    if (!pdm)
        ;

    if (!pf)
        ;

    if (!p)
        ;

    if (pmf == 0)         // { dg-warning "zero as null pointer" }
        ;

    if (pdm == 0)         // { dg-warning "zero as null pointer" }
        ;

    if (pf == 0)          // { dg-warning "zero as null pointer" }
        ;

    if (p == 0)           // { dg-warning "zero as null pointer" }
        ;

    if (0 == pmf)         // { dg-warning "zero as null pointer" }
        ;

    if (0 == pdm)         // { dg-warning "zero as null pointer" }
        ;

    if (0 == pf)          // { dg-warning "zero as null pointer" }
        ;

    if (0 == p)           // { dg-warning "zero as null pointer" }
        ;

    if (pmf != 0)         // { dg-warning "zero as null pointer" }
        ;

    if (pdm != 0)         // { dg-warning "zero as null pointer" }
        ;

    if (pf != 0)          // { dg-warning "zero as null pointer" }
        ;

    if (p != 0)           // { dg-warning "zero as null pointer" }
        ;

    if (0 != pmf)         // { dg-warning "zero as null pointer" }
        ;

    if (0 != pdm)         // { dg-warning "zero as null pointer" }
        ;

    if (0 != pf)          // { dg-warning "zero as null pointer" }
        ;

    if (0 != p)           // { dg-warning "zero as null pointer" }
        ;

    if (pmf == nullptr)
        ;

    if (pdm == nullptr)
        ;

    if (pf == nullptr)
        ;

    if (p == nullptr)
        ;

    if (nullptr == pmf)
        ;

    if (nullptr == pdm)
        ;

    if (nullptr == pf)
        ;

    if (nullptr == p)
        ;

    if (pmf != nullptr)
        ;

    if (pdm != nullptr)
        ;

    if (pf != nullptr)
        ;

    if (p != nullptr)
        ;

    if (nullptr != pmf)
        ;

    if (nullptr != pdm)
        ;

    if (nullptr != pf)
        ;

    if (nullptr != p)
        ;
}