GloSC -Main: UI improvements

UWP_Overlay
Peter Repukat 8 years ago
parent 88fbd8c53c
commit 6281dd4429

@ -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() void GloSC::on_pbSave_clicked()
{ {
QString name = ui.leName->text(); QString name = ui.leName->text();
@ -161,6 +209,7 @@ void GloSC::on_pbSave_clicked()
updateEntryList(); updateEntryList();
animate(small_x);
} }
@ -182,11 +231,12 @@ void GloSC::on_pbDelete_clicked()
dir.removeRecursively(); dir.removeRecursively();
} }
updateEntryList(); updateEntryList();
animate(small_x);
} }
void GloSC::on_pbAddToSteam_clicked() void GloSC::on_pbAddToSteam_clicked()
{ {
if (ui.lwInstances->count() <= 0) if (ui.lwInstances->count() <= 0)
{ {
QMessageBox::information(this, "GloSC", "No shortcuts! Create some shortcuts first for them to be added to Steam!", QMessageBox::Ok); 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(); shortcutsFile.close();
QMessageBox::information(this, "GloSC", "Shortcuts were added! Restart Steam for changes to take effect!", QMessageBox::Ok); QMessageBox::information(this, "GloSC", "Shortcuts were added! Restart Steam for changes to take effect!", QMessageBox::Ok);
animate(small_x);
} }
void GloSC::on_pbSearchPath_clicked() void GloSC::on_pbSearchPath_clicked()
@ -451,5 +502,29 @@ void GloSC::on_lwInstances_currentRowChanged(int row)
settings.endGroup(); 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);
}
} }

@ -28,6 +28,10 @@ limitations under the License.
#include <Windows.h> #include <Windows.h>
#include <appmodel.h> #include <appmodel.h>
#include <QTimer>
#include <QPropertyAnimation>
#include <QGraphicsOpacityEffect>
#include "UWPPair.h" #include "UWPPair.h"
#include "UWPSelectDialog.h" #include "UWPSelectDialog.h"
@ -51,13 +55,25 @@ private:
const unsigned int GLOSC_VERSION = 0x00000113; 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: private slots:
void on_pbCreateNew_clicked();
void on_pbSave_clicked(); void on_pbSave_clicked();
void on_pbDelete_clicked(); void on_pbDelete_clicked();
void on_pbAddToSteam_clicked(); void on_pbAddToSteam_clicked();
void on_pbSearchPath_clicked(); void on_pbSearchPath_clicked();
void on_pbUWP_clicked(); void on_pbUWP_clicked();
void on_lwInstances_currentRowChanged(int row); void on_lwInstances_currentRowChanged(int row);
void on_lwInstances_itemSelectionChanged();
}; };

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

Loading…
Cancel
Save