Refactor Playuver into Calyp
commit 1fd9cf34f06ba2a156919b5c9b73c31d4c6c6257 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Mon Mar 12 18:06:39 2018 +0000 Remove code style commit 165588840126a7ab35b32e5be47f00c613829ef3 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Mon Mar 12 18:06:25 2018 +0000 Update Mainpage.dox commit 5b1a2773c48697346c7b0b64519b81a5aecc0150 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Mon Feb 19 03:46:24 2018 +0000 Re-add CalypPixel.cpp but keep include with frame class commit 2343be49ff4906c3171d2df7791e3cf34494eb21 Author: Joao Santos <joaompssantos@gmail.com> Date: Sun Feb 18 21:06:57 2018 +0000 Fixed several things: - Removed unused define - Added: #include <cassert> to MainWindow.cpp - Fixed compilation issue when USE_FFMPEG is OFF on CalypStream.cpp commit 8d1d64bac828a6bcdfa6af977a5d17d0792acb69 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 15 02:14:13 2018 +0000 Fix several things: - Fix examples - Improve code formatting script - Change generated cmake config file commit ea1d0265f1e9300f76fd3f0c8ca03d110ec13eaa Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 15 01:28:50 2018 +0000 Fix dump of the module list: remove the use of char arrays commit b4d19dda169715113a74713ca62d05f5a18fd0b5 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 23:20:56 2018 +0000 Increase linesize of tools help commit 8b3eab54e376863276b0d7e032f9e1de8aaf90e5 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 23:20:35 2018 +0000 Fix CalypPixel commit 1c6ba03c379518acf5fc6f1fdf328ca740a8851d Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 22:24:10 2018 +0000 Enums CalypPixelFormats and CalypColorSpace are now class independent commit 5dcc35e1716a70095e1720b01823c2e3a3980576 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 02:04:31 2018 +0000 Change functions input and return types commit 5514e3e24f9b428d5db71156561b2d8b6f61dd23 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 02:04:31 2018 +0000 Change functions input and return types commit fae7a9a91e1899e7a2833c634221f970d44b8fb6 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 01:39:14 2018 +0000 Replace custom types with std ones commit 0c3b62b8ea01903e213d9e8dd73a5b49c7c8c36e Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 14 00:37:18 2018 +0000 Refactoring entries with Playuver name with Calyp Replace number of frames and add CLP tag into public definitions commit e8cd8d7a219446513a5dda2c183dd892ec25a6f1 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Sat Feb 10 14:42:15 2018 +0000 Fix min opencv version and missing ffmpeg module commit 1233598af8ac15c88fa84569942cc6f865325452 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Sat Feb 10 03:10:12 2018 +0000 Change version to 0.999.0 untill finishing refactoring commit 1fe0cac8f0e70f352bf6c63b8cb2e06ab43fb633 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Sat Feb 10 00:21:47 2018 +0000 Change project library commit 44e9d330bc63b8b8a1687a14ff0be05af0bf2eb5 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Fri Feb 9 01:42:58 2018 +0000 Change doxygen files and upload new ico commit 0d6f3408a2682cfac1533a57a2f1b4e2cc1f0f29 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 8 21:25:31 2018 +0000 Fix logos - different when it is icon or the full logo commit 9f3561acd4b51c7de5f21d63d7e8f2b43c253148 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 8 01:25:39 2018 +0000 fix install files commit 832154e3e40f17a863898a77c929a6c6850ffded Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 8 01:21:23 2018 +0000 rename calip to calyp commit 341b32bfcc0133fdbceea9b8390d59190e495b79 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 8 00:58:29 2018 +0000 Refactor lib, modules and tools commit b4b988cf80052fdcfe0e1f9099d5435ef7945584 Author: Joao Carreira <jfmcarreira@gmail.com> Date: Thu Feb 8 00:02:33 2018 +0000 Refactor classes and filename in app commit 6b4ab728202531ad00db1e6299ee69a01f3594ba Author: Joao Carreira <jfmcarreira@gmail.com> Date: Wed Feb 7 17:49:53 2018 +0000 Refactor about dialog and background logo commit d5c954d39fb89d735c4feddf62f529077840ab6c Author: João Santos <joaompssantos@gmail.com> Date: Wed Feb 7 15:05:19 2018 +0000 Added the misteriously missing new logo. commit f40d81f765bfdd2dc89c0647cf5f4a80eef845c7 Author: João Santos <joaompssantos@gmail.com> Date: Wed Feb 7 14:45:08 2018 +0000 Added new logo to resource folder. commit 52dc6d60d6590995d32de33f8199e954e0a6e120 Author: João Santos <joaompssantos@gmail.com> Date: Wed Feb 7 14:41:13 2018 +0000 Added new logo where it was previously forgotten. commit 6d8e064c3154e5202f01b1b10ba6ab3637383ecd Author: João Santos <joaompssantos@gmail.com> Date: Tue Feb 6 17:44:11 2018 +0000 About window no longer resizable. Added new logo.
This commit is contained in:
157 files changed
+16532
-17759
No files matched your search
@@ -0,0 +1,547 @@
|
||||
/* This file is a part of Calyp project
|
||||
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com)
|
||||
* Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* 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 ConfigureFormatDialog.cpp
|
||||
* \brief Dialog box to set the sequence resolution
|
||||
*/
|
||||
|
||||
#include "ConfigureFormatDialog.h"
|
||||
|
||||
#include "lib/CalypFrame.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFileInfo>
|
||||
#include <QGroupBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QSettings>
|
||||
#include <QSpinBox>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#define MAX_SUPPORTED_RESOLUTION 99999
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array )
|
||||
{
|
||||
CalypStandardResolution d;
|
||||
out << array.size();
|
||||
for( int i = 0; i < array.size(); i++ )
|
||||
{
|
||||
d = array.at( i );
|
||||
out << QString::fromStdString( d.shortName ) << d.uiWidth << d.uiHeight;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream& operator>>( QDataStream& in, CalypStandardResolutionVector& array )
|
||||
{
|
||||
CalypStandardResolution d;
|
||||
QString auxName;
|
||||
int array_size;
|
||||
in >> array_size;
|
||||
for( int i = 0; i < array_size; i++ )
|
||||
{
|
||||
in >> auxName;
|
||||
d.shortName = auxName.toStdString();
|
||||
in >> d.uiWidth;
|
||||
in >> d.uiHeight;
|
||||
array.append( d );
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
class AddCustomFormat : public QDialog
|
||||
{
|
||||
public:
|
||||
AddCustomFormat( QWidget* parent = NULL )
|
||||
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint )
|
||||
{
|
||||
setWindowModality( Qt::ApplicationModal );
|
||||
setWindowTitle( "Add custom resolution" );
|
||||
|
||||
QLabel* nameLabel = new QLabel( "Name" );
|
||||
m_lineEdtName = new QLineEdit();
|
||||
|
||||
QLabel* widthLabel = new QLabel( "Width" );
|
||||
m_spinWidth = new QSpinBox;
|
||||
m_spinWidth->setMinimumSize( 70, 5 );
|
||||
m_spinWidth->setMaximumSize( 70, 30 );
|
||||
m_spinWidth->setMinimum( 0 );
|
||||
m_spinWidth->setMaximum( MAX_SUPPORTED_RESOLUTION );
|
||||
|
||||
QLabel* heightLabel = new QLabel( "Heigth" );
|
||||
m_spinHeight = new QSpinBox;
|
||||
m_spinHeight->setMinimumSize( 70, 5 );
|
||||
m_spinHeight->setMaximumSize( 70, 30 );
|
||||
m_spinHeight->setMinimum( 0 );
|
||||
m_spinHeight->setMaximum( MAX_SUPPORTED_RESOLUTION );
|
||||
|
||||
QDialogButtonBox* dialogButtonOkCancel = new QDialogButtonBox();
|
||||
dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) );
|
||||
dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
|
||||
dialogButtonOkCancel->setCenterButtons( false );
|
||||
|
||||
QGridLayout* mainLayout = new QGridLayout;
|
||||
mainLayout->addWidget( nameLabel, 0, 0, 1, 1, Qt::AlignCenter );
|
||||
mainLayout->addWidget( widthLabel, 0, 1, 1, 1, Qt::AlignCenter );
|
||||
mainLayout->addWidget( heightLabel, 0, 2, 1, 1, Qt::AlignCenter );
|
||||
|
||||
mainLayout->addWidget( m_lineEdtName, 1, 0, 1, 1, Qt::AlignCenter );
|
||||
mainLayout->addWidget( m_spinWidth, 1, 1, 1, 1, Qt::AlignCenter );
|
||||
mainLayout->addWidget( m_spinHeight, 1, 2, 1, 1, Qt::AlignCenter );
|
||||
|
||||
mainLayout->addWidget( dialogButtonOkCancel, 2, 0, 1, 3, Qt::AlignRight );
|
||||
|
||||
setLayout( mainLayout );
|
||||
|
||||
connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) );
|
||||
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
}
|
||||
|
||||
CalypStandardResolution runDialog()
|
||||
{
|
||||
CalypStandardResolution stdResolution;
|
||||
stdResolution.shortName = "";
|
||||
if( exec() == QDialog::Accepted )
|
||||
{
|
||||
stdResolution.shortName = m_lineEdtName->text().toStdString();
|
||||
stdResolution.uiWidth = m_spinWidth->value();
|
||||
stdResolution.uiHeight = m_spinHeight->value();
|
||||
}
|
||||
return stdResolution;
|
||||
}
|
||||
|
||||
private:
|
||||
QLineEdit* m_lineEdtName;
|
||||
QSpinBox* m_spinWidth;
|
||||
QSpinBox* m_spinHeight;
|
||||
};
|
||||
|
||||
ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
: QDialog( parent )
|
||||
{
|
||||
QString Name;
|
||||
unsigned int uiWidth, uiHeight;
|
||||
|
||||
readSettings();
|
||||
for( int i = 0; i < aRCustomFileFormats.size(); i++ )
|
||||
{
|
||||
Name = QString::fromStdString( aRCustomFileFormats[i].shortName );
|
||||
uiWidth = aRCustomFileFormats[i].uiWidth;
|
||||
uiHeight = aRCustomFileFormats[i].uiHeight;
|
||||
standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
|
||||
}
|
||||
|
||||
std::vector<CalypStandardResolution> listCalypStdResolution = CalypStream::stdResolutionSizes();
|
||||
for( unsigned int i = 0; i < listCalypStdResolution.size(); i++ )
|
||||
{
|
||||
Name = QString::fromStdString( listCalypStdResolution[i].shortName );
|
||||
uiWidth = listCalypStdResolution[i].uiWidth;
|
||||
uiHeight = listCalypStdResolution[i].uiHeight;
|
||||
standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
|
||||
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
|
||||
}
|
||||
|
||||
standardResolutionNames.append( QStringLiteral( "Custom..." ) );
|
||||
standardResolutionSizes.append( QSize( 0, 0 ) );
|
||||
|
||||
setObjectName( "ConfigureFormat" );
|
||||
|
||||
setWindowTitle( "Configure Resolution" );
|
||||
setWindowIcon( QIcon( ":/images/configureformat.png" ) );
|
||||
|
||||
QVBoxLayout* MainLayout = new QVBoxLayout( this );
|
||||
|
||||
QFont titleFont, menusFont, normalFont;
|
||||
|
||||
titleFont.setPointSize( 12 );
|
||||
titleFont.setBold( true );
|
||||
titleFont.setWeight( 75 );
|
||||
|
||||
menusFont.setBold( true );
|
||||
titleFont.setWeight( 75 );
|
||||
|
||||
normalFont.setBold( false );
|
||||
// menusFont.setPointSize( 12 );
|
||||
|
||||
// // headLayout
|
||||
// QHBoxLayout* headLayout = new QHBoxLayout();
|
||||
// QLabel* dialogTitleLabel = new QLabel();
|
||||
// dialogTitleLabel->setFont( titleFont );
|
||||
// dialogTitleLabel->setText( "Configure Resolution" );
|
||||
// headLayout->addWidget( dialogTitleLabel );
|
||||
// headLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding,
|
||||
// QSizePolicy::Minimum ) );
|
||||
//
|
||||
// MainLayout->addLayout( headLayout );
|
||||
// MainLayout->addItem( new QSpacerItem( 10, 20, QSizePolicy::Minimum ) );
|
||||
|
||||
/*
|
||||
* Filename layout
|
||||
*/
|
||||
QHBoxLayout* filenameLayout = new QHBoxLayout();
|
||||
QLabel* filenameLabel = new QLabel();
|
||||
filenameLabel->setText( "Name" );
|
||||
filenameLabel->setFont( menusFont );
|
||||
m_labelFilename = new QLabel();
|
||||
m_labelFilename->setFont( titleFont );
|
||||
filenameLayout->addWidget( filenameLabel );
|
||||
filenameLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
filenameLayout->addWidget( m_labelFilename );
|
||||
MainLayout->addLayout( filenameLayout );
|
||||
|
||||
QSizePolicy sizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
|
||||
sizePolicy.setHorizontalStretch( 0 );
|
||||
sizePolicy.setVerticalStretch( 0 );
|
||||
|
||||
/*
|
||||
* Resolution
|
||||
*/
|
||||
QGroupBox* resolutionGroup = new QGroupBox();
|
||||
resolutionGroup->setTitle( QStringLiteral( "Resolution" ) );
|
||||
resolutionGroup->setFont( menusFont );
|
||||
|
||||
QGridLayout* resolutionGrid = new QGridLayout();
|
||||
resolutionGroup->setLayout( resolutionGrid );
|
||||
|
||||
m_comboBoxStandardResolution = new QComboBox();
|
||||
|
||||
m_comboBoxStandardResolution->setFont( normalFont );
|
||||
m_comboBoxStandardResolution->setSizePolicy( sizePolicy );
|
||||
m_comboBoxStandardResolution->setAcceptDrops( true );
|
||||
m_comboBoxStandardResolution->clear();
|
||||
m_comboBoxStandardResolution->insertItems( 0, standardResolutionNames );
|
||||
m_comboBoxStandardResolution->setCurrentIndex( -1 );
|
||||
|
||||
QLabel* widthLabel = new QLabel( "Width" );
|
||||
widthLabel->setFont( normalFont );
|
||||
m_spinBoxWidth = new QSpinBox();
|
||||
m_spinBoxWidth->setRange( 0, MAX_SUPPORTED_RESOLUTION );
|
||||
m_spinBoxWidth->setValue( 0 );
|
||||
m_spinBoxWidth->setFont( normalFont );
|
||||
|
||||
QLabel* heightLabel = new QLabel( "Height" );
|
||||
heightLabel->setFont( normalFont );
|
||||
m_spinBoxheight = new QSpinBox();
|
||||
m_spinBoxheight->setRange( 0, MAX_SUPPORTED_RESOLUTION );
|
||||
m_spinBoxheight->setValue( 0 );
|
||||
m_spinBoxheight->setFont( normalFont );
|
||||
|
||||
QLabel* pixelsLabel = new QLabel();
|
||||
pixelsLabel->setText( "Pixels" );
|
||||
pixelsLabel->setFont( normalFont );
|
||||
resolutionGrid->addWidget( m_comboBoxStandardResolution, 1, 0, Qt::AlignCenter );
|
||||
resolutionGrid->addWidget( widthLabel, 0, 1, Qt::AlignCenter );
|
||||
resolutionGrid->addWidget( m_spinBoxWidth, 1, 1, Qt::AlignCenter );
|
||||
resolutionGrid->addWidget( heightLabel, 0, 2, Qt::AlignCenter );
|
||||
resolutionGrid->addWidget( m_spinBoxheight, 1, 2, Qt::AlignCenter );
|
||||
resolutionGrid->addWidget( pixelsLabel, 1, 3, Qt::AlignCenter );
|
||||
|
||||
/*
|
||||
* Pixel format
|
||||
*/
|
||||
QGroupBox* pixelGroup = new QGroupBox();
|
||||
pixelGroup->setTitle( QStringLiteral( "Pixel Format" ) );
|
||||
pixelGroup->setFont( menusFont );
|
||||
QGridLayout* pixelGridLayout = new QGridLayout();
|
||||
pixelGroup->setLayout( pixelGridLayout );
|
||||
|
||||
QLabel* colorSpaceLabel = new QLabel();
|
||||
colorSpaceLabel->setText( "Color Space" );
|
||||
colorSpaceLabel->setFont( normalFont );
|
||||
m_comboBoxColorSpace = new QComboBox();
|
||||
m_comboBoxColorSpace->setSizePolicy( sizePolicy );
|
||||
m_comboBoxColorSpace->setFont( normalFont );
|
||||
m_comboBoxColorSpace->clear();
|
||||
|
||||
QLabel* pixelFormatLabel = new QLabel();
|
||||
pixelFormatLabel->setText( "Sampling" );
|
||||
pixelFormatLabel->setFont( normalFont );
|
||||
m_comboBoxPixelFormat = new QComboBox();
|
||||
m_comboBoxPixelFormat->setSizePolicy( sizePolicy );
|
||||
m_comboBoxPixelFormat->setFont( normalFont );
|
||||
m_comboBoxPixelFormat->clear();
|
||||
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedColorSpacesListNames().size(); i++ )
|
||||
{
|
||||
m_comboBoxColorSpace->insertItem( i, CalypFrame::supportedColorSpacesListNames()[i].c_str() );
|
||||
}
|
||||
m_comboBoxColorSpace->setCurrentIndex( 1 );
|
||||
|
||||
pixelGridLayout->addWidget( colorSpaceLabel, 0, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
|
||||
pixelGridLayout->addWidget( m_comboBoxColorSpace, 0, 2 );
|
||||
|
||||
pixelGridLayout->addWidget( pixelFormatLabel, 1, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 1 );
|
||||
pixelGridLayout->addWidget( m_comboBoxPixelFormat, 1, 2 );
|
||||
|
||||
QLabel* bitsPerPelLabel = new QLabel();
|
||||
bitsPerPelLabel->setFont( normalFont );
|
||||
bitsPerPelLabel->setText( "Pixel bit depth" );
|
||||
m_spinBoxBits = new QSpinBox();
|
||||
m_spinBoxBits->setFont( normalFont );
|
||||
m_spinBoxBits->setMinimumWidth( 30 );
|
||||
m_spinBoxBits->setRange( 0, 16 );
|
||||
m_spinBoxBits->setValue( 8 );
|
||||
pixelGridLayout->addWidget( bitsPerPelLabel, 2, 0 );
|
||||
pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 2, 1 );
|
||||
pixelGridLayout->addWidget( m_spinBoxBits, 2, 2 );
|
||||
|
||||
/*
|
||||
* Endianess
|
||||
*/
|
||||
QHBoxLayout* endiannessLayout = new QHBoxLayout();
|
||||
QLabel* endiannessLabel = new QLabel();
|
||||
endiannessLabel->setFont( menusFont );
|
||||
endiannessLabel->setText( "Endianness" );
|
||||
m_comboBoxEndianness = new QComboBox();
|
||||
m_comboBoxEndianness->setFont( normalFont );
|
||||
m_comboBoxEndianness->setSizePolicy( sizePolicy );
|
||||
m_comboBoxEndianness->clear();
|
||||
m_comboBoxEndianness->addItem( QStringLiteral( "Big Endian" ) );
|
||||
m_comboBoxEndianness->addItem( QStringLiteral( "Little Endian" ) );
|
||||
endiannessLayout->addWidget( endiannessLabel );
|
||||
endiannessLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
endiannessLayout->addWidget( m_comboBoxEndianness );
|
||||
m_widgetEndianness = new QWidget();
|
||||
m_widgetEndianness->setContentsMargins( 0, 0, 0, 0 );
|
||||
m_widgetEndianness->setLayout( endiannessLayout );
|
||||
m_widgetEndianness->setVisible( true );
|
||||
|
||||
/*
|
||||
* Frame rate format
|
||||
*/
|
||||
QHBoxLayout* framerateFormatLayout = new QHBoxLayout();
|
||||
QLabel* framerateFormatLabel = new QLabel();
|
||||
framerateFormatLabel->setFont( menusFont );
|
||||
framerateFormatLabel->setText( "Frame Rate" );
|
||||
m_spinBoxFrameRate = new QSpinBox();
|
||||
m_spinBoxFrameRate->setSuffix( QStringLiteral( " Hz" ) );
|
||||
m_spinBoxFrameRate->setMinimumWidth( 30 );
|
||||
m_spinBoxFrameRate->setRange( 0, 1000 );
|
||||
m_spinBoxFrameRate->setValue( 30 );
|
||||
framerateFormatLayout->addWidget( framerateFormatLabel );
|
||||
framerateFormatLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
|
||||
framerateFormatLayout->addWidget( m_spinBoxFrameRate );
|
||||
QWidget* framerateWidget = new QWidget();
|
||||
framerateWidget->setContentsMargins( 0, 0, 0, 0 );
|
||||
framerateWidget->setLayout( framerateFormatLayout );
|
||||
|
||||
/*
|
||||
* Confirmation buttons
|
||||
*/
|
||||
QDialogButtonBox* dialogButtonOkCancel = new QDialogButtonBox();
|
||||
dialogButtonOkCancel->setObjectName( QString::fromUtf8( "dialogButtonBox" ) );
|
||||
dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok );
|
||||
dialogButtonOkCancel->setCenterButtons( false );
|
||||
|
||||
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum ) );
|
||||
MainLayout->addWidget( resolutionGroup );
|
||||
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum ) );
|
||||
MainLayout->addWidget( pixelGroup );
|
||||
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum ) );
|
||||
MainLayout->addWidget( m_widgetEndianness );
|
||||
MainLayout->addWidget( framerateWidget );
|
||||
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
|
||||
MainLayout->addWidget( dialogButtonOkCancel );
|
||||
|
||||
connect( m_comboBoxStandardResolution, SIGNAL( currentIndexChanged( int ) ), this,
|
||||
SLOT( slotStandardResolutionSelected( int ) ) );
|
||||
connect( m_spinBoxWidth, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
|
||||
connect( m_spinBoxheight, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
|
||||
connect( m_comboBoxColorSpace, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotColorSpaceChange( int ) ) );
|
||||
connect( m_spinBoxBits, SIGNAL( valueChanged( int ) ), this, SLOT( slotBitsChange( int ) ) );
|
||||
|
||||
connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) );
|
||||
connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) );
|
||||
|
||||
m_comboBoxColorSpace->setCurrentIndex( 0 );
|
||||
|
||||
setFixedSize( MainLayout->sizeHint() );
|
||||
}
|
||||
|
||||
int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, unsigned int& rWidth, unsigned int& rHeight,
|
||||
int& rInputFormat, unsigned int& rBits, int& rEndianess, unsigned int& rFrameRate )
|
||||
{
|
||||
// Set default values
|
||||
// setWindowTitle( "Configure resolution for " + Filename );
|
||||
m_labelFilename->setText( QFileInfo( Filename ).fileName() );
|
||||
m_spinBoxWidth->setValue( rWidth );
|
||||
m_spinBoxheight->setValue( rHeight );
|
||||
|
||||
int colorSpace = 0;
|
||||
int sampling = 0;
|
||||
if( rInputFormat >= 0 )
|
||||
{
|
||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat];
|
||||
for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ )
|
||||
{
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( j ).size(); i++ )
|
||||
{
|
||||
if( pelFmtName == CalypFrame::supportedPixelFormatListNames( j )[i] )
|
||||
{
|
||||
colorSpace = j;
|
||||
sampling = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_comboBoxColorSpace->setCurrentIndex( colorSpace );
|
||||
m_comboBoxPixelFormat->setCurrentIndex( sampling );
|
||||
m_spinBoxBits->setValue( rBits );
|
||||
m_comboBoxEndianness->setCurrentIndex( rEndianess );
|
||||
if( rBits > 8 )
|
||||
{
|
||||
m_widgetEndianness->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_widgetEndianness->setVisible( false );
|
||||
}
|
||||
m_spinBoxFrameRate->setValue( rFrameRate );
|
||||
|
||||
for( int i = 0; i < standardResolutionSizes.size() - 1; i++ )
|
||||
{
|
||||
if( standardResolutionSizes.at( i ) == QSize( rWidth, rHeight ) )
|
||||
{
|
||||
m_comboBoxStandardResolution->setCurrentIndex( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( exec() == QDialog::Rejected )
|
||||
{
|
||||
writeSettings();
|
||||
return QDialog::Rejected;
|
||||
}
|
||||
|
||||
rWidth = m_spinBoxWidth->value();
|
||||
rHeight = m_spinBoxheight->value();
|
||||
colorSpace = m_comboBoxColorSpace->currentIndex();
|
||||
sampling = m_comboBoxPixelFormat->currentIndex();
|
||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling];
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
{
|
||||
if( pelFmtName == CalypFrame::supportedPixelFormatListNames()[i] )
|
||||
{
|
||||
rInputFormat = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
rBits = m_spinBoxBits->value();
|
||||
rEndianess = m_comboBoxEndianness->currentIndex();
|
||||
rFrameRate = m_spinBoxFrameRate->value();
|
||||
writeSettings();
|
||||
return QDialog::Accepted;
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotStandardResolutionSelected( int idx )
|
||||
{
|
||||
if( idx == standardResolutionSizes.size() - 1 )
|
||||
{
|
||||
AddCustomFormat* pcCustomFmtDialog = new AddCustomFormat;
|
||||
CalypStandardResolution customResolution = pcCustomFmtDialog->runDialog();
|
||||
aRCustomFileFormats.append( customResolution );
|
||||
if( customResolution.shortName != "" )
|
||||
{
|
||||
QString name = QString::fromStdString( customResolution.shortName );
|
||||
name.append( QString( " (%2x%3)" ).arg( customResolution.uiWidth ).arg( customResolution.uiHeight ) );
|
||||
standardResolutionNames.insert( 0, name );
|
||||
standardResolutionSizes.insert( 0, QSize( customResolution.uiWidth, customResolution.uiHeight ) );
|
||||
|
||||
m_comboBoxStandardResolution->blockSignals( true );
|
||||
m_comboBoxStandardResolution->insertItem( 0, name );
|
||||
m_comboBoxStandardResolution->blockSignals( false );
|
||||
m_comboBoxStandardResolution->setCurrentIndex( 0 );
|
||||
}
|
||||
}
|
||||
if( idx >= 0 )
|
||||
{
|
||||
QSize currSize = standardResolutionSizes.at( idx );
|
||||
m_spinBoxWidth->blockSignals( true );
|
||||
m_spinBoxWidth->setValue( currSize.width() );
|
||||
m_spinBoxWidth->blockSignals( false );
|
||||
m_spinBoxheight->blockSignals( true );
|
||||
m_spinBoxheight->setValue( currSize.height() );
|
||||
m_spinBoxheight->blockSignals( false );
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotResolutionChange()
|
||||
{
|
||||
m_comboBoxStandardResolution->blockSignals( true );
|
||||
int newIdx = -1;
|
||||
for( int i = 0; i < standardResolutionSizes.size(); i++ )
|
||||
{
|
||||
if( standardResolutionSizes.at( i ) == QSize( m_spinBoxWidth->value(), m_spinBoxheight->value() ) )
|
||||
{
|
||||
newIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_comboBoxStandardResolution->setCurrentIndex( newIdx );
|
||||
m_comboBoxStandardResolution->blockSignals( false );
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotColorSpaceChange( int idx )
|
||||
{
|
||||
if( idx == -1 )
|
||||
return;
|
||||
|
||||
m_comboBoxPixelFormat->clear();
|
||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( idx ).size(); i++ )
|
||||
{
|
||||
m_comboBoxPixelFormat->insertItem( i, CalypFrame::supportedPixelFormatListNames( idx )[i].c_str() );
|
||||
}
|
||||
m_comboBoxPixelFormat->setCurrentIndex( 0 );
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::slotBitsChange( int idx )
|
||||
{
|
||||
if( idx > 8 )
|
||||
{
|
||||
m_widgetEndianness->setVisible( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_widgetEndianness->setVisible( false );
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::readSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
QVariant value = appSettings.value( "ConfigureFormatDialog/CustomFormats" );
|
||||
aRCustomFileFormats = value.value<CalypStandardResolutionVector>();
|
||||
}
|
||||
|
||||
void ConfigureFormatDialog::writeSettings()
|
||||
{
|
||||
QSettings appSettings;
|
||||
QVariant var;
|
||||
var.setValue<CalypStandardResolutionVector>( aRCustomFileFormats );
|
||||
appSettings.setValue( "ConfigureFormatDialog/CustomFormats", var );
|
||||
}
|
||||
Reference in new issue
Block a user