Commit 7e3f02e0 authored by Jan Möbius's avatar Jan Möbius

added postprocessor manager widget

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16214 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 22c5e3df
......@@ -60,6 +60,7 @@ set (directories
../widgets/videoCaptureDialog
../widgets/snapshotDialog
../widgets/stereoSettingsWidget
../widgets/postProcessorWidget
)
# collect all header,source and ui files
......
......@@ -277,9 +277,14 @@ void CoreWidget::updatePopupMenuCoordsysNode(QMenu* _menu , const int /*_part*/
// Get the options action for the currently active postprocessor
if( postProcessorManager()[ postProcessorManager().activeId(PluginFunctions::activeExaminer() )]->optionsAction != 0 ) {
postProcessorMenu->addAction(postProcessorManager()[ postProcessorManager().activeId(PluginFunctions::activeExaminer() ) ]->optionsAction );
postProcessorMenu->addSeparator();
}
QAction* showPostProcessorDialog = new QAction(tr("Show post processor manager"),this);
connect(showPostProcessorDialog,SIGNAL(triggered()),this,SLOT(slotShowPostProcessorManager()));
postProcessorMenu->addAction(showPostProcessorDialog);
postProcessorMenu->addSeparator();
// Now add the processor chooser
......
......@@ -180,6 +180,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
snapshotCounter_(0),
stackMenu_(0),
helpWidget_(0),
postProcessorDialog_(0),
stereoSettingsWidget_(0),
aboutWidget_(0),
optionsWidget_(0),
......
......@@ -94,6 +94,7 @@
#include <OpenFlipper/widgets/optionsWidget/optionsWidget.hh>
#include <OpenFlipper/widgets/helpWidget/helpWidget.hh>
#include <OpenFlipper/widgets/stereoSettingsWidget/stereoSettingsWidget.hh>
#include <OpenFlipper/widgets/postProcessorWidget/postProcessorWidget.hh>
#include <OpenFlipper/Core/PluginInfo.hh>
......@@ -1078,6 +1079,21 @@ public:
/** @} */
//===========================================================================
/** @name PostProcessor dialog
* @{ */
//===========================================================================
public slots:
void slotShowPostProcessorManager();
private:
PostProcessorDialog* postProcessorDialog_;
/** @} */
//===========================================================================
/** @name Stereo View Mode
* @{ */
......
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 15910 $ *
* $LastChangedBy: moeller $ *
* $Date: 2012-12-05 12:53:39 +0100 (Mi, 05 Dez 2012) $ *
* *
\*===========================================================================*/
#include "postProcessorWidget.hh"
#include <QtGui>
#include <QMessageBox>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
PostProcessorDialog::PostProcessorDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
list->setContextMenuPolicy(Qt::CustomContextMenu);
connect(closeButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(list,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(slotContextMenu(const QPoint&)));
//set icons
QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
closeButton->setIcon( QIcon(iconPath + "window-close.png"));
}
void PostProcessorDialog::closeEvent(QCloseEvent *event)
{
event->accept();
accept();
}
void PostProcessorDialog::showEvent ( QShowEvent * ) {
update();
}
void PostProcessorDialog::update()
{
list->clear();
for ( unsigned int i = 0 ; i < postProcessorManager().available() ; ++i) {
// Get and check post processor
PostProcessorInfo* processor = postProcessorManager()[i];
if ( ! processor )
continue;
QFrame* frame = new QFrame();
QHBoxLayout* hlayout = new QHBoxLayout;
QLabel* name = new QLabel( processor->name );
QFont font;
font.setBold(true);
font.setPointSize(10);
name->setFont(font);
QLabel* version = new QLabel( processor->version );
hlayout->addWidget(name);
hlayout->addStretch();
hlayout->addWidget(version);
QVBoxLayout* vlayout = new QVBoxLayout;
QLabel* description = new QLabel( processor->description );
descriptions_.push_back(description);
vlayout->addLayout(hlayout,20);
vlayout->addWidget(description);
frame->setLayout(vlayout);
QListWidgetItem *item = new QListWidgetItem("");
frames_.push_back(frame);
item->setSizeHint( QSize (100,50) );
list->addItem(item);
list->setItemWidget(item, frame);
if ( postProcessorManager().activeId(PluginFunctions::activeExaminer()) == i )
item->setBackground( Qt::green );
}
}
void PostProcessorDialog::slotActivatePostProcessor() {
for (int i=0; i < list->selectedItems().size(); ++i)
{
QListWidgetItem* widget = list->selectedItems()[i];
postProcessorManager().setActive( list->row( widget ), PluginFunctions::activeExaminer());
}
update();
}
void PostProcessorDialog::slotContextMenu(const QPoint& _point)
{
if (!list->count())
return;
QMenu *menu = new QMenu(list);
QAction* action = 0;
action = menu->addAction(tr("Activate"));
connect(action,SIGNAL(triggered(bool)),this,SLOT(slotActivatePostProcessor()));
menu->exec(list->mapToGlobal(_point),0);
}
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
* www.openflipper.org *
* *
*--------------------------------------------------------------------------- *
* This file is part of OpenFlipper. *
* *
* OpenFlipper is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version with the *
* following exceptions: *
* *
* If other files instantiate templates or use macros *
* or inline functions from this file, or you compile this file and *
* link it with other files to produce an executable, this file does *
* not by itself cause the resulting executable to be covered by the *
* GNU Lesser General Public License. This exception does not however *
* invalidate any other reasons why the executable file might be *
* covered by the GNU Lesser General Public License. *
* *
* OpenFlipper 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 Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU LesserGeneral Public *
* License along with OpenFlipper. If not, *
* see <http://www.gnu.org/licenses/>. *
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 15910 $ *
* $LastChangedBy: moeller $ *
* $Date: 2012-12-05 12:53:39 +0100 (Mi, 05 Dez 2012) $ *
* *
\*===========================================================================*/
#include "ui_postProcessorWidget.hh"
#include <QtGui>
#include <OpenFlipper/common/RendererInfo.hh>
class PostProcessorDialog : public QDialog, public Ui::PostProcessorWidget
{
Q_OBJECT
public:
PostProcessorDialog(QWidget *parent = 0);
private slots:
/// Show the custom context menu
void slotContextMenu(const QPoint& _point);
/// Activates the post processor (triggered via the context menu)
void slotActivatePostProcessor();
protected:
void closeEvent(QCloseEvent *event);
void showEvent ( QShowEvent * );
private:
void update();
std::vector<QLabel*> descriptions_;
QVector< QFrame* > frames_;
};
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PostProcessorWidget</class>
<widget class="QWidget" name="PostProcessorWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>939</width>
<height>527</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_3">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>40</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="midLineWidth">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Available Post Processors</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QListWidget" name="list">
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="selectionRectVisible">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="closeButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment