(trunk qt) #2050 "properties dialog changes seem to undo themselves" -- applied 2nd patch from Longinus00

This commit is contained in:
Charles Kerr 2010-05-06 04:49:10 +00:00
parent 5d272161ed
commit fa17bef096
3 changed files with 22 additions and 3 deletions

View File

@ -86,7 +86,7 @@ namespace
TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& model, bool minimized ):
myLastFullUpdateTime( 0 ),
mySessionDialog( new SessionDialog( session, prefs, this ) ),
myPrefsDialog( new PrefsDialog( session, prefs, this ) ),
myPrefsDialog( 0 ),
myAboutDialog( new AboutDialog( this ) ),
myStatsDialog( new StatsDialog( session, this ) ),
myDetailsDialog( 0 ),
@ -159,7 +159,7 @@ TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode
connect( ui.action_AddFile, SIGNAL(triggered()), this, SLOT(openTorrent()));
connect( ui.action_AddURL, SIGNAL(triggered()), this, SLOT(openURL()));
connect( ui.action_New, SIGNAL(triggered()), this, SLOT(newTorrent()));
connect( ui.action_Preferences, SIGNAL(triggered()), myPrefsDialog, SLOT(show()));
connect( ui.action_Preferences, SIGNAL(triggered()), this, SLOT(openPreferences()));
connect( ui.action_Statistics, SIGNAL(triggered()), myStatsDialog, SLOT(show()));
connect( ui.action_About, SIGNAL(triggered()), myAboutDialog, SLOT(show()));
connect( ui.action_Contents, SIGNAL(triggered()), this, SLOT(openHelp()));
@ -629,6 +629,23 @@ TrMainWindow :: setSortAscendingPref( bool b )
*****
****/
void
TrMainWindow :: onPrefsDestroyed( )
{
myPrefsDialog = 0;
}
void
TrMainWindow :: openPreferences( )
{
if( myPrefsDialog == 0 ) {
myPrefsDialog = new PrefsDialog( mySession, myPrefs, this );
connect( myPrefsDialog, SIGNAL(destroyed(QObject*)), this, SLOT(onPrefsDestroyed()));
}
myPrefsDialog->show( );
}
void
TrMainWindow :: onDetailsDestroyed( )
{

View File

@ -95,6 +95,8 @@ class TrMainWindow: public QMainWindow
void openURL( QString );
private slots:
void onPrefsDestroyed( );
void openPreferences( );
void onDetailsDestroyed( );
void onShowModeClicked( );
void showAll( );

View File

@ -620,7 +620,7 @@ PrefsDialog :: PrefsDialog( Session& session, Prefs& prefs, QWidget * parent ):
myLayout->addWidget( t );
QDialogButtonBox * buttons = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
connect( buttons, SIGNAL(rejected()), this, SLOT(hide()) ); // "close" triggers rejected
connect( buttons, SIGNAL(rejected()), this, SLOT(deleteLater()) ); // "close" triggers rejected
myLayout->addWidget( buttons );
connect( &mySession, SIGNAL(sessionUpdated()), this, SLOT(sessionUpdated()));