diff --git a/core/core.pro b/core/core.pro
index 1d1fb6b..fe4434a 100644
--- a/core/core.pro
+++ b/core/core.pro
@@ -178,9 +178,26 @@ else:unix: LIBS += -L$$OUT_PWD/../qdecimal/lib/ -lqdecimal -ldecnumber
INCLUDEPATH += $$PWD/../qdecimal/src
INCLUDEPATH += $$PWD/../qdecimal/decnumber
-win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../LimeReport/build/5.5.1/win32/release/lib/ -llimereport
-else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../LimeReport/build/5.5.1/win32/debug/lib/ -llimereport
-else:unix: LIBS += -L$$PWD/../../LimeReport/build/5.5.1/win32/debug/lib/ -llimereport
+unix{
+ ARCH_TYPE = unix
+ macx{
+ ARCH_TYPE = macx
+ }
+ linux{
+ !contains(QT_ARCH, x86_64){
+ ARCH_TYPE = linux32
+ }else{
+ ARCH_TYPE = linux64
+ }
+ }
+}
+win32 {
+ ARCH_TYPE = win32
+}
+
+win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/release/lib/ -llimereport
+else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/debug/lib/ -llimereport
+else:unix: LIBS += -L$$PWD/../../LimeReport/build/$${QT_VERSION}/$${ARCH_TYPE}/debug/lib/ -llimereport
INCLUDEPATH += $$PWD/../../LimeReport/include
DEPENDPATH += $$PWD/../../LimeReport/include
diff --git a/core/igridform.cpp b/core/igridform.cpp
index c5fef79..f98d651 100644
--- a/core/igridform.cpp
+++ b/core/igridform.cpp
@@ -134,7 +134,7 @@ void IGridForm::on_btnFilter_toggled(bool checked)
}
}
-void IGridForm::on_tableView_clicked(const QModelIndex &index)
+void IGridForm::on_tableView_clicked(const QModelIndex &)
{
if (ui->tableView->currentIndex().isValid())
{
@@ -145,10 +145,6 @@ void IGridForm::on_tableView_clicked(const QModelIndex &index)
void IGridForm::on_btnPrint_clicked()
{
- /*ReportViewer *viewer = new ReportViewer(this);
- viewer->setAttribute(Qt::WA_DeleteOnClose);
- viewer->showMaximized();*/
-
ReportDialog *dialog = new ReportDialog(this);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setReports(Context::instance().plugin(pluginId())->reports());
diff --git a/core/reporting/reportdialog.cpp b/core/reporting/reportdialog.cpp
index 31c3554..787831b 100644
--- a/core/reporting/reportdialog.cpp
+++ b/core/reporting/reportdialog.cpp
@@ -38,6 +38,19 @@ void ReportDialog::setReports(ReportList reports)
ui->listReports->setModel(model);
m_reports = reports;
+
+ connect(ui->listReports->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](const QModelIndex, QModelIndex){
+ ui->textDescription->setText(m_reports[ui->listReports->currentIndex().row()]->description());
+ });
+
+
+ if (!reports.isEmpty())
+ {
+ ui->btnPreview->setEnabled(true);
+ ui->btnPrint->setEnabled(true);
+
+ ui->listReports->setCurrentIndex(model->index(0, 0));
+ }
}
void ReportDialog::on_btnPreview_clicked()
@@ -48,3 +61,15 @@ void ReportDialog::on_btnPreview_clicked()
viewer->setReport(m_reports[ui->listReports->currentIndex().row()]);
viewer->openPreview();
}
+
+void ReportDialog::on_btnPrint_clicked()
+{
+ ReportViewer viever;
+ viever.setReport(m_reports[ui->listReports->currentIndex().row()]);
+ viever.directPrint();
+}
+
+void ReportDialog::on_btnClose_clicked()
+{
+ close();
+}
diff --git a/core/reporting/reportdialog.h b/core/reporting/reportdialog.h
index 3a1b951..cc7795a 100644
--- a/core/reporting/reportdialog.h
+++ b/core/reporting/reportdialog.h
@@ -21,6 +21,10 @@ public:
private slots:
void on_btnPreview_clicked();
+ void on_btnPrint_clicked();
+
+ void on_btnClose_clicked();
+
private:
Ui::ReportDialog *ui;
ReportList m_reports;
diff --git a/core/reporting/reportdialog.ui b/core/reporting/reportdialog.ui
index 89adb85..fd2540c 100644
--- a/core/reporting/reportdialog.ui
+++ b/core/reporting/reportdialog.ui
@@ -96,7 +96,11 @@
0
-
-
+
+
+ QAbstractItemView::SelectRows
+
+
@@ -141,6 +145,9 @@
-
+
+ false
+
Preview
@@ -152,6 +159,9 @@
-
+
+ false
+
Print
diff --git a/core/reporting/reportviewer.cpp b/core/reporting/reportviewer.cpp
index e8f8605..8666c33 100644
--- a/core/reporting/reportviewer.cpp
+++ b/core/reporting/reportviewer.cpp
@@ -4,6 +4,7 @@
#include "../context.h"
#include
+#include
#include
ReportViewer::ReportViewer(QWidget *parent) :
@@ -11,6 +12,7 @@ ReportViewer::ReportViewer(QWidget *parent) :
ui(new Ui::ReportViewer)
{
ui->setupUi(this);
+ m_report = NULL;
}
ReportViewer::~ReportViewer()
@@ -33,6 +35,8 @@ void ReportViewer::setReport(ReportPtr report)
void ReportViewer::openPreview()
{
+ Q_ASSERT(m_report != NULL);
+
showMaximized();
m_prevWidget = m_report->createPreviewWidget(this);
@@ -52,6 +56,22 @@ void ReportViewer::openPreview()
m_prevWidget->refreshPages();
}
+void ReportViewer::directPrint(bool dialog)
+{
+ Q_ASSERT(m_report != NULL);
+
+ QPrinter printer(QPrinter::HighResolution);
+
+ if (dialog || !printer.isValid())
+ {
+ m_report->printReport();
+ }
+ else
+ {
+ m_report->printReport(&printer);
+ }
+}
+
void ReportViewer::on_btnClose_clicked()
{
close();
diff --git a/core/reporting/reportviewer.h b/core/reporting/reportviewer.h
index e1b4247..376874e 100644
--- a/core/reporting/reportviewer.h
+++ b/core/reporting/reportviewer.h
@@ -22,6 +22,7 @@ public:
~ReportViewer();
void setReport(ReportPtr report);
void openPreview();
+ void directPrint(bool dialog = true);
private slots:
void on_btnClose_clicked();