adding debug

This commit is contained in:
Daniel Tartavel 2024-09-17 21:39:31 +02:00
parent 631ab3819e
commit d07905eff0

View File

@ -561,7 +561,7 @@ void MainWindow::listServices()
flag = true; flag = true;
break; break;
} }
info(DEBUGMACRO, "extracting services inforamtions"); info(DEBUGMACRO, "extracting services informations");
// extracting name and comment of the service // extracting name and comment of the service
v = line.split("\t"); v = line.split("\t");
v[0].replace(" ", ""); v[0].replace(" ", "");
@ -1029,23 +1029,26 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
str = "Folder/" + this->connexion.server + "/" + this->connexion.service; str = "Folder/" + this->connexion.server + "/" + this->connexion.service;
if(!this->settings.contains(str)) if(!this->settings.contains(str))
{ {
info(DEBUGMACRO, "saving path do not exists, asking for it");
// saving path do not exists, asking for it // saving path do not exists, asking for it
if(!on_DefaultSaveFolder_triggered()) if(!on_DefaultSaveFolder_triggered())
{ {
cout << "no directory selectioned, ignoring download request" << endl; info(DEBUGMACRO, "no directory selectioned, ignoring download request");
this->treeviewClicked = false; this->treeviewClicked = false;
return; return;
} }
}else }else
{ {
this->downloading.savePath = this->settings.value(str).toString(); this->downloading.savePath = this->settings.value(str).toString();
info(DEBUGMACRO, "saving folder" + this->downloading.savePath);
} }
// Item is a file // Item is a file
// searching if file exists in savepath // searching if file exists in savepath
info(DEBUGMACRO, "searching if file exists in savepath");
if (QFile::exists(this->downloading.savePath + "/" + path)) if (QFile::exists(this->downloading.savePath + "/" + path))
{ {
info(DEBUGMACRO, "file exists in savepath");
QFileInfo fileinfo(this->downloading.savePath + "/" + path); QFileInfo fileinfo(this->downloading.savePath + "/" + path);
if (fileinfo.size() < sizeFromRsync) if (fileinfo.size() < sizeFromRsync)
{ {
@ -1089,9 +1092,11 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty()) if(ui->listDownload->findItems(path, Qt::MatchStartsWith).empty())
{ {
// is there a downloading process ? // is there a downloading process ?
info(DEBUGMACRO, "is there a downloading process ?");
if (this->downloading.process == nullptr) if (this->downloading.process == nullptr)
{ {
// no downloading process launching it // no downloading process launching it
info(DEBUGMACRO, "no downloading process launching it");
this->downloading.path = path; this->downloading.path = path;
this->downloading.server = this->connexion.server; this->downloading.server = this->connexion.server;
this->downloading.port = this->connexion.port; this->downloading.port = this->connexion.port;
@ -1100,8 +1105,8 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
// wait 1 second to process start // wait 1 second to process start
//sleep(1); //sleep(1);
} }
info(DEBUGMACRO, "Downloading process exist, adding download to download list");
// Adding download in download list // Adding download to download list
str = path + " => " + this->connexion.server + "/" + this->connexion.service; str = path + " => " + this->connexion.server + "/" + this->connexion.service;
ui->listDownload->addItem(str); ui->listDownload->addItem(str);
}else }else
@ -1111,11 +1116,13 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
}else }else
{ {
//Item is a Directory //Item is a Directory
info(DEBUGMACRO, "Item is a Directory");
if (item->isExpanded() == false) if (item->isExpanded() == false)
{ {
info(DEBUGMACRO, "Item is not expanded");
while (this->rescan) while (this->rescan)
{ {
info(DEBUGMACRO, "Re-scanning path: " + this->connexion.service + "/" + path +"/");
scanDir(&this->connexion, item, this->connexion.service + "/" + path +"/"); scanDir(&this->connexion, item, this->connexion.service + "/" + path +"/");
item->setExpanded(true); item->setExpanded(true);
} }
@ -1124,8 +1131,10 @@ void MainWindow::on_treeWidget_itemClicked(QTreeWidgetItem *item, bool downloadD
if (config.autosaveCheckbox->checkState() == Qt::Checked) if (config.autosaveCheckbox->checkState() == Qt::Checked)
{ {
info(DEBUGMACRO, "Saving download list");
saveDownloadList(); saveDownloadList();
} }
info(DEBUGMACRO, "Exiting");
this->treeviewClicked = false; this->treeviewClicked = false;
} }