Clean code and fix some issues regarding video handle and subwindow management
This commit is contained in:
1 parent
1f9affe499
commit
d7a8f52756
7 files changed
+56
-105
No files matched your search
+10
-8
@@ -39,14 +39,16 @@ SubWindowHandle::~SubWindowHandle()
|
||||
}
|
||||
|
||||
Void SubWindowHandle::setWindowName( QString name )
|
||||
{
|
||||
m_cWindowName = name;
|
||||
setWindowTitle( m_cWindowName );
|
||||
}
|
||||
QString SubWindowHandle::getWindowName()
|
||||
{
|
||||
return m_cWindowName;
|
||||
}
|
||||
{
|
||||
m_cWindowName = name;
|
||||
setWindowTitle( m_cWindowName );
|
||||
}
|
||||
|
||||
QString SubWindowHandle::getWindowName()
|
||||
{
|
||||
return m_cWindowName;
|
||||
}
|
||||
|
||||
Bool SubWindowHandle::mayClose()
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -82,6 +82,9 @@ public:
|
||||
return m_uiCategory;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent *event ) = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
void zoomChanged();
|
||||
void updateStatusBar( const QString& );
|
||||
|
||||
@@ -267,6 +267,14 @@ Void VideoHandle::update( VideoSubWindow* currSubWindow )
|
||||
update();
|
||||
}
|
||||
|
||||
Void VideoHandle::updateSelectionArea( QRect area )
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
m_pcFramePropertiesSideBar->setSelection( area );
|
||||
}
|
||||
}
|
||||
|
||||
Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow )
|
||||
{
|
||||
if( m_acPlayingSubWindows.contains( currSubWindow ) )
|
||||
@@ -274,6 +282,10 @@ Void VideoHandle::closeSubWindow( VideoSubWindow* currSubWindow )
|
||||
Int pos = m_acPlayingSubWindows.indexOf( currSubWindow );
|
||||
m_acPlayingSubWindows.at( pos )->stop();
|
||||
m_acPlayingSubWindows.remove( pos );
|
||||
if( m_acPlayingSubWindows.size() < 2 )
|
||||
{
|
||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ Q_SIGNALS:
|
||||
|
||||
private Q_SLOTS:
|
||||
void update();
|
||||
void updateSelectionArea( QRect area );
|
||||
void play();
|
||||
void stop();
|
||||
void playEvent();
|
||||
|
||||
@@ -528,10 +528,9 @@ QSize VideoSubWindow::sizeHint() const
|
||||
return maxSize;
|
||||
}
|
||||
|
||||
void VideoSubWindow::closeEvent( QCloseEvent *event )
|
||||
Void VideoSubWindow::closeEvent( QCloseEvent *event )
|
||||
{
|
||||
Bool bAccept = mayClose();
|
||||
bAccept = m_bIsPlaying ? false : bAccept;
|
||||
Bool bAccept = m_bIsPlaying ? false : true;
|
||||
if( bAccept )
|
||||
{
|
||||
event->accept();
|
||||
|
||||
+13
-72
@@ -145,6 +145,18 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::closeActiveWindow()
|
||||
{
|
||||
SubWindowHandle *currSubWindow = activeSubWindow();
|
||||
m_appModuleVideo->closeSubWindow( qobject_cast<VideoSubWindow*>( currSubWindow ) );
|
||||
mdiArea->closeActiveSubWindow();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::closeAll()
|
||||
{
|
||||
mdiArea->closeAllSubWindows();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
{
|
||||
if( !QFileInfo( fileName ).exists() )
|
||||
@@ -181,7 +193,7 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
|
||||
mdiArea->addSubWindow( videoSubWindow );
|
||||
videoSubWindow->show();
|
||||
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updatePropertiesSelectedArea( QRect ) ) );
|
||||
connect( videoSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
|
||||
|
||||
connect( subWindow, SIGNAL( updateStatusBar( const QString& ) ), this, SLOT( updateStatusBar( const QString& ) ) );
|
||||
connect( subWindow, SIGNAL( zoomChanged() ), this, SLOT( updateZoomFactorSBox() ) );
|
||||
@@ -367,11 +379,6 @@ Void plaYUVerApp::setTool( Int idxTool )
|
||||
{
|
||||
m_appTool = ( ViewArea::eTool )idxTool;
|
||||
actionGroupTools->actions().at( m_appTool )->setChecked( true );
|
||||
setAllSubWindowTool();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::setAllSubWindowTool()
|
||||
{
|
||||
QList<VideoSubWindow*> videoSubWindowList = mdiArea->findChildren<VideoSubWindow*>();
|
||||
for( Int i = 0; i < videoSubWindowList.size(); i++ )
|
||||
{
|
||||
@@ -379,72 +386,6 @@ Void plaYUVerApp::setAllSubWindowTool()
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::closeActiveWindow()
|
||||
{
|
||||
SubWindowHandle *currSubWindow = activeSubWindow();
|
||||
m_appModuleVideo->closeSubWindow( qobject_cast<VideoSubWindow*>( currSubWindow ) );
|
||||
mdiArea->closeActiveSubWindow();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::closeAll()
|
||||
{
|
||||
mdiArea->closeAllSubWindows();
|
||||
}
|
||||
//
|
||||
//Void plaYUVerApp::updateStreamProperties()
|
||||
//{
|
||||
// if( m_pcCurrentVideoSubWindow )
|
||||
// {
|
||||
// Int frame_num = 0;
|
||||
// UInt64 total_frame_num = 1;
|
||||
// if( m_pcCurrentVideoSubWindow->getInputStream() )
|
||||
// {
|
||||
// frame_num = m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum();
|
||||
// m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
||||
// total_frame_num = getMaxFrameNumber();
|
||||
// m_pcStreamProperties->setData( m_pcCurrentVideoSubWindow->getInputStream() );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_pcStreamProperties->setData( NULL );
|
||||
// m_pcFrameNumInfo->setCurrFrameNum( 0 );
|
||||
// }
|
||||
//
|
||||
// m_pcFrameProperties->setData( m_pcCurrentVideoSubWindow->getCurrFrame(), m_pcCurrentVideoSubWindow->isPlaying() );
|
||||
//
|
||||
// m_pcFrameSlider->setValue( frame_num );
|
||||
// m_pcFrameSlider->setMaximum( total_frame_num - 1 );
|
||||
// m_pcFrameNumInfo->setTotalFrameNum( total_frame_num );
|
||||
//
|
||||
// if( m_pcCurrentVideoSubWindow->isPlaying() )
|
||||
// m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPause ) );
|
||||
// else
|
||||
// m_arrayActions[PLAY_ACT]->setIcon( style()->standardIcon( QStyle::SP_MediaPlay ) );
|
||||
//
|
||||
// return;
|
||||
// }
|
||||
// m_pcStreamProperties->setData( NULL );
|
||||
// m_pcFrameProperties->setData( NULL, false );
|
||||
// m_pcFrameNumInfo->setCurrFrameNum( 0 );
|
||||
// m_pcFrameNumInfo->setTotalFrameNum( 0 );
|
||||
// m_pcZoomFactorSBox->setValue( 0.0 );
|
||||
//}
|
||||
|
||||
Void plaYUVerApp::updatePropertiesSelectedArea( QRect area )
|
||||
{
|
||||
// if( m_pcCurrentSubWindow )
|
||||
// {
|
||||
// if( area.isValid() )
|
||||
// {
|
||||
// m_pcFrameProperties->setSelection( area );
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_pcFrameProperties->setData( NULL, false );
|
||||
// }
|
||||
}
|
||||
|
||||
// ----------------------- Zoom Functions -----------------------
|
||||
|
||||
Void plaYUVerApp::normalSize()
|
||||
|
||||
+15
-22
@@ -88,11 +88,12 @@ private Q_SLOTS:
|
||||
void normalSize();
|
||||
void zoomToFit();
|
||||
|
||||
void setTool( int idxTool );
|
||||
|
||||
void update();
|
||||
void updateWindowMenu();
|
||||
void updateZoomFactorSBox();
|
||||
void updateStatusBar( const QString& );
|
||||
void updatePropertiesSelectedArea( QRect area );
|
||||
|
||||
void about();
|
||||
|
||||
@@ -101,9 +102,6 @@ private Q_SLOTS:
|
||||
|
||||
void setActiveSubWindow( QWidget *window );
|
||||
|
||||
void setAllSubWindowTool();
|
||||
void setTool( int idxTool );
|
||||
|
||||
private:
|
||||
|
||||
class PlaYUVerMdiArea: public QMdiArea
|
||||
@@ -138,7 +136,7 @@ private:
|
||||
/**
|
||||
* Save the current subwindow for every category
|
||||
*/
|
||||
SubWindowHandle* m_pcCurrentSubWindow; //!< General always set
|
||||
SubWindowHandle* m_pcCurrentSubWindow; //!< General always set
|
||||
VideoSubWindow* m_pcCurrentVideoSubWindow;
|
||||
|
||||
QString m_cLastOpenPath;
|
||||
@@ -175,6 +173,17 @@ private:
|
||||
QSignalMapper *mapperZoom;
|
||||
QSignalMapper *mapperWindow;
|
||||
|
||||
// Tools Actions;
|
||||
QActionGroup *actionGroupTools;
|
||||
enum APP_TOOLS_ACTION_LIST
|
||||
{
|
||||
NAVIGATION_TOOL,
|
||||
SELECTION_TOOL,
|
||||
TOTAL_TOOLS,
|
||||
};
|
||||
QSignalMapper *m_mapperTools;
|
||||
ViewArea::eTool m_appTool;
|
||||
|
||||
/**
|
||||
* App modules
|
||||
* Video
|
||||
@@ -185,7 +194,6 @@ private:
|
||||
QualityHandle* m_appModuleQuality;
|
||||
ModulesHandle *m_appModuleExtensions;
|
||||
|
||||
|
||||
/**
|
||||
* Array of menus for the main app
|
||||
* @param position description:
|
||||
@@ -260,26 +268,11 @@ private:
|
||||
};
|
||||
QVector<QAction*> m_arrayActions;
|
||||
|
||||
#define MAX_RECENT_FILES 10
|
||||
#define MAX_RECENT_FILES 20
|
||||
QVector<QAction*> m_arrayRecentFilesActions;
|
||||
//QAction *actionPopupMenu;
|
||||
|
||||
// Tools Actions;
|
||||
QActionGroup *actionGroupTools;
|
||||
enum APP_TOOLS_ACTION_LIST
|
||||
{
|
||||
NAVIGATION_TOOL,
|
||||
SELECTION_TOOL,
|
||||
TOTAL_TOOLS,
|
||||
};
|
||||
QVector<QAction*> m_arrayTools;
|
||||
QSignalMapper *m_mapperTools;
|
||||
ViewArea::eTool m_appTool;
|
||||
|
||||
PlaYUVerStreamInfoVector m_aRecentFileStreamInfo;
|
||||
|
||||
AboutDialog* m_pcAboutDialog;
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
Reference in new issue
Block a user