diff --git a/ACGMakefile b/ACGMakefile index af72b909aacb7e5bf9a61aa393f05489766cb411..af523c768cb00c7df9044599a59ebd5172335bf9 100644 --- a/ACGMakefile +++ b/ACGMakefile @@ -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 diff --git a/Core/Core.cc b/Core/Core.cc index 81bc2411d7bad219e4479cd7cb9b9779c437ac60..468aa6628faa9e65c67cbc6d104d74dab7dec3c1 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -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())); diff --git a/Core/Core.hh b/Core/Core.hh index e19b7fdb0a739977d1c9fab9c0830dde5dad1b25..855c0f45f4004a09541ab7a6a4a928588f5c47e0 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -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); diff --git a/Core/saveFunctions.cc b/Core/saveFunctions.cc index 3ac7231b056775abff987109dc2d302fcf2b2f56..9b6120c88e28a5f0c5bc90ed691b11aee9f0adbb 100644 --- a/Core/saveFunctions.cc +++ b/Core/saveFunctions.cc @@ -317,3 +317,5 @@ void Core::slotSaveIniMenu(){ } + + diff --git a/Icons/preferences-system.png b/Icons/preferences-system.png new file mode 100644 index 0000000000000000000000000000000000000000..06740ba1152ee681b57484017840f19c4acf6b29 Binary files /dev/null and b/Icons/preferences-system.png differ diff --git a/widgets/ACGMakefile b/widgets/ACGMakefile index 6f9580e9dcf5c919ecd44fd49772b6b308786aa0..68ad92c8caf7094c2e52cee4fee71bc027ab7f93 100644 --- a/widgets/ACGMakefile +++ b/widgets/ACGMakefile @@ -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 diff --git a/widgets/coreWidget/CoreWidget.cc b/widgets/coreWidget/CoreWidget.cc index 230db1d1cee8f68496c5b78d49d24e0004386f0b..c7938d70850d8f404e96de5c3c2fc70a9e3e9478 100644 --- a/widgets/coreWidget/CoreWidget.cc +++ b/widgets/coreWidget/CoreWidget.cc @@ -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(); - +} //============================================================================= diff --git a/widgets/coreWidget/CoreWidget.hh b/widgets/coreWidget/CoreWidget.hh index f595b0c47141f67e26df0e2e955bc0f74dc4541d..29cd4976601ae54797a6fedcac41040977bba34f 100644 --- a/widgets/coreWidget/CoreWidget.hh +++ b/widgets/coreWidget/CoreWidget.hh @@ -67,6 +67,7 @@ #include +#include #include /** 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 diff --git a/widgets/coreWidget/MenuBar.cc b/widgets/coreWidget/MenuBar.cc index 5f511761e6f0361181483a576a197f0b58167bbf..f8c9217ab7e87b4a24bdb15c9a796d6639e9b64e 100644 --- a/widgets/coreWidget/MenuBar.cc +++ b/widgets/coreWidget/MenuBar.cc @@ -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(); diff --git a/widgets/optionsWidget/ACGMakefile b/widgets/optionsWidget/ACGMakefile new file mode 100644 index 0000000000000000000000000000000000000000..ddce76166add49a528cab56264e19c4e2a8f4e73 --- /dev/null +++ b/widgets/optionsWidget/ACGMakefile @@ -0,0 +1,17 @@ +#== 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 +#============================================================================== diff --git a/widgets/optionsWidget/optionsWidget.cc b/widgets/optionsWidget/optionsWidget.cc new file mode 100644 index 0000000000000000000000000000000000000000..e004a62f269fabac6594ea48aa7b144a1c119a51 --- /dev/null +++ b/widgets/optionsWidget/optionsWidget.cc @@ -0,0 +1,60 @@ +//============================================================================= +// +// 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 . +// +//----------------------------------------------------------------------------- +// +// $Revision: 1909 $ +// $Author: wilden $ +// $Date: 2008-06-03 18:45:21 +0200 (Tue, 03 Jun 2008) $ +// +//============================================================================= + + + + +#include "optionsWidget.hh" +#include +#include + +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(); +} + diff --git a/widgets/optionsWidget/optionsWidget.hh b/widgets/optionsWidget/optionsWidget.hh new file mode 100644 index 0000000000000000000000000000000000000000..364f964cb7737b3d1202c88626fd82e7e7a0532b --- /dev/null +++ b/widgets/optionsWidget/optionsWidget.hh @@ -0,0 +1,64 @@ +//============================================================================= +// +// 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 . +// +//----------------------------------------------------------------------------- +// +// $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 +#include + +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 diff --git a/widgets/optionsWidget/ui_optionsWidget.ui b/widgets/optionsWidget/ui_optionsWidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..1a43df2fb3fec99403e9b7d0e18f17153b1e6ea1 --- /dev/null +++ b/widgets/optionsWidget/ui_optionsWidget.ui @@ -0,0 +1,45 @@ + + OptionsWidget + + + + 0 + 0 + 290 + 404 + + + + Options + + + + + + TODO + + + + + + + + + Apply + + + + + + + Cancel + + + + + + + + + +