Changeset 8323 for trunk/qt/app.cc
- Timestamp:
- May 3, 2009, 5:37:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt/app.cc
r8233 r8323 28 28 #include "options.h" 29 29 #include "prefs.h" 30 #include "session.h" 31 #include "session-dialog.h" 30 32 #include "torrent-model.h" 31 #include "session.h"32 33 #include "utils.h" 33 34 #include "watchdir.h" … … 41 42 { 'g', "config-dir", "Where to look for configuration files", "g", 1, "<path>" }, 42 43 { 'm', "minimized", "Start minimized in system tray", "m", 0, NULL }, 43 { 'p', "paused", "Pause all torrents on sartup", "p", 0, NULL },44 { 'r', "remote", "Remotely control a pre-existing session", "r", 1, "<URL>" },45 44 { 'v', "version", "Show version number and exit", "v", 0, NULL }, 46 45 { 0, NULL, NULL, NULL, 0, NULL } … … 97 96 // parse the command-line arguments 98 97 int c; 99 bool paused = false;100 98 bool minimized = false; 101 99 const char * optarg; 102 100 const char * configDir = 0; 103 const char * url = 0;104 101 while( ( c = tr_getopt( getUsage( ), argc, (const char**)argv, opts, &optarg ) ) ) { 105 102 switch( c ) { 106 103 case 'g': configDir = optarg; break; 107 104 case 'm': minimized = true; break; 108 case 'p': paused = true; break;109 case 'r': url = optarg; break;110 105 case 'v': Utils::toStderr( QObject::tr( "transmission %1" ).arg( LONG_VERSION_STRING ) ); exit( 0 ); break; 111 106 case TR_OPT_ERR: Utils::toStderr( QObject::tr( "Invalid option" ) ); showUsage( ); break; … … 118 113 configDir = tr_getDefaultConfigDir( MY_NAME ); 119 114 115 // is this the first time we've run transmission? 116 const bool firstTime = !QFile(QDir(configDir).absoluteFilePath("settings.json")).exists(); 117 120 118 myPrefs = new Prefs ( configDir ); 121 mySession = new Session( configDir, *myPrefs , url, paused);119 mySession = new Session( configDir, *myPrefs ); 122 120 myModel = new TorrentModel( *myPrefs ); 123 121 myWindow = new TrMainWindow( *mySession, *myPrefs, *myModel, minimized ); 124 122 myWatchDir = new WatchDir( *myModel ); 125 123 126 / * when the session gets torrent info, update the model */124 // when the session gets torrent info, update the model 127 125 connect( mySession, SIGNAL(torrentsUpdated(tr_benc*,bool)), myModel, SLOT(updateTorrents(tr_benc*,bool)) ); 128 126 connect( mySession, SIGNAL(torrentsUpdated(tr_benc*,bool)), myWindow, SLOT(refreshActionSensitivity()) ); 129 127 connect( mySession, SIGNAL(torrentsRemoved(tr_benc*)), myModel, SLOT(removeTorrents(tr_benc*)) ); 130 / * when the model sees a torrent for the first time, ask the session for full info on it */128 // when the model sees a torrent for the first time, ask the session for full info on it 131 129 connect( myModel, SIGNAL(torrentsAdded(QSet<int>)), mySession, SLOT(initTorrents(QSet<int>)) ); 132 130 … … 134 132 mySession->refreshSessionStats( ); 135 133 136 / * when torrents are added to the watch directory, tell the session */134 // when torrents are added to the watch directory, tell the session 137 135 connect( myWatchDir, SIGNAL(torrentFileAdded(QString)), this, SLOT(addTorrent(QString)) ); 138 136 139 / * init from preferences */137 // init from preferences 140 138 QList<int> initKeys; 141 139 initKeys << Prefs::DIR_WATCH; … … 163 161 164 162 maybeUpdateBlocklist( ); 163 164 if( !firstTime ) 165 mySession->restart( ); 166 else { 167 QDialog * d = new SessionDialog( *mySession, *myPrefs, myWindow ); 168 d->show( ); 169 } 165 170 } 166 171
Note: See TracChangeset
for help on using the changeset viewer.