diff --git a/source/app/AboutDialog.cpp b/source/app/AboutDialog.cpp index 3be057a..b9bc5ba 100644 --- a/source/app/AboutDialog.cpp +++ b/source/app/AboutDialog.cpp @@ -32,6 +32,9 @@ #include #include +namespace plaYUVer +{ + AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) { @@ -75,3 +78,5 @@ AboutDialog::AboutDialog(QWidget *parent) setWindowTitle(tr("About %1").arg(QApplication::applicationName())); } + +} // NAMESPACE diff --git a/source/app/AboutDialog.h b/source/app/AboutDialog.h index 4470655..4938241 100644 --- a/source/app/AboutDialog.h +++ b/source/app/AboutDialog.h @@ -28,6 +28,9 @@ #include +namespace plaYUVer +{ + class AboutDialog : public QDialog { Q_OBJECT @@ -36,4 +39,6 @@ public: AboutDialog(QWidget *parent = 0); }; +} // NAMESPACE + #endif // __ABOUTDIALOG_H__ diff --git a/source/app/WidgetFrameNumber.cpp b/source/app/WidgetFrameNumber.cpp new file mode 100644 index 0000000..7cd0b5b --- /dev/null +++ b/source/app/WidgetFrameNumber.cpp @@ -0,0 +1,74 @@ +/* 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 WidgetFrameNumber.h + * \brief Frame number widget + */ + +#include "config.h" +#include "PlaYUVerDefs.h" +#include +#if( QT_VERSION_PLAYUVER == 5 ) +#include +#elif( QT_VERSION_PLAYUVER == 4 ) +#include +#endif +#include "WidgetFrameNumber.h" + +namespace plaYUVer +{ + +WidgetFrameNumber::WidgetFrameNumber( QWidget *parent ) : + QWidget( parent ) +{ + QHBoxLayout* mainlayout = new QHBoxLayout; + m_pcCurrFrameNumLabel = new QLabel; + m_pcCurrFrameNumLabel->setText( "-" ); + m_pcCurrFrameNumLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + m_pcCurrFrameNumLabel->setMinimumWidth( 25 ); + m_pcCurrFrameNumLabel->setAlignment( Qt::AlignRight ); + QLabel *forwardslash = new QLabel; + forwardslash->setText( "/" ); + m_pcTotalFrameNumLabel = new QLabel; + m_pcTotalFrameNumLabel->setText( "-" ); + m_pcTotalFrameNumLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); + m_pcTotalFrameNumLabel->setMinimumWidth( 30 ); + m_pcTotalFrameNumLabel->setAlignment( Qt::AlignLeft ); + mainlayout->addWidget( m_pcCurrFrameNumLabel ); + mainlayout->addWidget( forwardslash ); + mainlayout->addWidget( m_pcTotalFrameNumLabel ); + setLayout( mainlayout ); +} +Void WidgetFrameNumber::setCurrFrameNum( Int number ) +{ + m_pcCurrFrameNumLabel->setText( QString( tr( "%1" ) ).arg( number + 1 ) ); +} +Void WidgetFrameNumber::setTotalFrameNum( Int number ) +{ + m_pcTotalFrameNumLabel->setText( QString( tr( "%1" ) ).arg( number ) ); +} +Void WidgetFrameNumber::clear() +{ + m_pcCurrFrameNumLabel->setText( "-" ); + m_pcTotalFrameNumLabel->setText( "-" ); +} + +} // NAMESPACE + diff --git a/source/app/WidgetFrameNumber.h b/source/app/WidgetFrameNumber.h new file mode 100644 index 0000000..da127d6 --- /dev/null +++ b/source/app/WidgetFrameNumber.h @@ -0,0 +1,55 @@ +/* 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 WidgetFrameNumber.h + * \brief Frame number widget + */ + +#ifndef __WIDGETFRAMENUMBER_H__ +#define __WIDGETFRAMENUMBER_H__ + +#include "config.h" +#include "PlaYUVerDefs.h" +#include +#if( QT_VERSION_PLAYUVER == 5 ) +#include +#elif( QT_VERSION_PLAYUVER == 4 ) +#include +#endif + +namespace plaYUVer +{ + +class WidgetFrameNumber: public QWidget +{ +public: + WidgetFrameNumber( QWidget *parent = 0 ); + Void setCurrFrameNum( Int number ); + Void setTotalFrameNum( Int number ); + Void clear(); +private: + QLabel *m_pcCurrFrameNumLabel; + QLabel *m_pcTotalFrameNumLabel; + +}; + +} // NAMESPACE + +#endif // __WIDGETFRAMENUMBER_H__ diff --git a/source/app/plaYUVerApp.cpp b/source/app/plaYUVerApp.cpp index 82f5007..4526caa 100644 --- a/source/app/plaYUVerApp.cpp +++ b/source/app/plaYUVerApp.cpp @@ -35,6 +35,7 @@ #include #endif #include +#include "WidgetFrameNumber.h" #include "PlaYUVerSettings.h" @@ -656,11 +657,11 @@ Void plaYUVerApp::updateCurrFrameNum() { Int frame_num = m_pcCurrentSubWindow->getInputStream()->getCurrFrameNum(); m_pcFrameSlider->setValue( frame_num ); - m_pcCurrFrameNumLabel->setText( QString( tr( "%1" ) ).arg( frame_num + 1 ) ); + m_pcFrameNumInfo->setCurrFrameNum( frame_num ); } else { - m_pcCurrFrameNumLabel->setText( "1" ); + m_pcFrameNumInfo->setCurrFrameNum( 0 ); } } Void plaYUVerApp::updateTotalFrameNum() @@ -671,7 +672,7 @@ Void plaYUVerApp::updateTotalFrameNum() total_frame_num = getMaxFrameNumber(); } m_pcFrameSlider->setMaximum( total_frame_num - 1 ); - m_pcTotalFrameNumLabel->setText( QString( tr( "%1" ) ).arg( total_frame_num ) ); + m_pcFrameNumInfo->setTotalFrameNum( total_frame_num ); } Void plaYUVerApp::seekEvent( Int direction ) @@ -1027,8 +1028,7 @@ Void plaYUVerApp::updateMenus() if( !hasSubWindow ) { m_pcFrameSlider->setValue( 0 ); - m_pcCurrFrameNumLabel->setText( "-" ); - m_pcTotalFrameNumLabel->setText( "-" ); + m_pcFrameNumInfo->clear(); } m_arrayActions[NAVIGATION_TOOL_ACT]->setEnabled( hasSubWindow ); m_arrayActions[SELECTION_TOOL_ACT]->setEnabled( hasSubWindow ); @@ -1431,15 +1431,8 @@ Void plaYUVerApp::createToolBars() m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcFrameSlider ); m_arrayToolBars[VIDEO_TOOLBAR]->addAction( m_arrayActions[VIDEO_FORWARD_ACT] ); m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( new QLabel ); - m_pcCurrFrameNumLabel = new QLabel; - m_pcCurrFrameNumLabel->setText( "-" ); - m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcCurrFrameNumLabel ); - QLabel *forwardslash = new QLabel; - forwardslash->setText( "/" ); - m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( forwardslash ); - m_pcTotalFrameNumLabel = new QLabel; - m_pcTotalFrameNumLabel->setText( "-" ); - m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcTotalFrameNumLabel ); + m_pcFrameNumInfo = new WidgetFrameNumber; + m_arrayToolBars[VIDEO_TOOLBAR]->addWidget( m_pcFrameNumInfo ); addToolBar( Qt::TopToolBarArea, m_arrayToolBars[VIDEO_TOOLBAR] ); } diff --git a/source/app/plaYUVerApp.h b/source/app/plaYUVerApp.h index 17c362a..bd2baa0 100644 --- a/source/app/plaYUVerApp.h +++ b/source/app/plaYUVerApp.h @@ -38,6 +38,7 @@ #include "PropertiesSidebar.h" #include "QualityMeasurementSidebar.h" #include "AboutDialog.h" +#include "WidgetFrameNumber.h" namespace plaYUVer { @@ -191,12 +192,10 @@ private: QVector m_acPlayingSubWindows; QSlider *m_pcFrameSlider; - QLabel *m_pcCurrFrameNumLabel; - QLabel *m_pcTotalFrameNumLabel; + + WidgetFrameNumber* m_pcFrameNumInfo; QDoubleSpinBox *m_pcZoomFactorSBox; - - QSignalMapper *mapperZoom; QSignalMapper *mapperSeekVideo; QSignalMapper *mapperWindow; @@ -251,8 +250,8 @@ private: QVector m_arrayToolBars; /** - * Array of actions for the main app - */ + * Array of actions for the main app + */ enum APP_ACTION_LIST { OPEN_ACT = 0,