diff --git a/.clang-format b/.clang-format
index 8985e75..6e8cf9f 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,7 +1,7 @@
---
Language: Cpp
# BasedOnStyle: Chromium
-ColumnLimit: 100
+ColumnLimit: 150
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
diff --git a/app/AboutDialog.cpp b/app/AboutDialog.cpp
index a4b61f5..a73bad3 100644
--- a/app/AboutDialog.cpp
+++ b/app/AboutDialog.cpp
@@ -37,16 +37,14 @@
AboutDialog::AboutDialog( QWidget* parent ) : QDialog( parent )
{
- QPixmap logo = QPixmap( ":/images/playuver-backgroud-logo.png" )
- .scaled( QSize( 500, 350 ), Qt::KeepAspectRatio );
+ QPixmap logo = QPixmap( ":/images/playuver-backgroud-logo.png" ).scaled( QSize( 500, 350 ), Qt::KeepAspectRatio );
QLabel* pixmapLabel = new QLabel;
pixmapLabel->setPixmap( logo );
- QLabel* label =
- new QLabel( QString( "
%1 Version %2
%3
" )
- .arg( QApplication::applicationName() )
- .arg( QApplication::applicationVersion() )
- .arg( tr( "Enhanced open-source Qt-based raw video player" ) ) );
+ QLabel* label = new QLabel( QString( "%1 Version %2
%3
" )
+ .arg( QApplication::applicationName() )
+ .arg( QApplication::applicationVersion() )
+ .arg( tr( "Enhanced open-source Qt-based raw video player" ) ) );
label->setWordWrap( true );
QString featuresList = QStringLiteral( "Features:
" );
@@ -64,8 +62,7 @@ AboutDialog::AboutDialog( QWidget* parent ) : QDialog( parent )
QLabel* labelFeatures = new QLabel( featuresList );
- QLabel* labelCopyright =
- new QLabel( QStringLiteral( "Copyright © 2014–2017 Luis Lucas and Joao Carreira" ) );
+ QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2017 Luis Lucas and Joao Carreira" ) );
QWidget* topWidget = new QWidget;
QVBoxLayout* topLayout = new QVBoxLayout;
diff --git a/app/ConfigureFormatDialog.cpp b/app/ConfigureFormatDialog.cpp
index dd8941e..f5a2d65 100644
--- a/app/ConfigureFormatDialog.cpp
+++ b/app/ConfigureFormatDialog.cpp
@@ -147,20 +147,17 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
Name = QString::fromStdString( aRCustomFileFormats[i].shortName );
uiWidth = aRCustomFileFormats[i].uiWidth;
uiHeight = aRCustomFileFormats[i].uiHeight;
- standardResolutionNames.append(
- QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
+ standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
}
- std::vector listPlaYUVerStdResolution =
- PlaYUVerStream::stdResolutionSizes();
+ std::vector listPlaYUVerStdResolution = PlaYUVerStream::stdResolutionSizes();
for( UInt i = 0; i < listPlaYUVerStdResolution.size(); i++ )
{
Name = QString::fromStdString( listPlaYUVerStdResolution[i].shortName );
uiWidth = listPlaYUVerStdResolution[i].uiWidth;
uiHeight = listPlaYUVerStdResolution[i].uiHeight;
- standardResolutionNames.append(
- QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
+ standardResolutionNames.append( QString( "%1 (%2x%3)" ).arg( Name ).arg( uiWidth ).arg( uiHeight ) );
standardResolutionSizes.append( QSize( uiWidth, uiHeight ) );
}
@@ -208,8 +205,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
m_labelFilename = new QLabel();
m_labelFilename->setFont( titleFont );
filenameLayout->addWidget( filenameLabel );
- filenameLayout->addItem(
- new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ filenameLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
filenameLayout->addWidget( m_labelFilename );
MainLayout->addLayout( filenameLayout );
@@ -287,19 +283,16 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
for( UInt i = 0; i < PlaYUVerFrame::supportedColorSpacesListNames().size(); i++ )
{
- m_comboBoxColorSpace->insertItem( i,
- PlaYUVerFrame::supportedColorSpacesListNames()[i].c_str() );
+ m_comboBoxColorSpace->insertItem( i, PlaYUVerFrame::supportedColorSpacesListNames()[i].c_str() );
}
m_comboBoxColorSpace->setCurrentIndex( 1 );
pixelGridLayout->addWidget( colorSpaceLabel, 0, 0 );
- pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
- 0, 1 );
+ pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
pixelGridLayout->addWidget( m_comboBoxColorSpace, 0, 2 );
pixelGridLayout->addWidget( pixelFormatLabel, 1, 0 );
- pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
- 1, 1 );
+ pixelGridLayout->addItem( new QSpacerItem( 10, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 1 );
pixelGridLayout->addWidget( m_comboBoxPixelFormat, 1, 2 );
QLabel* bitsPerPelLabel = new QLabel();
@@ -311,8 +304,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
m_spinBoxBits->setRange( 0, 16 );
m_spinBoxBits->setValue( 8 );
pixelGridLayout->addWidget( bitsPerPelLabel, 2, 0 );
- pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ),
- 2, 1 );
+ pixelGridLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ), 2, 1 );
pixelGridLayout->addWidget( m_spinBoxBits, 2, 2 );
/*
@@ -329,8 +321,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
m_comboBoxEndianness->addItem( QStringLiteral( "Big Endian" ) );
m_comboBoxEndianness->addItem( QStringLiteral( "Little Endian" ) );
endiannessLayout->addWidget( endiannessLabel );
- endiannessLayout->addItem(
- new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ endiannessLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
endiannessLayout->addWidget( m_comboBoxEndianness );
m_widgetEndianness = new QWidget();
m_widgetEndianness->setContentsMargins( 0, 0, 0, 0 );
@@ -350,8 +341,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
m_spinBoxFrameRate->setRange( 0, 1000 );
m_spinBoxFrameRate->setValue( 30 );
framerateFormatLayout->addWidget( framerateFormatLabel );
- framerateFormatLayout->addItem(
- new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ framerateFormatLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
framerateFormatLayout->addWidget( m_spinBoxFrameRate );
QWidget* framerateWidget = new QWidget();
framerateWidget->setContentsMargins( 0, 0, 0, 0 );
@@ -375,12 +365,10 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) : QDialog( paren
MainLayout->addItem( new QSpacerItem( 10, 5, QSizePolicy::Minimum, QSizePolicy::Expanding ) );
MainLayout->addWidget( dialogButtonOkCancel );
- connect( m_comboBoxStandardResolution, SIGNAL( currentIndexChanged( int ) ), this,
- SLOT( slotStandardResolutionSelected( int ) ) );
+ connect( m_comboBoxStandardResolution, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotStandardResolutionSelected( int ) ) );
connect( m_spinBoxWidth, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
connect( m_spinBoxheight, SIGNAL( valueChanged( int ) ), this, SLOT( slotResolutionChange() ) );
- connect( m_comboBoxColorSpace, SIGNAL( currentIndexChanged( int ) ), this,
- SLOT( slotColorSpaceChange( int ) ) );
+ connect( m_comboBoxColorSpace, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotColorSpaceChange( int ) ) );
connect( m_spinBoxBits, SIGNAL( valueChanged( int ) ), this, SLOT( slotBitsChange( int ) ) );
connect( dialogButtonOkCancel, SIGNAL( accepted() ), this, SLOT( accept() ) );
@@ -482,11 +470,9 @@ void ConfigureFormatDialog::slotStandardResolutionSelected( Int idx )
if( customResolution.shortName != "" )
{
QString name = QString::fromStdString( customResolution.shortName );
- name.append(
- QString( " (%2x%3)" ).arg( customResolution.uiWidth ).arg( customResolution.uiHeight ) );
+ name.append( QString( " (%2x%3)" ).arg( customResolution.uiWidth ).arg( customResolution.uiHeight ) );
standardResolutionNames.insert( 0, name );
- standardResolutionSizes.insert(
- 0, QSize( customResolution.uiWidth, customResolution.uiHeight ) );
+ standardResolutionSizes.insert( 0, QSize( customResolution.uiWidth, customResolution.uiHeight ) );
m_comboBoxStandardResolution->blockSignals( true );
m_comboBoxStandardResolution->insertItem( 0, name );
@@ -512,8 +498,7 @@ void ConfigureFormatDialog::slotResolutionChange()
Int newIdx = -1;
for( Int i = 0; i < standardResolutionSizes.size(); i++ )
{
- if( standardResolutionSizes.at( i ) ==
- QSize( m_spinBoxWidth->value(), m_spinBoxheight->value() ) )
+ if( standardResolutionSizes.at( i ) == QSize( m_spinBoxWidth->value(), m_spinBoxheight->value() ) )
{
newIdx = i;
break;
@@ -531,8 +516,7 @@ Void ConfigureFormatDialog::slotColorSpaceChange( Int idx )
m_comboBoxPixelFormat->clear();
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames( idx ).size(); i++ )
{
- m_comboBoxPixelFormat->insertItem(
- i, PlaYUVerFrame::supportedPixelFormatListNames( idx )[i].c_str() );
+ m_comboBoxPixelFormat->insertItem( i, PlaYUVerFrame::supportedPixelFormatListNames( idx )[i].c_str() );
}
m_comboBoxPixelFormat->setCurrentIndex( 0 );
}
diff --git a/app/FramePropertiesDock.cpp b/app/FramePropertiesDock.cpp
index 2c9e426..7c4854d 100644
--- a/app/FramePropertiesDock.cpp
+++ b/app/FramePropertiesDock.cpp
@@ -27,8 +27,7 @@
#include
#include
-FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch )
- : QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
+FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitch ) : QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
{
// -------------- Variables definition --------------
m_pcFrame = NULL;
@@ -240,19 +239,13 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, Bool* pbMainPlaySwitc
setEnabled( false );
connect( channelCB, SIGNAL( activated( int ) ), this, SLOT( slotChannelChanged( int ) ) );
- connect( scaleButtonGroup, SIGNAL( buttonClicked( int ) ), this,
- SLOT( slotScaleChanged( int ) ) );
+ connect( scaleButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotScaleChanged( int ) ) );
connect( colorsCB, SIGNAL( activated( int ) ), this, SLOT( slotColorsChanged( int ) ) );
- connect( renderingButtonGroup, SIGNAL( buttonClicked( int ) ), this,
- SLOT( slotRenderingChanged( int ) ) );
- connect( histogramWidget, SIGNAL( signalIntervalChanged( int, int ) ), this,
- SLOT( slotUpdateInterval( int, int ) ) );
- connect( histogramWidget, SIGNAL( signalMaximumValueChanged( int ) ), this,
- SLOT( slotUpdateIntervRange( int ) ) );
- connect( histogramWidget, SIGNAL( signalHistogramComputationDone( int ) ), this,
- SLOT( slotRefreshOptions( int ) ) );
- connect( histogramWidget, SIGNAL( signalHistogramComputationFailed( void ) ), this,
- SLOT( slotHistogramComputationFailed( void ) ) );
+ connect( renderingButtonGroup, SIGNAL( buttonClicked( int ) ), this, SLOT( slotRenderingChanged( int ) ) );
+ connect( histogramWidget, SIGNAL( signalIntervalChanged( int, int ) ), this, SLOT( slotUpdateInterval( int, int ) ) );
+ connect( histogramWidget, SIGNAL( signalMaximumValueChanged( int ) ), this, SLOT( slotUpdateIntervRange( int ) ) );
+ connect( histogramWidget, SIGNAL( signalHistogramComputationDone( int ) ), this, SLOT( slotRefreshOptions( int ) ) );
+ connect( histogramWidget, SIGNAL( signalHistogramComputationFailed( void ) ), this, SLOT( slotHistogramComputationFailed( void ) ) );
connect( minInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMinValueChanged( int ) ) );
connect( maxInterv, SIGNAL( valueChanged( int ) ), this, SLOT( slotMaxValueChanged( int ) ) );
}
@@ -392,8 +385,7 @@ Void FramePropertiesDock::setSelection( const QRect& selectionArea )
{
delete m_pcSelectedFrame;
}
- m_pcSelectedFrame = new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(),
- selectionArea.width(), selectionArea.height() );
+ m_pcSelectedFrame = new PlaYUVerFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(), selectionArea.height() );
}
updateDataHistogram();
selectionImageButton->click();
@@ -460,8 +452,7 @@ Void FramePropertiesDock::updateStatistiques()
if( frame )
{
- QString rangeText = "[" + QString::number( frame->getMin( channel ) ) + ":" +
- QString::number( frame->getMax( channel ) ) + "]";
+ QString rangeText = "[" + QString::number( frame->getMin( channel ) ) + ":" + QString::number( frame->getMax( channel ) ) + "]";
labelRangeValue->setText( rangeText );
double mean = frame->getMean( channel, min, max );
diff --git a/app/HistogramWidget.cpp b/app/HistogramWidget.cpp
index 3c1eed3..0ddef0c 100644
--- a/app/HistogramWidget.cpp
+++ b/app/HistogramWidget.cpp
@@ -177,8 +177,7 @@ HistogramWidget::HistogramWidget( Int width, Int height, QWidget* parent ) : QWi
m_colorType = FirstChannelColor;
m_renderingType = FullImageHistogram;
- setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode |
- HistogramWidget::ShowLumaChannel );
+ setOptions( HistogramWidget::BlinkComputation | HistogramWidget::SelectMode | HistogramWidget::ShowLumaChannel );
setMouseTracking( true );
setMinimumSize( width, height );
@@ -434,22 +433,21 @@ Void HistogramWidget::paintEvent( QPaintEvent* )
// or loading, but no message shall be drawn:
// Drawing grayed frame.
if( !isEnabled() || d->clearFlag == HistogramWidgetPrivate::HistogramNone ||
- ( !d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted ||
- d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) ) )
+ ( !d->blinkComputation &&
+ ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted || d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) ) )
{
QPainter p1( this );
p1.fillRect( 0, 0, maxX, maxY, palette().color( QPalette::Disabled, QPalette::Window ) );
- p1.setPen(
- QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
+ p1.setPen( QPen( palette().color( QPalette::Disabled, QPalette::WindowText ), 1, Qt::SolidLine ) );
p1.drawRect( 0, 0, maxX, maxY );
return;
}
// Image data is loading or histogram is being computed:
// Draw message.
- else if( d->blinkComputation && ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted ||
- d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) )
+ else if( d->blinkComputation &&
+ ( d->clearFlag == HistogramWidgetPrivate::HistogramStarted || d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading ) )
{
QPainter p1( this );
@@ -463,8 +461,7 @@ Void HistogramWidget::paintEvent( QPaintEvent* )
if( d->clearFlag == HistogramWidgetPrivate::HistogramDataLoading )
p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Loading image..." ) );
else
- p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter,
- tr( "Histogram\ncalculation\nin progress..." ) );
+ p1.drawText( 0, 0, maxX, maxY, Qt::AlignCenter, tr( "Histogram\ncalculation\nin progress..." ) );
return;
}
@@ -529,8 +526,7 @@ Void HistogramWidget::paintEvent( QPaintEvent* )
break;
case HistogramWidget::ColorChannelsHistogram: // All color channels.
- max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ),
- frame->getMaximum( CHROMA_V ) );
+ max = qMax( qMax( frame->getMaximum( LUMA ), frame->getMaximum( CHROMA_U ) ), frame->getMaximum( CHROMA_V ) );
break;
// case HistogramWidget::LumaHistogram: // Luminance.
// max = frame->getMaximum( LUMA );
@@ -1058,8 +1054,7 @@ Void HistogramWidget::mouseMoveEvent( QMouseEvent* e )
Void HistogramWidget::notifyValuesChanged()
{
- emit signalIntervalChanged( (int)( d->xmin * d->range ),
- d->xmax == 0.0 ? d->range : (int)( d->xmax * d->range ) );
+ emit signalIntervalChanged( (int)( d->xmin * d->range ), d->xmax == 0.0 ? d->range : (int)( d->xmax * d->range ) );
}
Void HistogramWidget::slotMinValueChanged( int min )
diff --git a/app/ModuleHandleDock.cpp b/app/ModuleHandleDock.cpp
index aac0ce9..b7a2ad0 100644
--- a/app/ModuleHandleDock.cpp
+++ b/app/ModuleHandleDock.cpp
@@ -27,8 +27,7 @@
#include "PlaYUVerAppModuleIf.h"
#include
-ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf )
- : QWidget( parent ), m_pcCurrModuleIf( moduleIf )
+ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* moduleIf ) : QWidget( parent ), m_pcCurrModuleIf( moduleIf )
{
// ----------------- Dock definition -----------------
diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp
index 7cd55ec..22600f0 100644
--- a/app/ModulesHandle.cpp
+++ b/app/ModulesHandle.cpp
@@ -32,13 +32,8 @@
#include "modules/PlaYUVerModuleFactory.h"
#include
-ModulesHandle::ModulesHandle( QWidget* parent,
- PlaYUVerSubWindowHandle* windowManager,
- VideoHandle* moduleVideo )
- : QWidget( parent )
- , m_pcParent( parent )
- , m_pcMainWindowManager( windowManager )
- , m_appModuleVideo( moduleVideo )
+ModulesHandle::ModulesHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager, VideoHandle* moduleVideo )
+ : QWidget( parent ), m_pcParent( parent ), m_pcMainWindowManager( windowManager ), m_appModuleVideo( moduleVideo )
{
setParent( m_pcParent );
}
@@ -60,8 +55,7 @@ Void ModulesHandle::createActions()
m_arrayActions[LOAD_EXTERNAL_ACT] = new QAction( "Load external module", parent() );
m_arrayActions[LOAD_EXTERNAL_ACT]->setStatusTip( "Load an externally build module" );
- connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this,
- SLOT( loadExternalModule() ) );
+ connect( m_arrayActions[LOAD_EXTERNAL_ACT], SIGNAL( triggered() ), this, SLOT( loadExternalModule() ) );
m_arrayActions[APPLY_ALL_ACT] = new QAction( "Apply to All", parent() );
m_arrayActions[APPLY_ALL_ACT]->setStatusTip( "Apply module to all frames and save the result" );
@@ -70,17 +64,14 @@ Void ModulesHandle::createActions()
m_arrayActions[SWAP_FRAMES_ACT] = new QAction( "Swap frames", parent() );
m_arrayActions[SWAP_FRAMES_ACT]->setStatusTip( "Swap Sub Window order" );
- connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper,
- SLOT( map() ) );
+ connect( m_arrayActions[SWAP_FRAMES_ACT], SIGNAL( triggered() ), m_pcActionMapper, SLOT( map() ) );
m_pcActionMapper->setMapping( m_arrayActions[SWAP_FRAMES_ACT], SWAP_FRAMES_ACT );
m_arrayActions[DISABLE_ACT] = new QAction( "Disable Modules", parent() );
- connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this,
- SLOT( destroyWindowModules() ) );
+ connect( m_arrayActions[DISABLE_ACT], SIGNAL( triggered() ), this, SLOT( destroyWindowModules() ) );
m_arrayActions[DISABLE_ALL_ACT] = new QAction( "Disable All Modules", parent() );
- connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this,
- SLOT( destroyAllModulesIf() ) );
+ connect( m_arrayActions[DISABLE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( destroyAllModulesIf() ) );
m_arrayActions[FORCE_NEW_WINDOW_ACT] = new QAction( "Use New Window", parent() );
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setStatusTip(
@@ -123,8 +114,7 @@ Void ModulesHandle::buildMenu()
{
for( Int j = 0; j < m_pcModulesSubMenuList.size(); j++ )
{
- if( m_pcModulesSubMenuList.at( j )->title() ==
- QString( pcCurrModuleIf->m_pchModuleCategory ) )
+ if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) )
{
currSubMenu = m_pcModulesSubMenuList.at( j );
break;
@@ -163,8 +153,7 @@ Void ModulesHandle::buildMenu()
Void ModulesHandle::updateMenus()
{
- VideoSubWindow* pcSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcSubWindow ? true : false;
QAction* currModuleAction;
@@ -207,21 +196,18 @@ Void ModulesHandle::updateMenus()
Void ModulesHandle::readSettings()
{
QSettings appSettings;
- m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked(
- appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
+ m_arrayActions[FORCE_NEW_WINDOW_ACT]->setChecked( appSettings.value( "ModulesHandle/UseNewWindow", false ).toBool() );
}
Void ModulesHandle::writeSettings()
{
QSettings appSettings;
- appSettings.setValue( "ModulesHandle/UseNewWindow",
- m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
+ appSettings.setValue( "ModulesHandle/UseNewWindow", m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() );
}
Void ModulesHandle::processOpt( Int index )
{
- VideoSubWindow* pcSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcSubWindow )
{
PlaYUVerAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
@@ -254,8 +240,7 @@ Void ModulesHandle::loadExternalModule()
formatsList << "Shared Libraries (*.so)";
QStringList filter;
filter << supported << formatsList << tr( "All Files (*)" );
- QStringList fileNames = QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(),
- filter.join( ";;" ) );
+ QStringList fileNames = QFileDialog::getOpenFileNames( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
for( Int i = 0; i < fileNames.size(); i++ )
{
@@ -271,24 +256,20 @@ Void ModulesHandle::activateModule()
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
Bool bTmpForceNewWindow = false;
- VideoSubWindow* pcVideoSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( !pcVideoSubWindow )
{
return;
}
- if( ( keyModifiers & Qt::ControlModifier ) ||
- pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
+ if( ( keyModifiers & Qt::ControlModifier ) || pcVideoSubWindow->checkCategory( VideoSubWindow::MODULE_SUBWINDOW ) )
{
bTmpForceNewWindow = true;
}
QString ModuleIfName = pcAction->data().toString();
- PlaYUVerModuleIf* pcCurrModuleIf =
- PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
- PlaYUVerAppModuleIf* pcCurrAppModuleIf =
- new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
+ PlaYUVerModuleIf* pcCurrModuleIf = PlaYUVerModuleFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
+ PlaYUVerAppModuleIf* pcCurrAppModuleIf = new PlaYUVerAppModuleIf( this, pcAction, pcCurrModuleIf );
QList videoSubWindowList;
Int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
@@ -301,11 +282,9 @@ Void ModulesHandle::activateModule()
minNumFrames = 0;
maxNumFrames = 255;
}
- DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager,
- SubWindowAbstract::VIDEO_SUBWINDOW,
- minNumFrames, maxNumFrames );
- QList windowsList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMainWindowManager, SubWindowAbstract::VIDEO_SUBWINDOW, minNumFrames,
+ maxNumFrames );
+ QList windowsList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
if( windowsList.size() == minNumFrames && windowsList.size() == maxNumFrames )
{
@@ -343,12 +322,10 @@ Void ModulesHandle::activateModule()
// Check for same fmt in more than one frame modules
for( Int i = 1; i < videoSubWindowList.size(); i++ )
{
- if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt(
- videoSubWindowList.at( 0 )->getCurrFrame() ) )
+ if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) )
{
videoSubWindowList.clear();
- qobject_cast( m_pcParent )
- ->printMessage( "Error! Incompatible frames", LOG_ERROR );
+ qobject_cast( m_pcParent )->printMessage( "Error! Incompatible frames", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -362,8 +339,7 @@ Void ModulesHandle::activateModule()
if( videoSubWindowList.size() == 0 )
{
- qobject_cast( m_pcParent )
- ->printMessage( "Error! There is no windows to apply the module", LOG_ERROR );
+ qobject_cast( m_pcParent )->printMessage( "Error! There is no windows to apply the module", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -378,34 +354,29 @@ Void ModulesHandle::activateModule()
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf );
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
{
- qobject_cast( m_pcParent )
- ->printMessage( "Module canceled by user!", LOG_WARNINGS );
+ qobject_cast( m_pcParent )->printMessage( "Module canceled by user!", LOG_WARNINGS );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
}
- Bool bShowModulesNewWindow =
- m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
+ Bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow;
QString windowName;
VideoSubWindow* pcModuleSubWindow = NULL;
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
{
- if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) ||
- bShowModulesNewWindow )
+ if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
{
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
windowName.append( QStringLiteral( "Module " ) );
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
- connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ),
- m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
- connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ),
- m_appModuleVideo, SLOT( zoomToFactorAll( double, QPoint ) ) );
- connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ),
- m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
+ connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, SLOT( updateSelectionArea( QRect ) ) );
+ connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo,
+ SLOT( zoomToFactorAll( double, QPoint ) ) );
+ connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo, SLOT( moveAllScrollBars( const QPoint ) ) );
pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
}
@@ -418,13 +389,10 @@ Void ModulesHandle::activateModule()
titleDockWidget.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
titleDockWidget.append( " Information" );
pcCurrAppModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent );
- pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable |
- QDockWidget::DockWidgetFloatable );
- pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea |
- Qt::RightDockWidgetArea );
+ pcCurrAppModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
+ pcCurrAppModuleIf->m_pcDockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
pcCurrAppModuleIf->m_pcDockWidget->setWidget( pcCurrAppModuleIf->m_pcModuleDock );
- qobject_cast( m_pcParent )
- ->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
+ qobject_cast( m_pcParent )->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
}
// Associate module with subwindows
@@ -461,8 +429,7 @@ Void ModulesHandle::activateModule()
if( !moduleCreated )
{
- qobject_cast( m_pcParent )
- ->printMessage( "Error! Module cannot be created", LOG_ERROR );
+ qobject_cast( m_pcParent )->printMessage( "Error! Module cannot be created", LOG_ERROR );
destroyModuleIf( pcCurrAppModuleIf );
return;
}
@@ -499,8 +466,7 @@ Void ModulesHandle::destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
Void ModulesHandle::destroyWindowModules()
{
- VideoSubWindow* pcVideoSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcVideoSubWindow )
{
pcVideoSubWindow->disableModule();
@@ -517,9 +483,7 @@ Void ModulesHandle::destroyAllModulesIf()
emit changed();
}
-Void ModulesHandle::applyModuleIf( QList pcCurrModuleIfList,
- Bool isPlaying,
- Bool disableThreads )
+Void ModulesHandle::applyModuleIf( QList pcCurrModuleIfList, Bool isPlaying, Bool disableThreads )
{
for( Int i = 0; i < pcCurrModuleIfList.size() && !isPlaying; i++ )
{
@@ -538,26 +502,32 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
QString supported = tr( "Supported Files (" );
QStringList formatsList;
-
std::vector supportedFmts = PlaYUVerStream::supportedWriteFormats();
+
for( UInt i = 0; i < supportedFmts.size(); i++ )
{
- QString currFmt;
- supported.append( " *." );
- supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
- currFmt.append( " (*." );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
- currFmt.append( ")" );
- formatsList << currFmt;
+ std::vector arrayExt = supportedFmts[i].getExts();
+ if( arrayExt.size() > 0 )
+ {
+ QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
+ currFmt.append( " (" );
+ for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
+ {
+ supported.append( " *." );
+ currFmt.append( "*." );
+ supported.append( QString::fromStdString( *e ) );
+ currFmt.append( QString::fromStdString( *e ) );
+ }
+ currFmt.append( ")" );
+ formatsList << currFmt;
+ }
}
supported.append( " )" );
QStringList filter;
filter << supported << formatsList << tr( "All Files (*)" );
- QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(),
- filter.join( ";;" ) );
+ QString fileName = QFileDialog::getSaveFileName( m_pcParent, tr( "Open File" ), QString(), filter.join( ";;" ) );
Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth();
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
@@ -566,9 +536,8 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf )
FrameRate = pcCurrModuleIf->m_pcSubWindow[0]->getInputStream()->getFrameRate();
pcCurrModuleIf->m_pcModuleStream = new PlaYUVerStream;
- if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height,
- InputFormat, BitsPixel, PLAYUVER_LITTLE_ENDIAN,
- FrameRate, false ) )
+ if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel, PLAYUVER_LITTLE_ENDIAN, FrameRate,
+ false ) )
{
delete pcCurrModuleIf->m_pcModuleStream;
pcCurrModuleIf->m_pcModuleStream = NULL;
diff --git a/app/ModulesHandle.h b/app/ModulesHandle.h
index 5a1e090..3f24ca3 100644
--- a/app/ModulesHandle.h
+++ b/app/ModulesHandle.h
@@ -61,9 +61,7 @@ public:
Void writeSettings();
static Void destroyModuleIf( PlaYUVerAppModuleIf* pcCurrModuleIf );
- static Void applyModuleIf( QList pcCurrModuleIfList,
- Bool isPlaying = false,
- Bool disableThreads = false );
+ static Void applyModuleIf( QList pcCurrModuleIfList, Bool isPlaying = false, Bool disableThreads = false );
private:
QWidget* m_pcParent;
diff --git a/app/ModulesHandleOptDialog.cpp b/app/ModulesHandleOptDialog.cpp
index 383d87e..401abe3 100644
--- a/app/ModulesHandleOptDialog.cpp
+++ b/app/ModulesHandleOptDialog.cpp
@@ -76,20 +76,17 @@ private:
String m_cName;
};
-ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent,
- PlaYUVerAppModuleIf* pcCurrModuleIf )
+ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, PlaYUVerAppModuleIf* pcCurrModuleIf )
: QDialog( parent ), m_pcCurrModuleIf( pcCurrModuleIf )
{
resize( 400, 10 );
setWindowTitle( "Select module parameters" );
- const PlaYUVerOptions::OptionsList& moduleOptions =
- m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
+ const PlaYUVerOptions::OptionsList& moduleOptions = m_pcCurrModuleIf->m_pcModule->m_cModuleOptions.getOptionList();
QVBoxLayout* optionsLayout = new QVBoxLayout;
OpionConfiguration* pcOption;
- for( PlaYUVerOptions::OptionsList::const_iterator it = moduleOptions.begin();
- it != moduleOptions.end(); ++it )
+ for( PlaYUVerOptions::OptionsList::const_iterator it = moduleOptions.begin(); it != moduleOptions.end(); ++it )
{
pcOption = new OpionConfiguration( ( *it )->opt );
m_apcOptionList.append( pcOption );
diff --git a/app/PlaYUVerApp.cpp b/app/PlaYUVerApp.cpp
index 35d128f..7a7b1fc 100644
--- a/app/PlaYUVerApp.cpp
+++ b/app/PlaYUVerApp.cpp
@@ -46,13 +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
@@ -119,8 +118,7 @@ Bool PlaYUVerApp::parseArgs( Int argc, Char* argv[] )
}
}
std::list& argv_unhandled = pcCmdParser.getUnhandledArgs();
- for( std::list::const_iterator it = argv_unhandled.begin();
- it != argv_unhandled.end(); it++ )
+ for( std::list::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++ )
{
loadFile( QString::fromStdString( *it ) );
}
@@ -144,8 +142,7 @@ Void PlaYUVerApp::closeEvent( QCloseEvent* event )
QList 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();
@@ -189,15 +186,13 @@ 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 )
{
@@ -220,12 +215,10 @@ 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();
@@ -245,8 +238,7 @@ 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 );
}
@@ -254,22 +246,31 @@ Void PlaYUVerApp::loadFile( QString fileName, PlaYUVerStreamInfo* pStreamInfo )
// ----------------------- File Functions -----------------------
-Void PlaYUVerApp::open()
+QStringList PlaYUVerApp::showFileDialog( Bool bRead )
{
QString supported = tr( "Supported Files (" );
QStringList formatsList;
- std::vector supportedFmts = PlaYUVerStream::supportedReadFormats();
+ std::vector supportedFmts;
+
+ if( bRead )
+ supportedFmts = PlaYUVerStream::supportedReadFormats();
+ else
+ supportedFmts = PlaYUVerStream::supportedWriteFormats();
for( UInt i = 0; i < supportedFmts.size(); i++ )
{
- if( supportedFmts[i].formatExt != "" )
+ std::vector arrayExt = supportedFmts[i].getExts();
+ if( arrayExt.size() > 0 )
{
- QString currFmt;
- supported.append( " *." );
- supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
- currFmt.append( " (*." );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
+ QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
+ currFmt.append( " (" );
+ for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
+ {
+ supported.append( " *." );
+ currFmt.append( "*." );
+ supported.append( QString::fromStdString( *e ) );
+ currFmt.append( QString::fromStdString( *e ) );
+ }
currFmt.append( ")" );
formatsList << currFmt;
}
@@ -279,9 +280,13 @@ 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( ";;" ) );
+ return fileNameList;
+}
+Void PlaYUVerApp::open()
+{
+ QStringList fileNameList = showFileDialog( true );
for( Int i = 0; i < fileNameList.size(); i++ )
{
if( !fileNameList.at( i ).isEmpty() )
@@ -309,31 +314,11 @@ Void PlaYUVerApp::save()
if( m_pcCurrentVideoSubWindow )
{
VideoSubWindow* saveWindow = m_pcCurrentVideoSubWindow;
- QString supported = tr( "Supported Files (" );
- QStringList formatsList;
- std::vector supportedFmts = PlaYUVerStream::supportedWriteFormats();
- for( UInt i = 0; i < supportedFmts.size(); i++ )
- {
- QString currFmt;
- supported.append( " *." );
- supported.append( QString::fromStdString( supportedFmts[i].formatExt ) );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatName ) );
- currFmt.append( " (*." );
- currFmt.append( QString::fromStdString( supportedFmts[i].formatExt ) );
- currFmt.append( ")" );
- formatsList << currFmt;
- }
- supported.append( " )" );
-
- QStringList filter;
- filter << supported << formatsList << tr( "All Files (*)" );
-
- QString fileName = QFileDialog::getSaveFileName( this, tr( "Open File" ), m_cLastOpenPath,
- filter.join( ";;" ) );
-
- if( !fileName.isEmpty() )
+ QStringList fileNames = showFileDialog( false );
+ if( fileNames.size() == 1 )
{
+ QString fileName = fileNames[0];
m_cLastOpenPath = QFileInfo( fileName ).path();
try
{
@@ -342,8 +327,7 @@ 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;
@@ -366,9 +350,8 @@ 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;
@@ -399,8 +382,7 @@ Void PlaYUVerApp::reloadAll()
for( UInt c = 0; c < 3; c++ )
{
- QList subWindowList =
- m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
+ QList subWindowList = m_pcWindowHandle->findSubWindow( windowCategoryOrder[c] );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindowList.at( i )->refreshSubWindow();
@@ -443,8 +425,7 @@ Void PlaYUVerApp::zoomToFit()
Void PlaYUVerApp::zoomToFitAll()
{
VideoSubWindow* videoSubWindow;
- QList subWindowList =
- m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcWindowHandle->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -506,13 +487,11 @@ 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;
- QList subWindowList =
- windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -638,8 +617,7 @@ 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() ) );
@@ -663,13 +641,11 @@ 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 );
@@ -681,31 +657,27 @@ 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() ) );
@@ -726,8 +698,7 @@ 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 );
@@ -822,8 +793,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] );
@@ -873,8 +843,7 @@ 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++;
}
diff --git a/app/PlaYUVerApp.h b/app/PlaYUVerApp.h
index 7dcf84c..aeae7d2 100644
--- a/app/PlaYUVerApp.h
+++ b/app/PlaYUVerApp.h
@@ -125,9 +125,9 @@ private:
VideoSubWindow* m_pcCurrentVideoSubWindow;
QString m_cLastOpenPath;
+ QStringList showFileDialog( Bool bRead );
- static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager,
- const QString& fileName );
+ static VideoSubWindow* findVideoStreamSubWindow( const PlaYUVerSubWindowHandle* windowManager, const QString& fileName );
Void updateMenus();
diff --git a/app/PlaYUVerAppAdaptor.cpp b/app/PlaYUVerAppAdaptor.cpp
index e6211e8..d99064c 100644
--- a/app/PlaYUVerAppAdaptor.cpp
+++ b/app/PlaYUVerAppAdaptor.cpp
@@ -26,12 +26,10 @@
#include "PlaYUVerApp.h"
#include
-PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp* app )
- : QDBusAbstractAdaptor( app ), m_app( app )
+PlaYUVerAppAdaptor::PlaYUVerAppAdaptor( PlaYUVerApp* app ) : QDBusAbstractAdaptor( app ), m_app( app )
{
// application dbus interface
- Bool isRegistered = QDBusConnection::sessionBus().registerObject(
- QStringLiteral( PLAYUVER_DBUS_PATH ), this, QDBusConnection::ExportAllSlots );
+ Bool isRegistered = QDBusConnection::sessionBus().registerObject( QStringLiteral( PLAYUVER_DBUS_PATH ), this, QDBusConnection::ExportAllSlots );
Q_ASSERT( isRegistered == true );
}
diff --git a/app/PlaYUVerAppModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp
index 2de6c7b..3f171c2 100644
--- a/app/PlaYUVerAppModuleIf.cpp
+++ b/app/PlaYUVerAppModuleIf.cpp
@@ -26,9 +26,7 @@
#include "VideoSubWindow.h"
#include "VideoSubWindow.h"
-PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent,
- QAction* action,
- PlaYUVerModuleIf* module )
+PlaYUVerAppModuleIf::PlaYUVerAppModuleIf( QObject* parent, QAction* action, PlaYUVerModuleIf* module )
: m_bIsRunning( false )
, m_pcModuleAction( action )
, m_pcModule( module )
diff --git a/app/PlaYUVerSubWindowHandle.cpp b/app/PlaYUVerSubWindowHandle.cpp
index e091446..f565c82 100644
--- a/app/PlaYUVerSubWindowHandle.cpp
+++ b/app/PlaYUVerSubWindowHandle.cpp
@@ -43,8 +43,7 @@
class PlaYUVerMdiArea : public QMdiArea
{
public:
- PlaYUVerMdiArea( QWidget* parent = 0 )
- : QMdiArea( parent ), m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
+ PlaYUVerMdiArea( QWidget* parent = 0 ) : QMdiArea( parent ), m_pixmapLogo( ":/images/playuver-backgroud-logo.png" )
{
setBackgroundRole( QPalette::Background );
}
@@ -120,8 +119,8 @@ Void PlaYUVerSubWindowHandle::resetWindowMode()
}
for( Int i = 0; i < m_apcMdiSubWindowList.size(); i++ )
{
- disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ),
- this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
+ disconnect( m_apcMdiSubWindowList.at( i ), SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this,
+ SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
m_apcMdiSubWindowList.at( i )->close();
}
m_apcMdiSubWindowList.clear();
@@ -163,8 +162,7 @@ Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode )
setVisible( true );
m_pcMdiArea = new PlaYUVerMdiArea;
m_pcMdiArea->setActivationOrder( QMdiArea::ActivationHistoryOrder );
- connect( m_pcMdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), this,
- SLOT( updateActiveSubWindow() ) );
+ connect( m_pcMdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), this, SLOT( updateActiveSubWindow() ) );
m_pcWindowManagerLayout = new QHBoxLayout( this );
m_pcWindowManagerLayout->addWidget( m_pcMdiArea );
setLayout( m_pcWindowManagerLayout );
@@ -177,8 +175,7 @@ Void PlaYUVerSubWindowHandle::setWindowMode( Int iWindowMode )
// m_pcApp->resize( m_cMdiModeWindowSize );
if( m_pcActiveWindow )
{
- m_pcApp->setWindowTitle( QApplication::applicationName() +
- " :: " + m_pcActiveWindow->getWindowName() );
+ m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
}
}
m_iWindowMode = iWindowMode;
@@ -205,8 +202,7 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
if( mdiSubWindow )
{
QWidget* activeWidget = m_pcMdiArea->activeSubWindow()->widget();
- Int windowIdx =
- m_apcSubWindowList.indexOf( qobject_cast( activeWidget ) );
+ Int windowIdx = m_apcSubWindowList.indexOf( qobject_cast( activeWidget ) );
if( windowIdx >= 0 )
{
m_pcActiveWindow = m_apcSubWindowList.at( windowIdx );
@@ -215,8 +211,7 @@ Void PlaYUVerSubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
}
if( m_pcActiveWindow )
{
- m_pcApp->setWindowTitle( QApplication::applicationName() +
- " :: " + m_pcActiveWindow->getWindowName() );
+ m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
}
}
}
@@ -228,24 +223,19 @@ Void PlaYUVerSubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
m_pcMdiArea->addSubWindow( mdiSubWindow );
m_apcMdiSubWindowList.append( mdiSubWindow );
window->setSubWindow( mdiSubWindow );
- connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this,
- SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
+ connect( mdiSubWindow, SIGNAL( aboutToClose( PlaYUVerMdiSubWindow* ) ), this, SLOT( removeMdiSubWindow( PlaYUVerMdiSubWindow* ) ) );
}
Void PlaYUVerSubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
{
if( window )
{
- connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp,
- SLOT( printMessage( const QString& ) ) );
- connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_pcApp,
- SLOT( updateZoomFactorSBox() ) );
+ connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
+ connect( window, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
- connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
- SLOT( updateActiveSubWindow( SubWindowAbstract* ) ) );
- connect( window, SIGNAL( aboutToClose( SubWindowAbstract* ) ), this,
- SLOT( removeSubWindow( SubWindowAbstract* ) ) );
+ connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this, SLOT( updateActiveSubWindow( SubWindowAbstract* ) ) );
+ connect( window, SIGNAL( aboutToClose( SubWindowAbstract* ) ), this, SLOT( removeSubWindow( SubWindowAbstract* ) ) );
}
if( m_iWindowMode == MDISUBWINDOWMODE )
{
@@ -330,8 +320,7 @@ QList PlaYUVerSubWindowHandle::findSubWindow( const UInt uiC
return apcSubWindowList;
}
-QList PlaYUVerSubWindowHandle::findSubWindow( const QString& windowName,
- const UInt uiCategory ) const
+QList PlaYUVerSubWindowHandle::findSubWindow( const QString& windowName, const UInt uiCategory ) const
{
QList subWindowList = findSubWindow( uiCategory );
QList apcSubWindowList;
@@ -346,8 +335,7 @@ QList PlaYUVerSubWindowHandle::findSubWindow( const QString&
return apcSubWindowList;
}
-SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow(
- const SubWindowAbstract* subWindow ) const
+SubWindowAbstract* PlaYUVerSubWindowHandle::findSubWindow( const SubWindowAbstract* subWindow ) const
{
QList subWindowList = findSubWindow();
for( Int i = 0; i < subWindowList.size(); i++ )
@@ -426,8 +414,7 @@ Void PlaYUVerSubWindowHandle::tileSubWindows()
}
QSize totalWindowsSize( screenSize.width(), screenSize.height() - topLeftCornerWindow.y() );
- QSize windowsSize( totalWindowsSize.width() / numberTillingColumns,
- totalWindowsSize.height() / numberTillingRows );
+ QSize windowsSize( totalWindowsSize.width() / numberTillingColumns, totalWindowsSize.height() / numberTillingRows );
QPoint windowRelativePos;
for( Int i = 0; i < m_apcSubWindowList.size(); i++ )
{
@@ -454,8 +441,7 @@ Void PlaYUVerSubWindowHandle::cascadeSubWindows()
Void PlaYUVerSubWindowHandle::createActions()
{
m_mapperWindow = new QSignalMapper( this );
- connect( m_mapperWindow, SIGNAL( mapped( QWidget* ) ), this,
- SLOT( setActiveSubWindow( QWidget* ) ) );
+ connect( m_mapperWindow, SIGNAL( mapped( QWidget* ) ), this, SLOT( setActiveSubWindow( QWidget* ) ) );
m_arrayActions.resize( TOTAL_ACT );
@@ -469,16 +455,13 @@ Void PlaYUVerSubWindowHandle::createActions()
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] = new QAction( tr( "&Detached SubWindows" ), this );
m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT]->setCheckable( true );
m_actionGroupWindowMode->addAction( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT] );
- connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
- SLOT( map() ) );
- m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT],
- DETACHEDSUBWINDOWMODE );
+ connect( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
+ m_mapperWindowMode->setMapping( m_arrayActions[NORMAL_SUBWINDOW_MODE_ACT], DETACHEDSUBWINDOWMODE );
m_arrayActions[MDI_SUBWINDOW_MODE_ACT] = new QAction( "&MDI SubWindows", this );
m_arrayActions[MDI_SUBWINDOW_MODE_ACT]->setCheckable( true );
m_actionGroupWindowMode->addAction( m_arrayActions[MDI_SUBWINDOW_MODE_ACT] );
- connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode,
- SLOT( map() ) );
+ connect( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], SIGNAL( triggered() ), m_mapperWindowMode, SLOT( map() ) );
m_mapperWindowMode->setMapping( m_arrayActions[MDI_SUBWINDOW_MODE_ACT], MDISUBWINDOWMODE );
m_actionGroupWindowMode->actions().at( m_iWindowMode )->setChecked( true );
@@ -486,19 +469,16 @@ Void PlaYUVerSubWindowHandle::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() ), this,
- SLOT( removeActiveSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
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() ), this,
- SLOT( removeActiveSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ACT], SIGNAL( triggered() ), this, SLOT( removeActiveSubWindow() ) );
m_arrayActions[CLOSE_ALL_ACT] = new QAction( tr( "Close &All" ), this );
m_arrayActions[CLOSE_ALL_ACT]->setStatusTip( tr( "Close all the windows" ) );
- connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this,
- SLOT( removeAllSubWindow() ) );
+ connect( m_arrayActions[CLOSE_ALL_ACT], SIGNAL( triggered() ), this, SLOT( removeAllSubWindow() ) );
m_arrayActions[TILE_WINDOWS_ACT] = new QAction( tr( "Tile" ), this );
m_arrayActions[TILE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowstile.png" ) );
@@ -506,29 +486,24 @@ Void PlaYUVerSubWindowHandle::createActions()
m_arrayActions[TILE_WINDOWS_ACT]->setShortcut( tr( "Ctrl+T" ) );
// connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), mdiArea,
// SLOT( tileSubWindows() ) );
- connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this,
- SLOT( tileSubWindows() ) );
+ connect( m_arrayActions[TILE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( tileSubWindows() ) );
m_arrayActions[CASCADE_WINDOWS_ACT] = new QAction( tr( "Cascade" ), this );
m_arrayActions[CASCADE_WINDOWS_ACT]->setIcon( QIcon( ":images/windowscascade.png" ) );
m_arrayActions[CASCADE_WINDOWS_ACT]->setStatusTip( tr( "Cascade the windows" ) );
- connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this,
- SLOT( cascadeSubWindows() ) );
+ connect( m_arrayActions[CASCADE_WINDOWS_ACT], SIGNAL( triggered() ), this, SLOT( cascadeSubWindows() ) );
m_arrayActions[NEXT_WINDOWS_ACT] = new QAction( tr( "Ne&xt" ), this );
m_arrayActions[NEXT_WINDOWS_ACT]->setShortcuts( QKeySequence::NextChild );
- m_arrayActions[NEXT_WINDOWS_ACT]->setIcon(
- QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
+ m_arrayActions[NEXT_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowRight ) ) );
m_arrayActions[NEXT_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the next window" ) );
// connect( m_arrayActions[NEXT_WINDOWS_ACT], SIGNAL( triggered() ), this,
// SLOT( activateNextSubWindow() ) );
m_arrayActions[PREVIOUS_WINDOWS_ACT] = new QAction( tr( "Pre&vious" ), this );
m_arrayActions[PREVIOUS_WINDOWS_ACT]->setShortcuts( QKeySequence::PreviousChild );
- m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon(
- QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
- m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip(
- tr( "Move the focus to the previous window" ) );
+ m_arrayActions[PREVIOUS_WINDOWS_ACT]->setIcon( QIcon( style()->standardIcon( QStyle::SP_ArrowLeft ) ) );
+ m_arrayActions[PREVIOUS_WINDOWS_ACT]->setStatusTip( tr( "Move the focus to the previous window" ) );
// connect( m_arrayActions[PREVIOUS_WINDOWS_ACT], SIGNAL( triggered() ),
// this, SLOT( activatePreviousSubWindow() ) );
@@ -598,10 +573,8 @@ Void PlaYUVerSubWindowHandle::updateMenu()
Void PlaYUVerSubWindowHandle::readSettings()
{
QSettings appSettings;
- m_cMdiModeWindowPosition =
- appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
- m_cMdiModeWindowSize =
- appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
+ m_cMdiModeWindowPosition = appSettings.value( "SubWindowManager/LastMdiPosition", QPoint( 200, 200 ) ).toPoint();
+ m_cMdiModeWindowSize = appSettings.value( "SubWindowManager/LastMdiSize", QSize( 500, 400 ) ).toSize();
Int iWindowMode = appSettings.value( "SubWindowManager/SubWindowMode", MDISUBWINDOWMODE ).toInt();
setWindowMode( iWindowMode );
m_actionGroupWindowMode->actions().at( iWindowMode )->setChecked( true );
diff --git a/app/PlotSubWindow.cpp b/app/PlotSubWindow.cpp
index f7008d5..b642481 100644
--- a/app/PlotSubWindow.cpp
+++ b/app/PlotSubWindow.cpp
@@ -44,8 +44,7 @@ Void PlotSubWindow::definePlotColors()
m_arrayColorList.append( Qt::darkYellow );
}
-PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
- : SubWindowAbstract( parent, SubWindowAbstract::PLOT_SUBWINDOW )
+PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent ) : SubWindowAbstract( parent, SubWindowAbstract::PLOT_SUBWINDOW )
{
definePlotColors();
m_iNumberPlots = 0;
@@ -94,18 +93,15 @@ PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
m_cPlotArea->yAxis2->setTickLabels( false );
// make left and bottom axes always transfer their ranges to right and top
// axes:
- connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->xAxis2,
- SLOT( setRange( QCPRange ) ) );
- connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->yAxis2,
- SLOT( setRange( QCPRange ) ) );
+ connect( m_cPlotArea->xAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->xAxis2, SLOT( setRange( QCPRange ) ) );
+ connect( m_cPlotArea->yAxis, SIGNAL( rangeChanged( QCPRange ) ), m_cPlotArea->yAxis2, SLOT( setRange( QCPRange ) ) );
QFont legendFont = font(); // start out with MainWindow's font..
legendFont.setPointSize( 9 ); // and make a bit smaller for legend
m_cPlotArea->legend->setFont( legendFont );
m_cPlotArea->legend->setBrush( backgroundBrush );
m_cPlotArea->legend->setTextColor( palette().text().color() );
- m_cPlotArea->legend->setBorderPen(
- QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
+ m_cPlotArea->legend->setBorderPen( QPen( palette().brush( QPalette::Active, QPalette::Shadow ), 1 ) );
m_cPlotArea->legend->setVisible( false );
m_cPlotArea->setInteractions( QCP::iRangeZoom | QCP::iRangeDrag ); // QCP::iSelectPlottables
@@ -192,9 +188,7 @@ Void PlotSubWindow::setAxisRange( const QLine& axisLimits )
setAxisRange( VERTICAL, axisLimits.y1(), axisLimits.y2() );
}
-Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis,
- const Int& axisStart,
- const Int& axisEnd )
+Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis, const Int& axisStart, const Int& axisEnd )
{
if( eAxis == HORIZONTAL )
{
@@ -213,9 +207,7 @@ Void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis,
m_cPlotArea->replot();
}
-Void PlotSubWindow::addPlot( const QVector& arrayX,
- const QVector& arrayY,
- const QString& key )
+Void PlotSubWindow::addPlot( const QVector& arrayX, const QVector& arrayY, const QString& key )
{
QCPGraph* newPlot = m_cPlotArea->addGraph();
QColor plotColor = m_arrayColorList.at( 0 );
diff --git a/app/PlotSubWindow.h b/app/PlotSubWindow.h
index d30931c..8dfcf15 100644
--- a/app/PlotSubWindow.h
+++ b/app/PlotSubWindow.h
@@ -84,9 +84,7 @@ public:
Void setKey( const QString& key );
- Void addPlot( const QVector& arrayX,
- const QVector& arrayY,
- const QString& key = QString() );
+ Void addPlot( const QVector& arrayX, const QVector& arrayY, const QString& key = QString() );
};
#endif // __PLOTWINDOWHANDLE_H__
diff --git a/app/ProgressBar.cpp b/app/ProgressBar.cpp
index 237e7c9..6b981db 100644
--- a/app/ProgressBar.cpp
+++ b/app/ProgressBar.cpp
@@ -29,8 +29,7 @@
#include
#include
-ProgressBar::ProgressBar( QWidget* parent, UInt maxValue )
- : QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 )
+ProgressBar::ProgressBar( QWidget* parent, UInt maxValue ) : QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 )
{
QVBoxLayout* mainLayout = new QVBoxLayout( this );
m_pcProgressBar = new QProgressBar;
diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp
index c0cdee3..9d9fcdf 100644
--- a/app/QualityHandle.cpp
+++ b/app/QualityHandle.cpp
@@ -34,8 +34,7 @@
#include "QtConcurrent/qtconcurrentrun.h"
#endif
-QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
- : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
+QualityHandle::QualityHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager ) : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
{
}
@@ -61,15 +60,12 @@ Void QualityHandle::createActions()
m_arrayActions.resize( TOTAL_ACT );
m_arrayActions[SELECT_CURR_REF_ACT] = new QAction( "Mark as Reference", this );
- connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this,
- SLOT( slotSelectCurrentAsReference() ) );
+ connect( m_arrayActions[SELECT_CURR_REF_ACT], SIGNAL( triggered() ), this, SLOT( slotSelectCurrentAsReference() ) );
m_arrayActions[PLOT_QUALITY] = new QAction( "Plot Window's Quality", this );
- connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this,
- SLOT( slotPlotQualitySingle() ) );
+ connect( m_arrayActions[PLOT_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySingle() ) );
m_arrayActions[PLOT_SEVERAL_QUALITY] = new QAction( "Plot Several Quality", this );
- connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this,
- SLOT( slotPlotQualitySeveral() ) );
+ connect( m_arrayActions[PLOT_SEVERAL_QUALITY], SIGNAL( triggered() ), this, SLOT( slotPlotQualitySeveral() ) );
}
QMenu* QualityHandle::createMenu()
@@ -91,10 +87,8 @@ QDockWidget* QualityHandle::createDock()
m_pcQualityHandleDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
m_pcQualityHandleDock->setWidget( m_pcQualityHandleSideBar );
- connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged( int ) ), this,
- SLOT( slotQualityMetricChanged( int ) ) );
- connect( m_mapperQualityMetric, SIGNAL( mapped( int ) ), this,
- SLOT( slotQualityMetricChanged( int ) ) );
+ connect( m_pcQualityHandleSideBar, SIGNAL( signalQualityMetricChanged( int ) ), this, SLOT( slotQualityMetricChanged( int ) ) );
+ connect( m_mapperQualityMetric, SIGNAL( mapped( int ) ), this, SLOT( slotQualityMetricChanged( int ) ) );
slotQualityMetricChanged( 0 );
@@ -103,8 +97,7 @@ QDockWidget* QualityHandle::createDock()
Void QualityHandle::updateMenus()
{
- VideoSubWindow* pcCurrentVideoSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcCurrentVideoSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcCurrentVideoSubWindow ? true : false;
Bool hasReference = false;
Bool isReference = false;
@@ -115,8 +108,7 @@ Void QualityHandle::updateMenus()
if( hasSubWindow && !hasReference )
{
VideoSubWindow* pcVideoSubWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -199,8 +191,7 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
for( UInt i = 0; i < numberOfWindows; i++ )
{
pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
- padQualityValues[i + 1].append(
- pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, LUMA ) );
+ padQualityValues[i + 1].append( pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, LUMA ) );
apcWindowList.at( i )->seekRelativeEvent( true );
}
pcReferenceWindow->seekRelativeEvent( true );
@@ -218,9 +209,7 @@ Void QualityHandle::measureQuality( QVector apcWindowList )
plotWindowTitle += " - " + apcWindowList.at( 0 )->getWindowName();
}
PlotSubWindow* pcPlotWindow = new PlotSubWindow( plotWindowTitle );
- pcPlotWindow->setAxisName(
- "Frame Number",
- QString::fromStdString( PlaYUVerFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
+ pcPlotWindow->setAxisName( "Frame Number", QString::fromStdString( PlaYUVerFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
if( apcWindowList.size() > 1 )
{
@@ -252,13 +241,11 @@ Void QualityHandle::slotQualityMetricChanged( Int idx )
Void QualityHandle::slotSelectCurrentAsReference()
{
- VideoSubWindow* pcRefSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcRefSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcRefSubWindow )
{
VideoSubWindow* pcVideoSubWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -273,8 +260,7 @@ Void QualityHandle::slotSelectCurrentAsReference()
Void QualityHandle::slotPlotQualitySingle()
{
- VideoSubWindow* pcSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcSubWindow )
{
if( pcSubWindow->getRefSubWindow() )
@@ -298,8 +284,7 @@ Void QualityHandle::slotPlotQualitySingle()
Void QualityHandle::slotPlotQualitySeveral()
{
- VideoSubWindow* pcSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
if( pcSubWindow )
{
QVector apcWindowList;
@@ -311,8 +296,7 @@ Void QualityHandle::slotPlotQualitySeveral()
}
VideoSubWindow* pcVideoSubWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
diff --git a/app/QualityMeasurementSidebar.cpp b/app/QualityMeasurementSidebar.cpp
index 73d865a..f4d1555 100644
--- a/app/QualityMeasurementSidebar.cpp
+++ b/app/QualityMeasurementSidebar.cpp
@@ -27,8 +27,7 @@
#include "VideoSubWindow.h"
#include
-QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent,
- PlaYUVerSubWindowHandle* windowManager )
+QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
: QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL )
{
// Side bar area -----------------------------------------------------
@@ -99,8 +98,7 @@ QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent,
setLayout( mainLayout );
connect( m_comboBoxRef, SIGNAL( activated( int ) ), this, SLOT( slotReferenceChanged( int ) ) );
- connect( m_comboBoxMetric, SIGNAL( currentIndexChanged( int ) ), this,
- SLOT( slotQualityMetricChanged( int ) ) );
+ connect( m_comboBoxMetric, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotQualityMetricChanged( int ) ) );
}
QualityMeasurementSidebar::~QualityMeasurementSidebar() {}
@@ -129,8 +127,7 @@ Void QualityMeasurementSidebar::updateSubWindowList()
m_pcVideoWindowList.clear();
VideoSubWindow* pcVideoSubWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
pcVideoSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -140,8 +137,7 @@ Void QualityMeasurementSidebar::updateSubWindowList()
}
if( m_pcCurrentVideoSubWindow )
{
- if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt(
- pcVideoSubWindow->getCurrFrame() ) )
+ if( !m_pcCurrentVideoSubWindow->getCurrFrame()->haveSameFmt( pcVideoSubWindow->getCurrFrame() ) )
{
continue;
}
diff --git a/app/SeekStreamDialog.cpp b/app/SeekStreamDialog.cpp
index b8c4bbb..83ac1e6 100644
--- a/app/SeekStreamDialog.cpp
+++ b/app/SeekStreamDialog.cpp
@@ -57,8 +57,7 @@ SeekStreamDialog::SeekStreamDialog( PlaYUVerStream* pcCurrStream, QWidget* paren
QVBoxLayout* verticalLayout = new QVBoxLayout;
QHBoxLayout* horizontalLayout = new QHBoxLayout;
horizontalLayout->addWidget( pcLabel );
- horizontalLayout->addItem(
- new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ horizontalLayout->addItem( new QSpacerItem( 20, 10, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
horizontalLayout->addWidget( m_spinFrameNum );
verticalLayout->addLayout( horizontalLayout );
verticalLayout->addWidget( dialogButtonOkCancel, Qt::AlignRight );
diff --git a/app/SubWindowAbstract.cpp b/app/SubWindowAbstract.cpp
index 429097a..b4e5d38 100644
--- a/app/SubWindowAbstract.cpp
+++ b/app/SubWindowAbstract.cpp
@@ -30,8 +30,7 @@
#include
#include
-SubWindowAbstract::SubWindowAbstract( QWidget* parent, UInt category )
- : QWidget( parent ), m_cSubWindow( NULL )
+SubWindowAbstract::SubWindowAbstract( QWidget* parent, UInt category ) : QWidget( parent ), m_cSubWindow( NULL )
{
setParent( parent );
setVisible( false );
diff --git a/app/VideoHandle.cpp b/app/VideoHandle.cpp
index 29ee4ce..55ef8b9 100644
--- a/app/VideoHandle.cpp
+++ b/app/VideoHandle.cpp
@@ -41,14 +41,13 @@
#include
#endif
-VideoHandle::VideoHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager )
- : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
+VideoHandle::VideoHandle( QWidget* parent, PlaYUVerSubWindowHandle* windowManager ) : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
{
m_pcCurrentVideoSubWindow = NULL;
m_bIsPlaying = false;
m_pcPlayingTimer = new QTimer;
#if( QT_VERSION_PLAYUVER == 5 )
- m_pcPlayingTimer->setTimerType( Qt::CoarseTimer );
+ m_pcPlayingTimer->setTimerType( Qt::VeryCoarseTimer );
#endif
connect( m_pcPlayingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
m_acPlayingSubWindows.clear();
@@ -61,15 +60,13 @@ Void VideoHandle::createActions()
m_arrayActions.resize( TOTAL_ACT );
m_arrayActions[PLAY_ACT] = new QAction( "Play", this );
m_arrayActions[PLAY_ACT]->setStatusTip( "Play/Pause" );
- m_arrayActions[PLAY_ACT]->setIcon(
- QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPlay ) ) );
+ m_arrayActions[PLAY_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPlay ) ) );
m_arrayActions[PLAY_ACT]->setShortcut( Qt::Key_Space );
connect( m_arrayActions[PLAY_ACT], SIGNAL( triggered() ), this, SLOT( play() ) );
m_arrayActions[STOP_ACT] = new QAction( "Stop", this );
m_arrayActions[STOP_ACT]->setStatusTip( "Stop" );
- m_arrayActions[STOP_ACT]->setIcon(
- QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaStop ) ) );
+ m_arrayActions[STOP_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaStop ) ) );
connect( m_arrayActions[STOP_ACT], SIGNAL( triggered() ), this, SLOT( stop() ) );
m_mapperVideoSeek = new QSignalMapper( this );
@@ -77,20 +74,16 @@ Void VideoHandle::createActions()
m_arrayActions[VIDEO_BACKWARD_ACT] = new QAction( "Video Backward", this );
m_arrayActions[VIDEO_BACKWARD_ACT]->setStatusTip( "Seek backward" );
- m_arrayActions[VIDEO_BACKWARD_ACT]->setIcon(
- QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) );
+ m_arrayActions[VIDEO_BACKWARD_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekBackward ) ) );
m_arrayActions[VIDEO_BACKWARD_ACT]->setShortcut( Qt::Key_Left );
- connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek,
- SLOT( map() ) );
+ connect( m_arrayActions[VIDEO_BACKWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) );
m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_BACKWARD_ACT], 0 );
m_arrayActions[VIDEO_FORWARD_ACT] = new QAction( "Video Forward", this );
m_arrayActions[VIDEO_FORWARD_ACT]->setStatusTip( "Seek forward" );
- m_arrayActions[VIDEO_FORWARD_ACT]->setIcon(
- QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
+ m_arrayActions[VIDEO_FORWARD_ACT]->setIcon( QIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaSeekForward ) ) );
m_arrayActions[VIDEO_FORWARD_ACT]->setShortcut( Qt::Key_Right );
- connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek,
- SLOT( map() ) );
+ connect( m_arrayActions[VIDEO_FORWARD_ACT], SIGNAL( triggered() ), m_mapperVideoSeek, SLOT( map() ) );
m_mapperVideoSeek->setMapping( m_arrayActions[VIDEO_FORWARD_ACT], 1 );
m_arrayActions[VIDEO_GOTO_ACT] = new QAction( "Go to", this );
@@ -114,14 +107,12 @@ Void VideoHandle::createActions()
m_arrayActions[VIDEO_LOCK_SELECTION_ACT]->setStatusTip(
"Select which windows should be played synchronized. Press Ctrl while "
"click to quickly to select all!" );
- connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this,
- SLOT( videoSelectionButtonEvent() ) );
+ connect( m_arrayActions[VIDEO_LOCK_SELECTION_ACT], SIGNAL( triggered() ), this, SLOT( videoSelectionButtonEvent() ) );
m_pcFrameSlider = new QSlider;
m_pcFrameSlider->setOrientation( Qt::Horizontal );
m_pcFrameSlider->setMaximumWidth( 2000 );
- m_pcFrameSlider->setSizePolicy(
- QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
+ m_pcFrameSlider->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ) );
m_pcFrameSlider->setEnabled( false );
m_pcFrameSlider->setTracking( false );
connect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this, SLOT( seekSliderEvent( int ) ) );
@@ -140,8 +131,7 @@ Void VideoHandle::createActions()
m_arrayActions[NAVIGATION_TOOL_ACT]->setChecked( true );
m_arrayActions[NAVIGATION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_1 );
actionGroupTools->addAction( m_arrayActions[NAVIGATION_TOOL_ACT] );
- connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
- SLOT( map() ) );
+ connect( m_arrayActions[NAVIGATION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
m_mapperTools->setMapping( m_arrayActions[NAVIGATION_TOOL_ACT], ViewArea::NavigationView );
m_arrayActions[SELECTION_TOOL_ACT] = new QAction( "Selection Tool", this );
@@ -149,8 +139,7 @@ Void VideoHandle::createActions()
m_arrayActions[SELECTION_TOOL_ACT]->setChecked( false );
m_arrayActions[SELECTION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_2 );
actionGroupTools->addAction( m_arrayActions[SELECTION_TOOL_ACT] );
- connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
- SLOT( map() ) );
+ connect( m_arrayActions[SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
m_mapperTools->setMapping( m_arrayActions[SELECTION_TOOL_ACT], ViewArea::NormalSelectionView );
m_arrayActions[BLOCK_SELECTION_TOOL_ACT] = new QAction( "Block Selection Tool", this );
@@ -158,16 +147,13 @@ Void VideoHandle::createActions()
m_arrayActions[BLOCK_SELECTION_TOOL_ACT]->setChecked( false );
m_arrayActions[BLOCK_SELECTION_TOOL_ACT]->setShortcut( Qt::CTRL + Qt::Key_3 );
actionGroupTools->addAction( m_arrayActions[BLOCK_SELECTION_TOOL_ACT] );
- connect( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools,
- SLOT( map() ) );
- m_mapperTools->setMapping( m_arrayActions[BLOCK_SELECTION_TOOL_ACT],
- ViewArea::BlockSelectionView );
+ connect( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], SIGNAL( triggered() ), m_mapperTools, SLOT( map() ) );
+ m_mapperTools->setMapping( m_arrayActions[BLOCK_SELECTION_TOOL_ACT], ViewArea::BlockSelectionView );
m_arrayActions[SHOW_GRID_ACT] = new QAction( "Show grid", this );
m_arrayActions[SHOW_GRID_ACT]->setCheckable( true );
m_arrayActions[SHOW_GRID_ACT]->setChecked( false );
- connect( m_arrayActions[SHOW_GRID_ACT], SIGNAL( toggled( bool ) ), this,
- SLOT( toggleGrid( bool ) ) );
+ connect( m_arrayActions[SHOW_GRID_ACT], SIGNAL( toggled( bool ) ), this, SLOT( toggleGrid( bool ) ) );
}
QMenu* VideoHandle::createVideoMenu()
@@ -255,8 +241,7 @@ QWidget* VideoHandle::createStatusBarMessage()
Void VideoHandle::updateMenus()
{
- VideoSubWindow* pcSubWindow =
- qobject_cast( m_pcMainWindowManager->activeSubWindow() );
+ VideoSubWindow* pcSubWindow = qobject_cast( m_pcMainWindowManager->activeSubWindow() );
Bool hasSubWindow = pcSubWindow ? true : false;
m_arrayActions[PLAY_ACT]->setEnabled( hasSubWindow );
@@ -271,8 +256,7 @@ Void VideoHandle::updateMenus()
m_pcFrameSlider->setEnabled( hasSubWindow );
if( !hasSubWindow )
{
- disconnect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this,
- SLOT( seekSliderEvent( int ) ) );
+ disconnect( m_pcFrameSlider, SIGNAL( valueChanged( int ) ), this, SLOT( seekSliderEvent( int ) ) );
m_pcFrameSlider->setValue( 0 );
m_pcFrameNumInfo->clear();
}
@@ -290,10 +274,8 @@ Void VideoHandle::updateMenus()
Void VideoHandle::readSettings()
{
QSettings appSettings;
- m_arrayActions[VIDEO_REPEAT_ACT]->setChecked(
- appSettings.value( "VideoHandle/Repeat", false ).toBool() );
- m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked(
- appSettings.value( "VideoHandle/VideoZoomLock", false ).toBool() );
+ m_arrayActions[VIDEO_REPEAT_ACT]->setChecked( appSettings.value( "VideoHandle/Repeat", false ).toBool() );
+ m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->setChecked( appSettings.value( "VideoHandle/VideoZoomLock", false ).toBool() );
if( !appSettings.value( "VideoHandle/FrameProperties", true ).toBool() )
m_pcFramePropertiesDock->close();
@@ -305,8 +287,7 @@ Void VideoHandle::writeSettings()
{
QSettings appSettings;
appSettings.setValue( "VideoHandle/Repeat", m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() );
- appSettings.setValue( "VideoHandle/VideoZoomLock",
- m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() );
+ appSettings.setValue( "VideoHandle/VideoZoomLock", m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() );
appSettings.setValue( "VideoHandle/FrameProperties", m_pcFramePropertiesSideBar->isVisible() );
appSettings.setValue( "VideoHandle/SelectedTool", m_uiViewTool );
}
@@ -326,8 +307,7 @@ Void VideoHandle::update()
QString resolution;
if( pcFrame )
{
- resolution.append(
- QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
+ resolution.append( QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
}
if( pcStream )
@@ -366,8 +346,7 @@ Void VideoHandle::update()
if( m_pcCurrentVideoSubWindow->isPlaying() )
{
m_arrayActions[PLAY_ACT]->setText( "Pause" );
- m_arrayActions[PLAY_ACT]->setIcon(
- m_pcParet->style()->standardIcon( QStyle::SP_MediaPause ) );
+ m_arrayActions[PLAY_ACT]->setIcon( m_pcParet->style()->standardIcon( QStyle::SP_MediaPause ) );
}
else
{
@@ -401,8 +380,7 @@ Void VideoHandle::updateSelectionArea( QRect area )
Void VideoHandle::openSubWindow( VideoSubWindow* subWindow )
{
- connect( subWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this,
- SLOT( updateSelectionArea( QRect ) ) );
+ connect( subWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectionArea( QRect ) ) );
subWindow->getViewArea()->setTool( m_uiViewTool );
subWindow->getViewArea()->setGridVisible( m_arrayActions[SHOW_GRID_ACT]->isChecked() );
}
@@ -432,8 +410,7 @@ Void VideoHandle::zoomToFactorAll( const Double scale, const QPoint center )
factor = m_pcCurrentVideoSubWindow->getScaleFactor();
SubWindowAbstract* subWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
subWindow = subWindowList.at( i );
@@ -453,8 +430,7 @@ Void VideoHandle::moveAllScrollBars( const QPoint offset )
if( m_arrayActions[VIDEO_ZOOM_LOCK_ACT]->isChecked() && m_pcCurrentVideoSubWindow )
{
VideoSubWindow* videoSubWindow;
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
QScrollBar* scrollBar;
scrollBar = m_pcCurrentVideoSubWindow->getScroll()->horizontalScrollBar();
@@ -538,8 +514,7 @@ Void VideoHandle::setTimerStatus()
#if( _CONTROL_PLAYING_TIME_ == 1 )
if( m_pcPlayControlTimer && m_pcPlayingTimer->interval() > 0 )
{
- qDebug() << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval()
- << "Real Fps: " << 1000 / m_dAverageFps;
+ qDebug() << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval() << "Real Fps: " << 1000 / m_dAverageFps;
delete m_pcPlayControlTimer;
m_pcPlayControlTimer = NULL;
@@ -627,9 +602,7 @@ Void VideoHandle::playEvent()
{
Bool bEndOfSequence = false;
#if( _CONTROL_PLAYING_TIME_ == 1 )
- m_dAverageFps =
- Double( m_dAverageFps * m_uiNumberPlayedFrames + m_pcPlayControlTimer->elapsed() ) /
- Double( m_uiNumberPlayedFrames + 1 );
+ m_dAverageFps = Double( m_dAverageFps * m_uiNumberPlayedFrames + m_pcPlayControlTimer->elapsed() ) / Double( m_uiNumberPlayedFrames + 1 );
m_uiNumberPlayedFrames++;
m_pcPlayControlTimer->restart();
#endif
@@ -650,9 +623,8 @@ Void VideoHandle::playEvent()
}
catch( const char* msg )
{
- QString warningMsg = "Error while playing " +
- QFileInfo( m_pcCurrentVideoSubWindow->getCurrentFileName() ).fileName() +
- " with the following error: \n" + msg;
+ QString warningMsg =
+ "Error while playing " + QFileInfo( m_pcCurrentVideoSubWindow->getCurrentFileName() ).fileName() + " with the following error: \n" + msg;
QMessageBox::warning( m_pcParet, QApplication::applicationName(), warningMsg );
qDebug() << warningMsg;
stop();
@@ -667,9 +639,7 @@ Void VideoHandle::seekEvent( Int direction )
{
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
{
- if( !( ( UInt )( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >=
- getMaxFrameNumber() &&
- direction > 0 ) )
+ if( !( ( UInt )( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() && direction > 0 ) )
{
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
{
@@ -692,8 +662,7 @@ Void VideoHandle::seekVideo()
{
if( m_pcCurrentVideoSubWindow->getInputStream() )
{
- SeekStreamDialog* dialogSeekVideo =
- new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), m_pcParet );
+ SeekStreamDialog* dialogSeekVideo = new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), m_pcParet );
Int newFrameNum = dialogSeekVideo->runDialog();
if( newFrameNum >= 0 )
{
@@ -741,8 +710,7 @@ Void VideoHandle::videoSelectionButtonEvent()
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
if( keyModifiers & Qt::ControlModifier )
{
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
videoSubWindow = qobject_cast( subWindowList.at( i ) );
@@ -751,8 +719,7 @@ Void VideoHandle::videoSelectionButtonEvent()
}
else
{
- DialogSubWindowSelector dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
- SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
+ DialogSubWindowSelector dialogWindowsSelection( m_pcParet, m_pcMainWindowManager, SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
QStringList cWindowListNames;
for( Int i = 0; i < m_acPlayingSubWindows.size(); i++ )
{
@@ -800,8 +767,7 @@ Void VideoHandle::setTool( Int tool )
{
m_uiViewTool = tool;
actionGroupTools->actions().at( m_uiViewTool )->setChecked( true );
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
qobject_cast( subWindowList.at( i ) )->getViewArea()->setTool( m_uiViewTool );
@@ -810,12 +776,9 @@ Void VideoHandle::setTool( Int tool )
Void VideoHandle::toggleGrid( Bool checked )
{
- QList subWindowList =
- m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
+ QList subWindowList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
for( Int i = 0; i < subWindowList.size(); i++ )
{
- qobject_cast( subWindowList.at( i ) )
- ->getViewArea()
- ->setGridVisible( checked );
+ qobject_cast( subWindowList.at( i ) )->getViewArea()->setGridVisible( checked );
}
}
diff --git a/app/VideoHandle.h b/app/VideoHandle.h
index 2d72e6c..aa5cd5d 100644
--- a/app/VideoHandle.h
+++ b/app/VideoHandle.h
@@ -34,7 +34,7 @@
#include
#include
-#define _CONTROL_PLAYING_TIME_ 0
+#define _CONTROL_PLAYING_TIME_ 1
class QToolBar;
class QDockWidget;
diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp
index 6f84f19..d715a78 100644
--- a/app/VideoSubWindow.cpp
+++ b/app/VideoSubWindow.cpp
@@ -43,8 +43,8 @@ QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array
for( Int i = 0; i < array.size(); i++ )
{
d = array.at( i );
- out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel
- << d.m_iEndianness << d.m_uiFrameRate << d.m_uiFileSize;
+ out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness << d.m_uiFrameRate
+ << d.m_uiFileSize;
}
return out;
}
@@ -125,8 +125,7 @@ protected:
if( m_bBusyWindow )
{
painter.setFont( m_cCenterTextFont );
- painter.drawText( rect(), Qt::AlignHCenter | Qt::AlignVCenter,
- QStringLiteral( "Refreshing..." ) );
+ painter.drawText( rect(), Qt::AlignHCenter | Qt::AlignVCenter, QStringLiteral( "Refreshing..." ) );
painter.fillRect( rect(), QBrush( QColor::fromRgb( 255, 255, 255, 50 ), Qt::SolidPattern ) );
}
}
@@ -143,27 +142,19 @@ VideoSubWindow::VideoSubWindow( enum VideoSubWindowCategories category, QWidget*
{
// Create a new scroll area inside the sub-window
m_pcScrollArea = new QScrollArea;
- connect( m_pcScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this,
- SLOT( updateCurScrollValues() ) );
- connect( m_pcScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this,
- SLOT( updateCurScrollValues() ) );
+ connect( m_pcScrollArea->horizontalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
+ connect( m_pcScrollArea->verticalScrollBar(), SIGNAL( actionTriggered( int ) ), this, SLOT( updateCurScrollValues() ) );
// Create a new interface to show images
m_cViewArea = new ViewArea;
- connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this,
- SLOT( adjustScrollBarByScale( double, QPoint ) ) );
- connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this,
- SIGNAL( zoomFactorChanged_SWindow( double, QPoint ) ) );
+ connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this, SLOT( adjustScrollBarByScale( double, QPoint ) ) );
+ connect( m_cViewArea, SIGNAL( zoomFactorChanged_byWheel( double, QPoint ) ), this, SIGNAL( zoomFactorChanged_SWindow( double, QPoint ) ) );
- connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this,
- SLOT( adjustScrollBarByOffset( QPoint ) ) );
- connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this,
- SIGNAL( scrollBarMoved_SWindow( QPoint ) ) );
+ connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SLOT( adjustScrollBarByOffset( QPoint ) ) );
+ connect( m_cViewArea, SIGNAL( scrollBarMoved( QPoint ) ), this, SIGNAL( scrollBarMoved_SWindow( QPoint ) ) );
- connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this,
- SLOT( updateSelectedArea( QRect ) ) );
- connect( m_cViewArea, SIGNAL( positionChanged( const QPoint& ) ), this,
- SLOT( updatePixelValueStatusBar( const QPoint& ) ) );
+ connect( m_cViewArea, SIGNAL( selectionChanged( QRect ) ), this, SLOT( updateSelectedArea( QRect ) ) );
+ connect( m_cViewArea, SIGNAL( positionChanged( const QPoint& ) ), this, SLOT( updatePixelValueStatusBar( const QPoint& ) ) );
m_pcScrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
m_pcScrollArea->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
@@ -318,30 +309,29 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
if( guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog )
{
- if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height,
- InputFormat, BitsPel, Endianness,
- FrameRate ) == QDialog::Rejected )
+ if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate ) ==
+ QDialog::Rejected )
{
return false;
}
}
- try
- {
- m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness,
- FrameRate, true );
- }
- catch( ... )
- {
- if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height,
- InputFormat, BitsPel, Endianness,
- FrameRate ) == QDialog::Rejected )
- {
- return false;
- }
- m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness,
- FrameRate, true );
- }
+ // try
+ // {
+ m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true );
+ // }
+ // catch( ... )
+ // {
+ // if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height,
+ // InputFormat, BitsPel, Endianness,
+ // FrameRate ) == QDialog::Rejected )
+ // {
+ // return false;
+ // }
+ // m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel,
+ // Endianness,
+ // FrameRate, true );
+ // }
m_sStreamInfo.m_cFilename = cFilename;
m_sStreamInfo.m_uiWidth = Width;
@@ -370,10 +360,8 @@ Bool VideoSubWindow::loadFile( PlaYUVerStreamInfo* streamInfo )
m_pCurrStream = new PlaYUVerStream;
}
- if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth,
- streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
- streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness,
- streamInfo->m_uiFrameRate, true ) )
+ if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat,
+ streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness, streamInfo->m_uiFrameRate, true ) )
{
return false;
}
@@ -404,8 +392,7 @@ Void VideoSubWindow::updateVideoWindowInfo()
{
if( arraySubWindows.at( i )->getWindowName() != getWindowName() )
{
- sourceWindowList.append(
- QString( "Input %1 - " + arraySubWindows.at( i )->getWindowName() ).arg( i + 1 ) );
+ sourceWindowList.append( QString( "Input %1 - " + arraySubWindows.at( i )->getWindowName() ).arg( i + 1 ) );
}
}
}
@@ -434,12 +421,7 @@ Void VideoSubWindow::updateVideoWindowInfo()
}
}
-Bool VideoSubWindow::guessFormat( QString filename,
- UInt& rWidth,
- UInt& rHeight,
- Int& rInputFormat,
- UInt& rBitsPerPixel,
- Int& rEndianness )
+Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel, Int& rEndianness )
{
std::vector stdResList = PlaYUVerStream::stdResolutionSizes();
Bool bGuessed = true;
@@ -451,13 +433,11 @@ Bool VideoSubWindow::guessFormat( QString filename,
{
return false;
}
- if( !fileExtension.compare( "yuv" ) || !fileExtension.compare( "rgb" ) ||
- !fileExtension.compare( "gray" ) )
+ if( !fileExtension.compare( "yuv" ) || !fileExtension.compare( "rgb" ) || !fileExtension.compare( "gray" ) )
{
bGuessed = false;
// Guess pixel format
- QVector formats_list =
- QVector::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() );
+ QVector formats_list = QVector::fromStdVector( PlaYUVerFrame::supportedPixelFormatListNames() );
for( Int i = 0; i < formats_list.size(); i++ )
{
if( FilenameShort.contains( formats_list.at( i ).c_str(), Qt::CaseInsensitive ) )
@@ -486,8 +466,7 @@ Bool VideoSubWindow::guessFormat( QString filename,
#if( QT_VERSION_PLAYUVER == 5 )
// Guess resolution - match %dx%d
- QRegularExpressionMatch resolutionMatch =
- QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
+ QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
if( resolutionMatch.hasMatch() )
{
QString resolutionString = resolutionMatch.captured( 0 );
@@ -518,8 +497,7 @@ Bool VideoSubWindow::guessFormat( QString filename,
Int count = 0, module, frame_bytes, match;
for( UInt i = 0; i < stdResList.size(); i++ )
{
- frame_bytes = PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth,
- stdResList[i].uiHeight, rInputFormat, 8 );
+ frame_bytes = PlaYUVerFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
module = uiFileSize % frame_bytes;
if( module == 0 )
{
@@ -641,16 +619,16 @@ Void VideoSubWindow::associateModule( PlaYUVerAppModuleIf* pcModule )
Bool VideoSubWindow::hasRunningModule()
{
- Bool bRet = false;
+ Bool bRet = false;
if( m_pcCurrentDisplayModule )
{
- bRet |= m_pcCurrentDisplayModule->isRunning();
+ bRet |= m_pcCurrentDisplayModule->isRunning();
}
- for( Int i = 0; i < m_apcCurrentModule.size() && !bRet; i++ )
+ for( Int i = 0; i < m_apcCurrentModule.size() && !bRet; i++ )
{
- bRet |= m_apcCurrentModule.at( i )->isRunning();
+ bRet |= m_apcCurrentModule.at( i )->isRunning();
}
- return bRet;
+ return bRet;
}
Void VideoSubWindow::setFillWindow( Bool bFlag )
@@ -717,8 +695,7 @@ Bool VideoSubWindow::goToNextFrame( Bool bThreaded )
if( bThreaded )
{
refreshFrame();
- m_cReadResult =
- QtConcurrent::run( m_pCurrStream, &PlaYUVerStream::readNextFrameFillRGBBuffer );
+ m_cReadResult = QtConcurrent::run( m_pCurrStream, &PlaYUVerStream::readNextFrameFillRGBBuffer );
}
else
#endif
@@ -738,8 +715,7 @@ Bool VideoSubWindow::save( QString filename )
PlaYUVerFrame* saveFrame = m_pcCurrFrame;
if( m_cSelectedArea.isValid() )
{
- saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(),
- m_cSelectedArea.width(), m_cSelectedArea.height() );
+ saveFrame = new PlaYUVerFrame( m_pcCurrFrame, m_cSelectedArea.x(), m_cSelectedArea.y(), m_cSelectedArea.width(), m_cSelectedArea.height() );
}
if( !saveFrame )
{
@@ -815,8 +791,7 @@ Void VideoSubWindow::stop()
QSize VideoSubWindow::getScrollSize()
{
- return QSize( m_pcScrollArea->viewport()->size().width() - 5,
- m_pcScrollArea->viewport()->size().height() - 5 );
+ return QSize( m_pcScrollArea->viewport()->size().width() - 5, m_pcScrollArea->viewport()->size().height() - 5 );
}
Void VideoSubWindow::adjustScrollBarByOffset( QPoint Offset )
@@ -857,8 +832,7 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
scrollBarH = m_pcScrollArea->horizontalScrollBar();
if( center.isNull() )
{
- m_cCurrScroll.setX(
- int( scale * cLastScroll.x() + ( ( scale - 1 ) * scrollBarH->pageStep() / 2 ) ) );
+ m_cCurrScroll.setX( int( scale * cLastScroll.x() + ( ( scale - 1 ) * scrollBarH->pageStep() / 2 ) ) );
}
else
{
@@ -874,8 +848,7 @@ Void VideoSubWindow::adjustScrollBarByScale( Double scale, QPoint center )
scrollBarV = m_pcScrollArea->verticalScrollBar();
if( center.isNull() )
{
- m_cCurrScroll.setY(
- int( scale * cLastScroll.y() + ( ( scale - 1 ) * scrollBarV->pageStep() / 2 ) ) );
+ m_cCurrScroll.setY( int( scale * cLastScroll.y() + ( ( scale - 1 ) * scrollBarV->pageStep() / 2 ) ) );
}
else
{
@@ -1008,19 +981,13 @@ Void VideoSubWindow::updatePixelValueStatusBar( const QPoint& pos )
if( ColorSpace == PlaYUVerPixel::COLOR_YUV )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
- strStatus.append( QString( "Y: %1 U: %2 V: %3" )
- .arg( sPixelValue.Y() )
- .arg( sPixelValue.Cb() )
- .arg( sPixelValue.Cr() ) );
+ strStatus.append( QString( "Y: %1 U: %2 V: %3" ).arg( sPixelValue.Y() ).arg( sPixelValue.Cb() ).arg( sPixelValue.Cr() ) );
}
if( ( ColorSpace == PlaYUVerPixel::COLOR_RGB ) )
{
sPixelValue = m_pcCurrFrame->getPixelValue( pos.x(), pos.y() );
- strStatus.append( QString( "R: %1 G: %2 B: %3" )
- .arg( sPixelValue.R() )
- .arg( sPixelValue.G() )
- .arg( sPixelValue.B() ) );
+ strStatus.append( QString( "R: %1 G: %2 B: %3" ).arg( sPixelValue.R() ).arg( sPixelValue.G() ).arg( sPixelValue.B() ) );
}
emit updateStatusBar( strStatus );
}
diff --git a/app/VideoSubWindow.h b/app/VideoSubWindow.h
index 1b08e8a..cbc5611 100644
--- a/app/VideoSubWindow.h
+++ b/app/VideoSubWindow.h
@@ -186,12 +186,7 @@ private:
Void refreshFrameOperation();
Bool goToNextFrame( Bool bThreaded = false );
- static Bool guessFormat( QString filename,
- UInt& rWidth,
- UInt& rHeight,
- Int& rInputFormat,
- UInt& rBitsPerPixel,
- Int& rEndianness );
+ static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel, Int& rEndianness );
Bool hasRunningModule();
diff --git a/app/ViewArea.cpp b/app/ViewArea.cpp
index 04ee252..8ab9dbb 100644
--- a/app/ViewArea.cpp
+++ b/app/ViewArea.cpp
@@ -72,8 +72,7 @@ Void ViewArea::setImage( PlaYUVerFrame* pcFrame )
m_pcCurrFrame = pcFrame;
m_uiPixelHalfScale = 1 << ( m_pcCurrFrame->getBitsPel() - 1 );
m_pcCurrFrame->fillRGBBuffer();
- QImage qimg = QImage( m_pcCurrFrame->getRGBBuffer(), m_pcCurrFrame->getWidth(),
- m_pcCurrFrame->getHeight(), QImage::Format_RGB32 );
+ QImage qimg = QImage( m_pcCurrFrame->getRGBBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(), QImage::Format_RGB32 );
setImage( QPixmap::fromImage( qimg ) );
}
@@ -439,8 +438,7 @@ Void ViewArea::paintEvent( QPaintEvent* event )
// That gives us the part of the pixmap that has actually been exposed.
// See:
// http://blog.qt.digia.com/blog/2006/05/13/fast-transformed-pixmapimage-drawing/
- QRect exposedRect =
- paInter.worldTransform().inverted().mapRect( event->rect() ).adjusted( -1, -1, 1, 1 );
+ QRect exposedRect = paInter.worldTransform().inverted().mapRect( event->rect() ).adjusted( -1, -1, 1, 1 );
// Draw the pixmap.
paInter.drawPixmap( exposedRect, m_pixmap, exposedRect );
@@ -514,8 +512,7 @@ Void ViewArea::paintEvent( QPaintEvent* event )
paInter.setPen( QColor( Qt::black ) );
paInter.drawText( pixelRect, Qt::AlignCenter,
- "Y: " + QString::number( sPixelValue.Y() ) + "\n" +
- "U: " + QString::number( sPixelValue.Cb() ) + "\n" +
+ "Y: " + QString::number( sPixelValue.Y() ) + "\n" + "U: " + QString::number( sPixelValue.Cb() ) + "\n" +
"V: " + QString::number( sPixelValue.Cr() ) );
}
if( frFormat == PlaYUVerPixel::COLOR_GRAY )
@@ -527,8 +524,7 @@ Void ViewArea::paintEvent( QPaintEvent* event )
else
paInter.setPen( QColor( Qt::black ) );
- paInter.drawText( pixelRect, Qt::AlignCenter,
- "Y: " + QString::number( sPixelValue.Y() ) );
+ paInter.drawText( pixelRect, Qt::AlignCenter, "Y: " + QString::number( sPixelValue.Y() ) );
}
if( ( frFormat == PlaYUVerPixel::COLOR_RGB ) )
@@ -541,8 +537,7 @@ Void ViewArea::paintEvent( QPaintEvent* event )
paInter.setPen( QColor( Qt::black ) );
paInter.drawText( pixelRect, Qt::AlignCenter,
- "R: " + QString::number( sPixelValue.R() ) + "\n" +
- "G: " + QString::number( sPixelValue.G() ) + "\n" +
+ "R: " + QString::number( sPixelValue.R() ) + "\n" + "G: " + QString::number( sPixelValue.G() ) + "\n" +
"B: " + QString::number( sPixelValue.B() ) );
}
}
diff --git a/app/external/qcustomplot.cpp b/app/external/qcustomplot.cpp
index b4cc1ce..9aef255 100644
--- a/app/external/qcustomplot.cpp
+++ b/app/external/qcustomplot.cpp
@@ -67,8 +67,7 @@ QCPPainter::QCPPainter() : QPainter(), mModes( pmDefault ), mIsAntialiasing( fal
Like \ref begin, this method sets QPainter::NonCosmeticDefaultPen in Qt
versions before Qt5.
*/
-QCPPainter::QCPPainter( QPaintDevice* device )
- : QPainter( device ), mModes( pmDefault ), mIsAntialiasing( false )
+QCPPainter::QCPPainter( QPaintDevice* device ) : QPainter( device ), mModes( pmDefault ), mIsAntialiasing( false )
{
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 ) // before Qt5, default pens used to
// be cosmetic if
@@ -392,10 +391,7 @@ void QCPPainter::makeNonCosmetic()
color will be inherited
from the plottable that uses this scatter style.
*/
-QCPScatterStyle::QCPScatterStyle()
- : mSize( 6 ), mShape( ssNone ), mPen( Qt::NoPen ), mBrush( Qt::NoBrush ), mPenDefined( false )
-{
-}
+QCPScatterStyle::QCPScatterStyle() : mSize( 6 ), mShape( ssNone ), mPen( Qt::NoPen ), mBrush( Qt::NoBrush ), mPenDefined( false ) {}
/*!
Creates a new QCPScatterStyle instance with shape set to \a shape and size to
@@ -418,11 +414,7 @@ QCPScatterStyle::QCPScatterStyle( ScatterShape shape, double size )
filled.
*/
QCPScatterStyle::QCPScatterStyle( ScatterShape shape, const QColor& color, double size )
- : mSize( size )
- , mShape( shape )
- , mPen( QPen( color ) )
- , mBrush( Qt::NoBrush )
- , mPenDefined( true )
+ : mSize( size ), mShape( shape ), mPen( QPen( color ) ), mBrush( Qt::NoBrush ), mPenDefined( true )
{
}
@@ -431,15 +423,8 @@ QCPScatterStyle::QCPScatterStyle( ScatterShape shape, const QColor& color, doubl
color set to \a color,
the brush color to \a fill (with a solid pattern), and size to \a size.
*/
-QCPScatterStyle::QCPScatterStyle( ScatterShape shape,
- const QColor& color,
- const QColor& fill,
- double size )
- : mSize( size )
- , mShape( shape )
- , mPen( QPen( color ) )
- , mBrush( QBrush( fill ) )
- , mPenDefined( true )
+QCPScatterStyle::QCPScatterStyle( ScatterShape shape, const QColor& color, const QColor& fill, double size )
+ : mSize( size ), mShape( shape ), mPen( QPen( color ) ), mBrush( QBrush( fill ) ), mPenDefined( true )
{
}
@@ -466,15 +451,8 @@ QCPScatterStyle::QCPScatterStyle( ScatterShape shape,
this constructor is
wanted.
*/
-QCPScatterStyle::QCPScatterStyle( ScatterShape shape,
- const QPen& pen,
- const QBrush& brush,
- double size )
- : mSize( size )
- , mShape( shape )
- , mPen( pen )
- , mBrush( brush )
- , mPenDefined( pen.style() != Qt::NoPen )
+QCPScatterStyle::QCPScatterStyle( ScatterShape shape, const QPen& pen, const QBrush& brush, double size )
+ : mSize( size ), mShape( shape ), mPen( pen ), mBrush( brush ), mPenDefined( pen.style() != Qt::NoPen )
{
}
@@ -484,12 +462,7 @@ QCPScatterStyle::QCPScatterStyle( ScatterShape shape,
is set to \ref ssPixmap.
*/
QCPScatterStyle::QCPScatterStyle( const QPixmap& pixmap )
- : mSize( 5 )
- , mShape( ssPixmap )
- , mPen( Qt::NoPen )
- , mBrush( Qt::NoBrush )
- , mPixmap( pixmap )
- , mPenDefined( false )
+ : mSize( 5 ), mShape( ssPixmap ), mPen( Qt::NoPen ), mBrush( Qt::NoBrush ), mPixmap( pixmap ), mPenDefined( false )
{
}
@@ -507,16 +480,8 @@ QCPScatterStyle::QCPScatterStyle( const QPixmap& pixmap )
natural size by default. To double the size of the path for example, set \a
size to 12.
*/
-QCPScatterStyle::QCPScatterStyle( const QPainterPath& customPath,
- const QPen& pen,
- const QBrush& brush,
- double size )
- : mSize( size )
- , mShape( ssCustom )
- , mPen( pen )
- , mBrush( brush )
- , mCustomPath( customPath )
- , mPenDefined( false )
+QCPScatterStyle::QCPScatterStyle( const QPainterPath& customPath, const QPen& pen, const QBrush& brush, double size )
+ : mSize( size ), mShape( ssCustom ), mPen( pen ), mBrush( brush ), mCustomPath( customPath ), mPenDefined( false )
{
}
@@ -927,8 +892,7 @@ void QCPLayer::addChild( QCPLayerable* layerable, bool prepend )
mChildren.append( layerable );
}
else
- qDebug() << Q_FUNC_INFO << "layerable is already child of this layer"
- << reinterpret_cast( layerable );
+ qDebug() << Q_FUNC_INFO << "layerable is already child of this layer" << reinterpret_cast( layerable );
}
/*! \internal
@@ -944,8 +908,7 @@ void QCPLayer::addChild( QCPLayerable* layerable, bool prepend )
void QCPLayer::removeChild( QCPLayerable* layerable )
{
if( !mChildren.removeOne( layerable ) )
- qDebug() << Q_FUNC_INFO << "layerable is not child of this layer"
- << reinterpret_cast( layerable );
+ qDebug() << Q_FUNC_INFO << "layerable is not child of this layer" << reinterpret_cast( layerable );
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1092,20 +1055,14 @@ void QCPLayer::removeChild( QCPLayerable* layerable )
plot does.
*/
QCPLayerable::QCPLayerable( QCustomPlot* plot, QString targetLayer, QCPLayerable* parentLayerable )
- : QObject( plot )
- , mVisible( true )
- , mParentPlot( plot )
- , mParentLayerable( parentLayerable )
- , mLayer( 0 )
- , mAntialiased( true )
+ : QObject( plot ), mVisible( true ), mParentPlot( plot ), mParentLayerable( parentLayerable ), mLayer( 0 ), mAntialiased( true )
{
if( mParentPlot )
{
if( targetLayer.isEmpty() )
setLayer( mParentPlot->currentLayer() );
else if( !setLayer( targetLayer ) )
- qDebug() << Q_FUNC_INFO << "setting QCPlayerable initial layer to" << targetLayer
- << "failed.";
+ qDebug() << Q_FUNC_INFO << "setting QCPlayerable initial layer to" << targetLayer << "failed.";
}
}
@@ -1198,8 +1155,7 @@ void QCPLayerable::setAntialiased( bool enabled )
*/
bool QCPLayerable::realVisibility() const
{
- return mVisible && ( !mLayer || mLayer->visible() ) &&
- ( !mParentLayerable || mParentLayerable.data()->realVisibility() );
+ return mVisible && ( !mLayer || mLayer->visible() ) && ( !mParentLayerable || mParentLayerable.data()->realVisibility() );
}
/*!
@@ -1341,8 +1297,7 @@ bool QCPLayerable::moveToLayer( QCPLayer* layer, bool prepend )
}
if( layer && layer->parentPlot() != mParentPlot )
{
- qDebug() << Q_FUNC_INFO << "layer" << layer->name()
- << "is not in same QCustomPlot as this layerable";
+ qDebug() << Q_FUNC_INFO << "layer" << layer->name() << "is not in same QCustomPlot as this layerable";
return false;
}
@@ -1367,9 +1322,7 @@ bool QCPLayerable::moveToLayer( QCPLayer* layer, bool prepend )
takes into account is
controlled via \a overrideElement.
*/
-void QCPLayerable::applyAntialiasingHint( QCPPainter* painter,
- bool localAntialiased,
- QCP::AntialiasedElement overrideElement ) const
+void QCPLayerable::applyAntialiasingHint( QCPPainter* painter, bool localAntialiased, QCP::AntialiasedElement overrideElement ) const
{
if( mParentPlot && mParentPlot->notAntialiasedElements().testFlag( overrideElement ) )
painter->setAntialiasing( false );
@@ -1485,10 +1438,7 @@ QRect QCPLayerable::clipRect() const
\see selectTest, deselectEvent
*/
-void QCPLayerable::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPLayerable::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
Q_UNUSED( additive )
@@ -1732,8 +1682,7 @@ bool QCPRange::validRange( double lower, double upper )
(lower < -minRange || lower > minRange) &&
(upper < -minRange || upper > minRange));
*/
- return ( lower > -maxRange && upper < maxRange && qAbs( lower - upper ) > minRange &&
- qAbs( lower - upper ) < maxRange );
+ return ( lower > -maxRange && upper < maxRange && qAbs( lower - upper ) > minRange && qAbs( lower - upper ) < maxRange );
}
/*!
@@ -1755,8 +1704,7 @@ bool QCPRange::validRange( const QCPRange& range )
(range.lower < -minRange || range.lower > minRange) &&
(range.upper < -minRange || range.upper > minRange));
*/
- return ( range.lower > -maxRange && range.upper < maxRange &&
- qAbs( range.lower - range.upper ) > minRange &&
+ return ( range.lower > -maxRange && range.upper < maxRange && qAbs( range.lower - range.upper ) > minRange &&
qAbs( range.lower - range.upper ) < maxRange );
}
@@ -1983,8 +1931,7 @@ bool QCPRange::validRange( const QCPRange& range )
/*!
Creates a new QCPMarginGroup instance in \a parentPlot.
*/
-QCPMarginGroup::QCPMarginGroup( QCustomPlot* parentPlot )
- : QObject( parentPlot ), mParentPlot( parentPlot )
+QCPMarginGroup::QCPMarginGroup( QCustomPlot* parentPlot ) : QObject( parentPlot ), mParentPlot( parentPlot )
{
mChildren.insert( QCP::msLeft, QList() );
mChildren.insert( QCP::msRight, QList() );
@@ -2056,8 +2003,7 @@ int QCPMarginGroup::commonMargin( QCP::MarginSide side ) const
{
if( !elements.at( i )->autoMargins().testFlag( side ) )
continue;
- int m = qMax( elements.at( i )->calculateAutoMargin( side ),
- QCP::getMarginValue( elements.at( i )->minimumMargins(), side ) );
+ int m = qMax( elements.at( i )->calculateAutoMargin( side ), QCP::getMarginValue( elements.at( i )->minimumMargins(), side ) );
if( m > result )
result = m;
}
@@ -2076,8 +2022,7 @@ void QCPMarginGroup::addChild( QCP::MarginSide side, QCPLayoutElement* element )
if( !mChildren[side].contains( element ) )
mChildren[side].append( element );
else
- qDebug() << Q_FUNC_INFO << "element is already child of this margin group side"
- << reinterpret_cast( element );
+ qDebug() << Q_FUNC_INFO << "element is already child of this margin group side" << reinterpret_cast( element );
}
/*! \internal
@@ -2090,8 +2035,7 @@ void QCPMarginGroup::addChild( QCP::MarginSide side, QCPLayoutElement* element )
void QCPMarginGroup::removeChild( QCP::MarginSide side, QCPLayoutElement* element )
{
if( !mChildren[side].removeOne( element ) )
- qDebug() << Q_FUNC_INFO << "element is not child of this margin group side"
- << reinterpret_cast( element );
+ qDebug() << Q_FUNC_INFO << "element is not child of this margin group side" << reinterpret_cast( element );
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2253,8 +2197,7 @@ void QCPLayoutElement::setOuterRect( const QRect& rect )
if( mOuterRect != rect )
{
mOuterRect = rect;
- mRect = mOuterRect.adjusted( mMargins.left(), mMargins.top(), -mMargins.right(),
- -mMargins.bottom() );
+ mRect = mOuterRect.adjusted( mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom() );
}
}
@@ -2278,8 +2221,7 @@ void QCPLayoutElement::setMargins( const QMargins& margins )
if( mMargins != margins )
{
mMargins = margins;
- mRect = mOuterRect.adjusted( mMargins.left(), mMargins.top(), -mMargins.right(),
- -mMargins.bottom() );
+ mRect = mOuterRect.adjusted( mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom() );
}
}
@@ -2455,17 +2397,15 @@ void QCPLayoutElement::update( UpdatePhase phase )
// calculation, either directly or via a
// margin group:
QMargins newMargins = mMargins;
- foreach( QCP::MarginSide side, QList() << QCP::msLeft << QCP::msRight
- << QCP::msTop << QCP::msBottom )
+ foreach( QCP::MarginSide side, QList() << QCP::msLeft << QCP::msRight << QCP::msTop << QCP::msBottom )
{
if( mAutoMargins.testFlag( side ) ) // this side's margin shall be calculated automatically
{
if( mMarginGroups.contains( side ) )
- QCP::setMarginValue(
- newMargins, side,
- mMarginGroups[side]->commonMargin( side ) ); // this side is part of a margin
- // group, so get the margin value
- // from that group
+ QCP::setMarginValue( newMargins, side,
+ mMarginGroups[side]->commonMargin( side ) ); // this side is part of a margin
+ // group, so get the margin value
+ // from that group
else
QCP::setMarginValue( newMargins, side,
calculateAutoMargin( side ) ); // this side is not
@@ -2473,8 +2413,7 @@ void QCPLayoutElement::update( UpdatePhase phase )
// so calculate the
// value directly
// apply minimum margin restrictions:
- if( QCP::getMarginValue( newMargins, side ) <
- QCP::getMarginValue( mMinimumMargins, side ) )
+ if( QCP::getMarginValue( newMargins, side ) < QCP::getMarginValue( mMinimumMargins, side ) )
QCP::setMarginValue( newMargins, side, QCP::getMarginValue( mMinimumMargins, side ) );
}
}
@@ -2544,9 +2483,7 @@ QList QCPLayoutElement::elements( bool recursive ) const
specific selection test
behaviour.
*/
-double QCPLayoutElement::selectTest( const QPointF& pos,
- bool onlySelectable,
- QVariant* details ) const
+double QCPLayoutElement::selectTest( const QPointF& pos, bool onlySelectable, QVariant* details ) const
{
Q_UNUSED( details )
@@ -2596,8 +2533,7 @@ void QCPLayoutElement::parentPlotInitialized( QCustomPlot* parentPlot )
*/
int QCPLayoutElement::calculateAutoMargin( QCP::MarginSide side )
{
- return qMax( QCP::getMarginValue( mMargins, side ),
- QCP::getMarginValue( mMinimumMargins, side ) );
+ return qMax( QCP::getMarginValue( mMargins, side ), QCP::getMarginValue( mMinimumMargins, side ) );
}
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -2952,15 +2888,11 @@ void QCPLayout::releaseElement( QCPLayoutElement* el )
The return value is a QVector containing the section sizes.
*/
-QVector QCPLayout::getSectionSizes( QVector maxSizes,
- QVector minSizes,
- QVector stretchFactors,
- int totalSize ) const
+QVector QCPLayout::getSectionSizes( QVector maxSizes, QVector minSizes, QVector stretchFactors, int totalSize ) const
{
if( maxSizes.size() != minSizes.size() || minSizes.size() != stretchFactors.size() )
{
- qDebug() << Q_FUNC_INFO << "Passed vector sizes aren't equal:" << maxSizes << minSizes
- << stretchFactors;
+ qDebug() << Q_FUNC_INFO << "Passed vector sizes aren't equal:" << maxSizes << minSizes << stretchFactors;
return QVector();
}
if( stretchFactors.isEmpty() )
@@ -2989,17 +2921,15 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes,
double freeSize = totalSize;
int outerIterations = 0;
- while( !unfinishedSections.isEmpty() &&
- outerIterations < sectionCount * 2 ) // the iteration check ist just a
- // failsafe in case something
- // really strange happens
+ while( !unfinishedSections.isEmpty() && outerIterations < sectionCount * 2 ) // the iteration check ist just a
+ // failsafe in case something
+ // really strange happens
{
++outerIterations;
int innerIterations = 0;
- while( !unfinishedSections.isEmpty() &&
- innerIterations < sectionCount * 2 ) // the iteration check ist just a
- // failsafe in case something
- // really strange happens
+ while( !unfinishedSections.isEmpty() && innerIterations < sectionCount * 2 ) // the iteration check ist just a
+ // failsafe in case something
+ // really strange happens
{
++innerIterations;
// find section that hits its maximum next:
@@ -3008,8 +2938,7 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes,
for( int i = 0; i < unfinishedSections.size(); ++i )
{
int secId = unfinishedSections.at( i );
- double hitsMaxAt =
- ( maxSizes.at( secId ) - sectionSizes.at( secId ) ) / stretchFactors.at( secId );
+ double hitsMaxAt = ( maxSizes.at( secId ) - sectionSizes.at( secId ) ) / stretchFactors.at( secId );
if( hitsMaxAt < nextMax )
{
nextMax = hitsMaxAt;
@@ -3031,8 +2960,7 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes,
{
for( int i = 0; i < unfinishedSections.size(); ++i )
{
- sectionSizes[unfinishedSections.at( i )] +=
- nextMax * stretchFactors.at( unfinishedSections.at( i ) ); // increment all sections
+ sectionSizes[unfinishedSections.at( i )] += nextMax * stretchFactors.at( unfinishedSections.at( i ) ); // increment all sections
freeSize -= nextMax * stretchFactors.at( unfinishedSections.at( i ) );
}
unfinishedSections.removeOne( nextId ); // exclude the section that is now
@@ -3042,9 +2970,7 @@ QVector QCPLayout::getSectionSizes( QVector maxSizes,
// remaining sections
{
for( int i = 0; i < unfinishedSections.size(); ++i )
- sectionSizes[unfinishedSections.at( i )] +=
- nextMaxLimit *
- stretchFactors.at( unfinishedSections.at( i ) ); // increment all sections
+ sectionSizes[unfinishedSections.at( i )] += nextMaxLimit * stretchFactors.at( unfinishedSections.at( i ) ); // increment all sections
unfinishedSections.clear();
}
}
@@ -3221,8 +3147,7 @@ bool QCPLayoutGrid::addElement( int row, int column, QCPLayoutElement* element )
return true;
}
else
- qDebug() << Q_FUNC_INFO << "There is already an element in the specified row/column:" << row
- << column;
+ qDebug() << Q_FUNC_INFO << "There is already an element in the specified row/column:" << row << column;
}
else
qDebug() << Q_FUNC_INFO << "Can't add null element to row/column:" << row << column;
@@ -3293,8 +3218,7 @@ void QCPLayoutGrid::setColumnStretchFactors( const QList& factors )
{
if( mColumnStretchFactors.at( i ) <= 0 )
{
- qDebug() << Q_FUNC_INFO
- << "Invalid stretch factor, must be positive:" << mColumnStretchFactors.at( i );
+ qDebug() << Q_FUNC_INFO << "Invalid stretch factor, must be positive:" << mColumnStretchFactors.at( i );
mColumnStretchFactors[i] = 1;
}
}
@@ -3352,8 +3276,7 @@ void QCPLayoutGrid::setRowStretchFactors( const QList& factors )
{
if( mRowStretchFactors.at( i ) <= 0 )
{
- qDebug() << Q_FUNC_INFO
- << "Invalid stretch factor, must be positive:" << mRowStretchFactors.at( i );
+ qDebug() << Q_FUNC_INFO << "Invalid stretch factor, must be positive:" << mRowStretchFactors.at( i );
mRowStretchFactors[i] = 1;
}
}
@@ -3429,8 +3352,7 @@ void QCPLayoutGrid::expandTo( int newRowCount, int newColumnCount )
*/
void QCPLayoutGrid::insertRow( int newIndex )
{
- if( mElements.isEmpty() ||
- mElements.first().isEmpty() ) // if grid is completely empty, add first cell
+ if( mElements.isEmpty() || mElements.first().isEmpty() ) // if grid is completely empty, add first cell
{
expandTo( 1, 1 );
return;
@@ -3458,8 +3380,7 @@ void QCPLayoutGrid::insertRow( int newIndex )
*/
void QCPLayoutGrid::insertColumn( int newIndex )
{
- if( mElements.isEmpty() ||
- mElements.first().isEmpty() ) // if grid is completely empty, add first cell
+ if( mElements.isEmpty() || mElements.first().isEmpty() ) // if grid is completely empty, add first cell
{
expandTo( 1, 1 );
return;
@@ -3484,12 +3405,8 @@ void QCPLayoutGrid::updateLayout()
int totalRowSpacing = ( rowCount() - 1 ) * mRowSpacing;
int totalColSpacing = ( columnCount() - 1 ) * mColumnSpacing;
- QVector colWidths =
- getSectionSizes( maxColWidths, minColWidths, mColumnStretchFactors.toVector(),
- mRect.width() - totalColSpacing );
- QVector rowHeights =
- getSectionSizes( maxRowHeights, minRowHeights, mRowStretchFactors.toVector(),
- mRect.height() - totalRowSpacing );
+ QVector colWidths = getSectionSizes( maxColWidths, minColWidths, mColumnStretchFactors.toVector(), mRect.width() - totalColSpacing );
+ QVector rowHeights = getSectionSizes( maxRowHeights, minRowHeights, mRowStretchFactors.toVector(), mRect.height() - totalRowSpacing );
// go through cells and set rects accordingly:
int yOffset = mRect.top();
@@ -3503,8 +3420,7 @@ void QCPLayoutGrid::updateLayout()
if( col > 0 )
xOffset += colWidths.at( col - 1 ) + mColumnSpacing;
if( mElements.at( row ).at( col ) )
- mElements.at( row ).at( col )->setOuterRect(
- QRect( xOffset, yOffset, colWidths.at( col ), rowHeights.at( row ) ) );
+ mElements.at( row ).at( col )->setOuterRect( QRect( xOffset, yOffset, colWidths.at( col ), rowHeights.at( row ) ) );
}
}
}
@@ -3648,8 +3564,7 @@ QSize QCPLayoutGrid::minimumSizeHint() const
result.rwidth() += minColWidths.at( i );
for( int i = 0; i < minRowHeights.size(); ++i )
result.rheight() += minRowHeights.at( i );
- result.rwidth() +=
- qMax( 0, columnCount() - 1 ) * mColumnSpacing + mMargins.left() + mMargins.right();
+ result.rwidth() += qMax( 0, columnCount() - 1 ) * mColumnSpacing + mMargins.left() + mMargins.right();
result.rheight() += qMax( 0, rowCount() - 1 ) * mRowSpacing + mMargins.top() + mMargins.bottom();
return result;
}
@@ -3665,8 +3580,7 @@ QSize QCPLayoutGrid::maximumSizeHint() const
result.setWidth( qMin( result.width() + maxColWidths.at( i ), QWIDGETSIZE_MAX ) );
for( int i = 0; i < maxRowHeights.size(); ++i )
result.setHeight( qMin( result.height() + maxRowHeights.at( i ), QWIDGETSIZE_MAX ) );
- result.rwidth() +=
- qMax( 0, columnCount() - 1 ) * mColumnSpacing + mMargins.left() + mMargins.right();
+ result.rwidth() += qMax( 0, columnCount() - 1 ) * mColumnSpacing + mMargins.left() + mMargins.right();
result.rheight() += qMax( 0, rowCount() - 1 ) * mRowSpacing + mMargins.top() + mMargins.bottom();
return result;
}
@@ -3685,8 +3599,7 @@ QSize QCPLayoutGrid::maximumSizeHint() const
\see getMaximumRowColSizes
*/
-void QCPLayoutGrid::getMinimumRowColSizes( QVector* minColWidths,
- QVector* minRowHeights ) const
+void QCPLayoutGrid::getMinimumRowColSizes( QVector* minColWidths, QVector* minRowHeights ) const
{
*minColWidths = QVector( columnCount(), 0 );
*minRowHeights = QVector( rowCount(), 0 );
@@ -3698,8 +3611,7 @@ void QCPLayoutGrid::getMinimumRowColSizes( QVector* minColWidths,
{
QSize minHint = mElements.at( row ).at( col )->minimumSizeHint();
QSize min = mElements.at( row ).at( col )->minimumSize();
- QSize final( min.width() > 0 ? min.width() : minHint.width(),
- min.height() > 0 ? min.height() : minHint.height() );
+ QSize final( min.width() > 0 ? min.width() : minHint.width(), min.height() > 0 ? min.height() : minHint.height() );
if( minColWidths->at( col ) < final.width() )
( *minColWidths )[col] = final.width();
if( minRowHeights->at( row ) < final.height() )
@@ -3724,8 +3636,7 @@ void QCPLayoutGrid::getMinimumRowColSizes( QVector* minColWidths,
\see getMinimumRowColSizes
*/
-void QCPLayoutGrid::getMaximumRowColSizes( QVector* maxColWidths,
- QVector* maxRowHeights ) const
+void QCPLayoutGrid::getMaximumRowColSizes( QVector* maxColWidths, QVector* maxRowHeights ) const
{
*maxColWidths = QVector( columnCount(), QWIDGETSIZE_MAX );
*maxRowHeights = QVector( rowCount(), QWIDGETSIZE_MAX );
@@ -3916,24 +3827,16 @@ void QCPLayoutInset::updateLayout()
QSize finalMinSize, finalMaxSize;
QSize minSizeHint = mElements.at( i )->minimumSizeHint();
QSize maxSizeHint = mElements.at( i )->maximumSizeHint();
- finalMinSize.setWidth( mElements.at( i )->minimumSize().width() > 0
- ? mElements.at( i )->minimumSize().width()
- : minSizeHint.width() );
- finalMinSize.setHeight( mElements.at( i )->minimumSize().height() > 0
- ? mElements.at( i )->minimumSize().height()
- : minSizeHint.height() );
- finalMaxSize.setWidth( mElements.at( i )->maximumSize().width() < QWIDGETSIZE_MAX
- ? mElements.at( i )->maximumSize().width()
- : maxSizeHint.width() );
- finalMaxSize.setHeight( mElements.at( i )->maximumSize().height() < QWIDGETSIZE_MAX
- ? mElements.at( i )->maximumSize().height()
- : maxSizeHint.height() );
+ finalMinSize.setWidth( mElements.at( i )->minimumSize().width() > 0 ? mElements.at( i )->minimumSize().width() : minSizeHint.width() );
+ finalMinSize.setHeight( mElements.at( i )->minimumSize().height() > 0 ? mElements.at( i )->minimumSize().height() : minSizeHint.height() );
+ finalMaxSize.setWidth( mElements.at( i )->maximumSize().width() < QWIDGETSIZE_MAX ? mElements.at( i )->maximumSize().width()
+ : maxSizeHint.width() );
+ finalMaxSize.setHeight( mElements.at( i )->maximumSize().height() < QWIDGETSIZE_MAX ? mElements.at( i )->maximumSize().height()
+ : maxSizeHint.height() );
if( mInsetPlacement.at( i ) == ipFree )
{
- insetRect = QRect( rect().x() + rect().width() * mInsetRect.at( i ).x(),
- rect().y() + rect().height() * mInsetRect.at( i ).y(),
- rect().width() * mInsetRect.at( i ).width(),
- rect().height() * mInsetRect.at( i ).height() );
+ insetRect = QRect( rect().x() + rect().width() * mInsetRect.at( i ).x(), rect().y() + rect().height() * mInsetRect.at( i ).y(),
+ rect().width() * mInsetRect.at( i ).width(), rect().height() * mInsetRect.at( i ).height() );
if( insetRect.size().width() < finalMinSize.width() )
insetRect.setWidth( finalMinSize.width() );
if( insetRect.size().height() < finalMinSize.height() )
@@ -3952,15 +3855,13 @@ void QCPLayoutInset::updateLayout()
else if( al.testFlag( Qt::AlignRight ) )
insetRect.moveRight( rect().x() + rect().width() );
else
- insetRect.moveLeft( rect().x() + rect().width() * 0.5 -
- finalMinSize.width() * 0.5 ); // default to Qt::AlignHCenter
+ insetRect.moveLeft( rect().x() + rect().width() * 0.5 - finalMinSize.width() * 0.5 ); // default to Qt::AlignHCenter
if( al.testFlag( Qt::AlignTop ) )
insetRect.moveTop( rect().y() );
else if( al.testFlag( Qt::AlignBottom ) )
insetRect.moveBottom( rect().y() + rect().height() );
else
- insetRect.moveTop( rect().y() + rect().height() * 0.5 -
- finalMinSize.height() * 0.5 ); // default to Qt::AlignVCenter
+ insetRect.moveTop( rect().y() + rect().height() * 0.5 - finalMinSize.height() * 0.5 ); // default to Qt::AlignVCenter
}
mElements.at( i )->setOuterRect( insetRect );
}
@@ -4034,9 +3935,7 @@ bool QCPLayoutInset::take( QCPLayoutElement* element )
See \ref QCPLayerable::selectTest for a general explanation of this virtual
method.
*/
-double QCPLayoutInset::selectTest( const QPointF& pos,
- bool onlySelectable,
- QVariant* details ) const
+double QCPLayoutInset::selectTest( const QPointF& pos, bool onlySelectable, QVariant* details ) const
{
Q_UNUSED( details )
if( onlySelectable )
@@ -4047,8 +3946,7 @@ double QCPLayoutInset::selectTest( const QPointF& pos,
// inset layout shall only return positive selectTest, if actually an inset
// object is at pos
// else it would block the entire underlying QCPAxisRect with its surface.
- if( mElements.at( i )->realVisibility() &&
- mElements.at( i )->selectTest( pos, onlySelectable ) >= 0 )
+ if( mElements.at( i )->realVisibility() && mElements.at( i )->selectTest( pos, onlySelectable ) >= 0 )
return mParentPlot->selectionTolerance() * 0.99;
}
return -1;
@@ -4157,10 +4055,7 @@ QCPLineEnding::QCPLineEnding() : mStyle( esNone ), mWidth( 8 ), mLength( 10 ), m
/*!
Creates a QCPLineEnding instance with the specified values.
*/
-QCPLineEnding::QCPLineEnding( QCPLineEnding::EndingStyle style,
- double width,
- double length,
- bool inverted )
+QCPLineEnding::QCPLineEnding( QCPLineEnding::EndingStyle style, double width, double length, bool inverted )
: mStyle( style ), mWidth( width ), mLength( length ), mInverted( inverted )
{
}
@@ -4320,8 +4215,7 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
break;
case esFlatArrow:
{
- QPointF points[3] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(),
- ( pos - lengthVec - widthVec ).toPointF()};
+ QPointF points[3] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), ( pos - lengthVec - widthVec ).toPointF()};
painter->setPen( miterPen );
painter->setBrush( brush );
painter->drawConvexPolygon( points, 3 );
@@ -4331,8 +4225,7 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
}
case esSpikeArrow:
{
- QPointF points[4] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(),
- ( pos - lengthVec * 0.8f ).toPointF(),
+ QPointF points[4] = {pos.toPointF(), ( pos - lengthVec + widthVec ).toPointF(), ( pos - lengthVec * 0.8f ).toPointF(),
( pos - lengthVec - widthVec ).toPointF()};
painter->setPen( miterPen );
painter->setBrush( brush );
@@ -4343,8 +4236,7 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
}
case esLineArrow:
{
- QPointF points[3] = {( pos - lengthVec + widthVec ).toPointF(), pos.toPointF(),
- ( pos - lengthVec - widthVec ).toPointF()};
+ QPointF points[3] = {( pos - lengthVec + widthVec ).toPointF(), pos.toPointF(), ( pos - lengthVec - widthVec ).toPointF()};
painter->setPen( miterPen );
painter->drawPolyline( points, 3 );
painter->setPen( penBackup );
@@ -4360,9 +4252,8 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
case esSquare:
{
QVector2D widthVecPerp( -widthVec.y(), widthVec.x() );
- QPointF points[4] = {
- ( pos - widthVecPerp + widthVec ).toPointF(), ( pos - widthVecPerp - widthVec ).toPointF(),
- ( pos + widthVecPerp - widthVec ).toPointF(), ( pos + widthVecPerp + widthVec ).toPointF()};
+ QPointF points[4] = {( pos - widthVecPerp + widthVec ).toPointF(), ( pos - widthVecPerp - widthVec ).toPointF(),
+ ( pos + widthVecPerp - widthVec ).toPointF(), ( pos + widthVecPerp + widthVec ).toPointF()};
painter->setPen( miterPen );
painter->setBrush( brush );
painter->drawConvexPolygon( points, 4 );
@@ -4373,8 +4264,8 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
case esDiamond:
{
QVector2D widthVecPerp( -widthVec.y(), widthVec.x() );
- QPointF points[4] = {( pos - widthVecPerp ).toPointF(), ( pos - widthVec ).toPointF(),
- ( pos + widthVecPerp ).toPointF(), ( pos + widthVec ).toPointF()};
+ QPointF points[4] = {( pos - widthVecPerp ).toPointF(), ( pos - widthVec ).toPointF(), ( pos + widthVecPerp ).toPointF(),
+ ( pos + widthVec ).toPointF()};
painter->setPen( miterPen );
painter->setBrush( brush );
painter->drawConvexPolygon( points, 4 );
@@ -4394,27 +4285,24 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, const QVect
}
case esSkewedBar:
{
- if( qFuzzyIsNull( painter->pen().widthF() ) &&
- !painter->modes().testFlag( QCPPainter::pmNonCosmetic ) )
+ if( qFuzzyIsNull( painter->pen().widthF() ) && !painter->modes().testFlag( QCPPainter::pmNonCosmetic ) )
{
// if drawing with cosmetic pen (perfectly thin stroke, happens only in
// vector exports), draw bar exactly on tip
// of line
- painter->drawLine(
- ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF(),
- ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF() );
+ painter->drawLine( ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF(),
+ ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) ).toPointF() );
}
else
{
// if drawing with thick (non-cosmetic) pen, shift bar a little in line
// direction to prevent line from sticking
// through bar slightly
- painter->drawLine( ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) +
- dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f )
- .toPointF(),
- ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) +
- dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f )
- .toPointF() );
+ painter->drawLine(
+ ( pos + widthVec + lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f )
+ .toPointF(),
+ ( pos - widthVec - lengthVec * 0.2f * ( mInverted ? -1 : 1 ) + dir.normalized() * qMax( 1.0f, (float)painter->pen().widthF() ) * 0.5f )
+ .toPointF() );
}
break;
}
@@ -4461,8 +4349,7 @@ void QCPLineEnding::draw( QCPPainter* painter, const QVector2D& pos, double angl
You shouldn't instantiate grids on their own, since every QCPAxis brings its
own QCPGrid.
*/
-QCPGrid::QCPGrid( QCPAxis* parentAxis )
- : QCPLayerable( parentAxis->parentPlot(), "", parentAxis ), mParentAxis( parentAxis )
+QCPGrid::QCPGrid( QCPAxis* parentAxis ) : QCPLayerable( parentAxis->parentPlot(), "", parentAxis ), mParentAxis( parentAxis )
{
// warning: this is called in QCPAxis constructor, so parentAxis members
// should not be accessed/called
@@ -4593,8 +4480,7 @@ void QCPGrid::drawGridLines( QCPPainter* painter ) const
{
// draw zeroline:
int zeroLineIndex = -1;
- if( mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 &&
- mParentAxis->mRange.upper > 0 )
+ if( mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0 )
{
applyAntialiasingHint( painter, mAntialiasedZeroLine, QCP::aeZeroLine );
painter->setPen( mZeroLinePen );
@@ -4605,8 +4491,7 @@ void QCPGrid::drawGridLines( QCPPainter* painter ) const
{
zeroLineIndex = i;
t = mParentAxis->coordToPixel( mParentAxis->mTickVector.at( i ) ); // x
- painter->drawLine(
- QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
+ painter->drawLine( QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
break;
}
}
@@ -4617,18 +4502,16 @@ void QCPGrid::drawGridLines( QCPPainter* painter ) const
for( int i = lowTick; i <= highTick; ++i )
{
if( i == zeroLineIndex )
- continue; // don't draw a gridline on top of the zeroline
+ continue; // don't draw a gridline on top of the zeroline
t = mParentAxis->coordToPixel( mParentAxis->mTickVector.at( i ) ); // x
- painter->drawLine(
- QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
+ painter->drawLine( QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
}
}
else
{
// draw zeroline:
int zeroLineIndex = -1;
- if( mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 &&
- mParentAxis->mRange.upper > 0 )
+ if( mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0 )
{
applyAntialiasingHint( painter, mAntialiasedZeroLine, QCP::aeZeroLine );
painter->setPen( mZeroLinePen );
@@ -4639,8 +4522,7 @@ void QCPGrid::drawGridLines( QCPPainter* painter ) const
{
zeroLineIndex = i;
t = mParentAxis->coordToPixel( mParentAxis->mTickVector.at( i ) ); // y
- painter->drawLine(
- QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
+ painter->drawLine( QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
break;
}
}
@@ -4651,10 +4533,9 @@ void QCPGrid::drawGridLines( QCPPainter* painter ) const
for( int i = lowTick; i <= highTick; ++i )
{
if( i == zeroLineIndex )
- continue; // don't draw a gridline on top of the zeroline
+ continue; // don't draw a gridline on top of the zeroline
t = mParentAxis->coordToPixel( mParentAxis->mTickVector.at( i ) ); // y
- painter->drawLine(
- QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
+ painter->drawLine( QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
}
}
}
@@ -4681,8 +4562,7 @@ void QCPGrid::drawSubGridLines( QCPPainter* painter ) const
for( int i = 0; i < mParentAxis->mSubTickVector.size(); ++i )
{
t = mParentAxis->coordToPixel( mParentAxis->mSubTickVector.at( i ) ); // x
- painter->drawLine(
- QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
+ painter->drawLine( QLineF( t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top() ) );
}
}
else
@@ -4690,8 +4570,7 @@ void QCPGrid::drawSubGridLines( QCPPainter* painter ) const
for( int i = 0; i < mParentAxis->mSubTickVector.size(); ++i )
{
t = mParentAxis->coordToPixel( mParentAxis->mSubTickVector.at( i ) ); // y
- painter->drawLine(
- QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
+ painter->drawLine( QLineF( mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t ) );
}
}
}
@@ -4838,8 +4717,7 @@ QCPAxis::QCPAxis( QCPAxisRect* parent, AxisType type )
, mAutoTickLabels( true )
, mTickLabelType( ltNumber )
, mTickLabelFont( mParentPlot->font() )
- , mSelectedTickLabelFont(
- QFont( mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold ) )
+ , mSelectedTickLabelFont( QFont( mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold ) )
, mTickLabelColor( Qt::black )
, mSelectedTickLabelColor( Qt::blue )
, mDateTimeFormat( "hh:mm:ss\ndd.MM.yy" )
@@ -5627,8 +5505,7 @@ void QCPAxis::setNumberFormat( const QString& formatCode )
}
else
{
- qDebug() << Q_FUNC_INFO
- << "Invalid number format code (first char not in 'eEfgG'):" << formatCode;
+ qDebug() << Q_FUNC_INFO << "Invalid number format code (first char not in 'eEfgG'):" << formatCode;
return;
}
if( formatCode.length() < 2 )
@@ -5668,8 +5545,7 @@ void QCPAxis::setNumberFormat( const QString& formatCode )
}
else
{
- qDebug() << Q_FUNC_INFO
- << "Invalid number format code (third char neither 'c' nor 'd'):" << formatCode;
+ qDebug() << Q_FUNC_INFO << "Invalid number format code (third char neither 'c' nor 'd'):" << formatCode;
return;
}
}
@@ -6178,8 +6054,7 @@ void QCPAxis::scaleRange( double factor, double center )
}
else // mScaleType == stLogarithmic
{
- if( ( mRange.upper < 0 && center < 0 ) ||
- ( mRange.upper > 0 && center > 0 ) ) // make sure center has same sign as range
+ if( ( mRange.upper < 0 && center < 0 ) || ( mRange.upper > 0 && center > 0 ) ) // make sure center has same sign as range
{
QCPRange newRange;
newRange.lower = pow( mRange.lower / center, factor ) * center;
@@ -6255,8 +6130,7 @@ void QCPAxis::rescale( bool onlyVisiblePlottables )
bool currentFoundRange;
QCPAbstractPlottable::SignDomain signDomain = QCPAbstractPlottable::sdBoth;
if( mScaleType == stLogarithmic )
- signDomain = ( mRange.upper < 0 ? QCPAbstractPlottable::sdNegative
- : QCPAbstractPlottable::sdPositive );
+ signDomain = ( mRange.upper < 0 ? QCPAbstractPlottable::sdNegative : QCPAbstractPlottable::sdPositive );
if( p.at( i )->keyAxis() == this )
plottableRange = p.at( i )->getKeyRange( currentFoundRange, signDomain );
else
@@ -6277,10 +6151,9 @@ void QCPAxis::rescale( bool onlyVisiblePlottables )
// this
// axis dimension), shift current range to at least center the plottable
{
- double center = ( newRange.lower + newRange.upper ) *
- 0.5; // upper and lower should be equal anyway, but just to
- // make sure, incase validRange returned false for
- // other reason
+ double center = ( newRange.lower + newRange.upper ) * 0.5; // upper and lower should be equal anyway, but just to
+ // make sure, incase validRange returned false for
+ // other reason
if( mScaleType == stLinear )
{
newRange.lower = center - mRange.size() / 2.0;
@@ -6307,22 +6180,16 @@ double QCPAxis::pixelToCoord( double value ) const
if( mScaleType == stLinear )
{
if( !mRangeReversed )
- return ( value - mAxisRect->left() ) / (double)mAxisRect->width() * mRange.size() +
- mRange.lower;
+ return ( value - mAxisRect->left() ) / (double)mAxisRect->width() * mRange.size() + mRange.lower;
else
- return -( value - mAxisRect->left() ) / (double)mAxisRect->width() * mRange.size() +
- mRange.upper;
+ return -( value - mAxisRect->left() ) / (double)mAxisRect->width() * mRange.size() + mRange.upper;
}
else // mScaleType == stLogarithmic
{
if( !mRangeReversed )
- return pow( mRange.upper / mRange.lower,
- ( value - mAxisRect->left() ) / (double)mAxisRect->width() ) *
- mRange.lower;
+ return pow( mRange.upper / mRange.lower, ( value - mAxisRect->left() ) / (double)mAxisRect->width() ) * mRange.lower;
else
- return pow( mRange.upper / mRange.lower,
- ( mAxisRect->left() - value ) / (double)mAxisRect->width() ) *
- mRange.upper;
+ return pow( mRange.upper / mRange.lower, ( mAxisRect->left() - value ) / (double)mAxisRect->width() ) * mRange.upper;
}
}
else // orientation() == Qt::Vertical
@@ -6330,22 +6197,16 @@ double QCPAxis::pixelToCoord( double value ) const
if( mScaleType == stLinear )
{
if( !mRangeReversed )
- return ( mAxisRect->bottom() - value ) / (double)mAxisRect->height() * mRange.size() +
- mRange.lower;
+ return ( mAxisRect->bottom() - value ) / (double)mAxisRect->height() * mRange.size() + mRange.lower;
else
- return -( mAxisRect->bottom() - value ) / (double)mAxisRect->height() * mRange.size() +
- mRange.upper;
+ return -( mAxisRect->bottom() - value ) / (double)mAxisRect->height() * mRange.size() + mRange.upper;
}
else // mScaleType == stLogarithmic
{
if( !mRangeReversed )
- return pow( mRange.upper / mRange.lower,
- ( mAxisRect->bottom() - value ) / (double)mAxisRect->height() ) *
- mRange.lower;
+ return pow( mRange.upper / mRange.lower, ( mAxisRect->bottom() - value ) / (double)mAxisRect->height() ) * mRange.lower;
else
- return pow( mRange.upper / mRange.lower,
- ( value - mAxisRect->bottom() ) / (double)mAxisRect->height() ) *
- mRange.upper;
+ return pow( mRange.upper / mRange.lower, ( value - mAxisRect->bottom() ) / (double)mAxisRect->height() ) * mRange.upper;
}
}
}
@@ -6378,13 +6239,9 @@ double QCPAxis::coordToPixel( double value ) const
else
{
if( !mRangeReversed )
- return baseLog( value / mRange.lower ) / baseLog( mRange.upper / mRange.lower ) *
- mAxisRect->width() +
- mAxisRect->left();
+ return baseLog( value / mRange.lower ) / baseLog( mRange.upper / mRange.lower ) * mAxisRect->width() + mAxisRect->left();
else
- return baseLog( mRange.upper / value ) / baseLog( mRange.upper / mRange.lower ) *
- mAxisRect->width() +
- mAxisRect->left();
+ return baseLog( mRange.upper / value ) / baseLog( mRange.upper / mRange.lower ) * mAxisRect->width() + mAxisRect->left();
}
}
}
@@ -6410,13 +6267,9 @@ double QCPAxis::coordToPixel( double value ) const
else
{
if( !mRangeReversed )
- return mAxisRect->bottom() - baseLog( value / mRange.lower ) /
- baseLog( mRange.upper / mRange.lower ) *
- mAxisRect->height();
+ return mAxisRect->bottom() - baseLog( value / mRange.lower ) / baseLog( mRange.upper / mRange.lower ) * mAxisRect->height();
else
- return mAxisRect->bottom() - baseLog( mRange.upper / value ) /
- baseLog( mRange.upper / mRange.lower ) *
- mAxisRect->height();
+ return mAxisRect->bottom() - baseLog( mRange.upper / value ) / baseLog( mRange.upper / mRange.lower ) * mAxisRect->height();
}
}
}
@@ -6478,8 +6331,7 @@ QList QCPAxis::plottables() const
for( int i = 0; i < mParentPlot->mPlottables.size(); ++i )
{
- if( mParentPlot->mPlottables.at( i )->keyAxis() == this ||
- mParentPlot->mPlottables.at( i )->valueAxis() == this )
+ if( mParentPlot->mPlottables.at( i )->keyAxis() == this || mParentPlot->mPlottables.at( i )->valueAxis() == this )
result.append( mParentPlot->mPlottables.at( i ) );
}
return result;
@@ -6498,8 +6350,7 @@ QList QCPAxis::graphs() const
for( int i = 0; i < mParentPlot->mGraphs.size(); ++i )
{
- if( mParentPlot->mGraphs.at( i )->keyAxis() == this ||
- mParentPlot->mGraphs.at( i )->valueAxis() == this )
+ if( mParentPlot->mGraphs.at( i )->keyAxis() == this || mParentPlot->mGraphs.at( i )->valueAxis() == this )
result.append( mParentPlot->mGraphs.at( i ) );
}
return result;
@@ -6630,12 +6481,10 @@ void QCPAxis::setupTickVectors()
int subTickIndex = 0;
bool done = false;
int lowTick = mLowestVisibleTick > 0 ? mLowestVisibleTick - 1 : mLowestVisibleTick;
- int highTick = mHighestVisibleTick < mTickVector.size() - 1 ? mHighestVisibleTick + 1
- : mHighestVisibleTick;
+ int highTick = mHighestVisibleTick < mTickVector.size() - 1 ? mHighestVisibleTick + 1 : mHighestVisibleTick;
for( int i = lowTick + 1; i <= highTick; ++i )
{
- subTickStep =
- ( mTickVector.at( i ) - mTickVector.at( i - 1 ) ) / (double)( mSubTickCount + 1 );
+ subTickStep = ( mTickVector.at( i ) - mTickVector.at( i - 1 ) ) / (double)( mSubTickCount + 1 );
for( int k = 1; k <= mSubTickCount; ++k )
{
subTickPosition = mTickVector.at( i - 1 ) + k * subTickStep;
@@ -6663,8 +6512,7 @@ void QCPAxis::setupTickVectors()
if( mTickLabelType == ltNumber )
{
for( int i = mLowestVisibleTick; i <= mHighestVisibleTick; ++i )
- mTickVectorLabels[i] = mParentPlot->locale().toString(
- mTickVector.at( i ), mNumberFormatChar, mNumberPrecision );
+ mTickVectorLabels[i] = mParentPlot->locale().toString( mTickVector.at( i ), mNumberFormatChar, mNumberPrecision );
}
else if( mTickLabelType == ltDateTime )
{
@@ -6673,14 +6521,11 @@ void QCPAxis::setupTickVectors()
#if QT_VERSION < QT_VERSION_CHECK( 4, 7, 0 ) // use fromMSecsSinceEpoch function
// if available, to gain sub-second
// accuracy on tick labels (e.g. for format "hh:mm:ss:zzz")
- mTickVectorLabels[i] = mParentPlot->locale().toString(
- QDateTime::fromTime_t( mTickVector.at( i ) ).toTimeSpec( mDateTimeSpec ),
- mDateTimeFormat );
+ mTickVectorLabels[i] =
+ mParentPlot->locale().toString( QDateTime::fromTime_t( mTickVector.at( i ) ).toTimeSpec( mDateTimeSpec ), mDateTimeFormat );
#else
mTickVectorLabels[i] = mParentPlot->locale().toString(
- QDateTime::fromMSecsSinceEpoch( mTickVector.at( i ) * 1000 )
- .toTimeSpec( mDateTimeSpec ),
- mDateTimeFormat );
+ QDateTime::fromMSecsSinceEpoch( mTickVector.at( i ) * 1000 ).toTimeSpec( mDateTimeSpec ), mDateTimeFormat );
#endif
}
}
@@ -6717,13 +6562,10 @@ void QCPAxis::generateAutoTicks()
if( mAutoTickStep )
{
// Generate tick positions according to linear scaling:
- mTickStep = mRange.size() /
- (double)( mAutoTickCount + 1e-10 ); // mAutoTickCount ticks on average, the small
- // addition is to prevent jitter on exact
- // integers
- double magnitudeFactor =
- qPow( 10.0, qFloor( qLn( mTickStep ) /
- qLn( 10.0 ) ) ); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
+ mTickStep = mRange.size() / (double)( mAutoTickCount + 1e-10 ); // mAutoTickCount ticks on average, the small
+ // addition is to prevent jitter on exact
+ // integers
+ double magnitudeFactor = qPow( 10.0, qFloor( qLn( mTickStep ) / qLn( 10.0 ) ) ); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
double tickStepMantissa = mTickStep / magnitudeFactor;
if( tickStepMantissa < 5 )
{
@@ -6785,8 +6627,7 @@ void QCPAxis::generateAutoTicks()
// different sign
{
mTickVector.clear();
- qDebug() << Q_FUNC_INFO << "Invalid range for logarithmic plot: " << mRange.lower << "-"
- << mRange.upper;
+ qDebug() << Q_FUNC_INFO << "Invalid range for logarithmic plot: " << mRange.lower << "-" << mRange.upper;
}
}
}
@@ -6817,9 +6658,7 @@ int QCPAxis::calculateAutoSubTickCount( double tickStep ) const
// can be found
// get mantissa of tickstep:
- double magnitudeFactor =
- qPow( 10.0, qFloor( qLn( tickStep ) /
- qLn( 10.0 ) ) ); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
+ double magnitudeFactor = qPow( 10.0, qFloor( qLn( tickStep ) / qLn( 10.0 ) ) ); // get magnitude factor e.g. 0.01, 1, 10, 1000 etc.
double tickStepMantissa = tickStep / magnitudeFactor;
// separate integer and fractional part of mantissa:
@@ -6910,10 +6749,7 @@ int QCPAxis::calculateAutoSubTickCount( double tickStep ) const
}
/* inherits documentation from base class */
-void QCPAxis::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPAxis::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
SelectablePart part = details.value();
@@ -7002,8 +6838,7 @@ void QCPAxis::draw( QCPPainter* painter )
mAxisPainter->labelFont = getLabelFont();
mAxisPainter->labelColor = getLabelColor();
mAxisPainter->label = mLabel;
- mAxisPainter->substituteExponent =
- mAutoTickLabels && mNumberBeautifulPowers && mTickLabelType == ltNumber;
+ mAxisPainter->substituteExponent = mAutoTickLabels && mNumberBeautifulPowers && mTickLabelType == ltNumber;
mAxisPainter->tickPen = getTickPen();
mAxisPainter->subTickPen = getSubTickPen();
mAxisPainter->tickLabelFont = getTickLabelFont();
@@ -7357,11 +7192,9 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
QLineF baseLine;
painter->setPen( basePen );
if( QCPAxis::orientation( type ) == Qt::Horizontal )
- baseLine.setPoints( origin + QPointF( xCor, yCor ),
- origin + QPointF( alignmentRect.width() + xCor, yCor ) );
+ baseLine.setPoints( origin + QPointF( xCor, yCor ), origin + QPointF( alignmentRect.width() + xCor, yCor ) );
else
- baseLine.setPoints( origin + QPointF( xCor, yCor ),
- origin + QPointF( xCor, -alignmentRect.height() + yCor ) );
+ baseLine.setPoints( origin + QPointF( xCor, yCor ), origin + QPointF( xCor, -alignmentRect.height() + yCor ) );
if( reversedEndings )
baseLine = QLineF( baseLine.p2(), baseLine.p1() ); // won't make a difference
// for line itself, but for
@@ -7372,23 +7205,19 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
if( !tickPositions.isEmpty() )
{
painter->setPen( tickPen );
- int tickDir = ( type == QCPAxis::atBottom || type == QCPAxis::atRight )
- ? -1
- : 1; // direction of ticks ("inward" is right for left
- // axis and left for right axis)
+ int tickDir = ( type == QCPAxis::atBottom || type == QCPAxis::atRight ) ? -1 : 1; // direction of ticks ("inward" is right for left
+ // axis and left for right axis)
if( QCPAxis::orientation( type ) == Qt::Horizontal )
{
for( int i = 0; i < tickPositions.size(); ++i )
- painter->drawLine(
- QLineF( tickPositions.at( i ) + xCor, origin.y() - tickLengthOut * tickDir + yCor,
- tickPositions.at( i ) + xCor, origin.y() + tickLengthIn * tickDir + yCor ) );
+ painter->drawLine( QLineF( tickPositions.at( i ) + xCor, origin.y() - tickLengthOut * tickDir + yCor, tickPositions.at( i ) + xCor,
+ origin.y() + tickLengthIn * tickDir + yCor ) );
}
else
{
for( int i = 0; i < tickPositions.size(); ++i )
- painter->drawLine(
- QLineF( origin.x() - tickLengthOut * tickDir + xCor, tickPositions.at( i ) + yCor,
- origin.x() + tickLengthIn * tickDir + xCor, tickPositions.at( i ) + yCor ) );
+ painter->drawLine( QLineF( origin.x() - tickLengthOut * tickDir + xCor, tickPositions.at( i ) + yCor,
+ origin.x() + tickLengthIn * tickDir + xCor, tickPositions.at( i ) + yCor ) );
}
}
@@ -7402,16 +7231,14 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
if( QCPAxis::orientation( type ) == Qt::Horizontal )
{
for( int i = 0; i < subTickPositions.size(); ++i )
- painter->drawLine( QLineF(
- subTickPositions.at( i ) + xCor, origin.y() - subTickLengthOut * tickDir + yCor,
- subTickPositions.at( i ) + xCor, origin.y() + subTickLengthIn * tickDir + yCor ) );
+ painter->drawLine( QLineF( subTickPositions.at( i ) + xCor, origin.y() - subTickLengthOut * tickDir + yCor, subTickPositions.at( i ) + xCor,
+ origin.y() + subTickLengthIn * tickDir + yCor ) );
}
else
{
for( int i = 0; i < subTickPositions.size(); ++i )
- painter->drawLine( QLineF(
- origin.x() - subTickLengthOut * tickDir + xCor, subTickPositions.at( i ) + yCor,
- origin.x() + subTickLengthIn * tickDir + xCor, subTickPositions.at( i ) + yCor ) );
+ painter->drawLine( QLineF( origin.x() - subTickLengthOut * tickDir + xCor, subTickPositions.at( i ) + yCor,
+ origin.x() + subTickLengthIn * tickDir + xCor, subTickPositions.at( i ) + yCor ) );
}
}
margin += qMax( 0, qMax( tickLengthOut, subTickLengthOut ) );
@@ -7424,15 +7251,11 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
QVector2D baseLineVector( baseLine.dx(), baseLine.dy() );
if( lowerEnding.style() != QCPLineEnding::esNone )
lowerEnding.draw( painter,
- QVector2D( baseLine.p1() ) - baseLineVector.normalized() *
- lowerEnding.realLength() *
- ( lowerEnding.inverted() ? -1 : 1 ),
+ QVector2D( baseLine.p1() ) - baseLineVector.normalized() * lowerEnding.realLength() * ( lowerEnding.inverted() ? -1 : 1 ),
-baseLineVector );
if( upperEnding.style() != QCPLineEnding::esNone )
upperEnding.draw( painter,
- QVector2D( baseLine.p2() ) + baseLineVector.normalized() *
- upperEnding.realLength() *
- ( upperEnding.inverted() ? -1 : 1 ),
+ QVector2D( baseLine.p2() ) + baseLineVector.normalized() * upperEnding.realLength() * ( upperEnding.inverted() ? -1 : 1 ),
baseLineVector );
painter->setAntialiasing( antialiasingBackup );
@@ -7465,27 +7288,22 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
QTransform oldTransform = painter->transform();
painter->translate( ( origin.x() - margin - labelBounds.height() ), origin.y() );
painter->rotate( -90 );
- painter->drawText( 0, 0, alignmentRect.height(), labelBounds.height(),
- Qt::TextDontClip | Qt::AlignCenter, label );
+ painter->drawText( 0, 0, alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label );
painter->setTransform( oldTransform );
}
else if( type == QCPAxis::atRight )
{
QTransform oldTransform = painter->transform();
- painter->translate( ( origin.x() + margin + labelBounds.height() ),
- origin.y() - alignmentRect.height() );
+ painter->translate( ( origin.x() + margin + labelBounds.height() ), origin.y() - alignmentRect.height() );
painter->rotate( 90 );
- painter->drawText( 0, 0, alignmentRect.height(), labelBounds.height(),
- Qt::TextDontClip | Qt::AlignCenter, label );
+ painter->drawText( 0, 0, alignmentRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label );
painter->setTransform( oldTransform );
}
else if( type == QCPAxis::atTop )
- painter->drawText( origin.x(), origin.y() - margin - labelBounds.height(),
- alignmentRect.width(), labelBounds.height(),
+ painter->drawText( origin.x(), origin.y() - margin - labelBounds.height(), alignmentRect.width(), labelBounds.height(),
Qt::TextDontClip | Qt::AlignCenter, label );
else if( type == QCPAxis::atBottom )
- painter->drawText( origin.x(), origin.y() + margin, alignmentRect.width(),
- labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label );
+ painter->drawText( origin.x(), origin.y() + margin, alignmentRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label );
}
// set selection boxes:
@@ -7496,51 +7314,41 @@ void QCPAxisPainterPrivate::draw( QCPPainter* painter )
qDebug() << Q_FUNC_INFO << "mParentPlot is null";
int selAxisOutSize = qMax( qMax( tickLengthOut, subTickLengthOut ), selectionTolerance );
int selAxisInSize = selectionTolerance;
- int selTickLabelSize =
- ( QCPAxis::orientation( type ) == Qt::Horizontal ? tickLabelsSize.height()
- : tickLabelsSize.width() );
+ int selTickLabelSize = ( QCPAxis::orientation( type ) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width() );
int selTickLabelOffset = qMax( tickLengthOut, subTickLengthOut ) + tickLabelPadding;
int selLabelSize = labelBounds.height();
int selLabelOffset = selTickLabelOffset + selTickLabelSize + labelPadding;
if( type == QCPAxis::atLeft )
{
- mAxisSelectionBox.setCoords( origin.x() - selAxisOutSize, alignmentRect.top(),
- origin.x() + selAxisInSize, alignmentRect.bottom() );
- mTickLabelsSelectionBox.setCoords( origin.x() - selTickLabelOffset - selTickLabelSize,
- alignmentRect.top(), origin.x() - selTickLabelOffset,
+ mAxisSelectionBox.setCoords( origin.x() - selAxisOutSize, alignmentRect.top(), origin.x() + selAxisInSize, alignmentRect.bottom() );
+ mTickLabelsSelectionBox.setCoords( origin.x() - selTickLabelOffset - selTickLabelSize, alignmentRect.top(), origin.x() - selTickLabelOffset,
alignmentRect.bottom() );
- mLabelSelectionBox.setCoords( origin.x() - selLabelOffset - selLabelSize, alignmentRect.top(),
- origin.x() - selLabelOffset, alignmentRect.bottom() );
+ mLabelSelectionBox.setCoords( origin.x() - selLabelOffset - selLabelSize, alignmentRect.top(), origin.x() - selLabelOffset,
+ alignmentRect.bottom() );
}
else if( type == QCPAxis::atRight )
{
- mAxisSelectionBox.setCoords( origin.x() - selAxisInSize, alignmentRect.top(),
- origin.x() + selAxisOutSize, alignmentRect.bottom() );
- mTickLabelsSelectionBox.setCoords( origin.x() + selTickLabelOffset + selTickLabelSize,
- alignmentRect.top(), origin.x() + selTickLabelOffset,
+ mAxisSelectionBox.setCoords( origin.x() - selAxisInSize, alignmentRect.top(), origin.x() + selAxisOutSize, alignmentRect.bottom() );
+ mTickLabelsSelectionBox.setCoords( origin.x() + selTickLabelOffset + selTickLabelSize, alignmentRect.top(), origin.x() + selTickLabelOffset,
alignmentRect.bottom() );
- mLabelSelectionBox.setCoords( origin.x() + selLabelOffset + selLabelSize, alignmentRect.top(),
- origin.x() + selLabelOffset, alignmentRect.bottom() );
+ mLabelSelectionBox.setCoords( origin.x() + selLabelOffset + selLabelSize, alignmentRect.top(), origin.x() + selLabelOffset,
+ alignmentRect.bottom() );
}
else if( type == QCPAxis::atTop )
{
- mAxisSelectionBox.setCoords( alignmentRect.left(), origin.y() - selAxisOutSize,
- alignmentRect.right(), origin.y() + selAxisInSize );
- mTickLabelsSelectionBox.setCoords( alignmentRect.left(),
- origin.y() - selTickLabelOffset - selTickLabelSize,
- alignmentRect.right(), origin.y() - selTickLabelOffset );
- mLabelSelectionBox.setCoords( alignmentRect.left(), origin.y() - selLabelOffset - selLabelSize,
- alignmentRect.right(), origin.y() - selLabelOffset );
+ mAxisSelectionBox.setCoords( alignmentRect.left(), origin.y() - selAxisOutSize, alignmentRect.right(), origin.y() + selAxisInSize );
+ mTickLabelsSelectionBox.setCoords( alignmentRect.left(), origin.y() - selTickLabelOffset - selTickLabelSize, alignmentRect.right(),
+ origin.y() - selTickLabelOffset );
+ mLabelSelectionBox.setCoords( alignmentRect.left(), origin.y() - selLabelOffset - selLabelSize, alignmentRect.right(),
+ origin.y() - selLabelOffset );
}
else if( type == QCPAxis::atBottom )
{
- mAxisSelectionBox.setCoords( alignmentRect.left(), origin.y() - selAxisInSize,
- alignmentRect.right(), origin.y() + selAxisOutSize );
- mTickLabelsSelectionBox.setCoords( alignmentRect.left(),
- origin.y() + selTickLabelOffset + selTickLabelSize,
- alignmentRect.right(), origin.y() + selTickLabelOffset );
- mLabelSelectionBox.setCoords( alignmentRect.left(), origin.y() + selLabelOffset + selLabelSize,
- alignmentRect.right(), origin.y() + selLabelOffset );
+ mAxisSelectionBox.setCoords( alignmentRect.left(), origin.y() - selAxisInSize, alignmentRect.right(), origin.y() + selAxisOutSize );
+ mTickLabelsSelectionBox.setCoords( alignmentRect.left(), origin.y() + selTickLabelOffset + selTickLabelSize, alignmentRect.right(),
+ origin.y() + selTickLabelOffset );
+ mLabelSelectionBox.setCoords( alignmentRect.left(), origin.y() + selLabelOffset + selLabelSize, alignmentRect.right(),
+ origin.y() + selLabelOffset );
}
// draw hitboxes for debug purposes:
// painter->setBrush(Qt::NoBrush);
@@ -7568,8 +7376,7 @@ int QCPAxisPainterPrivate::size() const
{
for( int i = 0; i < tickLabels.size(); ++i )
getMaxTickLabelSize( tickLabelFont, tickLabels.at( i ), &tickLabelsSize );
- result += QCPAxis::orientation( type ) == Qt::Horizontal ? tickLabelsSize.height()
- : tickLabelsSize.width();
+ result += QCPAxis::orientation( type ) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width();
result += tickLabelPadding;
}
@@ -7579,8 +7386,7 @@ int QCPAxisPainterPrivate::size() const
{
QFontMetrics fontMetrics( labelFont );
QRect bounds;
- bounds = fontMetrics.boundingRect(
- 0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter | Qt::AlignVCenter, label );
+ bounds = fontMetrics.boundingRect( 0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter | Qt::AlignVCenter, label );
result += bounds.height() + labelPadding;
}
@@ -7651,11 +7457,7 @@ QByteArray QCPAxisPainterPrivate::generateLabelParameterHash() const
(see \ref
getTickLabelData).
*/
-void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
- double position,
- int distanceToAxis,
- const QString& text,
- QSize* tickLabelsSize )
+void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter, double position, int distanceToAxis, const QString& text, QSize* tickLabelsSize )
{
// warning: if you change anything here, also adapt getMaxTickLabelSize()
// accordingly!
@@ -7678,8 +7480,7 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
labelAnchor = QPointF( position, alignmentRect.bottom() + distanceToAxis + offset );
break;
}
- if( mParentPlot->plottingHints().testFlag( QCP::phCacheLabels ) &&
- !painter->modes().testFlag( QCPPainter::pmNoCaching ) ) // label caching enabled
+ if( mParentPlot->plottingHints().testFlag( QCP::phCacheLabels ) && !painter->modes().testFlag( QCPPainter::pmNoCaching ) ) // label caching enabled
{
if( !mLabelCache.contains( text ) ) // no cached label exists, create it
{
@@ -7691,8 +7492,7 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
newCachedLabel->pixmap.fill( Qt::transparent );
QCPPainter cachePainter( &newCachedLabel->pixmap );
cachePainter.setPen( painter->pen() );
- drawTickLabel( &cachePainter, -labelData.rotatedTotalBounds.topLeft().x(),
- -labelData.rotatedTotalBounds.topLeft().y(), labelData );
+ drawTickLabel( &cachePainter, -labelData.rotatedTotalBounds.topLeft().x(), -labelData.rotatedTotalBounds.topLeft().y(), labelData );
mLabelCache.insert( text, newCachedLabel, 1 );
}
// draw cached label:
@@ -7701,15 +7501,13 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
// it:
if( QCPAxis::orientation( type ) == Qt::Horizontal )
{
- if( labelAnchor.x() + cachedLabel->offset.x() + cachedLabel->pixmap.width() >
- viewportRect.right() ||
+ if( labelAnchor.x() + cachedLabel->offset.x() + cachedLabel->pixmap.width() > viewportRect.right() ||
labelAnchor.x() + cachedLabel->offset.x() < viewportRect.left() )
return;
}
else
{
- if( labelAnchor.y() + cachedLabel->offset.y() + cachedLabel->pixmap.height() >
- viewportRect.bottom() ||
+ if( labelAnchor.y() + cachedLabel->offset.y() + cachedLabel->pixmap.height() > viewportRect.bottom() ||
labelAnchor.y() + cachedLabel->offset.y() < viewportRect.top() )
return;
}
@@ -7724,17 +7522,13 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
// it:
if( QCPAxis::orientation( type ) == Qt::Horizontal )
{
- if( finalPosition.x() +
- ( labelData.rotatedTotalBounds.width() + labelData.rotatedTotalBounds.left() ) >
- viewportRect.right() ||
+ if( finalPosition.x() + ( labelData.rotatedTotalBounds.width() + labelData.rotatedTotalBounds.left() ) > viewportRect.right() ||
finalPosition.x() + labelData.rotatedTotalBounds.left() < viewportRect.left() )
return;
}
else
{
- if( finalPosition.y() +
- ( labelData.rotatedTotalBounds.height() + labelData.rotatedTotalBounds.top() ) >
- viewportRect.bottom() ||
+ if( finalPosition.y() + ( labelData.rotatedTotalBounds.height() + labelData.rotatedTotalBounds.top() ) > viewportRect.bottom() ||
finalPosition.y() + labelData.rotatedTotalBounds.top() < viewportRect.top() )
return;
}
@@ -7761,10 +7555,7 @@ void QCPAxisPainterPrivate::placeTickLabel( QCPPainter* painter,
disabled, i.e. when
QCP::phCacheLabels plotting hint is not set.
*/
-void QCPAxisPainterPrivate::drawTickLabel( QCPPainter* painter,
- double x,
- double y,
- const TickLabelData& labelData ) const
+void QCPAxisPainterPrivate::drawTickLabel( QCPPainter* painter, double x, double y, const TickLabelData& labelData ) const
{
// backup painter settings that we're about to change:
QTransform oldTransform = painter->transform();
@@ -7781,14 +7572,13 @@ void QCPAxisPainterPrivate::drawTickLabel( QCPPainter* painter,
painter->setFont( labelData.baseFont );
painter->drawText( 0, 0, 0, 0, Qt::TextDontClip, labelData.basePart );
painter->setFont( labelData.expFont );
- painter->drawText( labelData.baseBounds.width() + 1, 0, labelData.expBounds.width(),
- labelData.expBounds.height(), Qt::TextDontClip, labelData.expPart );
+ painter->drawText( labelData.baseBounds.width() + 1, 0, labelData.expBounds.width(), labelData.expBounds.height(), Qt::TextDontClip,
+ labelData.expPart );
}
else
{
painter->setFont( labelData.baseFont );
- painter->drawText( 0, 0, labelData.totalBounds.width(), labelData.totalBounds.height(),
- Qt::TextDontClip | Qt::AlignHCenter, labelData.basePart );
+ painter->drawText( 0, 0, labelData.totalBounds.width(), labelData.totalBounds.height(), Qt::TextDontClip | Qt::AlignHCenter, labelData.basePart );
}
// reset painter settings to what it was before:
@@ -7807,9 +7597,7 @@ void QCPAxisPainterPrivate::drawTickLabel( QCPPainter* painter,
exponent if necessary (member substituteExponent) and calculates appropriate
bounding boxes.
*/
-QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(
- const QFont& font,
- const QString& text ) const
+QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData( const QFont& font, const QString& text ) const
{
TickLabelData result;
@@ -7829,10 +7617,9 @@ QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(
if( result.baseFont.pointSizeF() > 0 ) // On some rare systems, this sometimes
// is initialized with -1 (Qt bug?), so
// we check here before possibly setting a negative value in the next line
- result.baseFont.setPointSizeF( result.baseFont.pointSizeF() +
- 0.05 ); // QFontMetrics.boundingRect has a bug for
- // exact point sizes that make the results
- // oscillate due to internal rounding
+ result.baseFont.setPointSizeF( result.baseFont.pointSizeF() + 0.05 ); // QFontMetrics.boundingRect has a bug for
+ // exact point sizes that make the results
+ // oscillate due to internal rounding
if( useBeautifulPowers )
{
// split text into parts of number/symbol that will be drawn normally and
@@ -7843,13 +7630,10 @@ QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(
if( abbreviateDecimalPowers && result.basePart == "1" )
result.basePart = "10";
else
- result.basePart +=
- ( numberMultiplyCross ? QString( QChar( 215 ) ) : QString( QChar( 183 ) ) ) + "10";
+ result.basePart += ( numberMultiplyCross ? QString( QChar( 215 ) ) : QString( QChar( 183 ) ) ) + "10";
result.expPart = text.mid( ePos + 1 );
// clip "+" and leading zeros off expPart:
- while( result.expPart.length() > 2 &&
- result.expPart.at( 1 ) ==
- '0' ) // length > 2 so we leave one zero when numberFormatChar is 'e'
+ while( result.expPart.length() > 2 && result.expPart.at( 1 ) == '0' ) // length > 2 so we leave one zero when numberFormatChar is 'e'
result.expPart.remove( 1, 1 );
if( !result.expPart.isEmpty() && result.expPart.at( 0 ) == '+' )
result.expPart.remove( 0, 1 );
@@ -7857,25 +7641,19 @@ QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(
result.expFont = font;
result.expFont.setPointSize( result.expFont.pointSize() * 0.75 );
// calculate bounding rects of base part, exponent part and total one:
- result.baseBounds = QFontMetrics( result.baseFont )
- .boundingRect( 0, 0, 0, 0, Qt::TextDontClip, result.basePart );
- result.expBounds =
- QFontMetrics( result.expFont ).boundingRect( 0, 0, 0, 0, Qt::TextDontClip, result.expPart );
- result.totalBounds = result.baseBounds.adjusted(
- 0, 0, result.expBounds.width() + 2,
- 0 ); // +2 consists of the 1 pixel spacing between base and exponent (see
- // drawTickLabel) and an extra pixel to include AA
+ result.baseBounds = QFontMetrics( result.baseFont ).boundingRect( 0, 0, 0, 0, Qt::TextDontClip, result.basePart );
+ result.expBounds = QFontMetrics( result.expFont ).boundingRect( 0, 0, 0, 0, Qt::TextDontClip, result.expPart );
+ result.totalBounds = result.baseBounds.adjusted( 0, 0, result.expBounds.width() + 2,
+ 0 ); // +2 consists of the 1 pixel spacing between base and exponent (see
+ // drawTickLabel) and an extra pixel to include AA
}
else // useBeautifulPowers == false
{
result.basePart = text;
- result.totalBounds =
- QFontMetrics( result.baseFont )
- .boundingRect( 0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter, result.basePart );
+ result.totalBounds = QFontMetrics( result.baseFont ).boundingRect( 0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter, result.basePart );
}
- result.totalBounds.moveTopLeft(
- QPoint( 0, 0 ) ); // want bounding box aligned top left at origin, independent of how
- // it was created, to make further processing simpler
+ result.totalBounds.moveTopLeft( QPoint( 0, 0 ) ); // want bounding box aligned top left at origin, independent of how
+ // it was created, to make further processing simpler
// calculate possibly different bounding rect after rotation:
result.rotatedTotalBounds = result.totalBounds;
@@ -7921,8 +7699,7 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
labels.
*/
bool doRotation = !qFuzzyIsNull( tickLabelRotation );
- bool flip =
- qFuzzyCompare( qAbs( tickLabelRotation ), 90.0 ); // perfect +/-90 degree flip. Indicates
+ bool flip = qFuzzyCompare( qAbs( tickLabelRotation ), 90.0 ); // perfect +/-90 degree flip. Indicates
// vertical label centering on vertical axes.
double radians = tickLabelRotation / 180.0 * M_PI;
int x = 0, y = 0;
@@ -7934,16 +7711,13 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
{
x = -qCos( radians ) * labelData.totalBounds.width();
y = flip ? -labelData.totalBounds.width() / 2.0
- : -qSin( radians ) * labelData.totalBounds.width() -
- qCos( radians ) * labelData.totalBounds.height() / 2.0;
+ : -qSin( radians ) * labelData.totalBounds.width() - qCos( radians ) * labelData.totalBounds.height() / 2.0;
}
else
{
- x = -qCos( -radians ) * labelData.totalBounds.width() -
- qSin( -radians ) * labelData.totalBounds.height();
+ x = -qCos( -radians ) * labelData.totalBounds.width() - qSin( -radians ) * labelData.totalBounds.height();
y = flip ? +labelData.totalBounds.width() / 2.0
- : +qSin( -radians ) * labelData.totalBounds.width() -
- qCos( -radians ) * labelData.totalBounds.height() / 2.0;
+ : +qSin( -radians ) * labelData.totalBounds.width() - qCos( -radians ) * labelData.totalBounds.height() / 2.0;
}
}
else
@@ -7959,14 +7733,12 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
if( tickLabelRotation > 0 )
{
x = +qSin( radians ) * labelData.totalBounds.height();
- y = flip ? -labelData.totalBounds.width() / 2.0
- : -qCos( radians ) * labelData.totalBounds.height() / 2.0;
+ y = flip ? -labelData.totalBounds.width() / 2.0 : -qCos( radians ) * labelData.totalBounds.height() / 2.0;
}
else
{
x = 0;
- y = flip ? +labelData.totalBounds.width() / 2.0
- : -qCos( -radians ) * labelData.totalBounds.height() / 2.0;
+ y = flip ? +labelData.totalBounds.width() / 2.0 : -qCos( -radians ) * labelData.totalBounds.height() / 2.0;
}
}
else
@@ -7981,10 +7753,8 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
{
if( tickLabelRotation > 0 )
{
- x = -qCos( radians ) * labelData.totalBounds.width() +
- qSin( radians ) * labelData.totalBounds.height() / 2.0;
- y = -qSin( radians ) * labelData.totalBounds.width() -
- qCos( radians ) * labelData.totalBounds.height();
+ x = -qCos( radians ) * labelData.totalBounds.width() + qSin( radians ) * labelData.totalBounds.height() / 2.0;
+ y = -qSin( radians ) * labelData.totalBounds.width() - qCos( radians ) * labelData.totalBounds.height();
}
else
{
@@ -8009,8 +7779,7 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
}
else
{
- x = -qCos( -radians ) * labelData.totalBounds.width() -
- qSin( -radians ) * labelData.totalBounds.height() / 2.0;
+ x = -qCos( -radians ) * labelData.totalBounds.width() - qSin( -radians ) * labelData.totalBounds.height() / 2.0;
y = +qSin( -radians ) * labelData.totalBounds.width();
}
}
@@ -8034,15 +7803,12 @@ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset( const TickLabelData& labe
currently set to a
smaller width/height.
*/
-void QCPAxisPainterPrivate::getMaxTickLabelSize( const QFont& font,
- const QString& text,
- QSize* tickLabelsSize ) const
+void QCPAxisPainterPrivate::getMaxTickLabelSize( const QFont& font, const QString& text, QSize* tickLabelsSize ) const
{
// note: this function must return the same tick label sizes as the
// placeTickLabel function.
QSize finalSize;
- if( mParentPlot->plottingHints().testFlag( QCP::phCacheLabels ) &&
- mLabelCache.contains( text ) ) // label caching enabled and have cached label
+ if( mParentPlot->plottingHints().testFlag( QCP::phCacheLabels ) && mLabelCache.contains( text ) ) // label caching enabled and have cached label
{
const CachedLabel* cachedLabel = mLabelCache.object( text );
finalSize = cachedLabel->pixmap.size();
@@ -8524,10 +8290,9 @@ void QCPAbstractPlottable::rescaleKeyAxis( bool onlyEnlarge ) const
// this
// axis dimension), shift current range to at least center the plottable
{
- double center = ( newRange.lower + newRange.upper ) *
- 0.5; // upper and lower should be equal anyway, but just to
- // make sure, incase validRange returned false for
- // other reason
+ double center = ( newRange.lower + newRange.upper ) * 0.5; // upper and lower should be equal anyway, but just to
+ // make sure, incase validRange returned false for
+ // other reason
if( keyAxis->scaleType() == QCPAxis::stLinear )
{
newRange.lower = center - keyAxis->range().size() / 2.0;
@@ -8576,10 +8341,9 @@ void QCPAbstractPlottable::rescaleValueAxis( bool onlyEnlarge ) const
// this
// axis dimension), shift current range to at least center the plottable
{
- double center = ( newRange.lower + newRange.upper ) *
- 0.5; // upper and lower should be equal anyway, but just to
- // make sure, incase validRange returned false for
- // other reason
+ double center = ( newRange.lower + newRange.upper ) * 0.5; // upper and lower should be equal anyway, but just to
+ // make sure, incase validRange returned false for
+ // other reason
if( valueAxis->scaleType() == QCPAxis::stLinear )
{
newRange.lower = center - valueAxis->range().size() / 2.0;
@@ -8760,9 +8524,7 @@ void QCPAbstractPlottable::pixelsToCoords( double x, double y, double& key, doub
Returns the pixel input \a pixelPos as plot coordinates \a key and \a value.
*/
-void QCPAbstractPlottable::pixelsToCoords( const QPointF& pixelPos,
- double& key,
- double& value ) const
+void QCPAbstractPlottable::pixelsToCoords( const QPointF& pixelPos, double& key, double& value ) const
{
pixelsToCoords( pixelPos.x(), pixelPos.y(), key, value );
}
@@ -8880,9 +8642,7 @@ void QCPAbstractPlottable::applyErrorBarsAntialiasingHint( QCPPainter* painter )
\note This function is identical to QCPAbstractItem::distSqrToLine
*/
-double QCPAbstractPlottable::distSqrToLine( const QPointF& start,
- const QPointF& end,
- const QPointF& point ) const
+double QCPAbstractPlottable::distSqrToLine( const QPointF& start, const QPointF& end, const QPointF& point ) const
{
QVector2D a( start );
QVector2D b( end );
@@ -8905,10 +8665,7 @@ double QCPAbstractPlottable::distSqrToLine( const QPointF& start,
}
/* inherits documentation from base class */
-void QCPAbstractPlottable::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPAbstractPlottable::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
Q_UNUSED( details )
@@ -8991,10 +8748,7 @@ void QCPAbstractPlottable::deselectEvent( bool* selectionStateChanged )
instead, as
explained in the subclassing section of the QCPAbstractItem documentation.
*/
-QCPItemAnchor::QCPItemAnchor( QCustomPlot* parentPlot,
- QCPAbstractItem* parentItem,
- const QString name,
- int anchorId )
+QCPItemAnchor::QCPItemAnchor( QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name, int anchorId )
: mName( name ), mParentPlot( parentPlot ), mParentItem( parentItem ), mAnchorId( anchorId )
{
}
@@ -9117,14 +8871,8 @@ void QCPItemAnchor::removeChild( QCPItemPosition* pos )
instead, as
explained in the subclassing section of the QCPAbstractItem documentation.
*/
-QCPItemPosition::QCPItemPosition( QCustomPlot* parentPlot,
- QCPAbstractItem* parentItem,
- const QString name )
- : QCPItemAnchor( parentPlot, parentItem, name )
- , mPositionType( ptAbsolute )
- , mKey( 0 )
- , mValue( 0 )
- , mParentAnchor( 0 )
+QCPItemPosition::QCPItemPosition( QCustomPlot* parentPlot, QCPAbstractItem* parentItem, const QString name )
+ : QCPItemAnchor( parentPlot, parentItem, name ), mPositionType( ptAbsolute ), mKey( 0 ), mValue( 0 ), mParentAnchor( 0 )
{
}
@@ -9238,8 +8986,7 @@ bool QCPItemPosition::setParentAnchor( QCPItemAnchor* parentAnchor, bool keepPix
// make sure self is not assigned as parent:
if( parentAnchor == this )
{
- qDebug() << Q_FUNC_INFO << "can't set self as parent anchor"
- << reinterpret_cast( parentAnchor );
+ qDebug() << Q_FUNC_INFO << "can't set self as parent anchor" << reinterpret_cast( parentAnchor );
return false;
}
// make sure no recursive parent-child-relationships are created:
@@ -9251,8 +8998,7 @@ bool QCPItemPosition::setParentAnchor( QCPItemAnchor* parentAnchor, bool keepPix
// is a QCPItemPosition, might have further parent, so keep iterating
if( currentParentPos == this )
{
- qDebug() << Q_FUNC_INFO << "can't create recursive parent-child-relationship"
- << reinterpret_cast( parentAnchor );
+ qDebug() << Q_FUNC_INFO << "can't create recursive parent-child-relationship" << reinterpret_cast( parentAnchor );
return false;
}
currentParent = currentParentPos->mParentAnchor;
@@ -9360,15 +9106,11 @@ QPointF QCPItemPosition::pixelPoint() const
{
if( mParentAnchor )
{
- return QPointF( mKey * mParentPlot->viewport().width(),
- mValue * mParentPlot->viewport().height() ) +
- mParentAnchor->pixelPoint();
+ return QPointF( mKey * mParentPlot->viewport().width(), mValue * mParentPlot->viewport().height() ) + mParentAnchor->pixelPoint();
}
else
{
- return QPointF( mKey * mParentPlot->viewport().width(),
- mValue * mParentPlot->viewport().height() ) +
- mParentPlot->viewport().topLeft();
+ return QPointF( mKey * mParentPlot->viewport().width(), mValue * mParentPlot->viewport().height() ) + mParentPlot->viewport().topLeft();
}
}
@@ -9378,13 +9120,11 @@ QPointF QCPItemPosition::pixelPoint() const
{
if( mParentAnchor )
{
- return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) +
- mParentAnchor->pixelPoint();
+ return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + mParentAnchor->pixelPoint();
}
else
{
- return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) +
- mAxisRect.data()->topLeft();
+ return QPointF( mKey * mAxisRect.data()->width(), mValue * mAxisRect.data()->height() ) + mAxisRect.data()->topLeft();
}
}
else
@@ -10051,9 +9791,7 @@ void QCPAbstractItem::applyDefaultAntialiasingHint( QCPPainter* painter ) const
\see rectSelectTest
*/
-double QCPAbstractItem::distSqrToLine( const QPointF& start,
- const QPointF& end,
- const QPointF& point ) const
+double QCPAbstractItem::distSqrToLine( const QPointF& start, const QPointF& end, const QPointF& point ) const
{
QVector2D a( start );
QVector2D b( end );
@@ -10099,17 +9837,13 @@ double QCPAbstractItem::distSqrToLine( const QPointF& start,
\see distSqrToLine
*/
-double QCPAbstractItem::rectSelectTest( const QRectF& rect,
- const QPointF& pos,
- bool filledRect ) const
+double QCPAbstractItem::rectSelectTest( const QRectF& rect, const QPointF& pos, bool filledRect ) const
{
double result = -1;
// distance to border:
QList lines;
- lines << QLineF( rect.topLeft(), rect.topRight() )
- << QLineF( rect.bottomLeft(), rect.bottomRight() )
- << QLineF( rect.topLeft(), rect.bottomLeft() )
+ lines << QLineF( rect.topLeft(), rect.topRight() ) << QLineF( rect.bottomLeft(), rect.bottomRight() ) << QLineF( rect.topLeft(), rect.bottomLeft() )
<< QLineF( rect.topRight(), rect.bottomRight() );
double minDistSqr = std::numeric_limits::max();
for( int i = 0; i < lines.size(); ++i )
@@ -10223,10 +9957,7 @@ QCPItemAnchor* QCPAbstractItem::createAnchor( const QString& name, int anchorId
}
/* inherits documentation from base class */
-void QCPAbstractItem::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPAbstractItem::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
Q_UNUSED( details )
@@ -11102,8 +10833,7 @@ void QCustomPlot::setAntialiasedElement( QCP::AntialiasedElement antialiasedElem
\see setAntialiasedElements
*/
-void QCustomPlot::setNotAntialiasedElements(
- const QCP::AntialiasedElements& notAntialiasedElements )
+void QCustomPlot::setNotAntialiasedElements( const QCP::AntialiasedElements& notAntialiasedElements )
{
mNotAntialiasedElements = notAntialiasedElements;
@@ -11121,8 +10851,7 @@ void QCustomPlot::setNotAntialiasedElements(
\see setAntialiasedElement
*/
-void QCustomPlot::setNotAntialiasedElement( QCP::AntialiasedElement notAntialiasedElement,
- bool enabled )
+void QCustomPlot::setNotAntialiasedElement( QCP::AntialiasedElement notAntialiasedElement, bool enabled )
{
if( !enabled && mNotAntialiasedElements.testFlag( notAntialiasedElement ) )
mNotAntialiasedElements &= ~notAntialiasedElement;
@@ -11512,14 +11241,12 @@ bool QCustomPlot::addPlottable( QCPAbstractPlottable* plottable )
{
if( mPlottables.contains( plottable ) )
{
- qDebug() << Q_FUNC_INFO << "plottable already added to this QCustomPlot:"
- << reinterpret_cast( plottable );
+ qDebug() << Q_FUNC_INFO << "plottable already added to this QCustomPlot:" << reinterpret_cast( plottable );
return false;
}
if( plottable->parentPlot() != this )
{
- qDebug() << Q_FUNC_INFO << "plottable not created with this QCustomPlot as parent:"
- << reinterpret_cast( plottable );
+ qDebug() << Q_FUNC_INFO << "plottable not created with this QCustomPlot as parent:" << reinterpret_cast( plottable );
return false;
}
@@ -12026,10 +11753,9 @@ QCPAbstractItem* QCustomPlot::itemAt( const QPointF& pos, bool onlySelectable )
// but checking here is faster, because we have access to
// QCPAbstractItem::selectable
continue;
- if( !item->clipToAxisRect() ||
- item->clipRect().contains( pos.toPoint() ) ) // only consider clicks inside
- // axis cliprect of the item
- // if actually clipped to it
+ if( !item->clipToAxisRect() || item->clipRect().contains( pos.toPoint() ) ) // only consider clicks inside
+ // axis cliprect of the item
+ // if actually clipped to it
{
double currentDistance = item->selectTest( pos, false );
if( currentDistance >= 0 && currentDistance < resultDistance )
@@ -12137,8 +11863,7 @@ bool QCustomPlot::setCurrentLayer( QCPLayer* layer )
{
if( !mLayers.contains( layer ) )
{
- qDebug() << Q_FUNC_INFO
- << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
+ qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
return false;
}
@@ -12173,16 +11898,13 @@ int QCustomPlot::layerCount() const
\see layer, moveLayer, removeLayer
*/
-bool QCustomPlot::addLayer( const QString& name,
- QCPLayer* otherLayer,
- QCustomPlot::LayerInsertMode insertMode )
+bool QCustomPlot::addLayer( const QString& name, QCPLayer* otherLayer, QCustomPlot::LayerInsertMode insertMode )
{
if( !otherLayer )
otherLayer = mLayers.last();
if( !mLayers.contains( otherLayer ) )
{
- qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:"
- << reinterpret_cast( otherLayer );
+ qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:" << reinterpret_cast( otherLayer );
return false;
}
if( layer( name ) )
@@ -12219,8 +11941,7 @@ bool QCustomPlot::removeLayer( QCPLayer* layer )
{
if( !mLayers.contains( layer ) )
{
- qDebug() << Q_FUNC_INFO
- << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
+ qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
return false;
}
if( mLayers.size() < 2 )
@@ -12233,8 +11954,7 @@ bool QCustomPlot::removeLayer( QCPLayer* layer )
// prepend to layer above)
int removedIndex = layer->index();
bool isFirstLayer = removedIndex == 0;
- QCPLayer* targetLayer =
- isFirstLayer ? mLayers.at( removedIndex + 1 ) : mLayers.at( removedIndex - 1 );
+ QCPLayer* targetLayer = isFirstLayer ? mLayers.at( removedIndex + 1 ) : mLayers.at( removedIndex - 1 );
QList children = layer->children();
if( isFirstLayer ) // prepend in reverse order (so order relative to each other
// stays the same)
@@ -12269,20 +11989,16 @@ bool QCustomPlot::removeLayer( QCPLayer* layer )
\see layer, addLayer, moveLayer
*/
-bool QCustomPlot::moveLayer( QCPLayer* layer,
- QCPLayer* otherLayer,
- QCustomPlot::LayerInsertMode insertMode )
+bool QCustomPlot::moveLayer( QCPLayer* layer, QCPLayer* otherLayer, QCustomPlot::LayerInsertMode insertMode )
{
if( !mLayers.contains( layer ) )
{
- qDebug() << Q_FUNC_INFO
- << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
+ qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast( layer );
return false;
}
if( !mLayers.contains( otherLayer ) )
{
- qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:"
- << reinterpret_cast( otherLayer );
+ qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:" << reinterpret_cast( otherLayer );
return false;
}
@@ -12499,21 +12215,18 @@ void QCustomPlot::replot( QCustomPlot::RefreshPriority refreshPriority )
mReplotting = true;
emit beforeReplot();
- mPaintBuffer.fill( mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color()
- : Qt::transparent );
+ mPaintBuffer.fill( mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color() : Qt::transparent );
QCPPainter painter;
painter.begin( &mPaintBuffer );
if( painter.isActive() )
{
- painter.setRenderHint(
- QPainter::HighQualityAntialiasing ); // to make Antialiasing look good if
- // using the OpenGL graphicssystem
+ painter.setRenderHint( QPainter::HighQualityAntialiasing ); // to make Antialiasing look good if
+ // using the OpenGL graphicssystem
if( mBackgroundBrush.style() != Qt::SolidPattern && mBackgroundBrush.style() != Qt::NoBrush )
painter.fillRect( mViewport, mBackgroundBrush );
draw( &painter );
painter.end();
- if( ( refreshPriority == rpHint && mPlottingHints.testFlag( QCP::phForceRepaint ) ) ||
- refreshPriority == rpImmediate )
+ if( ( refreshPriority == rpHint && mPlottingHints.testFlag( QCP::phForceRepaint ) ) || refreshPriority == rpImmediate )
repaint();
else
update();
@@ -12602,12 +12315,7 @@ void QCustomPlot::rescaleAxes( bool onlyVisiblePlottables )
\see savePng, saveBmp, saveJpg, saveRastered
*/
-bool QCustomPlot::savePdf( const QString& fileName,
- bool noCosmeticPen,
- int width,
- int height,
- const QString& pdfCreator,
- const QString& pdfTitle )
+bool QCustomPlot::savePdf( const QString& fileName, bool noCosmeticPen, int width, int height, const QString& pdfCreator, const QString& pdfTitle )
{
bool success = false;
#ifdef QT_NO_PRINTER
@@ -12648,10 +12356,8 @@ bool QCustomPlot::savePdf( const QString& fileName,
printpainter.setMode( QCPPainter::pmNoCaching );
printpainter.setMode( QCPPainter::pmNonCosmetic, noCosmeticPen );
printpainter.setWindow( mViewport );
- if( mBackgroundBrush.style() != Qt::NoBrush && mBackgroundBrush.color() != Qt::white &&
- mBackgroundBrush.color() != Qt::transparent &&
- mBackgroundBrush.color().alpha() >
- 0 ) // draw pdf background color if not white/transparent
+ if( mBackgroundBrush.style() != Qt::NoBrush && mBackgroundBrush.color() != Qt::white && mBackgroundBrush.color() != Qt::transparent &&
+ mBackgroundBrush.color().alpha() > 0 ) // draw pdf background color if not white/transparent
printpainter.fillRect( viewport(), mBackgroundBrush );
draw( &printpainter );
printpainter.end();
@@ -12719,11 +12425,7 @@ bool QCustomPlot::savePdf( const QString& fileName,
\see savePdf, saveBmp, saveJpg, saveRastered
*/
-bool QCustomPlot::savePng( const QString& fileName,
- int width,
- int height,
- double scale,
- int quality )
+bool QCustomPlot::savePng( const QString& fileName, int width, int height, double scale, int quality )
{
return saveRastered( fileName, width, height, scale, "PNG", quality );
}
@@ -12780,11 +12482,7 @@ bool QCustomPlot::savePng( const QString& fileName,
\see savePdf, savePng, saveBmp, saveRastered
*/
-bool QCustomPlot::saveJpg( const QString& fileName,
- int width,
- int height,
- double scale,
- int quality )
+bool QCustomPlot::saveJpg( const QString& fileName, int width, int height, double scale, int quality )
{
return saveRastered( fileName, width, height, scale, "JPG", quality );
}
@@ -13018,8 +12716,7 @@ void QCustomPlot::mouseReleaseEvent( QMouseEvent* event )
emit mouseRelease( event );
bool doReplot = false;
- if( ( mMousePressPos - event->pos() ).manhattanLength() <
- 5 ) // determine whether it was a click operation
+ if( ( mMousePressPos - event->pos() ).manhattanLength() < 5 ) // determine whether it was a click operation
{
if( event->button() == Qt::LeftButton )
{
@@ -13027,8 +12724,7 @@ void QCustomPlot::mouseReleaseEvent( QMouseEvent* event )
QVariant details;
QCPLayerable* clickedLayerable = layerableAt( event->pos(), true, &details );
bool selectionStateChanged = false;
- bool additive = mInteractions.testFlag( QCP::iMultiSelect ) &&
- event->modifiers().testFlag( mMultiSelectModifier );
+ bool additive = mInteractions.testFlag( QCP::iMultiSelect ) && event->modifiers().testFlag( mMultiSelectModifier );
// deselect all other layerables if not additive selection:
if( !additive )
{
@@ -13036,8 +12732,7 @@ void QCustomPlot::mouseReleaseEvent( QMouseEvent* event )
{
foreach( QCPLayerable* layerable, layer->children() )
{
- if( layerable != clickedLayerable &&
- mInteractions.testFlag( layerable->selectionCategory() ) )
+ if( layerable != clickedLayerable && mInteractions.testFlag( layerable->selectionCategory() ) )
{
bool selChanged = false;
layerable->deselectEvent( &selChanged );
@@ -13060,10 +12755,9 @@ void QCustomPlot::mouseReleaseEvent( QMouseEvent* event )
// emit specialized object click signals:
QVariant details;
- QCPLayerable* clickedLayerable =
- layerableAt( event->pos(), false,
- &details ); // for these signals, selectability is ignored, that's why we
- // call this again with onlySelectable set to false
+ QCPLayerable* clickedLayerable = layerableAt( event->pos(), false,
+ &details ); // for these signals, selectability is ignored, that's why we
+ // call this again with onlySelectable set to false
if( QCPAbstractPlottable* ap = qobject_cast( clickedLayerable ) )
emit plottableClick( ap, event );
else if( QCPAxis* ax = qobject_cast( clickedLayerable ) )
@@ -13194,16 +12888,13 @@ void QCustomPlot::drawBackground( QCPPainter* painter )
QSize scaledSize( mBackgroundPixmap.size() );
scaledSize.scale( mViewport.size(), mBackgroundScaledMode );
if( mScaledBackgroundPixmap.size() != scaledSize )
- mScaledBackgroundPixmap = mBackgroundPixmap.scaled( mViewport.size(), mBackgroundScaledMode,
- Qt::SmoothTransformation );
- painter->drawPixmap(
- mViewport.topLeft(), mScaledBackgroundPixmap,
- QRect( 0, 0, mViewport.width(), mViewport.height() ) & mScaledBackgroundPixmap.rect() );
+ mScaledBackgroundPixmap = mBackgroundPixmap.scaled( mViewport.size(), mBackgroundScaledMode, Qt::SmoothTransformation );
+ painter->drawPixmap( mViewport.topLeft(), mScaledBackgroundPixmap,
+ QRect( 0, 0, mViewport.width(), mViewport.height() ) & mScaledBackgroundPixmap.rect() );
}
else
{
- painter->drawPixmap( mViewport.topLeft(), mBackgroundPixmap,
- QRect( 0, 0, mViewport.width(), mViewport.height() ) );
+ painter->drawPixmap( mViewport.topLeft(), mBackgroundPixmap, QRect( 0, 0, mViewport.width(), mViewport.height() ) );
}
}
}
@@ -13274,9 +12965,7 @@ void QCustomPlot::updateLayerIndices() const
layerables (e.g.
QCPAxis::SelectablePart).
*/
-QCPLayerable* QCustomPlot::layerableAt( const QPointF& pos,
- bool onlySelectable,
- QVariant* selectionDetails ) const
+QCPLayerable* QCustomPlot::layerableAt( const QPointF& pos, bool onlySelectable, QVariant* selectionDetails ) const
{
for( int layerIndex = mLayers.size() - 1; layerIndex >= 0; --layerIndex )
{
@@ -13318,12 +13007,7 @@ QCPLayerable* QCustomPlot::layerableAt( const QPointF& pos,
\see saveBmp, saveJpg, savePng, savePdf
*/
-bool QCustomPlot::saveRastered( const QString& fileName,
- int width,
- int height,
- double scale,
- const char* format,
- int quality )
+bool QCustomPlot::saveRastered( const QString& fileName, int width, int height, double scale, const char* format, int quality )
{
QPixmap buffer = toPixmap( width, height, scale );
if( !buffer.isNull() )
@@ -13361,9 +13045,7 @@ QPixmap QCustomPlot::toPixmap( int width, int height, double scale )
int scaledHeight = qRound( scale * newHeight );
QPixmap result( scaledWidth, scaledHeight );
- result.fill( mBackgroundBrush.style() == Qt::SolidPattern
- ? mBackgroundBrush.color()
- : Qt::transparent ); // if using non-solid pattern, make
+ result.fill( mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color() : Qt::transparent ); // if using non-solid pattern, make
// transparent now and draw brush pattern
// later
QCPPainter painter;
@@ -13495,10 +13177,7 @@ void QCustomPlot::toPainter( QCPPainter* painter, int width, int height )
The color level count is initialized to 350.
*/
QCPColorGradient::QCPColorGradient( GradientPreset preset )
- : mLevelCount( 350 )
- , mColorInterpolation( ciRGB )
- , mPeriodic( false )
- , mColorBufferInvalidated( true )
+ : mLevelCount( 350 ), mColorInterpolation( ciRGB ), mPeriodic( false ), mColorBufferInvalidated( true )
{
mColorBuffer.fill( qRgb( 0, 0, 0 ), mLevelCount );
loadPreset( preset );
@@ -13507,8 +13186,7 @@ QCPColorGradient::QCPColorGradient( GradientPreset preset )
/* undocumented operator */
bool QCPColorGradient::operator==( const QCPColorGradient& other ) const
{
- return ( ( other.mLevelCount == this->mLevelCount ) &&
- ( other.mColorInterpolation == this->mColorInterpolation ) &&
+ return ( ( other.mLevelCount == this->mLevelCount ) && ( other.mColorInterpolation == this->mColorInterpolation ) &&
( other.mPeriodic == this->mPeriodic ) && ( other.mColorStops == this->mColorStops ) );
}
@@ -13629,12 +13307,7 @@ void QCPColorGradient::setPeriodic( bool enabled )
works because \a data
is addressed data[i*dataIndexFactor].
*/
-void QCPColorGradient::colorize( const double* data,
- const QCPRange& range,
- QRgb* scanLine,
- int n,
- int dataIndexFactor,
- bool logarithmic )
+void QCPColorGradient::colorize( const double* data, const QCPRange& range, QRgb* scanLine, int n, int dataIndexFactor, bool logarithmic )
{
// If you change something here, make sure to also adapt ::color()
if( !data )
@@ -13657,8 +13330,7 @@ void QCPColorGradient::colorize( const double* data,
{
for( int i = 0; i < n; ++i )
{
- int index =
- (int)( ( data[dataIndexFactor * i] - range.lower ) * posToIndexFactor ) % mLevelCount;
+ int index = (int)( ( data[dataIndexFactor * i] - range.lower ) * posToIndexFactor ) % mLevelCount;
if( index < 0 )
index += mLevelCount;
scanLine[i] = mColorBuffer.at( index );
@@ -13683,9 +13355,7 @@ void QCPColorGradient::colorize( const double* data,
{
for( int i = 0; i < n; ++i )
{
- int index = (int)( qLn( data[dataIndexFactor * i] / range.lower ) /
- qLn( range.upper / range.lower ) * mLevelCount ) %
- mLevelCount;
+ int index = (int)( qLn( data[dataIndexFactor * i] / range.lower ) / qLn( range.upper / range.lower ) * mLevelCount ) % mLevelCount;
if( index < 0 )
index += mLevelCount;
scanLine[i] = mColorBuffer.at( index );
@@ -13695,8 +13365,7 @@ void QCPColorGradient::colorize( const double* data,
{
for( int i = 0; i < n; ++i )
{
- int index = qLn( data[dataIndexFactor * i] / range.lower ) /
- qLn( range.upper / range.lower ) * mLevelCount;
+ int index = qLn( data[dataIndexFactor * i] / range.lower ) / qLn( range.upper / range.lower ) * mLevelCount;
if( index < 0 )
index = 0;
else if( index >= mLevelCount )
@@ -13880,8 +13549,7 @@ QCPColorGradient QCPColorGradient::inverted() const
{
QCPColorGradient result( *this );
result.clearColorStops();
- for( QMap::const_iterator it = mColorStops.constBegin();
- it != mColorStops.constEnd(); ++it )
+ for( QMap::const_iterator it = mColorStops.constBegin(); it != mColorStops.constEnd(); ++it )
result.setColorStopAt( 1.0 - it.key(), it.value() );
return result;
}
@@ -13920,14 +13588,12 @@ void QCPColorGradient::updateColorBuffer()
{
QMap::const_iterator high = it;
QMap::const_iterator low = it - 1;
- double t =
- ( position - low.key() ) / ( high.key() - low.key() ); // interpolation factor 0..1
+ double t = ( position - low.key() ) / ( high.key() - low.key() ); // interpolation factor 0..1
switch( mColorInterpolation )
{
case ciRGB:
{
- mColorBuffer[i] = qRgb( ( 1 - t ) * low.value().red() + t * high.value().red(),
- ( 1 - t ) * low.value().green() + t * high.value().green(),
+ mColorBuffer[i] = qRgb( ( 1 - t ) * low.value().red() + t * high.value().red(), ( 1 - t ) * low.value().green() + t * high.value().green(),
( 1 - t ) * low.value().blue() + t * high.value().blue() );
break;
}
@@ -13947,10 +13613,9 @@ void QCPColorGradient::updateColorBuffer()
hue += 1.0;
else if( hue >= 1.0 )
hue -= 1.0;
- mColorBuffer[i] =
- QColor::fromHsvF( hue, ( 1 - t ) * lowHsv.saturationF() + t * highHsv.saturationF(),
- ( 1 - t ) * lowHsv.valueF() + t * highHsv.valueF() )
- .rgb();
+ mColorBuffer[i] = QColor::fromHsvF( hue, ( 1 - t ) * lowHsv.saturationF() + t * highHsv.saturationF(),
+ ( 1 - t ) * lowHsv.valueF() + t * highHsv.valueF() )
+ .rgb();
break;
}
}
@@ -14450,8 +14115,7 @@ QList QCPAxisRect::plottables() const
QList result;
for( int i = 0; i < mParentPlot->mPlottables.size(); ++i )
{
- if( mParentPlot->mPlottables.at( i )->keyAxis()->axisRect() == this ||
- mParentPlot->mPlottables.at( i )->valueAxis()->axisRect() == this )
+ if( mParentPlot->mPlottables.at( i )->keyAxis()->axisRect() == this || mParentPlot->mPlottables.at( i )->valueAxis()->axisRect() == this )
result.append( mParentPlot->mPlottables.at( i ) );
}
return result;
@@ -14473,8 +14137,7 @@ QList QCPAxisRect::graphs() const
QList result;
for( int i = 0; i < mParentPlot->mGraphs.size(); ++i )
{
- if( mParentPlot->mGraphs.at( i )->keyAxis()->axisRect() == this ||
- mParentPlot->mGraphs.at( i )->valueAxis()->axisRect() == this )
+ if( mParentPlot->mGraphs.at( i )->keyAxis()->axisRect() == this || mParentPlot->mGraphs.at( i )->valueAxis()->axisRect() == this )
result.append( mParentPlot->mGraphs.at( i ) );
}
return result;
@@ -14508,8 +14171,7 @@ QList QCPAxisRect::items() const
QList positions = mParentPlot->mItems.at( itemId )->positions();
for( int posId = 0; posId < positions.size(); ++posId )
{
- if( positions.at( posId )->axisRect() == this ||
- positions.at( posId )->keyAxis()->axisRect() == this ||
+ if( positions.at( posId )->axisRect() == this || positions.at( posId )->keyAxis()->axisRect() == this ||
positions.at( posId )->valueAxis()->axisRect() == this )
{
result.append( mParentPlot->mItems.at( itemId ) );
@@ -14862,16 +14524,12 @@ void QCPAxisRect::drawBackground( QCPPainter* painter )
QSize scaledSize( mBackgroundPixmap.size() );
scaledSize.scale( mRect.size(), mBackgroundScaledMode );
if( mScaledBackgroundPixmap.size() != scaledSize )
- mScaledBackgroundPixmap = mBackgroundPixmap.scaled( mRect.size(), mBackgroundScaledMode,
- Qt::SmoothTransformation );
- painter->drawPixmap(
- mRect.topLeft(), mScaledBackgroundPixmap,
- QRect( 0, 0, mRect.width(), mRect.height() ) & mScaledBackgroundPixmap.rect() );
+ mScaledBackgroundPixmap = mBackgroundPixmap.scaled( mRect.size(), mBackgroundScaledMode, Qt::SmoothTransformation );
+ painter->drawPixmap( mRect.topLeft(), mScaledBackgroundPixmap, QRect( 0, 0, mRect.width(), mRect.height() ) & mScaledBackgroundPixmap.rect() );
}
else
{
- painter->drawPixmap( mRect.topLeft(), mBackgroundPixmap,
- QRect( 0, 0, mRect.width(), mRect.height() ) );
+ painter->drawPixmap( mRect.topLeft(), mBackgroundPixmap, QRect( 0, 0, mRect.width(), mRect.height() ) );
}
}
}
@@ -14990,17 +14648,13 @@ void QCPAxisRect::mouseMoveEvent( QMouseEvent* event )
{
if( rangeDragHorzAxis->mScaleType == QCPAxis::stLinear )
{
- double diff = rangeDragHorzAxis->pixelToCoord( mDragStart.x() ) -
- rangeDragHorzAxis->pixelToCoord( event->pos().x() );
- rangeDragHorzAxis->setRange( mDragStartHorzRange.lower + diff,
- mDragStartHorzRange.upper + diff );
+ double diff = rangeDragHorzAxis->pixelToCoord( mDragStart.x() ) - rangeDragHorzAxis->pixelToCoord( event->pos().x() );
+ rangeDragHorzAxis->setRange( mDragStartHorzRange.lower + diff, mDragStartHorzRange.upper + diff );
}
else if( rangeDragHorzAxis->mScaleType == QCPAxis::stLogarithmic )
{
- double diff = rangeDragHorzAxis->pixelToCoord( mDragStart.x() ) /
- rangeDragHorzAxis->pixelToCoord( event->pos().x() );
- rangeDragHorzAxis->setRange( mDragStartHorzRange.lower * diff,
- mDragStartHorzRange.upper * diff );
+ double diff = rangeDragHorzAxis->pixelToCoord( mDragStart.x() ) / rangeDragHorzAxis->pixelToCoord( event->pos().x() );
+ rangeDragHorzAxis->setRange( mDragStartHorzRange.lower * diff, mDragStartHorzRange.upper * diff );
}
}
}
@@ -15010,17 +14664,13 @@ void QCPAxisRect::mouseMoveEvent( QMouseEvent* event )
{
if( rangeDragVertAxis->mScaleType == QCPAxis::stLinear )
{
- double diff = rangeDragVertAxis->pixelToCoord( mDragStart.y() ) -
- rangeDragVertAxis->pixelToCoord( event->pos().y() );
- rangeDragVertAxis->setRange( mDragStartVertRange.lower + diff,
- mDragStartVertRange.upper + diff );
+ double diff = rangeDragVertAxis->pixelToCoord( mDragStart.y() ) - rangeDragVertAxis->pixelToCoord( event->pos().y() );
+ rangeDragVertAxis->setRange( mDragStartVertRange.lower + diff, mDragStartVertRange.upper + diff );
}
else if( rangeDragVertAxis->mScaleType == QCPAxis::stLogarithmic )
{
- double diff = rangeDragVertAxis->pixelToCoord( mDragStart.y() ) /
- rangeDragVertAxis->pixelToCoord( event->pos().y() );
- rangeDragVertAxis->setRange( mDragStartVertRange.lower * diff,
- mDragStartVertRange.upper * diff );
+ double diff = rangeDragVertAxis->pixelToCoord( mDragStart.y() ) / rangeDragVertAxis->pixelToCoord( event->pos().y() );
+ rangeDragVertAxis->setRange( mDragStartVertRange.lower * diff, mDragStartVertRange.upper * diff );
}
}
}
@@ -15081,15 +14731,13 @@ void QCPAxisRect::wheelEvent( QWheelEvent* event )
{
factor = pow( mRangeZoomFactorHorz, wheelSteps );
if( mRangeZoomHorzAxis.data() )
- mRangeZoomHorzAxis.data()->scaleRange(
- factor, mRangeZoomHorzAxis.data()->pixelToCoord( event->pos().x() ) );
+ mRangeZoomHorzAxis.data()->scaleRange( factor, mRangeZoomHorzAxis.data()->pixelToCoord( event->pos().x() ) );
}
if( mRangeZoom.testFlag( Qt::Vertical ) )
{
factor = pow( mRangeZoomFactorVert, wheelSteps );
if( mRangeZoomVertAxis.data() )
- mRangeZoomVertAxis.data()->scaleRange(
- factor, mRangeZoomVertAxis.data()->pixelToCoord( event->pos().y() ) );
+ mRangeZoomVertAxis.data()->scaleRange( factor, mRangeZoomVertAxis.data()->pixelToCoord( event->pos().y() ) );
}
mParentPlot->replot();
}
@@ -15236,15 +14884,12 @@ void QCPAbstractLegendItem::setSelected( bool selected )
}
/* inherits documentation from base class */
-double QCPAbstractLegendItem::selectTest( const QPointF& pos,
- bool onlySelectable,
- QVariant* details ) const
+double QCPAbstractLegendItem::selectTest( const QPointF& pos, bool onlySelectable, QVariant* details ) const
{
Q_UNUSED( details )
if( !mParentPlot )
return -1;
- if( onlySelectable &&
- ( !mSelectable || !mParentLegend->selectableParts().testFlag( QCPLegend::spItems ) ) )
+ if( onlySelectable && ( !mSelectable || !mParentLegend->selectableParts().testFlag( QCPLegend::spItems ) ) )
return -1;
if( mRect.contains( pos.toPoint() ) )
@@ -15266,10 +14911,7 @@ QRect QCPAbstractLegendItem::clipRect() const
}
/* inherits documentation from base class */
-void QCPAbstractLegendItem::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPAbstractLegendItem::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
Q_UNUSED( details )
@@ -15399,14 +15041,13 @@ void QCPPlottableLegendItem::draw( QCPPainter* painter )
painter->setFont( getFont() );
painter->setPen( QPen( getTextColor() ) );
QSizeF iconSize = mParentLegend->iconSize();
- QRectF textRect = painter->fontMetrics().boundingRect( 0, 0, 0, iconSize.height(),
- Qt::TextDontClip, mPlottable->name() );
+ QRectF textRect = painter->fontMetrics().boundingRect( 0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name() );
QRectF iconRect( mRect.topLeft(), iconSize );
int textHeight = qMax( textRect.height(), iconSize.height() ); // if text has smaller height than
// icon, center text vertically in
// icon height, else align tops
- painter->drawText( mRect.x() + iconSize.width() + mParentLegend->iconTextPadding(), mRect.y(),
- textRect.width(), textHeight, Qt::TextDontClip, mPlottable->name() );
+ painter->drawText( mRect.x() + iconSize.width() + mParentLegend->iconTextPadding(), mRect.y(), textRect.width(), textHeight, Qt::TextDontClip,
+ mPlottable->name() );
// draw icon:
painter->save();
painter->setClipRect( iconRect, Qt::IntersectClip );
@@ -15435,12 +15076,9 @@ QSize QCPPlottableLegendItem::minimumSizeHint() const
QRect textRect;
QFontMetrics fontMetrics( getFont() );
QSize iconSize = mParentLegend->iconSize();
- textRect =
- fontMetrics.boundingRect( 0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name() );
- result.setWidth( iconSize.width() + mParentLegend->iconTextPadding() + textRect.width() +
- mMargins.left() + mMargins.right() );
- result.setHeight( qMax( textRect.height(), iconSize.height() ) + mMargins.top() +
- mMargins.bottom() );
+ textRect = fontMetrics.boundingRect( 0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name() );
+ result.setWidth( iconSize.width() + mParentLegend->iconTextPadding() + textRect.width() + mMargins.left() + mMargins.right() );
+ result.setHeight( qMax( textRect.height(), iconSize.height() ) + mMargins.top() + mMargins.bottom() );
return result;
}
@@ -15715,16 +15353,14 @@ void QCPLegend::setSelectedParts( const SelectableParts& selected )
if( mSelectedParts != newSelected )
{
- if( !mSelectedParts.testFlag( spItems ) &&
- newSelected.testFlag( spItems ) ) // attempt to set spItems flag (can't do that)
+ if( !mSelectedParts.testFlag( spItems ) && newSelected.testFlag( spItems ) ) // attempt to set spItems flag (can't do that)
{
qDebug() << Q_FUNC_INFO
<< "spItems flag can not be set, it can only be "
"unset with this function";
newSelected &= ~spItems;
}
- if( mSelectedParts.testFlag( spItems ) &&
- !newSelected.testFlag( spItems ) ) // spItems flag was unset, so clear item selection
+ if( mSelectedParts.testFlag( spItems ) && !newSelected.testFlag( spItems ) ) // spItems flag was unset, so clear item selection
{
for( int i = 0; i < itemCount(); ++i )
{
@@ -16029,21 +15665,17 @@ double QCPLegend::selectTest( const QPointF& pos, bool onlySelectable, QVariant*
}
/* inherits documentation from base class */
-void QCPLegend::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPLegend::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
mSelectedParts = selectedParts(); // in case item selection has changed
if( details.value() == spLegendBox && mSelectableParts.testFlag( spLegendBox ) )
{
SelectableParts selBefore = mSelectedParts;
- setSelectedParts( additive ? mSelectedParts ^ spLegendBox
- : mSelectedParts | spLegendBox ); // no need to
- // unset spItems
- // in !additive
- // case, because
+ setSelectedParts( additive ? mSelectedParts ^ spLegendBox : mSelectedParts | spLegendBox ); // no need to
+ // unset spItems
+ // in !additive
+ // case, because
// they will be deselected by QCustomPlot (they're
// normal QCPLayerables with own deselectEvent)
if( selectionStateChanged )
@@ -16139,8 +15771,7 @@ QCPPlotTitle::QCPPlotTitle( QCustomPlot* parentPlot )
{
setLayer( parentPlot->currentLayer() );
mFont = QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.5, QFont::Bold );
- mSelectedFont =
- QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.6, QFont::Bold );
+ mSelectedFont = QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.6, QFont::Bold );
}
setMargins( QMargins( 5, 5, 5, 0 ) );
}
@@ -16153,11 +15784,9 @@ QCPPlotTitle::QCPPlotTitle( QCustomPlot* parentPlot )
QCPPlotTitle::QCPPlotTitle( QCustomPlot* parentPlot, const QString& text )
: QCPLayoutElement( parentPlot )
, mText( text )
- , mFont(
- QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.5, QFont::Bold ) )
+ , mFont( QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.5, QFont::Bold ) )
, mTextColor( Qt::black )
- , mSelectedFont(
- QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.6, QFont::Bold ) )
+ , mSelectedFont( QFont( parentPlot->font().family(), parentPlot->font().pointSize() * 1.6, QFont::Bold ) )
, mSelectedTextColor( Qt::blue )
, mSelectable( false )
, mSelected( false )
@@ -16288,10 +15917,7 @@ QSize QCPPlotTitle::maximumSizeHint() const
}
/* inherits documentation from base class */
-void QCPPlotTitle::selectEvent( QMouseEvent* event,
- bool additive,
- const QVariant& details,
- bool* selectionStateChanged )
+void QCPPlotTitle::selectEvent( QMouseEvent* event, bool additive, const QVariant& details, bool* selectionStateChanged )
{
Q_UNUSED( event )
Q_UNUSED( details )
@@ -16518,8 +16144,7 @@ bool QCPColorScale::rangeDrag() const
return mAxisRect.data()->rangeDrag().testFlag( QCPAxis::orientation( mType ) ) &&
mAxisRect.data()->rangeDragAxis( QCPAxis::orientation( mType ) ) &&
- mAxisRect.data()->rangeDragAxis( QCPAxis::orientation( mType ) )->orientation() ==
- QCPAxis::orientation( mType );
+ mAxisRect.data()->rangeDragAxis( QCPAxis::orientation( mType ) )->orientation() == QCPAxis::orientation( mType );
}
/* undocumented getter */
@@ -16533,8 +16158,7 @@ bool QCPColorScale::rangeZoom() const
return mAxisRect.data()->rangeZoom().testFlag( QCPAxis::orientation( mType ) ) &&
mAxisRect.data()->rangeZoomAxis( QCPAxis::orientation( mType ) ) &&
- mAxisRect.data()->rangeZoomAxis( QCPAxis::orientation( mType ) )->orientation() ==
- QCPAxis::orientation( mType );
+ mAxisRect.data()->rangeZoomAxis( QCPAxis::orientation( mType ) )->orientation() == QCPAxis::orientation( mType );
}
/*!
@@ -16567,14 +16191,10 @@ void QCPColorScale::setType( QCPAxis::AxisType type )
labelTransfer = mColorAxis.data()->label();
logBaseTransfer = mColorAxis.data()->scaleLogBase();
mColorAxis.data()->setLabel( "" );
- disconnect( mColorAxis.data(), SIGNAL( rangeChanged( QCPRange ) ), this,
- SLOT( setDataRange( QCPRange ) ) );
- disconnect( mColorAxis.data(), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), this,
- SLOT( setDataScaleType( QCPAxis::ScaleType ) ) );
+ disconnect( mColorAxis.data(), SIGNAL( rangeChanged( QCPRange ) ), this, SLOT( setDataRange( QCPRange ) ) );
+ disconnect( mColorAxis.data(), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), this, SLOT( setDataScaleType( QCPAxis::ScaleType ) ) );
}
- foreach( QCPAxis::AxisType atype, QList()
- << QCPAxis::atLeft << QCPAxis::atRight
- << QCPAxis::atBottom << QCPAxis::atTop )
+ foreach( QCPAxis::AxisType atype, QList() << QCPAxis::atLeft << QCPAxis::atRight << QCPAxis::atBottom << QCPAxis::atTop )
{
mAxisRect.data()->axis( atype )->setTicks( atype == mType );
mAxisRect.data()->axis( atype )->setTickLabels( atype == mType );
@@ -16592,13 +16212,10 @@ void QCPColorScale::setType( QCPAxis::AxisType type )
// axes in realtime via
// signals (connected in QCPColorScale ctor), so we only
// need to take care of log base here
- connect( mColorAxis.data(), SIGNAL( rangeChanged( QCPRange ) ), this,
- SLOT( setDataRange( QCPRange ) ) );
- connect( mColorAxis.data(), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), this,
- SLOT( setDataScaleType( QCPAxis::ScaleType ) ) );
- mAxisRect.data()->setRangeDragAxes(
- QCPAxis::orientation( mType ) == Qt::Horizontal ? mColorAxis.data() : 0,
- QCPAxis::orientation( mType ) == Qt::Vertical ? mColorAxis.data() : 0 );
+ connect( mColorAxis.data(), SIGNAL( rangeChanged( QCPRange ) ), this, SLOT( setDataRange( QCPRange ) ) );
+ connect( mColorAxis.data(), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), this, SLOT( setDataScaleType( QCPAxis::ScaleType ) ) );
+ mAxisRect.data()->setRangeDragAxes( QCPAxis::orientation( mType ) == Qt::Horizontal ? mColorAxis.data() : 0,
+ QCPAxis::orientation( mType ) == Qt::Vertical ? mColorAxis.data() : 0 );
}
}
@@ -16809,10 +16426,9 @@ void QCPColorScale::rescaleDataRange( bool onlyVisibleMaps )
// this
// dimension), shift current range to at least center the data
{
- double center = ( newRange.lower + newRange.upper ) *
- 0.5; // upper and lower should be equal anyway, but just to
- // make sure, incase validRange returned false for
- // other reason
+ double center = ( newRange.lower + newRange.upper ) * 0.5; // upper and lower should be equal anyway, but just to
+ // make sure, incase validRange returned false for
+ // other reason
if( mDataScaleType == QCPAxis::stLinear )
{
newRange.lower = center - mDataRange.size() / 2.0;
@@ -16846,22 +16462,16 @@ void QCPColorScale::update( UpdatePhase phase )
{
if( mType == QCPAxis::atBottom || mType == QCPAxis::atTop )
{
- setMaximumSize( QWIDGETSIZE_MAX, mBarWidth + mAxisRect.data()->margins().top() +
- mAxisRect.data()->margins().bottom() + margins().top() +
- margins().bottom() );
- setMinimumSize( 0, mBarWidth + mAxisRect.data()->margins().top() +
- mAxisRect.data()->margins().bottom() + margins().top() +
- margins().bottom() );
+ setMaximumSize( QWIDGETSIZE_MAX,
+ mBarWidth + mAxisRect.data()->margins().top() + mAxisRect.data()->margins().bottom() + margins().top() + margins().bottom() );
+ setMinimumSize( 0,
+ mBarWidth + mAxisRect.data()->margins().top() + mAxisRect.data()->margins().bottom() + margins().top() + margins().bottom() );
}
else
{
- setMaximumSize( mBarWidth + mAxisRect.data()->margins().left() +
- mAxisRect.data()->margins().right() + margins().left() +
- margins().right(),
+ setMaximumSize( mBarWidth + mAxisRect.data()->margins().left() + mAxisRect.data()->margins().right() + margins().left() + margins().right(),
QWIDGETSIZE_MAX );
- setMinimumSize( mBarWidth + mAxisRect.data()->margins().left() +
- mAxisRect.data()->margins().right() + margins().left() +
- margins().right(),
+ setMinimumSize( mBarWidth + mAxisRect.data()->margins().left() + mAxisRect.data()->margins().right() + margins().left() + margins().right(),
0 );
}
break;
@@ -16944,52 +16554,38 @@ void QCPColorScale::wheelEvent( QWheelEvent* event )
Creates a new instance, as a child of \a parentColorScale.
*/
QCPColorScaleAxisRectPrivate::QCPColorScaleAxisRectPrivate( QCPColorScale* parentColorScale )
- : QCPAxisRect( parentColorScale->parentPlot(), true )
- , mParentColorScale( parentColorScale )
- , mGradientImageInvalidated( true )
+ : QCPAxisRect( parentColorScale->parentPlot(), true ), mParentColorScale( parentColorScale ), mGradientImageInvalidated( true )
{
setParentLayerable( parentColorScale );
setMinimumMargins( QMargins( 0, 0, 0, 0 ) );
- foreach( QCPAxis::AxisType type, QList()
- << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft
- << QCPAxis::atRight )
+ foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight )
{
axis( type )->setVisible( true );
axis( type )->grid()->setVisible( false );
axis( type )->setPadding( 0 );
- connect( axis( type ), SIGNAL( selectionChanged( QCPAxis::SelectableParts ) ), this,
- SLOT( axisSelectionChanged( QCPAxis::SelectableParts ) ) );
- connect( axis( type ), SIGNAL( selectableChanged( QCPAxis::SelectableParts ) ), this,
- SLOT( axisSelectableChanged( QCPAxis::SelectableParts ) ) );
+ connect( axis( type ), SIGNAL( selectionChanged( QCPAxis::SelectableParts ) ), this, SLOT( axisSelectionChanged( QCPAxis::SelectableParts ) ) );
+ connect( axis( type ), SIGNAL( selectableChanged( QCPAxis::SelectableParts ) ), this, SLOT( axisSelectableChanged( QCPAxis::SelectableParts ) ) );
}
- connect( axis( QCPAxis::atLeft ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atRight ),
- SLOT( setRange( QCPRange ) ) );
- connect( axis( QCPAxis::atRight ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atLeft ),
- SLOT( setRange( QCPRange ) ) );
- connect( axis( QCPAxis::atBottom ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atTop ),
- SLOT( setRange( QCPRange ) ) );
- connect( axis( QCPAxis::atTop ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atBottom ),
- SLOT( setRange( QCPRange ) ) );
- connect( axis( QCPAxis::atLeft ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ),
- axis( QCPAxis::atRight ), SLOT( setScaleType( QCPAxis::ScaleType ) ) );
- connect( axis( QCPAxis::atRight ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ),
- axis( QCPAxis::atLeft ), SLOT( setScaleType( QCPAxis::ScaleType ) ) );
- connect( axis( QCPAxis::atBottom ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ),
- axis( QCPAxis::atTop ), SLOT( setScaleType( QCPAxis::ScaleType ) ) );
- connect( axis( QCPAxis::atTop ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ),
- axis( QCPAxis::atBottom ), SLOT( setScaleType( QCPAxis::ScaleType ) ) );
+ connect( axis( QCPAxis::atLeft ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atRight ), SLOT( setRange( QCPRange ) ) );
+ connect( axis( QCPAxis::atRight ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atLeft ), SLOT( setRange( QCPRange ) ) );
+ connect( axis( QCPAxis::atBottom ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atTop ), SLOT( setRange( QCPRange ) ) );
+ connect( axis( QCPAxis::atTop ), SIGNAL( rangeChanged( QCPRange ) ), axis( QCPAxis::atBottom ), SLOT( setRange( QCPRange ) ) );
+ connect( axis( QCPAxis::atLeft ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), axis( QCPAxis::atRight ),
+ SLOT( setScaleType( QCPAxis::ScaleType ) ) );
+ connect( axis( QCPAxis::atRight ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), axis( QCPAxis::atLeft ),
+ SLOT( setScaleType( QCPAxis::ScaleType ) ) );
+ connect( axis( QCPAxis::atBottom ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), axis( QCPAxis::atTop ),
+ SLOT( setScaleType( QCPAxis::ScaleType ) ) );
+ connect( axis( QCPAxis::atTop ), SIGNAL( scaleTypeChanged( QCPAxis::ScaleType ) ), axis( QCPAxis::atBottom ),
+ SLOT( setScaleType( QCPAxis::ScaleType ) ) );
// make layer transfers of color scale transfer to axis rect and axes
// the axes must be set after axis rect, such that they appear above color
// gradient drawn by axis rect:
- connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), this,
- SLOT( setLayer( QCPLayer* ) ) );
- foreach( QCPAxis::AxisType type, QList()
- << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft
- << QCPAxis::atRight )
- connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), axis( type ),
- SLOT( setLayer( QCPLayer* ) ) );
+ connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), this, SLOT( setLayer( QCPLayer* ) ) );
+ foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight )
+ connect( parentColorScale, SIGNAL( layerChanged( QCPLayer* ) ), axis( type ), SLOT( setLayer( QCPLayer* ) ) );
}
/*! \internal
@@ -17008,11 +16604,9 @@ void QCPColorScaleAxisRectPrivate::draw( QCPPainter* painter )
if( mParentColorScale->mColorAxis )
{
mirrorHorz = mParentColorScale->mColorAxis.data()->rangeReversed() &&
- ( mParentColorScale->type() == QCPAxis::atBottom ||
- mParentColorScale->type() == QCPAxis::atTop );
+ ( mParentColorScale->type() == QCPAxis::atBottom || mParentColorScale->type() == QCPAxis::atTop );
mirrorVert = mParentColorScale->mColorAxis.data()->rangeReversed() &&
- ( mParentColorScale->type() == QCPAxis::atLeft ||
- mParentColorScale->type() == QCPAxis::atRight );
+ ( mParentColorScale->type() == QCPAxis::atLeft || mParentColorScale->type() == QCPAxis::atRight );
}
painter->drawImage( rect(), mGradientImage.mirrored( mirrorHorz, mirrorVert ) );
@@ -17044,8 +16638,7 @@ void QCPColorScaleAxisRectPrivate::updateGradientImage()
QVector pixels;
for( int y = 0; y < h; ++y )
pixels.append( reinterpret_cast( mGradientImage.scanLine( y ) ) );
- mParentColorScale->mGradient.colorize( data.constData(), QCPRange( 0, n - 1 ), pixels.first(),
- n );
+ mParentColorScale->mGradient.colorize( data.constData(), QCPRange( 0, n - 1 ), pixels.first(), n );
for( int y = 1; y < h; ++y )
memcpy( pixels.at( y ), pixels.first(), n * sizeof( QRgb ) );
}
@@ -17057,8 +16650,7 @@ void QCPColorScaleAxisRectPrivate::updateGradientImage()
for( int y = 0; y < h; ++y )
{
QRgb* pixels = reinterpret_cast( mGradientImage.scanLine( y ) );
- const QRgb lineColor =
- mParentColorScale->mGradient.color( data[h - 1 - y], QCPRange( 0, n - 1 ) );
+ const QRgb lineColor = mParentColorScale->mGradient.color( data[h - 1 - y], QCPRange( 0, n - 1 ) );
for( int x = 0; x < w; ++x )
pixels[x] = lineColor;
}
@@ -17075,9 +16667,7 @@ void QCPColorScaleAxisRectPrivate::updateGradientImage()
void QCPColorScaleAxisRectPrivate::axisSelectionChanged( QCPAxis::SelectableParts selectedParts )
{
// axis bases of four axes shall always (de-)selected synchronously:
- foreach( QCPAxis::AxisType type, QList()
- << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft
- << QCPAxis::atRight )
+ foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight )
{
if( QCPAxis* senderAxis = qobject_cast( sender() ) )
if( senderAxis->axisType() == type )
@@ -17102,9 +16692,7 @@ void QCPColorScaleAxisRectPrivate::axisSelectionChanged( QCPAxis::SelectablePart
void QCPColorScaleAxisRectPrivate::axisSelectableChanged( QCPAxis::SelectableParts selectableParts )
{
// synchronize axis base selectability:
- foreach( QCPAxis::AxisType type, QList()
- << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft
- << QCPAxis::atRight )
+ foreach( QCPAxis::AxisType type, QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight )
{
if( QCPAxis* senderAxis = qobject_cast( sender() ) )
if( senderAxis->axisType() == type )
@@ -17143,27 +16731,14 @@ void QCPColorScaleAxisRectPrivate::axisSelectableChanged( QCPAxis::SelectablePar
/*!
Constructs a data point with key, value and all errors set to zero.
*/
-QCPData::QCPData()
- : key( 0 )
- , value( 0 )
- , keyErrorPlus( 0 )
- , keyErrorMinus( 0 )
- , valueErrorPlus( 0 )
- , valueErrorMinus( 0 )
-{
-}
+QCPData::QCPData() : key( 0 ), value( 0 ), keyErrorPlus( 0 ), keyErrorMinus( 0 ), valueErrorPlus( 0 ), valueErrorMinus( 0 ) {}
/*!
Constructs a data point with the specified \a key and \a value. All errors are
set to zero.
*/
QCPData::QCPData( double key, double value )
- : key( key )
- , value( value )
- , keyErrorPlus( 0 )
- , keyErrorMinus( 0 )
- , valueErrorPlus( 0 )
- , valueErrorMinus( 0 )
+ : key( key ), value( value ), keyErrorPlus( 0 ), keyErrorMinus( 0 ), valueErrorPlus( 0 ), valueErrorMinus( 0 )
{
}
@@ -17246,8 +16821,7 @@ QCPData::QCPData( double key, double value )
To directly create a graph inside a plot, you can also use the simpler
QCustomPlot::addGraph function.
*/
-QCPGraph::QCPGraph( QCPAxis* keyAxis, QCPAxis* valueAxis )
- : QCPAbstractPlottable( keyAxis, valueAxis )
+QCPGraph::QCPGraph( QCPAxis* keyAxis, QCPAxis* valueAxis ) : QCPAbstractPlottable( keyAxis, valueAxis )
{
mData = new QCPDataMap;
@@ -17331,9 +16905,7 @@ void QCPGraph::setData( const QVector& key, const QVector& value
For asymmetrical errors (plus different from minus), see the overloaded
version of this function.
*/
-void QCPGraph::setDataValueError( const QVector& key,
- const QVector& value,
- const QVector& valueError )
+void QCPGraph::setDataValueError( const QVector& key, const QVector& value, const QVector& valueError )
{
mData->clear();
int n = key.size();
@@ -17395,9 +16967,7 @@ void QCPGraph::setDataValueError( const QVector& key,
For asymmetrical errors (plus different from minus), see the overloaded
version of this function.
*/
-void QCPGraph::setDataKeyError( const QVector& key,
- const QVector& value,
- const QVector& keyError )
+void QCPGraph::setDataKeyError( const QVector& key, const QVector& value, const QVector& keyError )
{
mData->clear();
int n = key.size();
@@ -17968,8 +17538,7 @@ void QCPGraph::draw( QCPPainter* painter )
QCPDataMap::const_iterator it;
for( it = mData->constBegin(); it != mData->constEnd(); ++it )
{
- if( QCP::isInvalidData( it.value().key, it.value().value ) ||
- QCP::isInvalidData( it.value().keyErrorPlus, it.value().keyErrorMinus ) ||
+ if( QCP::isInvalidData( it.value().key, it.value().value ) || QCP::isInvalidData( it.value().keyErrorPlus, it.value().keyErrorMinus ) ||
QCP::isInvalidData( it.value().valueErrorPlus, it.value().valueErrorPlus ) )
qDebug() << Q_FUNC_INFO << "Data point at" << it.key() << "invalid."
<< "Plottable name:" << name();
@@ -18002,9 +17571,7 @@ void QCPGraph::drawLegendIcon( QCPPainter* painter, const QRectF& rect ) const
if( mBrush.style() != Qt::NoBrush )
{
applyFillAntialiasingHint( painter );
- painter->fillRect(
- QRectF( rect.left(), rect.top() + rect.height() / 2.0, rect.width(), rect.height() / 3.0 ),
- mBrush );
+ painter->fillRect( QRectF( rect.left(), rect.top() + rect.height() / 2.0, rect.width(), rect.height() / 3.0 ), mBrush );
}
// draw line vertically centered:
if( mLineStyle != lsNone )
@@ -18022,12 +17589,10 @@ void QCPGraph::drawLegendIcon( QCPPainter* painter, const QRectF& rect ) const
applyScattersAntialiasingHint( painter );
// scale scatter pixmap if it's too large to fit in legend icon rect:
if( mScatterStyle.shape() == QCPScatterStyle::ssPixmap &&
- ( mScatterStyle.pixmap().size().width() > rect.width() ||
- mScatterStyle.pixmap().size().height() > rect.height() ) )
+ ( mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height() ) )
{
QCPScatterStyle scaledStyle( mScatterStyle );
- scaledStyle.setPixmap( scaledStyle.pixmap().scaled( rect.size().toSize(), Qt::KeepAspectRatio,
- Qt::SmoothTransformation ) );
+ scaledStyle.setPixmap( scaledStyle.pixmap().scaled( rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation ) );
scaledStyle.applyTo( painter, mPen );
scaledStyle.drawShape( painter, QRectF( rect ).center() );
}
@@ -18126,8 +17691,7 @@ void QCPGraph::getScatterPlotData( QVector* scatterData ) const
\see drawLinePlot
*/
-void QCPGraph::getLinePlotData( QVector* linePixelData,
- QVector* scatterData ) const
+void QCPGraph::getLinePlotData( QVector* linePixelData, QVector* scatterData ) const
{
QCPAxis* keyAxis = mKeyAxis.data();
QCPAxis* valueAxis = mValueAxis.data();
@@ -18183,8 +17747,7 @@ void QCPGraph::getLinePlotData( QVector* linePixelData,
\see drawLinePlot
*/
-void QCPGraph::getStepLeftPlotData( QVector* linePixelData,
- QVector* scatterData ) const
+void QCPGraph::getStepLeftPlotData( QVector* linePixelData, QVector* scatterData ) const
{
QCPAxis* keyAxis = mKeyAxis.data();
QCPAxis* valueAxis = mValueAxis.data();
@@ -18253,8 +17816,7 @@ void QCPGraph::getStepLeftPlotData( QVector* linePixelData,
\see drawLinePlot
*/
-void QCPGraph::getStepRightPlotData( QVector* linePixelData,
- QVector* scatterData ) const
+void QCPGraph::getStepRightPlotData( QVector* linePixelData, QVector