From b3396c10a3f527e316fc588246d446b5432dbaf7 Mon Sep 17 00:00:00 2001 From: xavierqet Date: Sun, 19 Nov 2006 18:40:03 +0000 Subject: [PATCH] Ajout de la possibilite de modifier les attributs du schema : titre, auteur, date git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@30 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- ico/info.png | Bin 0 -> 1195 bytes qelectrotech.qrc | 1 + qetapp.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++----- qetapp.h | 2 ++ schema.h | 8 +++---- 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 ico/info.png diff --git a/ico/info.png b/ico/info.png new file mode 100644 index 0000000000000000000000000000000000000000..3626ba7ee6c9b77bac35febfa9503cc85f48114f GIT binary patch literal 1195 zcmV;c1XTNpP)YF`^5o zChb)K8aN+_9e%KKGkoO{WiZneVqo|WME}7A!}aSg7`{Jv$iVdWHOP_!K+6-~UC4ZZ zYz{yGp%|=|v@hWQzkl<8uy6~g8L2VE+X^xGs9^We;l~UNb9X&wIJo901Jj$AAAmkd z{CFdO156$ufZztJC4&t8zy2eSI76zxIzzl63s{_)iGe|ihk=0u$bI_u2g9px3=BNn z9B>OxKKRK{(t3#D`{gU3U<&+lzZ7gZKmajA4Bf8)G<5qX9&wJ8AZ-R8H715{zZt+- z5NL)lC&UmwE*6INDZ3ezwN>HrLfkA2M&`;4doO-u`2GC32P==$%HN;&egFs{CXfcO z_gT3Fd|lKT%%m8=u7cqYKTw0RhPhyc*l^FitW0*F~PVXpzu z;0``*U4}q?U}OPZfsCJgW?=XSjI;YUA23vOZD-(=R%DP=QN&Qk#>T?%icOf|+0pX~ z%xrcW0Ro8S|G&TaKUjGfOqB!~UVgzIQ9Hrn3JhAo3Sd4qbq_x=F#M2`XZR;9%JBc$ zvwVO6VgV(quY#fsLO}1l_=>7HRFi>0h7ZCP;)H~E!SwSCe-sVDV();#bm=t%!=3jG z3_t%u)G;ZmGcZ1S>;MozAcGZnLLbHLs9s?tk5pD<{J1_$r-p6ou<6~fX@)H!mVDYbyS2M72`ZI7U z7{k>*U9*wl&$DMAfXqY?A0U9>#io$K^Z;PeThFVe#vtKf$H2_NPE;!S^X)ss{S_M- z-W)#-;syd;3obSR0tls`7tov(04kk0MT7(t-5nSNl;rRl`u6%=h8s&aFnoRlb7>#E zpa%#bjH-!OsTWwk{h1F;Ee<^5A`IfdvR6b+9-Q{T$qz`px_X!4>FLW1A0L7v>HySG zl&T3JfEaPPhEu%70BAuzu);*COo2r#IGsWboCq`!Yh?-$U;w6N`1tF4c>DkW002ov JPDHLkV1ml?7-s+g literal 0 HcmV?d00001 diff --git a/qelectrotech.qrc b/qelectrotech.qrc index 6b2c63667..21739df12 100644 --- a/qelectrotech.qrc +++ b/qelectrotech.qrc @@ -14,6 +14,7 @@ ico/export.png ico/fileclose.png ico/import.png + ico/info.png ico/masquer.png ico/move.png ico/new.png diff --git a/qetapp.cpp b/qetapp.cpp index 600c68cb2..f695457ac 100644 --- a/qetapp.cpp +++ b/qetapp.cpp @@ -225,6 +225,7 @@ void QETApp::actions() { sel_inverse = new QAction( tr("Inverser la s\351lection"), this); supprimer = new QAction(QIcon(":/ico/delete.png"), tr("Supprimer"), this); pivoter = new QAction(QIcon(":/ico/pivoter.png"), tr("Pivoter"), this); + infos_schema = new QAction(QIcon(":/ico/info.png"), tr("Informations sur le sch\351ma"), this); toggle_aa = new QAction( tr("D\351sactiver l'&antialiasing"), this); zoom_avant = new QAction(QIcon(":/ico/viewmag+.png"), tr("Zoom avant"), this); @@ -305,6 +306,7 @@ void QETApp::actions() { sel_inverse -> setStatusTip(tr("D\351s\351lectionne les \351l\351ments s\351lectionn\351s et s\351lectionne les \351l\351ments non s\351lectionn\351s")); supprimer -> setStatusTip(tr("Enl\350ve les \351l\351ments s\351lectionn\351s du sch\351ma")); pivoter -> setStatusTip(tr("Pivote les \351l\351ments s\351lectionn\351s")); + infos_schema -> setStatusTip(tr("\311dite les informations affich\351es par le cartouche")); toggle_aa -> setStatusTip(tr("Active / d\351sactive l'antialiasing pour le rendu du sch\351ma courant")); zoom_avant -> setStatusTip(tr("Agrandit le sch\351ma")); @@ -368,11 +370,12 @@ void QETApp::actions() { connect(copier, SIGNAL(triggered()), this, SLOT(slot_copier()) ); connect(coller, SIGNAL(triggered()), this, SLOT(slot_coller()) ); connect(toggle_aa, SIGNAL(triggered()), this, SLOT(toggleAntialiasing()) ); - connect(f_mosaique, SIGNAL(triggered()), &workspace, SLOT(tile())); - connect(f_cascade, SIGNAL(triggered()), &workspace, SLOT(cascade())); - connect(f_reorganise, SIGNAL(triggered()), &workspace, SLOT(arrangeIcons())); - connect(f_suiv, SIGNAL(triggered()), &workspace, SLOT(activateNextWindow())); - connect(f_prec, SIGNAL(triggered()), &workspace, SLOT(activatePreviousWindow())); + connect(f_mosaique, SIGNAL(triggered()), &workspace, SLOT(tile()) ); + connect(f_cascade, SIGNAL(triggered()), &workspace, SLOT(cascade()) ); + connect(f_reorganise, SIGNAL(triggered()), &workspace, SLOT(arrangeIcons()) ); + connect(f_suiv, SIGNAL(triggered()), &workspace, SLOT(activateNextWindow()) ); + connect(f_prec, SIGNAL(triggered()), &workspace, SLOT(activatePreviousWindow()) ); + connect(infos_schema, SIGNAL(activated()), this, SLOT(editInfos()) ); } /** @@ -423,6 +426,8 @@ void QETApp::menus() { menu_edition -> addSeparator(); menu_edition -> addAction(supprimer); menu_edition -> addAction(pivoter); + menu_edition -> addSeparator(); + menu_edition -> addAction(infos_schema); // menu Affichage > Afficher QMenu *menu_aff_aff = new QMenu(tr("Afficher")); @@ -747,6 +752,7 @@ void QETApp::slot_updateActions() { zoom_adapte -> setEnabled(document_ouvert); zoom_reset -> setEnabled(document_ouvert); toggle_aa -> setEnabled(document_ouvert); + infos_schema -> setEnabled(document_ouvert); // actions ayant aussi besoin d'un historique des actions annuler -> setEnabled(document_ouvert); @@ -926,3 +932,44 @@ QString QETApp::languagesPath() { return(QDir::current().path() + "/lang/"); } +void QETApp::editInfos() { + // ne fait rien s'il n'y a pas de schema ouvert + SchemaVue *sv = schemaEnCours(); + if (!sv) return; + + // construit le dialogue + QDialog popup; + popup.setMinimumWidth(400); + popup.setWindowTitle(tr("Cartouche du sch\351ma")); + + QLineEdit *titre = new QLineEdit(sv -> scene -> titre); + QLineEdit *auteur = new QLineEdit(sv -> scene -> auteur); + QDate date_schema = QDate(sv -> scene -> date); + if (date_schema.isNull() || !date_schema.isValid()) date_schema = QDate::currentDate(); + QDateEdit *date = new QDateEdit(date_schema); + date -> setCalendarPopup(true); + QWidget bidon; + QGridLayout layout_champs(&bidon); + layout_champs.addWidget(new QLabel(tr("Titre : ")), 0, 0); + layout_champs.addWidget(titre, 0, 1); + layout_champs.addWidget(new QLabel(tr("Auteur : ")), 1, 0); + layout_champs.addWidget(auteur, 1, 1); + layout_champs.addWidget(new QLabel(tr("Date : ")), 2, 0); + layout_champs.addWidget(date, 2, 1); + + // boutons + QDialogButtonBox boutons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + connect(&boutons, SIGNAL(accepted()), &popup, SLOT(accept())); + connect(&boutons, SIGNAL(rejected()), &popup, SLOT(accept())); + + // ajout dans une disposition verticale + QVBoxLayout layout_v(&popup); + layout_v.addWidget(&bidon); + layout_v.addWidget(&boutons); + if (popup.exec() == QDialog::Accepted) { + sv -> scene -> titre = titre -> text(); + sv -> scene -> auteur = auteur -> text(); + sv -> scene -> date = date -> date(); + + } +} diff --git a/qetapp.h b/qetapp.h index c9183ae44..33c2cf939 100644 --- a/qetapp.h +++ b/qetapp.h @@ -30,6 +30,7 @@ void toggleFullScreen(); void toggleAntialiasing(); void aPropos(); + void editInfos(); void dialogue_imprimer(); void dialogue_exporter(); bool dialogue_enregistrer_sous(); @@ -62,6 +63,7 @@ QAction *supprimer; QAction *selectionner; QAction *pivoter; + QAction *infos_schema; QAction *poser_fil; QAction *masquer_appli; QAction *restaurer_appli; diff --git a/schema.h b/schema.h index 426932bae..42ff34539 100644 --- a/schema.h +++ b/schema.h @@ -26,16 +26,16 @@ bool fromXml(QDomDocument &, QPointF = QPointF()); QGraphicsItem *getElementById(uint id); inline void setAffichageGrille(bool ddg) { doit_dessiner_grille = ddg; } - - private: - QGraphicsLineItem *poseur_de_conducteur; - bool doit_dessiner_grille; // elements du cartouche QString auteur; QDate date; QString titre; QString folio; // vraiment necessaire ce truc ? QString nom_fichier; // meme remarque + + private: + QGraphicsLineItem *poseur_de_conducteur; + bool doit_dessiner_grille; Element *elementFromXml(QDomElement &e, QHash &); private slots: