Commit 359c2dde authored by Dirk Wilden's avatar Dirk Wilden
Browse files

added defaultbackgroundcolor option

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3535 383ad7c9-94d9-4d36-a494-682f7c89f535
parent b8e2832b
...@@ -203,6 +203,13 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -203,6 +203,13 @@ void Core::readApplicationOptions(INIFile& _ini) {
if ( _ini.get_entry( fullScreen, "Options" , "FullScreen") ) if ( _ini.get_entry( fullScreen, "Options" , "FullScreen") )
OpenFlipper::Options::fullScreen(fullScreen); OpenFlipper::Options::fullScreen(fullScreen);
//============================================================================
// Load the setting for the fullscreen option
//============================================================================
uint backgroundColor = 0;
if ( _ini.get_entry( backgroundColor, "Options" , "DefaultBackgroundColor") )
OpenFlipper::Options::defaultBackgroundColor(backgroundColor);
//============================================================================ //============================================================================
// Load the setting for the default Toolbox mode // Load the setting for the default Toolbox mode
//============================================================================ //============================================================================
...@@ -400,6 +407,8 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -400,6 +407,8 @@ void Core::writeApplicationOptions(INIFile& _ini) {
// check if we are in fullscreen mode: // check if we are in fullscreen mode:
_ini.add_entry("Options","FullScreen", OpenFlipper::Options::fullScreen() ); _ini.add_entry("Options","FullScreen", OpenFlipper::Options::fullScreen() );
_ini.add_entry("Options","DefaultBackgroundColor", (uint)OpenFlipper::Options::defaultBackgroundColor() );
} }
_ini.add_entry("Options","Stereo",OpenFlipper::Options::stereo() ); _ini.add_entry("Options","Stereo",OpenFlipper::Options::stereo() );
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "OpenFlipper/INIFile/INIFile.hh" #include "OpenFlipper/INIFile/INIFile.hh"
#include "OpenFlipper/common/GlobalOptions.hh" #include "OpenFlipper/common/GlobalOptions.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
//== IMPLEMENTATION ========================================================== //== IMPLEMENTATION ==========================================================
...@@ -105,6 +106,10 @@ void Core::applyOptions(){ ...@@ -105,6 +106,10 @@ void Core::applyOptions(){
} }
} }
//set defaultBackgroundColor
QColor c = QColor( OpenFlipper::Options::defaultBackgroundColor() );
PluginFunctions::setBackColor( OpenMesh::Vec4f(c.redF(),c.greenF(),c.blueF(),0.0f) );
updateView(); updateView();
} }
......
...@@ -127,6 +127,9 @@ static QString title_ = "OpenFlipper v?"; ...@@ -127,6 +127,9 @@ static QString title_ = "OpenFlipper v?";
/// Show a splash screen on init? /// Show a splash screen on init?
static bool splash_ = true; static bool splash_ = true;
/// default background color for the viewer
static QRgb defaultBackgroundColor_ = 0;
/// Scripting status /// Scripting status
static bool scripting_ = false; static bool scripting_ = false;
...@@ -483,6 +486,13 @@ bool splash( ) { ...@@ -483,6 +486,13 @@ bool splash( ) {
return splash_; return splash_;
} }
void defaultBackgroundColor( QRgb _color ) {
defaultBackgroundColor_ = _color;
}
QRgb defaultBackgroundColor() {
return defaultBackgroundColor_;
}
/// return last used dataType /// return last used dataType
QString lastDataType(){ QString lastDataType(){
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <QDir> #include <QDir>
#include <QStringList> #include <QStringList>
#include <QColor>
namespace OpenFlipper { namespace OpenFlipper {
namespace Options { namespace Options {
...@@ -426,6 +427,14 @@ bool iconDir(QString _dir); ...@@ -426,6 +427,14 @@ bool iconDir(QString _dir);
DLLEXPORT DLLEXPORT
bool splash( ); bool splash( );
/// Default background color
DLLEXPORT
void defaultBackgroundColor( QRgb _color );
/// Default background color
DLLEXPORT
QRgb defaultBackgroundColor();
/** @} */ /** @} */
//=========================================================================== //===========================================================================
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include <OpenFlipper/ACGHelper/DrawModeConverter.hh> #include <OpenFlipper/ACGHelper/DrawModeConverter.hh>
#include <OpenFlipper/INIFile/INIFile.hh> #include <OpenFlipper/INIFile/INIFile.hh>
#include <QColorDialog>
OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, QWidget *parent) OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, QWidget *parent)
: QWidget(parent), : QWidget(parent),
plugins_(_plugins), plugins_(_plugins),
...@@ -85,6 +87,20 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB ...@@ -85,6 +87,20 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
progressDialog = new QProgressDialog(this); progressDialog = new QProgressDialog(this);
connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload()));
//colordialog
connect(backgroundButton, SIGNAL(clicked()), this, SLOT(getBackgroundColor()) );
}
void OptionsWidget::getBackgroundColor(){
QColor newColor = QColorDialog::getColor (QColor(OpenFlipper::Options::defaultBackgroundColor()));
OpenFlipper::Options::defaultBackgroundColor( newColor.rgb() );
QPixmap color(16,16);
color.fill(QColor(OpenFlipper::Options::defaultBackgroundColor()));
backgroundButton->setIcon( QIcon(color) );
} }
void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
...@@ -107,6 +123,10 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { ...@@ -107,6 +123,10 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() ); restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() ); FPS->setValue( OpenFlipper::Options::maxFrameRate() );
QPixmap color(16,16);
color.fill(QColor(OpenFlipper::Options::defaultBackgroundColor()));
backgroundButton->setIcon( QIcon(color) );
// updates // updates
updateUser->setText( OpenFlipper::Options::updateUsername() ); updateUser->setText( OpenFlipper::Options::updateUsername() );
updatePass->setText( OpenFlipper::Options::updatePassword() ); updatePass->setText( OpenFlipper::Options::updatePassword() );
......
...@@ -66,6 +66,9 @@ class OptionsWidget : public QWidget, public Ui::OptionsWidget ...@@ -66,6 +66,9 @@ class OptionsWidget : public QWidget, public Ui::OptionsWidget
/// Download updates /// Download updates
void slotGetUpdates(); void slotGetUpdates();
/// open a dialog to determine the color
void getBackgroundColor();
protected: protected:
void showEvent ( QShowEvent * event ); void showEvent ( QShowEvent * event );
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>488</width> <width>484</width>
<height>689</height> <height>763</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
...@@ -23,7 +23,7 @@ You can select multiple modes at the same time.</string> ...@@ -23,7 +23,7 @@ You can select multiple modes at the same time.</string>
<string/> <string/>
</property> </property>
<property name="currentIndex" > <property name="currentIndex" >
<number>4</number> <number>2</number>
</property> </property>
<property name="usesScrollButtons" > <property name="usesScrollButtons" >
<bool>true</bool> <bool>true</bool>
...@@ -33,8 +33,8 @@ You can select multiple modes at the same time.</string> ...@@ -33,8 +33,8 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
...@@ -133,8 +133,8 @@ You can select multiple modes at the same time.</string> ...@@ -133,8 +133,8 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
...@@ -165,14 +165,14 @@ You can select multiple modes at the same time.</string> ...@@ -165,14 +165,14 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
<string>Viewer</string> <string>Viewer</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout" > <layout class="QVBoxLayout" name="verticalLayout_9" >
<item> <item>
<widget class="QGroupBox" name="groupBox" > <widget class="QGroupBox" name="groupBox" >
<property name="title" > <property name="title" >
...@@ -295,7 +295,7 @@ You can select multiple modes at the same time.</string> ...@@ -295,7 +295,7 @@ You can select multiple modes at the same time.</string>
<property name="title" > <property name="title" >
<string> Other </string> <string> Other </string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_10" > <layout class="QVBoxLayout" name="verticalLayout" >
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2" > <layout class="QHBoxLayout" name="horizontalLayout_2" >
<item> <item>
...@@ -365,6 +365,30 @@ You can select multiple modes at the same time.</string> ...@@ -365,6 +365,30 @@ You can select multiple modes at the same time.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6" >
<item>
<widget class="QPushButton" name="backgroundButton" >
<property name="text" >
<string>Default background color</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6" >
<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> </layout>
</widget> </widget>
</item> </item>
...@@ -375,8 +399,8 @@ You can select multiple modes at the same time.</string> ...@@ -375,8 +399,8 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
...@@ -399,8 +423,8 @@ You can select multiple modes at the same time.</string> ...@@ -399,8 +423,8 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
...@@ -514,8 +538,8 @@ You can select multiple modes at the same time.</string> ...@@ -514,8 +538,8 @@ You can select multiple modes at the same time.</string>
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>466</width> <width>462</width>
<height>603</height> <height>685</height>
</rect> </rect>
</property> </property>
<attribute name="title" > <attribute name="title" >
...@@ -606,7 +630,6 @@ p, li { white-space: pre-wrap; } ...@@ -606,7 +630,6 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</item> </item>
</layout> </layout>
<zorder>tabWidget</zorder>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>
......
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