diff --git a/source/ConfigureResolutionDialog.cpp b/source/ConfigureResolutionDialog.cpp new file mode 100755 index 0000000..6d276c6 --- /dev/null +++ b/source/ConfigureResolutionDialog.cpp @@ -0,0 +1,172 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014 by plaYUVer developers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** \file ConfigureResolutionDialog.cpp + \brief Dialog box to set the sequence resolution + */ +#include +#include "ConfigureResolutionDialog.h" + +namespace plaYUVer +{ + +ConfigureResolutionDialog::ConfigureResolutionDialog( QWidget *parent ) : + QDialog( parent ) +{ + + setStandardResolutionSizes(); + + if( objectName().isEmpty() ) + setObjectName( QStringLiteral( "ConfigureResolution" ) ); + + // Config dialog + + setObjectName( QStringLiteral( "ConfigureResolution" ) ); + resize( 392, 292 ); + + setWindowTitle( QApplication::translate( "ConfigureResolution", "Configure Resolution", 0 ) ); + setWindowIcon( QIcon( ":/images/dialogicon-grid.png" ) ); + + MainLayout = new QVBoxLayout( this ); + MainLayout->setObjectName( QStringLiteral( "MainLayout" ) ); + + // headLayout + + headLayout = new QHBoxLayout( this ); + headLayout->setObjectName( QStringLiteral( "headLayout" ) ); + + dialogTitleLabel = new QLabel( this ); + dialogTitleLabel->setObjectName( QStringLiteral( "dialogTitleLabel" ) ); + QFont font; + font.setPointSize( 11 ); + font.setBold( true ); + font.setWeight( 75 ); + dialogTitleLabel->setFont( font ); + dialogTitleLabel->setText( QApplication::translate( "ConfigureResolution", "Configure Resolution", 0 ) ); + + headerSpacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + + dialogIconLabel = new QLabel( this ); + dialogIconLabel->setObjectName( QStringLiteral( "dialogIconLabel" ) ); + dialogIconLabel->setPixmap( QPixmap( ":/images/dialogheader-grid.png" ) ); + + headLayout->addWidget( dialogTitleLabel ); + headLayout->addItem( headerSpacer ); + headLayout->addWidget( dialogIconLabel ); + + MainLayout->addLayout( headLayout ); + + // standardResolutionLayout + + standardResolutionLayout = new QHBoxLayout( this ); + standardResolutionLayout->setObjectName( QStringLiteral( "standardResolutionLayout" ) ); + standardResolutionLabel = new QLabel( this ); + standardResolutionLabel->setObjectName( QStringLiteral( "standardResolutionLabel" ) ); + + horizontalSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); + + standardResolutionBox = new QComboBox( this ); + standardResolutionBox->setObjectName( QStringLiteral( "standardResolutionBox" ) ); + QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); + sizePolicy.setHorizontalStretch( 0 ); + sizePolicy.setVerticalStretch( 0 ); + sizePolicy.setHeightForWidth( standardResolutionBox->sizePolicy().hasHeightForWidth() ); + standardResolutionBox->setSizePolicy( sizePolicy ); + standardResolutionBox->setAcceptDrops( true ); + + standardResolutionLayout->addWidget( standardResolutionLabel ); + standardResolutionLayout->addItem( horizontalSpacer ); + standardResolutionLayout->addWidget( standardResolutionBox ); + standardResolutionLabel->setText( QApplication::translate( "ConfigureResolution", "Standard Resolution", 0 ) ); + standardResolutionBox->clear(); + standardResolutionBox->insertItems( 0, standardResolutionNames ); + + MainLayout->addLayout( standardResolutionLayout ); + + // resolutionGrid + + resolutionGrid = new QGridLayout( this ); + resolutionGrid->setObjectName( QStringLiteral( "resolutionGrid" ) ); + + resolutionLabel = new QLabel( this ); + resolutionLabel->setObjectName( QStringLiteral( "resolutionLabel" ) ); + QFont font1; + font1.setBold( true ); + font1.setWeight( 75 ); + resolutionLabel->setFont( font1 ); + resolutionLabel->setText( QApplication::translate( "ConfigureResolution", "Resolution chosen", 0 ) ); + + widthLabel = new QLabel( this ); + widthLabel->setObjectName( QStringLiteral( "widthLabel" ) ); + widthLabel->setText( QApplication::translate( "ConfigureResolution", "Width", 0 ) ); + widthSpinBox = new QSpinBox( this ); + widthSpinBox->setObjectName( QStringLiteral( "widthSpinBox" ) ); + widthSpinBox->setRange( 0, 5000 ); + widthSpinBox->setValue( 0 ); + + heightLabel = new QLabel( this ); + heightLabel->setObjectName( QStringLiteral( "heightLabel" ) ); + heightLabel->setText( QApplication::translate( "ConfigureResolution", "Height", 0 ) ); + heightSpinBox = new QSpinBox( this ); + heightSpinBox->setObjectName( QStringLiteral( "heightSpinBox" ) ); + heightSpinBox->setRange( 0, 5000 ); + heightSpinBox->setValue( 0 ); + + pixelsLabel = new QLabel( this ); + pixelsLabel->setObjectName( QStringLiteral( "pixelsLabel" ) ); + pixelsLabel->setText( QApplication::translate( "ConfigureResolution", "Pixels", 0 ) ); + + resolutionGrid->addWidget( resolutionLabel, 0, 0, 1, 1 ); + resolutionGrid->addWidget( widthLabel, 1, 1, 1, 1 ); + resolutionGrid->addWidget( widthSpinBox, 2, 1, 1, 1 ); + resolutionGrid->addWidget( heightLabel, 1, 2, 1, 1 ); + resolutionGrid->addWidget( heightSpinBox, 2, 2, 1, 1 ); + resolutionGrid->addWidget( pixelsLabel, 2, 3, 1, 1 ); + + MainLayout->addLayout( resolutionGrid ); + + verticalSpacer = new QSpacerItem( 20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding ); + MainLayout->addItem( verticalSpacer ); + + // Confirmation buttons + + dialogButtonOkCancel = new QDialogButtonBox( this ); + dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) ); + dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); + dialogButtonOkCancel->setCenterButtons( false ); + + MainLayout->addWidget( dialogButtonOkCancel ); + + connect( standardResolutionBox, SIGNAL( currentIndexChanged() ), this, SLOT( StandardResolutionSelection() ) ); + connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); + connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); + +} + + +void ConfigureResolutionDialog::StandardResolutionSelection() +{ + Int currIdx = standardResolutionBox->currentIndex(); + if( currIdx != 1 ) + { + widthSpinBox->setValue( 0 ); + heightSpinBox->setValue( 0 ); + } +} + +} // Namespace SCode diff --git a/source/ConfigureResolutionDialog.h b/source/ConfigureResolutionDialog.h new file mode 100755 index 0000000..80c4dc6 --- /dev/null +++ b/source/ConfigureResolutionDialog.h @@ -0,0 +1,104 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014 by plaYUVer developers + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** \file ConfigureResolutionDialog.h + \brief Dialog box to set the sequence resolution + */ + +#ifndef __CONFIGURERESOLUTIONDIALOG_H__ +#define __CONFIGURERESOLUTIONDIALOG_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "TypeDef.h" + +class QPixmap; +class QColor; + +namespace plaYUVer +{ + +#define MAX_STANDARD_RESOLUTIONSIZES 10 +/** + * + */ +class ConfigureResolutionDialog: public QDialog +{ +Q_OBJECT + +public: + + ConfigureResolutionDialog( QWidget *parent = 0 ); + + QSize getResolution() + { + return QSize( widthSpinBox->value(), heightSpinBox->value() ); + } + +private slots: + void StandardResolutionSelection(); + +private: + QStringList standardResolutionNames; + QList standardResolutionSizesList; + QSize standardResolutionSizes[MAX_STANDARD_RESOLUTIONSIZES]; + QVBoxLayout *MainLayout; + QHBoxLayout *headLayout; + QLabel *dialogTitleLabel; + QSpacerItem *headerSpacer; + QLabel *dialogIconLabel; + QHBoxLayout *standardResolutionLayout; + QLabel *standardResolutionLabel; + QSpacerItem *horizontalSpacer; + QComboBox *standardResolutionBox; + QGridLayout *resolutionGrid; + QLabel *widthLabel; + QLabel *pixelsLabel; + QSpinBox *widthSpinBox; + QLabel *resolutionLabel; + QSpinBox *heightSpinBox; + QLabel *heightLabel; + QSpacerItem *verticalSpacer; + QDialogButtonBox *dialogButtonOkCancel; + + Void setStandardResolutionSizes() + { + + standardResolutionNames.push_back( QString( "VGA (640x480)" ) ); + standardResolutionSizesList.push_back( QSize( 640, 480 ) ); + + standardResolutionNames.push_back( QString( "HD (1024x768)" ) ); + standardResolutionSizesList.push_back( QSize( 1024, 768 ) ); + + standardResolutionNames.push_back( QString( "Full HD (1920x1080)" ) ); + standardResolutionSizesList.push_back( QSize( 1920, 1080 ) ); + + } + +}; + +} // NAMESPACE + +#endif // __CONFIGURERESOLUTIONDIALOG_H__