mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Disabled fix color of chat messages for Qt 4.5 and lower because of missing methods on QColor.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5592 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
16f07f766c
commit
91710adfac
@ -88,6 +88,11 @@ ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags)
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
||||
#if QT_VERSION < 0x040600
|
||||
ui.minimumContrastLabel->hide();
|
||||
ui.minimumContrast->hide();
|
||||
#endif
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_40">
|
||||
<item>
|
||||
<widget class="QLabel" name="label40">
|
||||
<widget class="QLabel" name="minimumContrastLabel">
|
||||
<property name="text">
|
||||
<string>Minimum text contrast</string>
|
||||
</property>
|
||||
|
@ -451,6 +451,12 @@ static qreal getContrastRatio(qreal lum1, qreal lum2)
|
||||
*/
|
||||
static void findBestColor(QString &val, qreal bglum, qreal desiredContrast)
|
||||
{
|
||||
#if QT_VERSION < 0x040600
|
||||
// missing methods on class QColor
|
||||
Q_UNUSED(val);
|
||||
Q_UNUSED(bglum);
|
||||
Q_UNUSED(desiredContrast);
|
||||
#else
|
||||
// Change text color to get a good contrast with the background
|
||||
QColor c(val);
|
||||
qreal lum = ::getRelativeLuminance(c);
|
||||
@ -466,7 +472,6 @@ static void findBestColor(QString &val, qreal bglum, qreal desiredContrast)
|
||||
// So we enforce desired contrast when the bg is dark.
|
||||
|
||||
if (!searchDown || ::getContrastRatio(lum, bglum) < desiredContrast) {
|
||||
|
||||
// Bisection search of the correct "lightness" to get the desired contrast
|
||||
qreal minl = searchDown ? 0.0 : bglum;
|
||||
qreal maxl = searchDown ? bglum : 1.0;
|
||||
@ -485,6 +490,7 @@ static void findBestColor(QString &val, qreal bglum, qreal desiredContrast)
|
||||
c.setHslF(c.hslHueF(), c.hslSaturationF(), minl);
|
||||
val = c.name();
|
||||
}
|
||||
#endif // QT_VERSION < 0x040600
|
||||
}
|
||||
|
||||
static void optimizeHtml(QDomDocument& doc, QDomElement& currentElement, unsigned int flag, qreal bglum, qreal desiredContrast)
|
||||
|
Loading…
Reference in New Issue
Block a user