QTfrontend/ui/page/pagevideos.cpp
author Stepan777 <stepik-777@mail.ru>
Mon, 11 Jun 2012 18:15:30 +0400
changeset 7235 baa69bd025d9
child 7280 fd707afbc3a2
permissions -rw-r--r--
1. Implement new page in frontend with options for video recording. 2. Store temoprary files in different directory
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7235
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     1
/*
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     4
 *
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     8
 *
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    13
 *
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    17
 */
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    18
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    19
#include <QGridLayout>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    20
#include <QPushButton>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    21
#include <QGroupBox>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    22
#include <QComboBox>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    23
#include <QCheckBox>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    24
#include <QLabel>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    25
#include <QLineEdit>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    26
#include <QSpinBox>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    27
#include <QTableWidget>
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    28
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    29
#include "pagevideos.h"
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    30
#include "igbox.h"
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    31
#include "libav_iteraction.h"
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    32
#include "gameuiconfig.h"
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    33
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    34
QLayout * PageVideos::bodyLayoutDefinition()
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    35
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    36
    QGridLayout * pageLayout = new QGridLayout();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    37
    pageLayout->setColumnStretch(0, 1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    38
    pageLayout->setColumnStretch(1, 1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    39
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    40
    {
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    41
        IconedGroupBox* groupRec = new IconedGroupBox(this);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    42
        groupRec->setIcon(QIcon(":/res/graphicsicon.png"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    43
        groupRec->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    44
        groupRec->setTitle(QGroupBox::tr("Video recording options"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    45
        QGridLayout * RecLayout = new QGridLayout(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    46
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    47
        // Label for format
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    48
        QLabel *labelFormat = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    49
        labelFormat->setText(QLabel::tr("Format"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    50
        RecLayout->addWidget(labelFormat, 0, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    51
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    52
        // List of supported formats
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    53
        CBAVFormats = new QComboBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    54
        RecLayout->addWidget(CBAVFormats, 0, 1, 1, 4);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    55
        LibavIteraction::instance().FillFormats(CBAVFormats);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    56
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    57
        QFrame * hr = new QFrame(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    58
        hr->setFrameStyle(QFrame::HLine);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    59
        hr->setLineWidth(3);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    60
        hr->setFixedHeight(10);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    61
        RecLayout->addWidget(hr, 1, 0, 1, 5);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    62
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    63
        // Label for audio codec
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    64
        QLabel *labelACodec = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    65
        labelACodec->setText(QLabel::tr("Audio codec"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    66
        RecLayout->addWidget(labelACodec, 2, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    67
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    68
        // List of supported audio codecs
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    69
        CBAudioCodecs = new QComboBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    70
        RecLayout->addWidget(CBAudioCodecs, 2, 1, 1, 3);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    71
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    72
        // record audio
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    73
        CBRecordAudio = new QCheckBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    74
        CBRecordAudio->setText(QCheckBox::tr("Record audio"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    75
        RecLayout->addWidget(CBRecordAudio, 2, 4);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    76
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    77
        hr = new QFrame(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    78
        hr->setFrameStyle(QFrame::HLine);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    79
        hr->setLineWidth(3);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    80
        hr->setFixedHeight(10);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    81
        RecLayout->addWidget(hr, 3, 0, 1, 5);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    82
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    83
        // Label for video codec
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    84
        QLabel *labelVCodec = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    85
        labelVCodec->setText(QLabel::tr("Video codec"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    86
        RecLayout->addWidget(labelVCodec, 4, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    87
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    88
        // List of supported video codecs
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    89
        CBVideoCodecs = new QComboBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    90
        RecLayout->addWidget(CBVideoCodecs, 4, 1, 1, 4);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    91
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    92
        // Label for resolution
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    93
        QLabel *labelRes = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    94
        labelRes->setText(QLabel::tr("Resolution"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    95
        RecLayout->addWidget(labelRes, 5, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    96
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    97
        // width
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    98
        widthEdit = new QLineEdit(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    99
        widthEdit->setValidator(new QIntValidator(this));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   100
        RecLayout->addWidget(widthEdit, 5, 1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   101
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   102
        // x
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   103
        QLabel *labelX = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   104
        labelX->setText("X");
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   105
        RecLayout->addWidget(labelX, 5, 2);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   106
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   107
        // height
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   108
        heightEdit = new QLineEdit(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   109
        heightEdit->setValidator(new QIntValidator(groupRec));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   110
        RecLayout->addWidget(heightEdit, 5, 3);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   111
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   112
        // use game res
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   113
        CBUseGameRes = new QCheckBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   114
        CBUseGameRes->setText(QCheckBox::tr("Use game resolution"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   115
        RecLayout->addWidget(CBUseGameRes, 5, 4);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   116
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   117
        // Label for framerate
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   118
        QLabel *labelFramerate = new QLabel(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   119
        labelFramerate->setText(QLabel::tr("Framerate"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   120
        RecLayout->addWidget(labelFramerate, 6, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   121
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   122
        // framerate
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   123
        framerateBox = new QSpinBox(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   124
        framerateBox->setRange(1, 200);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   125
        framerateBox->setSingleStep(1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   126
        RecLayout->addWidget(framerateBox, 6, 1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   127
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   128
        BtnDefaults = new QPushButton(groupRec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   129
        BtnDefaults->setText(QPushButton::tr("Set default options"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   130
        RecLayout->addWidget(BtnDefaults, 7, 0, 1, 5);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   131
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   132
        pageLayout->addWidget(groupRec, 0, 0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   133
    }
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   134
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   135
    {
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   136
        IconedGroupBox* groupTable = new IconedGroupBox(this);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   137
        //groupRec->setContentTopPadding(0);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   138
        groupTable->setIcon(QIcon(":/res/graphicsicon.png"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   139
        groupTable->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   140
        groupTable->setTitle(QGroupBox::tr("Videos"));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   141
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   142
        QStringList columns;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   143
        columns << tr("Name") << tr("Lenght") << tr("...");
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   144
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   145
        filesTable = new QTableWidget(groupTable);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   146
        filesTable->setColumnCount(3);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   147
        filesTable->setHorizontalHeaderLabels(columns);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   148
        QVBoxLayout *box = new QVBoxLayout(groupTable);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   149
        box->addWidget(filesTable);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   150
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   151
        pageLayout->addWidget(groupTable, 0, 1, 2, 1);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   152
    }
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   153
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   154
    return pageLayout;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   155
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   156
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   157
QLayout * PageVideos::footerLayoutDefinition()
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   158
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   159
    return NULL;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   160
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   161
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   162
void PageVideos::connectSignals()
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   163
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   164
    connect(CBUseGameRes, SIGNAL(stateChanged(int)), this, SLOT(changeUseGameRes(int)));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   165
    connect(CBRecordAudio, SIGNAL(stateChanged(int)), this, SLOT(changeRecordAudio(int)));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   166
    connect(CBAVFormats, SIGNAL(currentIndexChanged(int)), this, SLOT(changeAVFormat(int)));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   167
    connect(BtnDefaults, SIGNAL(clicked()), this, SLOT(setDefaultOptions()));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   168
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   169
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   170
PageVideos::PageVideos(QWidget* parent) : AbstractPage(parent)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   171
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   172
    initPage();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   173
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   174
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   175
void PageVideos::changeAVFormat(int index)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   176
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   177
    QString prevVCodec = getVideoCodec();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   178
    QString prevACodec = getAudioCodec();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   179
    CBVideoCodecs->clear();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   180
    CBAudioCodecs->clear();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   181
    LibavIteraction::instance().FillCodecs(CBAVFormats->itemData(index), CBVideoCodecs, CBAudioCodecs);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   182
    if (CBAudioCodecs->count() == 0)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   183
    {
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   184
        CBRecordAudio->setChecked(false);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   185
        CBRecordAudio->setEnabled(false);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   186
    }
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   187
    else
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   188
        CBRecordAudio->setEnabled(true);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   189
    int iVCodec = CBVideoCodecs->findData(prevVCodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   190
    if (iVCodec != -1)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   191
        CBVideoCodecs->setCurrentIndex(iVCodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   192
    int iACodec = CBAudioCodecs->findData(prevACodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   193
    if (iACodec != -1)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   194
        CBAudioCodecs->setCurrentIndex(iACodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   195
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   196
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   197
void PageVideos::changeUseGameRes(int state)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   198
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   199
    if (state && config)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   200
    {
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   201
        QRect resolution = config->vid_Resolution();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   202
        widthEdit->setText(QString::number(resolution.width()));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   203
        heightEdit->setText(QString::number(resolution.height()));
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   204
    }
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   205
    widthEdit->setEnabled(!state);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   206
    heightEdit->setEnabled(!state);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   207
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   208
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   209
void PageVideos::changeRecordAudio(int state)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   210
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   211
    CBAudioCodecs->setEnabled(!!state);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   212
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   213
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   214
void PageVideos::setDefaultCodecs()
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   215
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   216
    if (tryCodecs("mp4", "libx264", "libmp3lame"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   217
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   218
    if (tryCodecs("mp4", "libx264", "ac3_fixed"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   219
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   220
    if (tryCodecs("avi", "libxvid", "libmp3lame"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   221
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   222
    if (tryCodecs("avi", "libxvid", "ac3_fixed"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   223
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   224
    if (tryCodecs("avi", "mpeg4", "libmp3lame"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   225
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   226
    if (tryCodecs("avi", "mpeg4", "ac3_fixed"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   227
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   228
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   229
    // this shouldn't happen, just in case
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   230
    if (tryCodecs("ogg", "libtheora", "libvorbis"))
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   231
        return;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   232
    tryCodecs("ogg", "libtheora", "flac");
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   233
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   234
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   235
void PageVideos::setDefaultOptions()
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   236
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   237
    framerateBox->setValue(25);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   238
    CBRecordAudio->setChecked(true);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   239
    CBUseGameRes->setChecked(true);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   240
    setDefaultCodecs();
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   241
}
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   242
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   243
bool PageVideos::tryCodecs(const QString & format, const QString & vcodec, const QString & acodec)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   244
{
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   245
    int iFormat = CBAVFormats->findData(format);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   246
    if (iFormat == -1)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   247
        return false;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   248
    CBAVFormats->setCurrentIndex(iFormat);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   249
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   250
    int iVCodec = CBVideoCodecs->findData(vcodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   251
    if (iVCodec == -1)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   252
        return false;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   253
    CBVideoCodecs->setCurrentIndex(iVCodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   254
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   255
    int iACodec = CBAudioCodecs->findData(acodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   256
    if (iACodec == -1 && CBRecordAudio->isChecked())
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   257
        return false;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   258
    if (iACodec != -1)
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   259
        CBAudioCodecs->setCurrentIndex(iACodec);
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   260
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   261
    return true;
baa69bd025d9 1. Implement new page in frontend with options for video recording.
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
   262
}