Init implementation of a window manager to replace QMdiArea

This commit is contained in:
jfmcarreira committed 2015-01-21 00:26:27 +00:00
1 parent 69cd20ab59
commit 26054b014e
16 files changed
+464 -252

No files matched your search

+1
View File
@@ -9,6 +9,7 @@ set(plaYUver_App_SRCS
# Main
main.cpp
plaYUVerApp.cpp
PlaYUVerSubWinManager.cpp
SubWindowHandle.cpp
Settings.cpp
# Module Video
+9 -7
View File
@@ -22,17 +22,19 @@
* \brief Dialog box to select sub windows
*/
#include "PlaYUVerSubWinManager.h"
#include "DialogSubWindowSelector.h"
#include "VideoSubWindow.h"
namespace plaYUVer
{
DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdiArea, Int minWindowsSelected, Int maxWindowsSelected ) :
DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, PlaYUVerSubWinManager *windowManager, UInt uiCategory, Int minWindowsSelected, Int maxWindowsSelected ) :
QDialog( parent ),
m_uiCategory( uiCategory ),
m_iMinSelectedWindows( minWindowsSelected ),
m_iMaxSlectedWindows( maxWindowsSelected ),
m_pcMainWindowMdiArea( mdiArea )
m_pcMainWindowManager( windowManager )
{
QFont titleFont, menusFont;
@@ -115,15 +117,15 @@ DialogSubWindowSelector::DialogSubWindowSelector( QWidget *parent, QMdiArea *mdi
Void DialogSubWindowSelector::updateSubWindowList()
{
VideoSubWindow *videoSubWindow;
SubWindowHandle *subWindow;
QString currSubWindowName;
m_pcWindowListNames.clear();
QList<VideoSubWindow*> subWindowList = m_pcMainWindowMdiArea->findChildren<VideoSubWindow*>();
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( m_uiCategory );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = subWindowList.at( i );
currSubWindowName = videoSubWindow->getWindowName();
if( !m_pcSelectedWindowListNames.contains( currSubWindowName ) && !videoSubWindow->getIsModule() )
subWindow = subWindowList.at( i );
currSubWindowName = subWindow->getWindowName();
if( !m_pcSelectedWindowListNames.contains( currSubWindowName ) )
m_pcWindowListNames.append( currSubWindowName );
}
m_comboBoxWindowList->clear();
+4 -2
View File
@@ -40,6 +40,7 @@ class QColor;
namespace plaYUVer
{
class PlaYUVerSubWinManager;
/**
* Class to define the dialog box to select sub windows
* This class enable the selection of several group of windows
@@ -49,7 +50,7 @@ class DialogSubWindowSelector: public QDialog
Q_OBJECT
public:
DialogSubWindowSelector( QWidget *parent = 0, QMdiArea *mdiArea = 0, Int minWindowsSelected = 0, Int maxWindowsSelected = -1 );
DialogSubWindowSelector( QWidget *parent, PlaYUVerSubWinManager *windowManager, UInt uiCategory, Int minWindowsSelected = 0, Int maxWindowsSelected = -1 );
Void setSubWindowList( QStringList cWindowListNames );
QStringList getSelectedWindows()
@@ -57,9 +58,10 @@ public:
return m_pcSelectedWindowListNames;
}
private:
UInt m_uiCategory;
Int m_iMinSelectedWindows;
Int m_iMaxSlectedWindows;
QMdiArea* m_pcMainWindowMdiArea;
PlaYUVerSubWinManager* m_pcMainWindowManager;
QStringList m_pcWindowListNames;
QStringList m_pcSelectedWindowListNames;
+28 -27
View File
@@ -24,6 +24,7 @@
#include <cstdio>
#include "PlaYUVerSubWinManager.h"
#include "ModulesHandle.h"
#include "PlaYUVerModuleFactory.h"
#include "DialogSubWindowSelector.h"
@@ -33,10 +34,10 @@
namespace plaYUVer
{
ModulesHandle::ModulesHandle( QMainWindow * parent, QMdiArea *mdiArea ) :
ModulesHandle::ModulesHandle( QWidget* parent, PlaYUVerSubWinManager *windowManager ) :
QWidget( parent ),
m_pcParent( parent ),
m_pcMdiArea( mdiArea )
m_pcMainWindowManager( windowManager )
{
setParent( m_pcParent );
}
@@ -140,7 +141,7 @@ QMenu* ModulesHandle::createMenu()
Void ModulesHandle::updateMenus()
{
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcSubWindow ? true : false;
QAction* currModuleAction;
@@ -186,7 +187,7 @@ Void ModulesHandle::writeSettings()
Void ModulesHandle::processOpt( Int index )
{
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
if( pcSubWindow )
{
QList<PlaYUVerAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
@@ -214,7 +215,7 @@ Void ModulesHandle::processOpt( Int index )
Void ModulesHandle::activateModule()
{
QAction *pcAction = qobject_cast<QAction *>( sender() );
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
if( pcVideoSubWindow )
{
if( pcAction->isChecked() )
@@ -238,39 +239,39 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
{
VideoSubWindow* pcModuleSubWindow = NULL;
Bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked();
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMdiArea->activeSubWindow() );
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
QString windowName;
QVector<VideoSubWindow*> subWindowList;
QList<VideoSubWindow*> videoSubWindowList;
UInt numberOfFrames = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows
{
DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames, numberOfFrames );
DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager, SubWindowHandle::VIDEO_SUBWINDOW, numberOfFrames, numberOfFrames );
if( dialogWindowsSelection.exec() == QDialog::Accepted )
{
QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows();
SubWindowHandle *subWindow;
VideoSubWindow *videoSubWindow;
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow();
for( Int j = 0; j < selectedWindows.size(); j++ )
{
for( Int i = 0; i < m_pcMdiArea->subWindowList().size(); i++ )
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = qobject_cast<SubWindowHandle*>( m_pcMdiArea->subWindowList().at( i ) );
if( subWindow->getWindowName() == selectedWindows.at( j ) )
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
if( videoSubWindow->getWindowName() == selectedWindows.at( j ) )
{
subWindowList.append( qobject_cast<VideoSubWindow*>( m_pcMdiArea->subWindowList().at( i ) ) );
pcCurrModuleIf->m_pcSubWindow[j] = qobject_cast<VideoSubWindow*>( m_pcMdiArea->subWindowList().at( i ) );
videoSubWindowList.append( videoSubWindow );
pcCurrModuleIf->m_pcSubWindow[j] = videoSubWindow;
}
}
}
}
// Check for same fmt in more than one frame modules
for( Int i = 1; i < subWindowList.size(); i++ )
for( Int i = 1; i < videoSubWindowList.size(); i++ )
{
if( !subWindowList.at( i )->getCurrFrame()->haveSameFmt( subWindowList.at( 0 )->getCurrFrame() ) )
if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) )
{
subWindowList.clear();
videoSubWindowList.clear();
break;
}
}
@@ -278,12 +279,12 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
else
{
windowName.append( pcVideoSubWindow->windowTitle() );
subWindowList.append( pcVideoSubWindow );
videoSubWindowList.append( pcVideoSubWindow );
}
if( subWindowList.size() == 0 )
if( videoSubWindowList.size() == 0 )
{
m_pcParent->statusBar()->showMessage( "Error! Module cannot be applied", 2000 );
qobject_cast<QMainWindow*>( m_pcParent )->statusBar()->showMessage( "Error! Module cannot be applied", 2000 );
destroyModuleIf( pcCurrModuleIf );
return;
}
@@ -292,9 +293,9 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
windowName.append( pcCurrModuleIf->m_pcModule->m_pchModuleName );
windowName.append( ">" );
for( Int i = 0; i < subWindowList.size(); i++ )
for( Int i = 0; i < videoSubWindowList.size(); i++ )
{
pcCurrModuleIf->m_pcSubWindow[i] = subWindowList.at( i );
pcCurrModuleIf->m_pcSubWindow[i] = videoSubWindowList.at( i );
}
pcCurrModuleIf->m_pcDisplaySubWindow = NULL;
@@ -303,7 +304,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
{
if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
{
pcModuleSubWindow = new VideoSubWindow( this , true );
pcModuleSubWindow = new VideoSubWindow( this, true );
pcModuleSubWindow->setWindowShortName( windowName );
pcModuleSubWindow->setWindowName( windowName );
@@ -327,7 +328,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
pcCurrModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
pcCurrModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
pcCurrModuleIf->m_pcDockWidget->setWidget( pcCurrModuleIf->m_pcModuleDock );
m_pcParent->addDockWidget( Qt::RightDockWidgetArea, pcCurrModuleIf->m_pcDockWidget );
qobject_cast<QMainWindow*>( m_pcParent )->addDockWidget( Qt::RightDockWidgetArea, pcCurrModuleIf->m_pcDockWidget );
}
}
@@ -345,8 +346,8 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
if( pcModuleSubWindow )
{
QMdiSubWindow* window = m_pcMdiArea->addSubWindow( pcModuleSubWindow );
window->show();
m_pcMainWindowManager->addSubWindow( pcModuleSubWindow );
pcModuleSubWindow->show();
}
return;
+4 -3
View File
@@ -42,6 +42,7 @@
namespace plaYUVer
{
class PlaYUVerSubWinManager;
class PlaYUVerAppModuleIf;
class SubWindowHandle;
@@ -49,7 +50,7 @@ class ModulesHandle: public QWidget
{
Q_OBJECT
public:
ModulesHandle( QMainWindow* parent = 0, QMdiArea *mdiArea = 0 );
ModulesHandle( QWidget*, PlaYUVerSubWinManager* );
~ModulesHandle();
Void createActions();
@@ -67,8 +68,8 @@ public:
static Bool showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double moduleResult );
private:
QMainWindow *m_pcParent;
QMdiArea *m_pcMdiArea;
QWidget* m_pcParent;
PlaYUVerSubWinManager* m_pcMainWindowManager;
enum
{
+189
View File
@@ -0,0 +1,189 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file PlaYUVerSubWinManager.cpp
* \brief
*/
#include "PlaYUVerSubWinManager.h"
#include "SubWindowHandle.h"
namespace plaYUVer
{
PlaYUVerSubWinManager::PlaYUVerSubWinManager( QWidget *parent ) :
QWidget( parent ),
m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
{
m_bMdiModeEnabled = true;
m_pcMdiArea = new QMdiArea( this );
connect( m_pcMdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( updateActiveSubWindow() ) );
m_pcActiveWindow = NULL;
m_apcSubWindowList.clear();
m_apcMdiSubWindowList.clear();
}
void PlaYUVerSubWinManager::paintEvent( QPaintEvent *event )
{
// QWidget::paintEvent( event );
// QPainter painter( m_pcMdiArea->viewport() );
// QSize logoSize = 2 * size() / 3;
//
// QPixmap pixFinalLogo = m_pixmapLogo.scaled( logoSize, Qt::KeepAspectRatio );
//
// // Calculate the logo position - the bottom right corner of the mdi area.
// int x = width() / 2 - pixFinalLogo.width() / 2;
// int y = height() / 2 - pixFinalLogo.height() / 2;
// painter.drawPixmap( x, y, pixFinalLogo );
}
Void PlaYUVerSubWinManager::updateActiveSubWindow()
{
if( m_bMdiModeEnabled )
{
m_pcActiveWindow = NULL;
QMdiSubWindow* mdiSubWindow = m_pcMdiArea->activeSubWindow();
if( mdiSubWindow)
{
QWidget* activeWidget = m_pcMdiArea->activeSubWindow()->widget();
Int windowIdx = m_apcSubWindowList.indexOf( qobject_cast<SubWindowHandle *>( activeWidget ) );
if( windowIdx >= 0 )
{
m_pcActiveWindow = m_apcSubWindowList.at( windowIdx );
emit windowActivated();
}
}
}
}
Void PlaYUVerSubWinManager::addSubWindow( SubWindowHandle *window, Qt::WindowFlags flags )
{
if( m_bMdiModeEnabled )
{
m_apcMdiSubWindowList.append( m_pcMdiArea->addSubWindow( window ) );
}
m_apcSubWindowList.append( window );
}
Void PlaYUVerSubWinManager::removeSubWindow( Int windowIdx )
{
if( windowIdx >= 0 )
{
if( m_bMdiModeEnabled )
{
m_pcMdiArea->removeSubWindow( m_apcSubWindowList.at( windowIdx ) );
m_apcMdiSubWindowList.at( windowIdx )->close();
m_apcMdiSubWindowList.removeAt( windowIdx );
}
m_apcSubWindowList.removeAt( windowIdx );
}
}
Void PlaYUVerSubWinManager::removeSubWindow( SubWindowHandle* window )
{
removeSubWindow( m_apcSubWindowList.indexOf( window ) );
}
Void PlaYUVerSubWinManager::removeAllSubWindow()
{
while( m_apcSubWindowList.size() > 0)
{
removeSubWindow( 0 );
}
}
SubWindowHandle* PlaYUVerSubWinManager::activeSubWindow() const
{
return m_pcActiveWindow;
}
QList<SubWindowHandle*> PlaYUVerSubWinManager::findSubWindow( const QString &windowName ) const
{
QList<SubWindowHandle*> apcSubWindowList;
if( windowName.isEmpty() )
{
apcSubWindowList = m_apcSubWindowList;
}
else
{
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
{
if( m_apcSubWindowList.at( i )->getWindowName() == windowName )
apcSubWindowList.append( m_apcSubWindowList.at( i ) );
}
}
return apcSubWindowList;
}
QList<SubWindowHandle*> PlaYUVerSubWinManager::findSubWindow( const UInt uiCategory ) const
{
QList<SubWindowHandle*> apcSubWindowList;
QList<SubWindowHandle*> subWindowList = findSubWindow();
for( Int i = 0; i < subWindowList.size(); i++ )
{
if( subWindowList.at( i )->getCategory() == uiCategory )
apcSubWindowList.append( subWindowList.at( i ) );
}
return apcSubWindowList;
}
SubWindowHandle* PlaYUVerSubWinManager::findSubWindow( const SubWindowHandle* subWindow )
{
QList<SubWindowHandle*> subWindowList = findSubWindow();
for( Int i = 0; i < subWindowList.size(); i++ )
{
if( subWindow == subWindowList.at( i ) )
return subWindowList.at( i );
}
return 0;
}
Void PlaYUVerSubWinManager::setActiveSubWindow( QWidget *window )
{
if( !window )
return;
m_pcActiveWindow = qobject_cast<SubWindowHandle *>( window );
window->font();
}
Void PlaYUVerSubWinManager::tileSubWindows()
{
if( m_bMdiModeEnabled )
{
m_pcMdiArea->tileSubWindows();
}
}
Void PlaYUVerSubWinManager::cascadeSubWindows()
{
if( m_bMdiModeEnabled )
{
m_pcMdiArea->cascadeSubWindows();
}
}
} // NAMESPACE
+84
View File
@@ -0,0 +1,84 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file PlaYUVerSubWinManager.h
* \brief
*/
#ifndef __PLAYUVERSUBWINMANAGER_H__
#define __PLAYUVERSUBWINMANAGER_H__
#include "config.h"
#include "lib/PlaYUVerDefs.h"
#if( QT_VERSION_PLAYUVER == 5 )
#include <QtWidgets>
#elif( QT_VERSION_PLAYUVER == 4 )
#include <QtGui>
#endif
namespace plaYUVer
{
class SubWindowHandle;
class PlaYUVerSubWinManager : public QWidget
{
Q_OBJECT
private:
Bool m_bMdiModeEnabled;
QList<SubWindowHandle*> m_apcSubWindowList;
QList<QMdiSubWindow*> m_apcMdiSubWindowList;
QMdiArea* m_pcMdiArea;
SubWindowHandle* m_pcActiveWindow;
QPixmap m_pixmapLogo;
public:
PlaYUVerSubWinManager(QWidget *parent = 0);
Void addSubWindow(SubWindowHandle *widget, Qt::WindowFlags flags = 0);
Void removeSubWindow( Int windowIdx );
Void removeSubWindow( SubWindowHandle *window);
Void removeAllSubWindow();
SubWindowHandle *activeSubWindow() const;
QList<SubWindowHandle*> findSubWindow( const QString &aName = QString() ) const;
QList<SubWindowHandle*> findSubWindow( const UInt uiCategory ) const;
SubWindowHandle* findSubWindow( const SubWindowHandle* subWindow );
public Q_SLOTS:
void updateActiveSubWindow();
void setActiveSubWindow(QWidget *window);
void tileSubWindows();
void cascadeSubWindows();
Q_SIGNALS:
void windowActivated();
protected:
void paintEvent( QPaintEvent *event );
};
} // NAMESPACE
#endif // __PLAYUVERSUBWINMANAGER_H__
+9 -9
View File
@@ -23,6 +23,7 @@
*/
#include <QtGui>
#include "PlaYUVerSubWinManager.h"
#include "QualityHandle.h"
#include "VideoSubWindow.h"
#include "PlotSubWindow.h"
@@ -31,9 +32,9 @@
namespace plaYUVer
{
QualityHandle::QualityHandle( QWidget* parent, QMdiArea* mdiArea ) :
QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWinManager* windowManager ) :
m_pcParet( parent ),
m_pcMainWindowMdiArea( mdiArea )
m_pcMainWindowManager( windowManager )
{
}
@@ -82,7 +83,7 @@ QMenu* QualityHandle::createMenu()
QDockWidget* QualityHandle::createDock()
{
m_pcQualityHandleSideBar = new QualityMeasurementSidebar( m_pcParet, m_pcMainWindowMdiArea );
m_pcQualityHandleSideBar = new QualityMeasurementSidebar( m_pcParet, m_pcMainWindowManager );
m_pcQualityHandleDock = new QDockWidget( tr( "Quality Measurement" ), this );
m_pcQualityHandleDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
m_pcQualityHandleDock->setWidget( m_pcQualityHandleSideBar );
@@ -128,16 +129,16 @@ Void QualityHandle::slotQualityMetricChanged( Int idx )
Void QualityHandle::slotSelectReference()
{
DialogSubWindowSelector dialogWindowSelection( this, m_pcMainWindowMdiArea, 1, 1 );
DialogSubWindowSelector dialogWindowSelection( this, m_pcMainWindowManager, 1, 1 );
if( dialogWindowSelection.exec() == QDialog::Accepted )
{
VideoSubWindow* pcVideoSubWindow;
VideoSubWindow* pcRefSubWindow = NULL;
QStringList selectedWindows = dialogWindowSelection.getSelectedWindows();
QList<VideoSubWindow*> subWindowList = m_pcMainWindowMdiArea->findChildren<VideoSubWindow*>();
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = subWindowList.at( i );
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
if( pcVideoSubWindow->getWindowName() == selectedWindows.at( 0 ) )
{
pcRefSubWindow = pcVideoSubWindow;
@@ -146,7 +147,7 @@ Void QualityHandle::slotSelectReference()
}
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = subWindowList.at( i );
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
pcVideoSubWindow->setRefSubWindow( pcRefSubWindow );
}
m_pcQualityHandleSideBar->updateSidebarData();
@@ -157,11 +158,10 @@ Void QualityHandle::slotSelectReference()
Void QualityHandle::slotCreatePlot()
{
PlotSubWindow* pcPlotWindow = new PlotSubWindow( m_pcParet );
m_pcMainWindowMdiArea->addSubWindow( pcPlotWindow );
m_pcMainWindowManager->addSubWindow( pcPlotWindow );
pcPlotWindow->show();
}
} // NAMESPACE
+3 -2
View File
@@ -38,13 +38,14 @@
namespace plaYUVer
{
class PlaYUVerSubWinManager;
class VideoSubWindow;
class QualityHandle: public QWidget
{
Q_OBJECT
public:
QualityHandle( QWidget*, QMdiArea * );
QualityHandle( QWidget*, PlaYUVerSubWinManager * );
~QualityHandle();
Void createActions();
@@ -59,7 +60,7 @@ public:
private:
QWidget* m_pcParet;
QMdiArea* m_pcMainWindowMdiArea;
PlaYUVerSubWinManager* m_pcMainWindowManager;
enum
{
SELECT_REF_ACT,
+13 -15
View File
@@ -24,15 +24,16 @@
#include "lib/PlaYUVerDefs.h"
#include <QtGui>
#include "PlaYUVerSubWinManager.h"
#include "QualityMeasurementSidebar.h"
#include "VideoSubWindow.h"
namespace plaYUVer
{
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, QMdiArea *mdiArea ) :
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, PlaYUVerSubWinManager *windowManager ) :
QWidget( parent ),
m_pcMainWindowMdiArea( mdiArea ),
m_pcMainWindowManager( windowManager ),
m_pcCurrentVideoSubWindow( NULL )
{
@@ -119,28 +120,25 @@ QSize QualityMeasurementSidebar::sizeHint() const
Void QualityMeasurementSidebar::updateSubWindowList()
{
VideoSubWindow* pcVideoSubWindow;
QString currSubWindowName;
m_pcWindowListNames.clear();
m_pcVideoWindowList.clear();
QList<VideoSubWindow*> videoSubWindowList = m_pcMainWindowMdiArea->findChildren<VideoSubWindow*>();
for( Int i = 0; i < videoSubWindowList.size(); i++ )
VideoSubWindow* pcVideoSubWindow;
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = videoSubWindowList.at( i );
if( pcVideoSubWindow )
pcVideoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
if( m_pcCurrentVideoSubWindow )
{
if( m_pcCurrentVideoSubWindow )
if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt( pcVideoSubWindow->getCurrFrame() ) )
{
if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt( pcVideoSubWindow->getCurrFrame() ) )
{
continue;
}
continue;
}
currSubWindowName = pcVideoSubWindow->getWindowShortName();
m_pcWindowListNames.append( currSubWindowName );
m_pcVideoWindowList.append( pcVideoSubWindow );
}
currSubWindowName = pcVideoSubWindow->getWindowShortName();
m_pcWindowListNames.append( currSubWindowName );
m_pcVideoWindowList.append( pcVideoSubWindow );
}
m_comboBoxRef->clear();
m_comboBoxRef->insertItems( -1, m_pcWindowListNames );
+3 -2
View File
@@ -39,13 +39,14 @@
namespace plaYUVer
{
class PlaYUVerSubWinManager;
class VideoSubWindow;
class QualityMeasurementSidebar: public QWidget
{
Q_OBJECT
public:
QualityMeasurementSidebar( QWidget*, QMdiArea * );
QualityMeasurementSidebar( QWidget*, PlaYUVerSubWinManager * );
~QualityMeasurementSidebar();
QSize sizeHint() const;
@@ -56,7 +57,7 @@ public:
Void updateQualityMetric( Int );
private:
QMdiArea* m_pcMainWindowMdiArea;
PlaYUVerSubWinManager* m_pcMainWindowManager;
QVector<VideoSubWindow*> m_pcVideoWindowList;
QStringList m_pcWindowListNames;
+5 -3
View File
@@ -49,9 +49,11 @@ private:
public:
enum SubWindowCategories
{
VIDEO_SUBWINDOW = 0,
MODULE_SUBWINDOW,
PLOT_SUBWINDOW,
SUBWINDOW = 0,
VIDEO_SUBWINDOW = 1,
VIDEO_STREAM_SUBWINDOW = 2,
MODULE_SUBWINDOW = 4,
PLOT_SUBWINDOW = 8,
};
SubWindowHandle( QWidget *, UInt );
+11 -11
View File
@@ -24,15 +24,16 @@
#include "lib/PlaYUVerDefs.h"
#include <QtGui>
#include "PlaYUVerSubWinManager.h"
#include "VideoHandle.h"
#include "DialogSubWindowSelector.h"
namespace plaYUVer
{
VideoHandle::VideoHandle( QWidget* parent, QMdiArea* mdiArea ) :
VideoHandle::VideoHandle( QWidget* parent, PlaYUVerSubWinManager* windowManager ) :
m_pcParet( parent ),
m_pcMainWindowMdiArea( mdiArea )
m_pcMainWindowManager( windowManager )
{
m_pcCurrentVideoSubWindow = NULL;
m_bIsPlaying = false;
@@ -171,7 +172,7 @@ QWidget* VideoHandle::createStatusBarMessage()
Void VideoHandle::updateMenus()
{
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowMdiArea->activeSubWindow() );
VideoSubWindow* pcSubWindow = qobject_cast<VideoSubWindow *>( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcSubWindow ? true : false;
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
@@ -485,7 +486,7 @@ Void VideoHandle::seekSliderEvent( Int new_frame_num )
Void VideoHandle::videoSelectionButtonEvent()
{
DialogSubWindowSelector dialogWindowsSelection( this, m_pcMainWindowMdiArea );
DialogSubWindowSelector dialogWindowsSelection( this, m_pcMainWindowManager, SubWindowHandle::VIDEO_STREAM_SUBWINDOW );
QStringList cWindowListNames;
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
{
@@ -496,18 +497,17 @@ Void VideoHandle::videoSelectionButtonEvent()
{
QStringList selectedWindows = dialogWindowsSelection.getSelectedWindows();
m_acPlayingSubWindows.clear();
SubWindowHandle *subWindow;
VideoSubWindow *videoSubWindow;
QString windowName;
QList<VideoSubWindow*> subWindowList = m_pcMainWindowMdiArea->findChildren<VideoSubWindow*>();
QList<SubWindowHandle*> subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowHandle::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = subWindowList.at( i );
windowName = subWindow->getWindowName();
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
windowName = videoSubWindow->getWindowName();
if( selectedWindows.contains( windowName ) )
{
VideoSubWindow* pcVideoSubWinodw = qobject_cast<VideoSubWindow*>( subWindow );
m_acPlayingSubWindows.append( pcVideoSubWinodw );
pcVideoSubWinodw->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() );
m_acPlayingSubWindows.append( videoSubWindow );
videoSubWindow->seekAbsoluteEvent( m_acPlayingSubWindows.at( 0 )->getInputStream()->getCurrFrameNum() );
}
}
if( m_acPlayingSubWindows.size() > 0 )
+3 -2
View File
@@ -39,13 +39,14 @@
namespace plaYUVer
{
class PlaYUVerSubWinManager;
class VideoSubWindow;
class VideoHandle: public QWidget
{
Q_OBJECT
public:
VideoHandle( QWidget*, QMdiArea * );
VideoHandle( QWidget*, PlaYUVerSubWinManager * );
~VideoHandle();
Void createActions();
@@ -64,7 +65,7 @@ public:
private:
QWidget* m_pcParet;
QMdiArea* m_pcMainWindowMdiArea;
PlaYUVerSubWinManager* m_pcMainWindowManager;
enum
{
PLAY_ACT,
+95 -132
View File
@@ -27,9 +27,9 @@
#include "fvupdater.h"
#endif
#include "plaYUVerApp.h"
#include "PlaYUVerSubWinManager.h"
#include "DialogSubWindowSelector.h"
#define SYNCHRONISED_ZOON 1
namespace plaYUVer
@@ -45,17 +45,17 @@ plaYUVerApp::plaYUVerApp()
m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
#endif
mdiArea = new PlaYUVerMdiArea( this );
setCentralWidget( mdiArea );
m_pcWindowManager = new PlaYUVerSubWinManager( this );
setCentralWidget( m_pcWindowManager );
//mdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
mapperWindow = new QSignalMapper( this );
connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) );
connect( mapperWindow, SIGNAL( mapped(QWidget*) ), m_pcWindowManager, SLOT( setActiveSubWindow(QWidget*) ) );
m_appModuleVideo = new VideoHandle( this, mdiArea );
m_appModuleQuality = new QualityHandle( this, mdiArea );
m_appModuleVideo = new VideoHandle( this, m_pcWindowManager );
m_appModuleQuality = new QualityHandle( this, m_pcWindowManager );
m_appModuleExtensions = new ModulesHandle( this, mdiArea );
m_appModuleExtensions = new ModulesHandle( this, m_pcWindowManager );
createActions();
createToolBars();
@@ -71,10 +71,10 @@ plaYUVerApp::plaYUVerApp()
setUnifiedTitleAndToolBarOnMac( true );
setAcceptDrops( true );
mdiArea->setAcceptDrops( true );
//mdiArea->setAcceptDrops( true );
//mdiArea->hide();
connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( update() ) );
connect( m_pcWindowManager, SIGNAL( windowActivated() ), this, SLOT( update() ) );
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
@@ -92,7 +92,7 @@ Void plaYUVerApp::parseArgs( Int argc, Char *argv[] )
{
loadFile( argv[i] );
}
mdiArea->tileSubWindows();
m_pcWindowManager->tileSubWindows();
zoomToFitAll();
}
}
@@ -108,9 +108,9 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
{
Int mayCloseAll = true;
Int msgBoxCloseRet = QMessageBox::Yes;
SubWindowHandle *imageInterface;
if( mdiArea->subWindowList().size() >= 1 )
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow();
if( subWindowList.size() >= 1 )
{
QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!", QMessageBox::Yes | QMessageBox::No, this );
msgBoxClose.setDefaultButton( QMessageBox::No );
@@ -122,10 +122,10 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
case QMessageBox::Yes:
mayCloseAll = true;
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
for( Int i = 0; i < subWindowList.size(); i++ )
{
imageInterface = qobject_cast<SubWindowHandle *>( mdiArea->subWindowList().at( i ) );
mayCloseAll &= imageInterface->mayClose();
mayCloseAll &= subWindowList.at( i )->mayClose();
;
}
if( mayCloseAll )
@@ -150,12 +150,12 @@ Void plaYUVerApp::closeActiveWindow()
{
SubWindowHandle *currSubWindow = activeSubWindow();
m_appModuleVideo->closeSubWindow( qobject_cast<VideoSubWindow*>( currSubWindow ) );
mdiArea->closeActiveSubWindow();
m_pcWindowManager->removeSubWindow( currSubWindow );
}
Void plaYUVerApp::closeAll()
{
mdiArea->closeAllSubWindows();
m_pcWindowManager->removeAllSubWindow();
}
Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
@@ -165,10 +165,10 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
statusBar()->showMessage( "File " + fileName + " do not exist!", 2000 );
return;
}
VideoSubWindow *videoSubWindow = plaYUVerApp::findVideoSubWindow( mdiArea, fileName );
VideoSubWindow *videoSubWindow = plaYUVerApp::findVideoStreamSubWindow( m_pcWindowManager, fileName );
if( videoSubWindow )
{
//mdiArea->setActiveSubWindow( videoSubWindow );
m_pcWindowManager->setActiveSubWindow( videoSubWindow );
return;
}
videoSubWindow = new VideoSubWindow( this ); //createSubWindow();
@@ -191,19 +191,18 @@ Void plaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
if( opened )
{
statusBar()->showMessage( tr( "Loading file..." ) );
//mdiArea->addSubWindow( videoSubWindow );
videoSubWindow->setWindowFlags(Qt::Window);
m_pcWindowManager->addSubWindow( videoSubWindow );
videoSubWindow->show();
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( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( updateZoomFactorSBox() ) );
// connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( zoomToFactorAll( double, QPoint ) ) );
// connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), this, SLOT( zoomToFactorAll( double, QPoint ) ) );
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), this, SLOT( moveAllScrollBars( const QPoint ) ) );
videoSubWindow->zoomToFit();
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool ) m_uiViewTool );
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool )m_uiViewTool );
updateZoomFactorSBox();
addStreamInfoToRecentList( videoSubWindow->getStreamInfo() );
@@ -250,8 +249,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( ";;" ) );
@@ -297,8 +296,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( ";;" ) );
@@ -352,14 +351,14 @@ Void plaYUVerApp::reload()
Void plaYUVerApp::reloadAll()
{
VideoSubWindow *subWindow;
QList<VideoSubWindow*> videoSubWindowList = mdiArea->findChildren<VideoSubWindow*>();
for( Int i = 0; i < videoSubWindowList.size(); i++ )
VideoSubWindow *videoSubWindow;
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = videoSubWindowList.at( i );
if( !subWindow->getIsModule() )
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
if( !videoSubWindow->getIsModule() )
{
subWindow->reloadFile();
videoSubWindow->reloadFile();
}
}
m_pcCurrentSubWindow = NULL;
@@ -380,10 +379,12 @@ Void plaYUVerApp::setTool( Int idxTool )
{
m_uiViewTool = idxTool;
actionGroupTools->actions().at( m_uiViewTool )->setChecked( true );
QList<VideoSubWindow*> videoSubWindowList = mdiArea->findChildren<VideoSubWindow*>();
for( Int i = 0; i < videoSubWindowList.size(); i++ )
VideoSubWindow* videoSubWindow;
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindowList.at( i )->getViewArea()->setTool( ( ViewArea::eTool ) m_uiViewTool );
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
videoSubWindow->getViewArea()->setTool( ( ViewArea::eTool )m_uiViewTool );
}
}
@@ -409,11 +410,13 @@ Void plaYUVerApp::zoomToFit()
Void plaYUVerApp::zoomToFitAll()
{
SubWindowHandle *subWindow;
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
VideoSubWindow *videoSubWindow;
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = qobject_cast<SubWindowHandle *>( mdiArea->subWindowList().at( i ) );
subWindow->zoomToFit();
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
videoSubWindow->zoomToFit();
}
if( m_pcCurrentSubWindow )
updateZoomFactorSBox();
@@ -421,21 +424,24 @@ Void plaYUVerApp::zoomToFitAll()
Void plaYUVerApp::zoomToFactorAll( const double scale, const QPoint center )
{
double factor;
Double factor;
if( m_pcCurrentSubWindow )
factor = m_pcCurrentSubWindow->getScaleFactor();
SubWindowHandle *subWindow;
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = qobject_cast<SubWindowHandle *>( mdiArea->subWindowList().at( i ) );
subWindow = subWindowList.at( i );
if( m_pcCurrentSubWindow == subWindow )
continue;
else
{
subWindow->zoomToFactor( factor , center );
subWindow->zoomToFactor( factor, center );
}
}
}
Void plaYUVerApp::scaleFrame( int ratio )
@@ -449,14 +455,14 @@ Void plaYUVerApp::scaleFrame( int ratio )
Void plaYUVerApp::zoomFromSBox( double zoom )
{
Double factor = zoom/100;
Double factor = zoom / 100;
if( activeSubWindow() )
{
activeSubWindow()->zoomToFactor( factor );
}
}
Void plaYUVerApp::updateZoomFactorSBox( )
Void plaYUVerApp::updateZoomFactorSBox()
{
Double factor;
if( m_pcCurrentSubWindow )
@@ -468,17 +474,14 @@ Void plaYUVerApp::updateZoomFactorSBox( )
Void plaYUVerApp::moveAllScrollBars( const QPoint offset )
{
SubWindowHandle *subWindow;
for( Int i = 0; i < mdiArea->subWindowList().size(); i++ )
QList<SubWindowHandle*> subWindowList = m_pcWindowManager->findSubWindow( SubWindowHandle::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = qobject_cast<SubWindowHandle *>( mdiArea->subWindowList().at( i ) );
if( m_pcCurrentSubWindow == subWindow )
if( m_pcCurrentSubWindow == subWindowList.at( i ) )
continue;
else
subWindow->adjustScrollBarByOffset(offset);
subWindowList.at( i )->adjustScrollBarByOffset( offset );
}
}
// ----------------------- Drag and drop functions ----------------------
@@ -486,7 +489,7 @@ Void plaYUVerApp::moveAllScrollBars( const QPoint offset )
Void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
{
//setText(tr("<drop content>"));
mdiArea->setBackgroundRole( QPalette::Highlight );
//mdiArea->setBackgroundRole( QPalette::Highlight );
event->acceptProposedAction();
}
@@ -504,72 +507,34 @@ Void plaYUVerApp::dropEvent( QDropEvent *event )
// ----------------------- Sub Window Functions -----------------------
void plaYUVerApp::tileSubWindows()
{
mdiArea->tileSubWindows();
}
SubWindowHandle *plaYUVerApp::activeSubWindow()
{
if( QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow() )
return qobject_cast<SubWindowHandle *>( activeSubWindow->widget() );
return 0;
if( SubWindowHandle *activeSubWindow = m_pcWindowManager->activeSubWindow() )
return activeSubWindow;
return NULL;
}
template<typename T>
T plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const QString& name )
{
T subWindow;
QList<T> subWindowList = mdiArea->findChildren<T>();
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = subWindowList.at( i );
if( subWindow->getWindowName() == name )
return subWindow;
}
return 0;
}
template<typename T>
T plaYUVerApp::findSubWindow( const QMdiArea* mdiArea, const T subWindow )
{
QList<T> subWindowList = mdiArea->findChildren<T>();
for( Int i = 0; i < subWindowList.size(); i++ )
{
if( subWindow == subWindowList.at( i ) )
return subWindowList.at( i );
}
return 0;
}
VideoSubWindow* plaYUVerApp::findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName )
VideoSubWindow* plaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWinManager* windowManager, const QString& fileName )
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
VideoSubWindow* pcVideoSubWindow;
QList<VideoSubWindow*> videoSubWindowList = mdiArea->findChildren<VideoSubWindow*>();
for( Int i = 0; i < videoSubWindowList.size(); i++ )
VideoSubWindow* pcSubWindow;
QList<SubWindowHandle*> subWindowList = windowManager->findSubWindow( SubWindowHandle::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = videoSubWindowList.at( i );
if( pcVideoSubWindow->getCurrentFileName() == canonicalFilePath )
return pcVideoSubWindow;
pcSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
if( pcSubWindow->getCurrentFileName() == canonicalFilePath )
return qobject_cast<VideoSubWindow*>( pcSubWindow );
}
return 0;
}
Void plaYUVerApp::setActiveSubWindow( QWidget *window )
{
if( !window )
return;
mdiArea->setActiveSubWindow( qobject_cast<QMdiSubWindow *>( window ) );
}
// ----------------------- Update Functions -----------------------
Void plaYUVerApp::update()
{
SubWindowHandle *new_window = activeSubWindow();
QCoreApplication::processEvents();
//if( activeSubWindow() != m_pcCurrentSubWindow )
//if( activeSubWindow() != m_pcCurrentSubWindow )
{
m_pcCurrentSubWindow = NULL;
m_pcCurrentVideoSubWindow = NULL;
@@ -588,7 +553,7 @@ Void plaYUVerApp::update()
if( m_pcCurrentVideoSubWindow )
{
if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentVideoSubWindow->getRefSubWindow() ) )
if( !m_pcWindowManager->findSubWindow( m_pcCurrentVideoSubWindow->getRefSubWindow() ) )
{
m_pcCurrentVideoSubWindow->setRefSubWindow( NULL );
}
@@ -660,9 +625,9 @@ Void plaYUVerApp::updateWindowMenu()
updateMenus();
QList<QMdiSubWindow *> windows = mdiArea->subWindowList();
m_arrayActions[SEPARATOR_ACT]->setVisible( !windows.isEmpty() );
Int number_windows = windows.size();
QList<SubWindowHandle *> subWindowList = m_pcWindowManager->findSubWindow();
m_arrayActions[SEPARATOR_ACT]->setVisible( !subWindowList.isEmpty() );
Int number_windows = subWindowList.size();
if( number_windows > 1 )
{
@@ -677,7 +642,7 @@ Void plaYUVerApp::updateWindowMenu()
for( Int i = 0; i < number_windows; ++i )
{
SubWindowHandle *child = qobject_cast<SubWindowHandle *>( windows.at(i)->widget());
SubWindowHandle *child = subWindowList.at( i );
QString text;
if( i < 9 )
@@ -692,7 +657,7 @@ Void plaYUVerApp::updateWindowMenu()
action->setCheckable( true );
action->setChecked( child == activeSubWindow() );
connect( action, SIGNAL( triggered() ), mapperWindow, SLOT( map() ) );
mapperWindow->setMapping( action, windows.at( i ) );
mapperWindow->setMapping( action, subWindowList.at( i ) );
}
}
@@ -702,7 +667,7 @@ Void plaYUVerApp::createActions()
{
m_arrayActions.resize( TOTAL_ACT );
// ------------ File ------------
// ------------ File ------------
m_arrayActions[OPEN_ACT] = new QAction( QIcon( ":/images/open.png" ), tr( "&Open" ), this );
m_arrayActions[OPEN_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogOpenButton ) );
m_arrayActions[OPEN_ACT]->setShortcuts( QKeySequence::Open );
@@ -759,7 +724,7 @@ Void plaYUVerApp::createActions()
m_arrayActions[EXIT_ACT]->setStatusTip( tr( "Exit the application" ) );
connect( m_arrayActions[EXIT_ACT], SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ) );
// ------------ View ------------
// ------------ View ------------
mapperZoom = new QSignalMapper( this );
connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) );
@@ -789,11 +754,11 @@ Void plaYUVerApp::createActions()
connect( m_arrayActions[ZOOM_FIT_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFit() ) );
m_arrayActions[ZOOM_FIT_ALL_ACT] = new QAction( tr( "Zoom to Fit All" ), this );
//m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
//m_arrayActions[ZOOM_FIT_ALL_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
m_arrayActions[ZOOM_FIT_ALL_ACT]->setStatusTip( tr( "Apply zoom to fit to all windows" ) );
connect( m_arrayActions[ZOOM_FIT_ALL_ACT], SIGNAL( triggered() ), this, SLOT( zoomToFitAll() ) );
// ------------ Tools ------------
// ------------ Tools ------------
actionGroupTools = new QActionGroup( this );
actionGroupTools->setExclusive( true );
@@ -820,35 +785,35 @@ Void plaYUVerApp::createActions()
m_appModuleQuality->createActions();
m_appModuleExtensions->createActions();
// ------------ Window ------------
// ------------ Window ------------
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() ), this, SLOT( tileSubWindows() ) );
//connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( tileSubWindows() ) );
connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), m_pcWindowManager, SLOT( tileSubWindows() ) );
m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this );
m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) );
m_arrayActions[CASCADE_WINDOWS_ACT]->setStatusTip( tr( "Cascade the windows" ) );
connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( cascadeSubWindows() ) );
connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), m_pcWindowManager, SLOT( cascadeSubWindows() ) );
m_arrayActions[NEXT_WINDOWS_ACT] = new QAction( tr( "Ne&xt" ), this );
m_arrayActions[NEXT_WINDOWS_ACT]->setShortcuts( QKeySequence::NextChild );
m_arrayActions[NEXT_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
m_arrayActions[NEXT_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the next window" ) );
connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( activateNextSubWindow() ) );
// connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), m_pcWindowManager, SLOT( activateNextSubWindow() ) );
m_arrayActions[PREVIOUS_WINDOWS_ACT] = new QAction( tr( "Pre&vious" ), this );
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setShortcuts( QKeySequence::PreviousChild );
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the previous window" ) );
connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea, SLOT( activatePreviousSubWindow() ) );
// connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ), m_pcWindowManager, SLOT( activatePreviousSubWindow() ) );
m_arrayActions[SEPARATOR_ACT] = new QAction( this );
m_arrayActions[SEPARATOR_ACT]->setSeparator( true );
// ------------ About ------------
// ------------ About ------------
#ifdef USE_FERVOR
m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this );
@@ -900,8 +865,8 @@ Void plaYUVerApp::createMenus()
m_arrayMenu[VIEW_MENU]->addSeparator();
// createPopupMenu() Returns a popup menu containing checkable entries for
// the toolbars and dock widgets present in the main window.
// createPopupMenu() Returns a popup menu containing checkable entries for
// the toolbars and dock widgets present in the main window.
m_arrayMenu[DOCK_VIEW_MENU] = createPopupMenu();
if( m_arrayMenu[DOCK_VIEW_MENU] )
{
@@ -909,9 +874,9 @@ Void plaYUVerApp::createMenus()
actionPopupMenu->setText( tr( "&Toolbars/Docks" ) );
}
// m_arrayMenu[TOOLS_MENU] = menuBar()->addMenu( tr( "Tools" ) );
// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] );
// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[SELECTION_TOOL_ACT] );
// m_arrayMenu[TOOLS_MENU] = menuBar()->addMenu( tr( "Tools" ) );
// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] );
// m_arrayMenu[TOOLS_MENU]->addAction( m_arrayActions[SELECTION_TOOL_ACT] );
QMenu* VideoMenu = m_appModuleVideo->createMenu();
menuBar()->addMenu( VideoMenu );
@@ -919,7 +884,7 @@ Void plaYUVerApp::createMenus()
menuBar()->addMenu( QualityMenu );
QMenu* ModuleMenu = m_appModuleExtensions->createMenu();
menuBar()->addMenu( ModuleMenu );
//connect( ModuleMenu, SIGNAL( triggered(QAction *) ), this, SLOT( ModuleHandling(QAction *) ) );
//connect( ModuleMenu, SIGNAL( triggered(QAction *) ), this, SLOT( ModuleHandling(QAction *) ) );
m_arrayMenu[WINDOW_MENU] = menuBar()->addMenu( tr( "&Window" ) );
updateWindowMenu();
@@ -973,7 +938,7 @@ Void plaYUVerApp::createToolBars()
Void plaYUVerApp::createDockWidgets()
{
// Properties Dock Window
// Properties Dock Window
m_arraySideBars.resize( TOTAL_DOCK );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() );
@@ -981,13 +946,11 @@ Void plaYUVerApp::createDockWidgets()
Void plaYUVerApp::createStatusBar()
{
//! Warning: the following widget cannot change size too much
//! Warning: the following widget cannot change size too much
statusBar()->addPermanentWidget( m_appModuleVideo->createStatusBarMessage() );
statusBar()->showMessage( tr( "Ready" ) );
}
Void plaYUVerApp::addStreamInfoToRecentList( PlaYUVerStreamInfo streamInfo )
{
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, streamInfo.m_cFilename );
@@ -1034,7 +997,7 @@ Void plaYUVerApp::readSettings()
m_cLastOpenPath = appSettings.value( "MainWindow/LastOpenPath", QDir::homePath() ).toString();
m_uiViewTool = appSettings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toUInt();
setTool( ( ViewArea::eTool ) m_uiViewTool );
setTool( ( ViewArea::eTool )m_uiViewTool );
QVariant value = appSettings.value( "MainWindow/RecentFileList" );
m_aRecentFileStreamInfo = value.value<PlaYUVerStreamInfoVector>();
+3 -37
View File
@@ -47,6 +47,7 @@ namespace plaYUVer
{
class PlaYUVerStream;
class PlaYUVerSubWinManager;
class PlaYUVerAppAdaptor;
class plaYUVerApp: public QMainWindow
@@ -95,10 +96,6 @@ private Q_SLOTS:
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
void tileSubWindows();
void setActiveSubWindow( QWidget *window );
void update();
void updateWindowMenu();
void updateZoomFactorSBox();
@@ -108,34 +105,8 @@ private Q_SLOTS:
private:
class PlaYUVerMdiArea: public QMdiArea
{
public:
PlaYUVerMdiArea( QWidget *parent = 0 ) :
QMdiArea( parent ),
m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
{
}
protected:
void paintEvent( QPaintEvent *event )
{
QMdiArea::paintEvent( event );
QPainter painter( viewport() );
QSize logoSize = 2 * size() / 3;
QPixmap pixFinalLogo = m_pixmapLogo.scaled( logoSize, Qt::KeepAspectRatio );
// Calculate the logo position - the bottom right corner of the mdi area.
int x = width() / 2 - pixFinalLogo.width() / 2;
int y = height() / 2 - pixFinalLogo.height() / 2;
painter.drawPixmap( x, y, pixFinalLogo );
}
private:
QPixmap m_pixmapLogo;
};
PlaYUVerAppAdaptor* m_pDBusAdaptor;
PlaYUVerMdiArea *mdiArea;
PlaYUVerSubWinManager* m_pcWindowManager;
/**
* Save the current subwindow for every category
@@ -146,11 +117,7 @@ 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 );
static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWinManager* windowManager, const QString& fileName );
Void updateMenus();
@@ -166,7 +133,6 @@ private:
Void readSettings();
Void writeSettings();
QDoubleSpinBox *m_pcZoomFactorSBox;
QSignalMapper *mapperZoom;