diff --git a/source/app/DialogSubWindowSelector.cpp b/source/app/DialogSubWindowSelector.cpp index 7e80643..7908fe5 100755 --- a/source/app/DialogSubWindowSelector.cpp +++ b/source/app/DialogSubWindowSelector.cpp @@ -57,8 +57,8 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi m_comboBoxWindowList->setSizePolicy( sizePolicy ); m_comboBoxWindowList->setAcceptDrops( true ); - m_pushButtonAdd = new QPushButton( "Add", this ); + m_pushButtonAddAll = new QPushButton( "Add all", this ); m_pushButtonRemove = new QPushButton( "Remove", this ); m_pushButtonRemove->setEnabled( false ); @@ -79,6 +79,7 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi QVBoxLayout* RightVLayout = new QVBoxLayout(); RightVLayout->addWidget( m_pushButtonAdd ); + RightVLayout->addWidget( m_pushButtonAddAll ); RightVLayout->addWidget( m_pushButtonRemove ); RightVLayout->addItem( new QSpacerItem( 40, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); RightVLayout->addWidget( dialogButtonOkCancel ); @@ -94,6 +95,7 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) ); connect( dialogButtonOkCancel, 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() ) ); QMetaObject::connectSlotsByName( this ); @@ -110,14 +112,14 @@ Void DialogSubWindowSelector::updateSubWindowList() { subWindow = qobject_cast( m_pcMainWindowMdiArea->subWindowList().at( i ) ); currSubWindowName = subWindow->getWindowName(); - if( !m_pcSelectedWindowListNames.contains( currSubWindowName ) ) + if( !m_pcSelectedWindowListNames.contains( currSubWindowName ) && !subWindow->getIsModule() ) m_pcWindowListNames.append( currSubWindowName ); } m_comboBoxWindowList->clear(); m_comboBoxWindowList->insertItems( 0, m_pcWindowListNames ); m_comboBoxWindowList->setCurrentIndex( -1 ); - if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() >= m_iNumberOfSelectedWindows ) + if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() >= m_iNumberOfSelectedWindows ) { m_pushButtonAdd->setEnabled( false ); } @@ -125,7 +127,7 @@ Void DialogSubWindowSelector::updateSubWindowList() { m_pushButtonAdd->setEnabled( true ); } - if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() < m_iNumberOfSelectedWindows ) + if( m_iNumberOfSelectedWindows >= 0 && m_pcSelectedWindowListNames.size() < m_iNumberOfSelectedWindows ) { } @@ -137,6 +139,10 @@ Void DialogSubWindowSelector::updateSubWindowList() { m_pushButtonRemove->setEnabled( false ); } + if( m_iNumberOfSelectedWindows >= 0 && m_pcWindowListNames.size() <= m_iNumberOfSelectedWindows ) + { + m_pushButtonAddAll->setEnabled( true ); + } } Void DialogSubWindowSelector::setSubWindowList( QStringList cWindowListNames ) @@ -149,7 +155,7 @@ Void DialogSubWindowSelector::setSubWindowList( QStringList cWindowListNames ) // ----------------------- Slot Functions ----------------------- -void DialogSubWindowSelector::addSubWindow() +Void DialogSubWindowSelector::addSubWindow() { Int iSelectedIdx = m_comboBoxWindowList->currentIndex(); if( iSelectedIdx >= 0 ) @@ -161,7 +167,21 @@ void DialogSubWindowSelector::addSubWindow() } } -void DialogSubWindowSelector::removeSubWindow() +Void DialogSubWindowSelector::addAllSubWindow() +{ + if( m_iNumberOfSelectedWindows <= 0 || m_pcWindowListNames.size() <= m_iNumberOfSelectedWindows ) + { + for( Int i = 0; i < m_pcWindowListNames.size(); i++ ) + { + m_pcSelectedWindowListNames.append( m_pcWindowListNames.at( i ) ); + } + m_listSelectedWindows->clear(); + m_listSelectedWindows->insertItems( 0, m_pcSelectedWindowListNames ); + updateSubWindowList(); + } +} + +Void DialogSubWindowSelector::removeSubWindow() { QList selectedWindows = m_listSelectedWindows->selectedItems(); if( selectedWindows.size() ) diff --git a/source/app/DialogSubWindowSelector.h b/source/app/DialogSubWindowSelector.h index 74286c6..5715ced 100755 --- a/source/app/DialogSubWindowSelector.h +++ b/source/app/DialogSubWindowSelector.h @@ -64,6 +64,7 @@ private: QComboBox* m_comboBoxWindowList; QPushButton* m_pushButtonAdd; + QPushButton* m_pushButtonAddAll; QPushButton* m_pushButtonRemove; QListWidget* m_listSelectedWindows; @@ -71,6 +72,7 @@ private: private Q_SLOTS: void addSubWindow(); + void addAllSubWindow(); void removeSubWindow(); }; diff --git a/source/app/ModulesHandle.cpp b/source/app/ModulesHandle.cpp index 1303890..c0e042f 100644 --- a/source/app/ModulesHandle.cpp +++ b/source/app/ModulesHandle.cpp @@ -140,7 +140,7 @@ SubWindowHandle* ModulesHandle::enableModuleIf( PlaYUVerModuleIf *pcCurrModuleIf pcCurrModuleIf->m_pcDisplaySubWindow = NULL; if( ( pcCurrModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { - interfaceChild = new SubWindowHandle( m_pcParent ); + interfaceChild = new SubWindowHandle( m_pcParent, true ); interfaceChild->setWindowName( windowName ); connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, PlaYUVerFrame *) ), m_pcParent, SLOT( updatePixelValueStatusBar(const QPoint &, PlaYUVerFrame *) ) ); diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 540488c..88a3018 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -29,8 +29,9 @@ namespace plaYUVer { -SubWindowHandle::SubWindowHandle( QWidget * parent ) : - QMdiSubWindow( parent ) +SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) : + QMdiSubWindow( parent ), + m_bIsModule( isModule ) { setParent( parent ); diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 24d0e57..ea41758 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -57,11 +57,12 @@ private: QString m_cCurrFileName; Bool m_bIsPlaying; + Bool m_bIsModule; QPoint m_cLastScroll; public: - SubWindowHandle( QWidget * parent = 0 ); + SubWindowHandle( QWidget * parent = 0, Bool isModule = false ); ~SubWindowHandle(); Bool mayClose(); @@ -168,6 +169,11 @@ public: return m_cCurrFileName; } + Bool getIsModule() + { + return m_bIsModule; + } + protected: void closeEvent( QCloseEvent *event );