25 #include "generics/reverse.h" |
25 #include "generics/reverse.h" |
26 #include "main.h" |
26 #include "main.h" |
27 #include "canvas.h" |
27 #include "canvas.h" |
28 #include "mainwindow.h" |
28 #include "mainwindow.h" |
29 #include "lddocument.h" |
29 #include "lddocument.h" |
30 #include "messageLog.h" |
|
31 #include "ui_mainwindow.h" |
30 #include "ui_mainwindow.h" |
32 #include "primitives.h" |
31 #include "primitives.h" |
33 #include "editmodes/abstractEditMode.h" |
32 #include "editmodes/abstractEditMode.h" |
34 #include "toolsets/toolset.h" |
33 #include "toolsets/toolset.h" |
35 #include "dialogs/configdialog.h" |
34 #include "dialogs/configdialog.h" |
57 ui (*new Ui_MainWindow), |
56 ui (*new Ui_MainWindow), |
58 m_externalPrograms (nullptr), |
57 m_externalPrograms (nullptr), |
59 m_documents (new DocumentManager (this)), |
58 m_documents (new DocumentManager (this)), |
60 m_currentDocument (nullptr) |
59 m_currentDocument (nullptr) |
61 { |
60 { |
62 m_messageLog = new MessageManager {this}; |
61 connect( |
|
62 &singleton<Printer>(), |
|
63 &Printer::linePrinted, |
|
64 [&](const QString& line) |
|
65 { |
|
66 this->statusBar()->showMessage(line, 5000); |
|
67 } |
|
68 ); |
|
69 |
63 ui.setupUi (this); |
70 ui.setupUi (this); |
64 this->restoreGeometry(config::mainWindowGeometry()); |
71 this->restoreGeometry(config::mainWindowGeometry()); |
65 this->restoreState(config::mainWindowState()); |
72 this->restoreState(config::mainWindowState()); |
66 |
73 |
67 if (config::mainSplitterState().isEmpty()) |
74 if (config::mainSplitterState().isEmpty()) |
606 return save (doc, true); // yay recursion! |
613 return save (doc, true); // yay recursion! |
607 |
614 |
608 return false; |
615 return false; |
609 } |
616 } |
610 |
617 |
611 void MainWindow::addMessage(QString message) |
|
612 { |
|
613 messageLog()->addLine(message); |
|
614 |
|
615 // Also print it to stdout |
|
616 fprint(stdout, "%1\n", message); |
|
617 } |
|
618 |
|
619 /* |
618 /* |
620 * Returns an icon from built-in resources. |
619 * Returns an icon from built-in resources. |
621 */ |
620 */ |
622 QPixmap MainWindow::getIcon(QString iconName) |
621 QPixmap MainWindow::getIcon(QString iconName) |
623 { |
622 { |
951 if (not renderer) |
950 if (not renderer) |
952 { |
951 { |
953 renderer = new Canvas {document, this}; |
952 renderer = new Canvas {document, this}; |
954 m_renderers[document] = renderer; |
953 m_renderers[document] = renderer; |
955 ui.rendererStack->addWidget(renderer); |
954 ui.rendererStack->addWidget(renderer); |
956 connect(m_messageLog, SIGNAL(changed()), renderer, SLOT(update())); |
955 //connect(m_messageLog, SIGNAL(changed()), renderer, SLOT(update())); |
957 } |
956 } |
958 |
957 |
959 return renderer; |
958 return renderer; |
960 } |
959 } |
961 |
960 |