lrdview has been added
@ -141,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
|
||||
|
||||
LIMEREPORT_VERSION_MAJOR = 1
|
||||
LIMEREPORT_VERSION_MINOR = 5
|
||||
LIMEREPORT_VERSION_RELEASE = 87
|
||||
LIMEREPORT_VERSION_RELEASE = 88
|
||||
|
||||
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
|
||||
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"
|
||||
|
@ -12,6 +12,7 @@ SUBDIRS += \
|
||||
limereport \
|
||||
demo_r1 \
|
||||
demo_r2 \
|
||||
lrdview \
|
||||
designer
|
||||
|
||||
if(equals(QT_MAJOR_VERSION, 5) : greaterThan(QT_MINOR_VERSION, 1)) | equals(QT_MAJOR_VERSION, 6) {
|
||||
|
217
lrdview/MainWindow.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
#include "MainWindow.h"
|
||||
#include "ui_MainWindow.h"
|
||||
#include <QFileDialog>
|
||||
#include <QPrintDialog>
|
||||
#include <private/qzipreader_p.h>
|
||||
#include <QDebug>
|
||||
#include <QtCore/qabstractanimation.h>
|
||||
#include <QDesktopWidget>
|
||||
#include "XmlModel.h"
|
||||
#include "SettingDialog.h"
|
||||
#include "lrreportengine.h"
|
||||
|
||||
//#ifndef QT_DEBUG
|
||||
//Q_IMPORT_PLUGIN(adateeditorplugin)
|
||||
//#endif
|
||||
|
||||
void centerWindow(QWidget* widget, double widthFactor, double heightFactor) {
|
||||
QDesktopWidget desk;
|
||||
int ww = desk.width() * widthFactor;
|
||||
int wh = desk.height() * heightFactor;
|
||||
widget->resize(ww, wh);
|
||||
widget->move((desk.width() - ww) / 2, (desk.height() - wh) / 2);
|
||||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow),
|
||||
m_previewScene(0), m_isCert(false), m_deleteLastFile(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
m_report.dataManager()->addModel("reportData",&m_model,false);
|
||||
ui->graphicsView->scale(0.5,0.5);
|
||||
centerWindow(this, 0.8, 0.8);
|
||||
m_settings = new QSettings("OCKK Ltd","LRDView");
|
||||
m_report.setSettings(m_settings);
|
||||
readSetting();
|
||||
setWindowTitle("LRDView ver 1.30");
|
||||
if (QCoreApplication::arguments().count()>1){
|
||||
loadReport(QCoreApplication::arguments().at(1));
|
||||
}
|
||||
//ui->statusBar->addWidget(new QLabel(" Designed by Arin Alexander (arin_a@bk.ru) ",this));
|
||||
}
|
||||
|
||||
bool isFileExists(QZipReader& reader, QString fileName){
|
||||
foreach( QZipReader::FileInfo fi, reader.fileInfoList()){
|
||||
if (fi.filePath.compare(fileName)==0) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void MainWindow::loadReport(QString fileName){
|
||||
if (!fileName.isEmpty()){
|
||||
QZipReader reader(fileName);
|
||||
QByteArray fileData = reader.fileData("report.xml");
|
||||
m_report.loadFromByteArray(&fileData);
|
||||
m_reportData = reader.fileData("data.xml");
|
||||
m_model.setXMLData(&m_reportData);
|
||||
if (m_previewScene) delete m_previewScene;
|
||||
m_previewScene = dynamic_cast<LimeReport::PageDesignIntf*>(m_report.createPreviewScene(ui->graphicsView));
|
||||
m_previewScene->setItemMode(LimeReport::PreviewMode);
|
||||
ui->graphicsView->setScene(m_previewScene);
|
||||
ui->graphicsView->centerOn(0, 0);
|
||||
ui->actionEdit->setChecked(false);
|
||||
m_isCert = isFileExists(reader,"CertFlag.sgn");
|
||||
//m_lastReport = fileName;
|
||||
ui->action_PDF->setEnabled(true);
|
||||
ui->actionPrint->setEnabled(true);
|
||||
reader.close();
|
||||
if (m_deleteLastFile){
|
||||
QFile::remove(fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete m_settings;
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionEdit_triggered()
|
||||
{
|
||||
if (m_previewScene){
|
||||
if (m_previewScene->itemMode()==LimeReport::PreviewMode){
|
||||
m_previewScene->setItemMode(LimeReport::DesignMode);
|
||||
} else m_previewScene->setItemMode(LimeReport::PreviewMode);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(0,tr("Открыть файл отчета"),QString(),"*.lrd");
|
||||
if (!fileName.isEmpty()){
|
||||
loadReport(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDesign_triggered()
|
||||
{
|
||||
m_report.designReport();
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
writeSetting();
|
||||
}
|
||||
|
||||
void MainWindow::writeSetting(){
|
||||
m_settings->setValue("geometry",saveGeometry());
|
||||
}
|
||||
|
||||
void MainWindow::readSetting()
|
||||
{
|
||||
QVariant v = m_settings->value("geometry");
|
||||
if (v.isValid()){
|
||||
restoreGeometry(v.toByteArray());
|
||||
}
|
||||
m_certPrinterName = m_settings->value("certPrinterName","").value<QString>();
|
||||
m_otherPrinterName = m_settings->value("otherPrinterName","").value<QString>();
|
||||
m_deleteLastFile = m_settings->value("deleteLastFile",false).value<bool>();
|
||||
}
|
||||
|
||||
void MainWindow::settingAccepted()
|
||||
{
|
||||
m_certPrinterName=((SettingDialog*)sender())->certPrinterName();
|
||||
m_otherPrinterName=((SettingDialog*)sender())->othenPrinterName();
|
||||
m_deleteLastFile = ((SettingDialog*)sender())->deleteLastFile();
|
||||
m_settings->setValue("certPrinterName",m_certPrinterName);
|
||||
m_settings->setValue("otherPrinterName",m_otherPrinterName);
|
||||
m_settings->setValue("deleteLastFile",m_deleteLastFile);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionZoomIn_triggered()
|
||||
{
|
||||
ui->graphicsView->scale(1.2,1.2);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionZoomOut_triggered()
|
||||
{
|
||||
ui->graphicsView->scale(1/1.2,1/1.2);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionPrint_triggered()
|
||||
{
|
||||
QPrinterInfo pi;
|
||||
if (m_isCert)
|
||||
pi = getPrinterInfo(m_certPrinterName);
|
||||
else {
|
||||
pi = getPrinterInfo(m_otherPrinterName);
|
||||
}
|
||||
QPrinter printer(pi);
|
||||
QPrintDialog dialog(&printer,QApplication::activeWindow());
|
||||
|
||||
|
||||
if (dialog.exec()){
|
||||
if (m_previewScene->pageItems().isEmpty())
|
||||
m_report.printReport(&printer);
|
||||
else{
|
||||
printer.setPrintRange(QPrinter::PrintRange(dialog.printRange()));
|
||||
printer.setFromTo(dialog.fromPage(), dialog.toPage());
|
||||
m_report.printPages(
|
||||
m_previewScene->pageItems(), &printer
|
||||
);
|
||||
foreach(LimeReport::PageItemDesignIntf::Ptr pageItem, m_previewScene->pageItems()){
|
||||
m_previewScene->reactivatePageItem(pageItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QPrinterInfo MainWindow::getPrinterInfo(QString printerName){
|
||||
foreach (QPrinterInfo pi, QPrinterInfo::availablePrinters()) {
|
||||
if (pi.printerName().compare(printerName)==0)
|
||||
return pi;
|
||||
}
|
||||
return QPrinterInfo::defaultPrinter();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSetting_triggered()
|
||||
{
|
||||
SettingDialog w(this);
|
||||
w.setCertPrinterName(m_certPrinterName);
|
||||
w.setOtherPrinterName(m_otherPrinterName);
|
||||
w.setDeleteLastFile(m_deleteLastFile);
|
||||
connect(&w, SIGNAL(accepted()), this, SLOT(settingAccepted()));
|
||||
w.exec();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionDelete_triggered()
|
||||
{
|
||||
if (m_previewScene){
|
||||
m_previewScene->deleteSelected();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_action_PDF_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,tr("Имя файла для экспорта"),"","*.pdf" );
|
||||
if (!fileName.isEmpty()){
|
||||
QPrinter printer;
|
||||
printer.setOutputFileName(fileName);
|
||||
printer.setOutputFormat(QPrinter::PdfFormat);
|
||||
//m_report.printReport(&printer);
|
||||
if (m_previewScene->pageItems().isEmpty())
|
||||
m_report.printReport(&printer);
|
||||
else{
|
||||
m_report.printPages(
|
||||
m_previewScene->pageItems(),
|
||||
&printer
|
||||
);
|
||||
foreach(LimeReport::PageItemDesignIntf::Ptr pageItem, m_previewScene->pageItems()){
|
||||
m_previewScene->reactivatePageItem(pageItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
lrdview/MainWindow.h
Normal file
@ -0,0 +1,58 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QPrinterInfo>
|
||||
#include "lrreportengine.h"
|
||||
#include "lrpagedesignintf.h"
|
||||
#include "XmlModel.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void on_actionEdit_triggered();
|
||||
void on_actionOpen_triggered();
|
||||
void on_actionDesign_triggered();
|
||||
void on_actionZoomIn_triggered();
|
||||
void on_actionZoomOut_triggered();
|
||||
void on_actionPrint_triggered();
|
||||
void on_actionSetting_triggered();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
private:
|
||||
void loadReport(QString fileName);
|
||||
void writeSetting();
|
||||
void readSetting();
|
||||
QPrinterInfo getPrinterInfo(QString printerName);
|
||||
private slots:
|
||||
void settingAccepted();
|
||||
void on_actionDelete_triggered();
|
||||
|
||||
void on_action_PDF_triggered();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LimeReport::PageDesignIntf* m_previewScene;
|
||||
LimeReport::ReportEngine m_report;
|
||||
XmlModel m_model;
|
||||
QByteArray m_reportData;
|
||||
QSettings* m_settings;
|
||||
QString m_certPrinterName;
|
||||
QString m_otherPrinterName;
|
||||
bool m_isCert;
|
||||
bool m_deleteLastFile;
|
||||
QString m_lastReport;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
17
lrdview/MainWindow.qrc
Normal file
@ -0,0 +1,17 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/design.png</file>
|
||||
<file>images/edit.png</file>
|
||||
<file>images/print.png</file>
|
||||
<file>images/folder_open_16.png</file>
|
||||
<file>images/design_black.png</file>
|
||||
<file>images/edit_page.png</file>
|
||||
<file>images/edit_pattern.png</file>
|
||||
<file>images/view.png</file>
|
||||
<file>images/zoomin.png</file>
|
||||
<file>images/zoomout.png</file>
|
||||
<file>images/settings-24.png</file>
|
||||
<file>images/delete.png</file>
|
||||
<file>images/PDF1.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
211
lrdview/MainWindow.ui
Normal file
@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>694</width>
|
||||
<height>677</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LRDView</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/view.png</normaloff>:/images/view.png</iconset>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="graphicsView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>694</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionPrint"/>
|
||||
<addaction name="action_PDF"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionEdit"/>
|
||||
<addaction name="actionDelete"/>
|
||||
<addaction name="actionDesign"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSetting"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<action name="actionPrint">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/print.png</normaloff>:/images/print.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Печать</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Печать документа</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/edit.png</normaloff>:/images/edit.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Редактировать</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Редактировать</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+E</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/folder_open_16.png</normaloff>:/images/folder_open_16.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Открыть</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Открыть файл</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+O</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDesign">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/edit_pattern.png</normaloff>:/images/edit_pattern.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Редактировать шаблон</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Редактировть шаблон</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomIn">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/zoomin.png</normaloff>:/images/zoomin.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Увеличить</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Увеличить</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+=</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomOut">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/zoomout.png</normaloff>:/images/zoomout.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Уменьшить</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Уменьшить</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+-</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSetting">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/settings-24.png</normaloff>:/images/settings-24.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Настройки</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Настройки</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete">
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/delete.png</normaloff>:/images/delete.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Удалить</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Удалить выбранный элемент</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Del</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_PDF">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="MainWindow.qrc">
|
||||
<normaloff>:/images/PDF1.png</normaloff>:/images/PDF1.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Экспорт в PDF</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
<include location="MainWindow.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
53
lrdview/SettingDialog.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
#include "SettingDialog.h"
|
||||
#include "ui_SettingDialog.h"
|
||||
#include <QPrinterInfo>
|
||||
|
||||
SettingDialog::SettingDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SettingDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
initPrinters();
|
||||
}
|
||||
|
||||
SettingDialog::~SettingDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SettingDialog::initPrinters()
|
||||
{
|
||||
foreach (QPrinterInfo pi, QPrinterInfo::availablePrinters()) {
|
||||
ui->certPrinter->addItem(pi.printerName());
|
||||
ui->otherPrinter->addItem(pi.printerName());
|
||||
}
|
||||
}
|
||||
|
||||
void SettingDialog::setCertPrinterName(QString printerName){
|
||||
|
||||
ui->certPrinter->setCurrentIndex(ui->certPrinter->findText(printerName));
|
||||
}
|
||||
|
||||
void SettingDialog::setOtherPrinterName(QString printerName)
|
||||
{
|
||||
ui->otherPrinter->setCurrentIndex(ui->otherPrinter->findText(printerName));
|
||||
}
|
||||
|
||||
QString SettingDialog::certPrinterName(){
|
||||
return ui->certPrinter->currentText();
|
||||
}
|
||||
|
||||
QString SettingDialog::othenPrinterName()
|
||||
{
|
||||
return ui->otherPrinter->currentText();
|
||||
}
|
||||
|
||||
bool SettingDialog::deleteLastFile(){
|
||||
return ui->checkBox->isChecked();
|
||||
}
|
||||
|
||||
void SettingDialog::setDeleteLastFile(bool value)
|
||||
{
|
||||
ui->checkBox->setChecked(value);
|
||||
}
|
||||
|
30
lrdview/SettingDialog.h
Normal file
@ -0,0 +1,30 @@
|
||||
#ifndef SETTINGDIALOG_H
|
||||
#define SETTINGDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class SettingDialog;
|
||||
}
|
||||
|
||||
class SettingDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SettingDialog(QWidget *parent = 0);
|
||||
~SettingDialog();
|
||||
void setCertPrinterName(QString printerName);
|
||||
void setOtherPrinterName(QString printerName);
|
||||
QString certPrinterName();
|
||||
QString othenPrinterName();
|
||||
bool deleteLastFile();
|
||||
void setDeleteLastFile(bool value);
|
||||
private:
|
||||
void initPrinters();
|
||||
|
||||
private:
|
||||
Ui::SettingDialog *ui;
|
||||
};
|
||||
|
||||
#endif // SETTINGDIALOG_H
|
114
lrdview/SettingDialog.ui
Normal file
@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SettingDialog</class>
|
||||
<widget class="QDialog" name="SettingDialog">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::WindowModal</enum>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Настройки</string>
|
||||
</property>
|
||||
<property name="modal">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Принтер</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Сертификаты </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="certPrinter"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Остальное</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="otherPrinter"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Удалять файл</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SettingDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SettingDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
73
lrdview/XmlModel.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include "XmlModel.h"
|
||||
#include <QDebug>
|
||||
|
||||
XmlModel::XmlModel(QByteArray *data) {
|
||||
if (data) {
|
||||
m_doc.setContent(*data);
|
||||
initModel();
|
||||
}
|
||||
}
|
||||
|
||||
void XmlModel::setXMLData(QByteArray *data) {
|
||||
if (data) {
|
||||
beginResetModel();
|
||||
m_doc.setContent(*data);
|
||||
initModel();
|
||||
endResetModel();
|
||||
}
|
||||
}
|
||||
|
||||
void XmlModel::initModel(){
|
||||
m_items = m_doc.firstChildElement("items");
|
||||
parseHeaders();
|
||||
}
|
||||
|
||||
void XmlModel::parseHeaders()
|
||||
{
|
||||
m_fields.clear();
|
||||
QDomNode root = m_doc.firstChildElement("items");
|
||||
QDomNode item = root.firstChild();
|
||||
for (int i=0; i<item.childNodes().count();++i){
|
||||
QDomNode attr = item.childNodes().item(i);
|
||||
m_fields.append(attr.nodeName());
|
||||
}
|
||||
}
|
||||
|
||||
QModelIndex XmlModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if (m_fields.isEmpty())
|
||||
return QModelIndex();
|
||||
return createIndex(row, column);
|
||||
}
|
||||
|
||||
QModelIndex XmlModel::parent(const QModelIndex &child) const
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
int XmlModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return m_items.childNodes().count();
|
||||
}
|
||||
|
||||
int XmlModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
return m_fields.count();
|
||||
}
|
||||
|
||||
QVariant XmlModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole) {
|
||||
if (index.isValid()){
|
||||
QDomNode data = m_items.childNodes().at(index.row()).childNodes().item(index.column());
|
||||
return data.toElement().text();
|
||||
} else return QVariant();
|
||||
} else return QVariant();
|
||||
}
|
||||
|
||||
QVariant XmlModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(orientation==Qt::Horizontal&&role==Qt::DisplayRole){
|
||||
return m_fields[section];
|
||||
} else return QVariant();
|
||||
}
|
28
lrdview/XmlModel.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef XMLMODEL_H
|
||||
#define XMLMODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDomDocument>
|
||||
#include <QVector>
|
||||
|
||||
class XmlModel : public QAbstractItemModel
|
||||
{
|
||||
public:
|
||||
XmlModel(QByteArray* data = 0);
|
||||
void setXMLData(QByteArray* data);
|
||||
void parseHeaders();
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
||||
QModelIndex parent(const QModelIndex &child) const;
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
private:
|
||||
void initModel();
|
||||
private:
|
||||
QDomDocument m_doc;
|
||||
QDomNode m_items;
|
||||
QVector<QString> m_fields;
|
||||
};
|
||||
|
||||
#endif // XMLMODEL_H
|
BIN
lrdview/images/PDF1.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
lrdview/images/delete.png
Normal file
After Width: | Height: | Size: 217 B |
BIN
lrdview/images/design.png
Normal file
After Width: | Height: | Size: 349 B |
BIN
lrdview/images/design_black.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
lrdview/images/edit.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
lrdview/images/edit_page.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
lrdview/images/edit_pattern.png
Normal file
After Width: | Height: | Size: 479 B |
BIN
lrdview/images/folder_open.png
Normal file
After Width: | Height: | Size: 610 B |
BIN
lrdview/images/folder_open_16.png
Normal file
After Width: | Height: | Size: 252 B |
BIN
lrdview/images/print.png
Normal file
After Width: | Height: | Size: 319 B |
BIN
lrdview/images/settings-24.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
lrdview/images/view.ico
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
lrdview/images/view.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
lrdview/images/zoomin.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
lrdview/images/zoomout.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
43
lrdview/lrdview.pro
Normal file
@ -0,0 +1,43 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2014-03-24T20:29:50
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui xml
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets gui-private
|
||||
|
||||
CONFIG += uitools
|
||||
|
||||
include(../common.pri)
|
||||
include(../qzint.pri)
|
||||
include(../limereport.pri)
|
||||
|
||||
TARGET = lrdview
|
||||
TEMPLATE = app
|
||||
|
||||
win32 {
|
||||
RC_FILE += mainicon.rc
|
||||
}
|
||||
|
||||
SOURCES += main.cpp\
|
||||
MainWindow.cpp \
|
||||
XmlModel.cpp \
|
||||
SettingDialog.cpp
|
||||
|
||||
HEADERS += MainWindow.h \
|
||||
XmlModel.h \
|
||||
SettingDialog.h
|
||||
|
||||
FORMS += MainWindow.ui \
|
||||
SettingDialog.ui
|
||||
|
||||
RESOURCES += \
|
||||
MainWindow.qrc
|
||||
|
||||
#win32:CONFIG(release, debug|release): {
|
||||
# LIBS += -LD:/Work/C++/Projects/LRDView/libs -ladateeditorplugin
|
||||
# QTPLUGIN += adateeditorplugin
|
||||
# DEFINES += DEBUG
|
||||
#}
|
||||
|
12
lrdview/main.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include "MainWindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
//QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
1
lrdview/mainicon.rc
Normal file
@ -0,0 +1 @@
|
||||
DI_ICON1 ICON "view.ico"
|
BIN
lrdview/view.ico
Normal file
After Width: | Height: | Size: 106 KiB |