PageRenderTime 30ms CodeModel.GetById 19ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/vp_plugins/print_monitor/datamodule.cpp

http://cupsfilter.googlecode.com/
C++ | 103 lines | 91 code | 11 blank | 1 comment | 1 complexity | 866898adafe4e151b1f7e107a8dfcd50 MD5 | raw file
  1#include "datamodule.h"
  2
  3#include <QDebug>
  4
  5#include <QtGui/QStandardItemModel>
  6#include <QtGui/QStringListModel>
  7#include <QtGui/QStandardItem>
  8#include <QtCore/QFile>
  9
 10#include "mytypes.h"
 11using namespace VPrn;
 12
 13DataModule::DataModule(QObject *parent)
 14    : QObject(parent)
 15
 16    , m_Mandats_model(0)
 17    , m_Stamps_model(0)
 18    , m_DocCard_model(0)
 19    , m_Tempalates_model(0)
 20    , m_Printers_model(0)
 21    , m_Work_file(QString())
 22{
 23    m_Mandats_model     = new QStringListModel(this);
 24    m_Stamps_model      = new QStringListModel(this);
 25
 26    m_DocCard_model     = new QStandardItemModel(this);
 27    m_Tempalates_model  = new QStandardItemModel(this);
 28    m_Printers_model    = new QStandardItemModel(this);
 29
 30    // ????????? ???????
 31    m_Printers_model->setHorizontalHeaderItem(0,
 32                                              new QStandardItem(QObject::trUtf8("???????"))
 33                                              );
 34    m_Printers_model->setHorizontalHeaderItem(1,
 35                                              new QStandardItem(QObject::trUtf8("IP"))
 36                                              );
 37    m_Printers_model->setHorizontalHeaderItem(2,
 38                                              new QStandardItem(QObject::trUtf8("???????"))
 39                                              );
 40    m_Printers_model->setHorizontalHeaderItem(3,
 41                                              new QStandardItem(QObject::trUtf8("??????"))
 42                                              );
 43
 44    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_ID,
 45                                               new QStandardItem(QObject::trUtf8("ID")));
 46    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_DOC_NAME,
 47                                               new QStandardItem(QObject::trUtf8("??? ?????????")));
 48    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_STAMP,
 49                                               new QStandardItem(QObject::trUtf8("????")));
 50    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_MB_NUMBER,
 51                                               new QStandardItem(QObject::trUtf8("????? ??")));
 52    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_PUNKT,
 53                                               new QStandardItem(QObject::trUtf8("?????")));
 54    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_PAGE_COUNT,
 55                                               new QStandardItem(QObject::trUtf8("????? ???????")));
 56    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_COPY_COUNT,
 57                                               new QStandardItem(QObject::trUtf8("????? ???")));
 58    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_CURRENT_COPY,
 59                                               new QStandardItem(QObject::trUtf8("??????? ???")));
 60    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_SELECT_ALL_COPY,
 61                                               new QStandardItem(QObject::trUtf8("??? ???")));
 62    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_TEMPLATE_NAME,
 63                                               new QStandardItem(QObject::trUtf8("??? ????? ???????")));
 64    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_EXECUTOR,
 65                                               new QStandardItem(QObject::trUtf8("???????????")));
 66    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_PRINTMAN,
 67                                               new QStandardItem(QObject::trUtf8("?????????")));
 68    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_PHONE,
 69                                               new QStandardItem(QObject::trUtf8("???????")));
 70    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_INV_NUMBER,
 71                                               new QStandardItem(QObject::trUtf8("???.?????")));
 72    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_PRINT_DATE,
 73                                               new QStandardItem(QObject::trUtf8("???? ??????")));
 74    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_RECIVER_1,
 75                                               new QStandardItem(QObject::trUtf8("??????????_1")));
 76    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_RECIVER_2,
 77                                               new QStandardItem(QObject::trUtf8("??????????_2")));
 78    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_RECIVER_3,
 79                                               new QStandardItem(QObject::trUtf8("??????????_3")));
 80    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_RECIVER_4,
 81                                               new QStandardItem(QObject::trUtf8("??????????_4")));
 82    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_RECIVER_5,
 83                                               new QStandardItem(QObject::trUtf8("??????????_5")));
 84    m_DocCard_model->setHorizontalHeaderItem( VPrn::cards_STATUS,
 85                                               new QStandardItem(QObject::trUtf8("??????_?????????")));
 86
 87    qDebug() << "m_DocCard_model ROW:COL" << m_DocCard_model->rowCount() <<" : "<< m_DocCard_model->columnCount();
 88}
 89
 90bool DataModule::setWorkFile(const QString & i_file)
 91{
 92    if (QFile::exists(i_file)){
 93        m_Work_file = i_file;
 94    }else{
 95        emit error(VPrn::FileNotFound,
 96                   QObject::trUtf8("???? %1 ???????? ??? ?????? ?? ??????????!\n%2")
 97                   .arg(i_file).arg(QString(Q_FUNC_INFO))
 98                   );
 99        return false;
100    }
101    return true;
102}
103