Browse Source

Remove button to change save path from lower panel

adaptive-webui-19844
Christophe Dumez 13 years ago
parent
commit
cfb4ded943
  1. 51
      src/properties/propertieswidget.cpp
  2. 1
      src/properties/propertieswidget.h
  3. 38
      src/properties/propertieswidget.ui

51
src/properties/propertieswidget.cpp

@ -245,7 +245,6 @@ void PropertiesWidget::loadTorrentInfos(const QTorrentHandle &_h) {
try { try {
// Save path // Save path
updateSavePath(h); updateSavePath(h);
changeSavePathButton->setEnabled(h.has_metadata());
// Hash // Hash
hash_lbl->setText(h.hash()); hash_lbl->setText(h.hash());
PropListModel->model()->clear(); PropListModel->model()->clear();
@ -662,56 +661,6 @@ bool PropertiesWidget::applyPriorities() {
return true; return true;
} }
void PropertiesWidget::on_changeSavePathButton_clicked() {
if (!h.is_valid()) return;
QString new_path;
if (h.has_metadata() && h.num_files() == 1) {
new_path = QFileDialog::getSaveFileName(this, tr("Choose save path"), h.firstFileSavePath());
} else {
const QDir saveDir(TorrentPersistentData::getSavePath(h.hash()));
new_path = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.absolutePath(),
QFileDialog::DontConfirmOverwrite|QFileDialog::ShowDirsOnly|QFileDialog::HideNameFilterDetails);
}
if (!new_path.isEmpty()) {
// Check if savePath exists
QString save_path_dir = new_path.replace("\\", "/");
QString new_file_name;
if (h.has_metadata() && h.num_files() == 1) {
save_path_dir = fsutils::branchPath(save_path_dir, &new_file_name); // Skip file name
}
QDir savePath(fsutils::expandPath(save_path_dir));
// Actually move storage
if (!QBtSession::instance()->useTemporaryFolder() || h.is_seed()) {
if (!savePath.exists()) savePath.mkpath(savePath.absolutePath());
h.move_storage(savePath.absolutePath());
}
// Update save_path in dialog
QString display_path;
if (h.has_metadata() && h.num_files() == 1) {
// Rename the file
Q_ASSERT(!new_file_name.isEmpty());
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
if (h.filename_at(0).compare(new_file_name, Qt::CaseInsensitive) != 0) {
#else
if (h.filename_at(0).compare(new_file_name, Qt::CaseSensitive) != 0) {
#endif
qDebug("Renaming single file to %s", qPrintable(new_file_name));
h.rename_file(0, new_file_name);
// Also rename it in the files list model
PropListModel->setData(PropListModel->index(0, 0), new_file_name);
}
display_path = h.firstFileSavePath();
} else {
display_path = savePath.absolutePath();
}
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
display_path.replace("/", "\\");
#endif
save_path->setText(display_path);
}
}
void PropertiesWidget::filteredFilesChanged() { void PropertiesWidget::filteredFilesChanged() {
if (h.is_valid()) { if (h.is_valid()) {
applyPriorities(); applyPriorities();

1
src/properties/propertieswidget.h

@ -79,7 +79,6 @@ protected slots:
void askWebSeed(); void askWebSeed();
void deleteSelectedUrlSeeds(); void deleteSelectedUrlSeeds();
void displayFilesListMenu(const QPoint& pos); void displayFilesListMenu(const QPoint& pos);
void on_changeSavePathButton_clicked();
void filteredFilesChanged(); void filteredFilesChanged();
void showPiecesDownloaded(bool show); void showPiecesDownloaded(bool show);
void showPiecesAvailability(bool show); void showPiecesAvailability(bool show);

38
src/properties/propertieswidget.ui

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>551</width> <width>551</width>
<height>274</height> <height>452</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -49,8 +49,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>534</width> <width>549</width>
<height>451</height> <height>447</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
@ -365,22 +365,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="changeSavePathButton">
<property name="maximumSize">
<size>
<width>22</width>
<height>15</height>
</size>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_4">
<property name="orientation"> <property name="orientation">
@ -548,22 +532,6 @@
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<item> <item>
<widget class="QTextBrowser" name="comment_text"> <widget class="QTextBrowser" name="comment_text">
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Cantarell';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu';&quot;&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans';&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
</property> </property>

Loading…
Cancel
Save