Minor code arrangements
This commit is contained in:
@@ -303,7 +303,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
{
|
||||
if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||
{
|
||||
pcModuleSubWindow = new VideoSubWindow( m_pcParent, true );
|
||||
pcModuleSubWindow = new VideoSubWindow( this , true );
|
||||
pcModuleSubWindow->setWindowShortName( windowName );
|
||||
pcModuleSubWindow->setWindowName( windowName );
|
||||
|
||||
@@ -312,7 +312,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrModuleIf, true );
|
||||
m_pcMdiArea->addSubWindow( pcModuleSubWindow );
|
||||
//m_pcMdiArea->addSubWindow( pcModuleSubWindow );
|
||||
}
|
||||
}
|
||||
else if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
@@ -342,7 +342,13 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
|
||||
applyModuleIf( pcCurrModuleIf, false );
|
||||
QCoreApplication::processEvents();
|
||||
//pcModuleSubWindow->show();
|
||||
|
||||
if( pcModuleSubWindow )
|
||||
{
|
||||
QMdiSubWindow* window = m_pcMdiArea->addSubWindow( pcModuleSubWindow );
|
||||
window->show();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,6 @@ public:
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
SubWindowHandle* processModuleHandlingOpt();
|
||||
|
||||
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
|
||||
static Bool applyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf, Bool isPlaying = false, Bool disableThreads = false );
|
||||
|
||||
|
||||
@@ -246,12 +246,12 @@ Void VideoSubWindow::setCurrFrame( PlaYUVerFrame* pcCurrFrame )
|
||||
{
|
||||
m_pcCurrFrame = pcCurrFrame;
|
||||
m_cViewArea->setImage( m_pcCurrFrame );
|
||||
if( !isVisible() )
|
||||
{
|
||||
show();
|
||||
resize( sizeHint() );
|
||||
zoomToFit();
|
||||
}
|
||||
// if( !isVisible() )
|
||||
// {
|
||||
// show();
|
||||
// resize( sizeHint() );
|
||||
// zoomToFit();
|
||||
// }
|
||||
}
|
||||
|
||||
Void VideoSubWindow::refreshFrame()
|
||||
|
||||
+67
-63
@@ -45,7 +45,7 @@ plaYUVerApp::plaYUVerApp()
|
||||
m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
|
||||
#endif
|
||||
|
||||
mdiArea = new PlaYUVerMdiArea;
|
||||
mdiArea = new PlaYUVerMdiArea( this );
|
||||
setCentralWidget( mdiArea );
|
||||
//mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
|
||||
|
||||
@@ -245,8 +245,8 @@ Void plaYUVerApp::open()
|
||||
|
||||
QStringList filter;
|
||||
filter << supported
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
|
||||
QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
|
||||
|
||||
@@ -292,8 +292,8 @@ Void plaYUVerApp::save()
|
||||
|
||||
QStringList filter;
|
||||
filter << supported
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
<< formatsList
|
||||
<< tr( "All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), QString(), filter.join( ";;" ) );
|
||||
|
||||
@@ -310,8 +310,6 @@ Void plaYUVerApp::save()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Void plaYUVerApp::format()
|
||||
{
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
@@ -448,56 +446,6 @@ Void plaYUVerApp::updateZoomFactorSBox()
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::update()
|
||||
{
|
||||
SubWindowHandle *new_window = activeSubWindow();
|
||||
QCoreApplication::processEvents();
|
||||
//if( activeSubWindow() != m_pcCurrentSubWindow )
|
||||
{
|
||||
m_pcCurrentSubWindow = NULL;
|
||||
m_pcCurrentVideoSubWindow = NULL;
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
m_pcCurrentSubWindow = new_window;
|
||||
|
||||
switch( m_pcCurrentSubWindow->getCategory() )
|
||||
{
|
||||
case SubWindowHandle::VIDEO_SUBWINDOW:
|
||||
m_pcCurrentVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcCurrentSubWindow );
|
||||
break;
|
||||
}
|
||||
|
||||
setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() );
|
||||
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentVideoSubWindow->getRefSubWindow() ) )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->setRefSubWindow( NULL );
|
||||
}
|
||||
}
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
m_appModuleVideo->update( m_pcCurrentVideoSubWindow );
|
||||
m_appModuleQuality->update( m_pcCurrentVideoSubWindow );
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
// ----------------------- Status bar Functions -----------------------
|
||||
|
||||
Void plaYUVerApp::updateStatusBar( const QString& statusBarString )
|
||||
{
|
||||
if( !statusBarString.isEmpty() )
|
||||
{
|
||||
statusBar()->showMessage( statusBarString, 5000 );
|
||||
}
|
||||
else
|
||||
{
|
||||
statusBar()->showMessage( " " );
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- Drag and drop functions ----------------------
|
||||
|
||||
Void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
|
||||
@@ -519,7 +467,12 @@ Void plaYUVerApp::dropEvent( QDropEvent *event )
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------- Gui Functions -----------------------
|
||||
// ----------------------- Sub Window Functions -----------------------
|
||||
|
||||
void plaYUVerApp::tileSubWindows()
|
||||
{
|
||||
mdiArea->tileSubWindows();
|
||||
}
|
||||
|
||||
SubWindowHandle *plaYUVerApp::activeSubWindow()
|
||||
{
|
||||
@@ -575,6 +528,56 @@ Void plaYUVerApp::setActiveSubWindow( QWidget *window )
|
||||
mdiArea->setActiveSubWindow( qobject_cast<QMdiSubWindow *>( window ) );
|
||||
}
|
||||
|
||||
// ----------------------- Update Functions -----------------------
|
||||
|
||||
Void plaYUVerApp::update()
|
||||
{
|
||||
SubWindowHandle *new_window = activeSubWindow();
|
||||
QCoreApplication::processEvents();
|
||||
//if( activeSubWindow() != m_pcCurrentSubWindow )
|
||||
{
|
||||
m_pcCurrentSubWindow = NULL;
|
||||
m_pcCurrentVideoSubWindow = NULL;
|
||||
if( activeSubWindow() )
|
||||
{
|
||||
m_pcCurrentSubWindow = new_window;
|
||||
|
||||
switch( m_pcCurrentSubWindow->getCategory() )
|
||||
{
|
||||
case SubWindowHandle::VIDEO_SUBWINDOW:
|
||||
m_pcCurrentVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcCurrentSubWindow );
|
||||
break;
|
||||
}
|
||||
|
||||
setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() );
|
||||
|
||||
if( m_pcCurrentVideoSubWindow )
|
||||
{
|
||||
if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentVideoSubWindow->getRefSubWindow() ) )
|
||||
{
|
||||
m_pcCurrentVideoSubWindow->setRefSubWindow( NULL );
|
||||
}
|
||||
}
|
||||
updateZoomFactorSBox();
|
||||
}
|
||||
}
|
||||
m_appModuleVideo->update( m_pcCurrentVideoSubWindow );
|
||||
m_appModuleQuality->update( m_pcCurrentVideoSubWindow );
|
||||
updateMenus();
|
||||
}
|
||||
|
||||
Void plaYUVerApp::updateStatusBar( const QString& statusBarString )
|
||||
{
|
||||
if( !statusBarString.isEmpty() )
|
||||
{
|
||||
statusBar()->showMessage( statusBarString, 5000 );
|
||||
}
|
||||
else
|
||||
{
|
||||
statusBar()->showMessage( " " );
|
||||
}
|
||||
}
|
||||
|
||||
Void plaYUVerApp::updateMenus()
|
||||
{
|
||||
Bool hasSubWindow = ( activeSubWindow() != 0 );
|
||||
@@ -658,7 +661,7 @@ Void plaYUVerApp::updateWindowMenu()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------- Create Functions -----------------------
|
||||
|
||||
Void plaYUVerApp::createActions()
|
||||
{
|
||||
@@ -787,7 +790,8 @@ Void plaYUVerApp::createActions()
|
||||
m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this );
|
||||
m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) );
|
||||
m_arrayActions[TILE_WINDOWS_ACT]->setStatusTip( tr( "Tile the windows" ) );
|
||||
connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) );
|
||||
//connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) );
|
||||
connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( tileSubWindows() ) );
|
||||
|
||||
m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this );
|
||||
m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) );
|
||||
@@ -942,7 +946,7 @@ Void plaYUVerApp::createDockWidgets()
|
||||
|
||||
Void plaYUVerApp::createStatusBar()
|
||||
{
|
||||
statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() );
|
||||
statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() );
|
||||
statusBar()->showMessage( tr( "Ready" ) );
|
||||
}
|
||||
|
||||
@@ -994,7 +998,7 @@ Void plaYUVerApp::readSettings()
|
||||
m_appTool = ( ViewArea::eTool )appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt();
|
||||
setTool( m_appTool );
|
||||
|
||||
QVariant value = appSettings.value("MainWindow/RecentFileList");
|
||||
QVariant value = appSettings.value( "MainWindow/RecentFileList" );
|
||||
m_aRecentFileStreamInfo = value.value<PlaYUVerStreamInfoVector>();
|
||||
updateRecentFileActions();
|
||||
|
||||
@@ -1014,7 +1018,7 @@ Void plaYUVerApp::writeSettings()
|
||||
|
||||
QVariant var;
|
||||
var.setValue<PlaYUVerStreamInfoVector>( m_aRecentFileStreamInfo );
|
||||
appSettings.setValue("MainWindow/RecentFileList", var );
|
||||
appSettings.setValue( "MainWindow/RecentFileList", var );
|
||||
|
||||
m_appModuleVideo->writeSettings();
|
||||
m_appModuleQuality->writeSettings();
|
||||
|
||||
+16
-15
@@ -64,6 +64,8 @@ protected:
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
void about();
|
||||
|
||||
/**
|
||||
* File functions slots
|
||||
*/
|
||||
@@ -90,18 +92,18 @@ private Q_SLOTS:
|
||||
|
||||
void setTool( int idxTool );
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent *event );
|
||||
void dropEvent( QDropEvent *event );
|
||||
|
||||
void tileSubWindows();
|
||||
void setActiveSubWindow( QWidget *window );
|
||||
|
||||
|
||||
void update();
|
||||
void updateWindowMenu();
|
||||
void updateZoomFactorSBox();
|
||||
void updateStatusBar( const QString& );
|
||||
|
||||
void about();
|
||||
|
||||
void dragEnterEvent( QDragEnterEvent *event );
|
||||
void dropEvent( QDropEvent *event );
|
||||
|
||||
void setActiveSubWindow( QWidget *window );
|
||||
|
||||
private:
|
||||
|
||||
class PlaYUVerMdiArea: public QMdiArea
|
||||
@@ -141,6 +143,13 @@ private:
|
||||
|
||||
QString m_cLastOpenPath;
|
||||
|
||||
SubWindowHandle *activeSubWindow();
|
||||
template<typename T>
|
||||
T findSubWindow( const QMdiArea* mdiArea, const QString& name );
|
||||
template<typename T>
|
||||
T findSubWindow( const QMdiArea* mdiArea, const T subWindow );
|
||||
static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName );
|
||||
|
||||
Void updateMenus();
|
||||
|
||||
Void createActions();
|
||||
@@ -155,14 +164,6 @@ private:
|
||||
Void readSettings();
|
||||
Void writeSettings();
|
||||
|
||||
SubWindowHandle *activeSubWindow();
|
||||
|
||||
template<typename T>
|
||||
T findSubWindow( const QMdiArea* mdiArea, const QString& name );
|
||||
template<typename T>
|
||||
T findSubWindow( const QMdiArea* mdiArea, const T subWindow );
|
||||
|
||||
static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName );
|
||||
|
||||
QDoubleSpinBox *m_pcZoomFactorSBox;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user