diff --git a/app/QualityMeasurement.cpp b/app/QualityMeasurement.cpp new file mode 100644 index 0000000..3bbd0c6 --- /dev/null +++ b/app/QualityMeasurement.cpp @@ -0,0 +1,109 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file QualityMeasurement.cpp + * \brief Definition of the quality measurement sidebar + */ + +#include "lib/PlaYUVerDefs.h" +#include +#include "QualityMeasurement.h" +#include "DialogSubWindowSelector.h" + +namespace plaYUVer +{ + +QualityMeasurement::QualityMeasurement( QWidget* parent, QMdiArea* mdiArea ) : + m_pcParet( parent ), + m_pcMainWindowMdiArea( mdiArea ) +{ + +} + +QualityMeasurement::~QualityMeasurement() +{ + +} + +Void QualityMeasurement::createActions() +{ + m_arrayActions.resize( TOTAL_ACT ); + m_arrayActions[SELECT_REF_ACT] = new QAction( "Select Reference", this ); + connect( m_arrayActions[SELECT_REF_ACT], SIGNAL( triggered() ), this, SLOT( slotSelectReference() ) ); +} + +QMenu* QualityMeasurement::createMenu() +{ + m_pcMenuQuality = new QMenu( "Quality", this ); + m_pcMenuQuality->addAction( m_arrayActions[SELECT_REF_ACT] ); + return m_pcMenuQuality; +} + +QDockWidget* QualityMeasurement::createDock() +{ + m_pcQualityMeasurementSideBar = new QualityMeasurementSidebar( m_pcParet, m_pcMainWindowMdiArea ); + m_pcQualityMeasurementDock = new QDockWidget( tr( "Quality Measurement" ), this ); + m_pcQualityMeasurementDock->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); + m_pcQualityMeasurementDock->setWidget( m_pcQualityMeasurementSideBar ); + + return m_pcQualityMeasurementDock; +} + +Void QualityMeasurement::updateMenus() +{ + +} + +Void QualityMeasurement::update( VideoSubWindow* currSubWindow ) +{ + m_pcQualityMeasurementSideBar->updateSubWindowList(); + m_pcQualityMeasurementSideBar->updateCurrentWindow( currSubWindow ); +} + +Void QualityMeasurement::slotSelectReference() +{ + DialogSubWindowSelector dialogWindowSelection( this, m_pcMainWindowMdiArea, 1, 1 ); + if( dialogWindowSelection.exec() == QDialog::Accepted ) + { + VideoSubWindow* pcVideoSubWindow; + VideoSubWindow* pcRefSubWindow; + QStringList selectedWindows = dialogWindowSelection.getSelectedWindows(); + QList subWindowList = m_pcMainWindowMdiArea->findChildren(); + for( Int i = 0; i < subWindowList.size(); i++ ) + { + pcVideoSubWindow = subWindowList.at( i ); + if( pcVideoSubWindow->getWindowName() == selectedWindows.at( 0 ) ) + { + pcRefSubWindow = pcVideoSubWindow; + break; + } + } + for( Int i = 0; i < subWindowList.size(); i++ ) + { + pcVideoSubWindow = subWindowList.at( i ); + pcVideoSubWindow->setRefSubWindow( pcRefSubWindow ); + } + m_pcQualityMeasurementSideBar->updateSidebarData(); + m_pcQualityMeasurementDock->show(); + } +} + +} // NAMESPACE + diff --git a/app/QualityMeasurement.h b/app/QualityMeasurement.h new file mode 100644 index 0000000..109527d --- /dev/null +++ b/app/QualityMeasurement.h @@ -0,0 +1,78 @@ +/* This file is a part of plaYUVer project + * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +/** + * \file QualityMeasurement.h + * \brief Definition of the quality measurement sidebar + */ + +#ifndef __QUALITYMEASUREMENT_H__ +#define __QUALITYMEASUREMENT_H__ + +#include "config.h" +#include +#if( QT_VERSION_PLAYUVER == 5 ) +#include +#elif( QT_VERSION_PLAYUVER == 4 ) +#include +#endif +#include "VideoSubWindow.h" +#include "QualityMeasurementSidebar.h" + +namespace plaYUVer +{ + +class VideoSubWindow; + +class QualityMeasurement: public QWidget +{ +Q_OBJECT +public: + QualityMeasurement( QWidget*, QMdiArea * ); + ~QualityMeasurement(); + + Void createActions(); + QMenu* createMenu(); + QDockWidget* createDock(); + Void updateMenus(); + + Void update( VideoSubWindow* currSubWindow ); + +private: + QWidget* m_pcParet; + QMdiArea* m_pcMainWindowMdiArea; + enum + { + SELECT_REF_ACT, + TOTAL_ACT, + }; + QVector m_arrayActions; + QMenu* m_pcMenuQuality; + + QDockWidget* m_pcQualityMeasurementDock; + QualityMeasurementSidebar* m_pcQualityMeasurementSideBar; + +private Q_SLOTS: + void slotSelectReference(); + +}; + +} // NAMESPACE + +#endif // __QUALITYMEASUREMENTSIDEBAR_H__