mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-19 14:50:53 +01:00
Factorisation de code : ajout de la classe InsetPropertiesWidget
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@218 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -57,56 +57,7 @@ NewDiagramPage::NewDiagramPage(QWidget *parent) : ConfigPage(parent) {
|
||||
diagram_size_box_layout -> addWidget(ds2, 1, 0);
|
||||
diagram_size_box_layout -> addWidget(columns_height, 1, 1);
|
||||
|
||||
QGroupBox *inset_infos = new QGroupBox(tr("Informations du cartouche"), this);
|
||||
inset_infos -> setMinimumWidth(300);
|
||||
|
||||
inset_title = new QLineEdit(settings.value("diagrameditor/defaulttitle").toString(), this);
|
||||
inset_author = new QLineEdit(settings.value("diagrameditor/defaultauthor").toString(), this);
|
||||
|
||||
QButtonGroup *date_policy_group = new QButtonGroup(this);
|
||||
inset_no_date = new QRadioButton(tr("Pas de date"), this);
|
||||
inset_current_date = new QRadioButton(tr("Date courante"), this);
|
||||
inset_fixed_date = new QRadioButton(tr("Date fixe : "), this);
|
||||
date_policy_group -> addButton(inset_no_date);
|
||||
date_policy_group -> addButton(inset_current_date);
|
||||
date_policy_group -> addButton(inset_fixed_date);
|
||||
QString settings_date = settings.value("diagrameditor/defaultdate").toString();
|
||||
QDate date_diagram;
|
||||
if (settings_date == "now") {
|
||||
date_diagram = QDate::currentDate();
|
||||
inset_current_date -> setChecked(true);
|
||||
} else if (settings_date.isEmpty() || settings_date == "null") {
|
||||
date_diagram = QDate();
|
||||
inset_no_date -> setChecked(true);
|
||||
} else {
|
||||
date_diagram = QDate::fromString(settings_date, "yyyyMMdd");
|
||||
inset_fixed_date -> setChecked(true);
|
||||
}
|
||||
inset_date = new QDateEdit(date_diagram, this);
|
||||
inset_date -> setEnabled(inset_fixed_date -> isChecked());
|
||||
connect(inset_fixed_date, SIGNAL(toggled(bool)), inset_date, SLOT(setEnabled(bool)));
|
||||
inset_date -> setCalendarPopup(true);
|
||||
|
||||
QGridLayout *layout_date = new QGridLayout();
|
||||
layout_date -> addWidget(inset_no_date, 0, 0);
|
||||
layout_date -> addWidget(inset_current_date, 1, 0);
|
||||
layout_date -> addWidget(inset_fixed_date, 2, 0);
|
||||
layout_date -> addWidget(inset_date, 2, 1);
|
||||
|
||||
inset_filename = new QLineEdit(settings.value("diagrameditor/defaultfilename").toString(), this);
|
||||
inset_folio = new QLineEdit(settings.value("diagrameditor/defaultfolio").toString(), this);
|
||||
QGridLayout *layout_champs = new QGridLayout(inset_infos);
|
||||
|
||||
layout_champs -> addWidget(new QLabel(tr("Titre : ")), 0, 0);
|
||||
layout_champs -> addWidget(inset_title, 0, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Auteur : ")), 1, 0);
|
||||
layout_champs -> addWidget(inset_author, 1, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Date : ")), 2, 0);
|
||||
layout_champs -> addLayout(layout_date, 3, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Fichier : ")), 4, 0);
|
||||
layout_champs -> addWidget(inset_filename, 4, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Folio : ")), 5, 0);
|
||||
layout_champs -> addWidget(inset_folio, 5, 1);
|
||||
ipw = new InsetPropertiesWidget(QETDiagramEditor::defaultInsetProperties(), true, this);
|
||||
|
||||
// proprietes par defaut des conducteurs
|
||||
ConductorProperties cp;
|
||||
@@ -114,7 +65,7 @@ NewDiagramPage::NewDiagramPage(QWidget *parent) : ConfigPage(parent) {
|
||||
cpw = new ConductorPropertiesWidget(cp);
|
||||
|
||||
vlayout2 -> addWidget(diagram_size_box);
|
||||
vlayout2 -> addWidget(inset_infos);
|
||||
vlayout2 -> addWidget(ipw);
|
||||
hlayout1 -> addLayout(vlayout2);
|
||||
hlayout1 -> addWidget(cpw);
|
||||
vlayout1 -> addLayout(hlayout1);
|
||||
@@ -139,14 +90,18 @@ void NewDiagramPage::applyConf() {
|
||||
settings.setValue("diagrameditor/defaultheight", columns_height -> value());
|
||||
|
||||
// proprietes du cartouche
|
||||
settings.setValue("diagrameditor/defaulttitle", inset_title -> text());
|
||||
settings.setValue("diagrameditor/defaultauthor", inset_author -> text());
|
||||
settings.setValue("diagrameditor/defaultfilename", inset_filename -> text());
|
||||
settings.setValue("diagrameditor/defaultfolio", inset_folio -> text());
|
||||
InsetProperties inset = ipw-> insetProperties();
|
||||
settings.setValue("diagrameditor/defaulttitle", inset.title);
|
||||
settings.setValue("diagrameditor/defaultauthor", inset.author);
|
||||
settings.setValue("diagrameditor/defaultfilename", inset.filename);
|
||||
settings.setValue("diagrameditor/defaultfolio", inset.folio);
|
||||
QString date_setting_value;
|
||||
if (inset_no_date -> isChecked()) date_setting_value = "null";
|
||||
else if (inset_current_date -> isChecked()) date_setting_value = "now";
|
||||
else date_setting_value = inset_date -> date().toString("yyyyMMdd");
|
||||
if (inset.useDate == InsetProperties::UseDateValue) {
|
||||
if (inset.date.isNull()) date_setting_value = "null";
|
||||
else date_setting_value = inset.date.toString("yyyyMMdd");
|
||||
} else {
|
||||
date_setting_value = "now";
|
||||
}
|
||||
settings.setValue("diagrameditor/defaultdate", date_setting_value);
|
||||
|
||||
// proprietes par defaut des conducteurs
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define CONFIG_PAGES_H
|
||||
#include <QtGui>
|
||||
#include "conductorpropertieswidget.h"
|
||||
#include "insetpropertieswidget.h"
|
||||
|
||||
/**
|
||||
Cette classe abstraite contient les methodes que toutes les pages de
|
||||
@@ -40,14 +41,7 @@ class NewDiagramPage : public ConfigPage {
|
||||
QSpinBox *columns_count;
|
||||
QSpinBox *columns_width;
|
||||
QSpinBox *columns_height;
|
||||
QLineEdit *inset_title;
|
||||
QLineEdit *inset_author;
|
||||
QDateEdit *inset_date;
|
||||
QLineEdit *inset_filename;
|
||||
QLineEdit *inset_folio;
|
||||
QRadioButton *inset_no_date;
|
||||
QRadioButton *inset_current_date;
|
||||
QRadioButton *inset_fixed_date;
|
||||
InsetPropertiesWidget *ipw;
|
||||
ConductorPropertiesWidget *cpw;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "conductor.h"
|
||||
#include "diagramcommands.h"
|
||||
#include "conductorpropertieswidget.h"
|
||||
#include "insetpropertieswidget.h"
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@@ -588,44 +589,7 @@ void DiagramView::dialogEditInfos() {
|
||||
diagram_size_box_layout.addWidget(ds2, 1, 0);
|
||||
diagram_size_box_layout.addWidget(columns_height, 1, 1);
|
||||
|
||||
QGroupBox *inset_infos = new QGroupBox(tr("Informations du cartouche"), &popup);
|
||||
|
||||
QLineEdit *titre = new QLineEdit(inset.title, &popup);
|
||||
QLineEdit *auteur = new QLineEdit(inset.author, &popup);
|
||||
|
||||
QButtonGroup *date_policy_group = new QButtonGroup(this);
|
||||
QRadioButton *inset_no_date = new QRadioButton(tr("Pas de date"));
|
||||
QRadioButton *inset_fixed_date = new QRadioButton(tr("Date fixe : "));
|
||||
date_policy_group -> addButton(inset_no_date);
|
||||
date_policy_group -> addButton(inset_fixed_date);
|
||||
|
||||
QDate date_diagram(inset.date);
|
||||
inset_no_date -> setChecked(date_diagram.isNull());
|
||||
inset_fixed_date -> setChecked(!date_diagram.isNull());
|
||||
QDateEdit *date = new QDateEdit(date_diagram.isNull() ? QDate::currentDate() : date_diagram);
|
||||
date -> setCalendarPopup(true);
|
||||
date -> setEnabled(inset_fixed_date -> isChecked());
|
||||
connect(inset_fixed_date, SIGNAL(toggled(bool)), date, SLOT(setEnabled(bool)));
|
||||
|
||||
QLineEdit *fichier = new QLineEdit(inset.filename, &popup);
|
||||
QLineEdit *folio = new QLineEdit(inset.folio, &popup);
|
||||
QGridLayout layout_champs(inset_infos);
|
||||
|
||||
QGridLayout *layout_date = new QGridLayout();
|
||||
layout_date -> addWidget(inset_no_date, 0, 0);
|
||||
layout_date -> addWidget(inset_fixed_date, 1, 0);
|
||||
layout_date -> addWidget(date, 1, 1);
|
||||
|
||||
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.addLayout(layout_date, 3, 1);
|
||||
layout_champs.addWidget(new QLabel(tr("Fichier : ")), 4, 0);
|
||||
layout_champs.addWidget(fichier, 4, 1);
|
||||
layout_champs.addWidget(new QLabel(tr("Folio : ")), 5, 0);
|
||||
layout_champs.addWidget(folio, 5, 1);
|
||||
InsetPropertiesWidget *inset_infos = new InsetPropertiesWidget(inset, false, &popup);
|
||||
|
||||
// boutons
|
||||
QDialogButtonBox boutons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
@@ -639,19 +603,14 @@ void DiagramView::dialogEditInfos() {
|
||||
layout_v.addWidget(&boutons);
|
||||
// si le dialogue est accepte
|
||||
if (popup.exec() == QDialog::Accepted) {
|
||||
InsetProperties new_inset;
|
||||
new_inset.title = titre -> text();
|
||||
new_inset.author = auteur -> text();
|
||||
new_inset.date = inset_no_date -> isChecked() ? QDate() : date -> date();
|
||||
new_inset.filename = fichier -> text();
|
||||
new_inset.folio = folio -> text();
|
||||
InsetProperties new_inset = inset_infos -> insetProperties();
|
||||
|
||||
// s'il y a des modifications au cartouche
|
||||
if (new_inset != inset) {
|
||||
scene -> undoStack().push(new ChangeInsetCommand(scene, inset, new_inset));
|
||||
}
|
||||
|
||||
// s'il y a des modifications
|
||||
// s'il y a des modifications aux dimensions du schema
|
||||
if (
|
||||
columns_count_value != columns_count -> value() ||\
|
||||
columns_width_value != columns_width -> value() ||\
|
||||
|
||||
42
insetproperties.cpp
Normal file
42
insetproperties.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "insetproperties.h"
|
||||
|
||||
/// Constructeur
|
||||
InsetProperties::InsetProperties() {
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
InsetProperties::~InsetProperties() {
|
||||
}
|
||||
|
||||
/**
|
||||
@param ip autre conteneur InsetProperties
|
||||
@return true si ip et ce conteneur sont identiques, false sinon
|
||||
*/
|
||||
bool InsetProperties::operator==(const InsetProperties &ip) {
|
||||
return(
|
||||
ip.title == title &&\
|
||||
ip.author == author &&\
|
||||
ip.date == date &&\
|
||||
ip.filename == filename &&\
|
||||
ip.folio == folio
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@param ip autre conteneur InsetProperties
|
||||
@return false si ip et ce conteneur sont identiques, true sinon
|
||||
*/
|
||||
bool InsetProperties::operator!=(const InsetProperties &ip) {
|
||||
return(!(*this == ip));
|
||||
}
|
||||
|
||||
/**
|
||||
@return La date a utiliser
|
||||
*/
|
||||
QDate InsetProperties::finalDate() const {
|
||||
if (useDate == UseDateValue) {
|
||||
return(date);
|
||||
} else {
|
||||
return(QDate::currentDate());
|
||||
}
|
||||
}
|
||||
@@ -8,37 +8,23 @@
|
||||
*/
|
||||
class InsetProperties {
|
||||
public:
|
||||
/// Constructeur
|
||||
InsetProperties() {
|
||||
}
|
||||
/// Destructeur
|
||||
virtual ~InsetProperties() {
|
||||
}
|
||||
/**
|
||||
@param ip autre conteneur InsetProperties
|
||||
@return true si ip et ce conteneur sont identiques, false sinon
|
||||
*/
|
||||
bool operator==(const InsetProperties &ip) {
|
||||
return(
|
||||
ip.title == title &&\
|
||||
ip.author == author &&\
|
||||
ip.date == date &&\
|
||||
ip.filename == filename &&\
|
||||
ip.folio == folio
|
||||
);
|
||||
}
|
||||
/**
|
||||
@param ip autre conteneur InsetProperties
|
||||
@return false si ip et ce conteneur sont identiques, true sinon
|
||||
*/
|
||||
bool operator!=(const InsetProperties &ip) {
|
||||
return(!(*this == ip));
|
||||
}
|
||||
InsetProperties();
|
||||
virtual ~InsetProperties();
|
||||
enum DateManagement {
|
||||
UseDateValue, ///< utilise l'attribut date
|
||||
CurrentDate ///< utilise la date courante
|
||||
};
|
||||
|
||||
bool operator==(const InsetProperties &);
|
||||
bool operator!=(const InsetProperties &);
|
||||
QDate finalDate() const ;
|
||||
|
||||
// attributs
|
||||
QString title;
|
||||
QString author;
|
||||
QDate date;
|
||||
QString filename;
|
||||
QString folio;
|
||||
QString title; ///< Titre affiche par le cartouche
|
||||
QString author; ///< Auteur affiche par le cartouche
|
||||
QDate date; ///< Date affichee par le cartouche ; si la date est nulle, le champ reste vide
|
||||
QString filename; ///< Nom de fichier affiche par le cartouche
|
||||
QString folio; ///< Folio affiche par le cartouche
|
||||
DateManagement useDate; ///< Indique s'il faut utiliser ou non l'attribut date
|
||||
};
|
||||
#endif
|
||||
|
||||
126
insetpropertieswidget.cpp
Normal file
126
insetpropertieswidget.cpp
Normal file
@@ -0,0 +1,126 @@
|
||||
#include "insetpropertieswidget.h"
|
||||
#include "qetapp.h"
|
||||
|
||||
/**
|
||||
Constructeur
|
||||
@param inset InsetProperties a afficher
|
||||
@param fixed true pour afficher l'option "Date courante"
|
||||
@param parent QWidget parent
|
||||
*/
|
||||
InsetPropertiesWidget::InsetPropertiesWidget(const InsetProperties &inset, bool current, QWidget *parent) : QWidget(parent), display_current_date(false) {
|
||||
|
||||
QVBoxLayout *this_layout = new QVBoxLayout(this);
|
||||
this_layout -> setContentsMargins(0, 0, 0, 0);
|
||||
QGroupBox *inset_infos = new QGroupBox(tr("Informations du cartouche"), this);
|
||||
inset_infos -> setMinimumWidth(300);
|
||||
this_layout -> addWidget(inset_infos);
|
||||
|
||||
inset_title = new QLineEdit(this);
|
||||
inset_author = new QLineEdit(this);
|
||||
|
||||
QButtonGroup *date_policy_group = new QButtonGroup(this);
|
||||
inset_no_date = new QRadioButton(tr("Pas de date"), this);
|
||||
inset_current_date = new QRadioButton(tr("Date courante"), this);
|
||||
inset_fixed_date = new QRadioButton(tr("Date fixe : "), this);
|
||||
date_policy_group -> addButton(inset_no_date);
|
||||
date_policy_group -> addButton(inset_current_date);
|
||||
date_policy_group -> addButton(inset_fixed_date);
|
||||
inset_date = new QDateEdit(QDate::currentDate(), this);
|
||||
inset_date -> setEnabled(inset_fixed_date -> isChecked());
|
||||
inset_current_date -> setVisible(display_current_date);
|
||||
connect(inset_fixed_date, SIGNAL(toggled(bool)), inset_date, SLOT(setEnabled(bool)));
|
||||
inset_date -> setCalendarPopup(true);
|
||||
|
||||
QGridLayout *layout_date = new QGridLayout();
|
||||
layout_date -> addWidget(inset_no_date, 0, 0);
|
||||
layout_date -> addWidget(inset_current_date, 1, 0);
|
||||
layout_date -> addWidget(inset_fixed_date, 2, 0);
|
||||
layout_date -> addWidget(inset_date, 2, 1);
|
||||
|
||||
inset_filename = new QLineEdit(this);
|
||||
inset_folio = new QLineEdit(this);
|
||||
QGridLayout *layout_champs = new QGridLayout(inset_infos);
|
||||
|
||||
layout_champs -> addWidget(new QLabel(tr("Titre : ")), 0, 0);
|
||||
layout_champs -> addWidget(inset_title, 0, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Auteur : ")), 1, 0);
|
||||
layout_champs -> addWidget(inset_author, 1, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Date : ")), 2, 0);
|
||||
layout_champs -> addLayout(layout_date, 3, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Fichier : ")), 4, 0);
|
||||
layout_champs -> addWidget(inset_filename, 4, 1);
|
||||
layout_champs -> addWidget(new QLabel(tr("Folio : ")), 5, 0);
|
||||
layout_champs -> addWidget(inset_folio, 5, 1);
|
||||
|
||||
inset_current_date -> setVisible(display_current_date = current);
|
||||
setInsetProperties(inset);
|
||||
setLayout(this_layout);
|
||||
}
|
||||
|
||||
/// Destructeur
|
||||
InsetPropertiesWidget::~InsetPropertiesWidget() {
|
||||
}
|
||||
|
||||
/**
|
||||
@return Les proprietes affichees par le widget
|
||||
*/
|
||||
InsetProperties InsetPropertiesWidget::insetProperties() const {
|
||||
InsetProperties prop;
|
||||
prop.title = inset_title -> text();
|
||||
prop.author = inset_author -> text();
|
||||
prop.filename = inset_filename -> text();
|
||||
prop.folio = inset_folio -> text();
|
||||
if (inset_no_date -> isChecked()) {
|
||||
prop.useDate = InsetProperties::UseDateValue;
|
||||
prop.date = QDate();
|
||||
} else if (inset_fixed_date -> isChecked()) {
|
||||
prop.useDate = InsetProperties::UseDateValue;
|
||||
prop.date = inset_date -> date();
|
||||
} else if (display_current_date && inset_current_date -> isChecked()) {
|
||||
prop.useDate = InsetProperties::CurrentDate;
|
||||
prop.date = QDate::currentDate();
|
||||
}
|
||||
return(prop);
|
||||
}
|
||||
|
||||
/**
|
||||
Specifie les proprietes que le widget doit afficher
|
||||
@param inset nouvelles proprietes affichees par le widget
|
||||
*/
|
||||
void InsetPropertiesWidget::setInsetProperties(const InsetProperties &inset) {
|
||||
inset_title -> setText(inset.title);
|
||||
inset_author -> setText(inset.author);
|
||||
inset_filename -> setText(inset.filename);
|
||||
inset_folio -> setText(inset.folio);
|
||||
if (display_current_date) {
|
||||
if (inset.useDate == InsetProperties::CurrentDate) {
|
||||
inset_current_date -> setChecked(true);
|
||||
} else {
|
||||
if (inset.date.isNull()) {
|
||||
inset_no_date -> setChecked(true);
|
||||
} else {
|
||||
inset_fixed_date -> setChecked(true);
|
||||
inset_date -> setDate(inset.date);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (inset.useDate == InsetProperties::CurrentDate) {
|
||||
inset_fixed_date -> setChecked(true);
|
||||
inset_date -> setDate(QDate::currentDate());
|
||||
} else {
|
||||
if (inset.date.isNull()) {
|
||||
inset_no_date -> setChecked(true);
|
||||
} else {
|
||||
inset_fixed_date -> setChecked(true);
|
||||
inset_date -> setDate(inset.date);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@return true si le widget affiche la proposition "Date courante", false sinon
|
||||
*/
|
||||
bool InsetPropertiesWidget::displayCurrentDate() const {
|
||||
return(display_current_date);
|
||||
}
|
||||
36
insetpropertieswidget.h
Normal file
36
insetpropertieswidget.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef INSET_PROPERTIES_WIDGET_H
|
||||
#define INSET_PROPERTIES_WIDGET_H
|
||||
#include <QtGui>
|
||||
#include "insetproperties.h"
|
||||
/**
|
||||
Ce widget permet d'editer un objet InsetProperties, c'est-a-dire les
|
||||
valeurs affichees par le cartouche d'un schema.
|
||||
*/
|
||||
class InsetPropertiesWidget : public QWidget {
|
||||
Q_OBJECT
|
||||
// constructeurs, destructeur
|
||||
public:
|
||||
InsetPropertiesWidget(const InsetProperties &inset = InsetProperties(), bool = false, QWidget * = 0);
|
||||
virtual ~InsetPropertiesWidget();
|
||||
private:
|
||||
InsetPropertiesWidget(const InsetPropertiesWidget &);
|
||||
|
||||
// methodes
|
||||
public:
|
||||
InsetProperties insetProperties() const;
|
||||
void setInsetProperties(const InsetProperties &);
|
||||
bool displayCurrentDate() const;
|
||||
|
||||
// attributs
|
||||
private:
|
||||
QLineEdit *inset_title;
|
||||
QLineEdit *inset_author;
|
||||
QDateEdit *inset_date;
|
||||
QLineEdit *inset_filename;
|
||||
QLineEdit *inset_folio;
|
||||
QRadioButton *inset_no_date;
|
||||
QRadioButton *inset_current_date;
|
||||
QRadioButton *inset_fixed_date;
|
||||
bool display_current_date;
|
||||
};
|
||||
#endif
|
||||
@@ -38,13 +38,18 @@ HEADERS += aboutqet.h \
|
||||
borderinset.h \
|
||||
conductor.h \
|
||||
conductorprofile.h \
|
||||
conductorproperties.h \
|
||||
conductorpropertieswidget.h \
|
||||
conductorsegment.h \
|
||||
conductorsegmentprofile.h \
|
||||
configdialog.h \
|
||||
configpages.h \
|
||||
customelement.h \
|
||||
diagram.h \
|
||||
diagramcommands.h \
|
||||
diagramcontent.h \
|
||||
diagramview.h \
|
||||
diagramtextitem.h \
|
||||
element.h \
|
||||
elementdeleter.h \
|
||||
elementscategorieslist.h \
|
||||
@@ -58,6 +63,8 @@ HEADERS += aboutqet.h \
|
||||
exportdialog.h \
|
||||
fixedelement.h \
|
||||
hotspoteditor.h \
|
||||
insetproperties.h \
|
||||
insetpropertieswidget.h \
|
||||
nameslist.h \
|
||||
nameslistwidget.h \
|
||||
newelementwizard.h \
|
||||
@@ -91,22 +98,21 @@ HEADERS += aboutqet.h \
|
||||
editor/styleeditor.h \
|
||||
editor/terminaleditor.h \
|
||||
editor/texteditor.h \
|
||||
editor/textfieldeditor.h \
|
||||
diagramcommands.h \
|
||||
diagramtextitem.h \
|
||||
insetproperties.h \
|
||||
conductorpropertieswidget.h \
|
||||
diagramcontent.h \
|
||||
conductorproperties.h
|
||||
editor/textfieldeditor.h
|
||||
SOURCES += aboutqet.cpp \
|
||||
borderinset.cpp \
|
||||
conductor.cpp \
|
||||
conductorprofile.cpp \
|
||||
conductorproperties.cpp \
|
||||
conductorpropertieswidget.cpp \
|
||||
conductorsegment.cpp \
|
||||
customelement.cpp \
|
||||
configdialog.cpp \
|
||||
configpages.cpp \
|
||||
diagram.cpp \
|
||||
diagramcommands.cpp \
|
||||
diagramcontent.cpp \
|
||||
diagramtextitem.cpp \
|
||||
diagramview.cpp \
|
||||
element.cpp \
|
||||
elementdeleter.cpp \
|
||||
@@ -121,6 +127,8 @@ SOURCES += aboutqet.cpp \
|
||||
exportdialog.cpp \
|
||||
fixedelement.cpp \
|
||||
hotspoteditor.cpp \
|
||||
insetproperties.cpp \
|
||||
insetpropertieswidget.cpp \
|
||||
main.cpp \
|
||||
nameslist.cpp \
|
||||
nameslistwidget.cpp \
|
||||
@@ -155,12 +163,7 @@ SOURCES += aboutqet.cpp \
|
||||
editor/styleeditor.cpp \
|
||||
editor/terminaleditor.cpp \
|
||||
editor/texteditor.cpp \
|
||||
editor/textfieldeditor.cpp \
|
||||
diagramcommands.cpp \
|
||||
diagramtextitem.cpp \
|
||||
conductorpropertieswidget.cpp \
|
||||
diagramcontent.cpp \
|
||||
conductorproperties.cpp
|
||||
editor/textfieldeditor.cpp
|
||||
RESOURCES += qelectrotech.qrc
|
||||
TRANSLATIONS += lang/qet_en.ts lang/qt_fr.ts
|
||||
RC_FILE = ico/windows_icon/application_icon/qelectrotech.rc
|
||||
|
||||
@@ -967,7 +967,39 @@ void QETDiagramEditor::writeSettings() {
|
||||
settings.setValue("diagrameditor/state", saveState());
|
||||
}
|
||||
|
||||
/**
|
||||
Permet a l'utilisateur de configurer QET en lancant un dialogue approprie.
|
||||
@see ConfigDialog
|
||||
*/
|
||||
void QETDiagramEditor::configureQET() {
|
||||
ConfigDialog cd;
|
||||
cd.exec();
|
||||
}
|
||||
|
||||
/**
|
||||
@return Les proprietes par defaut pour le cartouche d'un schema
|
||||
*/
|
||||
InsetProperties QETDiagramEditor::defaultInsetProperties() {
|
||||
// accede a la configuration de l'application
|
||||
QSettings &settings = QETApp::settings();
|
||||
|
||||
InsetProperties def;
|
||||
def.title = settings.value("diagrameditor/defaulttitle").toString();
|
||||
def.author = settings.value("diagrameditor/defaultauthor").toString();
|
||||
def.filename = settings.value("diagrameditor/defaultfilename").toString();
|
||||
def.folio = settings.value("diagrameditor/defaultfolio").toString();
|
||||
|
||||
QString settings_date = settings.value("diagrameditor/defaultdate").toString();
|
||||
if (settings_date == "now") {
|
||||
def.date = QDate::currentDate();
|
||||
def.useDate = InsetProperties::CurrentDate;
|
||||
} else if (settings_date.isEmpty() || settings_date == "null") {
|
||||
def.date = QDate();
|
||||
def.useDate = InsetProperties::UseDateValue;
|
||||
} else {
|
||||
def.date = QDate::fromString(settings_date, "yyyyMMdd");
|
||||
def.useDate = InsetProperties::UseDateValue;
|
||||
}
|
||||
|
||||
return(def);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef QET_DIAGRAM_EDITOR_H
|
||||
#define QET_DIAGRAM_EDITOR_H
|
||||
#include <QtGui>
|
||||
#include "insetproperties.h"
|
||||
class DiagramView;
|
||||
class ElementsPanelWidget;
|
||||
/**
|
||||
@@ -25,6 +26,7 @@ class QETDiagramEditor : public QMainWindow {
|
||||
public:
|
||||
void closeEvent(QCloseEvent *);
|
||||
void addDiagramView(DiagramView *);
|
||||
static InsetProperties defaultInsetProperties();
|
||||
|
||||
protected:
|
||||
void actions();
|
||||
|
||||
Reference in New Issue
Block a user