Commit 854084b6 authored by Jan Möbius's avatar Jan Möbius
Browse files

Moved Backgroundcolor to qsettings

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@7738 383ad7c9-94d9-4d36-a494-682f7c89f535
parent f26762e1
...@@ -250,13 +250,6 @@ void Core::readApplicationOptions(INIFile& _ini) { ...@@ -250,13 +250,6 @@ 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 background color option
//============================================================================
uint backgroundColor = 0;
if ( _ini.get_entry( backgroundColor, "Options" , "DefaultBackgroundColor") )
OpenFlipper::Options::defaultBackgroundColor(QRgb(backgroundColor));
//============================================================================ //============================================================================
// Load the setting for the object color option // Load the setting for the object color option
//============================================================================ //============================================================================
...@@ -633,7 +626,6 @@ void Core::writeApplicationOptions(INIFile& _ini) { ...@@ -633,7 +626,6 @@ 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().rgba () );
_ini.add_entry("Options","DefaultBaseColor", (uint)OpenFlipper::Options::defaultBaseColor().rgba () ); _ini.add_entry("Options","DefaultBaseColor", (uint)OpenFlipper::Options::defaultBaseColor().rgba () );
_ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() ); _ini.add_entry("Options", "StereoMode",OpenFlipper::Options::stereoMode() );
......
...@@ -385,7 +385,7 @@ void Core::slotObjectOpened ( int _id ) { ...@@ -385,7 +385,7 @@ void Core::slotObjectOpened ( int _id ) {
//init random seed //init random seed
srand ( time(NULL) ); srand ( time(NULL) );
QColor bckgrnd = OpenFlipper::Options::defaultBackgroundColor(); QColor bckgrnd = OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>();
int diff; int diff;
do{ do{
......
...@@ -131,7 +131,7 @@ void Core::applyOptions(){ ...@@ -131,7 +131,7 @@ void Core::applyOptions(){
// gridNode_->hide(); // gridNode_->hide();
//set defaultBackgroundColor //set defaultBackgroundColor
QColor c = OpenFlipper::Options::defaultBackgroundColor() ; QColor c = OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>();
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) { for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
//wheel zoom factor //wheel zoom factor
......
...@@ -191,9 +191,6 @@ static QString title_ = "OpenFlipper v?"; ...@@ -191,9 +191,6 @@ 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 QColor defaultBackgroundColor_ = QColor("black");
/// default base color /// default base color
static QColor defaultBaseColor_ = QColor("white"); static QColor defaultBaseColor_ = QColor("white");
...@@ -679,14 +676,6 @@ bool splash( ) { ...@@ -679,14 +676,6 @@ bool splash( ) {
return splash_; return splash_;
} }
void defaultBackgroundColor( QColor _color ) {
defaultBackgroundColor_ = _color;
}
QColor defaultBackgroundColor() {
return defaultBackgroundColor_;
}
void defaultBaseColor( QColor _color ) { void defaultBaseColor( QColor _color ) {
defaultBaseColor_ = _color; defaultBaseColor_ = _color;
} }
...@@ -866,8 +855,6 @@ bool renderPicking( ) { ...@@ -866,8 +855,6 @@ bool renderPicking( ) {
bool initializeSettings() { bool initializeSettings() {
std::cerr << "Initialize settings" << std::endl;
//================================================================================================== //==================================================================================================
// Get the Main config dir in the home directory and possibly create it // Get the Main config dir in the home directory and possibly create it
//================================================================================================== //==================================================================================================
...@@ -1008,6 +995,9 @@ bool initializeSettings() { ...@@ -1008,6 +995,9 @@ bool initializeSettings() {
//================================================================================================== //==================================================================================================
// User Interface Settings // User Interface Settings
if ( ! settings_->contains("Core/Gui/glViewer/defaultBackgroundColor") )
settings_->setValue("Core/Gui/glViewer/defaultBackgroundColor",QColor("black"));
if ( ! settings_->contains("Core/Gui/glViewer/showControlWheels") ) if ( ! settings_->contains("Core/Gui/glViewer/showControlWheels") )
settings_->setValue("Core/Gui/glViewer/showControlWheels",false); settings_->setValue("Core/Gui/glViewer/showControlWheels",false);
......
...@@ -85,7 +85,8 @@ ...@@ -85,7 +85,8 @@
* The following entries are available through the settings: * The following entries are available through the settings:
* *
* <b>User Interface Settings</b> * <b>User Interface Settings</b>
* * Core/Gui/glViewer/showControlWheels This setting controls if the control wheels should be visible in the glViewer (bool) * * Core/Gui/glViewer/defaultBackgroundColor This controls the default background color of the glViewer (QColor)
* * Core/Gui/glViewer/showControlWheels This setting controls if the control wheels should be visible in the glViewer (bool)
* *
* <b>Mouse Controls<b>\n * <b>Mouse Controls<b>\n
* * Core/Mouse/Wheel/ZoomFactor Zoom factor used when turning the mouse wheel (double)\n * * Core/Mouse/Wheel/ZoomFactor Zoom factor used when turning the mouse wheel (double)\n
...@@ -596,14 +597,6 @@ QString helpDirStr(); ...@@ -596,14 +597,6 @@ QString helpDirStr();
DLLEXPORT DLLEXPORT
bool splash( ); bool splash( );
/// Default background color
DLLEXPORT
void defaultBackgroundColor( QColor _color );
/// Default background color
DLLEXPORT
QColor defaultBackgroundColor();
/// Default base color /// Default base color
DLLEXPORT DLLEXPORT
void defaultBaseColor( QColor _color ); void defaultBaseColor( QColor _color );
......
...@@ -93,7 +93,7 @@ void CoreWidget::slotSetGlobalBackgroundColor() { ...@@ -93,7 +93,7 @@ void CoreWidget::slotSetGlobalBackgroundColor() {
((double) c.blueF()) , ((double) c.blueF()) ,
1.0)); 1.0));
OpenFlipper::Options::defaultBackgroundColor( c ); OpenFlipperSettings().setValue("Core/Gui/glViewer/defaultBackgroundColor",c);
} }
......
...@@ -140,12 +140,12 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB ...@@ -140,12 +140,12 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
} }
void OptionsWidget::getBackgroundColor(){ void OptionsWidget::getBackgroundColor(){
QColor newColor = QColorDialog::getColor ( OpenFlipper::Options::defaultBackgroundColor() ); QColor newColor = QColorDialog::getColor ( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
OpenFlipper::Options::defaultBackgroundColor( newColor) ; OpenFlipperSettings().setValue("Core/Gui/glViewer/defaultBackgroundColor", newColor);
QPixmap color(16,16); QPixmap color(16,16);
color.fill( OpenFlipper::Options::defaultBackgroundColor() ); color.fill( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
backgroundButton->setIcon( QIcon(color) ); backgroundButton->setIcon( QIcon(color) );
} }
...@@ -330,7 +330,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) { ...@@ -330,7 +330,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
FPS->setValue( OpenFlipper::Options::maxFrameRate() ); FPS->setValue( OpenFlipper::Options::maxFrameRate() );
QPixmap color(16,16); QPixmap color(16,16);
color.fill( OpenFlipper::Options::defaultBackgroundColor() ); color.fill( OpenFlipperSettings().value("Core/Gui/glViewer/defaultBackgroundColor").value<QColor>() );
backgroundButton->setIcon( QIcon(color) ); backgroundButton->setIcon( QIcon(color) );
color.fill( OpenFlipper::Options::defaultBaseColor() ); color.fill( OpenFlipper::Options::defaultBaseColor() );
......
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