diff --git a/source/plaYUVerApp.cpp b/source/plaYUVerApp.cpp
index 15118ab..ba4feac 100644
--- a/source/plaYUVerApp.cpp
+++ b/source/plaYUVerApp.cpp
@@ -46,7 +46,7 @@ plaYUVerApp::plaYUVerApp()
//mdiArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
//mdiArea->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
- connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( updateMenus() ) );
+ connect( mdiArea, SIGNAL( subWindowActivated(QMdiSubWindow*) ), this, SLOT( chageSubWindowSelection() ) );
mapperWindow = new QSignalMapper( this );
connect( mapperWindow, SIGNAL( mapped(QWidget*) ), this, SLOT( setActiveSubWindow(QWidget*) ) );
@@ -187,7 +187,7 @@ void plaYUVerApp::scaleFrame( int ratio )
{
if( activeSubWindow() )
{
- activeSubWindow()->scaleView( (Double)(ratio)/100.0 );
+ activeSubWindow()->scaleView( ( Double )( ratio ) / 100.0 );
actionZoomIn->setEnabled( activeSubWindow()->getScaleFactor() < 3.0 );
actionZoomOut->setEnabled( activeSubWindow()->getScaleFactor() > 0.333 );
@@ -201,7 +201,13 @@ void plaYUVerApp::about()
QMessageBox::about( this, tr( "About plaYUVerApp" ), tr( "The plaYUVerApp is an open-source raw video player " ) );
}
-void plaYUVerApp::updateMenus()
+void plaYUVerApp::chageSubWindowSelection()
+{
+ updateMenus();
+ //updateWindowMenu();
+}
+
+Void plaYUVerApp::updateMenus()
{
Bool hasSubWindow = ( activeSubWindow() != 0 );
actionSave->setEnabled( hasSubWindow );
@@ -209,8 +215,6 @@ void plaYUVerApp::updateMenus()
actionCloseAll->setEnabled( hasSubWindow );
actionTile->setEnabled( hasSubWindow );
actionCascade->setEnabled( hasSubWindow );
- actionNext->setEnabled( hasSubWindow );
- actionPrevious->setEnabled( hasSubWindow );
actionSeparator->setVisible( hasSubWindow );
actionZoomIn->setEnabled( hasSubWindow );
@@ -227,13 +231,35 @@ void plaYUVerApp::updateMenus()
void plaYUVerApp::updateWindowMenu()
{
+ menuWindow->clear();
+ menuWindow->addAction( actionClose );
+ menuWindow->addAction( actionCloseAll );
+ menuWindow->addSeparator();
+ menuWindow->addAction( actionTile );
+ menuWindow->addAction( actionCascade );
+ menuWindow->addSeparator();
+ menuWindow->addAction( actionNext );
+ menuWindow->addAction( actionPrevious );
+ menuWindow->addAction( actionSeparator );
- updateMenus();
+ //updateMenus();
QList windows = mdiArea->subWindowList();
actionSeparator->setVisible( !windows.isEmpty() );
+ Int number_windows = windows.size();
- for( Int i = 0; i < windows.size(); ++i )
+ if( number_windows > 1 )
+ {
+ actionNext->setEnabled( true );
+ actionPrevious->setEnabled( true );
+ }
+ else
+ {
+ actionNext->setEnabled( false );
+ actionPrevious->setEnabled( false );
+ }
+
+ for( Int i = 0; i < number_windows; ++i )
{
SubWindowHandle *child = qobject_cast( windows.at( i ) );
@@ -308,15 +334,15 @@ Void plaYUVerApp::createActions()
actionZoomIn->setIcon( QIcon( ":/images/zoomin.png" ) );
actionZoomIn->setShortcut( tr( "Ctrl++" ) );
actionZoomIn->setStatusTip( tr( "Scale the image up by 25%" ) );
- connect (actionZoomIn, SIGNAL(triggered()), mapperZoom, SLOT(map())) ;
- mapperZoom->setMapping(actionZoomIn, 125 );
+ connect( actionZoomIn, SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
+ mapperZoom->setMapping( actionZoomIn, 125 );
actionZoomOut = new QAction( tr( "Zoom &Out (25%)" ), this );
actionZoomOut->setIcon( QIcon( ":/images/zoomout.png" ) );
actionZoomOut->setShortcut( tr( "Ctrl+-" ) );
actionZoomOut->setStatusTip( tr( "Scale the image down by 25%" ) );
- connect (actionZoomOut, SIGNAL(triggered()), mapperZoom, SLOT(map())) ;
- mapperZoom->setMapping(actionZoomOut, 80 );
+ connect( actionZoomOut, SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
+ mapperZoom->setMapping( actionZoomOut, 80 );
actionNormalSize = new QAction( tr( "&Normal Size" ), this );
actionNormalSize->setIcon( QIcon( ":/images/zoomtonormal.png" ) );
@@ -410,16 +436,6 @@ Void plaYUVerApp::createMenus()
menuView->addAction( actionZoomToFit );
menuWindow = menuBar()->addMenu( tr( "&Window" ) );
- menuWindow->clear();
- menuWindow->addAction( actionClose );
- menuWindow->addAction( actionCloseAll );
- menuWindow->addSeparator();
- menuWindow->addAction( actionTile );
- menuWindow->addAction( actionCascade );
- menuWindow->addSeparator();
- menuWindow->addAction( actionNext );
- menuWindow->addAction( actionPrevious );
- menuWindow->addAction( actionSeparator );
updateWindowMenu();
connect( menuWindow, SIGNAL( aboutToShow() ), this, SLOT( updateWindowMenu() ) );
diff --git a/source/plaYUVerApp.h b/source/plaYUVerApp.h
index 4885768..14d737e 100644
--- a/source/plaYUVerApp.h
+++ b/source/plaYUVerApp.h
@@ -64,8 +64,8 @@ private slots:
/**
* 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%
+ * @param factor factor of scale. Ex: 120 scale the image up by 20% and
+ * 80 scale the image down by 25%
*/
void scaleFrame( int ratio = 100 );
@@ -74,7 +74,9 @@ private slots:
//! Show a message box with some information about the plaYUVerApp App
void about();
- void updateMenus();
+
+
+ void chageSubWindowSelection();
void updateWindowMenu();
@@ -84,8 +86,6 @@ private slots:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
- SubWindowHandle *createSubWindow();
- void addSubWindow( SubWindowHandle *child );
void setActiveSubWindow( QWidget *window );
private:
@@ -94,12 +94,18 @@ private:
QString m_cLastOpenPath;
QTimer *playingTimer;
+ Void updateMenus();
+
Void createActions();
Void createMenus();
Void createToolBars();
Void createStatusBar();
+
Void readSettings();
Void writeSettings();
+
+ Void addSubWindow( SubWindowHandle *child );
+ SubWindowHandle *createSubWindow();
SubWindowHandle *activeSubWindow();
QMdiSubWindow *findSubWindow( const QString &fileName );