Browse Source

- Use rootDir as default dir on Windows instead of homeDir

adaptive-webui-19844
Christophe Dumez 16 years ago
parent
commit
d883ef27be
  1. 20
      src/options_imp.cpp

20
src/options_imp.cpp

@ -493,7 +493,11 @@ void options_imp::loadOptions(){
settings.endGroup(); settings.endGroup();
// Downloads preferences // Downloads preferences
settings.beginGroup("Downloads"); settings.beginGroup("Downloads");
#ifdef Q_WS_WIN
QString home = QDir::rootPath();
#else
QString home = QDir::homePath(); QString home = QDir::homePath();
#endif
if(home[home.length()-1] != QDir::separator()){ if(home[home.length()-1] != QDir::separator()){
home += QDir::separator(); home += QDir::separator();
} }
@ -831,7 +835,11 @@ float options_imp::getDeleteRatio() const{
// Return Save Path // Return Save Path
QString options_imp::getSavePath() const{ QString options_imp::getSavePath() const{
#ifdef Q_WS_WIN
QString home = QDir::rootPath();
#else
QString home = QDir::homePath(); QString home = QDir::homePath();
#endif
if(home[home.length()-1] != QDir::separator()){ if(home[home.length()-1] != QDir::separator()){
home += QDir::separator(); home += QDir::separator();
} }
@ -1245,14 +1253,22 @@ int options_imp::getActionOnDblClOnTorrentFn() const {
// Display dialog to choose scan dir // Display dialog to choose scan dir
void options_imp::on_browseScanDirButton_clicked() { void options_imp::on_browseScanDirButton_clicked() {
#ifdef Q_WS_WIN
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::rootPath());
#else
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath()); QString dir = QFileDialog::getExistingDirectory(this, tr("Choose scan directory"), QDir::homePath());
#endif
if(!dir.isNull()){ if(!dir.isNull()){
textScanDir->setText(dir); textScanDir->setText(dir);
} }
} }
void options_imp::on_browseFilterButton_clicked() { void options_imp::on_browseFilterButton_clicked() {
#ifdef Q_WS_WIN
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::rootPath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)"));
#else
QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)")); QString ipfilter = QFileDialog::getOpenFileName(this, tr("Choose an ip filter file"), QDir::homePath(), tr("Filters")+QString(" (*.dat *.p2p *.p2b)"));
#endif
if(!ipfilter.isNull()){ if(!ipfilter.isNull()){
textFilterPath->setText(ipfilter); textFilterPath->setText(ipfilter);
} }
@ -1260,7 +1276,11 @@ void options_imp::on_browseFilterButton_clicked() {
// Display dialog to choose save dir // Display dialog to choose save dir
void options_imp::on_browseSaveDirButton_clicked(){ void options_imp::on_browseSaveDirButton_clicked(){
#ifdef Q_WS_WIN
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::rootPath());
#else
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath()); QString dir = QFileDialog::getExistingDirectory(this, tr("Choose a save directory"), QDir::homePath());
#endif
if(!dir.isNull()){ if(!dir.isNull()){
textSavePath->setText(dir); textSavePath->setText(dir);
} }

Loading…
Cancel
Save