okular/conf/dlggeneral.cpp
Albert Freeman 1f6e8a4782 Custom background color
Summary:
BUG: 182994

Adds an option to the config dialog that enables background color (the color around the displayed page) to be changed (while by default preserving the Qt toolkit selection as not to affect existing users).

Reasons for this change:
Accessibility, eye strain, aesthetic reasons, color displayed on monitor can affect power consumption (how: depends on display technology).
Many people want this change occording to Bugzilla and other sources.

Maintenance: Nearly no additional maintenance:
This is no new subsystem but a trivial feature with no complex code dependencies, and we are already showing a colour selection dialog and setting colours in other places in Okular.

{F4257766}

Other less important information:
https://git.reviewboard.kde.org/r/130219/
https://mail.kde.org/pipermail/okular-devel/2017-September/025520.html

Test Plan:
Tested everything, it all works:
Toggled the custom background color, changed custom background color, removed okular settings file (with: "rm ~/.config/okular*") to verify it uses the usual qt theme colour by default (where the settings file remembered the custom color).

Reviewers: #okular, aacid, elvisangelaccio, rkflx, ngraham

Reviewed By: ngraham

Subscribers: aacid, ltoscano, ngraham

Tags: #okular

Differential Revision: https://phabricator.kde.org/D8051
2017-10-01 11:31:59 +02:00

58 lines
1.8 KiB
C++

/***************************************************************************
* Copyright (C) 2006 by Pino Toscano <toscano.pino@tiscali.it> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "dlggeneral.h"
#include <kauthorized.h>
#include <config-okular.h>
#include "ui_dlggeneralbase.h"
#include "settings.h"
DlgGeneral::DlgGeneral( QWidget * parent, Okular::EmbedMode embedMode )
: QWidget( parent )
{
m_dlg = new Ui_DlgGeneralBase();
m_dlg->setupUi( this );
setCustomBackgroundColorButton( Okular::Settings::useCustomBackgroundColor() );
if( embedMode == Okular::ViewerWidgetMode )
{
m_dlg->kcfg_SyncThumbnailsViewport->setVisible( false );
m_dlg->kcfg_DisplayDocumentTitle->setVisible( false );
m_dlg->kcfg_WatchFile->setVisible( false );
m_dlg->kcfg_rtlReadingDirection->setVisible(false);
}
m_dlg->kcfg_ShellOpenFileInTabs->setVisible( embedMode == Okular::NativeShellMode );
}
DlgGeneral::~DlgGeneral()
{
delete m_dlg;
}
void DlgGeneral::showEvent( QShowEvent * )
{
#if OKULAR_FORCE_DRM
m_dlg->kcfg_ObeyDRM->hide();
#else
if ( KAuthorized::authorize( QStringLiteral("skip_drm") ) )
m_dlg->kcfg_ObeyDRM->show();
else
m_dlg->kcfg_ObeyDRM->hide();
#endif
}
void DlgGeneral::setCustomBackgroundColorButton( bool value )
{
m_dlg->kcfg_BackgroundColor->setEnabled( value );
}