mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Improve code style, Wrap code for better readability
This commit is contained in:
parent
c4bf492616
commit
41cef49453
@ -352,26 +352,28 @@ void DiagramPrintDialog::browseFilePrintTypeDialog() {
|
|||||||
ou non
|
ou non
|
||||||
@param options Options de rendu
|
@param options Options de rendu
|
||||||
*/
|
*/
|
||||||
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page, const ExportProperties& options) {
|
void DiagramPrintDialog::print(const QList<Diagram *> &diagrams,
|
||||||
|
bool fit_page,
|
||||||
|
const ExportProperties& options) {
|
||||||
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
//qDebug() << "Demande d'impression de " << diagrams.count() << "schemas.";
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << printer_->resolution();
|
qDebug() << "DiagramPrintDialog::print printer_->resolution() before " << printer_->resolution();
|
||||||
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
qDebug() << "DiagramPrintDialog::print screennumber " << QApplication::desktop()->screenNumber();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
QScreen *srn = QApplication::screens().at(QApplication::desktop()->screenNumber());
|
||||||
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
qreal dotsPerInch = (qreal)srn->logicalDotsPerInch();
|
||||||
printer_->setResolution(dotsPerInch);
|
printer_->setResolution(dotsPerInch);
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
qDebug() << "DiagramPrintDialog::print dotsPerInch " << dotsPerInch;
|
||||||
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << printer_->resolution();
|
qDebug() << "DiagramPrintDialog::print printer_->resolution() after" << printer_->resolution();
|
||||||
qDebug() << "--";
|
qDebug() << "--";
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
// QPainter utiliser pour effectuer le rendu
|
// QPainter utiliser pour effectuer le rendu
|
||||||
QPainter qp(printer_);
|
QPainter qp(printer_);
|
||||||
@ -399,7 +401,11 @@ void DiagramPrintDialog::print(const QList<Diagram *> &diagrams, bool fit_page,
|
|||||||
@param qp QPainter a utiliser (deja initialise sur printer)
|
@param qp QPainter a utiliser (deja initialise sur printer)
|
||||||
@param printer Imprimante a utiliser
|
@param printer Imprimante a utiliser
|
||||||
*/
|
*/
|
||||||
void DiagramPrintDialog::printDiagram(Diagram *diagram, bool fit_page, const ExportProperties &options, QPainter *qp, QPrinter *printer) {
|
void DiagramPrintDialog::printDiagram(Diagram *diagram,
|
||||||
|
bool fit_page,
|
||||||
|
const ExportProperties &options,
|
||||||
|
QPainter *qp,
|
||||||
|
QPrinter *printer) {
|
||||||
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
|
//qDebug() << printer -> paperSize() << printer -> paperRect() << diagram -> title();
|
||||||
// l'imprimante utilise-t-elle toute la feuille ?
|
// l'imprimante utilise-t-elle toute la feuille ?
|
||||||
bool full_page = printer -> fullPage();
|
bool full_page = printer -> fullPage();
|
||||||
|
@ -162,7 +162,7 @@ void DiagramsChooser::updateList() {
|
|||||||
foreach(Diagram *diagram, project_ -> diagrams()) {
|
foreach(Diagram *diagram, project_ -> diagrams()) {
|
||||||
// titre du schema
|
// titre du schema
|
||||||
QString diagram_title = diagram -> title();
|
QString diagram_title = diagram -> title();
|
||||||
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
if (diagram_title.isEmpty()) diagram_title = tr("Folio sans titre");
|
||||||
|
|
||||||
QCheckBox *checkbox = new QCheckBox(diagram_title);
|
QCheckBox *checkbox = new QCheckBox(diagram_title);
|
||||||
checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum));
|
checkbox -> setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum));
|
||||||
|
@ -88,7 +88,7 @@ int ElementsMover::beginMovement(Diagram *diagram, QGraphicsItem *driver_item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ElementTextItemGroup *> etig_list = m_moved_content.m_texts_groups.values();
|
QList<ElementTextItemGroup *> etig_list = m_moved_content.m_texts_groups.values();
|
||||||
for(ElementTextItemGroup *etig : etig_list) {
|
for(ElementTextItemGroup *etig : etig_list) {
|
||||||
if (m_moved_content.m_elements.contains(etig->parentElement())) {
|
if (m_moved_content.m_elements.contains(etig->parentElement())) {
|
||||||
m_moved_content.m_texts_groups.remove(etig);
|
m_moved_content.m_texts_groups.remove(etig);
|
||||||
|
@ -43,19 +43,19 @@ ElementsPanelWidget::ElementsPanelWidget(QWidget *parent) : QWidget(parent) {
|
|||||||
elements_panel = new ElementsPanel(this);
|
elements_panel = new ElementsPanel(this);
|
||||||
|
|
||||||
// initialise les actions
|
// initialise les actions
|
||||||
open_directory = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this);
|
open_directory = new QAction(QET::Icons::FolderOpen, tr("Ouvrir le dossier correspondant"), this);
|
||||||
copy_path = new QAction(QET::Icons::IC_CopyFile, tr("Copier le chemin"), this);
|
copy_path = new QAction(QET::Icons::IC_CopyFile, tr("Copier le chemin"), this);
|
||||||
prj_activate = new QAction(QET::Icons::ProjectFile, tr("Basculer vers ce projet"), this);
|
prj_activate = new QAction(QET::Icons::ProjectFile, tr("Basculer vers ce projet"), this);
|
||||||
prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this);
|
prj_close = new QAction(QET::Icons::DocumentClose, tr("Fermer ce projet"), this);
|
||||||
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
prj_edit_prop = new QAction(QET::Icons::DialogInformation, tr("Propriétés du projet"), this);
|
||||||
prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
prj_prop_diagram = new QAction(QET::Icons::DialogInformation, tr("Propriétés du folio"), this);
|
||||||
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
prj_add_diagram = new QAction(QET::Icons::DiagramAdd, tr("Ajouter un folio"), this);
|
||||||
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
|
prj_del_diagram = new QAction(QET::Icons::DiagramDelete, tr("Supprimer ce folio"), this);
|
||||||
prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
|
prj_move_diagram_up = new QAction(QET::Icons::GoUp, tr("Remonter ce folio"), this);
|
||||||
prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
|
prj_move_diagram_down = new QAction(QET::Icons::GoDown, tr("Abaisser ce folio"), this);
|
||||||
prj_move_diagram_upx10 = new QAction(QET::Icons::GoUpDouble, tr("Remonter ce folio x10"), this);
|
prj_move_diagram_upx10 = new QAction(QET::Icons::GoUpDouble, tr("Remonter ce folio x10"), this);
|
||||||
prj_move_diagram_top = new QAction(QET::Icons::GoTop, tr("Remonter ce folio au debut"), this);
|
prj_move_diagram_top = new QAction(QET::Icons::GoTop, tr("Remonter ce folio au debut"), this);
|
||||||
prj_move_diagram_downx10 = new QAction(QET::Icons::GoDownDouble, tr("Abaisser ce folio x10"), this);
|
prj_move_diagram_downx10 = new QAction(QET::Icons::GoDownDouble, tr("Abaisser ce folio x10"), this);
|
||||||
tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau modèle"), this);
|
tbt_add = new QAction(QET::Icons::TitleBlock, tr("Nouveau modèle"), this);
|
||||||
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this);
|
tbt_edit = new QAction(QET::Icons::TitleBlock, tr("Éditer ce modèle"), this);
|
||||||
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this);
|
tbt_remove = new QAction(QET::Icons::TitleBlock, tr("Supprimer ce modèle"), this);
|
||||||
|
@ -399,8 +399,12 @@ void ExportDialog::generateSvg(Diagram *diagram, int width, int height, bool kee
|
|||||||
@param keep_aspect_ratio True pour conserver le ratio, false sinon
|
@param keep_aspect_ratio True pour conserver le ratio, false sinon
|
||||||
@param io_device Peripherique de sortie pour le code DXF (souvent : un fichier)
|
@param io_device Peripherique de sortie pour le code DXF (souvent : un fichier)
|
||||||
*/
|
*/
|
||||||
void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool keep_aspect_ratio, QString &file_path) {
|
void ExportDialog::generateDxf(Diagram *diagram,
|
||||||
saveReloadDiagramParameters(diagram, true);
|
int width,
|
||||||
|
int height,
|
||||||
|
bool keep_aspect_ratio,
|
||||||
|
QString &file_path) {
|
||||||
|
saveReloadDiagramParameters(diagram, true);
|
||||||
|
|
||||||
width -= 2*Diagram::margin;
|
width -= 2*Diagram::margin;
|
||||||
height -= 2*Diagram::margin;
|
height -= 2*Diagram::margin;
|
||||||
@ -411,12 +415,22 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
Createdxf::dxfBegin(file_path);
|
Createdxf::dxfBegin(file_path);
|
||||||
|
|
||||||
//Add project elements (lines, rectangles, circles, texts) to dxf file
|
//Add project elements (lines, rectangles, circles, texts) to dxf file
|
||||||
if (epw -> exportProperties().draw_border) {
|
if (epw -> exportProperties().draw_border) {
|
||||||
double bx0 = Diagram::margin * Createdxf::xScale;
|
double bx0 = Diagram::margin * Createdxf::xScale;
|
||||||
double by0 = Diagram::margin * Createdxf::yScale;
|
double by0 = Diagram::margin * Createdxf::yScale;
|
||||||
Createdxf::drawRectangle(file_path, bx0, -by0, double(width)*Createdxf::xScale, double(height)*Createdxf::yScale, 0);
|
Createdxf::drawRectangle(
|
||||||
}
|
file_path,
|
||||||
diagram -> border_and_titleblock.drawDxf(width, height, keep_aspect_ratio, file_path, 0);
|
bx0,
|
||||||
|
-by0,
|
||||||
|
double(width)*Createdxf::xScale,
|
||||||
|
double(height)*Createdxf::yScale,
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
diagram -> border_and_titleblock.drawDxf(width,
|
||||||
|
height,
|
||||||
|
keep_aspect_ratio,
|
||||||
|
file_path,
|
||||||
|
0);
|
||||||
|
|
||||||
// Build the lists of elements.
|
// Build the lists of elements.
|
||||||
QList<Element *> list_elements;
|
QList<Element *> list_elements;
|
||||||
@ -651,7 +665,11 @@ void ExportDialog::generateDxf(Diagram *diagram, int width, int height, bool kee
|
|||||||
saveReloadDiagramParameters(diagram, false);
|
saveReloadDiagramParameters(diagram, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointF ExportDialog::rotation_transformed(qreal px, qreal py , qreal origin_x, qreal origin_y, qreal angle) {
|
QPointF ExportDialog::rotation_transformed(qreal px,
|
||||||
|
qreal py,
|
||||||
|
qreal origin_x,
|
||||||
|
qreal origin_y,
|
||||||
|
qreal angle) {
|
||||||
|
|
||||||
angle *= -3.14159265 / 180;
|
angle *= -3.14159265 / 180;
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ QTreeWidgetItem *GenericPanel::updateTemplateItem(
|
|||||||
"used to display a title block template").arg(
|
"used to display a title block template").arg(
|
||||||
tb_template.name()));
|
tb_template.name()));
|
||||||
QString tbt_whatsthis = tr(
|
QString tbt_whatsthis = tr(
|
||||||
"Ceci est un modèle de cartouche, qui peut être appliqué à un folio.",
|
"Ceci est un modèle de cartouche, qui peut être appliqué à un folio.",
|
||||||
"\"What's this\" tip"
|
"\"What's this\" tip"
|
||||||
);
|
);
|
||||||
tb_template_qtwi -> setWhatsThis(0, tbt_whatsthis);
|
tb_template_qtwi -> setWhatsThis(0, tbt_whatsthis);
|
||||||
|
@ -31,11 +31,11 @@ class Diagram;
|
|||||||
class Element;
|
class Element;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class represents a nomenclature...
|
This class represents a nomenclature...
|
||||||
*/
|
*/
|
||||||
class nomenclature
|
class nomenclature
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QETProject *m_project;
|
QETProject *m_project;
|
||||||
QList<Diagram *> m_list_diagram;
|
QList<Diagram *> m_list_diagram;
|
||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
|
@ -232,7 +232,7 @@ ProjectAutoNumConfigPage::ProjectAutoNumConfigPage (QETProject *project, QWidget
|
|||||||
@return
|
@return
|
||||||
*/
|
*/
|
||||||
QString ProjectAutoNumConfigPage::title() const {
|
QString ProjectAutoNumConfigPage::title() const {
|
||||||
return tr("Numérotation auto");
|
return tr("Numérotation auto");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,19 +263,19 @@ void ProjectAutoNumConfigPage::initWidgets()
|
|||||||
|
|
||||||
//Conductor tab
|
//Conductor tab
|
||||||
m_saw_conductor = new SelectAutonumW(1);
|
m_saw_conductor = new SelectAutonumW(1);
|
||||||
tab_widget->addTab(m_saw_conductor, tr("Conducteurs"));
|
tab_widget->addTab(m_saw_conductor, tr("Conducteurs"));
|
||||||
|
|
||||||
//Element tab
|
//Element tab
|
||||||
m_saw_element = new SelectAutonumW(0);
|
m_saw_element = new SelectAutonumW(0);
|
||||||
tab_widget->addTab(m_saw_element, tr("Eléments"));
|
tab_widget->addTab(m_saw_element, tr("Eléments"));
|
||||||
|
|
||||||
//Folio Tab
|
//Folio Tab
|
||||||
m_saw_folio = new SelectAutonumW(2);
|
m_saw_folio = new SelectAutonumW(2);
|
||||||
tab_widget->addTab(m_saw_folio, tr("Folios"));
|
tab_widget->addTab(m_saw_folio, tr("Folios"));
|
||||||
|
|
||||||
//AutoNumbering Tab
|
//AutoNumbering Tab
|
||||||
m_faw = new FolioAutonumberingW(project());
|
m_faw = new FolioAutonumberingW(project());
|
||||||
tab_widget->addTab(m_faw, tr("Numérotation auto des folios"));
|
tab_widget->addTab(m_faw, tr("Numérotation auto des folios"));
|
||||||
|
|
||||||
QHBoxLayout *main_layout = new QHBoxLayout();
|
QHBoxLayout *main_layout = new QHBoxLayout();
|
||||||
main_layout->addWidget(tab_widget);
|
main_layout->addWidget(tab_widget);
|
||||||
|
@ -352,14 +352,14 @@ QETResult ProjectView::noProjectResult() const {
|
|||||||
void ProjectView::removeDiagram(DiagramView *diagram_view)
|
void ProjectView::removeDiagram(DiagramView *diagram_view)
|
||||||
{
|
{
|
||||||
if (!diagram_view)
|
if (!diagram_view)
|
||||||
return;
|
return;
|
||||||
if (m_project -> isReadOnly())
|
if (m_project -> isReadOnly())
|
||||||
return;
|
return;
|
||||||
if (!m_diagram_ids.values().contains(diagram_view))
|
if (!m_diagram_ids.values().contains(diagram_view))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
//Ask confirmation to user.
|
//Ask confirmation to user.
|
||||||
int answer = QET::QetMessageBox::question(
|
int answer = QET::QetMessageBox::question(
|
||||||
this,
|
this,
|
||||||
tr("Supprimer le folio ?", "message box title"),
|
tr("Supprimer le folio ?", "message box title"),
|
||||||
@ -371,18 +371,18 @@ void ProjectView::removeDiagram(DiagramView *diagram_view)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Remove the diagram view of the tabs widget
|
//Remove the diagram view of the tabs widget
|
||||||
int index_to_remove = m_diagram_ids.key(diagram_view);
|
int index_to_remove = m_diagram_ids.key(diagram_view);
|
||||||
m_tab->removeTab(index_to_remove);
|
m_tab->removeTab(index_to_remove);
|
||||||
m_diagram_view_list.removeAll(diagram_view);
|
m_diagram_view_list.removeAll(diagram_view);
|
||||||
rebuildDiagramsMap();
|
rebuildDiagramsMap();
|
||||||
|
|
||||||
m_project -> removeDiagram(diagram_view -> diagram());
|
m_project -> removeDiagram(diagram_view -> diagram());
|
||||||
delete diagram_view;
|
delete diagram_view;
|
||||||
|
|
||||||
emit(diagramRemoved(diagram_view));
|
emit(diagramRemoved(diagram_view));
|
||||||
updateAllTabsTitle();
|
updateAllTabsTitle();
|
||||||
m_project -> setModified(true);
|
m_project -> setModified(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -812,11 +812,11 @@ void ProjectView::loadDiagrams()
|
|||||||
diagramAdded(diagram);
|
diagramAdded(diagram);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DiagramView *dv = currentDiagram())
|
if (DiagramView *dv = currentDiagram())
|
||||||
{
|
{
|
||||||
dv->diagram()->loadElmtFolioSeq();
|
dv->diagram()->loadElmtFolioSeq();
|
||||||
dv->diagram()->loadCndFolioSeq();
|
dv->diagram()->loadCndFolioSeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
}
|
}
|
||||||
|
@ -1279,13 +1279,13 @@ namespace pugi
|
|||||||
bool operator!() const;
|
bool operator!() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// C4275 can be ignored in Visual C++ if you are deriving
|
// C4275 can be ignored in Visual C++ if you are deriving
|
||||||
// from a type in the Standard C++ Library
|
// from a type in the Standard C++ Library
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable: 4275)
|
#pragma warning(disable: 4275)
|
||||||
#endif
|
#endif
|
||||||
// XPath exception class
|
// XPath exception class
|
||||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||||
{
|
{
|
||||||
@ -1302,10 +1302,10 @@ namespace pugi
|
|||||||
// Get parse result
|
// Get parse result
|
||||||
const xpath_parse_result& result() const;
|
const xpath_parse_result& result() const;
|
||||||
};
|
};
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// XPath node class (either xml_node or xml_attribute)
|
// XPath node class (either xml_node or xml_attribute)
|
||||||
class PUGIXML_CLASS xpath_node
|
class PUGIXML_CLASS xpath_node
|
||||||
|
@ -168,7 +168,7 @@ class QETApp : public QObject
|
|||||||
protected:
|
protected:
|
||||||
|
|
||||||
#ifdef Q_OS_DARWIN
|
#ifdef Q_OS_DARWIN
|
||||||
bool eventFiltrer(QObject *object, QEvent *);
|
bool eventFiltrer(QObject *object, QEvent *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
|
@ -46,8 +46,8 @@
|
|||||||
/**
|
/**
|
||||||
@brief QETDiagramEditor::QETDiagramEditor
|
@brief QETDiagramEditor::QETDiagramEditor
|
||||||
Constructor
|
Constructor
|
||||||
@param files, list of files to open
|
@param files : list of files to open
|
||||||
@param parent, parent widget
|
@param parent : parent widget
|
||||||
*/
|
*/
|
||||||
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
QETDiagramEditor::QETDiagramEditor(const QStringList &files, QWidget *parent) :
|
||||||
QETMainWindow(parent),
|
QETMainWindow(parent),
|
||||||
@ -382,8 +382,8 @@ void QETDiagramEditor::setUpActions()
|
|||||||
//Export nomenclature to CSV
|
//Export nomenclature to CSV
|
||||||
m_csv_export = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter au format CSV"), this);
|
m_csv_export = new QAction(QET::Icons::DocumentSpreadsheet, tr("Exporter au format CSV"), this);
|
||||||
connect(m_csv_export, &QAction::triggered, [this]() {
|
connect(m_csv_export, &QAction::triggered, [this]() {
|
||||||
BOMExportDialog bom(currentProjectView()->project(), this);
|
BOMExportDialog bom(currentProjectView()->project(), this);
|
||||||
bom.exec();
|
bom.exec();
|
||||||
});
|
});
|
||||||
|
|
||||||
//Add a nomenclature item
|
//Add a nomenclature item
|
||||||
|
@ -52,7 +52,8 @@ class QETDiagramEditor : public QETMainWindow
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QETDiagramEditor(const QStringList & = QStringList(), QWidget * = nullptr);
|
QETDiagramEditor(const QStringList & = QStringList(),
|
||||||
|
QWidget * = nullptr);
|
||||||
~QETDiagramEditor() override;
|
~QETDiagramEditor() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -390,26 +390,26 @@ void QET::Icons::initIcons() {
|
|||||||
ArrowRightDouble .addFile(":/ico/22x22/arrow-right-double.png");
|
ArrowRightDouble .addFile(":/ico/22x22/arrow-right-double.png");
|
||||||
Autoconnect .addFile(":/ico/22x22/autoconnect.png");
|
Autoconnect .addFile(":/ico/22x22/autoconnect.png");
|
||||||
BringForward .addFile(":/ico/22x22/bring_forward.png");
|
BringForward .addFile(":/ico/22x22/bring_forward.png");
|
||||||
Cancel .addFile(":/ico/16x16/item-cancel.png");
|
Cancel .addFile(":/ico/16x16/item-cancel.png");
|
||||||
Conductor .addFile(":/ico/16x16/conductor.png");
|
Conductor .addFile(":/ico/16x16/conductor.png");
|
||||||
ConductorEdit .addFile(":/ico/16x16/conductor-edit.png");
|
ConductorEdit .addFile(":/ico/16x16/conductor-edit.png");
|
||||||
ConductorSettings .addFile(":/ico/16x16/conductor-reset.png");
|
ConductorSettings .addFile(":/ico/16x16/conductor-reset.png");
|
||||||
ConductorSettings .addFile(":/ico/22x22/conductor2.png");
|
ConductorSettings .addFile(":/ico/22x22/conductor2.png");
|
||||||
Configure .addFile(":/ico/16x16/configure.png");
|
Configure .addFile(":/ico/16x16/configure.png");
|
||||||
Configure .addFile(":/ico/22x22/configure.png");
|
Configure .addFile(":/ico/22x22/configure.png");
|
||||||
ConfigureToolbars .addFile(":/ico/16x16/configure-toolbars.png");
|
ConfigureToolbars .addFile(":/ico/16x16/configure-toolbars.png");
|
||||||
ConfigureToolbars .addFile(":/ico/22x22/configure-toolbars.png");
|
ConfigureToolbars .addFile(":/ico/22x22/configure-toolbars.png");
|
||||||
IC_CopyFile .addFile(":/ico/16x16/item-copy.png");
|
IC_CopyFile .addFile(":/ico/16x16/item-copy.png");
|
||||||
DiagramAdd .addFile(":/ico/16x16/folio-new.png");
|
DiagramAdd .addFile(":/ico/16x16/folio-new.png");
|
||||||
DiagramAdd .addFile(":/ico/22x22/diagram_add.png");
|
DiagramAdd .addFile(":/ico/22x22/diagram_add.png");
|
||||||
Diagram .addFile(":/ico/16x16/diagram.png");
|
Diagram .addFile(":/ico/16x16/diagram.png");
|
||||||
Diagram .addFile(":/ico/diagram.png");
|
Diagram .addFile(":/ico/diagram.png");
|
||||||
DiagramBg .addFile(":/ico/22x22/diagram_bg.png");
|
DiagramBg .addFile(":/ico/22x22/diagram_bg.png");
|
||||||
DiagramDelete .addFile(":/ico/16x16/folio-delete.png");
|
DiagramDelete .addFile(":/ico/16x16/folio-delete.png");
|
||||||
DiagramDelete .addFile(":/ico/22x22/diagram_del.png");
|
DiagramDelete .addFile(":/ico/22x22/diagram_del.png");
|
||||||
DialogCancel .addFile(":/ico/16x16/dialog-cancel.png");
|
DialogCancel .addFile(":/ico/16x16/dialog-cancel.png");
|
||||||
DialogCancel .addFile(":/ico/22x22/dialog-cancel.png");
|
DialogCancel .addFile(":/ico/22x22/dialog-cancel.png");
|
||||||
DialogInformation .addFile(":/ico/16x16/folio-properties.png");
|
DialogInformation .addFile(":/ico/16x16/folio-properties.png");
|
||||||
DialogInformation .addFile(":/ico/22x22/dialog-information.png");
|
DialogInformation .addFile(":/ico/22x22/dialog-information.png");
|
||||||
DialogOk .addFile(":/ico/16x16/dialog-ok.png");
|
DialogOk .addFile(":/ico/16x16/dialog-ok.png");
|
||||||
DialogOk .addFile(":/ico/22x22/dialog-ok.png");
|
DialogOk .addFile(":/ico/22x22/dialog-ok.png");
|
||||||
@ -417,7 +417,7 @@ void QET::Icons::initIcons() {
|
|||||||
DocumentClose .addFile(":/ico/22x22/document-close.png");
|
DocumentClose .addFile(":/ico/22x22/document-close.png");
|
||||||
DocumentExport .addFile(":/ico/16x16/document-export.png");
|
DocumentExport .addFile(":/ico/16x16/document-export.png");
|
||||||
DocumentExport .addFile(":/ico/22x22/document-export.png");
|
DocumentExport .addFile(":/ico/22x22/document-export.png");
|
||||||
DocumentSpreadsheet .addFile(":/ico/16x16/export-csv.png");
|
DocumentSpreadsheet .addFile(":/ico/16x16/export-csv.png");
|
||||||
DocumentExport .addFile(":/ico/128x128/document-export.png");
|
DocumentExport .addFile(":/ico/128x128/document-export.png");
|
||||||
DocumentImport .addFile(":/ico/16x16/document-import.png");
|
DocumentImport .addFile(":/ico/16x16/document-import.png");
|
||||||
DocumentImport .addFile(":/ico/22x22/document-import.png");
|
DocumentImport .addFile(":/ico/22x22/document-import.png");
|
||||||
|
@ -170,11 +170,11 @@ void QETPrintPreviewDialog::selectNoDiagram() {
|
|||||||
*/
|
*/
|
||||||
void QETPrintPreviewDialog::build() {
|
void QETPrintPreviewDialog::build() {
|
||||||
preview_ = new QPrintPreviewWidget(printer_);
|
preview_ = new QPrintPreviewWidget(printer_);
|
||||||
diagrams_label_ = new QLabel(tr("Folios à imprimer :"));
|
diagrams_label_ = new QLabel(tr("Folios à imprimer :"));
|
||||||
diagrams_list_ = new DiagramsChooser(project_);
|
diagrams_list_ = new DiagramsChooser(project_);
|
||||||
diagrams_select_all_ = new QPushButton(tr("Tout cocher"));
|
diagrams_select_all_ = new QPushButton(tr("Tout cocher"));
|
||||||
diagrams_select_none_ = new QPushButton(tr("Tout décocher"));
|
diagrams_select_none_ = new QPushButton(tr("Tout décocher"));
|
||||||
toggle_diagrams_list_ = new QAction(QET::Icons::Diagram, tr("Cacher la liste des folios"), this);
|
toggle_diagrams_list_ = new QAction(QET::Icons::Diagram, tr("Cacher la liste des folios"), this);
|
||||||
toggle_print_options_ = new QAction(QET::Icons::Configure, tr("Cacher les options d'impression"), this);
|
toggle_print_options_ = new QAction(QET::Icons::Configure, tr("Cacher les options d'impression"), this);
|
||||||
adjust_width_ = new QAction(QET::Icons::ViewFitWidth, tr("Ajuster la largeur"), this);
|
adjust_width_ = new QAction(QET::Icons::ViewFitWidth, tr("Ajuster la largeur"), this);
|
||||||
adjust_page_ = new QAction(QET::Icons::ViewFitWindow, tr("Ajuster la page"), this);
|
adjust_page_ = new QAction(QET::Icons::ViewFitWindow, tr("Ajuster la page"), this);
|
||||||
@ -245,9 +245,9 @@ void QETPrintPreviewDialog::build() {
|
|||||||
));
|
));
|
||||||
use_full_page_label_ -> setWordWrap(true);
|
use_full_page_label_ -> setWordWrap(true);
|
||||||
use_full_page_label_ -> setContentsMargins(20, 0, 0, 0);
|
use_full_page_label_ -> setContentsMargins(20, 0, 0, 0);
|
||||||
fit_diagram_to_page_ = new QCheckBox(tr("Adapter le folio à la page"));
|
fit_diagram_to_page_ = new QCheckBox(tr("Adapter le folio à la page"));
|
||||||
fit_diagram_to_page_label_ = new QLabel(tr(
|
fit_diagram_to_page_label_ = new QLabel(tr(
|
||||||
"Si cette option est cochée, le folio sera agrandi ou "
|
"Si cette option est cochée, le folio sera agrandi ou "
|
||||||
"rétréci de façon à remplir toute la surface imprimable "
|
"rétréci de façon à remplir toute la surface imprimable "
|
||||||
"d'une et une seule page."
|
"d'une et une seule page."
|
||||||
));
|
));
|
||||||
@ -364,9 +364,9 @@ void QETPrintPreviewDialog::setDiagramsListVisible(bool display) {
|
|||||||
diagrams_select_none_ -> setVisible(display);
|
diagrams_select_none_ -> setVisible(display);
|
||||||
|
|
||||||
if (display) {
|
if (display) {
|
||||||
toggle_diagrams_list_ -> setText(tr("Cacher la liste des folios"));
|
toggle_diagrams_list_ -> setText(tr("Cacher la liste des folios"));
|
||||||
} else {
|
} else {
|
||||||
toggle_diagrams_list_ -> setText(tr("Afficher la liste des folios"));
|
toggle_diagrams_list_ -> setText(tr("Afficher la liste des folios"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,17 +870,19 @@ bool QETProject::close() {
|
|||||||
*/
|
*/
|
||||||
QETResult QETProject::write()
|
QETResult QETProject::write()
|
||||||
{
|
{
|
||||||
// this operation requires a filepath
|
// this operation requires a filepath
|
||||||
if (m_file_path.isEmpty())
|
if (m_file_path.isEmpty())
|
||||||
return(QString("unable to save project to file: no filepath was specified"));
|
return(QString("unable to save project to file: no filepath was specified"));
|
||||||
|
|
||||||
// if the project was opened read-only and the file is still non-writable, do not save the project
|
// if the project was opened read-only
|
||||||
|
// and the file is still non-writable, do not save the project
|
||||||
if (isReadOnly() && !QFileInfo(m_file_path).isWritable())
|
if (isReadOnly() && !QFileInfo(m_file_path).isWritable())
|
||||||
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
|
return(QString("the file %1 was opened read-only and thus will not be written").arg(m_file_path));
|
||||||
|
|
||||||
QDomDocument xml_project(toXml());
|
QDomDocument xml_project(toXml());
|
||||||
QString error_message;
|
QString error_message;
|
||||||
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message)) return(error_message);
|
if (!QET::writeXmlFile(xml_project, m_file_path, &error_message))
|
||||||
|
return(error_message);
|
||||||
|
|
||||||
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
//title block variables should be updated after file save dialog is confirmed, before file is saved.
|
||||||
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));
|
m_project_properties.addValue("saveddate", QDate::currentDate().toString(Qt::SystemLocaleShortDate));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user