Add initial class to handle different modules. Class for if also defined

This commit is contained in:
jfmcarreira committed 2014-02-08 16:07:49 +00:00
1 parent b645521470
commit 48dee6ccfd
5 files changed
+176 -36

No files matched your search

+5
View File
@@ -66,6 +66,11 @@ ENDIF()
INCLUDE( cmake/LibFFmpeg.cmake )
######################################################################################
# PlaYUVer modules build
######################################################################################
SET( MODULES_DIR ${SRC_DIR}/modules )
######################################################################################
# Create config.h
######################################################################################
+49
View File
@@ -0,0 +1,49 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014 by plaYUVer developers
*
* 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 ModulesHandle.cpp
* \brief PlaYUVer modules handle
*/
#include <cstdio>
#include "ModulesHandle.h"
namespace plaYUVer
{
ModulesHandle::ModulesHandle()
{
}
ModulesHandle::~ModulesHandle()
{
}
Void ModulesHandle::createMenus( QMenuBar *MainAppMenuBar )
{
MainAppMenuBar->addMenu( "&Modules" );
}
} // NAMESPACE
+70
View File
@@ -0,0 +1,70 @@
/* This file is a part of plaYUVer project
* Copyright (C) 2014 by plaYUVer developers
*
* 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 ModulesHandle.h
* \brief PlaYUVer modules handle
*/
#ifndef __MODULESHANDLE_H__
#define __MODULESHANDLE_H__
#include "config.h"
#include <iostream>
#include <cstdio>
#include <QtCore>
#if( QT_VERSION_PLAYUVER == 5 )
#include <QtWidgets>
#elif( QT_VERSION_PLAYUVER == 4 )
#include <QtGui>
#endif
#include "TypeDef.h"
namespace plaYUVer
{
class ModulesHandle
{
public:
ModulesHandle();
~ModulesHandle();
Void createMenus( QMenuBar *MainAppMenuBar );
private:
};
class PlaYUVerModuleIf
{
public:
virtual Void create();
virtual Void process();
virtual Void close();
virtual ~PlaYUVerModuleIf() {}
};
} // NAMESPACE
#endif // __PLAYUVERFRAME_H__
+32 -28
View File
@@ -245,16 +245,16 @@ Void plaYUVerApp::updateMenus()
void plaYUVerApp::updateWindowMenu()
{
menuWindow->clear();
menuWindow->addAction( actionClose );
menuWindow->addAction( actionCloseAll );
menuWindow->addSeparator();
menuWindow->addAction( actionTile );
menuWindow->addAction( actionCascade );
menuWindow->addSeparator();
menuWindow->addAction( actionNext );
menuWindow->addAction( actionPrevious );
menuWindow->addAction( actionSeparator );
m_arrayMenu[WINDOW_MENU]->clear();
m_arrayMenu[WINDOW_MENU]->addAction( actionClose );
m_arrayMenu[WINDOW_MENU]->addAction( actionCloseAll );
m_arrayMenu[WINDOW_MENU]->addSeparator();
m_arrayMenu[WINDOW_MENU]->addAction( actionTile );
m_arrayMenu[WINDOW_MENU]->addAction( actionCascade );
m_arrayMenu[WINDOW_MENU]->addSeparator();
m_arrayMenu[WINDOW_MENU]->addAction( actionNext );
m_arrayMenu[WINDOW_MENU]->addAction( actionPrevious );
m_arrayMenu[WINDOW_MENU]->addAction( actionSeparator );
updateMenus();
@@ -286,7 +286,7 @@ void plaYUVerApp::updateWindowMenu()
{
text = tr( "%1 %2" ).arg( i + 1 ).arg( child->userFriendlyCurrentFile() );
}
QAction *action = menuWindow->addAction( text );
QAction *action = m_arrayMenu[WINDOW_MENU]->addAction( text );
action->setCheckable( true );
action->setChecked( child == activeSubWindow() );
connect( action, SIGNAL( triggered() ), mapperWindow, SLOT( map() ) );
@@ -445,29 +445,33 @@ Void plaYUVerApp::createActions()
Void plaYUVerApp::createMenus()
{
menuFile = menuBar()->addMenu( tr( "&File" ) );
menuFile->addAction( actionOpen );
menuFile->addSeparator();
menuFile->addAction( actionSave );
menuFile->addSeparator();
menuFile->addAction( actionClose );
menuFile->addAction( actionExit );
m_arrayMenu.resize(4);
menuView = new QMenu( tr( "&View" ), this );
menuView->addAction( actionZoomIn );
menuView->addAction( actionZoomOut );
menuView->addAction( actionNormalSize );
menuView->addAction( actionZoomToFit );
m_arrayMenu[OTHER_MENU] = menuBar()->addMenu( tr( "&File" ) );
m_arrayMenu[OTHER_MENU]->addAction( actionOpen );
m_arrayMenu[OTHER_MENU]->addSeparator();
m_arrayMenu[OTHER_MENU]->addAction( actionSave );
m_arrayMenu[OTHER_MENU]->addSeparator();
m_arrayMenu[OTHER_MENU]->addAction( actionClose );
m_arrayMenu[OTHER_MENU]->addAction( actionExit );
menuWindow = menuBar()->addMenu( tr( "&Window" ) );
m_arrayMenu[OTHER_MENU+1] = menuBar()->addMenu( tr( "&View" ) );
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomIn );
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomOut );
m_arrayMenu[OTHER_MENU+1]->addAction( actionNormalSize );
m_arrayMenu[OTHER_MENU+1]->addAction( actionZoomToFit );
m_pcModulesHandle->createMenus( menuBar() );
m_arrayMenu[WINDOW_MENU] = menuBar()->addMenu( tr( "&Window" ) );
updateWindowMenu();
connect( menuWindow, SIGNAL( aboutToShow() ), this, SLOT( updateWindowMenu() ) );
connect( m_arrayMenu[WINDOW_MENU], SIGNAL( aboutToShow() ), this, SLOT( updateWindowMenu() ) );
menuBar()->addSeparator();
menuHelp = menuBar()->addMenu( tr( "&Help" ) );
menuHelp->addAction( actionAbout );
menuHelp->addAction( actionAboutQt );
m_arrayMenu[OTHER_MENU+2] = menuBar()->addMenu( tr( "&Help" ) );
m_arrayMenu[OTHER_MENU+2]->addAction( actionAbout );
m_arrayMenu[OTHER_MENU+2]->addAction( actionAboutQt );
}
Void plaYUVerApp::createToolBars()
+20 -8
View File
@@ -34,6 +34,8 @@
#include <QMainWindow>
#include "TypeDef.h"
#include "ModulesHandle.h"
namespace plaYUVer
{
@@ -41,7 +43,7 @@ class SubWindowHandle;
class plaYUVerApp: public QMainWindow
{
Q_OBJECT
Q_OBJECT
public:
plaYUVerApp();
@@ -60,7 +62,7 @@ private Q_SLOTS:
void pause();
void stop();
void playEvent();
void seekSliderEvent(int new_frame_num );
void seekSliderEvent( int new_frame_num );
/**
* Scale the image by a given factor
* @param factor factor of scale. Ex: 120 scale the image up by 20% and
@@ -80,13 +82,14 @@ private Q_SLOTS:
/*
* Drag and drop functions
*/
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void dragEnterEvent( QDragEnterEvent *event );
void dropEvent( QDropEvent *event );
void setActiveSubWindow( QWidget *window );
private:
QMdiArea *mdiArea;
ModulesHandle *m_pcModulesHandle;
QString m_cLastOpenPath;
QTimer *playingTimer;
@@ -111,10 +114,19 @@ private:
QSignalMapper *mapperZoom;
QSignalMapper *mapperWindow;
QMenu *menuFile;
QMenu *menuView;
QMenu *menuWindow;
QMenu *menuHelp;
/**
* Array of menus for the main app
* @param position description:
* 0 - Window
* 1 - File
* 2 - View
* 3 - Help
*/
enum MAIN_APP_MENU_LIST
{
WINDOW_MENU = 0, OTHER_MENU,
};
QVector<QMenu*> m_arrayMenu;
QToolBar *toolbarFile;
QToolBar *toolbarView;