Add a custom widget to handle frame num info
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
#include <QTextEdit>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
@@ -75,3 +78,5 @@ AboutDialog::AboutDialog(QWidget *parent)
|
||||
|
||||
setWindowTitle(tr("About %1").arg(QApplication::applicationName()));
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class AboutDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -36,4 +39,6 @@ public:
|
||||
AboutDialog(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __ABOUTDIALOG_H__
|
||||
|
||||
@@ -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 <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#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
|
||||
|
||||
@@ -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 <QtCore>
|
||||
#if( QT_VERSION_PLAYUVER == 5 )
|
||||
#include <QtWidgets>
|
||||
#elif( QT_VERSION_PLAYUVER == 4 )
|
||||
#include <QtGui>
|
||||
#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__
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QtGui>
|
||||
#endif
|
||||
#include <QtDebug>
|
||||
#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] );
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "PropertiesSidebar.h"
|
||||
#include "QualityMeasurementSidebar.h"
|
||||
#include "AboutDialog.h"
|
||||
#include "WidgetFrameNumber.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
@@ -191,12 +192,10 @@ private:
|
||||
|
||||
QVector<SubWindowHandle*> 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<QToolBar*> m_arrayToolBars;
|
||||
|
||||
/**
|
||||
* Array of actions for the main app
|
||||
*/
|
||||
* Array of actions for the main app
|
||||
*/
|
||||
enum APP_ACTION_LIST
|
||||
{
|
||||
OPEN_ACT = 0,
|
||||
|
||||
Reference in New Issue
Block a user