Re-format code

This commit is contained in:
jfmcarreira committed 2017-03-23 04:29:34 +00:00
1 parent fd68d340bd
commit ebc10d1b84
85 files changed
+8092 -4419

No files matched your search

+56 -38
View File
@@ -22,31 +22,32 @@
* \brief Main definition of the PlaYUVerApp app
*/
#include <QtDebug>
#include "PlaYUVerApp.h"
#include <QAction>
#include <QActionGroup>
#include <QCloseEvent>
#include <QDoubleSpinBox>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QDoubleSpinBox>
#include <QActionGroup>
#include <QAction>
#include <QSignalMapper>
#include "PlaYUVerApp.h"
#include <QtDebug>
#ifdef USE_FERVOR
#include "fvupdater.h"
#endif
#include "lib/PlaYUVerOptions.h"
#include "PlaYUVerSubWindowHandle.h"
#include "AboutDialog.h"
#include "SubWindowAbstract.h"
#include "VideoSubWindow.h"
#include "VideoHandle.h"
#include "QualityHandle.h"
#include "ModulesHandle.h"
#include "DialogSubWindowSelector.h"
#include "ModulesHandle.h"
#include "PlaYUVerSubWindowHandle.h"
#include "QualityHandle.h"
#include "SubWindowAbstract.h"
#include "VideoHandle.h"
#include "VideoSubWindow.h"
#include "lib/PlaYUVerOptions.h"
#define SYNCHRONISED_ZOON 1
PlaYUVerApp::PlaYUVerApp() : m_pcCurrentSubWindow( NULL ), m_pcCurrentVideoSubWindow( NULL ), m_pcAboutDialog( NULL )
PlaYUVerApp::PlaYUVerApp()
: m_pcCurrentSubWindow( NULL ), m_pcCurrentVideoSubWindow( NULL ), m_pcAboutDialog( NULL )
{
setWindowModality( Qt::ApplicationModal );
setWindowModality( Qt::NonModal );
@@ -118,7 +119,8 @@ Bool PlaYUVerApp::parseArgs( Int argc, Char* argv[] )
}
}
std::list<const Char*>& argv_unhandled = pcCmdParser.getUnhandledArgs();
for( std::list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
for( std::list<const Char*>::const_iterator it = argv_unhandled.begin();
it != argv_unhandled.end(); it++ )
{
loadFile( QString::fromStdString( *it ) );
}
@@ -187,13 +189,15 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
printMessage( "File " + fileName + " do not exist!", LOG_ERROR );
return;
}
VideoSubWindow* videoSubWindow = PlaYUVerApp::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
VideoSubWindow* videoSubWindow =
PlaYUVerApp::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
if( videoSubWindow )
{
m_pcWindowHandle->setActiveSubWindow( videoSubWindow );
return;
}
videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
videoSubWindow =
new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
SubWindowAbstract* subWindow = videoSubWindow;
if( !pStreamInfo )
{
@@ -218,8 +222,8 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
connect( subWindow, SIGNAL( aboutToClose( SubWindowAbstract* ) ), m_appModuleVideo,
SLOT( closeSubWindow( SubWindowAbstract* ) ) );
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo,
SLOT( zoomToFactorAll( double, QPoint ) ) );
connect( subWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
connect( subWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
SLOT( moveAllScrollBars( const QPoint ) ) );
@@ -241,8 +245,8 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
catch( PlaYUVerFailure& e )
{
videoSubWindow->close();
QString warningMsg =
"Cannot open file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what();
QString warningMsg = "Cannot open file " + QFileInfo( fileName ).fileName() +
" with the following error: \n" + e.what();
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
printMessage( warningMsg, LOG_ERROR );
}
@@ -272,8 +276,8 @@ Void PlaYUVerApp::open()
QStringList filter;
filter << supported << formatsList << tr( "All Files (*)" );
QStringList fileNameList =
QFileDialog::getOpenFileNames( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
QStringList fileNameList = QFileDialog::getOpenFileNames( this, tr( "Open File" ),
m_cLastOpenPath, filter.join( ";;" ) );
for( Int i = 0; i < fileNameList.size(); i++ )
{
@@ -317,7 +321,8 @@ Void PlaYUVerApp::save()
QStringList filter;
filter << supported << formatsList << tr( "All Files (*)" );
QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath,
filter.join( ";;" ) );
if( !fileName.isEmpty() )
{
@@ -329,8 +334,8 @@ Void PlaYUVerApp::save()
catch( PlaYUVerFailure& e )
{
QApplication::restoreOverrideCursor();
QString warningMsg =
"Cannot save file " + QFileInfo( fileName ).fileName() + " with the following error: \n" + e.what();
QString warningMsg = "Cannot save file " + QFileInfo( fileName ).fileName() +
" with the following error: \n" + e.what();
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
printMessage( warningMsg, LOG_ERROR );
return;
@@ -353,7 +358,8 @@ Void PlaYUVerApp::format()
}
catch( PlaYUVerFailure& e )
{
QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() +
QString warningMsg = "Cannot change format of " +
QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() +
" with the following error: \n" + e.what();
QMessageBox::warning( this, QApplication::applicationName(), warningMsg );
printMessage( warningMsg, LOG_ERROR );
@@ -384,7 +390,8 @@ Void PlaYUVerApp::reloadAll()
for( UInt c = 0; c < 3; c++ )
{
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
QList<SubWindowAbstract*> subWindowList =
m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindowList.at( i )->refreshSubWindow();
@@ -427,7 +434,8 @@ Void PlaYUVerApp::zoomToFit()
Void PlaYUVerApp::zoomToFitAll()
{
VideoSubWindow* videoSubWindow;
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
QList<SubWindowAbstract*> subWindowList =
m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
@@ -494,7 +502,8 @@ VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHa
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
VideoSubWindow* pcSubWindow;
QList<SubWindowAbstract*> subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
QList<SubWindowAbstract*> subWindowList =
windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
@@ -616,7 +625,8 @@ Void PlaYUVerApp::createActions()
connect( m_arrayActions[SAVE_ACT], SIGNAL( triggered() ), this, SLOT( save() ) );
m_arrayActions[FORMAT_ACT] = new QAction( tr( "&Format" ), this );
m_arrayActions[FORMAT_ACT]->setIcon( QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
m_arrayActions[FORMAT_ACT]->setIcon(
QIcon::fromTheme( "transform-scale", QIcon( ":/images/configuredialog.png" ) ) );
m_arrayActions[FORMAT_ACT]->setShortcut( Qt::CTRL + Qt::Key_F );
m_arrayActions[FORMAT_ACT]->setStatusTip( tr( "Open format dialog" ) );
connect( m_arrayActions[FORMAT_ACT], SIGNAL( triggered() ), this, SLOT( format() ) );
@@ -640,11 +650,13 @@ Void PlaYUVerApp::createActions()
m_arrayActions[CLOSE_ACT] = new QAction( tr( "&Close" ), this );
m_arrayActions[CLOSE_ACT]->setIcon( style()->standardIcon( QStyle::SP_DialogCloseButton ) );
m_arrayActions[CLOSE_ACT]->setStatusTip( tr( "Close the active window" ) );
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeActiveSubWindow() ) );
connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
SLOT( removeActiveSubWindow() ) );
m_arrayActions[CLOSEALL_ACT] = new QAction( tr( "Close &All" ), this );
m_arrayActions[CLOSEALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle, SLOT( removeAllSubWindow() ) );
connect( m_arrayActions[CLOSEALL_ACT], SIGNAL( triggered() ), m_pcWindowHandle,
SLOT( removeAllSubWindow() ) );
m_arrayActions[EXIT_ACT] = new QAction( tr( "E&xit" ), this );
m_arrayActions[EXIT_ACT]->setShortcuts( QKeySequence::Quit );
@@ -656,32 +668,37 @@ Void PlaYUVerApp::createActions()
connect( mapperZoom, SIGNAL( mapped( int ) ), this, SLOT( scaleFrame( int ) ) );
m_arrayActions[ZOOM_IN_ACT] = new QAction( tr( "Zoom &In (+25%)" ), this );
m_arrayActions[ZOOM_IN_ACT]->setIcon( QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
m_arrayActions[ZOOM_IN_ACT]->setIcon(
QIcon::fromTheme( "zoom-in", QIcon( ":/images/zoomin.png" ) ) );
m_arrayActions[ZOOM_IN_ACT]->setShortcut( tr( "Ctrl++" ) );
m_arrayActions[ZOOM_IN_ACT]->setStatusTip( tr( "Scale the image up by 25%" ) );
connect( m_arrayActions[ZOOM_IN_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
mapperZoom->setMapping( m_arrayActions[ZOOM_IN_ACT], 125 );
m_arrayActions[ZOOM_OUT_ACT] = new QAction( tr( "Zoom &Out (-25%)" ), this );
m_arrayActions[ZOOM_OUT_ACT]->setIcon( QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
m_arrayActions[ZOOM_OUT_ACT]->setIcon(
QIcon::fromTheme( "zoom-out", QIcon( ":/images/zoomout.png" ) ) );
m_arrayActions[ZOOM_OUT_ACT]->setShortcut( tr( "Ctrl+-" ) );
m_arrayActions[ZOOM_OUT_ACT]->setStatusTip( tr( "Scale the image down by 25%" ) );
connect( m_arrayActions[ZOOM_OUT_ACT], SIGNAL( triggered() ), mapperZoom, SLOT( map() ) );
mapperZoom->setMapping( m_arrayActions[ZOOM_OUT_ACT], 80 );
m_arrayActions[ZOOM_NORMAL_ACT] = new QAction( tr( "&Normal Size" ), this );
m_arrayActions[ZOOM_NORMAL_ACT]->setIcon( QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
m_arrayActions[ZOOM_NORMAL_ACT]->setIcon(
QIcon::fromTheme( "zoom-original", QIcon( ":/images/zoomtonormal.png" ) ) );
m_arrayActions[ZOOM_NORMAL_ACT]->setShortcut( tr( "Ctrl+N" ) );
m_arrayActions[ZOOM_NORMAL_ACT]->setStatusTip( tr( "Show the image at its original size" ) );
connect( m_arrayActions[ZOOM_NORMAL_ACT], SIGNAL( triggered() ), this, SLOT( normalSize() ) );
m_arrayActions[ZOOM_FIT_ACT] = new QAction( tr( "Zoom to &Fit" ), this );
m_arrayActions[ZOOM_FIT_ACT]->setIcon( QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
m_arrayActions[ZOOM_FIT_ACT]->setIcon(
QIcon::fromTheme( "zoom-fit-best", QIcon( ":/images/fittowindow.png" ) ) );
m_arrayActions[ZOOM_FIT_ACT]->setStatusTip( tr( "Zoom in or out to fit on the window." ) );
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() ) );
@@ -791,7 +808,8 @@ Void PlaYUVerApp::createToolBars()
m_pcZoomFactorSBox->setSingleStep( 10.0 );
m_pcZoomFactorSBox->setValue( 100.0 );
m_pcZoomFactorSBox->setSuffix( "%" );
connect( m_pcZoomFactorSBox, SIGNAL( valueChanged( double ) ), this, SLOT( zoomFromSBox( double ) ) );
connect( m_pcZoomFactorSBox, SIGNAL( valueChanged( double ) ), this,
SLOT( zoomFromSBox( double ) ) );
m_arrayToolBars[VIEW_TOOLBAR]->addWidget( m_pcZoomFactorSBox );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_IN_ACT] );
m_arrayToolBars[VIEW_TOOLBAR]->addAction( m_arrayActions[ZOOM_OUT_ACT] );