Change copyright and format the code using clang-format

This commit is contained in:
jfmcarreira committed 2017-01-28 19:43:48 +00:00
1 parent a69c32bfbf
commit 8a60bb2766
122 files changed
+12950 -12139

No files matched your search

+81 -84
View File
@@ -1,5 +1,5 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014-2016 by Luis Lucas (luisfrlucas@gmail.com)
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com)
* Joao Carreira (jfmcarreira@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
@@ -46,16 +46,12 @@
#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 );
// DBus
// DBus
#ifdef USE_QTDBUS
m_pDBusAdaptor = new PlaYUVerAppAdaptor( this );
#endif
@@ -87,10 +83,9 @@ PlaYUVerApp::PlaYUVerApp() :
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
}
Bool PlaYUVerApp::parseArgs( Int argc, Char *argv[] )
Bool PlaYUVerApp::parseArgs( Int argc, Char* argv[] )
{
Bool bRet = false;
PlaYUVerOptions pcCmdParser;
@@ -99,10 +94,10 @@ Bool PlaYUVerApp::parseArgs( Int argc, Char *argv[] )
String strResolution( "" );
String strPelFmt( "" );
pcCmdParser.addOptions()/**/
( "input,i", m_apcInputs, "input file" ) /**/
( "size,s", strResolution, "size (WxH)" ) /**/
( "pel_fmt", strPelFmt, "pixel format" );
pcCmdParser.addOptions() /**/
( "input,i", m_apcInputs, "input file" ) /**/
( "size,s", strResolution, "size (WxH)" ) /**/
( "pel_fmt", strPelFmt, "pixel format" );
if( !pcCmdParser.parse( argc, argv ) )
{
@@ -139,7 +134,7 @@ Void PlaYUVerApp::about()
m_pcAboutDialog->exec();
}
Void PlaYUVerApp::closeEvent( QCloseEvent *event )
Void PlaYUVerApp::closeEvent( QCloseEvent* event )
{
Int mayCloseAll = true;
Int msgBoxCloseRet = QMessageBox::Yes;
@@ -147,35 +142,36 @@ Void PlaYUVerApp::closeEvent( QCloseEvent *event )
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow();
if( subWindowList.size() >= 1 )
{
QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!", QMessageBox::Yes | QMessageBox::No, this );
QMessageBox msgBoxClose( QMessageBox::Question, "PlaYUVer", "There are open files!",
QMessageBox::Yes | QMessageBox::No, this );
msgBoxClose.setDefaultButton( QMessageBox::No );
msgBoxClose.setInformativeText( "Close all?" );
msgBoxCloseRet = msgBoxClose.exec();
}
switch( msgBoxCloseRet )
{
case QMessageBox::Yes:
mayCloseAll = true;
for( Int i = 0; i < subWindowList.size(); i++ )
{
mayCloseAll &= subWindowList.at( i )->mayClose();
}
case QMessageBox::Yes:
mayCloseAll = true;
for( Int i = 0; i < subWindowList.size(); i++ )
{
mayCloseAll &= subWindowList.at( i )->mayClose();
}
if( mayCloseAll )
{
//m_pcPlayingTimer->stop();
closeAll();
writeSettings();
event->accept();
}
else
{
event->ignore();
}
break;
case QMessageBox::No:
if( mayCloseAll )
{
// m_pcPlayingTimer->stop();
closeAll();
writeSettings();
event->accept();
}
else
{
event->ignore();
}
break;
case QMessageBox::No:
default:
event->ignore();
event->ignore();
}
}
@@ -191,18 +187,18 @@ 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();
SubWindowAbstract *subWindow = videoSubWindow;
videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
SubWindowAbstract* subWindow = videoSubWindow;
if( !pStreamInfo )
{
Int idx = findPlaYUVerStreamInfo( m_aRecentFileStreamInfo, fileName );
pStreamInfo = ( PlaYUVerStreamInfo* )( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
pStreamInfo = (PlaYUVerStreamInfo*)( idx >= 0 ? &m_aRecentFileStreamInfo.at( idx ) : NULL );
}
try
@@ -220,9 +216,12 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
m_pcWindowHandle->addSubWindow( videoSubWindow );
videoSubWindow->show();
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( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
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( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
SLOT( moveAllScrollBars( const QPoint ) ) );
videoSubWindow->zoomToFit();
updateZoomFactorSBox();
@@ -242,7 +241,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 );
}
@@ -270,11 +270,10 @@ Void PlaYUVerApp::open()
supported.append( " )" );
QStringList filter;
filter << supported
<< formatsList
<< tr( "All Files (*)" );
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++ )
{
@@ -287,7 +286,7 @@ Void PlaYUVerApp::open()
Void PlaYUVerApp::openRecent()
{
QAction *action = qobject_cast<QAction *>( sender() );
QAction* action = qobject_cast<QAction*>( sender() );
PlaYUVerStreamInfo recentFile = action->data().value<PlaYUVerStreamInfo>();
if( action )
loadFile( recentFile.m_cFilename, &recentFile );
@@ -297,7 +296,7 @@ Void PlaYUVerApp::save()
{
if( m_pcCurrentVideoSubWindow )
{
VideoSubWindow *saveWindow = m_pcCurrentVideoSubWindow;
VideoSubWindow* saveWindow = m_pcCurrentVideoSubWindow;
QString supported = tr( "Supported Files (" );
QStringList formatsList;
@@ -316,9 +315,7 @@ Void PlaYUVerApp::save()
supported.append( " )" );
QStringList filter;
filter << supported
<< formatsList
<< tr( "All Files (*)" );
filter << supported << formatsList << tr( "All Files (*)" );
QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
@@ -332,7 +329,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;
@@ -355,10 +353,11 @@ Void PlaYUVerApp::format()
}
catch( PlaYUVerFailure& e )
{
QString warningMsg = "Cannot change format of " + QFileInfo( pcVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + e.what();
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 );
qDebug( ) << warningMsg;
qDebug() << warningMsg;
m_pcCurrentSubWindow->close();
}
m_pcCurrentSubWindow = NULL;
@@ -378,12 +377,10 @@ Void PlaYUVerApp::reload()
Void PlaYUVerApp::reloadAll()
{
UInt windowCategoryOrder[] =
{
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW,
SubWindowAbstract::MODULE_SUBWINDOW,
SubWindowAbstract::MODULE_SUBWINDOW,
};
UInt windowCategoryOrder[] = {
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW, SubWindowAbstract::MODULE_SUBWINDOW,
SubWindowAbstract::MODULE_SUBWINDOW,
};
for( UInt c = 0; c < 3; c++ )
{
@@ -429,13 +426,12 @@ Void PlaYUVerApp::zoomToFit()
Void PlaYUVerApp::zoomToFitAll()
{
VideoSubWindow *videoSubWindow;
VideoSubWindow* videoSubWindow;
QList<SubWindowAbstract*> subWindowList = m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
videoSubWindow->zoomToFit();
}
if( m_pcCurrentSubWindow )
updateZoomFactorSBox();
@@ -452,7 +448,7 @@ Void PlaYUVerApp::scaleFrame( int ratio )
Void PlaYUVerApp::zoomFromSBox( double zoom )
{
SubWindowAbstract *activeSubWindow = m_pcWindowHandle->activeSubWindow();
SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
Double factor = zoom / 100;
if( activeSubWindow )
{
@@ -472,16 +468,16 @@ Void PlaYUVerApp::updateZoomFactorSBox()
// ----------------------- Drag and drop functions ----------------------
Void PlaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
Void PlaYUVerApp::dragEnterEvent( QDragEnterEvent* event )
{
//setText(tr("<drop content>"));
//mdiArea->setBackgroundRole( QPalette::Highlight );
// setText(tr("<drop content>"));
// mdiArea->setBackgroundRole( QPalette::Highlight );
event->acceptProposedAction();
}
Void PlaYUVerApp::dropEvent( QDropEvent *event )
Void PlaYUVerApp::dropEvent( QDropEvent* event )
{
const QMimeData *mimeData = event->mimeData();
const QMimeData* mimeData = event->mimeData();
QList<QUrl> urlList = mimeData->urls();
if( urlList.size() == 1 )
{
@@ -493,7 +489,8 @@ Void PlaYUVerApp::dropEvent( QDropEvent *event )
// ----------------------- Sub Window Functions -----------------------
VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager, const QString& fileName )
VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
const QString& fileName )
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
VideoSubWindow* pcSubWindow;
@@ -511,9 +508,9 @@ VideoSubWindow* PlaYUVerApp::findVideoStreamSubWindow( const PlaYUVerSubWindowHa
Void PlaYUVerApp::update()
{
SubWindowAbstract *activeSubWindow = m_pcWindowHandle->activeSubWindow();
SubWindowAbstract* activeSubWindow = m_pcWindowHandle->activeSubWindow();
QCoreApplication::processEvents();
//if( activeSubWindow() != m_pcCurrentSubWindow )
// if( activeSubWindow() != m_pcCurrentSubWindow )
{
m_pcCurrentSubWindow = NULL;
m_pcCurrentVideoSubWindow = NULL;
@@ -656,7 +653,7 @@ Void PlaYUVerApp::createActions()
// ------------ View ------------
mapperZoom = new QSignalMapper( this );
connect( mapperZoom, SIGNAL( mapped(int) ), this, SLOT( scaleFrame(int) ) );
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" ) ) );
@@ -684,7 +681,8 @@ Void PlaYUVerApp::createActions()
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() ) );
@@ -698,7 +696,8 @@ Void PlaYUVerApp::createActions()
#ifdef USE_FERVOR
m_arrayActions[UPDATE_ACT] = new QAction( tr( "&Update" ), this );
m_arrayActions[UPDATE_ACT]->setStatusTip( tr( "Check for updates" ) );
connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(), SLOT( CheckForUpdatesNotSilent() ) );
connect( m_arrayActions[UPDATE_ACT], SIGNAL( triggered() ), FvUpdater::sharedUpdater(),
SLOT( CheckForUpdatesNotSilent() ) );
#endif
m_arrayActions[ABOUT_ACT] = new QAction( tr( "&About" ), this );
@@ -742,12 +741,12 @@ Void PlaYUVerApp::createMenus()
m_arrayMenu[VIEW_MENU]->addSeparator();
// createPopupMenu() Returns a popup menu containing checkable entries for
// the toolbars and dock widgets present in the main window.
// createPopupMenu() Returns a popup menu containing checkable entries for
// the toolbars and dock widgets present in the main window.
m_arrayMenu[DOCK_VIEW_MENU] = createPopupMenu();
if( m_arrayMenu[DOCK_VIEW_MENU] )
{
QAction *actionPopupMenu = m_arrayMenu[VIEW_MENU]->addMenu( m_arrayMenu[DOCK_VIEW_MENU] );
QAction* actionPopupMenu = m_arrayMenu[VIEW_MENU]->addMenu( m_arrayMenu[DOCK_VIEW_MENU] );
actionPopupMenu->setText( tr( "&Toolbars/Docks" ) );
}
@@ -769,7 +768,6 @@ Void PlaYUVerApp::createMenus()
m_arrayMenu[ABOUT_MENU]->addSeparator();
m_arrayMenu[ABOUT_MENU]->addAction( m_arrayActions[ABOUT_ACT] );
m_arrayMenu[ABOUT_MENU]->addAction( m_arrayActions[ABOUTQT_ACT] );
}
Void PlaYUVerApp::createToolBars()
@@ -793,7 +791,7 @@ 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] );
@@ -804,12 +802,11 @@ Void PlaYUVerApp::createToolBars()
addToolBar( Qt::TopToolBarArea, m_arrayToolBars[VIEW_TOOLBAR] );
addToolBar( Qt::TopToolBarArea, m_appModuleVideo->createToolBar() );
}
Void PlaYUVerApp::createDockWidgets()
{
// Properties Dock Window
// Properties Dock Window
m_arraySideBars.resize( TOTAL_DOCK );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleVideo->createDock() );
addDockWidget( Qt::RightDockWidgetArea, m_appModuleQuality->createDock() );
@@ -844,7 +841,8 @@ Void PlaYUVerApp::updateRecentFileActions()
m_arrayRecentFilesActions.at( actionIdx )->setText( QFileInfo( text ).fileName() );
m_arrayRecentFilesActions.at( actionIdx )->setToolTip( "Open File " + text );
m_arrayRecentFilesActions.at( actionIdx )->setStatusTip( "Open File " + text );
m_arrayRecentFilesActions.at( actionIdx )->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) );
m_arrayRecentFilesActions.at( actionIdx )
->setData( QVariant::fromValue( m_aRecentFileStreamInfo.at( actionIdx ) ) );
m_arrayRecentFilesActions.at( actionIdx )->setVisible( true );
actionIdx++;
}
@@ -918,4 +916,3 @@ Void PlaYUVerApp::writeSettings()
m_appModuleExtensions->writeSettings();
m_pcWindowHandle->writeSettings();
}