- Upgraded to libtorrent svn (0.13)

This commit is contained in:
Christophe Dumez 2007-04-12 17:17:04 +00:00
commit 658771612a
9 changed files with 44 additions and 198 deletions

View file

@ -55,23 +55,28 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
}
unsigned int nbTorrents = handles.size();
if(!nbTorrents) close();
// TODO: Uncomment the following lines as soon as we upgrade
// to libtorrent svn to correctly initialize the bandwidth slider.
// if(nbTorrents == 1){
// if(uploadMode) {
// int val = h.upload_limit();
// if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
// val = -1;
// bandwidthSlider->setValue(val);
// } else {
// int val = h.download_limit();
// if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
// val = -1;
// bandwidthSlider->setValue(val);
// }
// }else{
// bandwidthSlider->setValue(-1);
// }
int val;
if(nbTorrents == 1){
torrent_handle h = handles[0];
if(uploadMode)
val = h.upload_limit();
else
val = h.download_limit();
if(val > bandwidthSlider->maximum() || val < bandwidthSlider->minimum())
val = -1;
bandwidthSlider->setValue(val);
if(val == -1) {
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
kb_lbl->setText("");
} else {
limit_lbl->setText(QString(misc::toString(val).c_str()));
}
}else{
qDebug("More than one torrent selected, no initilization");
bandwidthSlider->setValue(-1);
limit_lbl->setText(tr("Unlimited", "Unlimited (bandwidth)"));
kb_lbl->setText("");
}
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
show();
}
@ -95,11 +100,15 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
int val = bandwidthSlider->value();
torrent_handle h;
if(uploadMode) {
foreach(h, handles)
foreach(h, handles) {
h.set_upload_limit(val);
qDebug("Setting upload limit");
}
} else {
foreach(h, handles)
foreach(h, handles) {
h.set_download_limit(val);
qDebug("Setting download limit");
}
}
close();
}

View file

@ -182,11 +182,11 @@ void createtorrent::on_createButton_clicked(){
// calculate the hash for all pieces
file_pool fp;
storage st(t, full_path.branch_path(), fp);
boost::scoped_ptr<storage_interface> st(default_storage_constructor(t, full_path.branch_path(), fp));
int num = t.num_pieces();
std::vector<char> buf(piece_size);
for (int i = 0; i < num; ++i) {
st.read(&buf[0], i, 0, t.piece_size(i));
st->read(&buf[0], i, 0, t.piece_size(i));
hasher h(&buf[0], t.piece_size(i));
t.set_hash(i, h.final());
}

View file

@ -16,6 +16,9 @@ DEFINES += VERSION_MAJOR=0
DEFINES += VERSION_MINOR=10
DEFINES += VERSION_BUGFIX=0
# Temporary hack
DEFINES += NO_UPNP
contains(DEBUG_MODE, 1){
CONFIG += debug
message(Debug build!)