Use a new patch from upstream to fix ARM build

- devel subpackage requres libs instead of the base package
This commit is contained in:
Robin Lee 2015-10-31 01:36:55 +08:00
parent bf6dbff868
commit 1eb338e086
3 changed files with 134 additions and 30 deletions

View File

@ -1,26 +0,0 @@
From f724a5b9f755b22240180ebbb3743bea9235dc33 Mon Sep 17 00:00:00 2001
From: Robin Lee <cheeselee@fedoraproject.org>
Date: Wed, 14 Oct 2015 22:04:46 +0800
Subject: [PATCH] Use qreal instead of double
Since qreal is float on ARM, using double here will fail to compile.
---
src/gui/widgets/starrating.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/widgets/starrating.cpp b/src/gui/widgets/starrating.cpp
index 62b7afe..1fb149d 100644
--- a/src/gui/widgets/starrating.cpp
+++ b/src/gui/widgets/starrating.cpp
@@ -246,7 +246,7 @@ double StarRating::percentForPosition(const QPoint &pos, int numTotalStars, cons
const int starSize = qMin(inside.height() - 2 * Private::paintMargin, (inside.width() - 2 * Private::paintMargin) / numTotalStars);
const int width = starSize * numTotalStars;
const int x = pos.x() - Private::paintMargin - inside.left();
- const double percent = x * 100.0 / width;
+ const qreal percent = x * 100.0 / width;
return qMax(qreal(0.0), qMin(qreal(100.0), percent));
}
--
2.5.0

View File

@ -2,7 +2,7 @@
Name: kbibtex
Version: 0.6
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A BibTeX editor for KDE
Group: Applications/Editors
@ -10,7 +10,7 @@ License: GPLv2+
URL: http://home.gna.org/kbibtex/index.html
Source0: http://download.gna.org/%{name}/%{branch}/%{name}-%{version}.tar.xz
# https://bugs.kde.org/show_bug.cgi?id=353898
Patch0: 0001-Use-qreal-instead-of-double.patch
Patch0: starrating-float.diff
BuildRequires: cmake kdelibs4-devel libxslt-devel desktop-file-utils gettext
BuildRequires: pkgconfig(QtWebKit)
@ -18,6 +18,7 @@ BuildRequires: poppler-qt4-devel
BuildRequires: libqxt-devel
BuildRequires: qca-devel
Requires: okular-part%{_isa}
Requires: %{name}-libs%{_isa} = %{version}-%{release}
%{?_kde4_macros_api:Requires: kde4-macros(api) = %{_kde4_macros_api} }
%description
@ -35,8 +36,8 @@ This package provides the runtime libraries for %{name}
%package devel
Summary: Development files for KBibTeX
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: kdelibs4-devel libxslt-devel poppler-qt4-devel
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: kdelibs4-devel%{?_isa} libxslt-devel%{?_isa} poppler-qt4-devel%{?_isa}
%description devel
The %{name}-devel package contains libraries and header files necessary for
@ -103,11 +104,16 @@ fi
%{_libdir}/lib%{name}*.so.*
%files devel
%license LICENSE
%{_libdir}/lib%{name}*.so
%{_kde4_includedir}/%{name}/
%changelog
* Fri Oct 30 2015 Robin Lee <cheeselee@fedoraproject.org> - 0.6-2
- Use a new patch from upstream to fix ARM build
- devel subpackage requres libs instead of the base package
* Tue Oct 13 2015 Robin Lee <cheeselee@fedoraproject.org> - 0.6-1
- Update to 0.6
- Fix ARM build with 0001-Use-qreal-instead-of-double.patch

124
starrating-float.diff Normal file
View File

