Changeset 8323 for trunk/qt/mainwin.cc


Ignore:
Timestamp:
May 3, 2009, 5:37:39 PM (13 years ago)
Author:
charles
Message:

(trunk qt) Remember between runs whether we were running a local or remote session. Add a gui dialog for switching sessions during runtime.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/mainwin.cc

    r8322 r8323  
    3737#include "prefs-dialog.h"
    3838#include "session.h"
     39#include "session-dialog.h"
    3940#include "speed.h"
    4041#include "stats-dialog.h"
     
    100101
    101102    ui.setupUi( this );
    102 
    103     QString title( "Transmission" );
    104     const QUrl remoteUrl( session.getRemoteUrl( ) );
    105     if( !remoteUrl.isEmpty( ) )
    106         title += tr( " - %1" ).arg( remoteUrl.toString(QUrl::RemoveUserInfo) );
    107     setWindowTitle( title );
    108103
    109104    QStyle * style = this->style();
     
    163158    connect( ui.action_OpenFolder, SIGNAL(triggered()), this, SLOT(openFolder()));
    164159    connect( ui.action_Properties, SIGNAL(triggered()), this, SLOT(openProperties()));
     160    connect( ui.action_SessionDialog, SIGNAL(triggered()), this, SLOT(openSessionDialog()));
    165161    connect( ui.listView, SIGNAL(activated(const QModelIndex&)), ui.action_Properties, SLOT(trigger()));
    166162
     
    253249        refreshPref( key );
    254250
     251    connect( &mySession, SIGNAL(sourceChanged()), this, SLOT(onSessionSourceChanged()) );
    255252    connect( &mySession, SIGNAL(statsUpdated()), this, SLOT(refreshStatusBar()) );
    256253    connect( &mySession, SIGNAL(dataReadProgress()), this, SLOT(dataReadProgress()) );
     
    266263    refreshActionSensitivity( );
    267264    refreshStatusBar( );
     265    refreshTitle( );
    268266    refreshVisibleCount( );
    269267}
     
    271269TrMainWindow :: ~TrMainWindow( )
    272270{
     271}
     272
     273/****
     274*****
     275****/
     276
     277void
     278TrMainWindow :: onSessionSourceChanged( )
     279{
     280    myModel.clear( );
     281    refreshTitle( );
     282    refreshVisibleCount( );
     283    refreshActionSensitivity( );
     284    refreshStatusBar( );
    273285}
    274286
     
    578590
    579591void
     592TrMainWindow :: openSessionDialog( )
     593{
     594    SessionDialog * d = new SessionDialog( mySession, myPrefs, this );
     595    d->show( );
     596}
     597
     598void
    580599TrMainWindow :: openFolder( )
    581600{
     
    595614    snprintf( url, sizeof( url ), fmt, major, minor/10 );
    596615    QDesktopServices :: openUrl( QUrl( QString( url ) ) );
     616}
     617
     618void
     619TrMainWindow :: refreshTitle( )
     620{
     621    QString title( "Transmission" );
     622    const QUrl url( mySession.getRemoteUrl( ) );
     623    if( !url.isEmpty() )
     624        title += tr( " - %1" ).arg( url.toString(QUrl::RemoveUserInfo) );
     625    setWindowTitle( title );
    597626}
    598627
     
    724753TrMainWindow :: startSelected( )
    725754{
    726     mySession.start( getSelectedTorrents( ) );
     755    mySession.startTorrents( getSelectedTorrents( ) );
    727756}
    728757void
    729758TrMainWindow :: pauseSelected( )
    730759{
    731     mySession.pause( getSelectedTorrents( ) );
     760    mySession.pauseTorrents( getSelectedTorrents( ) );
    732761}
    733762void
    734763TrMainWindow :: startAll( )
    735764{
    736     mySession.start( );
     765    mySession.startTorrents( );
    737766}
    738767void
    739768TrMainWindow :: pauseAll( )
    740769{
    741     mySession.pause( );
     770    mySession.pauseTorrents( );
    742771}
    743772void
Note: See TracChangeset for help on using the changeset viewer.