@ -60,7 +60,7 @@
using namespace libtorrent ;
using namespace libtorrent ;
torrentAdditionDialog : : torrentAdditionDialog ( QWidget * parent ) :
torrentAdditionDialog : : torrentAdditionDialog ( QWidget * parent ) :
QDialog ( parent ) , old_l abel( " " ) , hidden_h eight( 0 ) , m_showContentList ( true ) {
QDialog ( parent ) , m_oldL abel( " " ) , m_hiddenH eight( 0 ) , m_showContentList ( true ) {
Preferences pref ;
Preferences pref ;
setupUi ( this ) ;
setupUi ( this ) ;
setAttribute ( Qt : : WA_DeleteOnClose ) ;
setAttribute ( Qt : : WA_DeleteOnClose ) ;
@ -68,33 +68,33 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
CancelButton - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " dialog-cancel " ) ) ;
CancelButton - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " dialog-cancel " ) ) ;
OkButton - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " list-add " ) ) ;
OkButton - > setIcon ( IconProvider : : instance ( ) - > getIcon ( " list-add " ) ) ;
// Set Properties list model
// Set Properties list model
P ropListModel = new TorrentContentFilterModel ( this ) ;
m_p ropListModel = new TorrentContentFilterModel ( this ) ;
connect ( P ropListModel, SIGNAL ( filteredFilesChanged ( ) ) , SLOT ( updateDiskSpaceLabels ( ) ) ) ;
connect ( m_p ropListModel, SIGNAL ( filteredFilesChanged ( ) ) , SLOT ( updateDiskSpaceLabels ( ) ) ) ;
torrentContentList - > setModel ( P ropListModel) ;
torrentContentList - > setModel ( m_p ropListModel) ;
torrentContentList - > hideColumn ( PROGRESS ) ;
torrentContentList - > hideColumn ( PROGRESS ) ;
Prop Delegate = new PropListDelegate ( ) ;
m_propList Delegate = new PropListDelegate ( ) ;
torrentContentList - > setItemDelegate ( Prop Delegate) ;
torrentContentList - > setItemDelegate ( m_propList Delegate) ;
connect ( torrentContentList , SIGNAL ( clicked ( const QModelIndex & ) ) , torrentContentList , SLOT ( edit ( const QModelIndex & ) ) ) ;
connect ( torrentContentList , SIGNAL ( clicked ( const QModelIndex & ) ) , torrentContentList , SLOT ( edit ( const QModelIndex & ) ) ) ;
connect ( torrentContentList , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayContentListMenu ( const QPoint & ) ) ) ;
connect ( torrentContentList , SIGNAL ( customContextMenuRequested ( const QPoint & ) ) , this , SLOT ( displayContentListMenu ( const QPoint & ) ) ) ;
connect ( selectAllButton , SIGNAL ( clicked ( ) ) , P ropListModel, SLOT ( selectAll ( ) ) ) ;
connect ( selectAllButton , SIGNAL ( clicked ( ) ) , m_p ropListModel, SLOT ( selectAll ( ) ) ) ;
connect ( selectNoneButton , SIGNAL ( clicked ( ) ) , P ropListModel, SLOT ( selectNone ( ) ) ) ;
connect ( selectNoneButton , SIGNAL ( clicked ( ) ) , m_p ropListModel, SLOT ( selectNone ( ) ) ) ;
connect ( comboLabel , SIGNAL ( editTextChanged ( QString ) ) , this , SLOT ( resetComboLabelIndex ( QString ) ) ) ;
connect ( comboLabel , SIGNAL ( editTextChanged ( QString ) ) , this , SLOT ( resetComboLabelIndex ( QString ) ) ) ;
connect ( comboLabel , SIGNAL ( editTextChanged ( QString ) ) , this , SLOT ( updateLabelInSavePath ( QString ) ) ) ;
connect ( comboLabel , SIGNAL ( editTextChanged ( QString ) ) , this , SLOT ( updateLabelInSavePath ( QString ) ) ) ;
connect ( comboLabel , SIGNAL ( currentIndexChanged ( QString ) ) , this , SLOT ( updateLabelInSavePath ( QString ) ) ) ;
connect ( comboLabel , SIGNAL ( currentIndexChanged ( QString ) ) , this , SLOT ( updateLabelInSavePath ( QString ) ) ) ;
LineEdit * contentFilterLine = new LineEdit ( this ) ;
LineEdit * contentFilterLine = new LineEdit ( this ) ;
connect ( contentFilterLine , SIGNAL ( textChanged ( QString ) ) , P ropListModel, SLOT ( setFilterFixedString ( QString ) ) ) ;
connect ( contentFilterLine , SIGNAL ( textChanged ( QString ) ) , m_p ropListModel, SLOT ( setFilterFixedString ( QString ) ) ) ;
contentFilterLayout - > insertWidget ( 1 , contentFilterLine ) ;
contentFilterLayout - > insertWidget ( 1 , contentFilterLine ) ;
// Important: as a default, it inserts at the bottom which is not desirable
// Important: as a default, it inserts at the bottom which is not desirable
savePathTxt - > setInsertPolicy ( QComboBox : : InsertAtCurrent ) ;
savePathTxt - > setInsertPolicy ( QComboBox : : InsertAtCurrent ) ;
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
//torrentContentList->header()->setResizeMode(0, QHeaderView::Stretch);
defaultSavePath = pref . getSavePath ( ) ;
m_ defaultSavePath = pref . getSavePath ( ) ;
//In case of the LastLocationPath doesn't exist anymore, empty the string
//In case of the LastLocationPath doesn't exist anymore, empty the string
appendLabelToSavePath = pref . appendTorrentLabel ( ) ;
m_ appendLabelToSavePath = pref . appendTorrentLabel ( ) ;
QString display_path = defaultSavePath . replace ( " \\ " , " / " ) ;
QString display_path = m_ defaultSavePath. replace ( " \\ " , " / " ) ;
if ( ! display_path . endsWith ( " / " ) )
if ( ! display_path . endsWith ( " / " ) )
display_path + = " / " ;
display_path + = " / " ;
path_h istory < < display_path ;
m_pathH istory < < display_path ;
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
display_path . replace ( " / " , " \\ " ) ;
display_path . replace ( " / " , " \\ " ) ;
# endif
# endif
@ -118,8 +118,8 @@ torrentAdditionDialog::torrentAdditionDialog(QWidget *parent) :
}
}
torrentAdditionDialog : : ~ torrentAdditionDialog ( ) {
torrentAdditionDialog : : ~ torrentAdditionDialog ( ) {
delete Prop Delegate;
delete m_propList Delegate;
delete P ropListModel;
delete m_p ropListModel;
}
}
void torrentAdditionDialog : : closeEvent ( QCloseEvent * event )
void torrentAdditionDialog : : closeEvent ( QCloseEvent * event )
@ -193,28 +193,23 @@ void torrentAdditionDialog::hideTorrentContent() {
m_showContentList = false ;
m_showContentList = false ;
}
}
void torrentAdditionDialog : : showLoadMagnetURI ( QString magnet_uri ) {
void torrentAdditionDialog : : showLoadMagnetURI ( const QString & magnet_uri ) {
is_m agnet = true ;
m_isM agnet = true ;
this - > from_u rl = magnet_uri ;
this - > m_fromU rl = magnet_uri ;
checkLastFolder - > setEnabled ( false ) ;
checkLastFolder - > setEnabled ( false ) ;
// Disable Save path combox and browse button
// Save path should be default for magnet links
savePathTxt - > setEnabled ( true ) ;
browseButton - > setEnabled ( true ) ;
// Get torrent hash
// Get torrent hash
hash = misc : : magnetUriToHash ( magnet_uri ) ;
m_hash = misc : : magnetUriToHash ( magnet_uri ) ;
if ( hash . isEmpty ( ) ) {
if ( m_hash . isEmpty ( ) ) {
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode magnet link: " ) + QString : : fromUtf8 ( " ' " ) + from_u rl+ QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode magnet link: " ) + QString : : fromUtf8 ( " ' " ) + m_fromUrl + QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
return ;
return ;
}
}
// Set torrent name
// Set torrent name
fileName = misc : : magnetUriToName ( magnet_uri ) ;
m_ fileName = misc : : magnetUriToName ( magnet_uri ) ;
if ( fileName . isEmpty ( ) ) {
if ( m_ fileName. isEmpty ( ) ) {
fileName = tr ( " Magnet Link " ) ;
m_ fileName = tr ( " Magnet Link " ) ;
}
}
fileNameLbl - > setText ( QString : : fromUtf8 ( " <center><b> " ) + fileName + QString : : fromUtf8 ( " </b></center> " ) ) ;
fileNameLbl - > setText ( QString : : fromUtf8 ( " <center><b> " ) + m_ fileName+ QString : : fromUtf8 ( " </b></center> " ) ) ;
// Update display
// Update display
updateDiskSpaceLabels ( ) ;
updateDiskSpaceLabels ( ) ;
@ -231,73 +226,73 @@ void torrentAdditionDialog::showLoadMagnetURI(QString magnet_uri) {
show ( ) ;
show ( ) ;
}
}
void torrentAdditionDialog : : showLoad ( QString filePath , QString from_url ) {
void torrentAdditionDialog : : showLoad ( const QString & filePath , const QString & from_url ) {
is_m agnet = false ;
m_isM agnet = false ;
// This is an URL to a local file, switch to local path
// This is an URL to a local file, switch to local path
if ( filePath . startsWith ( " file: " , Qt : : CaseInsensitive ) )
if ( filePath . startsWith ( " file: " , Qt : : CaseInsensitive ) )
filePath = QUrl : : fromEncoded ( filePath . toLocal8Bit ( ) ) . toLocalFile ( ) ;
m_filePath = QUrl : : fromEncoded ( filePath . toLocal8Bit ( ) ) . toLocalFile ( ) ;
else
m_filePath = filePath ;
if ( ! QFile : : exists ( filePath ) ) {
if ( ! QFile : : exists ( m_ filePath) ) {
close ( ) ;
close ( ) ;
return ;
return ;
}
}
qDebug ( ) < < Q_FUNC_INFO < < filePath ;
qDebug ( ) < < Q_FUNC_INFO < < filePath ;
this - > filePath = filePath ;
this - > m_fromUrl = from_url ;
this - > from_url = from_url ;
// Getting torrent file informations
// Getting torrent file informations
try {
try {
t = new torrent_info ( filePath . toUtf8 ( ) . data ( ) ) ;
m_ torrentInfo = new torrent_info ( m_ filePath. toUtf8 ( ) . data ( ) ) ;
if ( ! t - > is_valid ( ) )
if ( ! m_ torrentInfo - > is_valid ( ) )
throw std : : exception ( ) ;
throw std : : exception ( ) ;
} catch ( std : : exception & ) {
} catch ( std : : exception & ) {
qDebug ( " Caught error loading torrent " ) ;
qDebug ( " Caught error loading torrent " ) ;
if ( ! from_url . isNull ( ) ) {
if ( ! from_url . isNull ( ) ) {
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode torrent file: " ) + QString : : fromUtf8 ( " ' " ) + from_url + QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode torrent file: " ) + QString : : fromUtf8 ( " ' " ) + from_url + QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
QFile : : remove ( filePath ) ;
QFile : : remove ( m_ filePath) ;
} else {
} else {
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode torrent file: " ) + QString : : fromUtf8 ( " ' " ) + filePath + QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
QBtSession : : instance ( ) - > addConsoleMessage ( tr ( " Unable to decode torrent file: " ) + QString : : fromUtf8 ( " ' " ) + m_ filePath+ QString : : fromUtf8 ( " ' " ) , QString : : fromUtf8 ( " red " ) ) ;
}
}
close ( ) ;
close ( ) ;
return ;
return ;
}
}
nbFiles = t - > num_files ( ) ;
m_ nbFiles = m_ torrentInfo - > num_files ( ) ;
if ( nbFiles = = 0 ) {
if ( m_ nbFiles = = 0 ) {
// Empty torrent file!?
// Empty torrent file!?
close ( ) ;
close ( ) ;
return ;
return ;
}
}
# if LIBTORRENT_VERSION_MINOR >= 16
# if LIBTORRENT_VERSION_MINOR >= 16
file_storage fs = t - > files ( ) ;
file_storage fs = m_ torrentInfo - > files ( ) ;
# endif
# endif
// Truncate root folder
// Truncate root folder
QString root_folder = misc : : truncateRootFolder ( t ) ;
QString root_folder = misc : : truncateRootFolder ( m_ torrentInfo ) ;
// Setting file name
// Setting file name
fileName = misc : : toQStringU ( t - > name ( ) ) ;
m_ fileName = misc : : toQStringU ( m_ torrentInfo - > name ( ) ) ;
hash = misc : : toQString ( t - > info_hash ( ) ) ;
m_ hash = misc : : toQString ( m_ torrentInfo - > info_hash ( ) ) ;
// Use left() to remove .old extension
// Use left() to remove .old extension
QString newFileName ;
QString newFileName ;
if ( fileName . endsWith ( QString : : fromUtf8 ( " .old " ) ) ) {
if ( m_ fileName. endsWith ( QString : : fromUtf8 ( " .old " ) ) ) {
newFileName = fileName . left ( fileName . size ( ) - 4 ) ;
newFileName = m_ fileName. left ( m_ fileName. size ( ) - 4 ) ;
} else {
} else {
newFileName = fileName ;
newFileName = m_ fileName;
}
}
fileNameLbl - > setText ( QString : : fromUtf8 ( " <center><b> " ) + newFileName + QString : : fromUtf8 ( " </b></center> " ) ) ;
fileNameLbl - > setText ( QString : : fromUtf8 ( " <center><b> " ) + newFileName + QString : : fromUtf8 ( " </b></center> " ) ) ;
if ( t - > num_files ( ) > 1 ) {
if ( m_ torrentInfo - > num_files ( ) > 1 ) {
// List files in torrent
// List files in torrent
P ropListModel- > model ( ) - > setupModelData ( * t ) ;
m_p ropListModel- > model ( ) - > setupModelData ( * m_ torrentInfo ) ;
connect ( Prop Delegate, SIGNAL ( filteredFilesChanged ( ) ) , this , SLOT ( updateDiskSpaceLabels ( ) ) ) ;
connect ( m_propList Delegate, SIGNAL ( filteredFilesChanged ( ) ) , this , SLOT ( updateDiskSpaceLabels ( ) ) ) ;
// Loads files path in the torrent
// Loads files path in the torrent
for ( uint i = 0 ; i < nbFiles ; + + i ) {
for ( uint i = 0 ; i < m_ nbFiles; + + i ) {
# if LIBTORRENT_VERSION_MINOR >= 16
# if LIBTORRENT_VERSION_MINOR >= 16
files_p ath < < misc : : toQStringU ( fs . file_path ( t - > file_at ( i ) ) ) ;
m_filesP ath < < misc : : toQStringU ( fs . file_path ( m_ torrentInfo - > file_at ( i ) ) ) ;
# else
# else
files_p ath < < misc : : toQStringU ( t - > file_at ( i ) . path . string ( ) ) ;
m_filesP ath < < misc : : toQStringU ( m_ torrentInfo - > file_at ( i ) . path . string ( ) ) ;
# endif
# endif
}
}
}
}
// Load save path history
// Load save path history
@ -317,12 +312,12 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
if ( ! root_folder . isEmpty ( ) ) {
if ( ! root_folder . isEmpty ( ) ) {
save_path + = root_folder ;
save_path + = root_folder ;
}
}
if ( nbFiles = = 1 ) {
if ( m_ nbFiles = = 1 ) {
// single file torrent
// single file torrent
# if LIBTORRENT_VERSION_MINOR >= 16
# if LIBTORRENT_VERSION_MINOR >= 16
QString single_file_relpath = misc : : toQStringU ( fs . file_path ( t - > file_at ( 0 ) ) ) ;
QString single_file_relpath = misc : : toQStringU ( fs . file_path ( m_ torrentInfo - > file_at ( 0 ) ) ) ;
# else
# else
QString single_file_relpath = misc : : toQStringU ( t - > file_at ( 0 ) . path . string ( ) ) ;
QString single_file_relpath = misc : : toQStringU ( m_ torrentInfo - > file_at ( 0 ) . path . string ( ) ) ;
# endif
# endif
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
single_file_relpath . replace ( " / " , " \\ " ) ;
single_file_relpath . replace ( " / " , " \\ " ) ;
@ -335,7 +330,7 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
updateDiskSpaceLabels ( ) ;
updateDiskSpaceLabels ( ) ;
// Hide useless widgets
// Hide useless widgets
if ( t - > num_files ( ) < = 1 )
if ( m_ torrentInfo - > num_files ( ) < = 1 )
hideTorrentContent ( ) ;
hideTorrentContent ( ) ;
// Remember dialog geometry
// Remember dialog geometry
@ -349,11 +344,11 @@ void torrentAdditionDialog::showLoad(QString filePath, QString from_url) {
}
}
void torrentAdditionDialog : : displayContentListMenu ( const QPoint & ) {
void torrentAdditionDialog : : displayContentListMenu ( const QPoint & ) {
Q_ASSERT ( ! is_m agnet & & t - > num_files ( ) > 1 ) ;
Q_ASSERT ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) > 1 ) ;
QMenu myFilesLlistMenu ;
QMenu myFilesLlistMenu ;
const QModelIndexList selectedRows = torrentContentList - > selectionModel ( ) - > selectedRows ( 0 ) ;
const QModelIndexList selectedRows = torrentContentList - > selectionModel ( ) - > selectedRows ( 0 ) ;
QAction * actRename = 0 ;
QAction * actRename = 0 ;
if ( selectedRows . size ( ) = = 1 & & t - > num_files ( ) > 1 ) {
if ( selectedRows . size ( ) = = 1 & & m_ torrentInfo - > num_files ( ) > 1 ) {
actRename = myFilesLlistMenu . addAction ( IconProvider : : instance ( ) - > getIcon ( " edit-rename " ) , tr ( " Rename... " ) ) ;
actRename = myFilesLlistMenu . addAction ( IconProvider : : instance ( ) - > getIcon ( " edit-rename " ) , tr ( " Rename... " ) ) ;
myFilesLlistMenu . addSeparator ( ) ;
myFilesLlistMenu . addSeparator ( ) ;
}
}
@ -385,14 +380,14 @@ void torrentAdditionDialog::displayContentListMenu(const QPoint&) {
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 ( ) ) ;
P ropListModel- > setData ( P ropListModel- > index ( index . row ( ) , PRIORITY , index . parent ( ) ) , prio ) ;
m_p ropListModel- > setData ( m_p ropListModel- > index ( index . row ( ) , PRIORITY , index . parent ( ) ) , prio ) ;
}
}
}
}
}
}
}
}
void torrentAdditionDialog : : renameSelectedFile ( ) {
void torrentAdditionDialog : : renameSelectedFile ( ) {
Q_ASSERT ( ! is_m agnet & & t - > num_files ( ) > 1 ) ;
Q_ASSERT ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) > 1 ) ;
const QModelIndexList selectedIndexes = torrentContentList - > selectionModel ( ) - > selectedRows ( 0 ) ;
const QModelIndexList selectedIndexes = torrentContentList - > selectionModel ( ) - > selectedRows ( 0 ) ;
Q_ASSERT ( selectedIndexes . size ( ) = = 1 ) ;
Q_ASSERT ( selectedIndexes . size ( ) = = 1 ) ;
const QModelIndex & index = selectedIndexes . first ( ) ;
const QModelIndex & index = selectedIndexes . first ( ) ;
@ -408,10 +403,10 @@ void torrentAdditionDialog::renameSelectedFile() {
QMessageBox : : Ok ) ;
QMessageBox : : Ok ) ;
return ;
return ;
}
}
if ( P ropListModel- > getType ( index ) = = TorrentContentModelItem : : TFILE ) {
if ( m_p ropListModel- > getType ( index ) = = TorrentContentModelItem : : TFILE ) {
// File renaming
// File renaming
const uint file_index = P ropListModel- > getFileIndex ( index ) ;
const uint file_index = m_p ropListModel- > getFileIndex ( index ) ;
QString old_name = files_p ath. at ( file_index ) ;
QString old_name = m_filesP ath. at ( file_index ) ;
old_name . replace ( " \\ " , " / " ) ;
old_name . replace ( " \\ " , " / " ) ;
qDebug ( " Old name: %s " , qPrintable ( old_name ) ) ;
qDebug ( " Old name: %s " , qPrintable ( old_name ) ) ;
QStringList path_items = old_name . split ( " / " ) ;
QStringList path_items = old_name . split ( " / " ) ;
@ -425,12 +420,12 @@ void torrentAdditionDialog::renameSelectedFile() {
new_name = QDir : : cleanPath ( new_name ) ;
new_name = QDir : : cleanPath ( 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 ( uint i = 0 ; i < nbFiles ; + + i ) {
for ( uint i = 0 ; i < m_ nbFiles; + + i ) {
if ( i = = file_index ) continue ;
if ( i = = file_index ) continue ;
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if ( files_p ath. at ( i ) . compare ( new_name , Qt : : CaseSensitive ) = = 0 ) {
if ( m_filesP ath. at ( i ) . compare ( new_name , Qt : : CaseSensitive ) = = 0 ) {
# else
# else
if ( files_p ath. at ( i ) . compare ( new_name , Qt : : CaseInsensitive ) = = 0 ) {
if ( m_filesP ath. at ( i ) . compare ( new_name , Qt : : CaseInsensitive ) = = 0 ) {
# endif
# endif
// Display error message
// Display error message
QMessageBox : : warning ( this , tr ( " The file could not be renamed " ) ,
QMessageBox : : warning ( this , tr ( " The file could not be renamed " ) ,
@ -442,17 +437,17 @@ void torrentAdditionDialog::renameSelectedFile() {
new_name = QDir : : cleanPath ( new_name ) ;
new_name = QDir : : cleanPath ( new_name ) ;
qDebug ( " Renaming %s to %s " , qPrintable ( old_name ) , qPrintable ( new_name ) ) ;
qDebug ( " Renaming %s to %s " , qPrintable ( old_name ) , qPrintable ( new_name ) ) ;
// Rename file in files_path
// Rename file in files_path
files_p ath. replace ( file_index , new_name ) ;
m_filesP ath. replace ( file_index , new_name ) ;
// Rename in torrent files model too
// Rename in torrent files model too
P ropListModel- > setData ( index , new_name_last ) ;
m_p ropListModel- > 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 ( ) ;
QModelIndex parent = P ropListModel- > parent ( index ) ;
QModelIndex parent = m_p ropListModel- > parent ( index ) ;
while ( parent . isValid ( ) ) {
while ( parent . isValid ( ) ) {
path_items . prepend ( parent . data ( ) . toString ( ) ) ;
path_items . prepend ( parent . data ( ) . toString ( ) ) ;
parent = P ropListModel- > parent ( parent ) ;
parent = m_p ropListModel- > parent ( parent ) ;
}
}
const QString old_path = path_items . join ( " / " ) ;
const QString old_path = path_items . join ( " / " ) ;
path_items . removeLast ( ) ;
path_items . removeLast ( ) ;
@ -460,8 +455,8 @@ void torrentAdditionDialog::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 ( uint i = 0 ; i < nbFiles ; + + i ) {
for ( uint i = 0 ; i < m_ nbFiles; + + i ) {
const QString & current_name = files_p ath. at ( i ) ;
const QString & current_name = m_filesP ath. at ( i ) ;
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if ( current_name . startsWith ( new_path , Qt : : CaseSensitive ) ) {
if ( current_name . startsWith ( new_path , Qt : : CaseSensitive ) ) {
# else
# else
@ -474,19 +469,19 @@ void torrentAdditionDialog::renameSelectedFile() {
}
}
}
}
// Replace path in all files
// Replace path in all files
for ( uint i = 0 ; i < nbFiles ; + + i ) {
for ( uint i = 0 ; i < m_ nbFiles; + + i ) {
const QString & current_name = files_p ath. at ( i ) ;
const QString & current_name = m_filesP ath. at ( i ) ;
if ( current_name . startsWith ( old_path ) ) {
if ( current_name . startsWith ( old_path ) ) {
QString new_name = current_name ;
QString new_name = current_name ;
new_name . replace ( 0 , old_path . length ( ) , new_path ) ;
new_name . replace ( 0 , old_path . length ( ) , new_path ) ;
new_name = QDir : : cleanPath ( new_name ) ;
new_name = QDir : : cleanPath ( new_name ) ;
qDebug ( " Rename %s to %s " , qPrintable ( current_name ) , qPrintable ( new_name ) ) ;
qDebug ( " Rename %s to %s " , qPrintable ( current_name ) , qPrintable ( new_name ) ) ;
// Rename in files_path
// Rename in files_path
files_p ath. replace ( i , new_name ) ;
m_filesP ath. replace ( i , new_name ) ;
}
}
}
}
// Rename folder in torrent files model too
// Rename folder in torrent files model too
P ropListModel- > setData ( index , new_name_last ) ;
m_p ropListModel- > setData ( index , new_name_last ) ;
}
}
}
}
}
}
@ -495,19 +490,19 @@ void torrentAdditionDialog::updateDiskSpaceLabels() {
qDebug ( " Updating disk space label... " ) ;
qDebug ( " Updating disk space label... " ) ;
const long long available = misc : : freeDiskSpaceOnPath ( misc : : expandPath ( savePathTxt - > currentText ( ) ) ) ;
const long long available = misc : : freeDiskSpaceOnPath ( misc : : expandPath ( savePathTxt - > currentText ( ) ) ) ;
lbl_disk_space - > setText ( misc : : friendlyUnit ( available ) ) ;
lbl_disk_space - > setText ( misc : : friendlyUnit ( available ) ) ;
if ( ! is_m agnet) {
if ( ! m_isM agnet) {
// Determine torrent size
// Determine torrent size
qulonglong torrent_size = 0 ;
qulonglong torrent_size = 0 ;
if ( t - > num_files ( ) > 1 ) {
if ( m_ torrentInfo - > num_files ( ) > 1 ) {
const std : : vector < int > priorities = P ropListModel- > model ( ) - > getFilesPriorities ( ) ;
const std : : vector < int > priorities = m_p ropListModel- > model ( ) - > getFilesPriorities ( ) ;
Q_ASSERT ( priorities . size ( ) = = t - > num_files ( ) ) ;
Q_ASSERT ( priorities . size ( ) = = m_ torrentInfo - > num_files ( ) ) ;
for ( unsigned int i = 0 ; i < priorities . size ( ) ; + + i ) {
for ( unsigned int i = 0 ; i < priorities . size ( ) ; + + i ) {
if ( priorities [ i ] > 0 )
if ( priorities [ i ] > 0 )
torrent_size + = t - > file_at ( i ) . size ;
torrent_size + = m_ torrentInfo - > file_at ( i ) . size ;
}
}
} else {
} else {
torrent_size = t - > total_size ( ) ;
torrent_size = m_ torrentInfo - > total_size ( ) ;
}
}
lbl_torrent_size - > setText ( misc : : friendlyUnit ( torrent_size ) ) ;
lbl_torrent_size - > setText ( misc : : friendlyUnit ( torrent_size ) ) ;
@ -531,14 +526,14 @@ void torrentAdditionDialog::on_browseButton_clicked() {
QString new_path ;
QString new_path ;
QString root_folder ;
QString root_folder ;
const QString label_name = comboLabel - > currentText ( ) ;
const QString label_name = comboLabel - > currentText ( ) ;
if ( ! is_m agnet) {
if ( ! m_isM agnet) {
if ( t - > num_files ( ) = = 1 ) {
if ( m_ torrentInfo - > num_files ( ) = = 1 ) {
new_path = QFileDialog : : getSaveFileName ( this , tr ( " Choose save path " ) , savePathTxt - > currentText ( ) , QString ( ) , 0 , QFileDialog : : DontConfirmOverwrite ) ;
new_path = QFileDialog : : getSaveFileName ( this , tr ( " Choose save path " ) , savePathTxt - > currentText ( ) , QString ( ) , 0 , QFileDialog : : DontConfirmOverwrite ) ;
if ( ! new_path . isEmpty ( ) ) {
if ( ! new_path . isEmpty ( ) ) {
QStringList path_parts = new_path . replace ( " \\ " , " / " ) . split ( " / " ) ;
QStringList path_parts = new_path . replace ( " \\ " , " / " ) . split ( " / " ) ;
const QString filename = path_parts . takeLast ( ) ;
const QString filename = path_parts . takeLast ( ) ;
// Append label
// Append label
if ( QDir ( path_parts . join ( QDir : : separator ( ) ) ) = = QDir ( defaultSavePath ) & & ! label_name . isEmpty ( ) )
if ( QDir ( path_parts . join ( QDir : : separator ( ) ) ) = = QDir ( m_ defaultSavePath) & & ! label_name . isEmpty ( ) )
path_parts < < label_name ;
path_parts < < label_name ;
// Append file name
// Append file name
path_parts < < filename ;
path_parts < < filename ;
@ -558,7 +553,7 @@ void torrentAdditionDialog::on_browseButton_clicked() {
if ( path_parts . last ( ) . isEmpty ( ) )
if ( path_parts . last ( ) . isEmpty ( ) )
path_parts . removeLast ( ) ;
path_parts . removeLast ( ) ;
// Append label
// Append label
if ( QDir ( new_path ) = = QDir ( defaultSavePath ) & & ! label_name . isEmpty ( ) )
if ( QDir ( new_path ) = = QDir ( m_ defaultSavePath) & & ! label_name . isEmpty ( ) )
path_parts < < label_name ;
path_parts < < label_name ;
// Append root folder
// Append root folder
if ( ! root_folder . isEmpty ( ) )
if ( ! root_folder . isEmpty ( ) )
@ -571,9 +566,9 @@ void torrentAdditionDialog::on_browseButton_clicked() {
// Check if this new path already exists in the list
// Check if this new path already exists in the list
QString new_truncated_path = getTruncatedSavePath ( new_path ) ;
QString new_truncated_path = getTruncatedSavePath ( new_path ) ;
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
const int cur_index = path_h istory. indexOf ( QRegExp ( new_truncated_path , Qt : : CaseInsensitive ) ) ;
const int cur_index = m_pathH istory. indexOf ( QRegExp ( new_truncated_path , Qt : : CaseInsensitive ) ) ;
# else
# else
const int cur_index = path_h istory. indexOf ( QRegExp ( new_truncated_path , Qt : : CaseSensitive ) ) ;
const int cur_index = m_pathH istory. indexOf ( QRegExp ( new_truncated_path , Qt : : CaseSensitive ) ) ;
# endif
# endif
if ( cur_index > = 0 ) {
if ( cur_index > = 0 ) {
savePathTxt - > setCurrentIndex ( cur_index ) ;
savePathTxt - > setCurrentIndex ( cur_index ) ;
@ -590,15 +585,15 @@ void torrentAdditionDialog::on_CancelButton_clicked() {
}
}
bool torrentAdditionDialog : : allFiltered ( ) const {
bool torrentAdditionDialog : : allFiltered ( ) const {
Q_ASSERT ( ! is_m agnet) ;
Q_ASSERT ( ! m_isM agnet) ;
return P ropListModel- > model ( ) - > allFiltered ( ) ;
return m_p ropListModel- > model ( ) - > allFiltered ( ) ;
}
}
void torrentAdditionDialog : : savePiecesPriorities ( ) {
void torrentAdditionDialog : : savePiecesPriorities ( ) {
qDebug ( " Saving pieces priorities " ) ;
qDebug ( " Saving pieces priorities " ) ;
Q_ASSERT ( ! is_m agnet) ;
Q_ASSERT ( ! m_isM agnet) ;
const std : : vector < int > priorities = P ropListModel- > model ( ) - > getFilesPriorities ( ) ;
const std : : vector < int > priorities = m_p ropListModel- > model ( ) - > getFilesPriorities ( ) ;
TorrentTempData : : setFilesPriority ( hash , priorities ) ;
TorrentTempData : : setFilesPriority ( m_ hash, priorities ) ;
}
}
void torrentAdditionDialog : : on_OkButton_clicked ( ) {
void torrentAdditionDialog : : on_OkButton_clicked ( ) {
@ -614,12 +609,12 @@ void torrentAdditionDialog::on_OkButton_clicked() {
# endif
# endif
save_path = misc : : expandPath ( save_path ) ;
save_path = misc : : expandPath ( save_path ) ;
qDebug ( " Save path is %s " , qPrintable ( save_path ) ) ;
qDebug ( " Save path is %s " , qPrintable ( save_path ) ) ;
if ( ! is_m agnet & & t - > num_files ( ) = = 1 ) {
if ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) = = 1 ) {
// Remove file name
// Remove file name
QStringList parts = save_path . split ( " / " ) ;
QStringList parts = save_path . split ( " / " ) ;
const QString single_file_name = parts . takeLast ( ) ;
const QString single_file_name = parts . takeLast ( ) ;
Q_ASSERT ( files_p ath. isEmpty ( ) ) ;
Q_ASSERT ( m_filesP ath. isEmpty ( ) ) ;
files_p ath < < single_file_name ;
m_filesP ath < < single_file_name ;
save_path = parts . join ( " / " ) ;
save_path = parts . join ( " / " ) ;
}
}
qDebug ( " Save path dir is %s " , qPrintable ( save_path ) ) ;
qDebug ( " Save path dir is %s " , qPrintable ( save_path ) ) ;
@ -631,27 +626,27 @@ void torrentAdditionDialog::on_OkButton_clicked() {
}
}
// Save savepath
// Save savepath
qDebug ( " Saving save path to temp data: %s " , qPrintable ( savePath . absolutePath ( ) ) ) ;
qDebug ( " Saving save path to temp data: %s " , qPrintable ( savePath . absolutePath ( ) ) ) ;
TorrentTempData : : setSavePath ( hash , savePath . absolutePath ( ) ) ;
TorrentTempData : : setSavePath ( m_ hash, savePath . absolutePath ( ) ) ;
qDebug ( " Torrent label is: %s " , qPrintable ( comboLabel - > currentText ( ) . trimmed ( ) ) ) ;
qDebug ( " Torrent label is: %s " , qPrintable ( comboLabel - > currentText ( ) . trimmed ( ) ) ) ;
if ( ! current_label . isEmpty ( ) )
if ( ! current_label . isEmpty ( ) )
TorrentTempData : : setLabel ( hash , current_label ) ;
TorrentTempData : : setLabel ( m_ hash, current_label ) ;
// Is download sequential?
// Is download sequential?
TorrentTempData : : setSequential ( hash , checkIncrementalDL - > isChecked ( ) ) ;
TorrentTempData : : setSequential ( m_ hash, checkIncrementalDL - > isChecked ( ) ) ;
// Save files path
// Save files path
// Loads files path in the torrent
// Loads files path in the torrent
if ( ! is_m agnet) {
if ( ! m_isM agnet) {
bool path_changed = false ;
bool path_changed = false ;
for ( uint i = 0 ; i < nbFiles ; + + i ) {
for ( uint i = 0 ; i < m_ nbFiles; + + i ) {
# if LIBTORRENT_VERSION_MINOR >= 16
# if LIBTORRENT_VERSION_MINOR >= 16
file_storage fs = t - > files ( ) ;
file_storage fs = m_ torrentInfo - > files ( ) ;
QString old_path = misc : : toQStringU ( fs . file_path ( t - > file_at ( i ) ) ) ;
QString old_path = misc : : toQStringU ( fs . file_path ( m_ torrentInfo - > file_at ( i ) ) ) ;
# else
# else
QString old_path = misc : : toQStringU ( t - > file_at ( i ) . path . string ( ) ) ;
QString old_path = misc : : toQStringU ( m_ torrentInfo - > file_at ( i ) . path . string ( ) ) ;
# endif
# endif
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
# if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if ( files_p ath. at ( i ) . compare ( old_path , Qt : : CaseSensitive ) ! = 0 ) {
if ( m_filesP ath. at ( i ) . compare ( old_path , Qt : : CaseSensitive ) ! = 0 ) {
# else
# else
if ( files_p ath. at ( i ) . compare ( old_path , Qt : : CaseInsensitive ) ! = 0 ) {
if ( m_filesP ath. at ( i ) . compare ( old_path , Qt : : CaseInsensitive ) ! = 0 ) {
# endif
# endif
path_changed = true ;
path_changed = true ;
break ;
break ;
@ -659,21 +654,21 @@ void torrentAdditionDialog::on_OkButton_clicked() {
}
}
if ( path_changed ) {
if ( path_changed ) {
qDebug ( " Changing files paths " ) ;
qDebug ( " Changing files paths " ) ;
TorrentTempData : : setFilesPath ( hash , files_p ath) ;
TorrentTempData : : setFilesPath ( m_ hash, m_filesP ath) ;
}
}
}
}
// Skip file checking and directly start seeding
// Skip file checking and directly start seeding
if ( addInSeed - > isChecked ( ) ) {
if ( addInSeed - > isChecked ( ) ) {
// Check if local file(s) actually exist
// Check if local file(s) actually exist
if ( is_m agnet | | QFile : : exists ( savePathTxt - > currentText ( ) ) ) {
if ( m_isM agnet | | QFile : : exists ( savePathTxt - > currentText ( ) ) ) {
TorrentTempData : : setSeedingMode ( hash , true ) ;
TorrentTempData : : setSeedingMode ( m_ hash, true ) ;
} else {
} else {
QMessageBox : : warning ( 0 , tr ( " Seeding mode error " ) , tr ( " You chose to skip file checking. However, local files do not seem to exist in the current destionation folder. Please disable this feature or update the save path. " ) ) ;
QMessageBox : : warning ( 0 , tr ( " Seeding mode error " ) , tr ( " You chose to skip file checking. However, local files do not seem to exist in the current destionation folder. Please disable this feature or update the save path. " ) ) ;
return ;
return ;
}
}
}
}
// Check if there is at least one selected file
// Check if there is at least one selected file
if ( ! is_m agnet & & t - > num_files ( ) > 1 & & allFiltered ( ) ) {
if ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) > 1 & & allFiltered ( ) ) {
QMessageBox : : warning ( 0 , tr ( " Invalid file selection " ) , tr ( " You must select at least one file in the torrent " ) ) ;
QMessageBox : : warning ( 0 , tr ( " Invalid file selection " ) , tr ( " You must select at least one file in the torrent " ) ) ;
return ;
return ;
}
}
@ -693,14 +688,14 @@ void torrentAdditionDialog::on_OkButton_clicked() {
}
}
// save filtered files
// save filtered files
if ( ! is_m agnet & & t - > num_files ( ) > 1 )
if ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) > 1 )
savePiecesPriorities ( ) ;
savePiecesPriorities ( ) ;
// Add to download list
// Add to download list
QTorrentHandle h ;
QTorrentHandle h ;
if ( is_m agnet)
if ( m_isM agnet)
h = QBtSession : : instance ( ) - > addMagnetUri ( from_u rl, false ) ;
h = QBtSession : : instance ( ) - > addMagnetUri ( m_fromU rl, false ) ;
else
else
h = QBtSession : : instance ( ) - > addTorrent ( filePath , false , from_u rl) ;
h = QBtSession : : instance ( ) - > addTorrent ( m_ filePath, false , m_fromU rl) ;
if ( addInPause - > isChecked ( ) & & h . is_valid ( ) ) {
if ( addInPause - > isChecked ( ) & & h . is_valid ( ) ) {
h . pause ( ) ;
h . pause ( ) ;
}
}
@ -719,30 +714,30 @@ void torrentAdditionDialog::resetComboLabelIndex(QString text) {
}
}
void torrentAdditionDialog : : updateLabelInSavePath ( QString label ) {
void torrentAdditionDialog : : updateLabelInSavePath ( QString label ) {
if ( appendLabelToSavePath ) {
if ( m_ appendLabelToSavePath) {
// Update Label in combobox
// Update Label in combobox
savePathTxt - > setItemText ( 0 , misc : : updateLabelInSavePath ( defaultSavePath , savePathTxt - > itemText ( 0 ) , old_l abel, label ) ) ;
savePathTxt - > setItemText ( 0 , misc : : updateLabelInSavePath ( m_ defaultSavePath, savePathTxt - > itemText ( 0 ) , m_oldL abel, label ) ) ;
// update edit text
// update edit text
savePathTxt - > setEditText ( misc : : updateLabelInSavePath ( defaultSavePath , savePathTxt - > currentText ( ) , old_l abel, label ) ) ;
savePathTxt - > setEditText ( misc : : updateLabelInSavePath ( m_ defaultSavePath, savePathTxt - > currentText ( ) , m_oldL abel, label ) ) ;
old_l abel = label ;
m_oldL abel = label ;
}
}
}
}
void torrentAdditionDialog : : updateSavePathCurrentText ( ) {
void torrentAdditionDialog : : updateSavePathCurrentText ( ) {
qDebug ( " updateSavePathCurrentText() - ENTER " ) ;
qDebug ( " updateSavePathCurrentText() - ENTER " ) ;
savePathTxt - > setItemText ( savePathTxt - > currentIndex ( ) , savePathTxt - > currentText ( ) ) ;
savePathTxt - > setItemText ( savePathTxt - > currentIndex ( ) , savePathTxt - > currentText ( ) ) ;
qDebug ( " path_history.size() == %d " , path_h istory. size ( ) ) ;
qDebug ( " path_history.size() == %d " , m_pathH istory. size ( ) ) ;
qDebug ( " savePathTxt->currentIndex() == %d " , savePathTxt - > currentIndex ( ) ) ;
qDebug ( " savePathTxt->currentIndex() == %d " , savePathTxt - > currentIndex ( ) ) ;
path_h istory. replace ( savePathTxt - > currentIndex ( ) , getCurrentTruncatedSavePath ( ) ) ;
m_pathH istory. replace ( savePathTxt - > currentIndex ( ) , getCurrentTruncatedSavePath ( ) ) ;
QString root_folder_or_file_name = " " ;
QString root_folder_or_file_name = " " ;
getCurrentTruncatedSavePath ( & root_folder_or_file_name ) ;
getCurrentTruncatedSavePath ( & root_folder_or_file_name ) ;
// Update other combo items
// Update other combo items
for ( int i = 0 ; i < savePathTxt - > count ( ) ; + + i ) {
for ( int i = 0 ; i < savePathTxt - > count ( ) ; + + i ) {
if ( i = = savePathTxt - > currentIndex ( ) ) continue ;
if ( i = = savePathTxt - > currentIndex ( ) ) continue ;
QString item_path = path_h istory. at ( i ) ;
QString item_path = m_pathH istory. at ( i ) ;
if ( item_path . isEmpty ( ) ) continue ;
if ( item_path . isEmpty ( ) ) continue ;
// Append label
// Append label
if ( i = = 0 & & appendLabelToSavePath & & QDir ( item_path ) = = QDir ( defaultSavePath ) & & ! comboLabel - > currentText ( ) . isEmpty ( ) )
if ( i = = 0 & & m_ appendLabelToSavePath & & QDir ( item_path ) = = QDir ( m_ defaultSavePath) & & ! comboLabel - > currentText ( ) . isEmpty ( ) )
item_path + = comboLabel - > currentText ( ) + " / " ;
item_path + = comboLabel - > currentText ( ) + " / " ;
// Append root_folder or filename
// Append root_folder or filename
if ( ! root_folder_or_file_name . isEmpty ( ) )
if ( ! root_folder_or_file_name . isEmpty ( ) )
@ -765,13 +760,13 @@ QString torrentAdditionDialog::getTruncatedSavePath(QString save_path, QString*
save_path = misc : : expandPath ( save_path ) ;
save_path = misc : : expandPath ( save_path ) ;
QStringList parts = save_path . replace ( " \\ " , " / " ) . split ( " / " ) ;
QStringList parts = save_path . replace ( " \\ " , " / " ) . split ( " / " ) ;
// Remove torrent root folder
// Remove torrent root folder
if ( ! QDir ( save_path ) . exists ( ) | | ( ! is_m agnet & & t - > num_files ( ) = = 1 ) ) {
if ( ! QDir ( save_path ) . exists ( ) | | ( ! m_isM agnet & & m_ torrentInfo - > num_files ( ) = = 1 ) ) {
QString tmp = parts . takeLast ( ) ;
QString tmp = parts . takeLast ( ) ;
if ( root_folder_or_file_name )
if ( root_folder_or_file_name )
* root_folder_or_file_name = tmp ;
* root_folder_or_file_name = tmp ;
}
}
// Remove label
// Remove label
if ( appendLabelToSavePath & & savePathTxt - > currentIndex ( ) = = 0 & & parts . last ( ) = = comboLabel - > currentText ( ) ) {
if ( m_ appendLabelToSavePath & & savePathTxt - > currentIndex ( ) = = 0 & & parts . last ( ) = = comboLabel - > currentText ( ) ) {
parts . removeLast ( ) ;
parts . removeLast ( ) ;
}
}
QString truncated_path = parts . join ( " / " ) ;
QString truncated_path = parts . join ( " / " ) ;
@ -806,12 +801,12 @@ void torrentAdditionDialog::loadSavePathHistory() {
// Load save path history
// Load save path history
QStringList raw_path_history = settings . value ( " TorrentAdditionDlg/save_path_history " ) . toStringList ( ) ;
QStringList raw_path_history = settings . value ( " TorrentAdditionDlg/save_path_history " ) . toStringList ( ) ;
foreach ( const QString & sp , raw_path_history ) {
foreach ( const QString & sp , raw_path_history ) {
if ( QDir ( sp ) ! = QDir ( defaultSavePath ) ) {
if ( QDir ( sp ) ! = QDir ( m_ defaultSavePath) ) {
QString dsp = sp ;
QString dsp = sp ;
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
# if defined(Q_WS_WIN) || defined(Q_OS_OS2)
dsp . replace ( " / " , " \\ " ) ;
dsp . replace ( " / " , " \\ " ) ;
# endif
# endif
path_h istory < < sp ;
m_pathH istory < < sp ;
savePathTxt - > addItem ( dsp ) ;
savePathTxt - > addItem ( dsp ) ;
}
}
}
}