Public Member Functions

PreviewPage Class Reference
[File Upload Wizard Pages]

Fourth wizard page for previewing files to upload. More...

#include <fileuploadwizard.h>

Inheritance diagram for PreviewPage:
Inheritance graph
[legend]
Collaboration diagram for PreviewPage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PreviewPage (FileSelectionModel *fileSelectionModel, QWidget *parent=0)
void setLayout (WizardColumnLayout *layout)
WizardColumnLayoutlayout () const
void setVisible (bool visible)

Detailed Description

Fourth wizard page for previewing files to upload.

Implemented as one of the 6 wizard pages.


Constructor & Destructor Documentation

PreviewPage::PreviewPage ( FileSelectionModel fileSelectionModel,
QWidget parent = 0 
)

                                                                                          : FileUploadWizardPage(parent)
{
    setCommitPage(true);
    setTitle("Preview page");
    setSubTitle("Here you can preview the way files will be uploaded. "
                "You can start the uploadprocess by pressing next or you can click back and choose/create an other template.");

    QLabel *attentionLabel = new QLabel("ATTENTION! Each file will be uploaded the way it is previewed here. "
                                        "So make sure each file is previewed correctly.", this);
    attentionLabel->setWordWrap(true);

    buttonLayout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton << QWizard::CustomButton3;

    selectedFilesView = new QListView(this);
    selectedFilesView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    selectedFilesView->setSelectionMode(QAbstractItemView::SingleSelection);
    selectedFilesView->setModel(fileSelectionModel);
    selectedFilesView->selectionModel()->clearSelection();
    connect(selectedFilesView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
            this, SLOT(slot_fileSelected(QItemSelection,QItemSelection)));

    setLayout(new WizardColumnLayout(attentionLabel, selectedFilesView));
}


Member Function Documentation

WizardColumnLayout * PreviewPage::layout (  )  const

Referenced by setVisible().

{
    return dynamic_cast<WizardColumnLayout*>(FileUploadWizardPage::layout());
}

void PreviewPage::setLayout ( WizardColumnLayout layout  ) 

Referenced by PreviewPage().

void PreviewPage::setVisible ( bool  visible  ) 

{
    FileUploadWizardPage::setVisible(visible);
    if (!wizard()) return;
    if (visible) {
        // Button setup & connect
        wizard()->setButtonLayout(buttonLayout);
        wizard()->setButtonText(QWizard::CustomButton3, "&Upload All");
        connect(wizard(), SIGNAL(customButtonClicked(int)),
                this, SLOT(startUploadProcess()));

        // Template data setup
        QModelIndex selectedTemplate = wizard()->getTemplateView()->selectionModel()->selectedIndexes().first();
        spCode = selectedTemplate.data(TemplatesModel::TemplateDefinition).toString();
        spName = selectedTemplate.data(TemplatesModel::TemplateName).toString();
        spArgs = selectedTemplate.data(TemplatesModel::TemplateArgNames).toString();

        // Preview setup
        preview = new ImportFileView(this);
        preview->model()->setLimitedPreview(false);
        preview->setupAsPreviewer(spCode);
        layout()->addBottomWidget(preview);
    } else {
        layout()->removeRightWidget(wizard()->getFileSelectionView());

        // Button disconnect
        disconnect(wizard(), SIGNAL(customButtonClicked(int)),
                   this, SLOT(startUploadProcess()));
        wizard()->setDefaultButtonLayout();

        // Clean up
        spCode.clear();
        spName.clear();
        spArgs.clear();
        selectedFilesView->selectionModel()->clearSelection();
        if (preview) delete preview;
    }
}


The documentation for this class was generated from the following files: