From b3745e04116ecd7e126f852e0999bb3f385d8dc5 Mon Sep 17 00:00:00 2001 From: Lukáš Lalinský Date: Thu, 9 Jul 2009 23:46:47 +0200 Subject: Print support --- dbmodel.qrc | 1 + icons/16x16/document-print.png | Bin 0 -> 544 bytes src/mainwindow.cpp | 24 ++- src/mainwindow.h | 1 + src/src.pro | 2 +- translations/dbmodel_en.ts | 301 ++++++++++++++++++++++++++++++-------- translations/dbmodel_sk.ts | 324 +++++++++++++++++++++++++++++++---------- 7 files changed, 513 insertions(+), 140 deletions(-) create mode 100644 icons/16x16/document-print.png diff --git a/dbmodel.qrc b/dbmodel.qrc index 5c6ed93..1a41100 100644 --- a/dbmodel.qrc +++ b/dbmodel.qrc @@ -8,6 +8,7 @@ icons/16x16/document-open.png icons/16x16/document-save.png icons/16x16/document-save-as.png + icons/16x16/document-print.png icons/16x16/edit-undo.png icons/16x16/edit-redo.png icons/16x16/edit-delete.png diff --git a/icons/16x16/document-print.png b/icons/16x16/document-print.png new file mode 100644 index 0000000..35c37bd Binary files /dev/null and b/icons/16x16/document-print.png differ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cd29586..863af82 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,8 @@ public: QStackedWidget *propertyEditorsStack; QMap propertyEditorsIndexes; + QAction *printAction; + QActionGroup *notationActionGroup; QMenu *notationMenu; @@ -215,9 +218,14 @@ MainWindow::setupActions() //connect(m_undoGroup, SIGNAL(cleanChanged(bool)), m_actionSaveAs, SLOT(setDisabled(bool))); m_actionExportPNG = new QAction(this); - m_actionExportPNG->setText(tr("Export...")); + m_actionExportPNG->setText(tr("E&xport...")); connect(m_actionExportPNG, SIGNAL(triggered(bool)), SLOT(exportPNG())); + d->printAction = new QAction(this); + d->printAction->setText(tr("&Print...")); + d->printAction->setIcon(loadIcon("document-print")); + connect(d->printAction, SIGNAL(triggered(bool)), SLOT(print())); + for (int i = 0; i < MaxRecentFiles; i++) { m_actionRecentFile[i] = new QAction(this); m_actionRecentFile[i]->setVisible(false); @@ -378,6 +386,7 @@ MainWindow::setupMenuBar() menu->addSeparator(); menu->addAction(m_actionExportPNG); + menu->addAction(d->printAction); m_actionRecentFilesSeparator = menu->addSeparator(); for (int i = 0; i < MaxRecentFiles; i++) menu->addAction(m_actionRecentFile[i]); @@ -493,6 +502,19 @@ MainWindow::exportPNG() } } +void +MainWindow::print() +{ + QPrinter printer; + QPrintDialog printDialog(&printer, this); + if (printDialog.exec() == QDialog::Accepted) { + QPainter painter(&printer); + m_model->setPrinting(true); + m_model->render(&painter); + m_model->setPrinting(false); + } +} + void MainWindow::newModel(DiagramDocument *newModel) { diff --git a/src/mainwindow.h b/src/mainwindow.h index eaf7626..ace4ea6 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -53,6 +53,7 @@ public slots: bool maybeSave(); bool saveAs(); void exportPNG(); + void print(); void setViewScale(const QString &scale); void about(); diff --git a/src/src.pro b/src/src.pro index 4d9cc63..3796f56 100644 --- a/src/src.pro +++ b/src/src.pro @@ -1,5 +1,5 @@ TARGET = dbmodel -VERSION = 0.2.0 +VERSION = 0.3dev DESTDIR = ../ diff --git a/translations/dbmodel_en.ts b/translations/dbmodel_en.ts index 134e5c9..9e7ed89 100644 --- a/translations/dbmodel_en.ts +++ b/translations/dbmodel_en.ts @@ -1,5 +1,14 @@ - + + + + ColorPickerPopup + + + Custom + + + ColumnListModel @@ -97,37 +106,84 @@ DatabaseTableProperties - + &Table - + &Columns - + Name: + + + White + + + + + + + Gray + + + + + Red + + + + + Brown + + + + + Pink + + + + + Yellow + + + + + Green + + + + + Blue + + + Color: + + + + &Add - + &Remove - + Move &Up - + Move &Down @@ -135,270 +191,393 @@ MainWindow - + &Properties - + &New - + Ctrl+N - + &Open... - + Ctrl+O - + &Save - + Ctrl+S - + Save &As... - - Export... + + E&xport... - + + &Print... + + + + Select - + Add new table - + Add new relation - + &Undo - + Ctrl+Z - + Re&do - + Ctrl+Shift+Z - + Cu&t - + Ctrl+X - + &Copy - + Ctrl+C - + &Paste - + Ctrl+V - + &Delete - + Del - + &About... - + &Close - + Ctrl+W - + &Quit - + Ctrl+Q - + Show &Grid - + &Notation - + &Relational - + &Crow's Foot - + + &File - + &Mode - + 50% - + 70% - + 85% - + 100% - + 125% - + 150% - + + &View - + &Edit - + &Diagram - + &Help - + The document has been modified. Do you want to save your changes? - + Error - + Unknown format. - + &%1. %2 - + About - + + <p> +<b>Database Modeller + + + <p> <b>Database Modeller</b><br /> <a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br /> Copyright (C) 2008 Lukas Lalinsky </p> - <p><b>Database Modeller</b><br /><a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br />Copyright (C) 2008 Lukáš Lalinský</p> + <p><b>Database Modeller</b><br /><a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br />Copyright (C) 2008 Lukáš Lalinský</p> - + Untitled + + QtColorPicker + + + + + Black + + + + + + White + + + + + + Red + + + + + + Dark red + + + + + + Green + + + + + + Dark green + + + + + + Blue + + + + + + Dark blue + + + + + + Cyan + + + + + + Dark cyan + + + + + + Magenta + + + + + + Dark magenta + + + + + + Yellow + + + + + + Dark yellow + + + + + + Gray + + + + + + Dark gray + + + + + + Light gray + + + + + Custom + + + diff --git a/translations/dbmodel_sk.ts b/translations/dbmodel_sk.ts index 1b88564..88011c5 100644 --- a/translations/dbmodel_sk.ts +++ b/translations/dbmodel_sk.ts @@ -1,5 +1,14 @@ - + + + + ColorPickerPopup + + + Custom + Vlastná + + ColumnListModel @@ -78,12 +87,12 @@ Columns: - + Stĺpce: references - + odkazuje na @@ -94,12 +103,10 @@ &Vzťah - Name: Názov: - Cardinality: Kardinalita: @@ -107,37 +114,84 @@ DatabaseTableProperties - + &Table &Tabuľka - + &Columns Stĺ&ce - + Name: Názov: - + + White + Biela + + + + + + Gray + Šedá + + + + Red + Červená + + + + Brown + Hnedá + + + + Pink + Ružová + + + + Yellow + Žtlá + + + + Green + Zelená + + + + Blue + Modrá + + + + Color: + Farba: + + + Move &Up Posunúť &hore - + Move &Down Posunúť &dole - + &Add Prid&ať - + &Remove Odst&rániť @@ -145,328 +199,444 @@ MainWindow - + &New &Nový - + Ctrl+N - + &Open... &Otvoriť... - + Ctrl+O - + &Save &Uložiť - + Ctrl+S - + Save &As... Uložiť &ako... - Export... - Exportovať... + Exportovať... - + Select Výber - + Add new table Pridať novú tabuľku - + Add new relation Pridať nový vzťah - + &Undo Vrátit &späť - + Ctrl+Z - + Re&do &Opakovať vrátené - + Ctrl+Shift+Z - + + &File &Súbor - + &Mode &Mód - + 50% - + 70% - + 85% - + 100% - + 125% - + 150% - + &Quit &Koniec - + Ctrl+Q - + &Delete &Odstrániť - + Del - + Error Chyba - + Unknown format. Neznámy formát. - + &Edit &Upraviť - + + E&xport... + E&xportovať... + + + + &Print... + &Tlačiť... + + + Cu&t Vystri&hnúť - + Ctrl+X - + &Copy &Kopírovať - + Ctrl+C - + &Paste &Vložiť - + Ctrl+V - + + &View &Zobraziť - + The document has been modified. Do you want to save your changes? Dokument bol zmenený. Chcete uložiť Vaše zmeny? - + &%1. %2 - + &About... &O aplikácii... - + &Help &Pomocník - + About O aplikácii - + &Properties &Vlastnosti - + &Close Za&vrieť - + Ctrl+W - + Show &Grid Zobraziť m&riežku - + + <p> +<b>Database Modeller + + + + Untitled Nepomenované - + &Notation &Notácia - + &Relational &Relačná - + &Crow's Foot - + &Diagram - <p> <b>Database Modeller</b><br /> <a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br /> Copyright (C) 2008 Lukas Lalinsky </p> - <p><b>Database Modeller</b><br /><a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br />Copyright (C) 2008 Lukáš Lalinský</p> + <p><b>Database Modeller</b><br /><a href="http://oxygene.sk/lukas/dbmodel/">http://oxygene.sk/lukas/dbmodel/</a><br />Copyright (C) 2008 Lukáš Lalinský</p> + + QtColorPicker + + + + + Black + + + + + + White + + + + + + Red + + + + + + Dark red + + + + + + Green + + + + + + Dark green + + + + + + Blue + + + + + + Dark blue + + + + + + Cyan + + + + + + Dark cyan + + + + + + Magenta + + + + + + Dark magenta + + + + + + Yellow + + + + + + Dark yellow + + + + + + Gray + + + + + + Dark gray + + + + + + Light gray + + + + + Custom + + + TableProperties - &Definition &Definícia - Name: Názov: - &Columns Stĺ&ce - Add new column Pridať nový stĺpec - &Add Prid&ať - Remove selected column Odstrániť vybraný stĺpec - &Remove Odst&rániť - Move selected column up Posunúť vybraný stĺpec hore - Move &Up Posunúť &hore - Move selected column down Posunúť vybraný stĺpec dole - Move &Down Posunúť &dole -- cgit v1.2.3-54-g00ecf