From 148981528de0b666334da7da07d5cf1e367cabf0 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Thu, 9 Apr 2015 17:08:41 +0100 Subject: [PATCH] Fix wrong label in configure dialog and complete the save of the last window mode --- app/ConfigureFormatDialog.cpp | 14 ++++++------ app/PlaYUVerApp.cpp | 2 ++ app/PlaYUVerSubWindowHandle.cpp | 38 +++++++++++++++++++++------------ app/PlaYUVerSubWindowHandle.h | 1 + lib/PlaYUVerFrame.cpp | 4 ++++ 5 files changed, 37 insertions(+), 22 deletions(-) diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp index 8fdcdfd..ab3caf4 100644 --- a/app/ConfigureFormatDialog.cpp +++ b/app/ConfigureFormatDialog.cpp @@ -174,20 +174,18 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget *parent ) : pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 1 ); pixelGridLayout->addWidget( m_comboBoxPixelFormat, 1, 2 ); - /* - * Frame rate format - */ QHBoxLayout* bitsPerPelLayout = new QHBoxLayout(); QLabel* bitsPerPelLabel = new QLabel(); - bitsPerPelLabel->setFont( menusFont ); - bitsPerPelLabel->setText( "Frame Rate" ); + 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 ); - bitsPerPelLayout->addWidget( bitsPerPelLabel ); - bitsPerPelLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) ); - bitsPerPelLayout->addWidget( m_spinBoxBits ); + pixelGridLayout->addWidget( bitsPerPelLabel, 2, 0 ); + pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 2, 1 ); + pixelGridLayout->addWidget( m_spinBoxBits, 2, 2 ); /* * Frame rate format diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp index e618a47..8a3e74c 100644 --- a/app/PlaYUVerApp.cpp +++ b/app/PlaYUVerApp.cpp @@ -929,6 +929,7 @@ Void plaYUVerApp::readSettings() m_appModuleVideo->readSettings(); m_appModuleQuality->readSettings(); m_appModuleExtensions->readSettings(); + m_pcWindowHandle->readSettings(); } Void plaYUVerApp::writeSettings() @@ -947,6 +948,7 @@ Void plaYUVerApp::writeSettings() m_appModuleVideo->writeSettings(); m_appModuleQuality->writeSettings(); m_appModuleExtensions->writeSettings(); + m_pcWindowHandle->writeSettings(); } } // NAMESPACE diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp index d37ff26..117f171 100644 --- a/app/PlaYUVerSubWindowHandle.cpp +++ b/app/PlaYUVerSubWindowHandle.cpp @@ -59,14 +59,15 @@ private: PlaYUVerSubWindowHandle::PlaYUVerSubWindowHandle( QWidget *parent ) : QWidget( parent ) { - m_iWindowMode = 0; - - //setWindowMode( NormalSubWindows ); - setWindowMode( MdiWSubWindows ); - + m_iWindowMode = -1; + m_pcWindowManagerLayout = NULL; + m_pcMdiArea = NULL; m_pcActiveWindow = NULL; m_apcSubWindowList.clear(); m_apcMdiSubWindowList.clear(); + + //setWindowMode( NormalSubWindows ); + setWindowMode( MdiWSubWindows ); } Void PlaYUVerSubWindowHandle::resetWindowMode() @@ -95,6 +96,7 @@ Void PlaYUVerSubWindowHandle::resetWindowMode() delete m_pcMdiArea; if( m_pcWindowManagerLayout ) delete m_pcWindowManagerLayout; + } } @@ -349,25 +351,25 @@ Void PlaYUVerSubWindowHandle::createActions() m_arrayActions.resize( TOTAL_ACT ); // ------------ Tools ------------ - QActionGroup* actionGroupWindowMode = new QActionGroup( this ); - actionGroupWindowMode->setExclusive( true ); + m_actionGroupWindowMode = new QActionGroup( this ); + m_actionGroupWindowMode->setExclusive( true ); m_mapperWindowMode = new QSignalMapper( this ); connect( m_mapperWindowMode, SIGNAL( mapped(int) ), this, SLOT( setWindowMode(int) ) ); m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] = new QAction( tr( "&Detached SubWindows" ), this ); m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT]->setCheckable( true ); - actionGroupWindowMode->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] ); + m_actionGroupWindowMode->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] ); connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) ); - m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], ViewArea::NavigationTool ); + m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], NormalSubWindows ); m_arrayActions[MDI_SUBWINDOW_MODE_ACT] = new QAction( "&MDI SubWindows", this ); m_arrayActions[MDI_SUBWINDOW_MODE_ACT]->setCheckable( true ); - actionGroupWindowMode->addAction( m_arrayActions[MDI_SUBWINDOW_MODE_ACT] ); + m_actionGroupWindowMode->addAction( m_arrayActions[MDI_SUBWINDOW_MODE_ACT] ); connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) ); - m_mapperWindowMode->setMapping( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], ViewArea::NormalSelectionTool ); + m_mapperWindowMode->setMapping( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], MdiWSubWindows ); - actionGroupWindowMode->actions().at( m_iWindowMode )->setChecked( true ); + m_actionGroupWindowMode->actions().at( m_iWindowMode )->setChecked( true ); m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this ); m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) ); @@ -472,12 +474,20 @@ Void PlaYUVerSubWindowHandle::updateMenu() Void PlaYUVerSubWindowHandle::readSettings() { - + QSettings appSettings; + m_cMdiModeWindowPosition = appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint(); + m_cMdiModeWindowSize = appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize(); + Int iWindowMode = appSettings.value( "SubWindowManager/SubWindowMode", MdiWSubWindows ).toInt(); + setWindowMode( iWindowMode ); + m_actionGroupWindowMode->actions().at( iWindowMode )->setChecked( true ); } Void PlaYUVerSubWindowHandle::writeSettings() { - + QSettings appSettings; + appSettings.setValue( "SubWindowManager/LastMdiPosition", m_cMdiModeWindowPosition ); + appSettings.setValue( "SubWindowManager/LastMdiSize", m_cMdiModeWindowSize ); + appSettings.setValue( "SubWindowManager/SubWindowMode", m_iWindowMode ); } } // NAMESPACE diff --git a/app/PlaYUVerSubWindowHandle.h b/app/PlaYUVerSubWindowHandle.h index 93874b6..1070e52 100644 --- a/app/PlaYUVerSubWindowHandle.h +++ b/app/PlaYUVerSubWindowHandle.h @@ -95,6 +95,7 @@ private: }; QVector m_arrayActions; QSignalMapper* m_mapperWindowMode; + QActionGroup* m_actionGroupWindowMode; QSignalMapper* m_mapperWindow; QMenu* m_pcMenuWindow; diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index 2137464..ef90a67 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -241,11 +241,15 @@ UInt64 PlaYUVerFrame::getBytesPerFrame( UInt uiWidth, UInt uiHeight, Int iPixelF UInt PlaYUVerFrame::getChromaWidth() const { + if( m_pcPelFormat->colorSpace == GRAY ) + return 0; return CHROMASHIFT( m_uiWidth, m_pcPelFormat->log2ChromaWidth ); } UInt PlaYUVerFrame::getChromaHeight() const { + if( m_pcPelFormat->colorSpace == GRAY ) + return 0; return CHROMASHIFT( m_uiHeight, m_pcPelFormat->log2ChromaHeight ); }