"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/interface/statisticsprintform.cpp" between
fet-5.47.0.tar.bz2 and fet-5.47.1.tar.bz2

About: FET allows to automatically schedule a timetable for e.g. of a school, high-school or university.

statisticsprintform.cpp  (fet-5.47.0.tar.bz2):statisticsprintform.cpp  (fet-5.47.1.tar.bz2)
skipping to change at line 48 skipping to change at line 48
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QSet> #include <QSet>
#include <QList> #include <QList>
#include <QMap> #include <QMap>
#ifndef QT_NO_PRINTER #ifndef QT_NO_PRINTER
#include <QPrinter> #include <QPrinter>
#include <QPrintDialog> #include <QPrintDialog>
#include <QPrintPreviewDialog> #include <QPrintPreviewDialog>
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
#include <QPageSize>
#endif
#endif #endif
extern Timetable gt; extern Timetable gt;
extern QString generationLocalizedTime; extern QString generationLocalizedTime;
extern const QString COMPANY; extern const QString COMPANY;
extern const QString PROGRAM; extern const QString PROGRAM;
//static int numberOfPlacedActivities1; //static int numberOfPlacedActivities1;
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
static QMap<LocaleString, int> paperSizesMap; static QMap<LocaleString, int> paperSizesMap;
#else #else
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
static QMap<LocaleString, QPageSize> paperSizesMap;
#else
static QMap<LocaleString, QPrinter::PaperSize> paperSizesMap; static QMap<LocaleString, QPrinter::PaperSize> paperSizesMap;
#endif #endif
#endif
//const QString CBTablesState="/timetables-combo-box-state"; //const QString CBTablesState="/timetables-combo-box-state";
const QString studentSubjectRBState="/student-subject-state-radio-button-state"; const QString studentSubjectRBState="/student-subject-state-radio-button-state";
const QString studentTeacherRBState="/student-teacher-state-radio-button-state"; const QString studentTeacherRBState="/student-teacher-state-radio-button-state";
const QString teacherSubjectRBState="/teacher-subject-state-radio-button-state"; const QString teacherSubjectRBState="/teacher-subject-state-radio-button-state";
const QString teacherStudentRBState="/teacher-student-state-radio-button-state"; const QString teacherStudentRBState="/teacher-student-state-radio-button-state";
const QString subjectStudentRBState="/subject-student-state-radio-button-state"; const QString subjectStudentRBState="/subject-student-state-radio-button-state";
const QString subjectTeacherRBState="/subject-teacher-state-radio-button-state"; const QString subjectTeacherRBState="/subject-teacher-state-radio-button-state";
const QString CBBreakState="/page-break-combo-box-state"; const QString CBBreakState="/page-break-combo-box-state";
skipping to change at line 195 skipping to change at line 206
CBprinterMode=new QComboBox(); CBprinterMode=new QComboBox();
CBprinterMode->addItems(printerModeStrings); CBprinterMode->addItems(printerModeStrings);
CBprinterMode->setCurrentIndex(2); CBprinterMode->setCurrentIndex(2);
CBprinterMode->setDisabled(true); CBprinterMode->setDisabled(true);
CBprinterMode->setSizePolicy(QSizePolicy::Expanding, CBprinterMode->sizeP olicy().verticalPolicy()); CBprinterMode->setSizePolicy(QSizePolicy::Expanding, CBprinterMode->sizeP olicy().verticalPolicy());
*/ */
paperSizesMap.clear(); paperSizesMap.clear();
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
paperSizesMap.insert(tr("Custom", "Type of paper size"), 30); paperSizesMap.insert(tr("Custom", "Type of paper size"), 30);
#else #else
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
paperSizesMap.insert(tr("A0", "Type of paper size"), QPageSize(QPageSize:
:A0));
paperSizesMap.insert(tr("A1", "Type of paper size"), QPageSize(QPageSize:
:A1));
paperSizesMap.insert(tr("A2", "Type of paper size"), QPageSize(QPageSize:
:A2));
paperSizesMap.insert(tr("A3", "Type of paper size"), QPageSize(QPageSize:
:A3));
paperSizesMap.insert(tr("A4", "Type of paper size"), QPageSize(QPageSize:
:A4));
paperSizesMap.insert(tr("A5", "Type of paper size"), QPageSize(QPageSize:
:A5));
paperSizesMap.insert(tr("A6", "Type of paper size"), QPageSize(QPageSize:
:A6));
paperSizesMap.insert(tr("A7", "Type of paper size"), QPageSize(QPageSize:
:A7));
paperSizesMap.insert(tr("A8", "Type of paper size"), QPageSize(QPageSize:
:A8));
paperSizesMap.insert(tr("A9", "Type of paper size"), QPageSize(QPageSize:
:A9));
paperSizesMap.insert(tr("B0", "Type of paper size"), QPageSize(QPageSize:
:B0));
paperSizesMap.insert(tr("B1", "Type of paper size"), QPageSize(QPageSize:
:B1));
paperSizesMap.insert(tr("B2", "Type of paper size"), QPageSize(QPageSize:
:B2));
paperSizesMap.insert(tr("B3", "Type of paper size"), QPageSize(QPageSize:
:B3));
paperSizesMap.insert(tr("B4", "Type of paper size"), QPageSize(QPageSize:
:B4));
paperSizesMap.insert(tr("B5", "Type of paper size"), QPageSize(QPageSize:
:B5));
paperSizesMap.insert(tr("B6", "Type of paper size"), QPageSize(QPageSize:
:B6));
paperSizesMap.insert(tr("B7", "Type of paper size"), QPageSize(QPageSize:
:B7));
paperSizesMap.insert(tr("B8", "Type of paper size"), QPageSize(QPageSize:
:B8));
paperSizesMap.insert(tr("B9", "Type of paper size"), QPageSize(QPageSize:
:B9));
paperSizesMap.insert(tr("B10", "Type of paper size"), QPageSize(QPageSize
::B10));
paperSizesMap.insert(tr("C5E", "Type of paper size"), QPageSize(QPageSize
::C5E));
paperSizesMap.insert(tr("Comm10E", "Type of paper size"), QPageSize(QPage
Size::Comm10E));
paperSizesMap.insert(tr("DLE", "Type of paper size"), QPageSize(QPageSize
::DLE));
paperSizesMap.insert(tr("Executive", "Type of paper size"), QPageSize(QPa
geSize::Executive));
paperSizesMap.insert(tr("Folio", "Type of paper size"), QPageSize(QPageSi
ze::Folio));
paperSizesMap.insert(tr("Ledger", "Type of paper size"), QPageSize(QPageS
ize::Ledger));
paperSizesMap.insert(tr("Legal", "Type of paper size"), QPageSize(QPageSi
ze::Legal));
paperSizesMap.insert(tr("Letter", "Type of paper size"), QPageSize(QPageS
ize::Letter));
paperSizesMap.insert(tr("Tabloid", "Type of paper size"), QPageSize(QPage
Size::Tabloid));
#else
paperSizesMap.insert(tr("A0", "Type of paper size"), QPrinter::A0); paperSizesMap.insert(tr("A0", "Type of paper size"), QPrinter::A0);
paperSizesMap.insert(tr("A1", "Type of paper size"), QPrinter::A1); paperSizesMap.insert(tr("A1", "Type of paper size"), QPrinter::A1);
paperSizesMap.insert(tr("A2", "Type of paper size"), QPrinter::A2); paperSizesMap.insert(tr("A2", "Type of paper size"), QPrinter::A2);
paperSizesMap.insert(tr("A3", "Type of paper size"), QPrinter::A3); paperSizesMap.insert(tr("A3", "Type of paper size"), QPrinter::A3);
paperSizesMap.insert(tr("A4", "Type of paper size"), QPrinter::A4); paperSizesMap.insert(tr("A4", "Type of paper size"), QPrinter::A4);
paperSizesMap.insert(tr("A5", "Type of paper size"), QPrinter::A5); paperSizesMap.insert(tr("A5", "Type of paper size"), QPrinter::A5);
paperSizesMap.insert(tr("A6", "Type of paper size"), QPrinter::A6); paperSizesMap.insert(tr("A6", "Type of paper size"), QPrinter::A6);
paperSizesMap.insert(tr("A7", "Type of paper size"), QPrinter::A7); paperSizesMap.insert(tr("A7", "Type of paper size"), QPrinter::A7);
paperSizesMap.insert(tr("A8", "Type of paper size"), QPrinter::A8); paperSizesMap.insert(tr("A8", "Type of paper size"), QPrinter::A8);
paperSizesMap.insert(tr("A9", "Type of paper size"), QPrinter::A9); paperSizesMap.insert(tr("A9", "Type of paper size"), QPrinter::A9);
skipping to change at line 227 skipping to change at line 271
paperSizesMap.insert(tr("Comm10E", "Type of paper size"), QPrinter::Comm1 0E); paperSizesMap.insert(tr("Comm10E", "Type of paper size"), QPrinter::Comm1 0E);
paperSizesMap.insert(tr("DLE", "Type of paper size"), QPrinter::DLE); paperSizesMap.insert(tr("DLE", "Type of paper size"), QPrinter::DLE);
paperSizesMap.insert(tr("Executive", "Type of paper size"), QPrinter::Exe cutive); paperSizesMap.insert(tr("Executive", "Type of paper size"), QPrinter::Exe cutive);
paperSizesMap.insert(tr("Folio", "Type of paper size"), QPrinter::Folio); paperSizesMap.insert(tr("Folio", "Type of paper size"), QPrinter::Folio);
paperSizesMap.insert(tr("Ledger", "Type of paper size"), QPrinter::Ledger ); paperSizesMap.insert(tr("Ledger", "Type of paper size"), QPrinter::Ledger );
paperSizesMap.insert(tr("Legal", "Type of paper size"), QPrinter::Legal); paperSizesMap.insert(tr("Legal", "Type of paper size"), QPrinter::Legal);
paperSizesMap.insert(tr("Letter", "Type of paper size"), QPrinter::Letter ); paperSizesMap.insert(tr("Letter", "Type of paper size"), QPrinter::Letter );
paperSizesMap.insert(tr("Tabloid", "Type of paper size"), QPrinter::Tablo id); paperSizesMap.insert(tr("Tabloid", "Type of paper size"), QPrinter::Tablo id);
#endif #endif
#endif
CBpaperSize=new QComboBox(); CBpaperSize=new QComboBox();
//CBpaperSize->addItems(paperSizesMap.keys()); //CBpaperSize->addItems(paperSizesMap.keys());
QList<LocaleString> items=paperSizesMap.keys(); QList<LocaleString> items=paperSizesMap.keys();
for(const LocaleString& s : qAsConst(items)) for(const LocaleString& s : qAsConst(items))
CBpaperSize->addItem(s); CBpaperSize->addItem(s);
if(CBpaperSize->count()>=5) if(CBpaperSize->count()>=5)
CBpaperSize->setCurrentIndex(4); CBpaperSize->setCurrentIndex(4);
else if(CBpaperSize->count()>=1) else if(CBpaperSize->count()>=1)
skipping to change at line 874 skipping to change at line 920
}*/ }*/
void StatisticsPrintForm::print(){ void StatisticsPrintForm::print(){
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support " QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support "
"- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory")); "- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory"));
#else #else
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
assert(paperSizesMap.contains(CBpaperSize->currentText())); assert(paperSizesMap.contains(CBpaperSize->currentText()));
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
printer.setPageSize(paperSizesMap.value(CBpaperSize->currentText()));
#else
printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText())); printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText()));
#endif
switch(CBorientationMode->currentIndex()){ switch(CBorientationMode->currentIndex()){
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
case 0: printer.setPageOrientation(QPageLayout::Portrait); break;
case 1: printer.setPageOrientation(QPageLayout::Landscape); break
;
#else
case 0: printer.setOrientation(QPrinter::Portrait); break; case 0: printer.setOrientation(QPrinter::Portrait); break;
case 1: printer.setOrientation(QPrinter::Landscape); break; case 1: printer.setOrientation(QPrinter::Landscape); break;
#endif
default: assert(0==1); default: assert(0==1);
} }
#if QT_VERSION >= QT_VERSION_CHECK(5,3,0) #if QT_VERSION >= QT_VERSION_CHECK(5,3,0)
QMarginsF printerMargins; QMarginsF printerMargins;
printerMargins.setLeft(leftPageMargin->value()); printerMargins.setLeft(leftPageMargin->value());
printerMargins.setRight(rightPageMargin->value()); printerMargins.setRight(rightPageMargin->value());
printerMargins.setBottom(bottomPageMargin->value()); printerMargins.setBottom(bottomPageMargin->value());
printerMargins.setTop(topPageMargin->value()); printerMargins.setTop(topPageMargin->value());
if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){ if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){
printerMargins=printer.pageLayout().minimumMargins(); printerMargins=printer.pageLayout().minimumMargins();
skipping to change at line 902 skipping to change at line 957
} }
#else #else
printer.setPageMargins(leftPageMargin->value(), topPageMargin->value(), r ightPageMargin->value(), bottomPageMargin->value(), QPrinter::Millimeter); printer.setPageMargins(leftPageMargin->value(), topPageMargin->value(), r ightPageMargin->value(), bottomPageMargin->value(), QPrinter::Millimeter);
#endif #endif
//QPrintDialog *printDialog = new QPrintDialog(&printer, this); //QPrintDialog *printDialog = new QPrintDialog(&printer, this);
QPrintDialog printDialog(&printer, this); QPrintDialog printDialog(&printer, this);
printDialog.setWindowTitle(tr("Print statistics")); printDialog.setWindowTitle(tr("Print statistics"));
if (printDialog.exec() == QDialog::Accepted) { if (printDialog.exec() == QDialog::Accepted) {
QTextDocument textDocument; QTextDocument textDocument;
textDocument.documentLayout()->setPaintDevice(&printer); textDocument.documentLayout()->setPaintDevice(&printer);
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
textDocument.setPageSize(QSizeF(printer.pageLayout().paintRectPix
els(printer.resolution()).size()));
#else
textDocument.setPageSize(QSizeF(printer.pageRect().size())); textDocument.setPageSize(QSizeF(printer.pageRect().size()));
#endif
textDocument.setHtml(updateHTMLprintString(true)); textDocument.setHtml(updateHTMLprintString(true));
textDocument.print(&printer); textDocument.print(&printer);
} }
//delete printDialog; //delete printDialog;
#endif #endif
} }
void StatisticsPrintForm::printPreviewFull(){ void StatisticsPrintForm::printPreviewFull(){
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support " QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support "
"- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory")); "- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory"));
#else #else
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
assert(paperSizesMap.contains(CBpaperSize->currentText())); assert(paperSizesMap.contains(CBpaperSize->currentText()));
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
printer.setPageSize(paperSizesMap.value(CBpaperSize->currentText()));
#else
printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText())); printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText()));
#endif
switch(CBorientationMode->currentIndex()){ switch(CBorientationMode->currentIndex()){
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
case 0: printer.setPageOrientation(QPageLayout::Portrait); break;
case 1: printer.setPageOrientation(QPageLayout::Landscape); break
;
#else
case 0: printer.setOrientation(QPrinter::Portrait); break; case 0: printer.setOrientation(QPrinter::Portrait); break;
case 1: printer.setOrientation(QPrinter::Landscape); break; case 1: printer.setOrientation(QPrinter::Landscape); break;
#endif
default: assert(0==1); default: assert(0==1);
} }
#if QT_VERSION >= QT_VERSION_CHECK(5,3,0) #if QT_VERSION >= QT_VERSION_CHECK(5,3,0)
QMarginsF printerMargins; QMarginsF printerMargins;
printerMargins.setLeft(leftPageMargin->value()); printerMargins.setLeft(leftPageMargin->value());
printerMargins.setRight(rightPageMargin->value()); printerMargins.setRight(rightPageMargin->value());
printerMargins.setBottom(bottomPageMargin->value()); printerMargins.setBottom(bottomPageMargin->value());
printerMargins.setTop(topPageMargin->value()); printerMargins.setTop(topPageMargin->value());
if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){ if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){
printerMargins=printer.pageLayout().minimumMargins(); printerMargins=printer.pageLayout().minimumMargins();
skipping to change at line 955 skipping to change at line 1023
void StatisticsPrintForm::updatePreviewFull(QPrinter* printer){ void StatisticsPrintForm::updatePreviewFull(QPrinter* printer){
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
Q_UNUSED(printer); Q_UNUSED(printer);
QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support " QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support "
"- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory")); "- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory"));
#else #else
QTextDocument textDocument; QTextDocument textDocument;
textDocument.documentLayout()->setPaintDevice(printer); textDocument.documentLayout()->setPaintDevice(printer);
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
textDocument.setPageSize(QSizeF(printer->pageLayout().paintRectPixels(pri
nter->resolution()).size()));
#else
textDocument.setPageSize(QSizeF(printer->pageRect().size())); textDocument.setPageSize(QSizeF(printer->pageRect().size()));
#endif
textDocument.setHtml(updateHTMLprintString(true)); textDocument.setHtml(updateHTMLprintString(true));
textDocument.print(printer); textDocument.print(printer);
#endif #endif
} }
void StatisticsPrintForm::printPreviewSmall(){ void StatisticsPrintForm::printPreviewSmall(){
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support " QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support "
"- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory")); "- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory"));
#else #else
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
assert(paperSizesMap.contains(CBpaperSize->currentText())); assert(paperSizesMap.contains(CBpaperSize->currentText()));
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
#else
printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText())); printer.setPaperSize(paperSizesMap.value(CBpaperSize->currentText()));
#endif
switch(CBorientationMode->currentIndex()){ switch(CBorientationMode->currentIndex()){
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
case 0: printer.setPageOrientation(QPageLayout::Portrait); break;
case 1: printer.setPageOrientation(QPageLayout::Landscape); break
;
#else
case 0: printer.setOrientation(QPrinter::Portrait); break; case 0: printer.setOrientation(QPrinter::Portrait); break;
case 1: printer.setOrientation(QPrinter::Landscape); break; case 1: printer.setOrientation(QPrinter::Landscape); break;
#endif
default: assert(0==1); default: assert(0==1);
} }
#if QT_VERSION >= QT_VERSION_CHECK(5,3,0) #if QT_VERSION >= QT_VERSION_CHECK(5,3,0)
QMarginsF printerMargins; QMarginsF printerMargins;
printerMargins.setLeft(leftPageMargin->value()); printerMargins.setLeft(leftPageMargin->value());
printerMargins.setRight(rightPageMargin->value()); printerMargins.setRight(rightPageMargin->value());
printerMargins.setBottom(bottomPageMargin->value()); printerMargins.setBottom(bottomPageMargin->value());
printerMargins.setTop(topPageMargin->value()); printerMargins.setTop(topPageMargin->value());
if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){ if(!printer.setPageMargins(printerMargins, QPageLayout::Millimeter)){
printerMargins=printer.pageLayout().minimumMargins(); printerMargins=printer.pageLayout().minimumMargins();
skipping to change at line 1006 skipping to change at line 1086
void StatisticsPrintForm::updatePreviewSmall(QPrinter* printer){ void StatisticsPrintForm::updatePreviewSmall(QPrinter* printer){
#ifdef QT_NO_PRINTER #ifdef QT_NO_PRINTER
Q_UNUSED(printer); Q_UNUSED(printer);
QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support " QMessageBox::warning(this, tr("FET warning"), tr("FET is compiled without printer support "
"- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory")); "- it is impossible to print from this dialog. Please export and open th e HTML statistics from the results directory"));
#else #else
QTextDocument textDocument; QTextDocument textDocument;
textDocument.documentLayout()->setPaintDevice(printer); textDocument.documentLayout()->setPaintDevice(printer);
#if QT_VERSION >= QT_VERSION_CHECK(5,15,2)
textDocument.setPageSize(QSizeF(printer->pageLayout().paintRectPixels(pri
nter->resolution()).size()));
#else
textDocument.setPageSize(QSizeF(printer->pageRect().size())); textDocument.setPageSize(QSizeF(printer->pageRect().size()));
#endif
textDocument.setHtml(updateHTMLprintString(false)); textDocument.setHtml(updateHTMLprintString(false));
textDocument.print(printer); textDocument.print(printer);
#endif #endif
} }
 End of changes. 23 change blocks. 
0 lines changed or deleted 120 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)