Main Page · Namespace List · Alphabetical List · Class List · File List · Namespace Members · Class Members · File Members · Related Pages

globalsprintersetup.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2006 by Konrad Wilhelm Kleine
00003  *   konrad@plothe-kleine.de
00004  *
00005  *   This file contains the definition of globally used types, functions
00006  *   and constants for the Linux Printer Setup project.
00007  *
00008  *   PLEASE NOTICE: If not stated otherwise, whenever we speak of 'printer
00009  *                  drivers' or simply 'drivers', we mean the PPD files
00010  *                  and not the actual drivers.
00011  *
00012  *   STATUS: File has been reviewed and commented
00013  *
00014  *   $Id: globalsprintersetup.h,v 1.8 2006/04/23 16:06:22 hbci Exp $
00015  *
00016  *   This program is free software; you can redistribute it and/or modify
00017  *   it under the terms of the GNU General Public License as published by
00018  *   the Free Software Foundation; either version 2 of the License, or
00019  *   (at your option) any later version.
00020  *
00021  *   This program is distributed in the hope that it will be useful,
00022  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024  *   GNU General Public License for more details.
00025  *
00026  *   You should have received a copy of the GNU General Public License
00027  *   along with this program; if not, write to the Free Software Foundation,
00028  *   Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00029  ***************************************************************************/
00030 
00031 #ifndef GLOBALSPRINTERSETUP_H
00032 #define GLOBALSPRINTERSETUP_H
00033 
00034 // Qt includes
00035 #include <qmap.h>
00036 #include <qstring.h>
00037 #include <qdom.h>
00038 //#include <qwidget.h>
00039 class QWidget;
00040 
00041 //
00042 //====================================================================================
00043 //
00044 // Constants for the LPS automatic printer setup
00045 //
00046 //====================================================================================
00047 //
00048 
00049 #define LPS_USB_DEVICE_PATH     "/proc/bus/usb/devices"
00050 #define LPS_PARPORT_DEVICE_DIR  "/proc/sys/dev/parport/"
00051 
00052 //
00053 //====================================================================================
00054 //
00055 // Global constants for LPS autmatic AND manual printer setup
00056 // (Don't let the names fool you!)
00057 //
00058 //====================================================================================
00059 //
00060 
00061 #define LPS_DRIVER_DETAILS_DIR       "/usr/share/foomatic/db/source/driver/"
00062 #define LPS_DB_FILE                 "/printerdata.xml"
00063 #define LPS_CUPS_MODEL_DIR_DEFAULT  "/usr/share/cups/model"
00064 #define LPS_LPADMIN_PATH            "/usr/sbin/"
00065 //#define LPS_DB_PATH                "cupsdb.xml"
00066 #define LPS_DRIVER_STYLESHEET_PATH  "/driverdetails.xslt"
00067 #define LPS_APP_NAME                "PrinterSetup"
00068 #define LPS_PRINTER_NAME            "LinuxPrinter"
00069 #define LPS_DB_DOCUMENT_NAME        "CupsDriverDb"
00070 #define LPS_URL                     "http://printersetup.sourceforge.net"
00071 #define LPS_TESTPAGE_WIDTH          263
00072 #define LPS_TESTPAGE_HEIGHT         341
00073 #define LPS_TESTPAGE_IMG_SRC        "testpage.png"
00074 #define LPS_TESTPAGE_PS_SRC         "testpage.ps"
00075 #define LPS_TESTPAGE_JOBNAME        "Testpage"
00076 
00082 namespace LinuxPrinterSetup
00083 {
00084 
00085 
00089 enum ConnectionType
00090 {
00091   UsbConnection,
00092   ParPortConnection
00093 };
00094 
00095 
00100 class PrinterDevice
00101 {
00102 public:
00103 
00107   PrinterDevice();
00108 
00117   PrinterDevice(  const QString & nativeManufacturer,
00118                   const QString & nativeProduct,
00119                   ConnectionType connectionType,
00120                   const QDomNodeList & drivers );
00121 
00122   // Publicly available members
00123   QString        nativeManufacturer;  
00124   QString        nativeProduct;       
00125   ConnectionType connectionType;      
00126   QDomNodeList   drivers;             
00127 
00128 };
00129 
00130 
00131 typedef QMap< QString, PrinterDevice > PrinterMap;  
00132 
00133 
00134 typedef struct ppd_info
00135 {
00136   QString ppdFilePath;
00137   QString product;
00138   QString nickName;
00139   QString modelName;
00140   QString manufacturer;
00141   QString languageVersion;
00142 }
00143 PpdInfo;
00144 
00145 
00151 class LpsNotice : public QString
00152 {
00153 public:
00154 
00160   LpsNotice( const char * str );
00161 
00168   LpsNotice( const QString & str );
00169 
00170 };
00171 
00172 
00178 class LpsError : public QString
00179 {
00180 public:
00181 
00187   LpsError( const char * str );
00188 
00195   LpsError( const QString & str );
00196 
00197 };
00198 
00199 
00212 QString sudo();
00213 
00214 
00215 //
00216 //====================================================================================
00217 //
00218 // Shared functions
00219 //
00220 // The following functions are used by both printer setups, the automatic and manual.
00221 // Therefore, they are outsourced from the concrete classes and made friends.
00222 //
00223 //====================================================================================
00224 //
00225 
00226 
00237 void showPrinterDriverDetails( const QString & driverName );
00238 
00239 
00252 void testPrintRequest( QWidget * widget, const QString & printerName );
00253 
00254 
00265 void installPrinter(  QWidget * widget,
00266                       const QString & printerName,
00267                       const QString & deviceUri,
00268                       const QString & ppdFilePath );
00269 
00270 }; /* End of namespace LinuxPrinterSetup */
00271 
00272 
00273 
00312 #endif


To get more information, please visit our project site hosted at SourceForge.net Logo
To support this project, please click on this image: Support This Project

Copyright © 2005-2006 Linux Printer Setup Documentation generated by Doxygen 1.4.4 LPS 1.0 (Disclaimer)