Skip to content

Commit

Permalink
Clean-up old palette support for vision impaired users
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Oct 10, 2016
1 parent 0e32370 commit 6ffd328
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 73 deletions.
48 changes: 0 additions & 48 deletions src/YQUI.cc
Expand Up @@ -103,7 +103,6 @@ YQUI::YQUI( bool withThreads )
_uiInitialized = false;
_fatalError = false;
_fullscreen = false;
_usingVisionImpairedPalette = false;
_noborder = false;
screenShotNameTemplate = "";
_blockedLevel = 0;
Expand Down Expand Up @@ -158,7 +157,6 @@ void YQUI::initUI()
_busyCursorTimer = new QTimer( _signalReceiver );
_busyCursorTimer->setSingleShot( true );

_normalPalette = qApp->palette();
(void) QY2Styler::styler(); // Make sure QY2Styler singleton is created

setButtonOrderFromEnvironment();
Expand Down Expand Up @@ -628,52 +626,6 @@ void YQUI::deleteNotify( YWidget * widget )
_eventHandler.deletePendingEventsFor( widget );
}


void YQUI::toggleVisionImpairedPalette()
{
QY2Styler::styler()->toggleHighContrastStyleSheet();
}

bool YQUI::usingVisionImpairedPalette() {
return QY2Styler::styler()->usingHighContrastStyleSheet();
}

QPalette
YQUI::visionImpairedPalette()
{
const QColor dark ( 0x20, 0x20, 0x20 );
QPalette pal;

// for the active window (the one with the keyboard focus)
pal.setColor( QPalette::Active, QPalette::Background, Qt::black );
pal.setColor( QPalette::Active, QPalette::Foreground, Qt::cyan );
pal.setColor( QPalette::Active, QPalette::Text, Qt::cyan );
pal.setColor( QPalette::Active, QPalette::Base, dark );
pal.setColor( QPalette::Active, QPalette::Button, dark );
pal.setColor( QPalette::Active, QPalette::ButtonText, Qt::green );
pal.setColor( QPalette::Active, QPalette::Highlight, Qt::yellow );
pal.setColor( QPalette::Active, QPalette::HighlightedText, Qt::black );

// for other windows (those that don't have the keyboard focus)
pal.setColor( QPalette::Inactive, QPalette::Background, Qt::black );
pal.setColor( QPalette::Inactive, QPalette::Foreground, Qt::cyan );
pal.setColor( QPalette::Inactive, QPalette::Text, Qt::cyan );
pal.setColor( QPalette::Inactive, QPalette::Base, dark );
pal.setColor( QPalette::Inactive, QPalette::Button, dark );
pal.setColor( QPalette::Inactive, QPalette::ButtonText, Qt::green );

// for disabled widgets
pal.setColor( QPalette::Disabled, QPalette::Background, Qt::black );
pal.setColor( QPalette::Disabled, QPalette::Foreground, Qt::gray );
pal.setColor( QPalette::Disabled, QPalette::Text, Qt::gray );
pal.setColor( QPalette::Disabled, QPalette::Base, dark );
pal.setColor( QPalette::Disabled, QPalette::Button, dark );
pal.setColor( QPalette::Disabled, QPalette::ButtonText, Qt::gray );

return pal;
}


// FIXME: Does this still do anything now that YQUI is no longer a QObject?
bool YQUI::close()
{
Expand Down
25 changes: 0 additions & 25 deletions src/YQUI.h
Expand Up @@ -28,7 +28,6 @@
#include <qapplication.h>
#include <QMap>
#include <QTimer>
#include <QPalette>
#include <vector>
#include <type_traits>

Expand Down Expand Up @@ -271,27 +270,6 @@ class YQUI: public YUI
**/
static void setTextdomain( const char * domain );

/**
* Returns a high-contrast color palette suitable for vision impaired users.
**/
static QPalette visionImpairedPalette();

/**
* Returns the normal color palette
**/
QPalette normalPalette() const { return _normalPalette; }

/**
* Toggle between the vision impaired and the normal color palette.
**/
void toggleVisionImpairedPalette();

/**
* Returns 'true' if high-contrast colors for vision impaired users is in use.
* This should be queried at other places before using custom colors.
**/
bool usingVisionImpairedPalette();

/**
* Returns the application name for the window title (e.g. "YaST2@hostname")
**/
Expand Down Expand Up @@ -369,9 +347,6 @@ class YQUI: public YUI
YSimpleEventHandler _eventHandler;
int _blockedLevel;

QPalette _normalPalette;
bool _usingVisionImpairedPalette;

bool _leftHandedMouse;
bool _askedForLeftHandedMouse;

Expand Down

0 comments on commit 6ffd328

Please sign in to comment.