- Added session-level upload/download-rate limit preferences
[qtrapids] / src / gui / MainWindow.cpp
index 273aadc..6ab93c6 100644 (file)
@@ -119,6 +119,7 @@ MainWindow::MainWindow():
                this, SLOT(on_alert(std::auto_ptr<Alert>)));
 
        LoadPlugins();
+       RestoreSettings();
 }
 
 
@@ -268,6 +269,12 @@ void MainWindow::LoadPlugins()
 }
 
 
+void MainWindow::RestoreSettings()
+{
+       btSession_.setUploadRateLimit(settings_.value("network/uploadRate").toInt());
+       btSession_.setUploadRateLimit(settings_.value("network/downloadRate").toInt());
+}
+
 
 // Opens torrent information from buffer data and adds torrent to session 
 void MainWindow::StartTorrentFromBufferData(char const* data, int size)
@@ -314,8 +321,9 @@ void MainWindow::on_quitAction_clicked()
 void MainWindow::on_preferencesAction_clicked()
 {
        if (!preferencesDialog_) {
-               preferencesDialog_ = new PreferencesDialog(this);
+               preferencesDialog_ = new PreferencesDialog(this, NULL, &btSession_);
        }
+
        preferencesDialog_->show();
        preferencesDialog_->raise();
        preferencesDialog_->activateWindow();