Commit 06defb14 authored by Jan Möbius's avatar Jan Möbius

Make defaultBackgroundColor a qcolor ( otherwise load/save does not work)

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@4308 383ad7c9-94d9-4d36-a494-682f7c89f535
parent fedd5da5
......@@ -420,8 +420,6 @@ Core::init() {
emit log(LOGWARN,"Work is in progress to resolve this issue.");
}
applyOptions();
if ( OpenFlipper::Options::gui() ) {
//try to restore the windowState
......@@ -446,9 +444,10 @@ Core::init() {
file2.close();
}
coreWidget_->show();
applyOptions();
if ( OpenFlipper::Options::splash() ) {
splash_->finish(coreWidget_);
}
......
......@@ -222,7 +222,7 @@ void Core::readApplicationOptions(INIFile& _ini) {
//============================================================================
uint backgroundColor = 0;
if ( _ini.get_entry( backgroundColor, "Options" , "DefaultBackgroundColor") )
OpenFlipper::Options::defaultBackgroundColor(backgroundColor);
OpenFlipper::Options::defaultBackgroundColor(QRgb(backgroundColor));
//============================================================================
// Load the setting for the default Toolbox mode
......@@ -444,7 +444,7 @@ void Core::writeApplicationOptions(INIFile& _ini) {
// check if we are in fullscreen mode:
_ini.add_entry("Options","FullScreen", OpenFlipper::Options::fullScreen() );
_ini.add_entry("Options","DefaultBackgroundColor", (uint)OpenFlipper::Options::defaultBackgroundColor() );
_ini.add_entry("Options","DefaultBackgroundColor", (uint)OpenFlipper::Options::defaultBackgroundColor().rgba () );
}
_ini.add_entry("Options","Stereo",OpenFlipper::Options::stereo() );
......
......@@ -85,8 +85,14 @@ void Core::applyOptions(){
target = ACG::SceneGraph::PICK_ANYTHING;
}
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
//set defaultBackgroundColor
QColor c = OpenFlipper::Options::defaultBackgroundColor() ;
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
std::cerr << "Color before : " << i << " : " << coreWidget_->examiner_widgets_[i]->backgroundColor() << std::endl;
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i ) {
std::cerr << "Examiner " << i << std::endl;
//animation
coreWidget_->examiner_widgets_[i]->animation(OpenFlipper::Options::animation());
......@@ -100,8 +106,15 @@ void Core::applyOptions(){
// Picking Debugger
coreWidget_->examiner_widgets_[i]->renderPicking(OpenFlipper::Options::renderPicking(), target );
std::cerr << "Setting " << i << " to " << ACG::Vec4f( c.redF(), c.greenF(), c.blueF(),1.0f) << std::endl;
// Background color
coreWidget_->examiner_widgets_[i]->backgroundColor( ACG::Vec4f(c.redF(),c.greenF(),c.blueF(),1.0f) );
}
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
std::cerr << "Color After : " << i << " : " << coreWidget_->examiner_widgets_[i]->backgroundColor() << std::endl;;
//hideToolbox
if (OpenFlipper::Options::hideToolbox()) {
......@@ -128,10 +141,6 @@ void Core::applyOptions(){
}
}
//set defaultBackgroundColor
QColor c = QColor( OpenFlipper::Options::defaultBackgroundColor() );
PluginFunctions::setBackColor( OpenMesh::Vec4f(c.redF(),c.greenF(),c.blueF(),0.0f) );
updateView();
}
......
......@@ -141,7 +141,7 @@ static QString title_ = "OpenFlipper v?";
static bool splash_ = true;
/// default background color for the viewer
static QRgb defaultBackgroundColor_ = 0;
static QColor defaultBackgroundColor_ = QColor(0.0,0.0,0.0,0.0);
/// Scripting status
static bool scripting_ = false;
......@@ -566,11 +566,11 @@ bool splash( ) {
return splash_;
}
void defaultBackgroundColor( QRgb _color ) {
void defaultBackgroundColor( QColor _color ) {
defaultBackgroundColor_ = _color;
}
QRgb defaultBackgroundColor() {
QColor defaultBackgroundColor() {
return defaultBackgroundColor_;
}
......
......@@ -471,13 +471,13 @@ void fontsDir(QDir _dir);
DLLEXPORT
bool splash( );
/// Default background color
/// Default background color
DLLEXPORT
void defaultBackgroundColor( QRgb _color );
void defaultBackgroundColor( QColor _color );
/// Default background color
DLLEXPORT
QRgb defaultBackgroundColor();
QColor defaultBackgroundColor();
/** @} */
......
<?xml version = '1.0' encoding = 'UTF-8'?>
<!DOCTYPE KDevPrjSession>
<KDevPrjSession>
<DocsAndViews NumberOfDocuments="5" >
<DocsAndViews NumberOfDocuments="6" >
<Doc0 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/Init.cc" >
<View0 Encoding="" Type="Source" />
<View0 Encoding="" line="568" Type="Source" />
</Doc0>
<Doc1 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateModelingPlugin.hh" >
<View0 Encoding="" Type="Source" />
<View0 Encoding="" line="87" Type="Source" />
</Doc1>
<Doc2 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/Matching.cc" >
<View0 Encoding="" Type="Source" />
<Doc2 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/DataContainerT.hh" >
<View0 Encoding="" line="85" Type="Source" />
</Doc2>
<Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateModelingPlugin.cc" >
<View0 Encoding="" line="428" Type="Source" />
<Doc3 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/DataContainerT.cc" >
<View0 Encoding="" line="14" Type="Source" />
</Doc3>
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/ACG/QtWidgets/QtBaseViewer.cc" >
<View0 Encoding="" line="52" Type="Source" />
<Doc4 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateBlendingComputation.cc" >
<View0 Encoding="" line="247" Type="Source" />
</Doc4>
<Doc5 NumberOfViews="1" URL="file:///data/home1/moebius/projects/OpenFlipper/Plugin-TemplateModeling/TemplateModelingPlugin.cc" >
<View0 Encoding="" line="518" Type="Source" />
</Doc5>
</DocsAndViews>
<pluginList>
<kdevdebugger>
......
......@@ -311,19 +311,29 @@ void CoreWidget::slotSnapshotName() {
void CoreWidget::changeBackgroundColor(){
ACG::Vec4f bc = examiner_widgets_[PluginFunctions::activeExaminer()]->backgroundColor();
ACG::Vec4f bc = examiner_widgets_[PluginFunctions::activeExaminer()]->backgroundColor() * 255.0;
QColor backCol((int)bc[0], (int)bc[1], (int)bc[2]);
// for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
// std::cerr << "Color before : " << i << " : " << examiner_widgets_[i]->backgroundColor() << std::endl;
QColor backCol((int)bc[0], (int)bc[1], (int)bc[2], (int)bc[3]);
QColor c = QColorDialog::getColor(backCol,this);
if (c != backCol && c.isValid()){
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i )
examiner_widgets_[i]->backgroundColor(ACG::Vec4f(((double) c.red()) / 255.0,
((double) c.green()) / 255.0,
((double) c.blue()) / 255.0,
std::cerr << "Examiner widgets : " << OpenFlipper::Options::examinerWidgets() << std::endl;
for ( uint i = 0 ; i < OpenFlipper::Options::examinerWidgets(); ++i ) {
examiner_widgets_[i]->backgroundColor(ACG::Vec4f(((double) c.redF()) ,
((double) c.greenF()) ,
((double) c.blueF()) ,
1.0));
std::cerr << "i is " << i << std::endl;
}
OpenFlipper::Options::defaultBackgroundColor( c.rgb() );
OpenFlipper::Options::defaultBackgroundColor( c );
}
for ( unsigned int i = 0 ; i < OpenFlipper::Options::examinerWidgets() ; ++i )
std::cerr << "Color after : " << i << " : " << examiner_widgets_[i]->backgroundColor() << std::endl;
}
void CoreWidget::slotSnapshot() {
......
......@@ -97,12 +97,12 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
}
void OptionsWidget::getBackgroundColor(){
QColor newColor = QColorDialog::getColor (QColor(OpenFlipper::Options::defaultBackgroundColor()));
QColor newColor = QColorDialog::getColor ( OpenFlipper::Options::defaultBackgroundColor() );
OpenFlipper::Options::defaultBackgroundColor( newColor.rgb() );
OpenFlipper::Options::defaultBackgroundColor( newColor) ;
QPixmap color(16,16);
color.fill(QColor(OpenFlipper::Options::defaultBackgroundColor()));
color.fill( OpenFlipper::Options::defaultBackgroundColor() );
backgroundButton->setIcon( QIcon(color) );
}
......@@ -128,7 +128,7 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
FPS->setValue( OpenFlipper::Options::maxFrameRate() );
QPixmap color(16,16);
color.fill(QColor(OpenFlipper::Options::defaultBackgroundColor()));
color.fill( OpenFlipper::Options::defaultBackgroundColor() );
backgroundButton->setIcon( QIcon(color) );
// updates
......
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