@ -0,0 +1,124 @@
diff --git a/src/gui/widgets/starrating.cpp b/src/gui/widgets/starrating.cpp
index 664f12f..a6503ec 100644
--- a/src/gui/widgets/starrating.cpp
+++ b/src/gui/widgets/starrating.cpp
@@ -39,7 +39,7 @@ public:
static const int paintMargin;
bool isReadOnly;
- double percent;
+ float percent;
int maxNumberOfStars;
int spacing;
const QString unsetStarsText;
@@ -59,6 +59,15 @@ public:
const int starRectHeight = qMin(labelPercent->height() * 3 / 2, clearButton->height());
return QRect(QPoint(labelPercent->width() + spacing, (p->height() - starRectHeight) / 2), QSize(p->width() - 2 * spacing - clearButton->width() - labelPercent->width(), starRectHeight));
}
+
+ float percentForPosition(const QPoint &pos, int numTotalStars, const QRect &inside)
+ {
+ const int starSize = qMin(inside.height() - 2 * Private::paintMargin, (inside.width() - 2 * Private::paintMargin) / numTotalStars);
+ const int width = starSize * numTotalStars;
+ const int x = pos.x() - Private::paintMargin - inside.left();
+ const float percent = x * 100.0f / width;
+ return qMax(0.0f, qMin(100.0f, percent));
+ }
};
const int StarRating::Private::paintMargin = 2;
@@ -94,7 +103,7 @@ void StarRating::paintEvent(QPaintEvent *ev)
QPainter p(this);
const QRect r = d->starsInside();
- const double percent = d->mouseLocation.isNull() ? d->percent : percentForPosition(d->mouseLocation, d->maxNumberOfStars, r);
+ const float percent = d->mouseLocation.isNull() ? d->percent : d->percentForPosition(d->mouseLocation, d->maxNumberOfStars, r);
if (percent >= 0.0) {
paintStars(&p, KIconLoader::DefaultState, d->maxNumberOfStars, percent, d->starsInside());
@@ -117,7 +126,7 @@ void StarRating::mouseReleaseEvent(QMouseEvent *ev)
if (!d->isReadOnly && ev->button() == Qt::LeftButton) {
d->mouseLocation = QPoint();
- double newPercent = percentForPosition(ev->pos(), d->maxNumberOfStars, d->starsInside());
+ const float newPercent = d->percentForPosition(ev->pos(), d->maxNumberOfStars, d->starsInside());
setValue(newPercent);
emit modified();
ev->accept();
@@ -148,12 +157,12 @@ void StarRating::leaveEvent(QEvent *ev)
}
}
-double StarRating::value() const
+float StarRating::value() const
{
return d->percent;
}
-void StarRating::setValue(double percent)
+void StarRating::setValue(float percent)
{
if (d->isReadOnly) return; ///< disallow modifications if read-only
@@ -192,7 +201,7 @@ void StarRating::buttonHeight()
d->clearButton->setSizePolicy(sp.horizontalPolicy(), QSizePolicy::MinimumExpanding);
}
-void StarRating::paintStars(QPainter *painter, KIconLoader::States defaultState, int numTotalStars, double percent, const QRect &inside)
+void StarRating::paintStars(QPainter *painter, KIconLoader::States defaultState, int numTotalStars, float percent, const QRect &inside)
{
painter->save(); ///< Save the current painter's state; at this function's end restored
@@ -244,15 +253,6 @@ void StarRating::paintStars(QPainter *painter, KIconLoader::States defaultState,
painter->restore(); ///< Restore the painter's state as saved at this function's beginning
}
-double StarRating::percentForPosition(const QPoint &pos, int numTotalStars, const QRect &inside)
-{
- const int starSize = qMin(inside.height() - 2 * Private::paintMargin, (inside.width() - 2 * Private::paintMargin) / numTotalStars);
- const int width = starSize * numTotalStars;
- const int x = pos.x() - Private::paintMargin - inside.left();
- const double percent = x * 100.0 / width;
- return qMax(qreal(0.0), qMin(qreal(100.0), percent));
-}
-
bool StarRatingFieldInput::reset(const Value &value)
{
bool result = false;
diff --git a/src/gui/widgets/starrating.h b/src/gui/widgets/starrating.h
index a10ab08..c873892 100644
--- a/src/gui/widgets/starrating.h
+++ b/src/gui/widgets/starrating.h
@@ -60,13 +60,13 @@ public:
* the return value will be negative.
* @return either percent between 0.0 and 100.0, or a negative value
*/
- double value() const;
+ float value() const;
/**
* Set the rating in percent (valid only >=0.0 and <=100.0).
* @param percent value between 0.0 and 100.0
*/
- void setValue(double percent);
+ void setValue(float percent);
/**
* Remove any value assigned to this widget.
@@ -91,7 +91,7 @@ public:
* @param percent percent value of "glowing" starts, to be >=0.0 and <= 100.0
* @param inside fit and paint stars inside this rectangle on the painter
*/
- static void paintStars(QPainter *painter, KIconLoader::States defaultState, int numTotalStars, double percent, const QRect &inside);
+ static void paintStars(QPainter *painter, KIconLoader::States defaultState, int numTotalStars, float percent, const QRect &inside);
signals:
void modified();
@@ -105,7 +105,6 @@ protected:
private slots:
void clear();
void buttonHeight();
- double percentForPosition(const QPoint &pos, int numTotalStars, const QRect &inside);
private:
class Private;