CCCITT4Client::CCCITT4Client(QWidget *parent, QString sStoragePath) :
    QMainWindow(parent),
    ui(new Ui::CCCITT4Client)
{
    QString sTmp = sStoragePath;

    ui->setupUi(this);

    m_nCursorPos = 0;

    m_pSerialport = new CSerialport();
    m_pPortSelectionDialog = new CPortSelectionDialog();

    ui->BtSingleShot->setEnabled(false);
    ui->BtRepeat->setEnabled(false);

    if( (sStoragePath != "") && (QFile::exists(sStoragePath)) )
    {
        this->ui->lineEditPath->setText(sStoragePath);
    }
    else
    {
        this->ui->lineEditPath->setText(QDir::currentPath());
    }

    UpdateFileList();

    m_oScreenRefreshTimer.start(100);

    connect(ui->BtConnect, SIGNAL(clicked()), this, SLOT(OnBtConnectClicked()));
    connect(ui->BtSingleShot, SIGNAL(clicked()), this, SLOT(OnBtSingleShotClicked()));
    connect(ui->BtRepeat, SIGNAL(clicked()), this, SLOT(OnBtRepeatClicked()));
    connect(ui->BtPath, SIGNAL(clicked()), this, SLOT(OnBtPathClicked()));
    connect(ui->lineEditPath, SIGNAL(textChanged(QString)), this, SLOT(OnLineEditPathChanged(QString)));
    connect(ui->listWidgetFiles, SIGNAL(itemSelectionChanged()), this, SLOT(OnFilesListSelectionChanged()));
    connect(&m_oScreenRefreshTimer, SIGNAL(timeout()), this, SLOT(OnScreenRefreshTimer()));
    connect(m_pSerialport, SIGNAL(showErrorMessage(QString, bool, bool)), this, SLOT(OnShowErrorMessage(QString, bool, bool)));
    connect(m_pSerialport, SIGNAL(frameCompleted(QString)), this, SLOT(OnFrameCompleted(QString)));

}
Beispiel #2
0
void ActionThread::run()
{
    MagickImage* img     = 0;
    MagickImage* imgnext = 0;

    // have to keep dummy items at first and last
    imgnext              = loadImage(d->item);
    int upperBound       = 0;

    while (d->item->getNextImageItem() && d->running)
    {
        if (img)
        {
            d->api->freeImage(*img);
        }

        img             = imgnext;
        d->item         = d->item->getNextImageItem();
        imgnext         = loadImage(d->item);
        upperBound      = d->item->getTime() * d->framerate;

        processItem(upperBound, img, imgnext, TYPE_IMAGE);

        ActionData ad;
        ad.action       = TYPE_IMAGE;
        ad.fileUrl      = d->item->getPrevImageItem()->url();
        ad.totalFrames  = upperBound;
        Q_EMIT frameCompleted(ad);

        upperBound      = getTransitionFrames(d->item);
        processItem(upperBound, img, imgnext, TYPE_TRANSITION);

        ActionData tad;
        tad.action      = TYPE_TRANSITION;
        tad.fileUrl     = d->item->url();
        tad.totalFrames = upperBound;
        Q_EMIT frameCompleted(tad);
    }

    if (img)
    {
        d->api->freeImage(*img);
    }

    img            = imgnext;
    upperBound     = d->item->getTime() * d->framerate;
    processItem(upperBound, img, imgnext, TYPE_IMAGE);

    ActionData ad;
    ad.action      = TYPE_IMAGE;
    ad.fileUrl     = d->item->url();
    ad.totalFrames = upperBound;
    Q_EMIT frameCompleted(ad);

    if (img)
    {
        d->api->freeImage(*img);
    }

    if (!d->savePath.isNull())
    {
        d->encoder->encodeVideo(d->savePath, d->audioPath, d->videoFormat, d->videoType, d->path, d->aspectRatio);
        connect(d->encoder, SIGNAL(finished()),
                this, SLOT(quit()));
        exec();
    }

    Q_EMIT finished();
}