Commit 3053a42d authored by Jan Möbius's avatar Jan Möbius

Added Options widget ( forgot to check in earlier )

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@2629 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 344b4d74
......@@ -68,6 +68,7 @@ PROJ_LIBS += OpenFlipper/BasePlugin \
OpenFlipper/widgets/unloadPluginsWidget \
OpenFlipper/widgets/viewModeWidget \
OpenFlipper/widgets/addEmptyWidget \
OpenFlipper/widgets/optionsWidget \
OpenFlipper/widgets/viewModeWidget
MODULES := moc4 cxx
......
......@@ -162,6 +162,7 @@ Core::init() {
connect(coreWidget_, SIGNAL(saveToMenu()) , this, SLOT(slotSaveToMenu()));
connect(coreWidget_, SIGNAL(loadIniMenu()) , this, SLOT(slotLoadIniMenu()));
connect(coreWidget_, SIGNAL(saveIniMenu()) , this, SLOT(slotSaveIniMenu()));
connect(coreWidget_, SIGNAL(applyOptions()) , this, SLOT(applyOptions()));
connect(coreWidget_, SIGNAL(recentOpen(QAction*)) , this, SLOT(slotRecentOpen(QAction*)));
connect(coreWidget_, SIGNAL(exit()) , this, SLOT(slotExit()));
......
......@@ -401,9 +401,6 @@ private:
/// Get all ini files and set basic paths and options
void setupOptions();
/// after ini-files have been loaded and core is up -> apply Options
void applyOptions();
/// Get and set Application options from ini file
void readApplicationOptions(INIFile& _ini);
......@@ -412,6 +409,9 @@ private:
public slots:
/// after ini-files have been loaded and core is up or if options have been changed -> apply Options
void applyOptions();
/// Open an ini file and load everything in it ( Application/File Options )
void openIniFile(QString _filename);
......
......@@ -317,3 +317,5 @@ void Core::slotSaveIniMenu(){
}
......@@ -3,7 +3,7 @@ include $(ACGMAKE)/Config
#==============================================================================
SUBDIRS = helpBrowser unloadPluginsWidget addEmptyWidget loadWidget viewModeWidget coreWidget
SUBDIRS = helpBrowser unloadPluginsWidget addEmptyWidget loadWidget viewModeWidget optionsWidget coreWidget
PACKAGES := qt4 glut opengl x11 math ACG2 openmesh2
......
......@@ -81,6 +81,7 @@ CoreWidget( SeparatorNode* _rootNode,
stackedWidget_(0),
helpBrowserDeveloper_(0),
helpBrowserUser_(0),
optionsWidget_(0),
root_node_(_rootNode),
plugins_(_plugins)
......@@ -426,8 +427,20 @@ void
CoreWidget::closeEvent ( QCloseEvent * /* event */ ) {
emit exit();
}
void CoreWidget::showOptionsWidget() {
if ( OpenFlipper::Options::nogui() )
return;
if ( optionsWidget_ == 0 ) {
optionsWidget_ = new OptionsWidget(0);
connect(optionsWidget_,SIGNAL(applyOptions()),this,SIGNAL(applyOptions()));
}
optionsWidget_->show();
}
//=============================================================================
......@@ -67,6 +67,7 @@
#include <QDockWidget>
#include <OpenFlipper/widgets/optionsWidget/optionsWidget.hh>
#include <OpenFlipper/widgets/helpBrowser/helpWidget.hh>
/** Type defining a currently loaded Plugin */
......@@ -425,6 +426,25 @@ public:
HelpWidget* helpBrowserUser_;
/** @} */
//===========================================================================
/** @name Options System
* @{ */
//===========================================================================
public slots:
/// Display the Options Browser
void showOptionsWidget();
signals:
void applyOptions();
private:
/// Pointer to the OptionsWidget
OptionsWidget* optionsWidget_;
/** @} */
//===========================================================================
/** @name ToolBar controls
......
......@@ -157,6 +157,17 @@ void CoreWidget::setupMenuBar()
AC_save_ini->setIcon(icon);
connect(AC_save_ini, SIGNAL(triggered()), this, SIGNAL(saveIniMenu()));
fileMenu_->addAction(AC_save_ini);
fileMenu_->addSeparator();
//Options
QAction* AC_Options = new QAction(tr("&Options"), this);
AC_Options->setStatusTip(tr("Edit OpenFlipper Options"));
AC_Options->setWhatsThis("Edit OpenFlipper Options");
icon.addFile(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"preferences-system.png");
AC_Options->setIcon(icon);
connect(AC_Options, SIGNAL(triggered()), this, SLOT(showOptionsWidget()));
fileMenu_->addAction(AC_Options);
//Remember entry of menu (required for adding File Menu entries from plugins)
fileMenuEnd_ = fileMenu_->addSeparator();
......
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Config
#==============================================================================
SUBDIRS = $(call find-subdirs)
PACKAGES := qt4 glut opengl x11 math ACG2 openmesh2
PROJ_LIBS =
MODULES := uic4 moc4 cxx
#== SYSTEM PART -- DON'T TOUCH ==============================================
include $(ACGMAKE)/Rules
#==============================================================================
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// 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.
//
// 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 Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 1909 $
// $Author: wilden $
// $Date: 2008-06-03 18:45:21 +0200 (Tue, 03 Jun 2008) $
//
//=============================================================================
#include "optionsWidget.hh"
#include <iostream>
#include <OpenFlipper/common/GlobalOptions.hh>
OptionsWidget::OptionsWidget( QWidget *parent)
: QWidget(parent)
{
setupUi(this);
connect(applyButton,SIGNAL(clicked()),this,SLOT(slotApply()));
connect(cancelButton,SIGNAL(clicked()),this,SLOT(slotCancel()));
}
void OptionsWidget::showEvent ( QShowEvent * event ) {
std::cerr << "Todo : Set Options in Widget" << std::endl;
}
void OptionsWidget::slotApply() {
std::cerr << "Todo : Get Options from Widget and set them in the core" << std::endl;
emit applyOptions();
hide();
}
void OptionsWidget::slotCancel() {
hide();
}
//=============================================================================
//
// OpenFlipper
// Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen
// www.openflipper.org
//
//-----------------------------------------------------------------------------
//
// License
//
// 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.
//
// 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 Lesser General Public License
// along with OpenFlipper. If not, see <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
// $Revision: 1909 $
// $Author: wilden $
// $Date: 2008-06-03 18:45:21 +0200 (Tue, 03 Jun 2008) $
//
//=============================================================================
#ifndef OPTIONSWIDGET_HH
#define OPTIONSWIDGET_HH
#include "ui_optionsWidget.hh"
#include <QtGui>
#include <QStringList>
class OptionsWidget : public QWidget, public Ui::OptionsWidget
{
Q_OBJECT
public:
OptionsWidget(QWidget *parent = 0 );
signals:
void applyOptions();
private slots:
/// Hide widget, Update Options and tell others about changed Options
void slotApply();
/// Only hide widget
void slotCancel();
protected:
void showEvent ( QShowEvent * event );
};
#endif //OPTIONSWIDGET_HH
<ui version="4.0" >
<class>OptionsWidget</class>
<widget class="QWidget" name="OptionsWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>290</width>
<height>404</height>
</rect>
</property>
<property name="windowTitle" >
<string>Options</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>TODO</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QPushButton" name="applyButton" >
<property name="text" >
<string>Apply</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton" >
<property name="text" >
<string>Cancel</string>
</property>
</widget>
</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