Commit 02b96c8a authored by Philipp Erhardt's avatar Philipp Erhardt
Browse files

Replace background_opacity with background_color

With this option and background_color_fullscreen you can freely configure the color of your liking.
parent 5d6ef51e
......@@ -118,8 +118,10 @@ KEY BINDINGS
VARIABLES
---------
'int' *background_opacity* ::
223: Opacity of the black background in range [0..255]. Only works when using a compositor.
'string' *background_color* ::
0xDF000000: Background color in ARGB Format. Alpha only works when using a compositor.
'string' *background_color_fullscreen* ::
0xFF000000: Fullscreen background color in ARGB Format.
'string' *default_layout* ::
presentation: The layout on startup. Possible values: 'presentation', 'grid'.
'int' *mouse_wheel_factor* ::
......
[Settings]
background_opacity=223
background_color=0xDF000000
background_color_fullscreen=0xFF000000
default_layout=presentation
mouse_wheel_factor=120
smooth_scroll_delta=30
......
......@@ -32,7 +32,24 @@ Canvas::Canvas(Viewer *v, QWidget *parent) :
// load config options
CFG *config = CFG::get_instance();
background_opacity = config->get_value("background_opacity").toInt();
{
bool ok;
unsigned int color = config->get_value("background_color").toString().toUInt(&ok, 16);
if (ok) {
background.setRgba(color);
} else {
cerr << "failed to parse background_color" << endl;
}
}
{
bool ok;
unsigned int color = config->get_value("background_color_fullscreen").toString().toUInt(&ok, 16);
if (ok) {
background_fullscreen.setRgba(color);
} else {
cerr << "failed to parse background_color_fullscreen" << endl;
}
}
presentation_layout = new PresentationLayout(viewer);
grid_layout = new GridLayout(viewer);
......@@ -105,9 +122,9 @@ void Canvas::paintEvent(QPaintEvent * /*event*/) {
#endif
QPainter painter(this);
if (viewer->isFullScreen()) {
painter.fillRect(rect(), QColor(0, 0, 0));
painter.fillRect(rect(), background_fullscreen);
} else {
painter.fillRect(rect(), QColor(0, 0, 0, background_opacity));
painter.fillRect(rect(), background);
}
cur_layout->render(&painter);
......
......@@ -73,7 +73,8 @@ private:
bool valid;
// config options
int background_opacity;
QColor background;
QColor background_fullscreen;
int mouse_wheel_factor;
};
......
......@@ -8,7 +8,8 @@ CFG::CFG() :
settings.beginGroup("Settings");
// canvas options
defaults["background_opacity"] = 223;
defaults["background_color"] = "0xDF000000";
defaults["background_color_fullscreen"] = "0xFF000000";
defaults["default_layout"] = "presentation";
defaults["mouse_wheel_factor"] = 120; // (qt-)delta for turning the mouse wheel 1 click
defaults["smooth_scroll_delta"] = 30; // pixel scroll offset
......
Supports Markdown
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