| 1 |
#include "genctl_p.h" |
| 2 |
#include "genctl_p.moc" |
| 3 |
|
| 4 |
#include <qbuttongroup.h> |
| 5 |
#include <qvbuttongroup.h> |
| 6 |
#include <qcombobox.h> |
| 7 |
#include <qgroupbox.h> |
| 8 |
#include <qhgroupbox.h> |
| 9 |
#include <qvgroupbox.h> |
| 10 |
#include <qlabel.h> |
| 11 |
#include <qlineedit.h> |
| 12 |
#include <qlistbox.h> |
| 13 |
#include <qpushbutton.h> |
| 14 |
#include <qradiobutton.h> |
| 15 |
#include <qlayout.h> |
| 16 |
#include <qtooltip.h> |
| 17 |
#include <qwhatsthis.h> |
| 18 |
#include <qmenubar.h> |
| 19 |
#include <qmainwindow.h> |
| 20 |
#include <qvbox.h> |
| 21 |
#include <qhbox.h> |
| 22 |
|
| 23 |
#if QT_VERSION <= 220 |
| 24 |
#define LAYOUTCOL 1 |
| 25 |
#else |
| 26 |
#define LAYOUTCOL 0 |
| 27 |
#endif |
| 28 |
|
| 29 |
/* |
| 30 |
* Constructs a QtRecompressor which is a child of 'parent', with the |
| 31 |
* name 'name' and widget flags set to 'f' |
| 32 |
*/ |
| 33 |
QtRecompressor::QtRecompressor( QWidget* parent, const char* name, WFlags fl ) |
| 34 |
: QMainWindow( parent, name, fl ) |
| 35 |
{ |
| 36 |
QLabel* lb; |
| 37 |
QGridLayout* gl; |
| 38 |
QHBox* hb; |
| 39 |
QVBox* vb; |
| 40 |
|
| 41 |
if ( !name ) |
| 42 |
setName( "AviRecompressor" ); |
| 43 |
|
| 44 |
setCaption( tr( "AviRecompressor" ) ); |
| 45 |
//setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, sizePolicy().hasHeightForWidth() ) ); |
| 46 |
|
| 47 |
QPopupMenu *file = new QPopupMenu( this ); |
| 48 |
CHECK_PTR( file ); |
| 49 |
|
| 50 |
file->insertItem( "&Open video file", this, SLOT( fileOpenVideo() ), CTRL+Key_O ); |
| 51 |
file->insertItem( "&Append video file", this, SLOT( fileAppendVideo() ), CTRL+Key_A ); |
| 52 |
file->insertItem( "&Save AVI As", this, SLOT( fileSaveAvi() ), CTRL+Key_S ); |
| 53 |
//file->insertItem( "Save WAV ", this, SLOT( fileSaveAvi() ) ); |
| 54 |
//file->insertItem( "Save audio ", this, SLOT( fileSaveAvi() ) ); |
| 55 |
file->insertSeparator(); |
| 56 |
file->insertItem( "&Read Config", this, SLOT( fileLoadConfig() ), CTRL+Key_R ); |
| 57 |
file->insertItem( "&Write Config", this, SLOT( fileSaveConfig() ), CTRL+Key_W ); |
| 58 |
file->insertSeparator(); |
| 59 |
file->insertItem( "&Quit", this, SLOT( fileQuit() ), CTRL+Key_Q ); |
| 60 |
|
| 61 |
QPopupMenu *edit = new QPopupMenu( this ); |
| 62 |
CHECK_PTR( edit ); |
| 63 |
|
| 64 |
QPopupMenu *video = new QPopupMenu( this ); |
| 65 |
CHECK_PTR( video ); |
| 66 |
video->insertItem( "&Filters", this, SLOT( videoFilters() ), CTRL+Key_F ); |
| 67 |
|
| 68 |
QPopupMenu *audio = new QPopupMenu( this ); |
| 69 |
CHECK_PTR( audio ); |
| 70 |
|
| 71 |
QPopupMenu *options = new QPopupMenu( this ); |
| 72 |
CHECK_PTR( options ); |
| 73 |
options->insertItem( "&Preferences", this, SLOT( optionsPreferences() ) ); |
| 74 |
|
| 75 |
QPopupMenu *help = new QPopupMenu( this ); |
| 76 |
CHECK_PTR( help ); |
| 77 |
help->insertItem( "&Contents", this, SLOT( helpContents() ), CTRL+Key_H ); |
| 78 |
help->insertSeparator(); |
| 79 |
help->insertItem( "Changelog", this, SLOT( helpChangelog() ) ); |
| 80 |
|
| 81 |
QMenuBar* menu = menuBar(); // new QMenuBar( this ); |
| 82 |
statusBar(); |
| 83 |
|
| 84 |
CHECK_PTR( menu ); |
| 85 |
menu->insertItem( "&File", file ); |
| 86 |
menu->insertItem( "&Edit", edit ); |
| 87 |
menu->insertItem( "&Video", video ); |
| 88 |
menu->insertItem( "&Audio", audio ); |
| 89 |
menu->insertItem( "&Options", options ); |
| 90 |
menu->insertSeparator(); |
| 91 |
menu->insertItem( "&Help", help ); |
| 92 |
menu->setSeparator( QMenuBar::InWindowsStyle ); |
| 93 |
|
| 94 |
//QToolBar* qtb = new QToolBar( this ); |
| 95 |
//centralWidget() |
| 96 |
QVBox* bg = new QVBox( this ); |
| 97 |
bg->setMargin(10); |
| 98 |
setCentralWidget(bg); |
| 99 |
|
| 100 |
QGroupBox* g = new QGroupBox( tr( "Source and destination" ), bg ); |
| 101 |
g->setColumnLayout( LAYOUTCOL, Qt::Vertical ); |
| 102 |
|
| 103 |
gl = new QGridLayout( g->layout(), 1, 1 ); |
| 104 |
gl->setSpacing( 5 ); |
| 105 |
|
| 106 |
m_pButtonSrc = new QPushButton( tr( "&Source:" ), g ); |
| 107 |
//m_pButtonSrc->setAlignment( AlignRight | AlignVCenter ); |
| 108 |
gl->addWidget( m_pButtonSrc, 0, 0 ); |
| 109 |
|
| 110 |
m_pButtonDst = new QPushButton( tr( "&Destination:" ), g ); |
| 111 |
//m_pButtonDst->setAlignment( AlignRight | AlignVCenter ); |
| 112 |
gl->addWidget( m_pButtonDst, 1, 0 ); |
| 113 |
|
| 114 |
m_pButtonCfg = new QPushButton( tr( "Configuration:" ), g ); |
| 115 |
//m_pButtonCfg->setAlignment( AlignRight | AlignVCenter ); |
| 116 |
gl->addWidget( m_pButtonCfg, 2, 0 ); |
| 117 |
|
| 118 |
m_pLabelSrc = new QLabel( g ); |
| 119 |
m_pLabelSrc->setFrameShadow( QLabel::Sunken ); |
| 120 |
m_pLabelSrc->setFrameShape( QLabel::Box ); |
| 121 |
gl->addWidget( m_pLabelSrc, 0, 1 ); |
| 122 |
|
| 123 |
m_pLabelDst = new QLabel( g ); |
| 124 |
m_pLabelDst->setFrameShadow( QLabel::Sunken ); |
| 125 |
m_pLabelDst->setFrameShape( QLabel::Box ); |
| 126 |
gl->addWidget( m_pLabelDst, 1, 1 ); |
| 127 |
|
| 128 |
m_pLabelConfig = new QLabel( g ); |
| 129 |
m_pLabelConfig->setFrameShadow( QLabel::Sunken ); |
| 130 |
m_pLabelConfig->setFrameShape( QLabel::Box ); |
| 131 |
gl->addWidget( m_pLabelConfig, 2, 1 ); |
| 132 |
|
| 133 |
m_pButtonStart = new QPushButton( tr( "&Go!" ), g ); |
| 134 |
|
| 135 |
gl->addMultiCellWidget( m_pButtonStart, 0, 2, 2, 2 ); |
| 136 |
gl->setColStretch( 1, 1 ); |
| 137 |
|
| 138 |
|
| 139 |
g = new QGroupBox( tr( "Recompress options" ), bg ); |
| 140 |
g->setMargin( 5 ); |
| 141 |
g->setFrameShadow( QGroupBox::Sunken ); |
| 142 |
g->setFrameShape( QGroupBox::Box ); |
| 143 |
g->setColumnLayout( LAYOUTCOL , Qt::Vertical ); |
| 144 |
gl = new QGridLayout( g->layout(), 1, 1 ); |
| 145 |
|
| 146 |
hb = new QHBox( g ); |
| 147 |
hb->setSpacing( 5 ); |
| 148 |
gl->addMultiCellWidget( hb, 0, 0, 0, 1 ); |
| 149 |
|
| 150 |
lb = new QLabel( tr( "Stream:" ), hb ); |
| 151 |
|
| 152 |
m_pComboStreams = new QComboBox( FALSE, hb ); |
| 153 |
|
| 154 |
m_pButtonStreamDetails = new QPushButton( tr( "Details..." ), hb ); |
| 155 |
|
| 156 |
m_pButtonFormat = new QPushButton( tr( "Format..." ), hb ); |
| 157 |
m_pButtonFormat->setEnabled( FALSE ); |
| 158 |
|
| 159 |
/////////// |
| 160 |
|
| 161 |
m_pButtonGroupLimits = new QVButtonGroup( g ); |
| 162 |
m_pButtonGroupLimits->setLineWidth( 0 ); |
| 163 |
|
| 164 |
m_pRadioSeconds = new QRadioButton( tr( "seconds" ), m_pButtonGroupLimits ); |
| 165 |
m_pRadioFrames = new QRadioButton( tr( "frames" ), m_pButtonGroupLimits ); |
| 166 |
|
| 167 |
gl->addWidget( m_pButtonGroupLimits, 1, 0 ); |
| 168 |
|
| 169 |
|
| 170 |
QWidget* Layout27 = new QWidget( g ); |
| 171 |
gl->addWidget( Layout27, 1, 1, 1 ); |
| 172 |
|
| 173 |
QGridLayout* sgl = new QGridLayout( Layout27, 1, 1 ); |
| 174 |
sgl->setSpacing( 5 ); |
| 175 |
sgl->setMargin( 0 ); |
| 176 |
|
| 177 |
// first row |
| 178 |
m_pLineLowSec = new QLineEdit( Layout27 ); |
| 179 |
sgl->addWidget( m_pLineLowSec, 0, 0 ); |
| 180 |
|
| 181 |
lb = new QLabel( tr( "to" ), Layout27 ); |
| 182 |
sgl->addWidget( lb, 0, 1 ); |
| 183 |
|
| 184 |
m_pLineHighSec = new QLineEdit( Layout27 ); |
| 185 |
sgl->addWidget( m_pLineHighSec, 0, 2 ); |
| 186 |
|
| 187 |
// second row |
| 188 |
m_pLineLowFrames = new QLineEdit( Layout27 ); |
| 189 |
sgl->addWidget( m_pLineLowFrames, 1, 0 ); |
| 190 |
|
| 191 |
lb = new QLabel( tr( "to" ), Layout27 ); |
| 192 |
sgl->addWidget( lb, 1, 1 ); |
| 193 |
|
| 194 |
m_pLineHighFrames = new QLineEdit( Layout27 ); |
| 195 |
sgl->addWidget( m_pLineHighFrames, 1, 2 ); |
| 196 |
|
| 197 |
///////////// |
| 198 |
|
| 199 |
m_pButtonGroupStreamMode = new QVButtonGroup( g ); |
| 200 |
m_pButtonGroupStreamMode->setTitle( tr( "" ) ); |
| 201 |
m_pButtonGroupStreamMode->setLineWidth( 0 ); |
| 202 |
|
| 203 |
gl->addMultiCellWidget( m_pButtonGroupStreamMode, 0, 1, 2, 2 ); |
| 204 |
|
| 205 |
m_pRadioRemove = new QRadioButton( tr( "Remove" ), m_pButtonGroupStreamMode ); |
| 206 |
m_pRadioCopy = new QRadioButton( tr( "Copy" ), m_pButtonGroupStreamMode ); |
| 207 |
m_pRadioRecompress = new QRadioButton( tr( "Recompress" ), m_pButtonGroupStreamMode ); |
| 208 |
|
| 209 |
///////////// |
| 210 |
|
| 211 |
g = new QGroupBox( bg ); |
| 212 |
g->setTitle( tr( "Filters" ) ); |
| 213 |
g->setColumnLayout( LAYOUTCOL, Qt::Vertical ); |
| 214 |
gl = new QGridLayout( g->layout(), 1, 1 ); |
| 215 |
|
| 216 |
gl->setSpacing( 5 ); |
| 217 |
|
| 218 |
gl->setColStretch( 0, 4 ); |
| 219 |
gl->setColStretch( 2, 2 ); |
| 220 |
|
| 221 |
_lbFilters = new QListBox( g ); |
| 222 |
_lbFilters->insertItem( tr( "New Item" ) ); |
| 223 |
|
| 224 |
gl->addMultiCellWidget( _lbFilters, 0, 1, 0, 0 ); |
| 225 |
|
| 226 |
vb = new QVBox( g ); |
| 227 |
vb->setSpacing( 5 ); |
| 228 |
|
| 229 |
gl->addMultiCellWidget( vb, 0, 1, 1, 1 ); |
| 230 |
|
| 231 |
m_pButtonConfigFilter = new QPushButton( tr( "Configure" ), vb ); |
| 232 |
m_pButtonAddFilter = new QPushButton( tr( "Add" ), vb ); |
| 233 |
m_pButtonRemoveFilter = new QPushButton( tr( "Remove" ), vb ); |
| 234 |
m_pButtonUpFilter = new QPushButton( tr( "Up" ), vb ); |
| 235 |
m_pButtonUpFilter->setAutoRepeat( TRUE ); |
| 236 |
m_pButtonDownFilter = new QPushButton( tr( "Down" ) , vb ); |
| 237 |
m_pButtonDownFilter->setAutoRepeat( TRUE ); |
| 238 |
|
| 239 |
|
| 240 |
hb = new QHBox( g ); |
| 241 |
hb->setSpacing( 5 ); |
| 242 |
m_pButtonAboutFilter = new QPushButton( tr( "About" ), hb ); |
| 243 |
|
| 244 |
lb = new QLabel( tr( "Available filters" ), hb ); |
| 245 |
lb->setAlignment( AlignRight | AlignVCenter ); |
| 246 |
|
| 247 |
gl->addWidget( hb, 0, 2 ); |
| 248 |
|
| 249 |
hb = new QHBox(); |
| 250 |
|
| 251 |
m_pListAllFilters = new QListBox( g ); |
| 252 |
m_pListAllFilters->insertItem( tr( "New Item" ) ); |
| 253 |
|
| 254 |
gl->addWidget( m_pListAllFilters, 1, 2 ); |
| 255 |
|
| 256 |
// signals and slots connections |
| 257 |
connect( m_pButtonStreamDetails, SIGNAL( clicked() ), this, SLOT( detailsClicked() ) ); |
| 258 |
connect( m_pButtonAboutFilter, SIGNAL( clicked() ), this, SLOT( aboutFilterClicked() ) ); |
| 259 |
connect( m_pButtonAddFilter, SIGNAL( clicked() ), this, SLOT( addFilterClicked() ) ); |
| 260 |
connect( m_pButtonRemoveFilter, SIGNAL( clicked() ), this, SLOT( removeFilterClicked() ) ); |
| 261 |
connect( m_pButtonConfigFilter, SIGNAL( clicked() ), this, SLOT( configFilterClicked() ) ); |
| 262 |
connect( m_pButtonUpFilter, SIGNAL( clicked() ), this, SLOT( upFilterSelected() ) ); |
| 263 |
connect( m_pButtonDownFilter, SIGNAL( clicked() ), this, SLOT( downFilterClicked() ) ); |
| 264 |
connect( m_pButtonGroupStreamMode, SIGNAL( clicked(int) ), this, SLOT( streamModeChanged(int) ) ); |
| 265 |
connect( m_pButtonGroupLimits, SIGNAL( clicked(int) ), this, SLOT( streamLimitModeChanged(int) ) ); |
| 266 |
connect( m_pButtonFormat, SIGNAL( clicked() ), this, SLOT( streamFormatClicked() ) ); |
| 267 |
connect( m_pComboStreams, SIGNAL( activated(int) ), this, SLOT( streamSelected(int) ) ); |
| 268 |
connect( m_pButtonStart, SIGNAL( clicked() ), this, SLOT( startRecompress() ) ); |
| 269 |
|
| 270 |
connect( m_pButtonSrc, SIGNAL( clicked() ), this, SLOT( fileOpenVideo() ) ); |
| 271 |
connect( m_pButtonDst, SIGNAL( clicked() ), this, SLOT( fileSaveAvi() ) ); |
| 272 |
connect( m_pButtonCfg, SIGNAL( clicked() ), this, SLOT( fileLoadConfig() ) ); |
| 273 |
} |
| 274 |
|
| 275 |
/* |
| 276 |
* Destroys the object and frees any allocated resources |
| 277 |
*/ |
| 278 |
QtRecompressor::~QtRecompressor() |
| 279 |
{ |
| 280 |
// no need to delete child widgets, Qt does it all for us |
| 281 |
} |