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

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) {
if ( _ini.get_entry( fullScreen, "Options" , "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
//============================================================================
......@@ -400,6 +407,8 @@ 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","Stereo",OpenFlipper::Options::stereo() );
......
......@@ -48,6 +48,7 @@
#include "OpenFlipper/INIFile/INIFile.hh"
#include "OpenFlipper/common/GlobalOptions.hh"
#include <OpenFlipper/BasePlugin/PluginFunctions.hh>
//== IMPLEMENTATION ==========================================================
......@@ -104,6 +105,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();
......
......@@ -127,6 +127,9 @@ static QString title_ = "OpenFlipper v?";
/// Show a splash screen on init?
static bool splash_ = true;
/// default background color for the viewer
static QRgb defaultBackgroundColor_ = 0;
/// Scripting status
static bool scripting_ = false;
......@@ -483,6 +486,13 @@ bool splash( ) {
return splash_;
}
void defaultBackgroundColor( QRgb _color ) {
defaultBackgroundColor_ = _color;
}
QRgb defaultBackgroundColor() {
return defaultBackgroundColor_;
}
/// return last used dataType
QString lastDataType(){
......
......@@ -57,6 +57,7 @@
#include <QDir>
#include <QStringList>
#include <QColor>
namespace OpenFlipper {
namespace Options {
......@@ -426,6 +427,14 @@ bool iconDir(QString _dir);
DLLEXPORT
bool splash( );
/// Default background color
DLLEXPORT
void defaultBackgroundColor( QRgb _color );
/// Default background color
DLLEXPORT
QRgb defaultBackgroundColor();
/** @} */
//===========================================================================
......
......@@ -39,6 +39,8 @@
#include <OpenFlipper/ACGHelper/DrawModeConverter.hh>
#include <OpenFlipper/INIFile/INIFile.hh>
#include <QColorDialog>
OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyBinding>& _core, QWidget *parent)
: QWidget(parent),
plugins_(_plugins),
......@@ -85,6 +87,20 @@ OptionsWidget::OptionsWidget(std::vector<PluginInfo>& _plugins, std::vector<KeyB
progressDialog = new QProgressDialog(this);
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*/ ) {
......@@ -107,6 +123,10 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
restrictFPS->setChecked( OpenFlipper::Options::restrictFrameRate() );
FPS->setValue( OpenFlipper::Options::maxFrameRate() );
QPixmap color(16,16);
color.fill(QColor(OpenFlipper::Options::defaultBackgroundColor()));
backgroundButton->setIcon( QIcon(color) );
// updates
updateUser->setText( OpenFlipper::Options::updateUsername() );
updatePass->setText( OpenFlipper::Options::updatePassword() );
......
......@@ -66,6 +66,9 @@ class OptionsWidget : public QWidget, public Ui::OptionsWidget
/// Download updates
void slotGetUpdates();
/// open a dialog to determine the color
void getBackgroundColor();
protected:
void showEvent ( QShowEvent * event );
......
......@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>488</width>
<height>689</height>
<width>484</width>
<height>763</height>
</rect>
</property>
<property name="windowTitle" >
......@@ -23,7 +23,7 @@ You can select multiple modes at the same time.</string>
<string/>
</property>
<property name="currentIndex" >
<number>4</number>
<number>2</number>
</property>
<property name="usesScrollButtons" >
<bool>true</bool>
......@@ -33,8 +33,8 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
......@@ -133,8 +133,8 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
......@@ -165,14 +165,14 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
<string>Viewer</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout" >
<layout class="QVBoxLayout" name="verticalLayout_9" >
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
......@@ -295,7 +295,7 @@ You can select multiple modes at the same time.</string>
<property name="title" >
<string> Other </string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10" >
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
......@@ -365,6 +365,30 @@ You can select multiple modes at the same time.</string>
</property>
</widget>
</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>
</widget>
</item>
......@@ -375,8 +399,8 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
......@@ -399,8 +423,8 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
......@@ -514,8 +538,8 @@ You can select multiple modes at the same time.</string>
<rect>
<x>0</x>
<y>0</y>
<width>466</width>
<height>603</height>
<width>462</width>
<height>685</height>
</rect>
</property>
<attribute name="title" >
......@@ -606,7 +630,6 @@ p, li { white-space: pre-wrap; }
</layout>
</item>
</layout>
<zorder>tabWidget</zorder>
</widget>
<resources/>
<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