Change code order

This commit is contained in:
jfmcarreira committed 2014-03-26 06:16:37 +00:00
1 parent 875ebfd79a
commit 3575cefb44
4 files changed
+127 -136

No files matched your search

+4 -9
View File
@@ -72,7 +72,7 @@ SubWindowHandle::~SubWindowHandle()
}
}
bool SubWindowHandle::loadFile( const QString &fileName )
Bool SubWindowHandle::loadFile( const QString &fileName )
{
ConfigureFormatDialog formatDialog( this );
@@ -168,7 +168,7 @@ Void SubWindowHandle::refreshFrame()
m_cViewArea->setImage( QPixmap::fromImage( *m_pCurrFrameQImage ) );
}
bool SubWindowHandle::save()
Bool SubWindowHandle::save()
{
QString supported = tr( "Supported Files" );
QString formats = InputStream::supportedWriteFormats();
@@ -186,10 +186,10 @@ bool SubWindowHandle::save()
QApplication::setOverrideCursor( Qt::WaitCursor );
if( !m_pCurrStream->writeFrame( fileName ) )
if( m_pCurrFrameQImage->save( fileName ) )
{
QApplication::restoreOverrideCursor();
QMessageBox::warning( this, tr( "SCode" ), tr( "Cannot save file %1" ).arg( fileName ) );
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot save file %1" ).arg( fileName ) );
return false;
}
@@ -321,9 +321,4 @@ void SubWindowHandle::closeEvent( QCloseEvent *event )
event->accept();
}
QString SubWindowHandle::userFriendlyCurrentFile()
{
return m_cWindowName;
}
} // NAMESPACE
+8 -14
View File
@@ -59,15 +59,12 @@ private:
Bool m_bIsPlaying;
private slots:
void adjustScrollBar( double factor );
public:
SubWindowHandle( QWidget * parent = 0 );
~SubWindowHandle();
bool loadFile( const QString &fileName );
bool save();
Bool loadFile( const QString &fileName );
Bool save();
Void stopEvent();
Void seekEvent( UInt new_frame_num );
@@ -128,14 +125,11 @@ public:
QSize sizeHint() const;
/**
* Arranges all the listed widgets (normaly QMdiImageInterface) in a cascade
* pattern.
* @Note This function implementation is taken from the Qt source. The
* QMdiArea only have a function that arranges @b all the child windows.
*/
//static void cascader( QList<QWidget *> &widgets, const QRect &domain );
QString userFriendlyCurrentFile();
QString userFriendlyCurrentFile()
{
return m_cWindowName;
}
QString currentFile()
{
return m_cCurrFileName;
@@ -146,7 +140,7 @@ protected:
public Q_SLOTS:
bool playEvent();
void adjustScrollBar( double factor );
};
} // NAMESPACE
+113 -110
View File
@@ -271,6 +271,119 @@ void plaYUVerApp::chageSubWindowSelection()
//updateWindowMenu();
}
// ----------------------- Status bar Functions -----------------------
void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos, InputStream* stream)
{
Pixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strPixel;
QString strStatus = QString("(%1,%2) ").arg(posX).arg(posY);
PlaYUVerFrame *curFrame = stream->getCurrFrame();
iWidth = stream->getWidth();
iHeight = stream->getHeight();
if( (posX<iWidth) && (posX>=0) && (posY<iHeight) && (posY>=0) )
{
sPixelValue = curFrame->getPixelValue(pos,COLOR_YUV);
strPixel = QString("Y: %1 U: %2 V: %3").arg(sPixelValue.Luma).arg(sPixelValue.ChromaU).arg(sPixelValue.ChromaV);
}
else
{
strPixel = QString("Y: U: V: ");
}
strStatus.append(strPixel);
statusBar()->showMessage( strStatus , 0 );
}
// ----------------------- Drag and drop functions ----------------------
void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
{
//setText(tr("<drop content>"));
setBackgroundRole( QPalette::Highlight );
event->acceptProposedAction();
}
void plaYUVerApp::dropEvent( QDropEvent *event )
{
const QMimeData *mimeData = event->mimeData();
QList<QUrl> urlList = mimeData->urls();
if( urlList.size() == 1 )
{
QString fileName = urlList.at( 0 ).toLocalFile();
m_cLastOpenPath = QFileInfo( fileName ).path();
QMdiSubWindow *existing = findSubWindow( fileName );
if( !existing )
{
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
}
else
{
interfaceChild->close();
}
}
}
}
// ----------------------- Gui Functions -----------------------
SubWindowHandle *plaYUVerApp::createSubWindow()
{
SubWindowHandle *child = new SubWindowHandle;
mdiArea->addSubWindow( child );
return child;
}
void plaYUVerApp::addSubWindow( SubWindowHandle *child )
{
//connect( child, SIGNAL( areaSelected( QRect ) ), this, SLOT( setSelection( QRect ) ) );
// Add the interface to the mdiArea
mdiArea->addSubWindow( child );
return;
}
SubWindowHandle *plaYUVerApp::activeSubWindow()
{
if( QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow() )
return qobject_cast<SubWindowHandle *>( activeSubWindow );
return 0;
}
QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName )
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
if( mdiChild->currentFile() == canonicalFilePath )
return window;
}
return 0;
}
void plaYUVerApp::setActiveSubWindow( QWidget *window )
{
if( !window )
return;
mdiArea->setActiveSubWindow( qobject_cast<QMdiSubWindow *>( window ) );
}
Void plaYUVerApp::updateMenus()
{
Bool hasSubWindow = ( activeSubWindow() != 0 );
@@ -347,23 +460,6 @@ void plaYUVerApp::updateWindowMenu()
}
}
SubWindowHandle *plaYUVerApp::createSubWindow()
{
SubWindowHandle *child = new SubWindowHandle;
mdiArea->addSubWindow( child );
return child;
}
void plaYUVerApp::addSubWindow( SubWindowHandle *child )
{
//connect( child, SIGNAL( areaSelected( QRect ) ), this, SLOT( setSelection( QRect ) ) );
// Add the interface to the mdiArea
mdiArea->addSubWindow( child );
return;
}
Void plaYUVerApp::createActions()
{
// ------------ File ------------
@@ -562,48 +658,6 @@ Void plaYUVerApp::createStatusBar()
statusBar()->showMessage( tr( "Ready" ) );
}
/*
* Drag and drop functions
*/
void plaYUVerApp::dragEnterEvent( QDragEnterEvent *event )
{
//setText(tr("<drop content>"));
setBackgroundRole( QPalette::Highlight );
event->acceptProposedAction();
}
void plaYUVerApp::dropEvent( QDropEvent *event )
{
const QMimeData *mimeData = event->mimeData();
QList<QUrl> urlList = mimeData->urls();
if( urlList.size() == 1 )
{
QString fileName = urlList.at( 0 ).toLocalFile();
m_cLastOpenPath = QFileInfo( fileName ).path();
QMdiSubWindow *existing = findSubWindow( fileName );
if( !existing )
{
SubWindowHandle *interfaceChild = new SubWindowHandle( this ); //createSubWindow();
if( interfaceChild->loadFile( fileName ) )
{
addSubWindow( interfaceChild );
statusBar()->showMessage( tr( "File loaded" ), 2000 );
interfaceChild->show();
}
else
{
interfaceChild->close();
}
}
}
}
Void plaYUVerApp::readSettings()
{
PlaYUVerSettings settings;
@@ -622,55 +676,4 @@ Void plaYUVerApp::writeSettings()
settings.setLastOpenPath( m_cLastOpenPath );
}
SubWindowHandle *plaYUVerApp::activeSubWindow()
{
if( QMdiSubWindow *activeSubWindow = mdiArea->activeSubWindow() )
return qobject_cast<SubWindowHandle *>( activeSubWindow );
return 0;
}
QMdiSubWindow *plaYUVerApp::findSubWindow( const QString &fileName )
{
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
foreach( QMdiSubWindow * window, mdiArea->subWindowList() ){
SubWindowHandle *mdiChild = qobject_cast<SubWindowHandle *>( window);
if( mdiChild->currentFile() == canonicalFilePath )
return window;
}
return 0;
}
void plaYUVerApp::setActiveSubWindow( QWidget *window )
{
if( !window )
return;
mdiArea->setActiveSubWindow( qobject_cast<QMdiSubWindow *>( window ) );
}
void plaYUVerApp::updatePixelValueStatusBar(const QPoint & pos, InputStream* stream)
{
Pixel sPixelValue;
Int iWidth, iHeight;
Int posX = pos.x(), posY = pos.y();
QString strPixel;
QString strStatus = QString("(%1,%2) ").arg(posX).arg(posY);
PlaYUVerFrame *curFrame = stream->getCurrFrame();
iWidth = stream->getWidth();
iHeight = stream->getHeight();
if( (posX<iWidth) && (posX>=0) && (posY<iHeight) && (posY>=0) )
{
sPixelValue = curFrame->getPixelValue(pos,COLOR_YUV);
strPixel = QString("Y: %1 U: %2 V: %3").arg(sPixelValue.Luma).arg(sPixelValue.ChromaU).arg(sPixelValue.ChromaV);
}
else
{
strPixel = QString("Y: U: V: ");
}
strStatus.append(strPixel);
statusBar()->showMessage( strStatus , 0 );
}
} // NAMESPACE
+2 -3
View File
@@ -83,13 +83,12 @@ private Q_SLOTS:
void chageSubWindowSelection();
void updateWindowMenu();
/*
* Drag and drop functions
*/
//! Drag and drop functions
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
void setActiveSubWindow( QWidget *window );
void updatePixelValueStatusBar(const QPoint & pos, InputStream* stream);
private: