Commit 1c1d51c6 authored by Alexander Wiebel's avatar Alexander Wiebel

[MERGE]

parents d79df05e ff59f1fc
<h1>Welcome to OpenWalnut %OW_LIB_VERSION%!</h1>
<a href="http://www.openwalnut.org/projects/openwalnut/wiki/ReleaseNotes">Release Notes</a>
<br>
<br>
Hello User! New to OpenWalnut? Have a look at <a href="http://www.openwalnut.org">http://www.openwalnut.org</a>!
We provide
<ul>
<li> user-/video documentation
<li> programming tutorials
<li> and the newest information
</ul>
Do you have problems using OpenWalnut? Do not hesitate to ask:
<ul>
<li><a href="mailto:openwalnut@lists.informatik.uni-leipzig.de">Mailing List</a>
<li>IRC Chat on irc.freenode.net in #ow
</ul>
Found a Bug? Do you have ideas for improvement? Please <a href="http://www.openwalnut.org/projects/openwalnut/wiki/Contribute">report</a> these issues! We can improve OpenWalnut only with your help and ideas.
<br><br>
<i>Thank you for using OpenWalnut!</i>
......@@ -406,6 +406,17 @@ public:
*/
virtual bool set( T value, bool suppressNotification = false );
/**
* Sets the specified value as recommended value. The difference to \ref set is simple. If some value was set using the method \ref set
* earlier, the \ref setRecommendedValue call is ignored. This is very useful in modules, where incoming data yields some useful default values
* but you do not want to overwrite a user-value which might have been set.
*
* \param value the new value to set if the user did not yet set the value
*
* \return true if value has been set successfully.
*/
virtual bool setRecommendedValue( T value );
protected:
/**
......@@ -439,13 +450,19 @@ protected:
boost::shared_ptr< ConstraintContainerType > m_constraints;
private:
/**
* This is true, if the user did not set a value until now using \ref set.
*/
bool m_notYetSet;
};
template < typename T >
WPropertyVariable< T >::WPropertyVariable( std::string name, std::string description, const T& initial ):
WFlag< T >( new WCondition(), initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -458,7 +475,8 @@ template < typename T >
WPropertyVariable< T >::WPropertyVariable( std::string name, std::string description, const T& initial, boost::shared_ptr< WCondition > condition ):
WFlag< T >( condition, initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -472,7 +490,8 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
PropertyChangeNotifierType notifier ):
WFlag< T >( new WCondition(), initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -492,7 +511,8 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
PropertyChangeNotifierType notifier ):
WFlag< T >( condition, initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -511,7 +531,8 @@ template < typename T >
WPropertyVariable< T >::WPropertyVariable( const WPropertyVariable< T >& from ):
WFlag< T >( from ),
WPropertyBase( from ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( from.m_notYetSet )
{
// copy the constraints
......@@ -584,7 +605,7 @@ bool WPropertyVariable< T >::setAsString( std::string value )
{
// use the helper class which can handle different kinds of properties for us
PROPERTY_TYPE_HELPER::WStringConversion< T > h = PROPERTY_TYPE_HELPER::WStringConversion< T >();
return WFlag< T >::set( h.create( WFlag< T >::get(), value ) );
return set( h.create( WFlag< T >::get(), value ) );
}
catch( const boost::bad_lexical_cast &e )
{
......@@ -610,7 +631,7 @@ bool WPropertyVariable< T >::set( boost::shared_ptr< WPropertyBase > value )
boost::shared_ptr< WPropertyVariable< T > > v = boost::shared_dynamic_cast< WPropertyVariable< T > >( value );
if( v )
{
return WFlag< T >::set( v->get() );
return set( v->get() );
}
else
{
......@@ -621,9 +642,26 @@ bool WPropertyVariable< T >::set( boost::shared_ptr< WPropertyBase > value )
template < typename T >
bool WPropertyVariable< T >::set( T value, bool suppressNotification )
{
m_notYetSet = false;
return WFlag< T >::set( value, suppressNotification );
}
template < typename T >
bool WPropertyVariable< T >::setRecommendedValue( T value )
{
// NOTE: well this is quite problematic when used multi-threaded ...
if( m_notYetSet )
{
bool ret = set( value );
m_notYetSet = true;
return ret;
}
else
{
return false;
}
}
template < typename T >
bool WPropertyVariable< T >::ensureValidity( T newValidValue, bool suppressNotification )
{
......
......@@ -246,7 +246,7 @@ void WMIsosurfaceRaytracer::moduleMain()
m_isoValue->setMin( dataSet->getTexture()->minimum()->get() );
m_isoValue->setMax( dataSet->getTexture()->scale()->get() + dataSet->getTexture()->minimum()->get() );
m_isoValue->set( dataSet->getTexture()->minimum()->get() + ( 0.5 * dataSet->getTexture()->scale()->get() ) );
m_isoValue->setRecommendedValue( dataSet->getTexture()->minimum()->get() + ( 0.5 * dataSet->getTexture()->scale()->get() ) );
// First, grab the grid
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( dataSet->getGrid() );
......
......@@ -28,6 +28,7 @@
#include <vector>
#include <boost/thread.hpp>
#include <boost/regex.hpp>
#include <QtGui/QApplication>
#include <QtGui/QCloseEvent>
......@@ -49,10 +50,15 @@
#include <QtWebKit/QWebView>
#endif
#include "WVersion.h" // NOTE: this file is auto-generated by CMAKE
#include "../icons/WIcons.xpm"
#include "controlPanel/WPropertyBoolWidget.h"
#include "controlPanel/WQtControlPanel.h"
#include "core/common/WColor.h"
#include "core/common/WIOTools.h"
#include "core/common/WProjectFileIO.h"
#include "core/common/WPathHelper.h"
#include "core/common/WProjectFileIO.h"
#include "core/dataHandler/WDataSetFibers.h"
#include "core/dataHandler/WDataSetSingle.h"
#include "core/dataHandler/WEEG2.h"
......@@ -66,22 +72,20 @@
#include "core/kernel/WProjectFile.h"
#include "core/kernel/WROIManager.h"
#include "core/kernel/WSelectionManager.h"
#include "../icons/WIcons.xpm"
#include "controlPanel/WPropertyBoolWidget.h"
#include "controlPanel/WQtControlPanel.h"
#include "events/WEventTypes.h"
#include "events/WModuleCrashEvent.h"
#include "events/WModuleReadyEvent.h"
#include "events/WModuleRemovedEvent.h"
#include "events/WOpenCustomDockWidgetEvent.h"
#include "guiElements/WQtPropertyBoolAction.h"
#include "WQt4Gui.h"
#include "WQtCombinerToolbar.h"
#include "WQtCustomDockWidget.h"
#include "WQtNavGLWidget.h"
#include "WQtGLDockWidget.h"
#include "WQt4Gui.h"
#include "WQtNavGLWidget.h"
#include "WSettingAction.h"
#include "WSettingMenu.h"
#include "WQtMessageDialog.h"
#include "WMainWindow.h"
#include "WMainWindow.moc"
......@@ -224,6 +228,9 @@ void WMainWindow::setupGUI()
m_glDock->addDockWidget( Qt::RightDockWidgetArea, mainGLDock );
connect( m_mainGLWidget.get(), SIGNAL( renderedFirstFrame() ), this, SLOT( handleGLVendor() ) );
// NOTE: we abuse the gl widgets first frame event to handle startup news.
connect( m_mainGLWidget.get(), SIGNAL( renderedFirstFrame() ), this, SLOT( handleStartMessages() ) );
m_permanentToolBar = new WQtToolBar( "Standard Toolbar", this );
addToolBar( Qt::TopToolBarArea, m_permanentToolBar );
......@@ -1009,7 +1016,42 @@ void WMainWindow::handleLogLevelUpdate( unsigned int logLevel )
void WMainWindow::handleGLVendor()
{
// WARNING: never put blocking code here, as it might freeze the mainGLWidget.
std::string vendor = m_mainGLWidget->getViewer()->getOpenGLVendor();
std::string vendor = string_utils::toLower( m_mainGLWidget->getViewer()->getOpenGLVendor() );
// is this a mesa card?
if( vendor.find( "mesa" ) != std::string::npos )
{
QString msg = "<b>Warning:</b> Your graphics card is powered by the Mesa OpenGL implementation. OpenWalnut does not support Mesa "
"officially, since Mesa has some severe problems with GLSL shaders. You can still use OpenWalnut, but you should be "
"aware that Mesa can freeze OpenWalnut. Ensure you have the latest version of Mesa installed to avoid problems.";
QLabel* l = new QLabel( msg );
l->setWordWrap( true );
l->setMinimumWidth( 640 );
WQtMessageDialog* msgDia = new WQtMessageDialog( "MesaWarning", "Mesa Warning", l, getSettings(), this );
msgDia->show();
}
}
// TODO(ebaum): warning
void WMainWindow::handleStartMessages()
{
// Load welcome file
std::string filename( WPathHelper::getDocPath().file_string() + "/openwalnut-qt4/OpenWalnutWelcome.html" );
std::string content = readFileIntoString( filename );
// gen ID for it using version (allows showing release/welcome message for each new release)
QString msgID = "OpenWalnutWelcome" + QString( W_LIB_VERSION );
// replace OW_VERSION
boost::regex reg1( "%OW_LIB_VERSION%" );
boost::regex reg2( "%OW_VERSION%" );
content = boost::regex_replace( content, reg1, std::string( W_LIB_VERSION ) );
content = boost::regex_replace( content, reg2, std::string( W_VERSION ) );
QLabel* l = new QLabel( QString::fromStdString( content ) );
l->setWordWrap( true );
l->setMinimumWidth( 640 );
WQtMessageDialog* msgDia = new WQtMessageDialog( msgID, "Welcome to OpenWalnut", l, getSettings(), this );
msgDia->show();
}
......@@ -166,7 +166,7 @@ protected:
*
* \param e the close event.
*/
void closeEvent( QCloseEvent* e );
virtual void closeEvent( QCloseEvent* e );
/**
* Handle custom events.
......@@ -356,6 +356,11 @@ private slots:
* Handles some special GL vendors and shows the user a dialog.
*/
void handleGLVendor();
/**
* Shows startup info messages
*/
void handleStartMessages();
};
#endif // WMAINWINDOW_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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.
//
// OpenWalnut 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 Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <QtGui/QHBoxLayout>
#include <QtGui/QVBoxLayout>
#include "WMainWindow.h"
#include "WQtMessageDialog.h"
#include "WQtMessageDialog.moc"
WQtMessageDialog::WQtMessageDialog( QString msgID, QString title, QWidget* content, QSettings& settings, QWidget* parent ): // NOLINT - yes use a non-const ref
QDialog( parent ),
m_content( content ),
m_msgID( msgID ),
m_settings( settings )
{
setWindowTitle( title );
setModal( false );
// setup contents
QVBoxLayout* mainLayout = new QVBoxLayout();
// text widget
mainLayout->addWidget( m_content );
// dialog buttons and checkbox to bottom layout
QHBoxLayout* bottomLayout = new QHBoxLayout();
QWidget* bottomWidget = new QWidget( this );
bottomWidget->setLayout( bottomLayout );
mainLayout->addWidget( bottomWidget );
this->setLayout( mainLayout );
m_checkBox = new QCheckBox( bottomWidget );
m_checkBox->setText( "Do not show again" );
m_buttonBox = new QDialogButtonBox( bottomWidget );
m_buttonBox->setOrientation( Qt::Horizontal );
m_buttonBox->setStandardButtons( QDialogButtonBox::Ok );
bottomLayout->addWidget( m_checkBox );
bottomLayout->addWidget( m_buttonBox );
// connect dialog box to close event
QObject::connect( m_buttonBox, SIGNAL( accepted() ), this, SLOT( accept() ) );
QObject::connect( m_buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
}
WQtMessageDialog::~WQtMessageDialog()
{
// cleanup
}
void WQtMessageDialog::show()
{
// check if message is allowed
bool show = m_settings.value( m_msgID + "_showAgain", true ).toBool();
m_checkBox->setCheckState( show ? Qt::Unchecked : Qt::Checked );
// only show if wanted by user
if( !show )
{
return;
}
QDialog::show();
}
void WQtMessageDialog::reject()
{
QDialog::reject();
}
void WQtMessageDialog::accept()
{
handleClose();
QDialog::accept();
}
void WQtMessageDialog::handleClose()
{
m_settings.setValue( m_msgID + "_showAgain", m_checkBox->checkState() == Qt::Unchecked );
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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.
//
// OpenWalnut 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 Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTMESSAGEDIALOG_H
#define WQTMESSAGEDIALOG_H
#include <QtGui/QDialog>
#include <QtGui/QTextEdit>
#include <QtGui/QLabel>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QCheckBox>
#include <QtCore/QSettings>
/**
* General purpose message dialog, able to show arbitrary content. It additionally allows the user to decide whether he wants to see this again
* or not.
*/
class WQtMessageDialog: public QDialog
{
Q_OBJECT
public:
/**
* Construct a message dialog.
*
* \param msgID the id used to check whether to show the message or not.
* \param title the title of the dialog
* \param content the widget representing the content
* \param settings the object storing the info about disabled messages
* \param parent parent window
*/
WQtMessageDialog( QString msgID, QString title, QWidget* content, QSettings& settings, QWidget* parent ); // NOLINT - yes use a non-const ref
/**
* Destructor.
*/
virtual ~WQtMessageDialog();
/**
* Shows the dialog if the user does not disabled it.
*/
virtual void show();
protected:
private slots:
/**
* Dialog closed
*/
virtual void reject();
/**
* Dialog closed
*/
virtual void accept();
private:
/**
* Dialog buttons.
*/
QDialogButtonBox* m_buttonBox;
/**
* Do not show again - Checkbox
*/
QCheckBox* m_checkBox;
/**
* The widget showing the content
*/
QWidget* m_content;
/**
* The message ID
*/
QString m_msgID;
/**
* Settings object of the main window
*/
QSettings& m_settings;
/**
* Handles close and saves setting
*/
void handleClose();
};
#endif // WQTMESSAGEDIALOG_H
......@@ -29,4 +29,4 @@
INCLUDE( BuildUtils.cmake )
GET_VERSION_STRING( OW_VERSION OW_API_VERSION )
FILE( WRITE ${HEADER_FILENAME} "// generated by CMake. Do not modify.\n#define W_VERSION \"${OW_VERSION}\"\n" )
FILE( WRITE ${HEADER_FILENAME} "// generated by CMake. Do not modify.\n#define W_VERSION \"${OW_VERSION}\"\n#define W_LIB_VERSION \"${OW_API_VERSION}\"\n" )
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