Add tools menu with 2 options: Navigation and Selection Tools.

This commit is contained in:
Luis Lucas
2014-04-12 23:42:25 +01:00
parent 02b2bfac43
commit 5f3ab1306d
5 changed files with 73 additions and 18 deletions
+5
View File
@@ -154,6 +154,11 @@ typedef struct __pixel_definition
};
}Pixel;
enum eTool
{
NavigationTool, NormalSelectionTool, BlockSelectionTool, MaskTool, EraserTool
};
} // NAMESPACE
#endif // __TYPEDEF_H__
+1 -2
View File
@@ -165,7 +165,7 @@ void ViewArea::setMaskColor( const QColor &color )
update();
}
void ViewArea::setTool( Tool tool )
void ViewArea::setTool( eTool tool )
{
m_tool = tool;
}
@@ -874,5 +874,4 @@ InputStream* ViewArea::getInputStream()
return m_pStream;
}
} // NameSpace plaYUVer
+3 -8
View File
@@ -53,16 +53,10 @@ public:
NormalMode, MaskMode,
};
enum Tool
{
NavigationTool, NormalSelectionTool, BlockSelectionTool, MaskTool, EraserTool
};
ViewArea( QWidget *parent = 0 );
void setImage( const QPixmap &pixmap );
void setMode( ViewMode mode );
void setTool( Tool tool );
void setMaskColor( const QColor &color = QColor() );
/**
@@ -94,7 +88,7 @@ public:
{
return m_mode;
}
Tool tool() const
enum eTool tool() const
{
return m_tool;
}
@@ -108,6 +102,7 @@ public:
Void zoomChangeEvent(Double factor, QPoint center);
Double getZoomFactor();
void setTool( enum eTool tool );
// QSize sizeHint() const;
@@ -158,7 +153,7 @@ private:
QPoint m_lastWindowPos;
GridManager m_grid;
ViewMode m_mode;
Tool m_tool;
enum eTool m_tool;
QColor m_maskColor;
double m_zoomFactor;
int m_xOffset;
+50 -4
View File
@@ -161,6 +161,7 @@ void plaYUVerApp::open()
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
}
else
{
@@ -557,13 +558,33 @@ QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName )
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
if( mdiChild->currentFile() == canonicalFilePath )
return window;
}
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
if( mdiChild->currentFile() == canonicalFilePath )
return window;
}
return 0;
}
void plaYUVerApp::setNavigationTool( )
{
m_appTool = NavigationTool;
setAllSubWindowTool( );
}
void plaYUVerApp::setSelectionTool( )
{
m_appTool = NormalSelectionTool;
setAllSubWindowTool( );
}
void plaYUVerApp::setAllSubWindowTool( )
{
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
mdiChild->getViewArea()->setTool( m_appTool );
}
}
void plaYUVerApp::setActiveSubWindow( QWidget *window )
{
if( !window )
@@ -599,6 +620,9 @@ Void plaYUVerApp::updateMenus()
m_pcFrameSlider->setValue( 0 );
}
actionNavigationTool->setEnabled( hasSubWindow );
actionSelectionTool->setEnabled( hasSubWindow );
m_pcModulesHandle->updateMenus( hasSubWindow );
}
@@ -763,6 +787,24 @@ Void plaYUVerApp::createActions()
m_pcFrameSlider->setEnabled( false );
connect( m_pcFrameSlider, SIGNAL( sliderMoved(int) ), this, SLOT( seekSliderEvent(int) ) );
// ------------ Tools ------------
actionGroupTools = new QActionGroup( this );
actionGroupTools->setExclusive(true);
m_appTool = NavigationTool;
actionNavigationTool = new QAction( tr( "&Navigation Tool" ), this );
actionNavigationTool->setCheckable( true );
actionNavigationTool->setChecked( true );
actionGroupTools->addAction( actionNavigationTool );
connect( actionNavigationTool, SIGNAL( triggered() ), this, SLOT( setNavigationTool() ) );
actionSelectionTool = new QAction( "&Selection Tool", this );
actionSelectionTool->setCheckable( true );
actionSelectionTool->setChecked( false );
actionGroupTools->addAction( actionSelectionTool );
connect( actionSelectionTool, SIGNAL( triggered() ), this, SLOT( setSelectionTool() ) );
// ------------ Window ------------
actionTile = new QAction( tr( "&Tile" ), this );
@@ -839,6 +881,10 @@ Void plaYUVerApp::createMenus()
QMenu* modules_menu = m_pcModulesHandle->createMenus( menuBar() );
connect( modules_menu, SIGNAL( triggered(QAction *) ), this, SLOT( selectModule(QAction *) ) );
m_arrayMenu[TOOLS_MENU] = menuBar()->addMenu( tr( "Tools" ) );
m_arrayMenu[TOOLS_MENU]->addAction( actionNavigationTool );
m_arrayMenu[TOOLS_MENU]->addAction( actionSelectionTool );
m_arrayMenu[WINDOW_MENU] = menuBar()->addMenu( tr( "&Window" ) );
updateWindowMenu();
connect( m_arrayMenu[WINDOW_MENU], SIGNAL( aboutToShow() ), this, SLOT( updateWindowMenu() ) );
+14 -4
View File
@@ -98,6 +98,10 @@ private Q_SLOTS:
void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream);
void setAllSubWindowTool( );
void setNavigationTool( );
void setSelectionTool( );
private:
QMdiArea *mdiArea;
SubWindowHandle *m_pcCurrentSubWindow;
@@ -138,16 +142,16 @@ private:
/**
* Array of menus for the main app
* @param position description:
* 0 - Window
* 1 - File
* 2 - View
* 3 - Help
* 0 - File
* 1 - View
* 2 - ...
*/
enum MAIN_APP_MENU_LIST
{
FILE_MENU = 0,
VIEW_MENU,
VIDEO_MENU,
TOOLS_MENU,
WINDOW_MENU,
ABOUT_MENU,
TOTAL_MENUS,
@@ -213,6 +217,12 @@ private:
QAction *actionAbout;
QAction *actionAboutQt;
// Tools Actions;
QActionGroup *actionGroupTools;
QAction *actionNavigationTool;
QAction *actionSelectionTool;
enum eTool m_appTool;
};
} // NAMESPACE