Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0c30419
Showing
48 changed files
with
9,330 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
moc_*.cxx | ||
qrc_*.cxx | ||
cmake_install.cmake | ||
cmake_uninstall.cmake | ||
Makefile | ||
CMakeFiles | ||
CMakeCache.txt | ||
CPackConfig.cmake | ||
CPackSourceConfig.cmake | ||
lib*.so | ||
lib*.so.* | ||
ui_*.h | ||
*.qm | ||
*~ | ||
*.autosave | ||
CMakeLists.txt.user* | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
cmake_minimum_required( VERSION 2.6 ) | ||
|
||
project(booklet) | ||
|
||
set(GUI_DIR ${CMAKE_INSTALL_PREFIX}/lib/booklet) | ||
add_definitions(-DGUI_DIR=\"${GUI_DIR}\") | ||
|
||
set(GUI_PROGRAM ${GUI_DIR}/booklet) | ||
add_definitions(-DGUI_PROGRAM=\"${GUI_PROGRAM}\") | ||
|
||
set(MY_CUPS_URI "booklet:/") | ||
add_definitions(-DMY_CUPS_URI=\"${MY_CUPS_URI}\") | ||
|
||
add_subdirectory(cups) | ||
add_subdirectory(gui) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required( VERSION 2.6 ) | ||
|
||
project(bokletCups) | ||
|
||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/booklet | ||
${CMAKE_CURRENT_BINARY_DIR}/booklet | ||
@ONLY) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/booklet | ||
DESTINATION /usr/lib/cups/backend | ||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#!/bin/bash | ||
|
||
TMP_DIR="/tmp" | ||
|
||
CUPS_BACKEND_OK=0 | ||
CUPS_BACKEND_FAILED=1 | ||
|
||
# Have debug info in /var/log/cups/error_log: | ||
#set -x | ||
|
||
# Output "device discovery" information on stdout: | ||
if test "$#" = "0"; then | ||
echo 'file @MY_CUPS_URI@ "Booklet Printer" "Booklet" "MFG:Generic;MDL:Booklet Printer;DES:Booklet Printer;CLS:PRINTER;CMD:POSTSCRIPT;"' | ||
exit 0 | ||
fi | ||
|
||
jobID=$1 | ||
user=$2 | ||
title=$3 | ||
count=$4 | ||
options=$5 | ||
psFile=$6 | ||
|
||
if [ -z ${psFile} ]; then | ||
psFile=${TMP_DIR}/brint_in_file-${jobID}.ps | ||
cat - > ${psFile} | ||
fi | ||
|
||
|
||
uid=$(id -u $user) | ||
|
||
if [ "${uid}" == "" ]; then | ||
echo "ERROR: Can't found UID for user '$user'" >&2 | ||
exit $CUPS_BACKEND_FAILED | ||
fi | ||
|
||
|
||
echo "DEBUG: User $user" >&2 | ||
echo "DEBUG: Uid $uid" >&2 | ||
|
||
oldIfs=$IFS | ||
IFS=$(echo -en "\n") | ||
while read line; do | ||
IFS="$oldIfs='" | ||
read key value <<< $line; | ||
|
||
case $key in | ||
Session*) | ||
if [ "$sesUid" = "$uid" -a "$sesActive" = "TRUE" -a "$sesDisplay" != "" ]; then | ||
echo "DEBUG: Session=$line" >&2 | ||
echo "DEBUG: DISPLAY=$sesDisplay" >&2 | ||
|
||
xDisplay=$sesDisplay | ||
break; | ||
fi | ||
|
||
unset sesUid | ||
unset sesActive | ||
unset sesADisplay | ||
;; | ||
|
||
unix-user) | ||
sesUid=$value | ||
;; | ||
|
||
active) | ||
sesActive=$value | ||
;; | ||
|
||
x11-display) | ||
sesDisplay=$value | ||
;; | ||
esac | ||
done <<< $(ck-list-sessions | tac ); | ||
|
||
|
||
if [ "${xDisplay}" == "" ]; then | ||
echo "ERROR: Can't found session for user '$user' (UID: $uid)" >&2 | ||
exit $CUPS_BACKEND_FAILED | ||
fi | ||
|
||
chown ${user} ${psFile} | ||
export DISPLAY=${xDisplay} | ||
su -c "@GUI_PROGRAM@ -t \"$title\" -n $count $psFile" $user 0<&- &>/tmp/booklet-${user}.log & | ||
|
||
exit $CUPS_BACKEND_OK | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
cmake_minimum_required( VERSION 2.6 ) | ||
|
||
project(bookletGui) | ||
|
||
set(HEADERS | ||
kernel/psconstants.h | ||
kernel/psfile.h | ||
kernel/psproject.h | ||
kernel/pssheet.h | ||
kernel/psengine.h | ||
kernel/printer.h | ||
third-party/libspectre/ps.h | ||
third-party/libspectre/spectre-utils.h | ||
mainwindow.h | ||
settings.h | ||
widgets.h | ||
|
||
dbus.h | ||
printersettings/printersettings.h | ||
psrender.h | ||
psview.h | ||
) | ||
|
||
set(SOURCES | ||
main.cpp | ||
kernel/psfile.cpp | ||
kernel/psproject.cpp | ||
kernel/pssheet.cpp | ||
kernel/psengine.cpp | ||
kernel/printer.cpp | ||
third-party/libspectre/ps.c | ||
third-party/libspectre/spectre-utils.c | ||
mainwindow.cpp | ||
settings.cpp | ||
widgets.cpp | ||
dbus.cpp | ||
printersettings/printersettings.cpp | ||
psrender.cpp | ||
psview.cpp | ||
) | ||
|
||
set (MOCS | ||
kernel/psfile.h | ||
kernel/psproject.h | ||
mainwindow.h | ||
widgets.h | ||
dbus.h | ||
printersettings/printersettings.h | ||
psrender.h | ||
psview.h | ||
) | ||
|
||
set(LIBRARIES | ||
) | ||
|
||
set(QT_USE_QTDBUS 1) | ||
|
||
set(UI_FILES | ||
mainwindow.ui | ||
printersettings/printersettings.ui | ||
) | ||
|
||
# QRC files ................. | ||
set(RESOURCES | ||
resource.qrc | ||
) | ||
|
||
# add translations ... | ||
file (GLOB TS_FILES | ||
translations/*.ts | ||
) | ||
|
||
set(DATA_DIR | ||
${CMAKE_INSTALL_PREFIX}/share/booklet | ||
) | ||
|
||
set(TRANSLATIONS_DIR | ||
"${DATA_DIR}/translations" | ||
) | ||
add_definitions(-DTRANSLATIONS_DIR=\"${TRANSLATIONS_DIR}\") | ||
|
||
|
||
############################################ | ||
if (NOT CMAKE_BUILD_TYPE) | ||
set ( CMAKE_BUILD_TYPE Release ) | ||
endif (NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
#if(CMAKE_COMPILER_IS_GNUCXX) | ||
# add_definitions (-Wall -pedantic) | ||
#endif() | ||
|
||
#******************************************* | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_SOURCE_DIR}/third-party | ||
${CMAKE_CURRENT_SOURCE_DIR}/third-party/libspectre | ||
${CMAKE_SOURCE_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
) | ||
|
||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) | ||
find_package(Qt4 REQUIRED) | ||
find_package(Ghostscript REQUIRED) | ||
|
||
include(${QT_USE_FILE}) | ||
qt4_wrap_cpp(MOC_SOURCES ${MOCS}) | ||
qt4_add_resources(QRC_SOURCES ${RESOURCES}) | ||
qt4_wrap_ui(UI_HEADERS ${UI_FILES}) | ||
qt4_add_translation(QM_FILES ${TS_FILES}) | ||
|
||
|
||
add_executable(booklet ${HEADERS} ${SOURCES} ${MOC_SOURCES} ${QM_FILES} ${QRC_SOURCES} ${UI_HEADERS}) | ||
target_link_libraries(booklet ${LIBRARIES} ${QT_LIBRARIES} ${GHOSTSCRIPT_LIBRARIES}) | ||
|
||
install(FILES ${QM_FILES} DESTINATION ${TRANSLATIONS_DIR}) | ||
install(TARGETS booklet RUNTIME DESTINATION ${GUI_DIR}) | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# +-----------------------------------------------------------------------------+ | ||
# | Copyright (C) 2012 | | ||
# | Lars B"ahren (lbaehren@gmail.com) | | ||
# | | | ||
# | This program is free software; you can redistribute it and/or modify | | ||
# | it under the terms of the GNU General Public License as published by | | ||
# | the Free Software Foundation; either version 2 of the License, or | | ||
# | (at your option) any later version. | | ||
# | | | ||
# | This program is distributed in the hope that it will be useful, | | ||
# | but WITHOUT ANY WARRANTY; without even the implied warranty of | | ||
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | ||
# | GNU General Public License for more details. | | ||
# | | | ||
# | You should have received a copy of the GNU General Public License | | ||
# | along with this program; if not, write to the | | ||
# | Free Software Foundation, Inc., | | ||
# | 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | | ||
# +-----------------------------------------------------------------------------+ | ||
|
||
# - Check for the presence of GHOSTSCRIPT | ||
# | ||
# The following variables are set when GHOSTSCRIPT is found: | ||
# GHOSTSCRIPT_FOUND = Set to true, if all components of GHOSTSCRIPT have been found. | ||
# GHOSTSCRIPT_INCLUDES = Include path for the header files of GHOSTSCRIPT | ||
# GHOSTSCRIPT_LIBRARIES = Link these to use GHOSTSCRIPT | ||
# GHOSTSCRIPT_LFLAGS = Linker flags (optional) | ||
|
||
if (NOT GHOSTSCRIPT_FOUND) | ||
|
||
if (NOT GHOSTSCRIPT_ROOT_DIR) | ||
set (GHOSTSCRIPT_ROOT_DIR ${CMAKE_INSTALL_PREFIX}) | ||
endif (NOT GHOSTSCRIPT_ROOT_DIR) | ||
|
||
##_____________________________________________________________________________ | ||
## Check for the header files | ||
|
||
find_path (GHOSTSCRIPT_INCLUDES | ||
NAMES ghostscript/gdevdsp.h ghostscript/iapi.h | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES include | ||
) | ||
|
||
##_____________________________________________________________________________ | ||
## Check for the library | ||
|
||
find_library (GHOSTSCRIPT_LIBRARIES gs | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES lib | ||
) | ||
|
||
##_____________________________________________________________________________ | ||
## Check for the executable | ||
|
||
find_program (GS_EXECUTABLE gs | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES bin | ||
) | ||
|
||
find_program (EPS2EPS_EXECUTABLE eps2eps | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES bin | ||
) | ||
|
||
find_program (DVIPDF_EXECUTABLE dvipdf | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES bin | ||
) | ||
|
||
find_program (PS2PS2_EXECUTABLE ps2ps2 | ||
HINTS ${GHOSTSCRIPT_ROOT_DIR} ${CMAKE_INSTALL_PREFIX} | ||
PATH_SUFFIXES bin | ||
) | ||
|
||
##_____________________________________________________________________________ | ||
## Actions taken when all components have been found | ||
|
||
find_package_handle_standard_args (GHOSTSCRIPT DEFAULT_MSG GHOSTSCRIPT_LIBRARIES GHOSTSCRIPT_INCLUDES GS_EXECUTABLE) | ||
|
||
if (GHOSTSCRIPT_FOUND) | ||
if (NOT GHOSTSCRIPT_FIND_QUIETLY) | ||
message (STATUS "Found components for GHOSTSCRIPT") | ||
message (STATUS "GHOSTSCRIPT_ROOT_DIR = ${GHOSTSCRIPT_ROOT_DIR}") | ||
message (STATUS "GHOSTSCRIPT_INCLUDES = ${GHOSTSCRIPT_INCLUDES}") | ||
message (STATUS "GHOSTSCRIPT_LIBRARIES = ${GHOSTSCRIPT_LIBRARIES}") | ||
endif (NOT GHOSTSCRIPT_FIND_QUIETLY) | ||
else (GHOSTSCRIPT_FOUND) | ||
if (GHOSTSCRIPT_FIND_REQUIRED) | ||
message (FATAL_ERROR "Could not find GHOSTSCRIPT!") | ||
endif (GHOSTSCRIPT_FIND_REQUIRED) | ||
endif (GHOSTSCRIPT_FOUND) | ||
|
||
##_____________________________________________________________________________ | ||
## Mark advanced variables | ||
|
||
mark_as_advanced ( | ||
GHOSTSCRIPT_ROOT_DIR | ||
GHOSTSCRIPT_INCLUDES | ||
GHOSTSCRIPT_LIBRARIES | ||
GS_EXECUTABLE | ||
) | ||
|
||
endif (NOT GHOSTSCRIPT_FOUND) |
Oops, something went wrong.