#include <fstream>
#include <iostream>
using namespace std;
#include "interface_impl.h"
{
cout << "interface_impl" << endl;
setupUi(this);
Listeur_appelant = appelant;
Masquer_checkBoxes();
MAJ_checkBoxes_racines();
connect(bouton_scan_plus_rep, SIGNAL(clicked()), this, SLOT(SLOT_ajouter_repertoire_scan()));
connect(bouton_scan_moins_rep, SIGNAL(clicked()), this, SLOT(SLOT_supprimer_repertoire_scan()));
connect(bouton_noscan_plus_rep, SIGNAL(clicked()), this, SLOT(SLOT_ajouter_repertoire_noscan()));
connect(bouton_noscan_moins_rep, SIGNAL(clicked()), this, SLOT(SLOT_supprimer_repertoire_noscan()));
connect(bouton_lister, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_liste_films()));
connect(bouton_rechercher, SIGNAL(clicked()), this, SLOT(SLOT_rechercher_synopsis_jaquettes_ALL()));
//connect(bouton_AC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_synopsis_jaquettes_AC()));
//connect(bouton_QLCS, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_synopsis_jaquettes_QLCS()));
//connect(bouton_VC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_sysnopsis_jaquettes_VC()));
//connect(bouton_MC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_jaquettes_MC()));
connect(tree, SIGNAL(itemSelectionChanged()), this, SLOT(SLOT_selection_changed()));
connect(bouton_ouvrir, SIGNAL(clicked()), this, SLOT(SLOT_ouvrir_selection()));
connect(bouton_lancer, SIGNAL(clicked()), this, SLOT(SLOT_lancer_selection()));
Charger_config();
}
void interface_impl::SLOT_rechercher_synopsis_jaquettes_ALL()
{
Listeur_appelant->Rechercher_jaquettes_synopsis();
}
void interface_impl::SLOT_actualiser_synopsis_jaquettes_AC()
{
Listeur_appelant->Utiliser_HTTP_AC();
}
void interface_impl::SLOT_actualiser_synopsis_jaquettes_QLCS()
{
Listeur_appelant->Utiliser_HTTP_QLCS();
}
void interface_impl::SLOT_actualiser_sysnopsis_jaquettes_VC()
{
Listeur_appelant->Utiliser_HTTP_VC();
}
void interface_impl::SLOT_actualiser_jaquettes_MC()
{
Listeur_appelant->Utiliser_HTTP_MC();
}
void interface_impl::SLOT_selection_changed()
{
cout << "\n\nSLOT_selection_changed" << endl;
liste_selection.clear();
//liste_selection = tree->selectedItems();
// ----------------------
// QTreeWidgetItem *item;
// QString item_path;
// QDir mon_dossier_cible;
// QFile mon_fichier_cible;
// QUrl mon_url;
// bool isDir;
// bool isFile;
// item = liste_selection.at(0);
// item_name = item->text(0);
// item_path = item->text(1);
item_name = ((tree->selectedItems()).at(0))->text(0);
tree->clear();
//QTimer::singleShot(0, tree, SLOT(clear()));
// mon_dossier_cible.setPath(item_path);
// mon_fichier_cible.setFileName(item_path);
// mon_url = QUrl::fromLocalFile(item_path);
// isDir = mon_dossier_cible.exists();
// isFile = mon_fichier_cible.exists();
//
// // L'objet sélectionné n'est pas un dossier
// if (isDir == false)
// {
// // Par contre c'est bien un fichier, donc un film
// if (isFile == true)
// {
// // On reconstruit le chemin d'accès au synopsis
// QString acces_synopsys = "./Synopsis/";
// acces_synopsys.append(item_name);
// acces_synopsys.append(".html");
//
// // On crée l'URL qui sera utilisée par le QTextBroxser de synopsis
// QUrl html_url;
// html_url = QUrl::fromLocalFile(acces_synopsys);
//
// // On met à jour le QTextBrowser du synopsis
// TB_Synopsis->setSource(html_url);
//
// // On reconstruit le nom complet de la jaquette (avec extension)
// QString item_name_stored = "";
// QDir dossier_synopsis("Jaquettes");
// QFileInfoList synopsis_fileInfoList = dossier_synopsis.entryInfoList();
// for(int i = 0; i < synopsis_fileInfoList.size(); ++i)
// {
// if(synopsis_fileInfoList.at(i).isFile()) // On peut avoir des DIR
// {
// if (synopsis_fileInfoList.at(i).baseName() == item_name) // Nom sans extension
// {
// item_name_stored = synopsis_fileInfoList.at(i).fileName(); // Nom avec extension
// i = synopsis_fileInfoList.size(); // Fin de parcours
// }
// }
// }
//
// if (item_name_stored == "") // La recherche n'a pas aboutit, ne devrait pas survenir
// {
// item_name_stored .append(item_name);
// item_name_stored .append(".jpg");
// }
//
// // On reconstruit le chemin d'accès à la jaquette
// QString acces_jaquette = "./Jaquettes/";
// acces_jaquette.append(item_name_stored);
//
// cout << "Accès jaquette : " << acces_jaquette.toStdString() << endl;
//
// // Affichage de l'image
// int hauteur_jaquette = (tree->height()) / 2; // 50% de la hauteur de l'interface
// QPixmap jaquette_pixmap;
// jaquette_pixmap.load(acces_jaquette); // Chargement de l'image dans le QPixmap
// jaquette_pixmap = jaquette_pixmap.scaledToHeight(hauteur_jaquette, Qt::SmoothTransformation); // Redimensionnement de l'image
// label_jaquette->setPixmap(jaquette_pixmap); // Affichage du QPixmap (et donc de l'image) dans le QLabel de l'interface
// }
// }
// else // L'objet sélectionné est un dossier
// {
// label_jaquette->clear();
// TB_Synopsis->clear();
// }
}
#include <fstream>
#include <iostream>
using namespace std;
#include "interface_impl.h"
interface_impl::interface_impl(Listeur *appelant, QWidget *parent) : QMainWindow(parent)
{
cout << "interface_impl" << endl;
setupUi(this);
Listeur_appelant = appelant;
Masquer_checkBoxes();
MAJ_checkBoxes_racines();
connect(bouton_scan_plus_rep, SIGNAL(clicked()), this, SLOT(SLOT_ajouter_repertoire_scan()));
connect(bouton_scan_moins_rep, SIGNAL(clicked()), this, SLOT(SLOT_supprimer_repertoire_scan()));
connect(bouton_noscan_plus_rep, SIGNAL(clicked()), this, SLOT(SLOT_ajouter_repertoire_noscan()));
connect(bouton_noscan_moins_rep, SIGNAL(clicked()), this, SLOT(SLOT_supprimer_repertoire_noscan()));
connect(bouton_lister, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_liste_films()));
connect(bouton_rechercher, SIGNAL(clicked()), this, SLOT(SLOT_rechercher_synopsis_jaquettes_ALL()));
//connect(bouton_AC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_synopsis_jaquettes_AC()));
//connect(bouton_QLCS, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_synopsis_jaquettes_QLCS()));
//connect(bouton_VC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_sysnopsis_jaquettes_VC()));
//connect(bouton_MC, SIGNAL(clicked()), this, SLOT(SLOT_actualiser_jaquettes_MC()));
connect(tree, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(SLOT_lancer_le_film(QTreeWidgetItem*, int)));
connect(tree, SIGNAL(itemSelectionChanged()), this, SLOT(SLOT_selection_changed()));
connect(bouton_ouvrir, SIGNAL(clicked()), this, SLOT(SLOT_ouvrir_selection()));
connect(bouton_lancer, SIGNAL(clicked()), this, SLOT(SLOT_lancer_selection()));
Charger_config();
}
void interface_impl::SLOT_rechercher_synopsis_jaquettes_ALL()
{
Listeur_appelant->Rechercher_jaquettes_synopsis();
}
void interface_impl::SLOT_actualiser_synopsis_jaquettes_AC()
{
Listeur_appelant->Utiliser_HTTP_AC();
}
void interface_impl::SLOT_actualiser_synopsis_jaquettes_QLCS()
{
Listeur_appelant->Utiliser_HTTP_QLCS();
}
void interface_impl::SLOT_actualiser_sysnopsis_jaquettes_VC()
{
Listeur_appelant->Utiliser_HTTP_VC();
}
void interface_impl::SLOT_actualiser_jaquettes_MC()
{
Listeur_appelant->Utiliser_HTTP_MC();
}
void interface_impl::SLOT_selection_changed()
{
cout << "\n\nSLOT_selection_changed" << endl;
liste_selection.clear();
//liste_selection = tree->selectedItems();
// ----------------------
// QTreeWidgetItem *item;
QString item_name;
// QString item_path;
// QDir mon_dossier_cible;
// QFile mon_fichier_cible;
// QUrl mon_url;
// bool isDir;
// bool isFile;
// item = liste_selection.at(0);
// item_name = item->text(0);
// item_path = item->text(1);
item_name = ((tree->selectedItems()).at(0))->text(0);
tree->clear();
//QTimer::singleShot(0, tree, SLOT(clear()));
// mon_dossier_cible.setPath(item_path);
// mon_fichier_cible.setFileName(item_path);
// mon_url = QUrl::fromLocalFile(item_path);
// isDir = mon_dossier_cible.exists();
// isFile = mon_fichier_cible.exists();
//
// // L'objet sélectionné n'est pas un dossier
// if (isDir == false)
// {
// // Par contre c'est bien un fichier, donc un film
// if (isFile == true)
// {
// // On reconstruit le chemin d'accès au synopsis
// QString acces_synopsys = "./Synopsis/";
// acces_synopsys.append(item_name);
// acces_synopsys.append(".html");
//
// // On crée l'URL qui sera utilisée par le QTextBroxser de synopsis
// QUrl html_url;
// html_url = QUrl::fromLocalFile(acces_synopsys);
//
// // On met à jour le QTextBrowser du synopsis
// TB_Synopsis->setSource(html_url);
//
// // On reconstruit le nom complet de la jaquette (avec extension)
// QString item_name_stored = "";
// QDir dossier_synopsis("Jaquettes");
// QFileInfoList synopsis_fileInfoList = dossier_synopsis.entryInfoList();
// for(int i = 0; i < synopsis_fileInfoList.size(); ++i)
// {
// if(synopsis_fileInfoList.at(i).isFile()) // On peut avoir des DIR
// {
// if (synopsis_fileInfoList.at(i).baseName() == item_name) // Nom sans extension
// {
// item_name_stored = synopsis_fileInfoList.at(i).fileName(); // Nom avec extension
// i = synopsis_fileInfoList.size(); // Fin de parcours
// }
// }
// }
//
// if (item_name_stored == "") // La recherche n'a pas aboutit, ne devrait pas survenir
// {
// item_name_stored .append(item_name);
// item_name_stored .append(".jpg");
// }
//
// // On reconstruit le chemin d'accès à la jaquette
// QString acces_jaquette = "./Jaquettes/";
// acces_jaquette.append(item_name_stored);
//
// cout << "Accès jaquette : " << acces_jaquette.toStdString() << endl;
//
// // Affichage de l'image
// int hauteur_jaquette = (tree->height()) / 2; // 50% de la hauteur de l'interface
// QPixmap jaquette_pixmap;
// jaquette_pixmap.load(acces_jaquette); // Chargement de l'image dans le QPixmap
// jaquette_pixmap = jaquette_pixmap.scaledToHeight(hauteur_jaquette, Qt::SmoothTransformation); // Redimensionnement de l'image
// label_jaquette->setPixmap(jaquette_pixmap); // Affichage du QPixmap (et donc de l'image) dans le QLabel de l'interface
// }
// }
// else // L'objet sélectionné est un dossier
// {
// label_jaquette->clear();
// TB_Synopsis->clear();
// }
}
To copy to clipboard, switch view to plain text mode
Bookmarks