diff --git a/GloSC/GloSC.cpp b/GloSC/GloSC.cpp index 7bd7d11..7050587 100644 --- a/GloSC/GloSC.cpp +++ b/GloSC/GloSC.cpp @@ -103,6 +103,54 @@ void GloSC::updateTargetsToNewVersion() } +void GloSC::animate(int to) +{ + QPropertyAnimation* anim = new QPropertyAnimation(this, "size"); + if (to > width()) + { + anim->setEasingCurve(QEasingCurve::InOutExpo); + connect(anim, &QPropertyAnimation::finished, this, [this, to]() + { + this->setMinimumWidth(to); + }); + this->setMaximumWidth(to); + + QPropertyAnimation* buttonAnim = new QPropertyAnimation(ui.pbCreateNew, "size"); + buttonAnim->setEasingCurve(QEasingCurve::InOutExpo); + buttonAnim->setDuration(360); + buttonAnim->setStartValue(QSize(ui.pbCreateNew->width(), ui.pbCreateNew->height())); + buttonAnim->setEndValue(QSize(wide_x_create, ui.pbCreateNew->height())); + buttonAnim->start(QPropertyAnimation::DeleteWhenStopped); + + } + else + { + anim->setEasingCurve(QEasingCurve::InExpo); + connect(anim, &QPropertyAnimation::finished, this, [this, to]() + { + this->setMaximumWidth(to); + }); + this->setMinimumWidth(to); + + QPropertyAnimation* buttonAnim = new QPropertyAnimation(ui.pbCreateNew, "size"); + buttonAnim->setEasingCurve(QEasingCurve::OutExpo); + buttonAnim->setDuration(360); + buttonAnim->setStartValue(QSize(ui.pbCreateNew->width(), ui.pbCreateNew->height())); + buttonAnim->setEndValue(QSize(small_x_create, ui.pbCreateNew->height())); + buttonAnim->start(QPropertyAnimation::DeleteWhenStopped); + + } + anim->setDuration(360); + anim->setStartValue(QSize(this->width(), this->height())); + anim->setEndValue(QSize(to, this->height())); + anim->start(QPropertyAnimation::DeleteWhenStopped); +} + +void GloSC::on_pbCreateNew_clicked() +{ + animate(wide_x); +} + void GloSC::on_pbSave_clicked() { QString name = ui.leName->text(); @@ -161,6 +209,7 @@ void GloSC::on_pbSave_clicked() updateEntryList(); + animate(small_x); } @@ -182,11 +231,12 @@ void GloSC::on_pbDelete_clicked() dir.removeRecursively(); } updateEntryList(); + + animate(small_x); } void GloSC::on_pbAddToSteam_clicked() { - if (ui.lwInstances->count() <= 0) { QMessageBox::information(this, "GloSC", "No shortcuts! Create some shortcuts first for them to be added to Steam!", QMessageBox::Ok); @@ -301,6 +351,7 @@ void GloSC::on_pbAddToSteam_clicked() shortcutsFile.close(); QMessageBox::information(this, "GloSC", "Shortcuts were added! Restart Steam for changes to take effect!", QMessageBox::Ok); + animate(small_x); } void GloSC::on_pbSearchPath_clicked() @@ -451,5 +502,29 @@ void GloSC::on_lwInstances_currentRowChanged(int row) settings.endGroup(); +} +void GloSC::on_lwInstances_itemSelectionChanged() +{ + if (width() != wide_x) + { + animate(wide_x); + } else { + //ui.configBox->setGraphicsEffect(&opEff); + //QPropertyAnimation* anim = new QPropertyAnimation(&opEff, "opacity"); + //anim->setEasingCurve(QEasingCurve::OutExpo); + //anim->setDuration(160); + //anim->setStartValue(1.f); + //anim->setEndValue(0.f); + //connect(anim, &QPropertyAnimation::finished, this, [this]() + //{ + // QPropertyAnimation* anim2 = new QPropertyAnimation(&opEff, "opacity"); + // anim2->setEasingCurve(QEasingCurve::InExpo); + // anim2->setDuration(160); + // anim2->setStartValue(0.f); + // anim2->setEndValue(1.f); + // anim2->start(QPropertyAnimation::DeleteWhenStopped); + //}); + //anim->start(QPropertyAnimation::DeleteWhenStopped); + } } diff --git a/GloSC/GloSC.h b/GloSC/GloSC.h index afe7bf4..d791608 100644 --- a/GloSC/GloSC.h +++ b/GloSC/GloSC.h @@ -28,6 +28,10 @@ limitations under the License. #include #include +#include +#include +#include + #include "UWPPair.h" #include "UWPSelectDialog.h" @@ -51,13 +55,25 @@ private: const unsigned int GLOSC_VERSION = 0x00000113; + int wide_x = 711; + int small_x = 302; + + int wide_x_create = 261; + int small_x_create = 131; + + QGraphicsOpacityEffect opEff; + + void animate(int to); + private slots: + void on_pbCreateNew_clicked(); void on_pbSave_clicked(); void on_pbDelete_clicked(); void on_pbAddToSteam_clicked(); void on_pbSearchPath_clicked(); void on_pbUWP_clicked(); void on_lwInstances_currentRowChanged(int row); + void on_lwInstances_itemSelectionChanged(); }; diff --git a/GloSC/GloSC.ui b/GloSC/GloSC.ui index 22ca55a..90504da 100644 --- a/GloSC/GloSC.ui +++ b/GloSC/GloSC.ui @@ -12,7 +12,7 @@ - 711 + 302 386 @@ -58,14 +58,14 @@ - 10 + 150 330 - 261 + 121 31 - Add to Steam + Add all to Steam false @@ -77,8 +77,21 @@ false + + + + 10 + 330 + 131 + 31 + + + + Create New + + - + 309 @@ -193,8 +206,11 @@ 31 + + font: 87 8pt "Arial Black"; + - Save / Create + Save @@ -266,6 +282,9 @@ Enforces bindings reliably by hooking into Steam + groupBox + configBox + verticalGroupBox