mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Follow project coding style. Issue #2192.
This commit is contained in:
parent
d45aff9169
commit
38455af791
2 changed files with 559 additions and 549 deletions
|
@ -51,15 +51,15 @@
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) :
|
AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent)
|
||||||
QDialog(parent),
|
: QDialog(parent)
|
||||||
ui(new Ui::AddNewTorrentDialog),
|
, ui(new Ui::AddNewTorrentDialog)
|
||||||
m_contentModel(0),
|
, m_contentModel(0)
|
||||||
m_contentDelegate(0),
|
, m_contentDelegate(0)
|
||||||
m_isMagnet(false),
|
, m_isMagnet(false)
|
||||||
m_hasMetadata(false),
|
, m_hasMetadata(false)
|
||||||
m_hasRenamedFile(false),
|
, m_hasRenamedFile(false)
|
||||||
m_oldIndex(0)
|
, m_oldIndex(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
@ -77,9 +77,8 @@ AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) :
|
||||||
// Load labels
|
// Load labels
|
||||||
const QStringList customLabels = pref->getTorrentLabels();
|
const QStringList customLabels = pref->getTorrentLabels();
|
||||||
ui->label_combo->addItem("");
|
ui->label_combo->addItem("");
|
||||||
foreach (const QString& label, customLabels) {
|
foreach (const QString& label, customLabels)
|
||||||
ui->label_combo->addItem(label);
|
ui->label_combo->addItem(label);
|
||||||
}
|
|
||||||
ui->label_combo->model()->sort(0);
|
ui->label_combo->model()->sort(0);
|
||||||
ui->content_tree->header()->setSortIndicator(0, Qt::AscendingOrder);
|
ui->content_tree->header()->setSortIndicator(0, Qt::AscendingOrder);
|
||||||
loadState();
|
loadState();
|
||||||
|
@ -140,7 +139,8 @@ void AddNewTorrentDialog::showMagnet(const QString& link, QWidget *parent)
|
||||||
delete dlg;
|
delete dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::showEvent(QShowEvent *event) {
|
void AddNewTorrentDialog::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
Preferences* const pref = Preferences::instance();
|
Preferences* const pref = Preferences::instance();
|
||||||
if (!pref->additionDialogFront())
|
if (!pref->additionDialogFront())
|
||||||
|
@ -159,16 +159,18 @@ void AddNewTorrentDialog::showAdvancedSettings(bool show)
|
||||||
if (m_hasMetadata && (m_torrentInfo->num_files() > 1)) {
|
if (m_hasMetadata && (m_torrentInfo->num_files() > 1)) {
|
||||||
ui->content_tree->setVisible(true);
|
ui->content_tree->setVisible(true);
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->content_tree->setVisible(false);
|
ui->content_tree->setVisible(false);
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
}
|
}
|
||||||
static_cast<QVBoxLayout*>(layout())->insertWidget(layout()->indexOf(ui->never_show_cb)+1, ui->adv_button);
|
static_cast<QVBoxLayout*>(layout())->insertWidget(layout()->indexOf(ui->never_show_cb) + 1, ui->adv_button);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ui->adv_button->setText(QString::fromUtf8("▼"));
|
ui->adv_button->setText(QString::fromUtf8("▼"));
|
||||||
ui->settings_group->setVisible(false);
|
ui->settings_group->setVisible(false);
|
||||||
ui->info_group->setVisible(false);
|
ui->info_group->setVisible(false);
|
||||||
ui->buttonsHLayout->insertWidget(0, layout()->takeAt(layout()->indexOf(ui->never_show_cb)+1)->widget());
|
ui->buttonsHLayout->insertWidget(0, layout()->takeAt(layout()->indexOf(ui->never_show_cb) + 1)->widget());
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
}
|
}
|
||||||
relayout();
|
relayout();
|
||||||
|
@ -216,7 +218,7 @@ bool AddNewTorrentDialog::loadTorrent(const QString& torrent_path, const QString
|
||||||
|
|
||||||
bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
|
bool AddNewTorrentDialog::loadMagnet(const QString &magnet_uri)
|
||||||
{
|
{
|
||||||
connect(QBtSession::instance(), SIGNAL(metadataReceivedHidden(const QTorrentHandle&)), SLOT(updateMetadata(const QTorrentHandle&)));
|
connect(QBtSession::instance(), SIGNAL(metadataReceivedHidden(const QTorrentHandle &)), SLOT(updateMetadata(const QTorrentHandle &)));
|
||||||
m_isMagnet = true;
|
m_isMagnet = true;
|
||||||
m_url = magnet_uri;
|
m_url = magnet_uri;
|
||||||
m_hash = misc::magnetUriToHash(m_url);
|
m_hash = misc::magnetUriToHash(m_url);
|
||||||
|
@ -273,22 +275,22 @@ void AddNewTorrentDialog::saveSavePathHistory() const
|
||||||
int AddNewTorrentDialog::indexOfSavePath(const QString &save_path)
|
int AddNewTorrentDialog::indexOfSavePath(const QString &save_path)
|
||||||
{
|
{
|
||||||
QDir saveDir(save_path);
|
QDir saveDir(save_path);
|
||||||
for(int i=0; i<ui->save_path_combo->count()-1; ++i) {
|
for(int i = 0; i<ui->save_path_combo->count() - 1; ++i)
|
||||||
if (QDir(ui->save_path_combo->itemData(i).toString()) == saveDir)
|
if (QDir(ui->save_path_combo->itemData(i).toString()) == saveDir)
|
||||||
return i;
|
return i;
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::updateFileNameInSavePaths(const QString &new_filename)
|
void AddNewTorrentDialog::updateFileNameInSavePaths(const QString &new_filename)
|
||||||
{
|
{
|
||||||
for(int i=0; i<ui->save_path_combo->count()-1; ++i) {
|
for(int i = 0; i<ui->save_path_combo->count() - 1; ++i) {
|
||||||
const QDir folder(ui->save_path_combo->itemData(i).toString());
|
const QDir folder(ui->save_path_combo->itemData(i).toString());
|
||||||
ui->save_path_combo->setItemText(i, fsutils::toNativePath(folder.absoluteFilePath(new_filename)));
|
ui->save_path_combo->setItemText(i, fsutils::toNativePath(folder.absoluteFilePath(new_filename)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::updateDiskSpaceLabel() {
|
void AddNewTorrentDialog::updateDiskSpaceLabel()
|
||||||
|
{
|
||||||
// Determine torrent size
|
// Determine torrent size
|
||||||
qulonglong torrent_size = 0;
|
qulonglong torrent_size = 0;
|
||||||
|
|
||||||
|
@ -296,11 +298,11 @@ void AddNewTorrentDialog::updateDiskSpaceLabel() {
|
||||||
if (m_contentModel) {
|
if (m_contentModel) {
|
||||||
const std::vector<int> priorities = m_contentModel->model()->getFilesPriorities();
|
const std::vector<int> priorities = m_contentModel->model()->getFilesPriorities();
|
||||||
Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files());
|
Q_ASSERT(priorities.size() == (uint) m_torrentInfo->num_files());
|
||||||
for (uint i=0; i<priorities.size(); ++i) {
|
for (uint i = 0; i<priorities.size(); ++i)
|
||||||
if (priorities[i] > 0)
|
if (priorities[i] > 0)
|
||||||
torrent_size += m_torrentInfo->files().file_size(i);
|
torrent_size += m_torrentInfo->files().file_size(i);
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
torrent_size = m_torrentInfo->total_size();
|
torrent_size = m_torrentInfo->total_size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +341,8 @@ void AddNewTorrentDialog::browseButton_clicked()
|
||||||
new_path = fsutils::branchPath(new_path, &new_filename);
|
new_path = fsutils::branchPath(new_path, &new_filename);
|
||||||
qDebug() << "new_path: " << new_path;
|
qDebug() << "new_path: " << new_path;
|
||||||
qDebug() << "new_filename: " << new_filename;
|
qDebug() << "new_filename: " << new_filename;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (!cur_save_path.isEmpty() && QDir(cur_save_path).exists())
|
if (!cur_save_path.isEmpty() && QDir(cur_save_path).exists())
|
||||||
new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), cur_save_path);
|
new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), cur_save_path);
|
||||||
else
|
else
|
||||||
|
@ -347,8 +350,9 @@ void AddNewTorrentDialog::browseButton_clicked()
|
||||||
}
|
}
|
||||||
if (!new_path.isEmpty()) {
|
if (!new_path.isEmpty()) {
|
||||||
const int existing_index = indexOfSavePath(new_path);
|
const int existing_index = indexOfSavePath(new_path);
|
||||||
if (existing_index >= 0)
|
if (existing_index >= 0) {
|
||||||
ui->save_path_combo->setCurrentIndex(existing_index);
|
ui->save_path_combo->setCurrentIndex(existing_index);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
// New path, prepend to combo box
|
// New path, prepend to combo box
|
||||||
if (!new_filename.isEmpty())
|
if (!new_filename.isEmpty())
|
||||||
|
@ -365,7 +369,8 @@ void AddNewTorrentDialog::browseButton_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
onSavePathChanged(0);
|
onSavePathChanged(0);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Restore index
|
// Restore index
|
||||||
ui->save_path_combo->setCurrentIndex(m_oldIndex);
|
ui->save_path_combo->setCurrentIndex(m_oldIndex);
|
||||||
}
|
}
|
||||||
|
@ -419,7 +424,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
new_name = fsutils::expandPath(new_name);
|
new_name = fsutils::expandPath(new_name);
|
||||||
qDebug("New name: %s", qPrintable(new_name));
|
qDebug("New name: %s", qPrintable(new_name));
|
||||||
// Check if that name is already used
|
// Check if that name is already used
|
||||||
for (int i=0; i<m_torrentInfo->num_files(); ++i) {
|
for (int i = 0; i<m_torrentInfo->num_files(); ++i) {
|
||||||
if (i == file_index) continue;
|
if (i == file_index) continue;
|
||||||
if (fsutils::sameFileNames(m_filesPath.at(i), new_name)) {
|
if (fsutils::sameFileNames(m_filesPath.at(i), new_name)) {
|
||||||
// Display error message
|
// Display error message
|
||||||
|
@ -435,7 +440,8 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
m_hasRenamedFile = true;
|
m_hasRenamedFile = true;
|
||||||
// Rename in torrent files model too
|
// Rename in torrent files model too
|
||||||
m_contentModel->setData(index, new_name_last);
|
m_contentModel->setData(index, new_name_last);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Folder renaming
|
// Folder renaming
|
||||||
QStringList path_items;
|
QStringList path_items;
|
||||||
path_items << index.data().toString();
|
path_items << index.data().toString();
|
||||||
|
@ -450,7 +456,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
QString new_path = path_items.join("/");
|
QString new_path = path_items.join("/");
|
||||||
if (!new_path.endsWith("/")) new_path += "/";
|
if (!new_path.endsWith("/")) new_path += "/";
|
||||||
// Check for overwriting
|
// Check for overwriting
|
||||||
for (int i=0; i<m_torrentInfo->num_files(); ++i) {
|
for (int i = 0; i<m_torrentInfo->num_files(); ++i) {
|
||||||
const QString ¤t_name = m_filesPath.at(i);
|
const QString ¤t_name = m_filesPath.at(i);
|
||||||
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
|
#if defined(Q_OS_UNIX) || defined(Q_WS_QWS)
|
||||||
if (current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
if (current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||||
|
@ -464,7 +470,7 @@ void AddNewTorrentDialog::renameSelectedFile()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Replace path in all files
|
// Replace path in all files
|
||||||
for (int i=0; i<m_torrentInfo->num_files(); ++i) {
|
for (int i = 0; i<m_torrentInfo->num_files(); ++i) {
|
||||||
const QString ¤t_name = m_filesPath.at(i);
|
const QString ¤t_name = m_filesPath.at(i);
|
||||||
if (current_name.startsWith(old_path)) {
|
if (current_name.startsWith(old_path)) {
|
||||||
QString new_name = current_name;
|
QString new_name = current_name;
|
||||||
|
@ -490,7 +496,8 @@ void AddNewTorrentDialog::setdialogPosition()
|
||||||
int y = Preferences::instance()->getAddNewTorrentDialogPos();
|
int y = Preferences::instance()->getAddNewTorrentDialogPos();
|
||||||
if (y >= 0) {
|
if (y >= 0) {
|
||||||
center.setY(y);
|
center.setY(y);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
center.ry() -= 120;
|
center.ry() -= 120;
|
||||||
if (center.y() < 0)
|
if (center.y() < 0)
|
||||||
center.setY(0);
|
center.setY(0);
|
||||||
|
@ -503,13 +510,13 @@ void AddNewTorrentDialog::loadSavePathHistory()
|
||||||
QDir default_save_path(Preferences::instance()->getSavePath());
|
QDir default_save_path(Preferences::instance()->getSavePath());
|
||||||
// Load save path history
|
// Load save path history
|
||||||
QStringList raw_path_history = Preferences::instance()->getAddNewTorrentDialogPathHistory();
|
QStringList raw_path_history = Preferences::instance()->getAddNewTorrentDialogPathHistory();
|
||||||
foreach (const QString &sp, raw_path_history) {
|
foreach (const QString &sp, raw_path_history)
|
||||||
if (QDir(sp) != default_save_path)
|
if (QDir(sp) != default_save_path)
|
||||||
ui->save_path_combo->addItem(fsutils::toNativePath(sp), sp);
|
ui->save_path_combo->addItem(fsutils::toNativePath(sp), sp);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::displayContentTreeMenu(const QPoint&) {
|
void AddNewTorrentDialog::displayContentTreeMenu(const QPoint&)
|
||||||
|
{
|
||||||
QMenu myFilesLlistMenu;
|
QMenu myFilesLlistMenu;
|
||||||
const QModelIndexList selectedRows = ui->content_tree->selectionModel()->selectedRows(0);
|
const QModelIndexList selectedRows = ui->content_tree->selectionModel()->selectedRows(0);
|
||||||
QAction *actRename = 0;
|
QAction *actRename = 0;
|
||||||
|
@ -529,18 +536,19 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint&) {
|
||||||
if (act) {
|
if (act) {
|
||||||
if (act == actRename) {
|
if (act == actRename) {
|
||||||
renameSelectedFile();
|
renameSelectedFile();
|
||||||
} else {
|
}
|
||||||
int prio = prio::NORMAL;
|
|
||||||
if (act == ui->actionHigh)
|
|
||||||
prio = prio::HIGH;
|
|
||||||
else {
|
else {
|
||||||
if (act == ui->actionMaximum) {
|
int prio = prio::NORMAL;
|
||||||
|
if (act == ui->actionHigh) {
|
||||||
|
prio = prio::HIGH;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (act == ui->actionMaximum)
|
||||||
prio = prio::MAXIMUM;
|
prio = prio::MAXIMUM;
|
||||||
} else {
|
else
|
||||||
if (act == ui->actionNot_downloaded)
|
if (act == ui->actionNot_downloaded)
|
||||||
prio = prio::IGNORED;
|
prio = prio::IGNORED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
qDebug("Setting files priority");
|
qDebug("Setting files priority");
|
||||||
foreach (const QModelIndex &index, selectedRows) {
|
foreach (const QModelIndex &index, selectedRows) {
|
||||||
qDebug("Setting priority(%d) for file at row %d", prio, index.row());
|
qDebug("Setting priority(%d) for file at row %d", prio, index.row());
|
||||||
|
@ -553,16 +561,15 @@ void AddNewTorrentDialog::displayContentTreeMenu(const QPoint&) {
|
||||||
void AddNewTorrentDialog::accept()
|
void AddNewTorrentDialog::accept()
|
||||||
{
|
{
|
||||||
if (m_isMagnet)
|
if (m_isMagnet)
|
||||||
disconnect(this, SLOT(updateMetadata(const QTorrentHandle&)));
|
disconnect(this, SLOT(updateMetadata(const QTorrentHandle &)));
|
||||||
|
|
||||||
Preferences* const pref = Preferences::instance();
|
Preferences* const pref = Preferences::instance();
|
||||||
// Save Temporary data about torrent
|
// Save Temporary data about torrent
|
||||||
QString save_path = ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString();
|
QString save_path = ui->save_path_combo->itemData(ui->save_path_combo->currentIndex()).toString();
|
||||||
TorrentTempData::setSavePath(m_hash, save_path);
|
TorrentTempData::setSavePath(m_hash, save_path);
|
||||||
if (ui->skip_check_cb->isChecked()) {
|
if (ui->skip_check_cb->isChecked())
|
||||||
// TODO: Check if destination actually exists
|
// TODO: Check if destination actually exists
|
||||||
TorrentTempData::setSeedingMode(m_hash, true);
|
TorrentTempData::setSeedingMode(m_hash, true);
|
||||||
}
|
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
const QString label = ui->label_combo->currentText();
|
const QString label = ui->label_combo->currentText();
|
||||||
|
@ -595,21 +602,23 @@ void AddNewTorrentDialog::accept()
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::reject() {
|
void AddNewTorrentDialog::reject()
|
||||||
|
{
|
||||||
if (m_isMagnet) {
|
if (m_isMagnet) {
|
||||||
disconnect(this, SLOT(updateMetadata(const QTorrentHandle&)));
|
disconnect(this, SLOT(updateMetadata(const QTorrentHandle &)));
|
||||||
setMetadataProgressIndicator(false);
|
setMetadataProgressIndicator(false);
|
||||||
QBtSession::instance()->deleteTorrent(m_hash, true);
|
QBtSession::instance()->deleteTorrent(m_hash, true);
|
||||||
}
|
}
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::updateMetadata(const QTorrentHandle &h) {
|
void AddNewTorrentDialog::updateMetadata(const QTorrentHandle &h)
|
||||||
|
{
|
||||||
try {
|
try {
|
||||||
if (h.hash() != m_hash)
|
if (h.hash() != m_hash)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnect(this, SLOT(updateMetadata(const QTorrentHandle&)));
|
disconnect(this, SLOT(updateMetadata(const QTorrentHandle &)));
|
||||||
Q_ASSERT(h.has_metadata());
|
Q_ASSERT(h.has_metadata());
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_NUM < 10000
|
#if LIBTORRENT_VERSION_NUM < 10000
|
||||||
|
@ -632,14 +641,16 @@ void AddNewTorrentDialog::updateMetadata(const QTorrentHandle &h) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText) {
|
void AddNewTorrentDialog::setMetadataProgressIndicator(bool visibleIndicator, const QString &labelText)
|
||||||
|
{
|
||||||
// Always show info label when waiting for metadata
|
// Always show info label when waiting for metadata
|
||||||
ui->lblMetaLoading->setVisible(true);
|
ui->lblMetaLoading->setVisible(true);
|
||||||
ui->lblMetaLoading->setText(labelText);
|
ui->lblMetaLoading->setText(labelText);
|
||||||
ui->progMetaLoading->setVisible(visibleIndicator);
|
ui->progMetaLoading->setVisible(visibleIndicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddNewTorrentDialog::setupTreeview() {
|
void AddNewTorrentDialog::setupTreeview()
|
||||||
|
{
|
||||||
if (!m_hasMetadata) {
|
if (!m_hasMetadata) {
|
||||||
ui->comment_lbl->setText(tr("Not Available", "This comment is unavailable"));
|
ui->comment_lbl->setText(tr("Not Available", "This comment is unavailable"));
|
||||||
ui->date_lbl->setText(tr("Not Available", "This date is unavailable"));
|
ui->date_lbl->setText(tr("Not Available", "This date is unavailable"));
|
||||||
|
@ -656,9 +667,8 @@ void AddNewTorrentDialog::setupTreeview() {
|
||||||
file_storage const& fs = m_torrentInfo->files();
|
file_storage const& fs = m_torrentInfo->files();
|
||||||
|
|
||||||
// Populate m_filesList
|
// Populate m_filesList
|
||||||
for (int i = 0; i < fs.num_files(); ++i) {
|
for (int i = 0; i < fs.num_files(); ++i)
|
||||||
m_filesPath << misc::toQStringU(fs.file_path(i));
|
m_filesPath << misc::toQStringU(fs.file_path(i));
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare content tree
|
// Prepare content tree
|
||||||
if (fs.num_files() > 1) {
|
if (fs.num_files() > 1) {
|
||||||
|
@ -668,8 +678,8 @@ void AddNewTorrentDialog::setupTreeview() {
|
||||||
ui->content_tree->hideColumn(PROGRESS);
|
ui->content_tree->hideColumn(PROGRESS);
|
||||||
m_contentDelegate = new PropListDelegate();
|
m_contentDelegate = new PropListDelegate();
|
||||||
ui->content_tree->setItemDelegate(m_contentDelegate);
|
ui->content_tree->setItemDelegate(m_contentDelegate);
|
||||||
connect(ui->content_tree, SIGNAL(clicked(const QModelIndex&)), ui->content_tree, SLOT(edit(const QModelIndex&)));
|
connect(ui->content_tree, SIGNAL(clicked(const QModelIndex &)), ui->content_tree, SLOT(edit(const QModelIndex &)));
|
||||||
connect(ui->content_tree, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayContentTreeMenu(const QPoint&)));
|
connect(ui->content_tree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(displayContentTreeMenu(const QPoint &)));
|
||||||
|
|
||||||
// List files in torrent
|
// List files in torrent
|
||||||
m_contentModel->model()->setupModelData(*m_torrentInfo);
|
m_contentModel->model()->setupModelData(*m_torrentInfo);
|
||||||
|
@ -678,14 +688,14 @@ void AddNewTorrentDialog::setupTreeview() {
|
||||||
|
|
||||||
// Expand root folder
|
// Expand root folder
|
||||||
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
|
ui->content_tree->setExpanded(m_contentModel->index(0, 0), true);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// Update save paths (append file name to them)
|
// Update save paths (append file name to them)
|
||||||
QString single_file_relpath = misc::toQStringU(fs.file_path(0));
|
QString single_file_relpath = misc::toQStringU(fs.file_path(0));
|
||||||
for (int i=0; i<ui->save_path_combo->count()-1; ++i) {
|
for (int i = 0; i<ui->save_path_combo->count() - 1; ++i)
|
||||||
ui->save_path_combo->setItemText(i, fsutils::toNativePath(QDir(ui->save_path_combo->itemText(i)).absoluteFilePath(single_file_relpath)));
|
ui->save_path_combo->setItemText(i, fsutils::toNativePath(QDir(ui->save_path_combo->itemText(i)).absoluteFilePath(single_file_relpath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
updateDiskSpaceLabel();
|
updateDiskSpaceLabel();
|
||||||
showAdvancedSettings(Preferences::instance()->getAddNewTorrentDialogExpanded());
|
showAdvancedSettings(Preferences::instance()->getAddNewTorrentDialogExpanded());
|
||||||
|
|
|
@ -40,14 +40,14 @@
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AddNewTorrentDialog;
|
class AddNewTorrentDialog;
|
||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class TorrentContentFilterModel;
|
class TorrentContentFilterModel;
|
||||||
class PropListDelegate;
|
class PropListDelegate;
|
||||||
|
|
||||||
class AddNewTorrentDialog : public QDialog
|
class AddNewTorrentDialog: public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue