Ticket #2050: qt_refresh2.patch

File qt_refresh2.patch, 2.8 KB (added by Longinus00, 12 years ago)
  • qt/mainwin.cc

    diff --git qt/mainwin.cc qt/mainwin.cc
    index 2f333a7..6703c7a 100644
    namespace 
    8686TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& model, bool minimized ):
    8787    myLastFullUpdateTime( 0 ),
    8888    mySessionDialog( new SessionDialog( session, prefs, this ) ),
    89     myPrefsDialog( new PrefsDialog( session, prefs, this ) ),
     89    myPrefsDialog( 0 ),
    9090    myAboutDialog( new AboutDialog( this ) ),
    9191    myStatsDialog( new StatsDialog( session, this ) ),
    9292    myDetailsDialog( 0 ),
    TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode 
    159159    connect( ui.action_AddFile, SIGNAL(triggered()), this, SLOT(openTorrent()));
    160160    connect( ui.action_AddURL, SIGNAL(triggered()), this, SLOT(openURL()));
    161161    connect( ui.action_New, SIGNAL(triggered()), this, SLOT(newTorrent()));
    162     connect( ui.action_Preferences, SIGNAL(triggered()), myPrefsDialog, SLOT(show()));
     162    connect( ui.action_Preferences, SIGNAL(triggered()), this, SLOT(openPreferences()));
    163163    connect( ui.action_Statistics, SIGNAL(triggered()), myStatsDialog, SLOT(show()));
    164164    connect( ui.action_About, SIGNAL(triggered()), myAboutDialog, SLOT(show()));
    165165    connect( ui.action_Contents, SIGNAL(triggered()), this, SLOT(openHelp()));
    TrMainWindow :: setSortAscendingPref( bool b ) 
    630630****/
    631631
    632632void
     633TrMainWindow :: onPrefsDestroyed( )
     634{
     635    myPrefsDialog = 0;
     636}
     637
     638void
     639TrMainWindow :: openPreferences( )
     640{
     641    if( myPrefsDialog == 0 ) {
     642        myPrefsDialog = new PrefsDialog( mySession, myPrefs, this );
     643        connect( myPrefsDialog, SIGNAL(destroyed(QObject*)), this, SLOT(onPrefsDestroyed()));
     644    }
     645
     646    myPrefsDialog->show( );
     647}
     648
     649void
    633650TrMainWindow :: onDetailsDestroyed( )
    634651{
    635652    myDetailsDialog = 0;
  • qt/mainwin.h

    diff --git qt/mainwin.h qt/mainwin.h
    index 537145a..e18f668 100644
    class TrMainWindow: public QMainWindow 
    9595        void openURL( QString );
    9696
    9797    private slots:
     98        void onPrefsDestroyed( );
     99        void openPreferences( );
    98100        void onDetailsDestroyed( );
    99101        void onShowModeClicked( );
    100102        void showAll( );
  • qt/prefs-dialog.cc

    diff --git qt/prefs-dialog.cc qt/prefs-dialog.cc
    index 68adf26..e4ba365 100644
    PrefsDialog :: PrefsDialog( Session& session, Prefs& prefs, QWidget * parent ): 
    620620    myLayout->addWidget( t );
    621621
    622622    QDialogButtonBox * buttons = new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this );
    623     connect( buttons, SIGNAL(rejected()), this, SLOT(hide()) ); // "close" triggers rejected
     623    connect( buttons, SIGNAL(rejected()), this, SLOT(deleteLater()) ); // "close" triggers rejected
    624624    myLayout->addWidget( buttons );
    625625
    626626    connect( &mySession, SIGNAL(sessionUpdated()), this, SLOT(sessionUpdated()));