Open probonopd opened 3 years ago
In the Dock we have implemented this and it was actually very easy, but the Dock is written in Qml.
How do we do this in Filer? https://doc.qt.io/qt-5/qpropertyanimation.html
Something in libfm-qt/filelauncher.cpp
along the lines of
#include <QPropertyAnimation>
bool FileLauncher::launchFiles(QWidget* parent, GList* file_infos) {
qDebug() << "probono: FileLauncher::launchFiles called";
qDebug() << "probono: parent:" << parent;
QPropertyAnimation *animation = new QPropertyAnimation(parent, "pos");
animation->setTargetObject(parent);
animation->setDuration(1500);
animation->setEndValue(QPoint(400, 400)); // Actually we want to increase the size, as we do in the Dock
animation->start();
// FIXME: QPropertyAnimation::updateState (pos): Changing state of an animation without target
maybe?
I think our bool FileLauncher::launchFiles(QWidget* parent, GList* file_infos)
method needs to be changed:
QWidget* parent
, it is not the icon in the list view that is being launched, and often it is nullptr
GList* file_infos
can contain multiple filescc @moochris
In desktopitemdelegate.cpp
, we may need to add a Q_PROPERTY
for what we want to animate (e.g., size and/or opacity)
https://stackoverflow.com/a/52856454
Then we can use a QPropertyAnimation
https://felgo.com/doc/qt/qpropertyanimation/
or a QVariantAnimation
to animate that property similar to
auto moveAnimation = new QPropertyAnimation( &t, "pos" );
moveAnimation->setDuration( 10000 );
moveAnimation->setStartValue( QPointF(640, 680) );
moveAnimation->setEndValue( QPointF(0, 0) );
moveAnimation->setEasingCurve( QEasingCurve::Linear );
moveAnimation->start(QAbstractAnimation::DeleteWhenStopped);
https://stackoverflow.com/q/52853322
Need to play with https://github.com/kimtaikee/resizeAnimation examples.
While the icon is increased, we can slowly fade it out; maybe using https://doc.qt.io/qt-5/qgraphicsopacityeffect.html?
If the opened item is a folder, the folder's window appears instantly; we might use a KWin animatin for it.
If the launched item is an application, we may need to animate the application icon instead because a window may or may not appear immediately.
E.g., Open animation like in https://user-images.githubusercontent.com/900690/51821977-24acd700-22db-11e9-865a-17490e445f35.gif