QWidget *NavFichiers::nouvelOnglet() { QSettings settings(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat); QString welcomeFolder = settings.value("dossier_accueil").toString(); if (!QDir(welcomeFolder).exists()) welcomeFolder = QDir::homePath(); VueDossier *vue = new VueDossier(this); connect(vue, SIGNAL(debutChargement()), this, SLOT(slotDebutChargement())); connect(vue, SIGNAL(finChargement()), this, SLOT(slotFinChargement())); connect(vue, SIGNAL(demandeUpdate()), this, SLOT(slotUpdateAffichage())); connect(vue, SIGNAL(openFileRequested(QString)), this, SLOT(slotOpenFile(QString))); vue->setChemin(welcomeFolder); vue->setViewMode(selectView->currentText()); vue->lister(); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(vue); layout->setContentsMargins(0, 0, 0, 0); QWidget *page = new QWidget; page->setLayout(layout); return page; }
Navigateur::Navigateur(): m_PointeurChargerRafraichir(new QToolButton(this)), m_barAddress (new QLineEdit(this)), m_barRecherche (new QLineEdit(this)), m_tabWidget (new QTabWidget(this->centralWidget())), m_currWebView (new QWebView(this->centralWidget())), m_pageAccueil ("http://www.globo.com"), m_rechercheDefault("Google") { // 1. creer Fenetre Principale this->resize(800, 600); this->setWindowTitle("zNavigo"); this->setWindowIcon(QIcon("images/icon-browser.png")); this->setAnimated(true); creerMenu(); // 2. creer menus creerActions(); // 3. creer actions creerToolBars(); // 4. creer barre d'outils creerWebView(); // 5. creer tabBar avec webView creerStatusBar(); // 6. creer barre de status // 7. Aller a la page d'acueil this->aller(m_pageAccueil); /// [CONNECTIONS] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // Faire la connection de la barre d'address pour changer la page QObject::connect(m_barAddress, SIGNAL(returnPressed()), this, SLOT(allerAPageAddress())); QObject::connect(m_currWebView, SIGNAL(loadProgress(int)), m_statusProgress, SLOT(setValue(int))); QObject::connect(m_currWebView, SIGNAL(loadStarted()), this, SLOT(debutChargement())); QObject::connect(m_currWebView, SIGNAL(loadFinished(bool)), this, SLOT(finChargement(bool))); // [MENU FICHIER]__________________________________________________________ // Faire la connection pour ouvrir un fichier html QObject::connect(m_actionOuvrir, SIGNAL(triggered()), this, SLOT(ouvrirHtml())); // Faire la connection pour ouvrir un lien QObject::connect(m_actionOuvrirLien, SIGNAL(triggered()), this, SLOT(ouvrirLien())); // Faire la connection pour sauvegarder page QObject::connect(m_actionSauvegarder, SIGNAL(triggered()), this, SLOT(sauvegarderPage())); // Faire la connection pour sauvegarder page sous QObject::connect(m_actionSauvegarderSous, SIGNAL(triggered()), this, SLOT(sauvegarderPageSous())); // Faire la connection pour imprimer page QObject::connect(m_actionImprimer, SIGNAL(triggered()), this, SLOT(imprimerPage())); // Faire la connection pour Quitter l'app QObject::connect(m_actionQuitter, SIGNAL(triggered()), qApp, SLOT(quit())); // ________________________________________________________________________ // [MENU EDITION]__________________________________________________________ QObject::connect(m_actionRechercher, SIGNAL(triggered()), this, SLOT(rechercher())); // ________________________________________________________________________ // [MENU AFFICHAGE]________________________________________________________ QObject::connect(m_actionArreterChargement, SIGNAL(triggered()), m_currWebView, SLOT(stop())); QObject::connect(m_actionRafraichir, SIGNAL(triggered()), m_currWebView, SLOT(reload())); // ________________________________________________________________________ // [MENU HISTORIQUE]________________________________________________________ QObject::connect(m_actionArriere, SIGNAL(triggered()), m_currWebView, SLOT(back())); QObject::connect(m_actionEnAvant, SIGNAL(triggered()), m_currWebView, SLOT(forward())); // ________________________________________________________________________ /// [END CONNECTIONS] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 9. keep looping }