Exemple #1
0
ExportWizard::ExportWizard(Canvas *canvas, bool printPreferred)
    : QWizard()
    , m_ui(new Ui::ExportWizard)
    , m_canvas(canvas)
    , m_printPreferred(printPreferred)
    , m_nextId(0)
    , m_pdfPrinter(0)
{
    // create and init UI
    m_ui->setupUi(this);
    connect(m_ui->clWallpaper, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    connect(m_ui->clImage, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    connect(m_ui->clPosteRazor, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    connect(m_ui->clPrint, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    connect(m_ui->clPdf, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    connect(m_ui->clSvg, SIGNAL(clicked()), this, SLOT(slotModeButtonClicked()));
    m_ui->prWebLabel->setText("<html><body><a href='" POSTERAZOR_WEBSITE_LINK "'>" + m_ui->prWebLabel->text() + "</a></body></html>" );
    connect(m_ui->prWebLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotOpenLink(const QString &)));
    m_ui->prTutorialLabel->setText("<html><body><a href='" POSTERAZOR_TUTORIAL_LINK "'>" + m_ui->prTutorialLabel->text() + "</a></body></html>" );
    connect(m_ui->prTutorialLabel, SIGNAL(linkActivated(const QString &)), this, SLOT(slotOpenLink(const QString &)));

#if !defined(Q_OS_WIN) && !defined(Q_OS_LINUX) && !defined(Q_OS_OS2)
#warning "Implement background change for this OS"
    m_ui->clWallpaper->hide();
#endif

    // set default sizes
    m_ui->saveHeight->setValue(m_canvas->height());
    m_ui->saveWidth->setValue(m_canvas->width());
    m_ui->imgFromDpi->setEnabled(m_printPreferred);
    m_ui->printDpi->setValue(m_canvas->modeInfo()->printDpi());
    m_ui->printLandscape->setChecked(m_canvas->modeInfo()->printLandscape());
    m_printSizeInches = canvasNatInches();

    // connect buttons
    connect(m_ui->chooseFilePath, SIGNAL(clicked()), this, SLOT(slotChoosePath()));
    connect(m_ui->imgFromCanvas, SIGNAL(clicked()), this, SLOT(slotImageFromCanvas()));
    connect(m_ui->imgFromDpi, SIGNAL(clicked()), this, SLOT(slotImageFromDpi()));
    connect(m_ui->printUnity, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPrintUnityChanged(int)));
    connect(m_ui->printWidth, SIGNAL(valueChanged(double)), this, SLOT(slotPrintSizeChanged()));
    connect(m_ui->printHeight, SIGNAL(valueChanged(double)), this, SLOT(slotPrintSizeChanged()));
    connect(m_ui->printDpi, SIGNAL(valueChanged(int)), this, SLOT(slotPrintSizeChanged()));
    connect(m_ui->pdfPageButton, SIGNAL(clicked()), this, SLOT(slotChoosePdfPage()));
    connect(m_ui->pdfPreviewButton, SIGNAL(clicked()), this, SLOT(slotPdfPreview()));
    connect(m_ui->pdfRes, SIGNAL(valueChanged(int)), this, SLOT(slotPdfResChanged(int)));
    connect(m_ui->svgChooseFilePath, SIGNAL(clicked()), this, SLOT(slotChooseSvgPath()));
    bool imperial = QLocale::system().measurementSystem() == QLocale::ImperialSystem;
    m_ui->printUnity->setCurrentIndex(imperial ? 2 : 1);

    // configure Wizard
    setOptions(NoDefaultButton | NoBackButtonOnStartPage | IndependentPages);
    setPage(PageMode);
    setMinimumWidth(400);
    if (m_printPreferred) {
        // clear the boldness of non-print buttons
        QFont font;
        font.setBold(false);
        m_ui->clImage->setFont(font);
        m_ui->clWallpaper->setFont(font);
        m_ui->clPosteRazor->setFont(font);
        m_ui->clPdf->setFont(font);
        m_ui->clSvg->setFont(font);

        // set the focus to the print button
        show();
        m_ui->clPrint->setFocus();
        //QTimer::singleShot(800, m_ui->clPrint, SLOT(animateClick()));
    }

    // react to 'finish'
    connect(this, SIGNAL(finished(int)), this, SLOT(slotFinished(int)));
}
Exemple #2
0
void App::initToolBar()
{
  m_toolbar = new QToolBar(this, "Workspace");

  QString dir;
  settings()->get(KEY_SYSTEM_DIR, dir);
  dir += QString("/") + PIXMAPPATH;
  
  new QToolButton(QPixmap(dir + QString("/filenew.xpm")), "New workspace; clear everything", 0, this, SLOT(slotFileNew()), m_toolbar);

  new QToolButton(QPixmap(dir + QString("/fileopen.xpm")), "Open existing workspace", 0, this, SLOT(slotFileOpen()), m_toolbar);

  new QToolButton(QPixmap(dir + QString("/filesave.xpm")), "Save current workspace", 0, this, SLOT(slotFileSave()), m_toolbar);

  m_toolbar->addSeparator();

  new QToolButton(QPixmap(dir + QString("/device.xpm")), "View device manager", 0, this, SLOT(slotViewDeviceManager()), m_toolbar);

  new QToolButton(QPixmap(dir + QString("/virtualconsole.xpm")), "View virtual console", 0, this, SLOT(slotViewVirtualConsole()), m_toolbar);


  QToolBar* vc = new QToolBar(this, "Virtual Console toolbar");

  new QToolButton(QPixmap(dir + QString("/panic.xpm")), "Panic; Shut down all running functions", 0, this, SLOT(slotPanic()), vc);

  m_modeButton = new QToolButton(QPixmap(dir + QString("/unlocked.xpm")), "Design Mode; All editing features enabled", 0, this, SLOT(slotModeButtonClicked()), vc);
}