void NewGalleryWizard::setupUi()
{
  setWindowTitle(tr("Create a new gallery"));

  setDefaultProperty("QComboBox", "currentText", "currentIndexChanged()");

  setOption(QWizard::DisabledBackButtonOnLastPage);

  addPage(new GWidgets::GWizard::WelcomePage);
  m_selectionPage = addPage(new GWidgets::GWizard::SelectionPage);
  addPage(new GWidgets::GWizard::SummaryPage);
  m_copyPage = addPage(new GWidgets::GWizard::CopyPage);
  addPage(new GWidgets::GWizard::FinishPage);

  setPixmap(QWizard::LogoPixmap, QPixmap(":/images/galerist.png").scaled(55, 55, Qt::KeepAspectRatio));
  setPixmap(QWizard::BannerPixmap, QPixmap(":/images/newgallerywizard-banner.png"));
  setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/galerist-big.png"));

#ifdef Q_WS_X11
  setWizardStyle(QWizard::ModernStyle);
#endif

  if (wizardStyle() == QWizard::MacStyle)
    setFixedSize(770, 570);
  else
    setFixedSize(580, 570);
}
void QIWizard::assignWatermark(const QString &strWatermark)
{
    /* Create initial watermark. */
    QPixmap pixWaterMark(strWatermark);

    /* Convert watermark to image which
     * allows to manage pixel data directly. */
    QImage imgWatermark = pixWaterMark.toImage();

    /* Use the right-top watermark pixel as frame color */
    QRgb rgbFrame = imgWatermark.pixel(imgWatermark.width() - 1, 0);

    /* Take into account button's height */
    int iPageHeight = height() - button(QWizard::CancelButton)->height();

    /* Create final image on the basis of incoming, applying the rules. */
    QImage imgWatermarkNew(imgWatermark.width(), qMax(imgWatermark.height(), iPageHeight), imgWatermark.format());
    for (int y = 0; y < imgWatermarkNew.height(); ++ y)
    {
        for (int x = 0; x < imgWatermarkNew.width(); ++ x)
        {
            /* Border rule 1 - draw border for ClassicStyle */
            if (wizardStyle() == QWizard::ClassicStyle &&
                (x == 0 || y == 0 || x == imgWatermarkNew.width() - 1 || y == imgWatermarkNew.height() - 1))
                imgWatermarkNew.setPixel(x, y, rgbFrame);
            /* Border rule 2 - draw border for ModernStyle */
            else if (wizardStyle() == QWizard::ModernStyle && x == imgWatermarkNew.width() - 1)
                imgWatermarkNew.setPixel(x, y, rgbFrame);
            /* Horizontal extension rule - use last used color */
            else if (x >= imgWatermark.width() && y < imgWatermark.height())
                imgWatermarkNew.setPixel(x, y, imgWatermark.pixel(imgWatermark.width() - 1, y));
            /* Vertical extension rule - use last used color */
            else if (y >= imgWatermark.height() && x < imgWatermark.width())
                imgWatermarkNew.setPixel(x, y, imgWatermark.pixel(x, imgWatermark.height() - 1));
            /* Common extension rule - use last used color */
            else if (x >= imgWatermark.width() && y >= imgWatermark.height())
                imgWatermarkNew.setPixel(x, y, imgWatermark.pixel(imgWatermark.width() - 1, imgWatermark.height() - 1));
            /* Else just copy color */
            else
                imgWatermarkNew.setPixel(x, y, imgWatermark.pixel(x, y));
        }
    }

    /* Convert processed image to pixmap and assign it to wizard's watermark. */
    QPixmap pixWatermarkNew = QPixmap::fromImage(imgWatermarkNew);
    setPixmap(QWizard::WatermarkPixmap, pixWatermarkNew);
}