Merge branch 'master' into dev_properties_side_bar

This commit is contained in:
jfmcarreira committed 2014-04-13 13:08:03 +01:00
commit ef6d3ece54
10 files changed
+151 -64

No files matched your search

+4 -4
View File
@@ -100,11 +100,11 @@ IF( NOT USE_QT4)
QT5_USE_MODULES( ${PROJECT_NAME} ${CURR_QT_MODULES} )
ENDIF()
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin )
INSTALL(FILES resources/playuver.desktop DESTINATION share/applications )
INSTALL(FILES resources/playuver.png DESTINATION share/icons )
INCLUDE(cmake/Install.cmake)
######################################################################################
# Final information dump
######################################################################################
status("Configuration:")
status(" Build type:" ${CMAKE_BUILD_TYPE} )
status(" Warnings as errors:" USE_WERROR THEN YES ELSE NO)
+27
View File
@@ -0,0 +1,27 @@
######################################################################################
# Install
######################################################################################
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin )
INSTALL(FILES resources/playuver.desktop DESTINATION share/applications )
INSTALL(FILES resources/playuver.png DESTINATION share/icons )
INSTALL(FILES resources/x-raw.xml DESTINATION share/mime/video )
# # try to set up the menu system
# find_program(XDG-MIME_EXECUTABLE xdg-mime)
# # find_program(XDG-DESKTOP-MENU_EXECUTABLE xdg-desktop-menu)
# INSTALL(CODE "execute_process(COMMAND ${XDG-MIME_EXECUTABLE} install --novendor resources/)" )
######################################################################################
# Create deb package
######################################################################################
SET(CPACK_GENERATOR "DEB")
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt4-core,libqt4-gui,libavformat53,libcodec53,libavutil51")
SET(CPACK_PACKAGE_DESCRIPTION "plaYUVer is an open-source QT based raw video player")
SET(CPACK_PACKAGE_CONTACT "Joao Carreira (jfmcarreira@gmail.com)")
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/Debian/postinst")
INCLUDE(CPack)
+1 -1
View File
@@ -5,6 +5,6 @@ Name=plaYUVer
Exec=playuver
Icon=playuver.png
Terminal=false
#MimeType=text/x-pgf
MimeType=video/x-raw
Categories=AudioVideo;Video;Player;
GenericName=raw video player
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<mime-type xmlns="http://www.freedesktop.org/standards/shared-mime-info" type="video/x-raw">
<comment>Raw YUV file</comment>
<icon name="video-x-generic"/>
<glob-deleteall/>
<glob pattern="*.yuv"/>
</mime-type>
+5
View File
@@ -146,6 +146,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;
+1 -2
View File
@@ -31,8 +31,7 @@ int main( int argc, char *argv[] )
{
QApplication a( argc, argv );
plaYUVerApp w;
w.show();
w.parseArgs( argc, argv );
return a.exec();
}
+86 -43
View File
@@ -82,6 +82,14 @@ plaYUVerApp::plaYUVerApp()
m_pcCurrentSubWindow = NULL;
}
Void plaYUVerApp::parseArgs( Int argc, Char *argv[] )
{
if( argc == 2 )
{
loadFile( argv[1] );
}
}
Void plaYUVerApp::closeEvent( QCloseEvent *event )
{
Int mayCloseAll = true;
@@ -124,6 +132,33 @@ Void plaYUVerApp::closeEvent( QCloseEvent *event )
}
}
Void plaYUVerApp::loadFile( QString fileName )
{
QMdiSubWindow *existing = findSubWindow( fileName );
if( existing )
{
mdiArea->setActiveSubWindow( existing );
return;
}
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
mdiArea->addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
interfaceChild->zoomToFit();
interfaceChild->getViewArea()->setTool( m_appTool );
}
else
{
interfaceChild->close();
}
}
// ----------------------- File Functions -----------------------
void plaYUVerApp::open()
@@ -144,28 +179,7 @@ void plaYUVerApp::open()
if( !fileName.isEmpty() )
{
m_cLastOpenPath = QFileInfo( fileName ).path();
QMdiSubWindow *existing = findSubWindow( fileName );
if( existing )
{
mdiArea->setActiveSubWindow( existing );
return;
}
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
mdiArea->addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
connect( interfaceChild->getViewArea(), SIGNAL( positionChanged(const QPoint &, InputStream *) ), this,
SLOT( updatePixelValueStatusBar(const QPoint &, InputStream *) ) );
interfaceChild->zoomToFit();
}
else
{
interfaceChild->close();
}
loadFile( fileName );
}
}
@@ -529,24 +543,8 @@ void plaYUVerApp::dropEvent( QDropEvent *event )
if( urlList.size() == 1 )
{
QString fileName = urlList.at( 0 ).toLocalFile();
m_cLastOpenPath = QFileInfo( fileName ).path();
QMdiSubWindow *existing = findSubWindow( fileName );
if( !existing )
{
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
mdiArea->addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
}
else
{
interfaceChild->close();
}
}
loadFile( fileName );
}
}
@@ -564,13 +562,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 )
@@ -606,6 +624,9 @@ Void plaYUVerApp::updateMenus()
m_pcFrameSlider->setValue( 0 );
}
actionNavigationTool->setEnabled( hasSubWindow );
actionSelectionTool->setEnabled( hasSubWindow );
m_pcModulesHandle->updateMenus( hasSubWindow );
}
@@ -770,6 +791,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 );
@@ -846,6 +885,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() ) );
+16 -4
View File
@@ -50,6 +50,7 @@ Q_OBJECT
public:
plaYUVerApp();
Void parseArgs( Int argc, Char *argv[] );
protected:
Void closeEvent( QCloseEvent *event );
@@ -98,6 +99,10 @@ private Q_SLOTS:
void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream);
void setAllSubWindowTool( );
void setNavigationTool( );
void setSelectionTool( );
private:
QMdiArea *mdiArea;
SubWindowHandle *m_pcCurrentSubWindow;
@@ -108,6 +113,7 @@ private:
QTime m_cTimer;
UInt m_uiAveragePlayInterval;
Void loadFile( QString fileName );
//! Playing functions
Void setTimerStatus();
@@ -138,16 +144,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 +219,12 @@ private:
QAction *actionAbout;
QAction *actionAboutQt;
// Tools Actions;
QActionGroup *actionGroupTools;
QAction *actionNavigationTool;
QAction *actionSelectionTool;
enum eTool m_appTool;
};
} // NAMESPACE