Remove tweeny
This commit is contained in:
parent
56c44d0454
commit
626d8bf151
@ -39,8 +39,6 @@ option(USE_BUNDLED_LMDB "Use the bundled version of lmdb."
|
|||||||
${HUNTER_ENABLED})
|
${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++."
|
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++."
|
||||||
${HUNTER_ENABLED})
|
${HUNTER_ENABLED})
|
||||||
option(USE_BUNDLED_TWEENY "Use the bundled version of tweeny."
|
|
||||||
${HUNTER_ENABLED})
|
|
||||||
option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt5Keychain."
|
option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt5Keychain."
|
||||||
${HUNTER_ENABLED})
|
${HUNTER_ENABLED})
|
||||||
|
|
||||||
@ -446,18 +444,6 @@ else()
|
|||||||
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
|
add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_BUNDLED_TWEENY)
|
|
||||||
include(FetchContent)
|
|
||||||
FetchContent_Declare(
|
|
||||||
Tweeny
|
|
||||||
GIT_REPOSITORY https://github.com/mobius3/tweeny.git
|
|
||||||
GIT_TAG 6a5033372fe53c4c731c66c8a2d56261746cd85c #v3 <- v3 has unfixed warnings
|
|
||||||
)
|
|
||||||
FetchContent_MakeAvailable(Tweeny)
|
|
||||||
else()
|
|
||||||
find_package(Tweeny REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(FindPkgConfig)
|
include(FindPkgConfig)
|
||||||
pkg_check_modules(GSTREAMER IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
|
pkg_check_modules(GSTREAMER IMPORTED_TARGET gstreamer-sdp-1.0>=1.18 gstreamer-webrtc-1.0>=1.18)
|
||||||
if (TARGET PkgConfig::GSTREAMER)
|
if (TARGET PkgConfig::GSTREAMER)
|
||||||
@ -643,7 +629,6 @@ target_link_libraries(nheko PRIVATE
|
|||||||
nlohmann_json::nlohmann_json
|
nlohmann_json::nlohmann_json
|
||||||
lmdbxx::lmdbxx
|
lmdbxx::lmdbxx
|
||||||
liblmdb::lmdb
|
liblmdb::lmdb
|
||||||
tweeny
|
|
||||||
SingleApplication::SingleApplication)
|
SingleApplication::SingleApplication)
|
||||||
|
|
||||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
|
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
#include <tweeny.h>
|
|
||||||
|
|
||||||
#include "SnackBar.h"
|
#include "SnackBar.h"
|
||||||
|
|
||||||
constexpr int STARTING_OFFSET = 1;
|
constexpr int STARTING_OFFSET = 1;
|
||||||
@ -16,6 +14,7 @@ constexpr double MIN_WIDTH_PERCENTAGE = 0.3;
|
|||||||
|
|
||||||
SnackBar::SnackBar(QWidget *parent)
|
SnackBar::SnackBar(QWidget *parent)
|
||||||
: OverlayWidget(parent)
|
: OverlayWidget(parent)
|
||||||
|
, offset_anim(this, "offset", this)
|
||||||
{
|
{
|
||||||
QFont font;
|
QFont font;
|
||||||
font.setPointSizeF(font.pointSizeF() * 1.2);
|
font.setPointSizeF(font.pointSizeF() * 1.2);
|
||||||
@ -28,17 +27,16 @@ SnackBar::SnackBar(QWidget *parent)
|
|||||||
|
|
||||||
hideTimer_.setSingleShot(true);
|
hideTimer_.setSingleShot(true);
|
||||||
|
|
||||||
auto offset_anim = tweeny::from(1.0f).to(0.0f).during(100).via(tweeny::easing::cubicOut);
|
offset_anim.setStartValue(1.0);
|
||||||
connect(&showTimer_, &QTimer::timeout, this, [this, offset_anim]() mutable {
|
offset_anim.setEndValue(0.0);
|
||||||
if (offset_anim.progress() < 1.0f) {
|
offset_anim.setDuration(100);
|
||||||
offset_ = offset_anim.step(0.07f);
|
offset_anim.setEasingCurve(QEasingCurve::OutCubic);
|
||||||
|
|
||||||
|
connect(this, &SnackBar::offsetChanged, this, [this]() mutable {
|
||||||
repaint();
|
repaint();
|
||||||
} else {
|
|
||||||
showTimer_.stop();
|
|
||||||
hideTimer_.start(ANIMATION_DURATION);
|
|
||||||
offset_anim.seek(0.0f);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
connect(
|
||||||
|
&offset_anim, &QPropertyAnimation::finished, this, [this]() { hideTimer_.start(10000); });
|
||||||
|
|
||||||
connect(&hideTimer_, SIGNAL(timeout()), this, SLOT(hideMessage()));
|
connect(&hideTimer_, SIGNAL(timeout()), this, SLOT(hideMessage()));
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ SnackBar::start()
|
|||||||
show();
|
show();
|
||||||
raise();
|
raise();
|
||||||
|
|
||||||
showTimer_.start(10);
|
offset_anim.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -77,7 +75,6 @@ SnackBar::hideMessage()
|
|||||||
void
|
void
|
||||||
SnackBar::stopTimers()
|
SnackBar::stopTimers()
|
||||||
{
|
{
|
||||||
showTimer_.stop();
|
|
||||||
hideTimer_.stop();
|
hideTimer_.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
#include <QPropertyAnimation>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
@ -23,6 +24,7 @@ class SnackBar : public OverlayWidget
|
|||||||
|
|
||||||
Q_PROPERTY(QColor bgColor READ backgroundColor WRITE setBackgroundColor)
|
Q_PROPERTY(QColor bgColor READ backgroundColor WRITE setBackgroundColor)
|
||||||
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
|
Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor)
|
||||||
|
Q_PROPERTY(double offset READ offset WRITE setOffset NOTIFY offsetChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SnackBar(QWidget *parent);
|
explicit SnackBar(QWidget *parent);
|
||||||
@ -46,9 +48,21 @@ public:
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double offset() { return offset_; }
|
||||||
|
void setOffset(double offset)
|
||||||
|
{
|
||||||
|
if (offset != offset_) {
|
||||||
|
offset_ = offset;
|
||||||
|
emit offsetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showMessage(const QString &msg);
|
void showMessage(const QString &msg);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void offsetChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event) override;
|
void paintEvent(QPaintEvent *event) override;
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
@ -68,10 +82,11 @@ private:
|
|||||||
|
|
||||||
std::deque<QString> messages_;
|
std::deque<QString> messages_;
|
||||||
|
|
||||||
QTimer showTimer_;
|
|
||||||
QTimer hideTimer_;
|
QTimer hideTimer_;
|
||||||
|
|
||||||
double boxHeight_;
|
double boxHeight_;
|
||||||
|
|
||||||
|
QPropertyAnimation offset_anim;
|
||||||
|
|
||||||
SnackBarPosition position_;
|
SnackBarPosition position_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user