diff --git a/CMakeLists.txt b/CMakeLists.txt index b055589..f10f8a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,9 @@ IF( USE_FFMPEG ) ENDIF() SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in PlaYUVerStream" TYPE OPTIONAL) +find_package( KF5CoreAddons ) +SET_PACKAGE_PROPERTIES(KF5CoreAddons PROPERTIES URL "http://kde.org/" DESCRIPTION "KF5 core addons support" TYPE OPTIONAL) + IF( WIN32 ) INCLUDE( cmake/Win32.cmake ) ENDIF() diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index c0eca24..ec7357d 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -13,8 +13,8 @@ set(plaYUver_App_SRCS ViewArea.cpp ModulesHandle.cpp PlaYUVerAppModuleIf.cpp - PlaYUVerSettings.cpp GridManager.cpp + Settings.cpp # Dialogs AboutDialog.cpp ConfigureFormatDialog.cpp @@ -108,6 +108,9 @@ ENDIF() ADD_EXECUTABLE( ${PROJECT_NAME} ${plaYUver_App_SRCS} ${HEADERS_MOC_FILES} ${plaYUver_App_UI_Wrap} ${plaYUver_App_RCC} ${WINDOWS_RES_FILE} ) TARGET_LINK_LIBRARIES( ${PROJECT_NAME} PlaYUVerLib PlaYUVerModules ${QT_LINKER_LIBS} ${APP_LINKER_LIBS} ) +IF( ${KF5CoreAddons_FOUND}) + TARGET_LINK_LIBRARIES( ${PROJECT_NAME} KF5::CoreAddons) +ENDIF() IF( NOT USE_QT4 ) QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) diff --git a/app/GridManager.cpp b/app/GridManager.cpp index cb4bda1..fd233c6 100644 --- a/app/GridManager.cpp +++ b/app/GridManager.cpp @@ -33,7 +33,7 @@ #include #include "GridManager.h" -#include "PlaYUVerSettings.h" +#include "Settings.h" namespace plaYUVer { @@ -51,7 +51,7 @@ GridManager::GridManager() //////////////////////////////////////////////////////////////////////////////// void GridManager::drawGrid( QPixmap &image, const QRect& area, QPainter *painter ) { - PlaYUVerSettings settings; + Settings settings; int offsetx = 0; // Grid offset doesn't applies to SCODE int offsety = 0; // project for now... @@ -149,7 +149,7 @@ QRect GridManager::rectContains( int x, int y ) const int multiPosX; int multiPosY; - PlaYUVerSettings settings; + Settings settings; int hSpacing = settings.gridHSpacing(); int vSpacing = settings.gridVSpacing(); @@ -176,7 +176,7 @@ bool GridManager::contains( int x, int y ) int resX; int resY; - PlaYUVerSettings settings; + Settings settings; int hSpacing = settings.gridHSpacing(); int vSpacing = settings.gridVSpacing(); @@ -215,7 +215,7 @@ bool GridManager::isNear( int x, int y ) int multiPosX; int multiPosY; - PlaYUVerSettings settings; + Settings settings; int hSpacing = settings.gridHSpacing(); int vSpacing = settings.gridVSpacing(); diff --git a/app/PlaYUVerSettings.cpp b/app/PlaYUVerSettings.cpp deleted file mode 100644 index 34a5ece..0000000 --- a/app/PlaYUVerSettings.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* 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 PlaYUVerSettings.h - * \brief plaYUVer app settings - */ - -#include "PlaYUVerSettings.h" - -namespace plaYUVer -{ - -PlaYUVerSettings::PlaYUVerSettings() : - m_settings( "pixLRA", "plaYUVer" ) -{ -} -// - - - - - - - - - - - - Main Window Settings - - - - - - - - - - - - - - - - - -QPoint PlaYUVerSettings::mainWindowPos() -{ - return m_settings.value( "MainWindow/pos", QPoint( 200, 200 ) ).toPoint(); -} - -Void PlaYUVerSettings::setMainWindowPos( const QPoint & pos ) -{ - m_settings.setValue( "MainWindow/pos", pos ); -} - -QSize PlaYUVerSettings::mainWindowSize() -{ - return m_settings.value( "MainWindow/size", QSize( 500, 400 ) ).toSize(); -} - -Void PlaYUVerSettings::setMainWindowSize( const QSize & size ) -{ - m_settings.setValue( "MainWindow/size", size ); -} - -QString PlaYUVerSettings::lastOpenPath() -{ - return m_settings.value( "MainWindow/lastOpenPath", QDir::homePath() ).toString(); -} - -Void PlaYUVerSettings::setLastOpenPath( const QString & path ) -{ - m_settings.setValue( "MainWindow/lastOpenPath", path ); -} - -Int PlaYUVerSettings::getSelectedTool() -{ - return m_settings.value( "MainWindow/SelectedTool", ViewArea::NavigationTool ).toInt(); -} - -Void PlaYUVerSettings::setSelectedTool( Int tool ) -{ - m_settings.setValue( "MainWindow/SelectedTool", tool ); -} - -Void PlaYUVerSettings::setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement ) -{ - m_settings.setValue( "Dock/StreamProperties", statusStreamProperties ); - m_settings.setValue( "Dock/FrameProperties", statusFrameProperties ); - m_settings.setValue( "Dock/QualityMeasurement", statusQualityMeasurement ); -} - -Void PlaYUVerSettings::getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement ) -{ - statusStreamProperties = m_settings.value( "Dock/StreamProperties", true ).toBool(); - statusFrameProperties = m_settings.value( "Dock/FrameProperties", true ).toBool(); - statusQualityMeasurement = m_settings.value( "Dock/QualityMeasurement", true ).toBool(); -} - -// - - - - - - - - - - - - PLaying Settings - - - - - - - - - - - - - - - - - -Bool PlaYUVerSettings::getRepeat() -{ - return m_settings.value( "Playing/Repeat", false ).toBool(); -} -Bool PlaYUVerSettings::getVideoLock() -{ - return m_settings.value( "Playing/VideoLock", false ).toBool(); -} -Void PlaYUVerSettings::setPlayingSettings( Bool repeat, Bool lock ) -{ - m_settings.setValue( "Playing/Repeat", repeat ); - m_settings.setValue( "Playing/VideoLock", lock ); -} - -Void PlaYUVerSettings::setRecentFileList( PlaYUVerStreamInfoVector recentFileList ) -{ - QVariant var; - var.setValue( recentFileList ); - m_settings.setValue("MainWindow/RecentFileList", var ); -} - -QVector PlaYUVerSettings::getRecentFileList() -{ - QVariant value = m_settings.value("MainWindow/RecentFileList"); - return value.value(); -} - -// - - - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - - - - - -GridManager::Style PlaYUVerSettings::gridStyle() -{ - return ( GridManager::Style )m_settings.value( "Grid/style", 0 ).toInt(); -} - -void PlaYUVerSettings::setGridStyle( GridManager::Style v ) -{ - m_settings.setValue( "Grid/style", v ); -} - -QColor PlaYUVerSettings::gridColor() -{ - return m_settings.value( "Grid/color", QColor( Qt::white ) ).value(); -} - -Void PlaYUVerSettings::setGridColor( const QColor & v ) -{ - m_settings.setValue( "Grid/color", v ); -} - -Int PlaYUVerSettings::gridHSpacing() -{ - return m_settings.value( "Grid/hSpacing", 16 ).toInt(); -} - -Void PlaYUVerSettings::setGridHSpacing( Int v ) -{ - m_settings.setValue( "Grid/hSpacing", v ); -} - -Int PlaYUVerSettings::gridVSpacing() -{ - return m_settings.value( "Grid/vSpacing", 16 ).toInt(); -} - -Void PlaYUVerSettings::setGridVSpacing( Int v ) -{ - m_settings.setValue( "Grid/vSpacing", v ); -} - -} // NAMESPACE diff --git a/app/PlaYUVerSettings.h b/app/PlaYUVerSettings.h deleted file mode 100644 index 3cf6f80..0000000 --- a/app/PlaYUVerSettings.h +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 PlaYUVerSettings.h - * \brief plaYUVer app settings - */ - -#ifndef __PLAYUVERSETTINGS_H__ -#define __PLAYUVERSETTINGS_H__ - -#include "config.h" -#include "lib/PlaYUVerDefs.h" -#include -#include "GridManager.h" -#include "SubWindowHandle.h" - -namespace plaYUVer -{ - -class PlaYUVerSettings -{ - -public: - PlaYUVerSettings(); - - // - - - - - - - - - - Main Window Settings - - - - - - - - - - - - - - QPoint mainWindowPos(); - Void setMainWindowPos( const QPoint &v ); - - QSize mainWindowSize(); - Void setMainWindowSize( const QSize &v ); - - QString lastOpenPath(); - Void setLastOpenPath( const QString &v ); - - Int getSelectedTool(); - Void setSelectedTool( Int); - - Bool getRepeat(); - Bool getVideoLock(); - Void setPlayingSettings( Bool repeat, Bool lock ); - - Void setDockVisibility( Bool statusStreamProperties, Bool statusFrameProperties, Bool statusQualityMeasurement ); - Void getDockVisibility( Bool& statusStreamProperties, Bool& statusFrameProperties, Bool& statusQualityMeasurement ); - - // - - - - - - - - - - Recent Files Settings - - - - - - - - - - - - - - Void setRecentFileList( PlaYUVerStreamInfoVector recentFileList ); - PlaYUVerStreamInfoVector getRecentFileList(); - - // - - - - - - - - - - - - Grid Settings - - - - - - - - - - - - - - - - GridManager::Style gridStyle(); - Void setGridStyle( GridManager::Style v ); - - QColor gridColor(); - Void setGridColor( const QColor &v ); - - Int gridHSpacing(); - Void setGridHSpacing( Int v ); - - Int gridVSpacing(); - Void setGridVSpacing( Int v ); - -private: - QSettings m_settings; -}; - -} // NAMESPACE - -#endif // __PLAYUVERSETTINGS_H__ diff --git a/app/SubWindowHandle.cpp b/app/SubWindowHandle.cpp index 74e8b1c..a004757 100644 --- a/app/SubWindowHandle.cpp +++ b/app/SubWindowHandle.cpp @@ -29,6 +29,47 @@ namespace plaYUVer { +QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array ) +{ + PlaYUVerStreamInfo d; + out << array.size(); + 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_uiFrameRate; + + } + return out; +} + +QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array ) +{ + PlaYUVerStreamInfo d; + Int array_size; + in >> array_size; + for( Int i = 0; i < array_size; i++ ) + { + in >> d.m_cFilename; + in >> d.m_uiWidth; + in >> d.m_uiHeight; + in >> d.m_iPelFormat; + in >> d.m_uiFrameRate; + array.append( d ); + } + return in; +} + +Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) +{ + for( Int i = 0; i < array.size(); i++ ) + if( array.at( i ).m_cFilename == filename ) + return i; + return -1; +} + SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) : QMdiSubWindow( parent ), m_pCurrStream( NULL ), @@ -101,6 +142,12 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog ) m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate ); + m_sStreamInfo.m_cFilename = m_cFilename; + m_sStreamInfo.m_uiWidth = Width; + m_sStreamInfo.m_uiHeight = Height; + m_sStreamInfo.m_iPelFormat = InputFormat; + m_sStreamInfo.m_uiFrameRate = FrameRate; + m_cViewArea->setInputStream( m_pCurrStream ); QApplication::restoreOverrideCursor(); @@ -123,6 +170,8 @@ Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo ) return false; } + m_sStreamInfo = *streamInfo; + m_cViewArea->setInputStream( m_pCurrStream ); QApplication::restoreOverrideCursor(); diff --git a/app/SubWindowHandle.h b/app/SubWindowHandle.h index 91b42ed..677becd 100644 --- a/app/SubWindowHandle.h +++ b/app/SubWindowHandle.h @@ -41,6 +41,20 @@ namespace plaYUVer class SubWindowHandle; +typedef struct +{ + QString m_cFilename; + UInt m_uiWidth; + UInt m_uiHeight; + Int m_iPelFormat; + UInt m_uiFrameRate; +}PlaYUVerStreamInfo; +typedef QVector PlaYUVerStreamInfoVector; + +QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); +QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); +Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ); + class SubWindowHandle: public QMdiSubWindow { Q_OBJECT @@ -50,6 +64,8 @@ private: QScrollArea* m_cScrollArea; ViewArea* m_cViewArea; + PlaYUVerStreamInfo m_sStreamInfo; + PlaYUVerStream* m_pCurrStream; PlaYUVerFrame* m_pcCurrFrame; QRect m_cSelectedArea; @@ -99,10 +115,7 @@ public: PlaYUVerStreamInfo getStreamInfo() { - PlaYUVerStreamInfo info; - if( m_pCurrStream ) - info = m_pCurrStream->getStreamInfo(); - return info; + return m_sStreamInfo; } PlaYUVerStream* getInputStream() @@ -223,5 +236,8 @@ public Q_SLOTS: } // NAMESPACE +Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo); +Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector); + #endif // __SUBWINDOWHANDLE_H__ diff --git a/app/main.cpp b/app/main.cpp index ce24c8f..d5421fb 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -25,10 +25,11 @@ #include #include "config.h" #include "plaYUVerApp.h" -#include "lib/PlaYUVerStream.h" +#include "SubWindowHandle.h" #ifdef USE_FERVOR #include "fvupdater.h" #endif + using namespace plaYUVer; #if _WIN32 diff --git a/app/plaYUVerApp.cpp b/app/plaYUVerApp.cpp index 9e8fb69..8d9dc01 100644 --- a/app/plaYUVerApp.cpp +++ b/app/plaYUVerApp.cpp @@ -36,8 +36,7 @@ #endif #include #include "WidgetFrameNumber.h" - -#include "PlaYUVerSettings.h" +#include "Settings.h" #define SYNCHRONISED_ZOON 1 @@ -1505,7 +1504,7 @@ Void plaYUVerApp::createStatusBar() Void plaYUVerApp::readSettings() { - PlaYUVerSettings settings; + Settings settings; QPoint pos = settings.mainWindowPos(); QSize size = settings.mainWindowSize(); move( pos ); @@ -1532,7 +1531,7 @@ Void plaYUVerApp::readSettings() Void plaYUVerApp::writeSettings() { - PlaYUVerSettings settings; + Settings settings; settings.setMainWindowPos( pos() ); settings.setMainWindowSize( size() ); settings.setLastOpenPath( m_cLastOpenPath ); diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index d89f72d..59cb8a1 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -34,47 +34,6 @@ namespace plaYUVer { -QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array ) -{ - PlaYUVerStreamInfo d; - out << array.size(); - 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_uiFrameRate; - - } - return out; -} - -QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array ) -{ - PlaYUVerStreamInfo d; - Int array_size; - in >> array_size; - for( Int i = 0; i < array_size; i++ ) - { - in >> d.m_cFilename; - in >> d.m_uiWidth; - in >> d.m_uiHeight; - in >> d.m_iPelFormat; - in >> d.m_uiFrameRate; - array.append( d ); - } - return in; -} - -Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ) -{ - for( Int i = 0; i < array.size(); i++ ) - if( array.at( i ).m_cFilename == filename ) - return i; - return -1; -} - PlaYUVerStream::PlaYUVerStream() { m_bInit = false; @@ -243,12 +202,6 @@ Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_ m_cStreamInformationString = "[" + m_cFormatName + " / " + m_cCodedName + " / " + PlaYUVerFrame::supportedPixelFormatListNames().at( m_iPixelFormat ) + "] " + QFileInfo( m_cFilename ).fileName(); - m_sStreamInfo.m_cFilename = m_cFilename; - m_sStreamInfo.m_uiWidth = m_uiWidth; - m_sStreamInfo.m_uiHeight = m_uiHeight; - m_sStreamInfo.m_iPelFormat = m_iPixelFormat; - m_sStreamInfo.m_uiFrameRate = m_uiFrameRate; - m_iCurrFrameNum = -1; m_bInit = true; diff --git a/lib/PlaYUVerStream.h b/lib/PlaYUVerStream.h index dde78c8..505ad2f 100644 --- a/lib/PlaYUVerStream.h +++ b/lib/PlaYUVerStream.h @@ -36,20 +36,6 @@ namespace plaYUVer class LibAvContextHandle; -typedef struct -{ - QString m_cFilename; - UInt m_uiWidth; - UInt m_uiHeight; - Int m_iPelFormat; - UInt m_uiFrameRate; -}PlaYUVerStreamInfo; -typedef QVector PlaYUVerStreamInfoVector; - -QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); -QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); -Int findPlaYUVerStreamInfo( PlaYUVerStreamInfoVector array, QString filename ); - class PlaYUVerStream { private: @@ -61,8 +47,6 @@ private: Bool m_bLoadAll; Int m_iErrorStatus; - PlaYUVerStreamInfo m_sStreamInfo; - LibAvContextHandle* m_cLibAvContext; QString m_cFilename; @@ -313,15 +297,8 @@ public: m_uiHeight = new_height; } } - PlaYUVerStreamInfo getStreamInfo() - { - return m_sStreamInfo; - } }; } // NAMESPACE -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo); -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector); - #endif // __PLAYUVERSTREAM_H__