diff --git a/resources/x-raw.xml b/resources/x-raw.xml index 6d06cd7..21e6d0f 100644 --- a/resources/x-raw.xml +++ b/resources/x-raw.xml @@ -2,6 +2,6 @@ Raw YUV file - + diff --git a/source/app/DialogSubWindowSelector.cpp b/source/app/DialogSubWindowSelector.cpp index 7908fe5..d28eed0 100644 --- a/source/app/DialogSubWindowSelector.cpp +++ b/source/app/DialogSubWindowSelector.cpp @@ -28,9 +28,10 @@ namespace plaYUVer { -DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdiArea, Int numberWindowsSelected ) : +DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdiArea, Int minWindowsSelected, Int maxWindowsSelected ) : QDialog( parent ), - m_iNumberOfSelectedWindows( numberWindowsSelected ), + m_iMinSelectedWindows( minWindowsSelected ), + m_iMaxSlectedWindows( maxWindowsSelected ), m_pcMainWindowMdiArea( mdiArea ) { QFont titleFont, menusFont; @@ -66,10 +67,11 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi m_listSelectedWindows = new QListWidget( this ); // Confirmation buttons - QDialogButtonBox* dialogButtonOkCancel = new QDialogButtonBox(); - dialogButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); - dialogButtonOkCancel->setOrientation( Qt::Vertical ); - dialogButtonOkCancel->setCenterButtons( false ); + m_pushButtonOkCancel = new QDialogButtonBox(); + m_pushButtonOkCancel->setStandardButtons( QDialogButtonBox::Cancel | QDialogButtonBox::Ok ); + m_pushButtonOkCancel->setOrientation( Qt::Vertical ); + m_pushButtonOkCancel->setCenterButtons( false ); + m_pushButtonOkCancel->buttons().at( 0 )->setEnabled( false ); // Create Layouts QVBoxLayout* LeftVLayout = new QVBoxLayout(); @@ -82,7 +84,7 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi RightVLayout->addWidget( m_pushButtonAddAll ); RightVLayout->addWidget( m_pushButtonRemove ); RightVLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); - RightVLayout->addWidget( dialogButtonOkCancel ); + RightVLayout->addWidget( m_pushButtonOkCancel ); // Add components //MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Expanding, QSizePolicy::Fixed ) ); @@ -92,8 +94,8 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi setLayout( MainLayout ); // Create actions - connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); - connect( dialogButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); + connect( m_pushButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); + connect( m_pushButtonOkCancel, SIGNAL( rejected() ), this, SLOT( reject() ) ); connect( m_pushButtonAdd, SIGNAL( clicked() ), this, SLOT( addSubWindow() ) ); connect( m_pushButtonAddAll, SIGNAL( clicked() ), this, SLOT( addAllSubWindow() ) ); connect( m_pushButtonRemove, SIGNAL( clicked() ), this, SLOT( removeSubWindow() ) ); @@ -119,18 +121,25 @@ Void DialogSubWindowSelector::updateSubWindowList() m_comboBoxWindowList->insertItems( 0, m_pcWindowListNames ); m_comboBoxWindowList->setCurrentIndex( -1 ); - if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() >= m_iNumberOfSelectedWindows ) - { - m_pushButtonAdd->setEnabled( false ); - } - else - { - m_pushButtonAdd->setEnabled( true ); - } - if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() < m_iNumberOfSelectedWindows ) - { + Bool enableAddAll = true; + if( m_iMaxSlectedWindows >= 0 ) + { + if( m_pcSelectedWindowListNames.size() >= m_iMaxSlectedWindows ) + { + m_pushButtonAdd->setEnabled( false ); + } + else + { + m_pushButtonAdd->setEnabled( true ); + } + if( m_pcWindowListNames.size() > m_iMaxSlectedWindows ) + { + enableAddAll = false; + } } + m_pushButtonAddAll->setEnabled( enableAddAll ); + if( m_pcSelectedWindowListNames.size() > 0 ) { m_pushButtonRemove->setEnabled( true ); @@ -139,10 +148,16 @@ Void DialogSubWindowSelector::updateSubWindowList() { m_pushButtonRemove->setEnabled( false ); } - if( m_iNumberOfSelectedWindows >= 0 && m_pcWindowListNames.size() <= m_iNumberOfSelectedWindows ) + + if( m_pcSelectedWindowListNames.size() >= m_iMinSelectedWindows ) { - m_pushButtonAddAll->setEnabled( true ); + m_pushButtonOkCancel->buttons().at( 0 )->setEnabled( true ); } + else + { + m_pushButtonOkCancel->buttons().at( 0 )->setEnabled( false ); + } + } Void DialogSubWindowSelector::setSubWindowList( QStringList cWindowListNames ) @@ -169,7 +184,7 @@ Void DialogSubWindowSelector::addSubWindow() Void DialogSubWindowSelector::addAllSubWindow() { - if( m_iNumberOfSelectedWindows <= 0 || m_pcWindowListNames.size() <= m_iNumberOfSelectedWindows ) + if( m_iMaxSlectedWindows <= 0 || m_pcWindowListNames.size() <= m_iMaxSlectedWindows ) { for( Int i = 0; i < m_pcWindowListNames.size(); i++ ) { diff --git a/source/app/DialogSubWindowSelector.h b/source/app/DialogSubWindowSelector.h index 5715ced..b059cbc 100644 --- a/source/app/DialogSubWindowSelector.h +++ b/source/app/DialogSubWindowSelector.h @@ -49,7 +49,7 @@ class DialogSubWindowSelector: public QDialog Q_OBJECT public: - DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0, Int numberWindowsSelected = -1 ); + DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0, Int minWindowsSelected = 0, Int maxWindowsSelected = -1 ); Void setSubWindowList( QStringList cWindowListNames ); QStringList getSelectedWindows() @@ -57,12 +57,14 @@ public: return m_pcSelectedWindowListNames; } private: - Int m_iNumberOfSelectedWindows; + Int m_iMinSelectedWindows; + Int m_iMaxSlectedWindows; QMdiArea* m_pcMainWindowMdiArea; QStringList m_pcWindowListNames; QStringList m_pcSelectedWindowListNames; QComboBox* m_comboBoxWindowList; + QDialogButtonBox* m_pushButtonOkCancel; QPushButton* m_pushButtonAdd; QPushButton* m_pushButtonAddAll; QPushButton* m_pushButtonRemove; diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index 348d7a6..4ced82b 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -105,14 +105,16 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf SubWindowHandle* interfaceChild = NULL; QString windowName; + QVector subWindowList; UInt numberOfFrames = pcCurrModuleIf->m_cModuleDef.m_uiNumberOfFrames; if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows { - DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames ); + DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames, numberOfFrames ); if( dialogWindowsSelection.exec() == QDialog::Accepted ) { QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows(); SubWindowHandle *subWindow; + for( Int j = 0; j < selectedWindows.size(); j++ ) { for( Int i = 0; i < m_pcMdiArea->subWindowList().size(); i++ ) @@ -120,26 +122,45 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf subWindow = qobject_cast( m_pcMdiArea->subWindowList().at( i ) ); if( subWindow->getWindowName() == selectedWindows.at( j ) ) { + subWindowList.append( subWindow ); pcCurrModuleIf->m_pcSubWindow[j] = subWindow; } } } } - else + // Check for same fmt in more than one frame modules + for( Int i = 1; i < subWindowList.size(); i++ ) { - pcCurrModuleIf->m_pcAction->setChecked( false ); - return interfaceChild; + if( !subWindowList.at( i )->getCurrFrame()->haveSameFmt( subWindowList.at( 0 )->getCurrFrame()) ) + { + subWindowList.clear(); + break; + } } } else { windowName.append( pcSubWindow->getWindowName() ); - pcCurrModuleIf->m_pcSubWindow[0] = pcSubWindow; + subWindowList.append( pcSubWindow ); } + + if( subWindowList.size() == 0 ) + { + pcCurrModuleIf->m_pcAction->setChecked( false ); + m_pcParent->statusBar()->showMessage( "Error! Module cannot be applied", 2000 ); + return interfaceChild; + } + windowName.append( " <" ); windowName.append( pcCurrModuleIf->m_cModuleDef.m_pchModuleName ); windowName.append( ">" ); + for( Int i = 0; i < subWindowList.size(); i++ ) + { + pcCurrModuleIf->m_pcSubWindow[i] = subWindowList.at( i ); + pcCurrModuleIf->m_pcSubWindow[i]->disableModule(); + } + pcCurrModuleIf->m_pcDisplaySubWindow = NULL; if( pcCurrModuleIf->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) { @@ -165,19 +186,10 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf pcCurrModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); pcCurrModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); pcCurrModuleIf->m_pcDockWidget->setWidget( pcCurrModuleIf->m_pcModuleDock ); - //pcCurrModuleIf->m_pcDockWidget->setAttribute( Qt::WA_DeleteOnClose ); m_pcParent->addDockWidget( Qt::RightDockWidgetArea, pcCurrModuleIf->m_pcDockWidget ); - - //connect( pcCurrModuleIf->m_pcDockWidget, SIGNAL( visibilityChanged(bool) ), pcCurrModuleIf->m_pcModuleDock, SLOT( visibilityChangedSlot(bool) ) ); } } - // Disable existing Module - for( UInt i = 0; i < numberOfFrames; i++ ) - { - pcCurrModuleIf->m_pcSubWindow[i]->disableModule(); - } - // Create Module pcCurrModuleIf->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );