"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/interface/timetableprintform.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.

timetableprintform.cpp  (fet-5.47.0.tar.bz2):timetableprintform.cpp  (fet-5.47.1.tar.bz2)
skipping to change at line 52 skipping to change at line 52
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include <QSet> #include <QSet>
#include <QList> #include <QList>
#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 bool students_schedule_ready; extern bool students_schedule_ready;
extern bool teachers_schedule_ready; extern bool teachers_schedule_ready;
extern bool rooms_schedule_ready; extern bool rooms_schedule_ready;
extern QHash<int, int> hashActivityColorBySubject; extern QHash<int, int> hashActivityColorBySubject;
extern QList<int> activeHashActivityColorBySubject; extern QList<int> activeHashActivityColorBySubject;
extern QHash<int, int> hashActivityColorBySubjectAndStudents; extern QHash<int, int> hashActivityColorBySubjectAndStudents;
skipping to change at line 74 skipping to change at line 79
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 RBDaysHorizontalState="/days-horizontal-radio-button-state"; const QString RBDaysHorizontalState="/days-horizontal-radio-button-state";
const QString RBDaysVerticalState="/days-vertical-radio-button-state"; const QString RBDaysVerticalState="/days-vertical-radio-button-state";
const QString RBTimeHorizontalState="/time-horizontal-radio-button-state"; const QString RBTimeHorizontalState="/time-horizontal-radio-button-state";
const QString RBTimeVerticalState="/time-vertical-radio-button-state"; const QString RBTimeVerticalState="/time-vertical-radio-button-state";
//By Liviu Lalescu - not used anymore //By Liviu Lalescu - not used anymore
//const QString CBDivideTimeAxisByDayState="/divide-time-axis-timetables-by-days "; //const QString CBDivideTimeAxisByDayState="/divide-time-axis-timetables-by-days ";
const QString RBTimeHorizontalDayState="/time-horizontal-per-day-radio-button-st ate"; const QString RBTimeHorizontalDayState="/time-horizontal-per-day-radio-button-st ate";
const QString RBTimeVerticalDayState="/time-vertical-per-day-radio-button-state" ; const QString RBTimeVerticalDayState="/time-vertical-per-day-radio-button-state" ;
skipping to change at line 261 skipping to change at line 272
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 293 skipping to change at line 337
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 1302 skipping to change at line 1348
}*/ }*/
void TimetablePrintForm::print(){ void TimetablePrintForm::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 open the HTML time tables from the results directory")); "- it is impossible to print from this dialog. Please open the HTML time tables 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 1330 skipping to change at line 1385
} }
#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 timetable")); printDialog.setWindowTitle(tr("Print timetable"));
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 TimetablePrintForm::printPreviewFull(){ void TimetablePrintForm::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 open the HTML time tables from the results directory")); "- it is impossible to print from this dialog. Please open the HTML time tables 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,3,0)
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 1383 skipping to change at line 1451
void TimetablePrintForm::updatePreviewFull(QPrinter* printer){ void TimetablePrintForm::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 open the HTML time tables from the results directory")); "- it is impossible to print from this dialog. Please open the HTML time tables 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 TimetablePrintForm::printPreviewSmall(){ void TimetablePrintForm::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 open the HTML time tables from the results directory")); "- it is impossible to print from this dialog. Please open the HTML time tables 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,3,0)
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)){
skipping to change at line 1435 skipping to change at line 1516
void TimetablePrintForm::updatePreviewSmall(QPrinter* printer){ void TimetablePrintForm::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 open the HTML time tables from the results directory")); "- it is impossible to print from this dialog. Please open the HTML time tables 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 121 lines changed or added

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