2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-03 09:40:18 +00:00

GloSC -Main: UI improvements

This commit is contained in:
Peter Repukat 2017-02-05 04:02:14 +01:00
parent 88fbd8c53c
commit 6281dd4429
3 changed files with 118 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -28,6 +28,10 @@ limitations under the License.
#include <Windows.h>
#include <appmodel.h>
#include <QTimer>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#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();
};

View File

@ -12,7 +12,7 @@
</property>
<property name="minimumSize">
<size>
<width>711</width>
<width>302</width>
<height>386</height>
</size>
</property>
@ -58,14 +58,14 @@
</property>
<property name="geometry">
<rect>
<x>10</x>
<x>150</x>
<y>330</y>
<width>261</width>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Add to Steam</string>
<string>Add all to Steam</string>
</property>
<property name="autoDefault">
<bool>false</bool>
@ -77,8 +77,21 @@
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="pbCreateNew">
<property name="geometry">
<rect>
<x>10</x>
<y>330</y>
<width>131</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Create New</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<widget class="QGroupBox" name="configBox">
<property name="geometry">
<rect>
<x>309</x>
@ -193,8 +206,11 @@
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">font: 87 8pt &quot;Arial Black&quot;;</string>
</property>
<property name="text">
<string>Save / Create</string>
<string>Save</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
@ -266,6 +282,9 @@ Enforces bindings reliably by hooking into Steam
</property>
</widget>
</widget>
<zorder>groupBox</zorder>
<zorder>configBox</zorder>
<zorder>verticalGroupBox</zorder>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>