diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 65ba8ea..d469663 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -29,6 +29,7 @@ #include "ModulesListMacro.h" #include "DialogSubWindowSelector.h" #include "SubWindowHandle.h" +#include "VideoSubWindow.h" namespace plaYUVer { @@ -80,7 +81,7 @@ SubWindowHandle* ModulesHandle::processModuleHandlingOpt() } else { - SubWindowHandle* pcSubWindow = qobject_cast( m_pcMdiArea->activeSubWindow() ); + VideoSubWindow* pcSubWindow = qobject_cast( m_pcMdiArea->activeSubWindow() ); switch( m_iOptionSelected ) { case INVALID_OPT: diff --git a/app/PlaYUVerAppModuleIf.h b/app/PlaYUVerAppModuleIf.h index bf60d2e..5873b49 100644 --- a/app/PlaYUVerAppModuleIf.h +++ b/app/PlaYUVerAppModuleIf.h @@ -40,6 +40,7 @@ namespace plaYUVer { class SubWindowHandle; +class VideoSubWindow; class PlaYUVerAppModuleIf #ifdef PLAYUVER_THREADED_MODULES @@ -56,7 +57,7 @@ private: PlaYUVerModuleIf* m_pcModule; QAction* m_pcAction; - SubWindowHandle* m_pcSubWindow[MAX_NUMBER_FRAMES]; + VideoSubWindow* m_pcSubWindow[MAX_NUMBER_FRAMES]; SubWindowHandle* m_pcDisplaySubWindow; @@ -85,20 +86,6 @@ public: PlaYUVerAppModuleIf(); virtual ~PlaYUVerAppModuleIf() {} - -// virtual Void create() {} -// virtual Void create( PlaYUVerFrame* ) {} -// -// virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; } -// virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } -// virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; } -// -// virtual Double measure( PlaYUVerFrame* ) { return 0; } -// virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } -// virtual Double measure( PlaYUVerFrame*, PlaYUVerFrame*, PlaYUVerFrame* ) { return 0; } -// -// virtual Void destroy() { } - protected: virtual void run(); }; diff --git a/app/Settings.h b/app/Settings.h index be42efd..117f32c 100644 --- a/app/Settings.h +++ b/app/Settings.h @@ -29,7 +29,7 @@ #include "lib/PlaYUVerDefs.h" #include #include "GridManager.h" -#include "SubWindowHandle.h" +#include "VideoSubWindow.h" namespace plaYUVer { diff --git a/app/SubWindowHandle.cpp b/app/SubWindowHandle.cpp index fb0508b..e613af8 100644 --- a/app/SubWindowHandle.cpp +++ b/app/SubWindowHandle.cpp @@ -28,14 +28,23 @@ namespace plaYUVer { SubWindowHandle::SubWindowHandle( QWidget * parent, UInt category ) : - QMdiSubWindow( parent ), - m_uiCategory( category ) + QMdiSubWindow( parent ) { - + m_uiCategory = category; } SubWindowHandle::~SubWindowHandle() { } +QString SubWindowHandle::getWindowName() +{ + return QString(); +} + +Bool SubWindowHandle::mayClose() +{ + return true; +} + } // NAMESPACE diff --git a/app/SubWindowHandle.h b/app/SubWindowHandle.h index ea2179a..305c917 100644 --- a/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -51,8 +51,44 @@ public: MODULE_SUBWINDOW, PLOT_SUBWINDOW, } - SubWindowHandle( QWidget * parent, UInt category ); + SubWindowHandle( QWidget *, UInt ); ~SubWindowHandle(); + + /** + * Show the image at its original size + */ + virtual Void normalSize() {}; + /** + * Scale the image (zoomed in or out) to fit on the window. + */ + virtual Void zoomToFit() {}; + /** + * Scale the image by a given factor + * @param factor factor of scale. Ex: 1.2 scale the image up by 20% and + * 0.8 scale the image down by 25% + */ + virtual Void scaleView( Double scale ) {}; + + /** + * The current image size is scaled to a rectangle as large as possible + * inside (@p width, @p height ) preserving the aspect ratio. + */ + virtual Void scaleView( Int width, Int height ) {}; + + /** + * This is an overloaded member function, provided for convenience. + * Scales the image to a rectangle with the given size, preserving the + * aspect ratio. + */ + Void scaleView( const QSize & size ) {}; + + virtual QString getWindowName(); + virtual Bool mayClose(); + + UInt getCategory() + { + return m_uiCategory; + } }; } // NAMESPACE diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 955eab3..24d44b3 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -516,11 +516,6 @@ QSize VideoSubWindow::sizeHint() const return maxSize; } -Bool VideoSubWindow::mayClose() -{ - return true; -} - void VideoSubWindow::closeEvent( QCloseEvent *event ) { Bool bAccept = mayClose(); diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h index e1c804c..f39af96 100644 --- a/app/VideoSubWindow.h +++ b/app/VideoSubWindow.h @@ -49,11 +49,11 @@ typedef struct UInt m_uiHeight; Int m_iPelFormat; UInt m_uiFrameRate; -}PlaYUVerStreamInfo; +} PlaYUVerStreamInfo; typedef QVector PlaYUVerStreamInfoVector; -QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); -QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); +QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& d ); +QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& d ); Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ); class VideoSubWindow: public SubWindowHandle @@ -90,7 +90,6 @@ public: VideoSubWindow( QWidget * parent = 0, Bool isModule = false ); ~VideoSubWindow(); - Bool mayClose(); Bool loadFile( QString cFilename, Bool bForceDialog = false ); Bool loadFile( PlaYUVerStreamInfo* streamInfo ); Void reloadFile(); @@ -167,31 +166,12 @@ public: Void applyModuleAllFrames(); /** - * Show the image at its original size + * Reimplemented function from SubWindowHandle */ Void normalSize(); - /** - * Scale the image (zoomed in or out) to fit on the window. - */ Void zoomToFit(); - /** - * Scale the image by a given factor - * @param factor factor of scale. Ex: 1.2 scale the image up by 20% and - * 0.8 scale the image down by 25% - */ Void scaleView( Double scale ); - - /** - * The current image size is scaled to a rectangle as large as possible - * inside (@p width, @p height ) preserving the aspect ratio. - */ Void scaleView( Int width, Int height ); - - /** - * This is an overloaded member function, provided for convenience. - * Scales the image to a rectangle with the given size, preserving the - * aspect ratio. - */ Void scaleView( const QSize & size ); Void scaleViewByRatio( Double ratio ); @@ -237,8 +217,8 @@ public Q_SLOTS: } // NAMESPACE -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo); -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector); +Q_DECLARE_METATYPE( plaYUVer::PlaYUVerStreamInfo ); +Q_DECLARE_METATYPE( plaYUVer::PlaYUVerStreamInfoVector ); #endif // __VIDEOSUBWINDOW_H__ diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 7e1049a..a651fc6 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -309,15 +309,16 @@ Void plaYUVerApp::save() Void plaYUVerApp::format() { - if( m_pcCurrentSubWindow ) + if( m_pcCurrentSubWindow->getCategory() == SubWindowHandle::VIDEO_SUBWINDOW ) { + VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcCurrentSubWindow ); try { - m_pcCurrentSubWindow->loadFile( m_pcCurrentSubWindow->getCurrentFileName(), true ); + pcVideoSubWindow->loadFile( pcVideoSubWindow->getCurrentFileName(), true ); } catch( const char *msg ) { - QString warningMsg = "Cannot change format of " + QFileInfo( m_pcCurrentSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + msg; QMessageBox::warning( this, QApplication::applicationName(), warningMsg ); statusBar()->showMessage( warningMsg, 2000 ); @@ -331,9 +332,10 @@ Void plaYUVerApp::format() Void plaYUVerApp::reload() { - if( m_pcCurrentSubWindow ) + if( m_pcCurrentSubWindow->getCategory() == SubWindowHandle::VIDEO_SUBWINDOW ) { - m_pcCurrentSubWindow->reloadFile(); + VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcCurrentSubWindow ); + pcVideoSubWindow->reloadFile(); m_pcCurrentSubWindow = NULL; chageSubWindowSelection(); } @@ -901,7 +903,10 @@ Void plaYUVerApp::chageSubWindowSelection() if( activeSubWindow() ) { m_pcCurrentSubWindow = new_window; + setWindowTitle( QApplication::applicationName() + " - " + m_pcCurrentSubWindow->getWindowName() ); + + if( ) if( !plaYUVerApp::findSubWindow( mdiArea, m_pcCurrentSubWindow->getRefSubWindow() ) ) { m_pcCurrentSubWindow->setRefSubWindow( NULL ); diff --git a/app/plaYUVerApp.h b/app/plaYUVerApp.h index 4ce75d3..ea59330 100644 --- a/app/plaYUVerApp.h +++ b/app/plaYUVerApp.h @@ -193,7 +193,7 @@ private: static VideoSubWindow* findVideoSubWindow( const QMdiArea* mdiArea, const QString& fileName ); static SubWindowHandle* findSubWindow( const QMdiArea* mdiArea, const SubWindowHandle* subWindow ); - QVector m_acPlayingSubWindows; + QVector m_acPlayingSubWindows; QSlider *m_pcFrameSlider; WidgetFrameNumber* m_pcFrameNumInfo;