From 2bc457938c16c8d4487ab6f2636d0a86dd4d2270 Mon Sep 17 00:00:00 2001 From: xavier Date: Sun, 4 Oct 2009 02:04:42 +0000 Subject: [PATCH] Les options d'impression sont desormais configurables. git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@760 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- ico/128x128/printer.png | Bin 0 -> 6970 bytes qelectrotech.qrc | 1 + sources/configdialog.cpp | 5 +-- sources/configpages.cpp | 54 +++++++++++++++++++++++++++++- sources/configpages.h | 23 +++++++++++++ sources/qetdiagrameditor.cpp | 14 ++++++++ sources/qetdiagrameditor.h | 1 + sources/qeticons.cpp | 1 + sources/qetprintpreviewdialog.cpp | 6 +++- 9 files changed, 101 insertions(+), 4 deletions(-) create mode 100644 ico/128x128/printer.png diff --git a/ico/128x128/printer.png b/ico/128x128/printer.png new file mode 100644 index 0000000000000000000000000000000000000000..5920f4d4281d335952f4bc1f38aaa6256fa52fb8 GIT binary patch literal 6970 zcmV-A8^z>_P)?Q8qeZQQoO$e5dL44%=9gpu$p zHz6M8b+s>x1QIVud;nxEFhbfFctXNj9?)o?_JIe!0GfeC3=2ZQa5peuV|>50FMaQ- zJ-<@^ThS4Dsd810tGn_@r!q4#G9vSwf1EgRA~LH|uh*lJdYAg5l1c!SR05!+5&$KY z04S;FsCuI+t{B;7h+QQ`y+`$!r|L$%1ORA-@jl~~QE$_v@#lb`*8osK`3C&IM7>K` z!hc~?`T!;M8~`c}E~(Pf7N878i+UIU@Qt7n{3QTN0CWogYPFsM0nb|kz!8LTtye68 zp0@;mgdr9fmN7ZcSz3Sufz-6W%#~k@_e%gEj2-|%p!}|R#%eeC0DXP+ct5gz_5eY} z!lZq6Tv;X#U(M_4N&rYWrf3Pm1%V5M1~0`{FZPsQ0>DvtjSVf`xNiXj=$k`_mJ$f^ z6wh-TmjFNzQm=r(K6?T}0#~|R@!I;V{=Wo38URpy-1=*zrLaKI{U$%O0#bf=0N|hc zUcgH)y;L0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F;j=QPy&LS`-RpG07;Q5*nkKw?T0uzN8}~{#hD^wlVgd9w z`;zIrI}g*X0I0zVSk#Spc$wUk021D@D+q+|n__=ag!cV^Jx@IbLc~?p5Oix7Amz`(3MuR1?Kofv6U@VEp5A$x(d`xEWvb-}VEkX6{*OmpjLIdSx&gIj)j@uBEvir50xj6}b*QIP>_-E&k_Q$5 zqHYGjtTP`lk6FZYrgZ^se=Y!Mn5D0C>Z>L4z$ue74Y3?yDbA1i=DZv~*K8}F7J{g3 z>X!Eo%iQZ86jP*iS!)Z;^nPr7diU<#X!VcHelor5srdUO7V)mV6!I%!5@aa=$hYdYE4=0@Dle>Xp^@7cTQrN&nx@6{H{x13_a?f;Vse z|7YS!5D!8xh0%c>2n!`G>tdiCSdz9WA>HkSB*U(PeY1yY_+Dgyi~uMAex2x0;!v(- zuG}=U^1@)?wCdzaQDmqyF;@?j?KU-wN(XrR+T9dEBY>$}25>4=4q&iBjYef>27n~X zvOhSzEOGptico/128x128/diagram.png ico/128x128/settings.png ico/128x128/document-export.png + ico/128x128/printer.png ico/16x16/add_col.png ico/16x16/add_row.png ico/16x16/application-exit.png diff --git a/sources/configdialog.cpp b/sources/configdialog.cpp index 9e1fd89e6..60b81513b 100644 --- a/sources/configdialog.cpp +++ b/sources/configdialog.cpp @@ -31,8 +31,8 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { pages_list -> setViewMode(QListView::IconMode); pages_list -> setIconSize(QSize(110, 110)); pages_list -> setMovement(QListView::Static); - pages_list -> setMinimumWidth(135); - pages_list -> setMaximumWidth(135); + pages_list -> setMinimumWidth(150); + pages_list -> setMaximumWidth(150); pages_list -> setSpacing(4); // pages @@ -40,6 +40,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent) { addPage(new GeneralConfigurationPage()); addPage(new NewDiagramPage()); addPage(new ExportConfigPage()); + addPage(new PrintConfigPage()); buildPagesList(); // boutons diff --git a/sources/configpages.cpp b/sources/configpages.cpp index fb36c503d..783eae11f 100644 --- a/sources/configpages.cpp +++ b/sources/configpages.cpp @@ -191,7 +191,6 @@ QString GeneralConfigurationPage::title() const { return(tr("G\351n\351ral", "configuration page title")); } - /** Constructeur @param parent QWidget parent @@ -238,3 +237,56 @@ QString ExportConfigPage::title() const { return(tr("Export", "configuration page title")); } +/** + Constructeur + @param parent QWidget parent +*/ +PrintConfigPage::PrintConfigPage(QWidget *parent) : ConfigPage(parent) { + // epw contient les options d'export + epw = new ExportPropertiesWidget(QETDiagramEditor::defaultPrintProperties()); + epw -> setPrintingMode(true); + + // layout vertical contenant le titre, une ligne horizontale et epw + QVBoxLayout *vlayout1 = new QVBoxLayout(); + + QLabel *title = new QLabel(this -> title()); + vlayout1 -> addWidget(title); + + QFrame *horiz_line = new QFrame(); + horiz_line -> setFrameShape(QFrame::HLine); + vlayout1 -> addWidget(horiz_line); + vlayout1 -> addWidget(epw); + vlayout1 -> addStretch(); + + // activation du layout + setLayout(vlayout1); +} + +/// Destructeur +PrintConfigPage::~PrintConfigPage() { +} + +/** + Applique la configuration de cette page +*/ +void PrintConfigPage::applyConf() { + QString prefix = "print/default"; + + QSettings &settings = QETApp::settings(); + epw -> exportProperties().toSettings(settings, prefix); + + // annule l'enregistrement de certaines proprietes non pertinentes + settings.remove(prefix + "path"); + settings.remove(prefix + "format"); + settings.remove(prefix + "area"); +} + +/// @return l'icone de cette page +QIcon PrintConfigPage::icon() const { + return(QET::Icons::Printer); +} + +/// @return le titre de cette page +QString PrintConfigPage::title() const { + return(tr("Impression", "configuration page title")); +} diff --git a/sources/configpages.h b/sources/configpages.h index 6e35e38c9..cc95825e7 100644 --- a/sources/configpages.h +++ b/sources/configpages.h @@ -123,4 +123,27 @@ class ExportConfigPage : public ConfigPage { public: ExportPropertiesWidget *epw; }; + +/** + Cette classe represente la page de configuration du dialogue d'impression +*/ +class PrintConfigPage : public ConfigPage { + Q_OBJECT + // constructeurs, destructeur + public: + PrintConfigPage(QWidget * = 0); + virtual ~PrintConfigPage(); + private: + PrintConfigPage(const PrintConfigPage &); + + // methodes + public: + void applyConf(); + QString title() const; + QIcon icon() const; + + // attributs + public: + ExportPropertiesWidget *epw; +}; #endif diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index f0b0d74e2..274275ec5 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -1777,3 +1777,17 @@ ExportProperties QETDiagramEditor::defaultExportProperties() { return(def); } + +/** + @return Les parametres d'impression par defaut pour un schema +*/ +ExportProperties QETDiagramEditor::defaultPrintProperties() { + // accede a la configuration de l'application + QSettings &settings = QETApp::settings(); + + ExportProperties def; + // lit les caracteristiques des conducteurs par defaut dans la configuration + def.fromSettings(settings, "print/default"); + + return(def); +} diff --git a/sources/qetdiagrameditor.h b/sources/qetdiagrameditor.h index d4b0470a8..29570c8a6 100644 --- a/sources/qetdiagrameditor.h +++ b/sources/qetdiagrameditor.h @@ -60,6 +60,7 @@ class QETDiagramEditor : public QMainWindow { static BorderProperties defaultBorderProperties(); static ConductorProperties defaultConductorProperties(); static ExportProperties defaultExportProperties(); + static ExportProperties defaultPrintProperties(); protected: void actions(); diff --git a/sources/qeticons.cpp b/sources/qeticons.cpp index 96dde6bca..94d557364 100644 --- a/sources/qeticons.cpp +++ b/sources/qeticons.cpp @@ -262,6 +262,7 @@ void QET::Icons::initIcons() { Phase .addFile(":/ico/16x16/phase.png"); PrintAllPages .addFile(":/ico/22x22/all_pages.png"); Printer .addFile(":/ico/32x32/printer.png"); + Printer .addFile(":/ico/128x128/printer.png"); PrintLandscape .addFile(":/ico/22x22/landscape.png"); PrintPortrait .addFile(":/ico/22x22/portrait.png"); PrintTwoPages .addFile(":/ico/22x22/two_pages.png"); diff --git a/sources/qetprintpreviewdialog.cpp b/sources/qetprintpreviewdialog.cpp index a4022213e..c5f485b6a 100644 --- a/sources/qetprintpreviewdialog.cpp +++ b/sources/qetprintpreviewdialog.cpp @@ -19,6 +19,7 @@ #include "diagramschooser.h" #include "exportproperties.h" #include "exportpropertieswidget.h" +#include "qetdiagrameditor.h" #include "qeticons.h" /** @@ -231,7 +232,10 @@ void QETPrintPreviewDialog::build() { fit_diagram_to_page_label_ -> setContentsMargins(20, 0, 0, 0); fit_diagram_to_page_ -> setChecked(true); - render_properties_ = new ExportPropertiesWidget(); + // recupere les parametres d'export definis dans la configuration de l'application + ExportProperties default_print_properties = QETDiagramEditor::defaultPrintProperties(); + + render_properties_ = new ExportPropertiesWidget(default_print_properties); render_properties_ -> setPrintingMode(true); buttons_ = new QDialogButtonBox();