Commit cc718913 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - warning for mesa cards on startup. User can check the...

[CHANGE] - warning for mesa cards on startup. User can check the do-not-show-again-checkbox to avoid this message every startup
parent 3a93b8b6
......@@ -49,10 +49,13 @@
#include <QtWebKit/QWebView>
#endif
#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 +69,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"
......@@ -1009,7 +1010,20 @@ 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() );
// TODO(ebaum): warning
// 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->setGeometry( 0, 0, 400, 200 );
l->setMinimumWidth( 400 );
WQtMessageDialog* msgDia = new WQtMessageDialog( "MesaWarning", "Mesa Warning", l, getSettings(), this );
msgDia->show();
}
}
//---------------------------------------------------------------------------
//
// 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
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