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