Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12a2ff2051 | |||
| 24d1ce7e0b | |||
| 92d47eee99 | |||
| 1f253d8c35 | |||
| 3b66a26e05 | |||
| 9b15a68c99 | |||
| 86d1abdfbd | |||
| e3ff109311 | |||
| e9286548d1 | |||
| 332afaa867 | |||
| 0f765a6313 | |||
| b52abb4913 |
@@ -33,3 +33,4 @@ FIND_PACKAGE( Qt4 REQUIRED )
|
||||
FIND_PACKAGE( LightScribe REQUIRED )
|
||||
|
||||
SUBDIRS( src )
|
||||
SUBDIRS( resources )
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
NEWS - list of user-visible changes between releases of qlscribe
|
||||
|
||||
New in 0.7:
|
||||
Z-order of items saved and resored
|
||||
Bugfix for not loading radius for round text
|
||||
Console mode printing implemented
|
||||
While printing in console mode text can be replaced by application parameter
|
||||
|
||||
New in 0.6:
|
||||
Label mode and background color is added to scene
|
||||
Added dialog to edit properties (color and mode) of the scene (label)
|
||||
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
qlscribe (0.7-0ubuntu1) unstable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Vyacheslav Kononenko <vyacheslav@kononenko.net> Sun, 15 Feb 2009 21:49:41 -0500
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
7
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
Source: qlscribe
|
||||
Section: qt
|
||||
Priority: optional
|
||||
Maintainer: Vyacheslav Kononenko <vyacheslav@kononenko.net>
|
||||
Build-Depends: debhelper (>= 7)
|
||||
Standards-Version: 3.7.3
|
||||
Homepage: http://qlscribe.sourceforge.net/
|
||||
|
||||
Package: qlscribe
|
||||
Architecture: i386
|
||||
Depends: ${shlibs:Depends}, lightscribe, libstdc++5
|
||||
Description: Qt based application to print lightScribe discs
|
||||
Qt lightScribe is a GUI application to burn labels on lightScribe capable drives.
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
This package was debianized by Vyacheslav Kononenko <vyacheslav@kononenko.net> on
|
||||
Sun, 15 Feb 2009 21:49:41 -0500.
|
||||
|
||||
It was downloaded from https://sourceforge.net/project/platformdownload.php?group_id=251217
|
||||
|
||||
Upstream Author(s):
|
||||
|
||||
Vyacheslav Kononenko <vyacheslav@kononenko.net>
|
||||
|
||||
Copyright:
|
||||
|
||||
<Copyright (C) 2009 Vyacheslav Kononenko>
|
||||
|
||||
License:
|
||||
|
||||
This package 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 package 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 package; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL'.
|
||||
|
||||
The Debian packaging is (C) 2009, Vyacheslav Kononenko <vyacheslav@kononenko.net> and
|
||||
is licensed under the GPL, see above.
|
||||
|
||||
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
usr/bin
|
||||
usr/sbin
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
NEWS
|
||||
README
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
# Sample debian/rules that uses debhelper.
|
||||
# This file was originally written by Joey Hess and Craig Small.
|
||||
# As a special exception, when this file is copied by dh-make into a
|
||||
# dh-make output file, you may use that output file without restriction.
|
||||
# This special exception was added by Craig Small in version 0.37 of dh-make.
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
# Add here commands to configure the package.
|
||||
mkdir -p build
|
||||
cd build; cmake .. -DCMAKE_INSTALL_PREFIX=$(CURDIR)/debian/qlscribe/usr
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
build: build-stamp
|
||||
|
||||
build-stamp: configure-stamp
|
||||
dh_testdir
|
||||
|
||||
# Add here commands to compile the package.
|
||||
cd build; $(MAKE)
|
||||
#docbook-to-man debian/qlscribe.sgml > qlscribe.1
|
||||
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
rm -f build-stamp configure-stamp
|
||||
|
||||
# Add here commands to clean up after the build process.
|
||||
rm -rf build
|
||||
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
|
||||
# Add here commands to install the package into debian/qlscribe.
|
||||
cd build; $(MAKE) install
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
# We have nothing to do by default.
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installchangelogs ChangeLog
|
||||
# dh_installdocs
|
||||
# dh_installexamples
|
||||
dh_install
|
||||
dh_desktop
|
||||
dh_icons
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
# dh_installemacsen
|
||||
# dh_installpam
|
||||
dh_installmime
|
||||
# dh_python
|
||||
# dh_installinit
|
||||
# dh_installcron
|
||||
# dh_installinfo
|
||||
# dh_installman
|
||||
# dh_link
|
||||
# dh_strip
|
||||
dh_compress
|
||||
# dh_fixperms #need suid
|
||||
# dh_perl
|
||||
# dh_makeshlibs
|
||||
dh_installdeb
|
||||
dh_shlibdeps -- --ignore-missing-info
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install configure
|
||||
@@ -0,0 +1,36 @@
|
||||
# qlscribe - Qt based application to print lightScribe discs
|
||||
#
|
||||
# Copyright (C) 2009 Vyacheslav Kononenko <vyacheslav@kononenko.net>
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# $Id$
|
||||
|
||||
SET( DESKTOP_DIR share/applications )
|
||||
SET( MIME_DIR share/mime/packages )
|
||||
SET( ICON_DIR share/icons/hicolor )
|
||||
|
||||
INSTALL( FILES qlscribe.desktop DESTINATION ${DESKTOP_DIR} )
|
||||
|
||||
INSTALL( FILES qlscribe.xml DESTINATION ${MIME_DIR} )
|
||||
|
||||
MACRO( INSTALL_ICON SIZE )
|
||||
INSTALL( FILES qlscribe${SIZE}.png DESTINATION ${ICON_DIR}/${SIZE}x${SIZE}/apps RENAME qlscribe.png )
|
||||
ENDMACRO( INSTALL_ICON )
|
||||
|
||||
INSTALL_ICON( 64 )
|
||||
INSTALL_ICON( 48 )
|
||||
INSTALL_ICON( 32 )
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Name=Qt lightScribe
|
||||
Exec=qlscribe
|
||||
Icon=qlscribe.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/x-qlscribe;
|
||||
Categories=AudioVideo;DiscBurning;
|
||||
Binary file not shown.
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/x-qlscribe">
|
||||
<comment>Qt lightScribe label document</comment>
|
||||
<glob pattern="*.qlx"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
+2
-2
@@ -21,14 +21,14 @@
|
||||
SET( QLSCRIBE_SRCS main.cpp mainwindow.cpp qcdscene.cpp qcdview.cpp
|
||||
qdialogpixmap.cpp qdialogroundtext.cpp qdialogtext.cpp qlightroundtextitem.cpp
|
||||
qlightscribe.cpp qshapefactory.cpp qlighttextitem.cpp qlightpixmapitem.cpp
|
||||
qdialogprint.cpp qdialogprogress.cpp qdialogcdproperties.cpp)
|
||||
qdialogprint.cpp qdialogprogress.cpp qdialogcdproperties.cpp qconsoleprintprogress.cpp)
|
||||
|
||||
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui
|
||||
qdialogprint.ui qdialogprogress.ui qdialogcdproperties.ui)
|
||||
|
||||
SET( QLSCRIBE_MOC_HDRS mainwindow.h qcdscene.h qdialogpixmap.h qdialogroundtext.h
|
||||
qdialogtext.h qlightscribe.h qdialogprint.h qdialogprogress.h
|
||||
qdialogcdproperties.h)
|
||||
qdialogcdproperties.h qconsoleprintprogress.h)
|
||||
|
||||
ADD_DEFINITIONS( -Wall )
|
||||
|
||||
|
||||
+131
-15
@@ -20,34 +20,150 @@
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <QMap>
|
||||
#include "mainwindow.h"
|
||||
#include "qcdscene.h"
|
||||
#include "qlightscribe.h"
|
||||
#include "qconsoleprintprogress.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
uid_t realUserId;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
std::ostream &operator<<( std::ostream &os, const QString &str )
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
return os << str.toAscii().data();
|
||||
}
|
||||
|
||||
void usage()
|
||||
{
|
||||
std::cout << "Usage: \n"
|
||||
<< "To run GUI: qlscribe [filename] [filename] ...\n"
|
||||
<< "To print label in console mode: qlscribe --print [--drive Index] [--replace KEY=VALUE] filename\n"
|
||||
<< "\tParameters:\n"
|
||||
<< "\t\t--help | -h - print this message\n"
|
||||
<< "\t\t--print | -p - switch to print mode\n"
|
||||
<< "\t\t--drive | -d NUMBER - use this drive, starts from 0, 0 is default\n"
|
||||
<< "\t\t--replace | -r KEY=VALUE - replace text from KEY to VALUE\n"
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int main( int argc, char **argv )
|
||||
{
|
||||
QApplication app( argc, argv );
|
||||
app.addLibraryPath( "/usr/lib32/qt4/plugins" );
|
||||
|
||||
bool doPrint = false;
|
||||
QStringList arguments = app.arguments();
|
||||
QStringList files;
|
||||
QCDScene::QString2String replacements;
|
||||
int driveIndex = 0;
|
||||
QLightScribe::PrintParameters params;
|
||||
bool labelModeOverriden = false;
|
||||
|
||||
for( int i = 1; i < arguments.size(); ++i ) {
|
||||
QString arg = arguments[i];
|
||||
if( arg == "--print" || arg == "-p" ) {
|
||||
doPrint = true;
|
||||
continue;
|
||||
}
|
||||
if( arg == "--help" || arg == "-h" ) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
if( arg == "--replace" || arg == "-r" ) {
|
||||
if( i == arguments.size() - 1 ) {
|
||||
std::cerr << "Error: arg#" << i
|
||||
<< " argument expected for \"" << arg << "\" not enough parameters" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
QString param = arguments[ ++i ];
|
||||
int pos = param.indexOf( '=' );
|
||||
if( pos == -1 ) {
|
||||
std::cerr << "Error: arg#" << i
|
||||
<< " invalid argument for replacement, KEY=VALUE expected, missing =" << std::endl;
|
||||
return 2;
|
||||
}
|
||||
replacements[ param.left( pos ) ] = param.right( param.size() - pos - 1 );
|
||||
continue;
|
||||
}
|
||||
if( arg == "--drive" || arg == "-d" ) {
|
||||
if( i == arguments.size() - 1 ) {
|
||||
std::cerr << "Error: arg#" << i
|
||||
<< " argument expected for \"" << arg << "\" not enough parameters" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
QString param = arguments[ ++i ];
|
||||
driveIndex = param.toInt();
|
||||
}
|
||||
if( arg[0] != '-' )
|
||||
files.append( arg );
|
||||
}
|
||||
|
||||
if( doPrint && files.size() != 1 ) {
|
||||
if( files.size() )
|
||||
std::cerr << "Error: only one filename expected to print, got " << files.size() << " instead" << std::endl;
|
||||
else
|
||||
std::cerr << "Error: filename required to print" << std::endl;
|
||||
return 3;
|
||||
}
|
||||
|
||||
bool enablePrint = false;
|
||||
if( geteuid() ) {
|
||||
if( QMessageBox::question( 0,
|
||||
QObject::tr( "Confirmation" ),
|
||||
QObject::tr( "Print functionality requires setuid (sticky) flag set on the application\n"
|
||||
"This program does not seem to have it set, print functiionality will be disabled\n"
|
||||
"You still will be able to do print preview and edit documents\n"
|
||||
"Do you want to continue?" ),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No )
|
||||
== QMessageBox::No )
|
||||
return 1;
|
||||
if( !doPrint ) {
|
||||
if( QMessageBox::question( 0,
|
||||
QObject::tr( "Confirmation" ),
|
||||
QObject::tr( "Print functionality requires setuid (sticky) flag set on the application\n"
|
||||
"This program does not seem to have it set, print functionality will be disabled\n"
|
||||
"You still will be able to do print preview and edit documents\n"
|
||||
"Do you want to continue?" ),
|
||||
QMessageBox::Yes | QMessageBox::No,
|
||||
QMessageBox::No )
|
||||
== QMessageBox::No )
|
||||
return 4;
|
||||
} else {
|
||||
std::cerr << "Error: setuid flag is not set, cannot print" << std::endl;
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
realUserId = getuid();
|
||||
setreuid( 0, realUserId );
|
||||
enablePrint = true;
|
||||
}
|
||||
MainWindow mwindow( enablePrint );
|
||||
mwindow.show();
|
||||
|
||||
return app.exec();
|
||||
int rez = 0;
|
||||
|
||||
if( doPrint ) {
|
||||
// print here
|
||||
QCDScene scene;
|
||||
QString err;
|
||||
if( !scene.load( files.front(), &err ) ) {
|
||||
std::cerr << "Error: cannot read \"" << files.front() << "\" - " << err << std::endl;
|
||||
return 5;
|
||||
}
|
||||
scene.replace( replacements );
|
||||
if( !labelModeOverriden )
|
||||
params.m_labelMode = scene.labelMode();
|
||||
|
||||
QLightScribe *scribe = QLightScribe::instance();
|
||||
QList< QLightDrive * > drives = scribe->getDrives();
|
||||
if( driveIndex >= drives.size() ) {
|
||||
std::cerr << "Error: drive " << driveIndex << " specified, but there are only " << drives.size() << " drives" << std::endl;
|
||||
return 6;
|
||||
}
|
||||
QConsolePrintProgress progress;
|
||||
std::cout << "Printing label " << files.front() << std::endl;
|
||||
scribe->print( drives[driveIndex], params, &scene );
|
||||
rez = app.exec();
|
||||
} else {
|
||||
MainWindow mwindow( enablePrint );
|
||||
mwindow.show();
|
||||
mwindow.open( files );
|
||||
rez = app.exec();
|
||||
}
|
||||
|
||||
QLightScribe *scribe = QLightScribe::instance();
|
||||
scribe->stopThread();
|
||||
scribe->wait( 1000 );
|
||||
return rez;
|
||||
}
|
||||
|
||||
+19
-4
@@ -46,6 +46,7 @@ MainWindow::MainWindow( bool enablePrint )
|
||||
m_insertMapper( new QSignalMapper( this ) ),
|
||||
m_newLabelMapper( new QSignalMapper( this ) )
|
||||
{
|
||||
setWindowTitle( tr( "Qt lightScribe", "Main window title \"Qt lightScribe\"" ) );
|
||||
setCentralWidget( m_mdiArea );
|
||||
|
||||
m_menuFile = menuBar()->addMenu( tr( "File", "Menu item \"File\"" ) );
|
||||
@@ -130,9 +131,23 @@ MainWindow::MainWindow( bool enablePrint )
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
QLightScribe *lscribe = QLightScribe::instance();
|
||||
lscribe->stopThread();
|
||||
lscribe->wait( 1000 );
|
||||
}
|
||||
|
||||
void MainWindow::open( const QStringList &files )
|
||||
{
|
||||
foreach( QString fileName, files ) {
|
||||
QCDView *newView = new QCDView;
|
||||
QCDScene *scene = new QCDScene( newView );
|
||||
newView->setScene( scene );
|
||||
|
||||
if( !scene->load( fileName ) ) {
|
||||
delete newView;
|
||||
continue;
|
||||
}
|
||||
|
||||
QMdiSubWindow *subWindow = m_mdiArea->addSubWindow( newView );
|
||||
subWindow->show();
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::saveSceneAs( QCDScene *scene )
|
||||
@@ -332,7 +347,7 @@ void MainWindow::onMenuAbout()
|
||||
QMessageBox::about( this,
|
||||
tr( "About" ),
|
||||
tr( "<h3>qlscribe - Qt lisghtScribe</h3>"
|
||||
"<p>release 0.6 $Revision$</p>"
|
||||
"<p>release 0.7 $Revision$</p>"
|
||||
"<p>visit project at home page "
|
||||
"<a href=\"http://qlscribe.sourceforge.net/\">qlscribe.sourceforge.net</a></p>" ) );
|
||||
}
|
||||
|
||||
@@ -35,6 +35,8 @@ public:
|
||||
virtual ~MainWindow();
|
||||
|
||||
bool saveScene( QCDScene *scene );
|
||||
void open( const QStringList &files );
|
||||
|
||||
protected:
|
||||
virtual void closeEvent( QCloseEvent *event );
|
||||
|
||||
|
||||
+27
-7
@@ -48,11 +48,28 @@ QCDScene::~QCDScene()
|
||||
{
|
||||
}
|
||||
|
||||
bool QCDScene::load( const QString &fileName )
|
||||
void QCDScene::replace( const QString2String &strings )
|
||||
{
|
||||
QShapeFactory &sfactory = QShapeFactory::instance();
|
||||
QList<QGraphicsItem *> list = items();
|
||||
|
||||
for( QString2String::const_iterator st = strings.begin(); st != strings.end(); ++st ) {
|
||||
foreach(QGraphicsItem *item, list ) {
|
||||
QShapeFactory::iterator f = sfactory.find( item->type() );
|
||||
if( f != sfactory.end() )
|
||||
f->second->replace( item, st.key(), st.value() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool QCDScene::load( const QString &fileName, QString *errMessage )
|
||||
{
|
||||
QFile file( fileName );
|
||||
if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
|
||||
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot open file for reading\n" ) + fileName );
|
||||
if( errMessage )
|
||||
*errMessage = "cannot open file for reading";
|
||||
else
|
||||
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot open file for reading\n" ) + fileName );
|
||||
return false;
|
||||
}
|
||||
QXmlStreamReader reader( &file );
|
||||
@@ -60,7 +77,10 @@ bool QCDScene::load( const QString &fileName )
|
||||
read( reader );
|
||||
}
|
||||
catch( const QString &err ) {
|
||||
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot read file " ) + fileName + "\n" + err );
|
||||
if( errMessage )
|
||||
*errMessage = err;
|
||||
else
|
||||
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot read file " ) + fileName + "\n" + err );
|
||||
return false;
|
||||
}
|
||||
m_fileName = fileName;
|
||||
@@ -162,13 +182,13 @@ void QCDScene::write( QXmlStreamWriter &writer )
|
||||
|
||||
QShapeFactory &sfactory = QShapeFactory::instance();
|
||||
QList<QGraphicsItem *> list = items();
|
||||
for( QList<QGraphicsItem *>::const_iterator it = list.begin(); it != list.end(); ++it ) {
|
||||
QShapeFactory::iterator f = sfactory.find( (*it)->type() );
|
||||
foreach(QGraphicsItem *item, list ) {
|
||||
QShapeFactory::iterator f = sfactory.find( item->type() );
|
||||
if( f == sfactory.end() ) {
|
||||
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot find controller for type %n", 0, (*it)->type() ) );
|
||||
QMessageBox::warning( 0, tr( "Warning" ), tr( "Cannot find controller for type %n", 0, item->type() ) );
|
||||
continue;
|
||||
}
|
||||
f->second->write( writer, *it );
|
||||
f->second->write( writer, item );
|
||||
}
|
||||
|
||||
writer.writeEndElement();
|
||||
|
||||
+4
-1
@@ -31,6 +31,8 @@ class QXmlStreamReader;
|
||||
class QCDScene : public QGraphicsScene {
|
||||
Q_OBJECT
|
||||
public:
|
||||
typedef QMap<QString,QString> QString2String;
|
||||
|
||||
QCDScene( QObject * parent = 0 );
|
||||
virtual ~QCDScene();
|
||||
|
||||
@@ -45,7 +47,8 @@ public:
|
||||
|
||||
void setChanged();
|
||||
void setName();
|
||||
bool load( const QString &fileName );
|
||||
bool load( const QString &fileName, QString *errMessage = 0 );
|
||||
void replace( const QString2String &strings );
|
||||
bool save();
|
||||
bool saveAs( const QString &fileName );
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "qconsoleprintprogress.h"
|
||||
#include "qlightscribe.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
QConsolePrintProgress::QConsolePrintProgress()
|
||||
{
|
||||
QLightScribe *scribe = QLightScribe::instance();
|
||||
|
||||
connect( scribe, SIGNAL(prepareProgress(long,long)), this, SLOT(onPrepareProgress(long,long)) );
|
||||
connect( scribe, SIGNAL(labelProgress(long,long)), this, SLOT(onLabelProgress(long,long)) );
|
||||
connect( scribe, SIGNAL(timeEstimate(long)), this, SLOT(onTimeEstimate(long)) );
|
||||
connect( scribe, SIGNAL(finished(int)), this, SLOT(onFinished(int)) );
|
||||
|
||||
}
|
||||
|
||||
QConsolePrintProgress::~QConsolePrintProgress()
|
||||
{
|
||||
}
|
||||
|
||||
void QConsolePrintProgress::onPrepareProgress( long current, long final )
|
||||
{
|
||||
std::cout << "Preparing label: " << current << '/' << final << " \r";
|
||||
}
|
||||
|
||||
void QConsolePrintProgress::onLabelProgress( long current, long final )
|
||||
{
|
||||
std::cout << "Printing label: " << current << '/' << final << " \r";
|
||||
}
|
||||
|
||||
void QConsolePrintProgress::onTimeEstimate( long time )
|
||||
{
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
||||
void QConsolePrintProgress::onFinished( int status )
|
||||
{
|
||||
std::cout << "\n";
|
||||
if( !status )
|
||||
std::cout << "Print successfull" << std::endl;
|
||||
else
|
||||
std::cout << "Print failed: 0x" << QString::number( status, 16 ) << std::endl;
|
||||
|
||||
qApp->exit( status );
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef QCONSOLEPRINTPROGRESS_H
|
||||
#define QCONSOLEPRINTPROGRESS_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QConsolePrintProgress : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QConsolePrintProgress();
|
||||
~QConsolePrintProgress();
|
||||
|
||||
private slots:
|
||||
void onPrepareProgress( long current, long final );
|
||||
void onLabelProgress( long current, long final );
|
||||
void onTimeEstimate( long time );
|
||||
void onFinished(int status );
|
||||
};
|
||||
|
||||
#endif // QCONSOLEPRINTPROGRESS_H
|
||||
@@ -70,10 +70,9 @@ void QShapeControllerPixmap::writeData( QXmlStreamWriter &writer, const QGraphic
|
||||
= static_cast< const QGraphicsPixmapItem * >( item );
|
||||
|
||||
writer.writeEmptyElement( "pos" );
|
||||
writer.writeAttribute(
|
||||
QXmlStreamAttribute( "x", QString::number( pixmapItem->pos().x() ) ) );
|
||||
writer.writeAttribute(
|
||||
QXmlStreamAttribute( "y", QString::number( pixmapItem->pos().y() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "x", QString::number( pixmapItem->pos().x() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "y", QString::number( pixmapItem->pos().y() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "z", QString::number( pixmapItem->zValue() ) ) );
|
||||
|
||||
QPointF scale = pixmapItem->transform().map( QPointF( 1.0, 1.0 ) );
|
||||
writer.writeEmptyElement( "scale" );
|
||||
@@ -96,6 +95,7 @@ void QShapeControllerPixmap::readData( const QString &element,
|
||||
if( element == "pos" ) {
|
||||
pixmapItem->setPos( attrs.value( "x" ).toString().toDouble(),
|
||||
attrs.value( "y" ).toString().toDouble() );
|
||||
pixmapItem->setZValue( attrs.value( "z" ).toString().toDouble() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -261,12 +261,20 @@ QItemDialog *QShapeControllerRoundText::createDialog( QWidget *parent ) const
|
||||
return new QDialogRoundText( parent );
|
||||
}
|
||||
|
||||
void QShapeControllerRoundText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
|
||||
{
|
||||
QLightRoundTextItem *textItem = static_cast< QLightRoundTextItem * >( item );
|
||||
if( textItem->text() == from )
|
||||
textItem->setText( to );
|
||||
}
|
||||
|
||||
void QShapeControllerRoundText::writeData( QXmlStreamWriter &writer, const QGraphicsItem *item ) const
|
||||
{
|
||||
const QLightRoundTextItem *textItem = static_cast< const QLightRoundTextItem * >( item );
|
||||
writer.writeEmptyElement( "pos" );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "x", QString::number( textItem->pos().x() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "y", QString::number( textItem->pos().y() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "z", QString::number( textItem->zValue() ) ) );
|
||||
|
||||
writer.writeTextElement( "radius", QString::number( textItem->radius() ) );
|
||||
writer.writeTextElement( "angle", QString::number( textItem->angle() ) );
|
||||
@@ -287,6 +295,7 @@ void QShapeControllerRoundText::readData( const QString &element,
|
||||
if( element == "pos" ) {
|
||||
textItem->setPos( attrs.value( "x" ).toString().toDouble(),
|
||||
attrs.value( "y" ).toString().toDouble() );
|
||||
textItem->setZValue( attrs.value( "z" ).toString().toDouble() );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -312,6 +321,11 @@ void QShapeControllerRoundText::readData( const QString &element,
|
||||
return;
|
||||
}
|
||||
|
||||
if( element == "radius" ) {
|
||||
textItem->setRadius( data.toDouble() );
|
||||
return;
|
||||
}
|
||||
|
||||
if( element == "angle" ) {
|
||||
textItem->setAngle( data.toDouble() );
|
||||
return;
|
||||
|
||||
@@ -74,6 +74,7 @@ public:
|
||||
virtual QString menuName() const;
|
||||
|
||||
virtual QGraphicsItem *create() const;
|
||||
virtual void replace( QGraphicsItem *item, const QString &from, const QString &to ) const;
|
||||
|
||||
protected:
|
||||
virtual QItemDialog *createDialog( QWidget *parent ) const;
|
||||
|
||||
@@ -71,12 +71,20 @@ void QShapeControllerText::writeData( QXmlStreamWriter &writer, const QGraphicsI
|
||||
writer.writeEmptyElement( "pos" );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "x", QString::number( textItem->pos().x() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "y", QString::number( textItem->pos().y() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "z", QString::number( textItem->zValue() ) ) );
|
||||
|
||||
writer.writeTextElement( "font", textItem->font().toString() );
|
||||
writer.writeTextElement( "color", textItem->brush().color().name() );
|
||||
writer.writeTextElement( "text", textItem->text() );
|
||||
}
|
||||
|
||||
void QShapeControllerText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
|
||||
{
|
||||
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
|
||||
if( textItem->text() == from )
|
||||
textItem->setText( to );
|
||||
}
|
||||
|
||||
|
||||
void QShapeControllerText::readData( const QString &element,
|
||||
const QXmlStreamAttributes &attrs,
|
||||
@@ -88,6 +96,7 @@ void QShapeControllerText::readData( const QString &element,
|
||||
if( element == "pos" ) {
|
||||
textItem->setPos( attrs.value( "x" ).toString().toDouble(),
|
||||
attrs.value( "y" ).toString().toDouble() );
|
||||
textItem->setZValue( attrs.value( "z" ).toString().toDouble() );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
virtual QString menuName() const;
|
||||
|
||||
virtual QGraphicsItem *create() const;
|
||||
virtual void replace( QGraphicsItem *item, const QString &from, const QString &to ) const;
|
||||
|
||||
protected:
|
||||
virtual QItemDialog *createDialog( QWidget *parent ) const;
|
||||
|
||||
+6
-1
@@ -16,11 +16,14 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
$Id:$ */
|
||||
$Id$ */
|
||||
|
||||
#ifndef QLSCRIBE_H
|
||||
#define QLSCRIBE_H
|
||||
|
||||
#include <iostream>
|
||||
#include <QString>
|
||||
|
||||
enum LabelMode {
|
||||
/** label the entire disc */
|
||||
modeFull=0,
|
||||
@@ -30,4 +33,6 @@ enum LabelMode {
|
||||
modeContent=2
|
||||
};
|
||||
|
||||
std::ostream &operator<<( std::ostream &os, const QString &str );
|
||||
|
||||
#endif // QLSCRIBE_H
|
||||
|
||||
+4
-2
@@ -19,7 +19,8 @@ SOURCES += main.cpp \
|
||||
qdialogprogress.cpp \
|
||||
qlighttextitem.cpp \
|
||||
qlightpixmapitem.cpp \
|
||||
qdialogcdproperties.cpp
|
||||
qdialogcdproperties.cpp \
|
||||
qconsoleprintprogress.cpp
|
||||
QMAKE_LIBS += -llightscribe
|
||||
HEADERS += mainwindow.h \
|
||||
qlightroundtextitem.h \
|
||||
@@ -35,7 +36,8 @@ HEADERS += mainwindow.h \
|
||||
qlighttextitem.h \
|
||||
qlightpixmapitem.h \
|
||||
qlscribe.h \
|
||||
qdialogcdproperties.h
|
||||
qdialogcdproperties.h \
|
||||
qconsoleprintprogress.h
|
||||
FORMS += qdialogtext.ui \
|
||||
qdialogroundtext.ui \
|
||||
qdialogpixmap.ui \
|
||||
|
||||
@@ -88,6 +88,10 @@ QGraphicsItem *QShapeController::read( QXmlStreamReader &reader ) const
|
||||
return item;
|
||||
}
|
||||
|
||||
void QShapeController::replace( QGraphicsItem *, const QString &, const QString & ) const
|
||||
{
|
||||
}
|
||||
|
||||
QShapeFactory &QShapeFactory::QShapeFactory::instance()
|
||||
{
|
||||
static QShapeFactory inst;
|
||||
|
||||
+4
-1
@@ -16,7 +16,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
$Id:$ */
|
||||
$Id$ */
|
||||
|
||||
#ifndef QSHAPEFACTORY_H
|
||||
#define QSHAPEFACTORY_H
|
||||
@@ -46,10 +46,13 @@ public:
|
||||
virtual QString name() const = 0;
|
||||
virtual QString menuName() const = 0;
|
||||
virtual QGraphicsItem *create() const = 0;
|
||||
|
||||
bool edit( QGraphicsItem *item, QWidget *parent ) const;
|
||||
void write( QXmlStreamWriter &writer, const QGraphicsItem *item ) const;
|
||||
QGraphicsItem *read( QXmlStreamReader &reader ) const;
|
||||
|
||||
virtual void replace( QGraphicsItem *item, const QString &from, const QString &to ) const;
|
||||
|
||||
protected:
|
||||
virtual QItemDialog *createDialog( QWidget *parent ) const = 0;
|
||||
virtual void writeData( QXmlStreamWriter &writer, const QGraphicsItem *item ) const = 0;
|
||||
|
||||
Reference in New Issue
Block a user