Signals | Public Member Functions | Protected Slots

Exporter Class Reference

Main window for exporting data from the Builder. More...

#include <exporter.h>

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

List of all members.

Signals

void busy (bool)

Public Member Functions

 Exporter (BaseQueryModel *base, QWidget *parent=0)
QGridLayoutlayout ()
virtual void setVisible (bool visible)

Protected Slots

void updateButtons ()

Detailed Description

Main window for exporting data from the Builder.

exporter_sample.png

The base work-flow consist in selecting the options, like delimiter and file splitting type, specifying the target directory and the file name, and pressing the "Export" button.

For the file name you have the option to specify some variables that are filled in during the export process. Currently only two are supported, but others might be included on request in the future. Check the tooltip for a more extensive explanation of each variable.

Todo:
%interval:format% as an extension to %interval%?

Constructor & Destructor Documentation

Exporter::Exporter ( BaseQueryModel base,
QWidget parent = 0 
)

                                                                  : QWidget(parent)
{
    setObjectName("Exporter");

    // Setup members
    this->base = base;
    view = new QTableView;
    view->setModel(base);

    // Setup buttons
    exportButton = new QPushButton("Export", this);

    // Setup directory editor
    QLabel *dirLabel = new QLabel("Target directory:", this);
    dirEdit = new DirectoryEdit(this);

    // Setup filename editor
    QLabel *fileNameLabel = new QLabel("Target filename:", this);
    fileNameEdit = new FileNameEdit("export %interval%.txt", this);
    fileNameEdit->setToolTip("Currently supported keywords:\n"
                             "%interval% (on by default, works always)\n"
                             "%week% (only works when split on week, day, hour or minute)\n"
                             "Note: use them so your files don't get overwritten!");

    // Setup delimiters
    dBox = new DelimiterGroup("Delimiters", this);
    dBox->setStandardDelimiters();
    dBox->setAutoExclusive(true);

    // Setup Split-on combo's
    soBox = new SplitOnGroup("Split on", this);
    soBox->setStandardDelimiters();
    soBox->setAutoExclusive(true);

    // Setup include header checkbox
    exportHeader = new QCheckBox("Include header", this);
    exportHeader->setChecked(true);

    // Set...
    // setRealNumberNotation &  setRealNumberPrecision
    // setPadChar ( QChar ch ) & setFieldAlignment(QTextStream::AlignCenter) setFieldWidth(10);
    // setCodec ( QTextCodec * codec )

    // Setup layout
    QVBoxLayout *rightLayout = new QVBoxLayout;
    rightLayout->addWidget(dBox);
    rightLayout->addWidget(soBox);
    rightLayout->addWidget(exportHeader);
    rightLayout->addStretch();
    QGridLayout *bottomLayout = new QGridLayout;
    bottomLayout->addWidget(dirLabel, 0, 0, 1, 1);
    bottomLayout->addWidget(dirEdit, 0, 1, 1, 1);
    bottomLayout->addWidget(fileNameLabel, 1, 0, 1, 1);
    bottomLayout->addWidget(fileNameEdit, 1, 1, 1, 1);

    setLayout(new QGridLayout);
    layout()->addWidget(view, 0, 0, 1, 1);
    layout()->addLayout(rightLayout, 0, 1, 1, 1);
    layout()->addLayout(bottomLayout, 1, 0, 1, 1);
    layout()->addWidget(exportButton, 1, 1, 1, 1, Qt::AlignRight | Qt::AlignBottom);

    // Set connections
    connect(exportButton, SIGNAL(clicked()), this, SLOT(onExportButtonPush()));
}


Member Function Documentation

void Exporter::busy ( bool   )  [signal]
QGridLayout * Exporter::layout (  ) 

Reimplemented from QWidget.

Referenced by Exporter().

{
    return dynamic_cast<QGridLayout*>(QWidget::layout());
}

void Exporter::setVisible ( bool  visible  )  [virtual]

{
    updateButtons(); //daar geen betere plaats gevonden is...
    QWidget::setVisible(visible);
}

void Exporter::updateButtons (  )  [protected, slot]

Referenced by setVisible().

{
    //exportButton->setEnabled(base->rowCount() != 0);
}


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