diff --git a/sources/bordertitleblock.cpp b/sources/bordertitleblock.cpp --- a/sources/bordertitleblock.cpp +++ b/sources/bordertitleblock.cpp @@ -240,6 +240,8 @@ ip.date = date(); ip.title = title(); ip.filename = fileName(); + ip.machine = machine(); + ip.loc = loc(); ip.version = version(); ip.folio = folio(); ip.template_name = titleBlockTemplateName(); @@ -260,6 +262,8 @@ setDate(ip.date); setTitle(ip.title); setFileName(ip.filename); + setMachine(ip.machine); + setLoc(ip.loc); setVersion(QET::displayedVersion); setFolio(ip.folio); setAutoPageNum(ip.auto_page_num); @@ -695,6 +699,8 @@ context.addValue("date", btb_date_.toString(Qt::SystemLocaleShortDate)); context.addValue("title", btb_title_); context.addValue("filename", btb_filename_); + context.addValue("machine", btb_machine_); + context.addValue("loc", btb_loc_); context.addValue("version", btb_version_); context.addValue("folio", btb_final_folio_); context.addValue("folio-id", folio_index_); diff --git a/sources/bordertitleblock.h b/sources/bordertitleblock.h --- a/sources/bordertitleblock.h +++ b/sources/bordertitleblock.h @@ -95,6 +95,11 @@ QString title() const { return(btb_title_); } /// @return the value of the title block "Folio" field QString folio() const { return(btb_folio_); } + /// @return the value of the title block "Machine" field + QString machine() const { return(btb_machine_); } + /// @return the value of the title block "Folio" field + QString loc() const { return(btb_loc_); } + /// @return the value of the title block "File" field QString fileName() const { return(btb_filename_); } /// @return the value of the title block Additional Fields @@ -146,6 +151,8 @@ } void setFolioData(int, int, QString = NULL, const DiagramContext & = DiagramContext()); /// @param author the new value of the "File" field + void setMachine(const QString &machine) { btb_machine_ = machine; } + void setLoc(const QString &loc) { btb_loc_ = loc; } void setFileName(const QString &filename) { btb_filename_ = filename; } /// @param author the new value of the "Version" field void setVersion(const QString &version) { btb_version_ = version; } @@ -225,6 +232,9 @@ QDate btb_date_; QString btb_title_; QString btb_folio_; + QString btb_machine_; + QString btb_loc_; + QString btb_final_folio_; QString btb_auto_page_num_; int folio_index_; diff --git a/sources/diagramfoliolist.cpp b/sources/diagramfoliolist.cpp --- a/sources/diagramfoliolist.cpp +++ b/sources/diagramfoliolist.cpp @@ -19,7 +19,7 @@ #include #include "qetapp.h" -qreal DiagramFolioList::colWidths[4] = {0.1, 0.55, 0.2, 0.15}; +qreal DiagramFolioList::colWidths[5] = {0.1, 0.1, 0.55, 0.1, 0.15}; /** * @brief DiagramFolioList::DiagramFolioList @@ -74,10 +74,11 @@ qreal y0 = border_and_titleblock.columnsHeaderHeight(); QRectF row_RectBorder(x0, y0, width, height); - buildGrid(p, row_RectBorder,30,2,colWidths); + buildGrid(p, row_RectBorder,30,1,colWidths); x0 = list_rectangles_[0] -> topLeft().x(); y0 = list_rectangles_[0] -> topLeft().y(); + qreal rowHeight = (list_rectangles_[0] -> height())/30; QRectF row_RectF(x0, y0, list_rectangles_[0] -> width(), rowHeight); @@ -84,8 +85,7 @@ fillHeader(p, row_RectF); QList diagram_list = project() -> diagrams(); - int startDiagram = id * 58; - + int startDiagram = id * 29; for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) { y0 += rowHeight; QRectF row_rect(x0, y0, list_rectangles_[0] -> width(), rowHeight); @@ -92,26 +92,10 @@ fillRow(p, row_rect, diagram_list[i] -> border_and_titleblock.author(), diagram_list[i] -> title(), QString::number(diagram_list[i] ->folioIndex()+1), + diagram_list[i] -> border_and_titleblock.folio(), diagram_list[i] -> border_and_titleblock.date().toString(Qt::SystemLocaleShortDate)); } - x0 = list_rectangles_[1] -> topLeft().x(); - y0 = list_rectangles_[1] -> topLeft().y(); - rowHeight = (list_rectangles_[1] -> height())/30; - QRectF row_RectF2(x0, y0, list_rectangles_[1] -> width(), rowHeight); - fillHeader(p, row_RectF2); - - startDiagram += 29; - - for (int i = startDiagram; i < startDiagram+29 && i < diagram_list.size(); ++i) { - y0 += rowHeight; - QRectF row_rect(x0, y0, list_rectangles_[1] -> width(), rowHeight); - fillRow(p, row_rect, diagram_list[i] -> border_and_titleblock.author(), - diagram_list[i] -> title(), - QString::number(diagram_list[i] ->folioIndex()+1), - diagram_list[i] -> border_and_titleblock.date().toString(Qt::SystemLocaleShortDate)); - } - border_and_titleblock.draw(p); p -> restore(); } @@ -123,7 +107,7 @@ * @param row_rect rectangle where we must draw the new row */ void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, QString author, QString title, - QString folio, QString date) + QString folio, QString label, QString date) { qreal x = row_rect.topLeft().x(); qreal y = row_rect.topLeft().y(); @@ -142,33 +126,42 @@ qp -> drawText(QRectF(x, y, colWidths[0]*row_rect.width(), row_rect.height()), Qt::AlignCenter, folio); x += colWidths[0]*row_rect.width(); - if (origFontMetrics.width(title) > 0.95*colWidths[1]*row_rect.width()) - workingFont.setPointSizeF(origFontSize * 0.95*colWidths[1]*row_rect.width() / origFontMetrics.width(title)); + if (origFontMetrics.width(folio) > 0.95*colWidths[1]*row_rect.width()) + workingFont.setPointSizeF(origFontSize * 0.95*colWidths[1]*row_rect.width() / origFontMetrics.width(label)); else workingFont.setPointSizeF(origFontSize); qp -> setFont(workingFont); + qp -> drawText(QRectF(x, y, colWidths[1]*row_rect.width(), row_rect.height()), Qt::AlignCenter, label); + x += colWidths[1]*row_rect.width(); + + + if (origFontMetrics.width(title) > 0.95*colWidths[2]*row_rect.width()) + workingFont.setPointSizeF(origFontSize * 0.95*colWidths[2]*row_rect.width() / origFontMetrics.width(title)); + else + workingFont.setPointSizeF(origFontSize); + qp -> setFont(workingFont); QString heading = tr("Titre"); if (title == heading) - qp -> drawText(QRectF(x, y, colWidths[1]*row_rect.width(),row_rect.height()), Qt::AlignCenter, title); + qp -> drawText(QRectF(x, y, colWidths[2]*row_rect.width(),row_rect.height()), Qt::AlignCenter, title); else - qp -> drawText(QRectF(x+0.01*row_rect.width(), y, colWidths[1]*row_rect.width()*0.99, + qp -> drawText(QRectF(x+0.01*row_rect.width(), y, colWidths[1]*row_rect.width()*6.2, row_rect.height()), Qt::AlignLeft | Qt::AlignVCenter, title); - x += colWidths[1]*row_rect.width(); + x += colWidths[2]*row_rect.width(); - if (origFontMetrics.width(author) > 0.95*colWidths[2]*row_rect.width()) - workingFont.setPointSizeF(origFontSize * 0.95*colWidths[2]*row_rect.width() / origFontMetrics.width(author)); + if (origFontMetrics.width(author) > 0.95*colWidths[3]*row_rect.width()) + workingFont.setPointSizeF(origFontSize * 0.95*colWidths[3]*row_rect.width() / origFontMetrics.width(author)); else workingFont.setPointSizeF(origFontSize); qp -> setFont(workingFont); - qp -> drawText(QRectF(x, y, colWidths[2]*row_rect.width(), row_rect.height()), Qt::AlignCenter, author); - x += colWidths[2]*row_rect.width(); + qp -> drawText(QRectF(x, y, colWidths[3]*row_rect.width(), row_rect.height()), Qt::AlignCenter, author); + x += colWidths[3]*row_rect.width(); - if (origFontMetrics.width(date) > 0.95*colWidths[3]*row_rect.width()) - workingFont.setPointSizeF(origFontSize * 0.95*colWidths[3]*row_rect.width() / origFontMetrics.width(date)); + if (origFontMetrics.width(date) > 0.95*colWidths[4]*row_rect.width()) + workingFont.setPointSizeF(origFontSize * 0.95*colWidths[4]*row_rect.width() / origFontMetrics.width(date)); else workingFont.setPointSizeF(origFontSize); qp -> setFont(workingFont); - qp -> drawText(QRectF(x, y, colWidths[3]*row_rect.width(), row_rect.height()), Qt::AlignCenter, date); + qp -> drawText(QRectF(x, y, colWidths[4]*row_rect.width(), row_rect.height()), Qt::AlignCenter, date); } void DiagramFolioList::buildGrid(QPainter *qp, const QRectF &rect, int rows, int tables, qreal colWidths[]) @@ -179,7 +172,7 @@ list_rectangles_.clear(); qreal sum = 0; - for (int i = 0; i < 4; i++ ) + for (int i = 0; i < 5; i++ ) sum += colWidths[i]; if ( sum < 0.99 || sum > 1.01 ) { qDebug() << "Invalid input: Column widths do not sum to 1"; @@ -189,7 +182,7 @@ qreal tablesSpacing = rect.height() * 0.02; qreal tableWidth = (rect.width() - tablesSpacing*(tables+1) ) / tables; qreal rowHeight = (rect.height() - 2*tablesSpacing) / rows; - int cols = 4;//colWidths.size(); + int cols = 5;//colWidths.size(); qreal x0 = tablesSpacing + rect.topLeft().x(); qreal y0 = tablesSpacing + rect.topLeft().y(); @@ -223,10 +216,11 @@ QString authorTranslatable(QObject::tr("Auteur")); QString titleTranslatable(QObject::tr("Titre")); QString folioTranslatable(QObject::tr("Folio")); + QString labelTranslatable(QObject::tr("Foliolabel")); QString dateTranslatable(QObject::tr("Date")); qp->save(); qp->setFont(QETApp::diagramTextsFont(13)); - fillRow(qp, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, dateTranslatable); + fillRow(qp, row_RectF, authorTranslatable, titleTranslatable, folioTranslatable, labelTranslatable, dateTranslatable); qp->restore(); } diff --git a/sources/diagramfoliolist.h b/sources/diagramfoliolist.h --- a/sources/diagramfoliolist.h +++ b/sources/diagramfoliolist.h @@ -31,13 +31,13 @@ void setId(int i) {id = i;} int getId() const {return id;} - static qreal colWidths[4]; + static qreal colWidths[5]; protected: void drawBackground(QPainter *, const QRectF &); private: - void fillRow(QPainter *, const QRectF &, QString, QString, QString, QString); + void fillRow(QPainter *, const QRectF &, QString, QString, QString, QString, QString); void buildGrid(QPainter *, const QRectF &, int, int, qreal[]); void fillHeader(QPainter *, const QRectF &); diff --git a/sources/qetproject.cpp b/sources/qetproject.cpp --- a/sources/qetproject.cpp +++ b/sources/qetproject.cpp @@ -1039,7 +1039,7 @@ setFolioSheetsQuantity(0); int diagCount = diagrams().size(); - for (int i = 0; i <= diagCount/58; i++) { + for (int i = 0; i <= diagCount/29; i++) { //create new diagram Diagram *diagram_folio_list = new DiagramFolioList(this); diff --git a/sources/titleblockproperties.cpp b/sources/titleblockproperties.cpp --- a/sources/titleblockproperties.cpp +++ b/sources/titleblockproperties.cpp @@ -47,6 +47,8 @@ ip.author == author &&\ ip.date == date &&\ ip.filename == filename &&\ + ip.machine == machine &&\ + ip.loc == loc &&\ ip.version == version &&\ ip.folio == folio &&\ ip.auto_page_num == auto_page_num &&\ @@ -74,6 +76,8 @@ e.setAttribute("author", author); e.setAttribute("title", title); e.setAttribute("filename", filename); + e.setAttribute("machine", machine); + e.setAttribute("loc", loc); e.setAttribute("version", version); e.setAttribute("folio", folio); e.setAttribute("auto_page_num", auto_page_num); @@ -101,6 +105,8 @@ if (e.hasAttribute("author")) author = e.attribute("author"); if (e.hasAttribute("title")) title = e.attribute("title"); if (e.hasAttribute("filename")) filename = e.attribute("filename"); + if (e.hasAttribute("machine")) machine = e.attribute("machine"); + if (e.hasAttribute("loc")) loc = e.attribute("loc"); if (e.hasAttribute("version")) version = e.attribute("version"); if (e.hasAttribute("folio")) folio = e.attribute("folio"); if (e.hasAttribute("auto_page_num")) auto_page_num = e.attribute("auto_page_num"); @@ -131,6 +137,8 @@ settings.setValue(prefix + "title", title); settings.setValue(prefix + "author", author); settings.setValue(prefix + "filename", filename); + settings.setValue(prefix + "machine", machine); + settings.setValue(prefix + "loc", loc); settings.setValue(prefix + "version", version); settings.setValue(prefix + "folio", folio); settings.setValue(prefix + "auto_page_num", auto_page_num); @@ -150,6 +158,8 @@ title = settings.value(prefix + "title").toString(); author = settings.value(prefix + "author").toString(); filename = settings.value(prefix + "filename").toString(); + machine = settings.value(prefix + "machine").toString(); + loc = settings.value(prefix + "loc").toString(); version = settings.value(prefix + "version").toString(); folio = settings.value(prefix + "folio", "%id/%total").toString(); auto_page_num = settings.value(prefix + "auto_page_num").toString(); diff --git a/sources/titleblockproperties.h b/sources/titleblockproperties.h --- a/sources/titleblockproperties.h +++ b/sources/titleblockproperties.h @@ -54,6 +54,8 @@ QString author; ///< Author of the diagram/folio (displayed by the default template) QDate date; ///< Date (displayed by the default template) QString filename; ///< Filename (displayed by the default template) + QString machine; ///< Machine (displayed by the default template) + QString loc; ///< Location(displayed by the default template) QString version; ///< Version (displayed by the default template) QString folio; ///< Folio information (displayed by the default template) QString auto_page_num; diff --git a/sources/ui/titleblockpropertieswidget.cpp b/sources/ui/titleblockpropertieswidget.cpp --- a/sources/ui/titleblockpropertieswidget.cpp +++ b/sources/ui/titleblockpropertieswidget.cpp @@ -95,6 +95,8 @@ ui -> m_title_le -> setText (properties.title); ui -> m_author_le -> setText (properties.author); ui -> m_file_le -> setText (properties.filename); + ui -> m_mach -> setText (properties.machine); + ui -> m_loc -> setText (properties.loc); ui -> m_folio_le -> setText (properties.folio); ui -> m_display_at_cb -> setCurrentIndex(properties.display_at == Qt::BottomEdge ? 0 : 1); ui->auto_page_cb->setCurrentText(properties.auto_page_num); @@ -150,6 +152,8 @@ prop.title = ui -> m_title_le -> text(); prop.author = ui -> m_author_le -> text(); prop.filename = ui -> m_file_le -> text(); + prop.machine = ui -> m_mach -> text(); + prop.loc = ui -> m_loc -> text(); prop.folio = ui -> m_folio_le -> text(); prop.display_at = ui -> m_display_at_cb -> currentIndex() == 0 ? Qt::BottomEdge : Qt::RightEdge; @@ -188,6 +192,8 @@ prop.title = ui -> m_title_le -> text(); prop.author = ui -> m_author_le -> text(); prop.filename = ui -> m_file_le -> text(); + prop.machine = ui -> m_mach -> text(); + prop.loc = ui -> m_loc -> text(); prop.folio = "%autonum"; prop.display_at = ui -> m_display_at_cb -> currentIndex() == 0 ? Qt::BottomEdge : Qt::RightEdge; diff --git a/sources/ui/titleblockpropertieswidget.ui b/sources/ui/titleblockpropertieswidget.ui --- a/sources/ui/titleblockpropertieswidget.ui +++ b/sources/ui/titleblockpropertieswidget.ui @@ -42,8 +42,8 @@ 0 0 - 552 - 570 + 538 + 608 @@ -123,32 +123,6 @@ - - - - Fichier : - - - - - - - QFrame::NoFrame - - - Les variables suivantes sont utilisables dans le champ Folio : -- %id : numéro du folio courant dans le projet -- %total : nombre total de folios dans le projet -- %autonum : Folio Auto Numeration - - - false - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - @@ -159,66 +133,99 @@ - - + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + + 16 + 16 + + - Folio : + + + + :/ico/16x16/configure.png:/ico/16x16/configure.png + - - + + + + - Titre : + Afficher : - - - - Disponible en tant que %folio pour les modèles de cartouches + + + + Indice Rev - - - - Disponible en tant que %title pour les modèles de cartouches + + + + Auteur : - - - - <html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html> - - + + + + + + + + - en bas + Folio : + - + + - à droite + Fichier : - - - + + - Disponible en tant que %filename pour les modèles de cartouches + Disponible en tant que %title pour les modèles de cartouches - - - - Auteur : + + + + Disponible en tant que %author pour les modèles de cartouches - + @@ -270,68 +277,117 @@ - - + + + + Titre : + + + + + - Disponible en tant que %author pour les modèles de cartouches + Disponible en tant que %filename pour les modèles de cartouches - - - - Afficher : + + + + Disponible en tant que %folio pour les modèles de cartouches - - - - + + - + 0 0 + + Page Num: + - - - - - 0 - 0 - + + + + <html><head/><body><p>Affiche le cartouche en bas (horizontalement) ou à droite (verticalement) du folio.</p></body></html> - - - 16 - 16 - + + + en bas + + - + à droite - - - :/ico/16x16/configure.png:/ico/16x16/configure.png + + + + + + + QFrame::NoFrame + + Les variables suivantes sont utilisables dans le champ Folio : +- %id : numéro du folio courant dans le projet +- %total : nombre total de folios dans le projet +- %autonum : Folio Auto Numeration + + + false + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + - + + + + Machine : + + - - - - - 0 - 0 - + + + + Localisation + + + + + - Page Num: + A + + + + B + + + + + C + + + + + D + + + + + E + +