Update to 0.6.2

This commit is contained in:
Robin Lee 2017-04-10 11:28:33 +08:00
parent 9510cd1739
commit 303b6d3d9d
4 changed files with 12 additions and 136 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ kbibtex-0.2.2.tar.bz2
/kbibtex-0.5.tar.xz
/kbibtex-0.5.1.tar.xz
/kbibtex-0.6.tar.xz
/kbibtex-0.6.2.tar.xz

View File

@ -1,16 +1,14 @@
%global branch 0.6
Name: kbibtex
Version: 0.6
Release: 5%{?dist}
Version: 0.6.2
Release: 1%{?dist}
Summary: A BibTeX editor for KDE
Group: Applications/Editors
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: starrating-float.diff
BuildRequires: cmake kdelibs4-devel libxslt-devel desktop-file-utils gettext
BuildRequires: pkgconfig(QtWebKit)
@ -49,7 +47,6 @@ developing programs using KBibTeX libraries.
%prep
%setup -q
%patch0 -p 1
%build
@ -62,6 +59,7 @@ make %{?_smp_mflags} -C %{_target_platform}
%install
make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}
%find_lang %{name}
%check
@ -88,9 +86,8 @@ touch --no-create %{_datadir}/mime/packages &> /dev/null || :
update-mime-database %{?fedora:-n} %{_datadir}/mime &> /dev/null || :
fi
%files
%doc README
%license LICENSE
%files -f %{name}.lang
%doc README ChangeLog
%{_kde4_bindir}/%{name}
%{_kde4_libdir}/kde4/%{name}part.so*
%{_kde4_datadir}/appdata/%{name}.appdata.xml
@ -101,19 +98,21 @@ fi
%{_kde4_configdir}/%{name}rc
%{_datadir}/mime/packages/bibliography.xml
%{_kde4_iconsdir}/hicolor/*/apps/%{name}.*
%{_mandir}/man1/%{name}.1.*
%{_kde4_docdir}/HTML/en/%{name}
%{_kde4_docdir}/HTML/*/%{name}
%files libs
%license LICENSE
%{_libdir}/lib%{name}*.so.*
%files devel
%license LICENSE
%{_libdir}/lib%{name}*.so
%{_kde4_includedir}/%{name}/
%changelog
* Sun Apr 9 2017 Robin Lee <cheeselee@fedoraproject.org> - 0.6.2-1
- Update to 0.6.2
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

View File

@ -1 +1 @@
f1a9c1867d94c36fe88cfa0470b85dac kbibtex-0.6.tar.xz
SHA512 (kbibtex-0.6.2.tar.xz) = aa23e80cb273c0ae721ecc917f540070deea520fea2d7ca7ee97fde2c6918dba84769ad083fed93b9d0260539273c20c214b92c94269b413f46cb644d16dc270

View File

@ -1,124 +0,0 @@
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;