Merge branch 'master' of https://git.bukova.info/repos/git/prodejna
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="345.552" x2="29.998" y1="227.99" y2="227.99"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><g><rect fill="#D5D6D6" height="389" rx="23" ry="22" width="250" x="210" y="35"/><rect fill="none" height="389" rx="23" ry="22" stroke="#434242" stroke-width="30" width="250" x="210" y="35"/><path d="M34 236l95 73c3 2 7 3 11 1 3-2 5-5 5-9v-42h191c5 0 10-5 10-10v-40c0-5-5-10-10-10h-191v-44c0-4-2-7-5-9-4-2-8-1-11 1l-95 73c-3 2-4 5-4 8s1 6 4 8z" fill="url(#a)" stroke="#434242" stroke-width="10"/><path d="M290 77l137-30c12-3 23 10 23 23l3 317c0 13-11 20-24 23l-136 40c-12 4-23-10-23-23l-3-327c0-13 11-21 23-23z" fill="#f5f5f5" stroke="#434242" stroke-width="10"/></g></svg>
|
After Width: | Height: | Size: 1012 B |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
|
||||
.str0 {stroke:#434242;stroke-width:10;stroke-linejoin:round}
|
||||
.fil0 {fill:url(#id0)}
|
||||
]]></style><radialGradient cx="51%" cy="47%" fx="51%" fy="47%" id="id0"><stop offset="0" stop-color="#0af"/><stop offset="1" stop-color="#008BFF"/></radialGradient></defs><path class="fil0 str0" d="M366 193v7c0 6-5 10-10 10h-212c-5 0-10-4-10-10v-7c0-14-3-17-7-21-7-7-21-7-28 0l-64 64c-7 7-7 21 0 28l64 64c7 7 21 7 28 0 4-4 7-7 7-21v-7c0-6 5-10 10-10h212c5 0 10 4 10 10v7c0 14 3 17 7 21 7 7 21 7 28 0l64-64c7-7 7-21 0-28l-64-64c-7-7-21-7-28 0-4 4-7 7-7 21z" id="Layer_x0020_1"/></svg>
|
After Width: | Height: | Size: 848 B |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="401.544" x2="98.456" y1="98.456" y2="401.544"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><path d="M193 134h7c6 0 10 5 10 10v212c0 5-4 10-10 10h-7c-14 0-17 3-21 7-7 7-7 21 0 28l64 64c7 7 21 7 28 0l64-64c7-7 7-21 0-28-4-4-7-7-21-7h-7c-6 0-10-5-10-10v-212c0-5 4-10 10-10h7c14 0 17-3 21-7 7-7 7-21 0-28l-64-64c-7-7-21-7-28 0l-64 64c-7 7-7 21 0 28 4 4 7 7 21 7z" fill="url(#a)" stroke="#2B2A29" stroke-width="10"/></svg>
|
After Width: | Height: | Size: 766 B |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 5000 5000" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
|
||||
.str0 {stroke:#434242;stroke-width:100}
|
||||
.fil0 {fill:url(#id0)}
|
||||
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="3935.29" x2="1064.71" y1="3935.29" y2="1064.71"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><path class="fil0 str0" d="M3511 2253c136 136 136 358 0 494l-1450 1450c-78 78-205 78-283 0l-318-318c-97-97-97-256 0-354l1025-1025-1025-1025c-97-98-97-257 0-354l318-318c78-78 205-78 283 0l1450 1450z" id="Layer_x0020_1"/></svg>
|
After Width: | Height: | Size: 789 B |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 5000 5000" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css"><![CDATA[
|
||||
.str0 {stroke:#434242;stroke-width:100}
|
||||
.fil0 {fill:url(#id0)}
|
||||
]]></style><linearGradient gradientUnits="userSpaceOnUse" id="id0" x1="1064.71" x2="3935.29" y1="3935.29" y2="1064.71"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient></defs><path class="fil0 str0" d="M1489 2253c-136 136-136 358 0 494l1450 1450c78 78 205 78 283 0l318-318c97-97 97-256 0-354l-1025-1025 1025-1025c97-98 97-257 0-354l-318-318c-78-78-205-78-283 0l-1450 1450z" id="Layer_x0020_1"/></svg>
|
After Width: | Height: | Size: 789 B |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg height="32px" version="1.1" viewBox="0 0 32 32" width="32px" xmlns="http://www.w3.org/2000/svg" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns" xmlns:xlink="http://www.w3.org/1999/xlink"><title/><desc/><defs/><g fill="none" fill-rule="evenodd" id="Page-1" stroke="none" stroke-width="1"><g fill="#157EFB" id="icon-70-document-file-pdf"><path d="M21,26 L21,28.0025781 C21,29.1090746 20.1057238,30 19.0025781,30 L3.99742191,30 C2.89092539,30 2,29.1012878 2,27.9926701 L2,5.00732994 C2,3.89833832 2.8992496,3 4.0085302,3 L14,3 L14,9.00189865 C14,10.1132936 14.8980806,11 16.0059191,11 L21,11 L21,13 L12.0068483,13 C10.3462119,13 9,14.3422643 9,15.9987856 L9,23.0012144 C9,24.6573979 10.3359915,26 12.0068483,26 L21,26 L21,26 Z M15,3 L15,8.99707067 C15,9.55097324 15.4509752,10 15.990778,10 L21,10 L15,3 L15,3 Z M11.9945615,14 C10.8929956,14 10,14.9001762 10,15.992017 L10,23.007983 C10,24.1081436 10.9023438,25 11.9945615,25 L29.0054385,25 C30.1070044,25 31,24.0998238 31,23.007983 L31,15.992017 C31,14.8918564 30.0976562,14 29.0054385,14 L11.9945615,14 L11.9945615,14 Z M25,19 L25,17 L29,17 L29,16 L24,16 L24,23 L25,23 L25,20 L28,20 L28,19 L25,19 L25,19 Z M12,18 L12,23 L13,23 L13,20 L14.9951185,20 C16.102384,20 17,19.1122704 17,18 C17,16.8954305 16.1061002,16 14.9951185,16 L12,16 L12,18 L12,18 Z M13,17 L13,19 L15.0010434,19 C15.5527519,19 16,18.5561352 16,18 C16,17.4477153 15.5573397,17 15.0010434,17 L13,17 L13,17 Z M18,16 L18,23 L20.9951185,23 C22.102384,23 23,22.1134452 23,20.9940809 L23,18.0059191 C23,16.8980806 22.1061002,16 20.9951185,16 L18,16 L18,16 Z M19,17 L19,22 L21.0010434,22 C21.5527519,22 22,21.5562834 22,21.0001925 L22,17.9998075 C22,17.4476291 21.5573397,17 21.0010434,17 L19,17 L19,17 Z" id="document-file-pdf"/></g></g></svg>
|
After Width: | Height: | Size: 1.7 KiB |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="b" x1="1" x2="0" y1="1"><stop offset="0" stop-color="#008BFF"/><stop offset="1" stop-color="#0af"/></linearGradient><linearGradient id="a" x2="0" y1="1"><stop offset="0" stop-color="#FCFCFD"/><stop offset="1" stop-color="#DDDEDE"/></linearGradient></defs><g stroke="#434242" stroke-linejoin="round"><path d="M250 30h140c11 0 20 9 20 20v400c0 11-9 20-20 20h-280c-11 0-20-9-20-20v-260l160-160z" fill="url(#a)" stroke-linecap="round" stroke-width="15"/><path d="M220 190h-130l160-160v130c0 17-14 30-30 30z" fill="url(#b)" stroke-width="10"/></g></svg>
|
After Width: | Height: | Size: 805 B |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="249.901" x2="290.097" y1="289.886" y2="249.692"><stop offset="0" stop-color="#979798"/><stop offset=".412" stop-color="#C5C5C5"/><stop offset=".6" stop-color="#fff"/><stop offset=".722" stop-color="#CDCDCE"/><stop offset="1" stop-color="#787879"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="385.356" x2="335.934" y1="335.726" y2="385.148"><stop offset="0" stop-color="#434242"/><stop offset=".478" stop-color="#545454"/><stop offset="1" stop-color="#434242"/></linearGradient></defs><g><polygon fill="url(#a)" points="234,269 269,234 302,267 267,302"/><path d="M258 307l2-12 35-35 12-3 143 143c14 14 14 36 0 50-14 13-36 13-49 0l-143-143z" fill="url(#b)"/><circle fill="#434242" r="127" stroke="#2B2A29" stroke-width=".1" transform="matrix(.717 -.717 .717 .717 165 164.999)"/><circle fill="#9DD2FF" r="127" transform="matrix(.606 -.606 .606 .606 165 164.999)"/><path d="M245 155v20c0 3-2 5-5 5h-55c-3 0-5 2-5 5v55c0 3-2 5-5 5h-20c-3 0-5-2-5-5v-55c0-3-2-5-5-5h-55c-3 0-5-2-5-5v-20c0-3 2-5 5-5h55c3 0 5-2 5-5v-55c0-3 2-5 5-5h20c3 0 5 2 5 5v55c0 3 2 5 5 5h55c3 0 5 2 5 5z" fill="#434242"/></g></svg>
|
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" ?><svg clip-rule="evenodd" fill-rule="evenodd" image-rendering="optimizeQuality" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient gradientUnits="userSpaceOnUse" id="a" x1="249.901" x2="290.097" y1="289.886" y2="249.692"><stop offset="0" stop-color="#979798"/><stop offset=".412" stop-color="#C5C5C5"/><stop offset=".6" stop-color="#fff"/><stop offset=".722" stop-color="#CDCDCE"/><stop offset="1" stop-color="#787879"/></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="b" x1="385.356" x2="335.934" y1="335.726" y2="385.148"><stop offset="0" stop-color="#434242"/><stop offset=".478" stop-color="#545454"/><stop offset="1" stop-color="#434242"/></linearGradient></defs><g><polygon fill="url(#a)" points="234,269 269,234 302,267 267,302"/><path d="M258 307l2-12 35-35 12-3 143 143c14 14 14 36 0 50-14 13-36 13-49 0l-143-143z" fill="url(#b)"/><circle fill="#434242" r="127" stroke="#2B2A29" stroke-width=".1" transform="matrix(.717 -.717 .717 .717 165 164.999)"/><circle fill="#9DD2FF" r="127" transform="matrix(.606 -.606 .606 .606 165 164.999)"/><path d="M245 155v20c0 3-2 5-5 5h-150c-3 0-5-2-5-5v-20c0-3 2-5 5-5h150c3 0 5 2 5 5z" fill="#434242"/></g></svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1,61 @@
|
||||
#include "report.h"
|
||||
|
||||
Report::Report()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString Report::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void Report::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
QString Report::description() const
|
||||
{
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void Report::setDescription(const QString &description)
|
||||
{
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
QString Report::file() const
|
||||
{
|
||||
return m_file;
|
||||
}
|
||||
|
||||
void Report::setFile(const QString &file)
|
||||
{
|
||||
m_file = file;
|
||||
}
|
||||
|
||||
bool Report::listReport() const
|
||||
{
|
||||
return m_listReport;
|
||||
}
|
||||
|
||||
void Report::setListReport(bool listReport)
|
||||
{
|
||||
m_listReport = listReport;
|
||||
}
|
||||
|
||||
QMap<QString, QString> Report::variables() const
|
||||
{
|
||||
return m_variables;
|
||||
}
|
||||
|
||||
void Report::setVariables(const QMap<QString, QString> &variables)
|
||||
{
|
||||
m_variables = variables;
|
||||
}
|
||||
|
||||
void Report::addVariable(const QString &varName, const QString &value)
|
||||
{
|
||||
m_variables[varName] = value;
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
#ifndef REPORT_H
|
||||
#define REPORT_H
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
#include <QSharedPointer>
|
||||
|
||||
#include "../core_global.h"
|
||||
|
||||
class CORESHARED_EXPORT Report
|
||||
{
|
||||
public:
|
||||
Report();
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
QString file() const;
|
||||
void setFile(const QString &file);
|
||||
|
||||
bool listReport() const;
|
||||
void setListReport(bool listReport);
|
||||
|
||||
QMap<QString, QString> variables() const;
|
||||
void setVariables(const QMap<QString, QString> &variables);
|
||||
void addVariable(const QString &varName, const QString &value);
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_description;
|
||||
QString m_file;
|
||||
bool m_listReport;
|
||||
QMap<QString, QString> m_variables;
|
||||
};
|
||||
|
||||
typedef QSharedPointer<Report> ReportPtr;
|
||||
typedef QList<ReportPtr> ReportList;
|
||||
|
||||
#endif // REPORT_H
|
@ -0,0 +1,75 @@
|
||||
#include "reportdialog.h"
|
||||
#include "ui_reportdialog.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QIcon>
|
||||
|
||||
#include "reportviewer.h"
|
||||
|
||||
ReportDialog::ReportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
ReportDialog::~ReportDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ReportDialog::setReports(ReportList reports)
|
||||
{
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(ui->listReports->model());
|
||||
|
||||
if (model == NULL)
|
||||
{
|
||||
model = new QStandardItemModel(0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
model->clear();
|
||||
}
|
||||
|
||||
foreach (ReportPtr report, reports) {
|
||||
QStandardItem *item = new QStandardItem((report->listReport() ? QIcon(":/icons/list.svg") : QIcon(":/icons/report.svg")), report->name());
|
||||
model->appendRow(item);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
ReportViewer *viewer = new ReportViewer(this);
|
||||
viewer->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
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();
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#ifndef REPORTDIALOG_H
|
||||
#define REPORTDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "report.h"
|
||||
|
||||
namespace Ui {
|
||||
class ReportDialog;
|
||||
}
|
||||
|
||||
class ReportDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportDialog(QWidget *parent = 0);
|
||||
~ReportDialog();
|
||||
|
||||
void setReports(ReportList reports);
|
||||
|
||||
private slots:
|
||||
void on_btnPreview_clicked();
|
||||
|
||||
void on_btnPrint_clicked();
|
||||
|
||||
void on_btnClose_clicked();
|
||||
|
||||
private:
|
||||
Ui::ReportDialog *ui;
|
||||
ReportList m_reports;
|
||||
};
|
||||
|
||||
#endif // REPORTDIALOG_H
|
@ -0,0 +1,194 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReportDialog</class>
|
||||
<widget class="QDialog" name="ReportDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>569</width>
|
||||
<height>442</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Reports</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>36</width>
|
||||
<height>36</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../rc.qrc">:/icons/print.svg</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(0, 0, 0);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print reports</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widgetReports" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QListView" name="listReports">
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>90</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textDescription">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnPreview">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/report.svg</normaloff>:/icons/report.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnPrint">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnClose">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/close.svg</normaloff>:/icons/close.svg</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../rc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -0,0 +1,90 @@
|
||||
#include "reportviewer.h"
|
||||
#include "ui_reportviewer.h"
|
||||
|
||||
#include "../context.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QPrinter>
|
||||
#include <LimeReport>
|
||||
|
||||
ReportViewer::ReportViewer(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::ReportViewer)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_report = NULL;
|
||||
}
|
||||
|
||||
ReportViewer::~ReportViewer()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ReportViewer::setReport(ReportPtr report)
|
||||
{
|
||||
m_report = new LimeReport::ReportEngine(this);
|
||||
|
||||
QString reportPath = qApp->applicationDirPath() + REPORT_ROOT + "/" + report->file();
|
||||
QFile file(reportPath);
|
||||
file.open(QFile::ReadOnly);
|
||||
|
||||
m_report->loadFromByteArray(&file.readAll());
|
||||
m_report->setReportFileName(reportPath);
|
||||
m_report->dataManager()->setReportVariable("dbPath", Context::instance().settings()->value("db/path", "").toString());
|
||||
}
|
||||
|
||||
void ReportViewer::openPreview()
|
||||
{
|
||||
Q_ASSERT(m_report != NULL);
|
||||
|
||||
showMaximized();
|
||||
|
||||
m_prevWidget = m_report->createPreviewWidget(this);
|
||||
|
||||
connect(m_prevWidget, SIGNAL(pagesSet(int)), this, SLOT(slotPageSet(int)));
|
||||
connect(ui->pageNavigator, SIGNAL(valueChanged(int)), m_prevWidget, SLOT(pageNavigatorChanged(int)));
|
||||
connect(ui->btnPrint, SIGNAL(clicked(bool)), m_prevWidget, SLOT(print()));
|
||||
connect(ui->btnPdf, SIGNAL(clicked(bool)), m_prevWidget, SLOT(printToPDF()));
|
||||
connect(ui->btnPageUp, SIGNAL(clicked(bool)), m_prevWidget, SLOT(priorPage()));
|
||||
connect(ui->btnPageDown, SIGNAL(clicked(bool)), m_prevWidget, SLOT(nextPage()));
|
||||
connect(ui->btnZoomIn, SIGNAL(clicked(bool)), m_prevWidget, SLOT(zoomIn()));
|
||||
connect(ui->btnZoomOut, SIGNAL(clicked(bool)), m_prevWidget, SLOT(zoomOut()));
|
||||
connect(ui->btnFitHoriz, SIGNAL(clicked(bool)), m_prevWidget, SLOT(fitWidth()));
|
||||
connect(ui->btnFitVert, SIGNAL(clicked(bool)), m_prevWidget, SLOT(fitPage()));
|
||||
|
||||
ui->reportLayout->addWidget(m_prevWidget);
|
||||
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();
|
||||
}
|
||||
|
||||
void ReportViewer::on_btnEdit_clicked()
|
||||
{
|
||||
m_report->designReport();
|
||||
}
|
||||
|
||||
void ReportViewer::slotPageSet(int page)
|
||||
{
|
||||
ui->pageNavigator->setSuffix(ui->pageNavigator->suffix() + QString::number(page));
|
||||
ui->pageNavigator->setMinimum(1);
|
||||
ui->pageNavigator->setMaximum(page);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
#ifndef REPORTVIEWER_H
|
||||
#define REPORTVIEWER_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "report.h"
|
||||
|
||||
namespace Ui {
|
||||
class ReportViewer;
|
||||
}
|
||||
|
||||
namespace LimeReport {
|
||||
class PreviewReportWidget;
|
||||
class ReportEngine;
|
||||
}
|
||||
|
||||
class ReportViewer : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReportViewer(QWidget *parent = 0);
|
||||
~ReportViewer();
|
||||
void setReport(ReportPtr report);
|
||||
void openPreview();
|
||||
void directPrint(bool dialog = true);
|
||||
|
||||
private slots:
|
||||
void on_btnClose_clicked();
|
||||
|
||||
void on_btnEdit_clicked();
|
||||
|
||||
void slotPageSet(int page);
|
||||
|
||||
private:
|
||||
Ui::ReportViewer *ui;
|
||||
|
||||
LimeReport::PreviewReportWidget *m_prevWidget;
|
||||
LimeReport::ReportEngine *m_report;
|
||||
};
|
||||
|
||||
#endif // REPORTVIEWER_H
|
@ -0,0 +1,312 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ReportViewer</class>
|
||||
<widget class="QDialog" name="ReportViewer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>914</width>
|
||||
<height>675</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Report</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnClose">
|
||||
<property name="toolTip">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/close.svg</normaloff>:/icons/close.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPrint">
|
||||
<property name="toolTip">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/print.svg</normaloff>:/icons/print.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPdf">
|
||||
<property name="toolTip">
|
||||
<string>Export to PDF</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export to PDF</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/pdf.svg</normaloff>:/icons/pdf.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnEdit">
|
||||
<property name="toolTip">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/edit.svg</normaloff>:/icons/edit.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPageUp">
|
||||
<property name="toolTip">
|
||||
<string>Page up</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Page up</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/pageUp.svg</normaloff>:/icons/pageUp.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="pageNavigator">
|
||||
<property name="suffix">
|
||||
<string> of </string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>Page: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnPageDown">
|
||||
<property name="toolTip">
|
||||
<string>Page down</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Page down</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/pageDown.svg</normaloff>:/icons/pageDown.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnZoomOut">
|
||||
<property name="toolTip">
|
||||
<string>Zoom out</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom out</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/zoomOut.svg</normaloff>:/icons/zoomOut.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnZoomIn">
|
||||
<property name="toolTip">
|
||||
<string>Zoom in</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom in</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/zoomIn.svg</normaloff>:/icons/zoomIn.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnFitHoriz">
|
||||
<property name="toolTip">
|
||||
<string>Fit horizontal</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit horizontal</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/fitHorizontal.svg</normaloff>:/icons/fitHorizontal.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="btnFitVert">
|
||||
<property name="toolTip">
|
||||
<string>Fit vertical</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fit vertical</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../rc.qrc">
|
||||
<normaloff>:/icons/fitVertical.svg</normaloff>:/icons/fitVertical.svg</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="reportLayout"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../rc.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|