NavFichiers::NavFichiers(QWidget *parent) : QMainWindow(parent) { QSettings settings(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat); if (settings.value("view_type").toString().isEmpty()) settings.setValue("view_type", "Tableau"); selectView = new QComboBox; selectView->addItems(QStringList() << "Tableau" << "Liste"); selectView->setCurrentIndex(selectView->findText(settings.value("view_type").toString())); connect(selectView, SIGNAL(currentIndexChanged(QString)), this, SLOT(viewChanged(QString))); status = statusBar(); status->addPermanentWidget(new QLabel("Vue : ")); status->addPermanentWidget(selectView); creerActions(); QToolButton *buttonNewTab = new QToolButton; buttonNewTab->setDefaultAction(actionNouvelOnglet); buttonNewTab->setAutoRaise(true); QToolButton *buttonCloseTab = new QToolButton; buttonCloseTab->setDefaultAction(actionFermerOnglet); buttonCloseTab->setAutoRaise(true); onglets = new QTabWidget; onglets->setMovable(true); onglets->setDocumentMode(true); onglets->setCornerWidget(buttonNewTab, Qt::BottomLeftCorner); onglets->setCornerWidget(buttonCloseTab, Qt::BottomRightCorner); connect(onglets, SIGNAL(tabCloseRequested(int)), this, SLOT(slotFermerOnglet(int))); connect(onglets, SIGNAL(currentChanged(int)), this, SLOT(slotOngletChange(int))); ajouterOnglet(); onglets->setTabsClosable(false); setCentralWidget(onglets); QSettings reglages(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat); restoreState(reglages.value("etat_fenetre").toByteArray()); QShortcut *shortcutSwitchTab = new QShortcut(QKeySequence("Ctrl+Tab"), this); connect(shortcutSwitchTab, SIGNAL(activated()), this, SLOT(slotSwitchTab())); p_fenPrincipale = parent; p_navigateurWeb = NULL; m_copyCutObject = new CopyCutObject; }
/** * @brief Fonction pour creer le view des pages web */ void Navigateur::creerWebView() { m_tabWidget->setTabsClosable(true); this->setCentralWidget(m_tabWidget); m_currWebView = ajouterOnglet(); // pour faire le webView current }
void NavFichiers::creerActions() { toolBar = addToolBar("Raccourcis"); toolBar->setObjectName("Raccourcis"); toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); actionPrecedent = new QAction("Précédent", this); actionPrecedent->setIcon(QIcon(":/icones/nav_fichiers/actionPrecedent.png")); connect(actionPrecedent, SIGNAL(triggered()), this, SLOT(slotPrecedent())); toolBar->addAction(actionPrecedent); actionSuivant = new QAction("Suivant", this); actionSuivant->setIcon(QIcon(":/icones/nav_fichiers/actionSuivant.png")); connect(actionSuivant, SIGNAL(triggered()), this, SLOT(slotSuivant())); toolBar->addAction(actionSuivant); actionHaut = new QAction("Haut", this); actionHaut->setIcon(QIcon(":/icones/nav_fichiers/actionHaut.png")); connect(actionHaut, SIGNAL(triggered()), this, SLOT(slotHaut())); toolBar->addAction(actionHaut); actionActualiser = new QAction("Actualiser", this); actionActualiser->setIcon(QIcon(":/icones/nav_fichiers/actionActualiser.png")); connect(actionActualiser, SIGNAL(triggered()), this, SLOT(slotActualiser())); toolBar->addAction(actionActualiser); toolBar->addSeparator(); actionDossierPersonnel = new QAction("Dossier personnel", this); actionDossierPersonnel->setIcon(QIcon(":/icones/nav_fichiers/actionDossierPersonnel.png")); connect(actionDossierPersonnel, SIGNAL(triggered()), this, SLOT(slotDossierPersonnel())); toolBar->addAction(actionDossierPersonnel); actionDossierTelechargements = new QAction("Téléchargements", this); actionDossierTelechargements->setIcon(QIcon(":/icones/nav_fichiers/actionDossierTelechargements.png")); connect(actionDossierTelechargements, SIGNAL(triggered()), this, SLOT(slotDossierTelechargements())); toolBar->addAction(actionDossierTelechargements); actionDossiersCaches = new QAction("Éléments cachés", this); actionDossiersCaches->setIcon(QIcon(":/icones/nav_fichiers/actionDossiersCaches.png")); connect(actionDossiersCaches, SIGNAL(triggered()), this, SLOT(slotDossiersCaches())); toolBar->addAction(actionDossiersCaches); actionDossierRacine = new QAction("Racine", this); actionDossierRacine->setIcon(QIcon(":/icones/nav_fichiers/actionDossierRacine.png")); connect(actionDossierRacine, SIGNAL(triggered()), this, SLOT(slotDossierRacine())); toolBar->addAction(actionDossierRacine); actionDossierTmp = new QAction("Dossier temporaire", this); actionDossierTmp->setIcon(QIcon(":/icones/nav_fichiers/actionDossierTmp.png")); connect(actionDossierTmp, SIGNAL(triggered()), this, SLOT(slotDossierTmp())); toolBar->addAction(actionDossierTmp); addToolBarBreak(); toolBar2 = addToolBar("Adresse"); toolBar2->setObjectName("Adresse"); afficherCheminActuel = new LineEdit; connect(afficherCheminActuel, SIGNAL(returnPressed()), this, SLOT(slotGo())); toolBar2->addWidget(afficherCheminActuel); actionGo = new QAction("Go", this); actionGo->setIcon(QIcon(":/icones/nav_fichiers/actionGo.png")); connect(actionGo, SIGNAL(triggered()), this, SLOT(slotGo())); toolBar2->addAction(actionGo); actionNouvelOnglet = new QAction("Nouvel onglet", this); actionNouvelOnglet->setIcon(QIcon(":/icones/nav_fichiers/actionNouvelOnglet.png")); actionNouvelOnglet->setShortcut(QKeySequence("Ctrl+T")); connect(actionNouvelOnglet, SIGNAL(triggered()), this, SLOT(ajouterOnglet())); actionFermerOnglet = new QAction("Fermer l'onglet", this); actionFermerOnglet->setIcon(QIcon(":/icones/nav_fichiers/actionFermerOnglet.png")); actionFermerOnglet->setShortcut(QKeySequence("Ctrl+W")); actionFermerOnglet->setEnabled(false); connect(actionFermerOnglet, SIGNAL(triggered()), this, SLOT(slotFermerOnglet())); }