1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-18 11:51:44 +02:00

Reset config widget data on Cancel

This commit is contained in:
Dominik Schmidt
2014-12-10 22:46:15 +01:00
parent fffe3cbf1f
commit 7d114ea0f3
2 changed files with 14 additions and 0 deletions

View File

@@ -136,6 +136,7 @@ DelegateConfigWrapper::closed( QAbstractButton* b )
} }
else else
{ {
m_widget->fillDataInWidgets( m_initialData );
closeDialog( QDialog::Rejected ); closeDialog( QDialog::Rejected );
} }
} }
@@ -157,6 +158,15 @@ DelegateConfigWrapper::updateSizeHint()
} }
void DelegateConfigWrapper::showEvent(QShowEvent* event)
{
// TODO: would be cool to load the data only on show event instead of on widget creation
m_initialData = m_widget->readData();
QDialog::showEvent(event);
}
void void
DelegateConfigWrapper::aboutClicked( bool ) DelegateConfigWrapper::aboutClicked( bool )
{ {

View File

@@ -55,6 +55,9 @@ public slots:
signals: signals:
void closedWithDelete(); void closedWithDelete();
protected:
void showEvent( QShowEvent * event ) override;
private slots: private slots:
void aboutClicked( bool ); void aboutClicked( bool );
void onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType ); void onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType );
@@ -70,6 +73,7 @@ private:
QLabel* m_errorLabel; QLabel* m_errorLabel;
bool m_deleted; bool m_deleted;
QVariantMap m_invalidData; QVariantMap m_invalidData;
QVariantMap m_initialData;
}; };
#endif #endif