Commit f3e703f4 authored by Jan Möbius's avatar Jan Möbius

Missing widget



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16245 383ad7c9-94d9-4d36-a494-682f7c89f535
parent e89f6f8b
/*===========================================================================*\
* *
* 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 "rendererWidget.hh"
#include <QtGui>
#include <QMessageBox>
#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
RendererDialog::RendererDialog(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 RendererDialog::closeEvent(QCloseEvent *event)
{
event->accept();
accept();
}
void RendererDialog::showEvent ( QShowEvent * ) {
update();
}
void RendererDialog::update()
{
list->clear();
for ( unsigned int i = 0 ; i < renderManager().available() ; ++i) {
// Get and check post processor
RendererInfo* renderer = renderManager()[i];
if ( ! renderer )
continue;
QFrame* frame = new QFrame();
QHBoxLayout* hlayout = new QHBoxLayout;
QLabel* name = new QLabel( renderer->name );
QFont font;
font.setBold(true);
font.setPointSize(10);
name->setFont(font);
QLabel* version = new QLabel( renderer->version );
hlayout->addWidget(name);
hlayout->addStretch();
hlayout->addWidget(version);
QVBoxLayout* vlayout = new QVBoxLayout;
QLabel* description = new QLabel( renderer->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 ( renderManager().activeId(PluginFunctions::activeExaminer()) == i )
item->setBackground( Qt::green );
}
}
void RendererDialog::slotActivateRenderer() {
for (int i=0; i < list->selectedItems().size(); ++i)
{
QListWidgetItem* widget = list->selectedItems()[i];
renderManager().setActive( list->row( widget ), PluginFunctions::activeExaminer());
}
update();
}
void RendererDialog::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(slotActivateRenderer()));
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_rendererWidget.hh"
#include <QtGui>
#include <OpenFlipper/common/RendererInfo.hh>
class RendererDialog : public QDialog, public Ui::RendererWidget
{
Q_OBJECT
public:
RendererDialog(QWidget *parent = 0);
private slots:
/// Show the custom context menu
void slotContextMenu(const QPoint& _point);
/// Activates the renderer (triggered via the context menu)
void slotActivateRenderer();
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>RendererWidget</class>
<widget class="QWidget" name="RendererWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>939</width>
<height>527</height>
</rect>
</property>
<property name="windowTitle">
<string>Renderers</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 Renderers</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