1 Commits

Author SHA1 Message Date
ruglory 3f8db94113 Tagging the 0.11 release
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/tags/release-0.11@142 cac9541e-1b8d-4bfa-827e-589bba606050
2009-04-04 03:43:12 +00:00
40 changed files with 241 additions and 719 deletions
+2 -2
View File
@@ -26,10 +26,10 @@ SET( FINAL_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Final install path
SET( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
SET( QLSCRIBE_DBUS_SERVICE org.lightscribe )
SET( QLSCRIBE_DBUS_MANAGER_SERVICE ${QLSCRIBE_DBUS_SERVICE}.printManager )
SET( QLSCRIBE_DBUS_MANAGER_SERVICE ${QLSCRIBE_DBUS_SERVICE}.Manager )
SET( QLSCRIBE_DBUS_DRIVES_SERVICE ${QLSCRIBE_DBUS_SERVICE}.drives )
SET( QLSCRIBE_DBUS_PATH /org/lightscribe )
SET( QLSCRIBE_DBUS_MANAGER_PATH ${QLSCRIBE_DBUS_PATH}/printManager ) # path to manager
SET( QLSCRIBE_DBUS_MANAGER_PATH ${QLSCRIBE_DBUS_PATH}/Manager ) # path to manager
SET( QLSCRIBE_DBUS_DRIVES_PATH ${QLSCRIBE_DBUS_PATH}/drives ) # base path under which drives located
SUBDIRS( src )
-21
View File
@@ -1,26 +1,5 @@
NEWS - list of user-visible changes between releases of qlscribe
New in 0.15
Added ability to align regular text to left, right or center the same way as rounded text
Fixed issue with filters in open dialog
Added image preview to Qt open file dialog
New in 0.14
Added Software Render for preview to make preview when no drive is available
Items have Z coordinate set to remove ambiguity
Saves from previous versions will have Z coordinate of items reordered on load
New in 0.13:
Fixes in dbus config for Ubuntu Jaunty
New in 0.12:
Fixed bug for round text not updating last used font
Main window stores/restores position and size from/to config
Round text changes radius and angle when dragged by mouse instead of moving the center
Added ability to open image as a document
Bugfix for labels opened from commandline not updating menu
Bugfix for not properly drawing partially covered window background
New in 0.11:
Application settings added with default font to use and option to eject media
Added functionality to eject media after print
+1 -1
View File
@@ -18,7 +18,7 @@
#
# $Id$
FIND_PATH( LSCRIBE_INCLUDE_DIR lightscribe.h /usr/local/include /usr/include/lightscribe $ENV{LIGHTSCRIBEDIR}/include )
FIND_PATH( LSCRIBE_INCLUDE_DIR lightscribe.h /usr/local/include /usr/include/lightsribe $ENV{LIGHTSCRIBEDIR}/include )
FIND_LIBRARY( LSCRIBE_LIBRARY lightscribe /usr/local/lib /opt/lightscribe/lib /opt/lightscribe/lib32 $ENV{LIGHTSCRIBEDIR}/lib )
+1 -5
View File
@@ -1,8 +1,4 @@
qlscribe (0.15-0ubuntu1) unstable; urgency=low
* Release 0.15 imported
* Release 0.14 imported
* Release 0.13 imported
* Release 0.12 imported
qlscribe (0.11-0ubuntu1) unstable; urgency=low
* Release 0.11 imported
* Release 0.10 imported
* Release 0.9 imported
+1 -1
View File
@@ -1 +1 @@
/usr/share/dbus-1/system-services/org.lightscribe.printManager.service
/usr/share/dbus-1/services/org.lightscribe.Manager.service
+1 -1
View File
@@ -8,6 +8,6 @@ Homepage: http://qlscribe.sourceforge.net/
Package: qlscribe
Architecture: any
Depends: ${shlibs:Depends}
Depends: ${shlibs:Depends}, lightscribe
Description: Qt based application to print lightScribe discs
Qt lightScribe is a GUI application to burn labels on lightScribe capable drives.
+2 -2
View File
@@ -9,7 +9,7 @@ Upstream Author(s):
Copyright:
<Copyright (C) 2009-2010 Vyacheslav Kononenko>
<Copyright (C) 2009 Vyacheslav Kononenko>
License:
@@ -30,7 +30,7 @@ License:
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-2010, Vyacheslav Kononenko <vyacheslav@kononenko.net> and
The Debian packaging is (C) 2009, Vyacheslav Kononenko <vyacheslav@kononenko.net> and
is licensed under the GPL, see above.
+1 -1
View File
@@ -2,7 +2,7 @@
set -e
if [ "$1" = "configure" ] ; then
invoke-rc.d dbus reload
/etc/init.d/dbus reload
fi
#DEBHELPER#
+3 -2
View File
@@ -2,13 +2,14 @@
set -e
if [ "$1" = "remove" -o "$1" = "upgrade" ] ; then
if PID=`pidof lscribed` ; then
PID=`pidof lscribed`
if [ "X$PID" != "X" ] ; then
kill $PID
fi
fi
if [ "$1" = "remove" ] ; then
invoke-rc.d dbus reload
/etc/init.d/dbus reload
fi
#DEBHELPER#
+1 -1
View File
@@ -17,7 +17,7 @@ configure-stamp:
cd build; cmake .. -DCMAKE_INSTALL_PREFIX=$(CURDIR)/debian/qlscribe/usr \
-DFINAL_INSTALL_PREFIX=/usr \
-DDBUS_SYSTEM_POLICY_DIR=$(CURDIR)/debian/qlscribe/etc/dbus-1/system.d \
-DDBUS_SYSTEM_SERVICE_DIR=$(CURDIR)/debian/qlscribe/usr/share/dbus-1/system-services
-DDBUS_SYSTEM_SERVICE_DIR=$(CURDIR)/debian/qlscribe/usr/share/dbus-1/services
build: build-stamp
+1 -1
View File
@@ -22,7 +22,7 @@ FIND_PACKAGE( Dbus32 REQUIRED )
FIND_PACKAGE( LightScribe REQUIRED )
SET( LSCRIBED_CONF_FILE ${CMAKE_CURRENT_BINARY_DIR}/lightscribe.conf )
SET( LSCRIBED_SERVICE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${QLSCRIBE_DBUS_SERVICE}.printManager.service )
SET( LSCRIBED_SERVICE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${QLSCRIBE_DBUS_SERVICE}.Manager.service )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/lscribed.h.in ${CMAKE_CURRENT_BINARY_DIR}/lscribed.h @ONLY )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/lightscribe.conf.in ${LSCRIBED_CONF_FILE} @ONLY )
-1
View File
@@ -22,7 +22,6 @@
#define DBUSCPP_H
#include <dbus/dbus.h>
#include <stdint.h>
#include <string>
#include <map>
+1 -1
View File
@@ -45,7 +45,7 @@ DBusHandlerResult IntrospectHandler::processMessage( const Message &msg )
std::string( DBusManagerPath + pathlen, sublen )
+ "\"/>";
} else
introspect += "<node name=\"printManager\"/><node name=\"drives\"/>";
introspect += "<node name=\"Manager\"/><node name=\"drives\"/>";
}
introspect += "</node>";
+5 -2
View File
@@ -7,12 +7,15 @@
<!-- Only root can own the service -->
<policy user="root">
<allow own="@QLSCRIBE_DBUS_MANAGER_SERVICE@"/>
<allow send_interface="@QLSCRIBE_DBUS_MANAGER_SERVICE@"/>
<allow send_interface="@QLSCRIBE_DBUS_DRIVES_SERVICE@"/>
</policy>
<!-- Allow anyone to invoke methods on the interfaces -->
<policy context="default">
<allow send_destination="@QLSCRIBE_DBUS_MANAGER_SERVICE@"/>
<allow send_destination="@QLSCRIBE_DBUS_DRIVES_SERVICE@"/>
<allow send_interface="@QLSCRIBE_DBUS_MANAGER_SERVICE@"/>
<allow send_interface="@QLSCRIBE_DBUS_DRIVES_SERVICE@"/>
<allow receive_interface="@QLSCRIBE_DBUS_DRIVES_SERVICE@"/>
</policy>
</busconfig>
+2 -2
View File
@@ -25,14 +25,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 qconsoleprintprogress.cpp
qdialogsettings.cpp previewinjector.cpp )
qdialogsettings.cpp )
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui
qdialogprint.ui qdialogprogress.ui qdialogcdproperties.ui qdialogsettings.ui )
SET( QLSCRIBE_MOC_HDRS mainwindow.h qcdscene.h qdialogpixmap.h qdialogroundtext.h
qdialogtext.h qlightscribe.h qdialogprint.h qdialogprogress.h
qdialogcdproperties.h qconsoleprintprogress.h qdialogsettings.h previewinjector.h )
qdialogcdproperties.h qconsoleprintprogress.h qdialogsettings.h )
ADD_DEFINITIONS( -Wall )
+18 -126
View File
@@ -28,7 +28,6 @@
#include "qdialogprogress.h"
#include "qdialogcdproperties.h"
#include "qdialogsettings.h"
#include "previewinjector.h"
#include <QMenuBar>
#include <QStatusBar>
@@ -41,9 +40,6 @@
#include <QCloseEvent>
#include <QApplication>
#include <QClipboard>
#include <QSettings>
#include <QImageReader>
#include <QPicture>
MainWindow::MainWindow( bool enablePrint )
@@ -177,13 +173,6 @@ MainWindow::MainWindow( bool enablePrint )
this, SLOT(updateMenu()) );
updateMenu();
QSettings settings;
settings.beginGroup( "MainWindow");
resize( settings.value( "size", QSize(800, 400) ).toSize() );
move( settings.value( "pos", QPoint(200, 200) ).toPoint() );
settings.endGroup();
}
MainWindow::~MainWindow()
@@ -201,8 +190,6 @@ void MainWindow::open( const QStringList &files )
delete newView;
continue;
}
connect( scene, SIGNAL(selectionChanged()), this, SLOT(updateMenu()) );
connect( scene, SIGNAL(changed()), this, SLOT(updateMenu()) );
QMdiSubWindow *subWindow = m_mdiArea->addSubWindow( newView );
subWindow->show();
@@ -268,13 +255,6 @@ bool MainWindow::saveScene( QCDScene *scene )
return;
}
}
QSettings settings;
settings.beginGroup( "MainWindow" );
settings.setValue( "size", size());
settings.setValue( "pos", pos());
settings.endGroup();
event->accept();
}
@@ -325,29 +305,19 @@ void MainWindow::onMenuInsert( int id )
return;
}
cdscene->addItem( item, true );
item->setFlag( QGraphicsItem::ItemIsMovable, true );
item->setFlag( QGraphicsItem::ItemIsSelectable, true );
cdscene->addItem( item );
cdscene->setChanged();
}
void MainWindow::onMenuOpen()
{
QString filter( tr("qlscribe document (*.qlx);;Images ( ") );
QList<QByteArray> list = QImageReader::supportedImageFormats();
foreach( QByteArray arr, list ) {
filter += QString( "*." ) + arr.data() + " ";
}
filter += tr( ");;All Files (*)" );
QFileDialog fd( this, "Open:", QString(), filter );
bool injectPreview = QSettings().value( cfgInjectPreview, true ).toBool();
PreviewInjector pj( injectPreview ? &fd : 0 );
fd.setFileMode( QFileDialog::ExistingFile );
if( fd.exec() != QDialog::Accepted )
return;
QString fileName = fd.selectedFiles().value(0);
QString fileName = QFileDialog::getOpenFileName( this,
tr( "Open:" ),
QString(),
tr("qlscribe document (*.qlx)") );
if( fileName.isNull() )
return;
@@ -387,24 +357,6 @@ void MainWindow::onMenuProperties()
QDialogCDProperties::exec( this, scene );
}
namespace {
const int bigImageSize = 1600;
}
inline
void drawCircle( QPainter &painter, double radi )
{
const int half = bigImageSize / 2;
painter.drawEllipse( QRectF( half - radi, half - radi, radi * 2, radi * 2 ) );
}
inline
void drawCircle( QPainterPath &path, double radi )
{
const int half = bigImageSize / 2;
path.addEllipse( QRectF( half - radi, half - radi, radi * 2, radi * 2 ) );
}
void MainWindow::onMenuPrintPreview()
{
QCDScene *cdscene = getScene( m_mdiArea );
@@ -413,81 +365,21 @@ void MainWindow::onMenuPrintPreview()
PrintParameters params;
params.m_labelMode = cdscene->labelMode();
QPair< bool, QLightDrive * > bd = QDialogPrint::exec( this, params, true );
if( !bd.first )
QLightDrive *drive = QDialogPrint::exec( this, params );
if( !drive )
return;
if( !bd.second ) {
// software "rendering"
QPixmap image( bigImageSize, bigImageSize );
image.fill( 0xFFFFFFFF );
try {
QPixmap pixmap = drive->preview( params, cdscene, QSize( 400, 400 ) );
cdscene->clearSelection();
{
QPainter painter( &image );
QColor circleColor( 0xd8, 0xd8, 0xd8 );
painter.setPen( circleColor );
painter.setBrush( circleColor );
drawCircle( painter, bigImageSize / 2 );
cdscene->render( &painter, image.rect() );
QPainterPath p1;
p1.addRect( image.rect() );
{
QPainterPath p2;
drawCircle( p2, bigImageSize / 2 );
painter.setClipPath( p1.subtracted( p2 ) );
painter.fillRect( image.rect(), Qt::white );
painter.setClipPath( p1 );
}
painter.setBrush( circleColor );
if( params.m_labelMode == modeTitle ) {
// 3.22
QPainterPath p2;
drawCircle( p2, bigImageSize / 3.20 );
painter.setClipPath( p1.subtracted( p2 ) );
drawCircle( painter, bigImageSize / 2 );
// 3.74
painter.setClipPath( p1 );
drawCircle( painter, bigImageSize / 3.74 );
} else
if( params.m_labelMode == modeContent ) {
// 3.22
QPainterPath p2;
drawCircle( p2, bigImageSize / 3.20 );
painter.setClipPath( p1.subtracted( p2 ) );
drawCircle( painter, bigImageSize / 2 );
// 4.69
painter.setClipPath( p1 );
drawCircle( painter, bigImageSize / 4.69 );
}
painter.setBrush( Qt::white );
drawCircle( painter, bigImageSize / 4.93 );
}
QLabel *label = new QLabel;
label->setPixmap( image.scaled( QSize( 400, 400 ) ) );
label->setPixmap( pixmap );
QMdiSubWindow *subWindow = m_mdiArea->addSubWindow( label );
subWindow->setWindowTitle( "Software preview: " + cdscene->name() );
subWindow->setWindowTitle( "Preview: " + cdscene->name() );
subWindow->show();
} else {
try {
QPixmap pixmap = bd.second->preview( params, cdscene, QSize( 400, 400 ) );
QLabel *label = new QLabel;
label->setPixmap( pixmap );
QMdiSubWindow *subWindow = m_mdiArea->addSubWindow( label );
subWindow->setWindowTitle( "Preview: " + cdscene->name() );
subWindow->show();
}
catch( const QString &err ) {
QMessageBox::critical( this, tr( "Error on print preview" ), err );
}
}
catch( const QString &err ) {
QMessageBox::critical( this, tr( "Error on print preview" ), err );
}
}
@@ -545,7 +437,7 @@ void MainWindow::onMenuAbout()
QMessageBox::about( this,
tr( "About" ),
tr( "<h3>qlscribe - Qt lisghtScribe</h3>"
"<p>release 0.15 $Revision$</p>"
"<p>release 0.11 $Revision$</p>"
"<p>visit project at home page "
"<a href=\"http://qlscribe.sourceforge.net/\">qlscribe.sourceforge.net</a></p>" ) );
}
-61
View File
@@ -1,61 +0,0 @@
#include "previewinjector.h"
#include <QFileDialog>
#include <QLabel>
#include <QSplitter>
#include <QImageReader>
PreviewInjector::PreviewInjector( QFileDialog * dl ) :
m_label( 0 ),
m_size( 160, 120 )
{
if( !dl )
return;
QSplitter *sp = qFindChild<QSplitter *>( dl, "splitter" );
if( !sp )
return;
m_label = new QLabel;
m_label->resize( m_size );
sp->addWidget( m_label );
connect( dl, SIGNAL(currentChanged(QString)),SLOT(onSelectionChanged(QString)));
}
PreviewInjector::~PreviewInjector()
{
delete m_label;
}
void PreviewInjector::onSelectionChanged(QString file)
{
QImageReader reader( file );
if( !reader.canRead() ) {
m_label->setPixmap( QPixmap() );
return;
}
m_label->resize( m_size );
QSize toSize = m_size;
QSize sz = reader.size();
if( !sz.isNull() ) {
double r1 = m_label->size().width() / double( sz.width() );
double r2 = m_label->size().height() / double( sz.height() );
double ratio = std::max( r1, r2 );
if( ratio < 1.0 ) {
toSize.setWidth( sz.width() * ratio );
toSize.setHeight( sz.height() * ratio );
}
}
reader.setScaledSize( toSize );
QImage img = reader.read();
if( img.isNull() ) {
m_label->setPixmap( QPixmap() );
return;
}
m_label->setPixmap( QPixmap::fromImage( img ) );
}
-27
View File
@@ -1,27 +0,0 @@
#ifndef PREVIEWINJECTOR_HPP
#define PREVIEWINJECTOR_HPP
#include <QObject>
#include <QSize>
class QFileDialog;
class QLabel;
class PreviewInjector : public QObject {
Q_OBJECT
public:
PreviewInjector( QFileDialog * dl );
~PreviewInjector();
bool injected() const { return m_label; }
private slots:
void onSelectionChanged(QString );
private:
QLabel *m_label;
QSize m_size;
};
#endif // PREVIEWINJECTOR_HPP
+26 -82
View File
@@ -20,7 +20,6 @@
#include "qcdscene.h"
#include "qshapefactory.h"
#include "qlightpixmapitem.h"
#include <QMenu>
#include <QMessageBox>
@@ -35,7 +34,6 @@
#include <QApplication>
#include <QClipboard>
#include <QMimeData>
#include <QRegExp>
QCDScene::QCDScene( QObject * parent )
: QGraphicsScene( parent ),
@@ -83,70 +81,31 @@ void QCDScene::start( LabelMode mode )
bool QCDScene::load( const QString &fileName, QString *errMessage )
{
if( QRegExp( ".*.\\.qlx$", Qt::CaseInsensitive ).exactMatch( fileName ) ) {
QFile file( fileName );
if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
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 );
try {
read( reader );
}
catch( const QString &err ) {
if( errMessage )
*errMessage = err;
else
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot read file " ) + fileName + "\n" + err );
return false;
}
m_fileName = fileName;
m_saved = true;
setName();
pushUndo();
QList<QGraphicsItem *> list = items();
bool oldFormat = true;
foreach(QGraphicsItem *item, list ) {
if( item->zValue() != 0.0 ) {
oldFormat = false;
break;
}
}
if( oldFormat ) {
double z = 1.0;
foreach(QGraphicsItem *item, list ) {
item->setZValue( z );
z += 0.1;
}
}
return true;
}
QShapeFactory &sfactory = QShapeFactory::instance();
QLightPixmapItem *item =
static_cast<QLightPixmapItem *>(sfactory.create( QShapeControllerPixmap::Type ) );
addItem( item, true );
if( item->loadImage( fileName ) ) {
QSize size = item->pixmap().size();
item->setOffset( -QPointF( size.height(), size.width() ) / 2.0 );
item->setTransform( QTransform().scale( size.width() ? 120.0 / size.width() : 1.0,
size.height() ? 120.0 / size.height() : 1.0 ) );
setName();
pushUndo();
return true;
} else {
QFile file( fileName );
if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) {
if( errMessage )
*errMessage = "cannot load image";
*errMessage = "cannot open file for reading";
else
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot load image " ) +
fileName + "\n" );
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot open file for reading\n" ) + fileName );
return false;
}
return false;
QXmlStreamReader reader( &file );
try {
read( reader );
}
catch( const QString &err ) {
if( errMessage )
*errMessage = err;
else
QMessageBox::critical( 0, tr( "Error" ), tr( "Cannot read file " ) + fileName + "\n" + err );
return false;
}
m_fileName = fileName;
m_saved = true;
setName();
pushUndo();
return true;
}
@@ -278,22 +237,8 @@ void QCDScene::write( QXmlStreamWriter &writer )
writer.writeEndDocument();
}
void QCDScene::addItem( QGraphicsItem *item, bool top )
{
if( top ) {
double topZ = 1.0;
QList<QGraphicsItem *> list = items();
foreach(QGraphicsItem *item, list ) {
if( item->zValue() >= topZ )
topZ = item->zValue() + 0.1;
}
item->setZValue( topZ );
}
QGraphicsScene::addItem( item );
}
bool QCDScene::readItem( QXmlStreamReader &reader, bool top )
bool QCDScene::readItem( QXmlStreamReader &reader )
{
QShapeFactory &sfactory = QShapeFactory::instance();
@@ -310,7 +255,7 @@ bool QCDScene::readItem( QXmlStreamReader &reader, bool top )
if( item ) {
item->setFlag( QGraphicsItem::ItemIsMovable, true );
item->setFlag( QGraphicsItem::ItemIsSelectable, true );
addItem( item, top );
addItem( item );
return true;
}
return false;
@@ -339,7 +284,7 @@ void QCDScene::read( QXmlStreamReader &reader )
}
if( elementName == "item" ) {
readItem( reader, false );
readItem( reader );
} else
throw QString( "QCDScene: unknown element \"" ) + elementName + "\"";
}
@@ -397,7 +342,7 @@ void QCDScene::getItemFromClipboard()
QString elementName = reader.name().toString();
if( elementName == "item" ) {
if( readItem( reader, true ) )
if( readItem( reader ) )
setChanged();
}
}
@@ -520,4 +465,3 @@ void QCDScene::unredo( bool undo )
}
setChanged( false );
}
+1 -2
View File
@@ -60,7 +60,6 @@ public:
void putItemToClipboard( bool move );
void getItemFromClipboard();
void addItem( QGraphicsItem *item, bool top );
void updateTitles() const;
void redrawViews() const;
@@ -83,7 +82,7 @@ private slots:
private:
void write( QXmlStreamWriter &writer );
bool readItem( QXmlStreamReader &reader, bool top );
bool readItem( QXmlStreamReader &reader );
void read( QXmlStreamReader &reader );
void sendItemTo( bool front );
void pushUndo();
+2 -3
View File
@@ -147,19 +147,18 @@ void QCDView::drawForeground ( QPainter * painter, const QRectF & rect )
m_labelMode = cdscene->labelMode();
*m_mask = QPixmap( frameSize() );
QRectF rectf( QPointF( -frameSize().width(), -frameSize().height() ), frameSize() * 2 );
{
QPainter paint( m_mask );
paint.setWorldTransform( painter->transform() );
drawCD( &paint, rectf, false );
drawCD( &paint, rect, false );
}
{
QPixmap alpha( frameSize() );
QPainter paint( &alpha );
paint.setWorldTransform( painter->transform() );
drawCD( &paint, rectf, true );
drawCD( &paint, rect, true );
m_mask->setAlphaChannel( alpha );
}
+3 -16
View File
@@ -22,12 +22,10 @@
#include "ui_qdialogpixmap.h"
#include "qlightpixmapitem.h"
#include "qcdscene.h"
#include "previewinjector.h"
#include <QImageReader>
#include <QFileDialog>
#include <QMessageBox>
#include <QSettings>
QDialogPixmap::QDialogPixmap(QWidget *parent) :
QItemDialog( parent ),
@@ -70,7 +68,7 @@ bool QDialogPixmap::exec( QGraphicsItem *graphicsItem )
m_item->imageName( item->imageName() );
m_item->setTransform( item->transform() );
scene.addItem( m_item, true );
scene.addItem( m_item );
m_ui->spinX->setValue( m_item->pos().x() );
m_ui->spinY->setValue( m_item->pos().y() );
@@ -120,19 +118,8 @@ void QDialogPixmap::onLoadImage()
foreach( QByteArray arr, list ) {
filter += QString( "*." ) + arr.data() + " ";
}
filter += tr( ");;All Files (*.*)" );
QFileDialog fd( this, "Load image:", QString(), filter );
fd.setOption( QFileDialog::DontUseNativeDialog ); // for testing
bool injectPreview = QSettings().value( cfgInjectPreview, true ).toBool();
PreviewInjector pj( injectPreview ? &fd : 0 );
fd.setFileMode( QFileDialog::ExistingFile );
if( fd.exec() != QDialog::Accepted )
return;
QString fileName = fd.selectedFiles().value(0);
filter += tr( ")\nAll Files (*)" );
QString fileName = QFileDialog::getOpenFileName( this, "Load image:", QString(), filter );
if( fileName.isNull() )
return;
+5 -14
View File
@@ -46,14 +46,12 @@ void QDialogPrint::changeEvent(QEvent *e)
}
}
QPair<bool, QLightDrive *> QDialogPrint::exec( QWidget *parent, PrintParameters &params, bool preview )
QLightDrive *QDialogPrint::exec( QWidget *parent, PrintParameters &params )
{
QPair<bool, QLightDrive *> rez( false, 0 );
QList<QLightDrive *> drives = QLightScribe::instance()->getDrives();
if( !preview && drives.isEmpty() ) {
if( drives.isEmpty() ) {
QMessageBox::critical( parent, tr( "Error" ), tr( "Cannot find any lightScribe drive" ) );
return rez;
return 0;
}
QDialogPrint dialog( parent );
switch( params.m_labelMode ) {
@@ -66,11 +64,8 @@ QPair<bool, QLightDrive *> QDialogPrint::exec( QWidget *parent, PrintParameters
foreach( QLightDrive *drv, drives ) {
dialog.m_ui->comboDrive->insertItem( index++, drv->displayName() );
}
if( preview )
dialog.m_ui->comboDrive->insertItem( index++, tr( "Software renderer" ) );
if( dialog.QDialog::exec() == Rejected )
return rez;
return 0;
params = PrintParameters(); // reset to default
@@ -92,9 +87,5 @@ QPair<bool, QLightDrive *> QDialogPrint::exec( QWidget *parent, PrintParameters
if( dialog.m_ui->radioMediaGeneric->isChecked() )
params.m_mediaOptimizationLevel = mediaGeneric;
rez.first = true;
if( dialog.m_ui->comboDrive->currentIndex() < drives.size() )
rez.second = drives.at( dialog.m_ui->comboDrive->currentIndex() );
return rez;
return drives.at( dialog.m_ui->comboDrive->currentIndex() );
}
+1 -1
View File
@@ -33,7 +33,7 @@ class QDialogPrint : public QDialog {
Q_OBJECT
Q_DISABLE_COPY(QDialogPrint)
public:
static QPair<bool, QLightDrive *> exec( QWidget *parent, PrintParameters &params, bool preview );
static QLightDrive *exec( QWidget *parent, PrintParameters &params );
protected:
explicit QDialogPrint(QWidget *parent = 0);
+1 -1
View File
@@ -65,7 +65,7 @@ bool QDialogProgress::exec( QWidget *parent, QCDScene *scene )
{
PrintParameters params;
params.m_labelMode = scene->labelMode();
QLightDrive *drive = QDialogPrint::exec( parent, params, false ).second;
QLightDrive *drive = QDialogPrint::exec( parent, params );
if( !drive )
return false;
+1 -3
View File
@@ -22,7 +22,6 @@
#include "ui_qdialogroundtext.h"
#include "qlightroundtextitem.h"
#include "qcdscene.h"
#include "qdialogsettings.h"
#include <QFontDialog>
#include <QColorDialog>
@@ -73,7 +72,7 @@ bool QDialogRoundText::exec( QGraphicsItem *graphicsItem )
m_item->setAlignment( item->alignment() );
m_item->setOutside( item->outside() );
scene.addItem( m_item, true );
scene.addItem( m_item );
m_ui->spinX->setValue( m_item->pos().x() );
m_ui->spinY->setValue( m_item->pos().y() );
@@ -133,7 +132,6 @@ void QDialogRoundText::onFont()
//font.setPointSizeF( font.pointSizeF() / 2.0 );
if( ok ) {
m_item->setFont( font );
QDialogSettings::setLastUsedFont( font );
fontChanged();
}
}
-2
View File
@@ -60,13 +60,11 @@ bool QDialogSettings::exec( QWidget *parent )
dialog.m_font = sts.value( cfgDefaultFont ).value<QFont>();
dialog.m_ui->fontName->setCurrentFont( dialog.m_font );
dialog.m_ui->chkEject->setChecked( sts.value( cfgEjectAfterFinish, false ).toBool() );
dialog.m_ui->chkPreview->setChecked( sts.value( cfgInjectPreview, true ).toBool() );
if( dialog.QDialog::exec() == Rejected ) return false;
sts.setValue( cfgDefaultFont, dialog.m_font );
sts.setValue( cfgEjectAfterFinish, dialog.m_ui->chkEject->isChecked() );
sts.setValue( cfgInjectPreview, dialog.m_ui->chkPreview->isChecked() );
return true;
}
+38 -46
View File
@@ -1,49 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<ui version="4.0" >
<class>QDialogSettings</class>
<widget class="QDialog" name="QDialogSettings">
<property name="windowModality">
<widget class="QDialog" name="QDialogSettings" >
<property name="windowModality" >
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>170</height>
<width>305</width>
<height>156</height>
</rect>
</property>
<property name="windowTitle">
<property name="windowTitle" >
<string>Settings</string>
</property>
<property name="modal">
<property name="modal" >
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Default font:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="fontName">
<property name="enabled">
<item row="0" column="1" >
<widget class="QFontComboBox" name="fontName" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="editable">
<property name="editable" >
<bool>false</bool>
</property>
</widget>
@@ -51,13 +50,13 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@@ -66,15 +65,15 @@
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnFont">
<property name="text">
<widget class="QPushButton" name="btnFont" >
<property name="text" >
<string>Font...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnLastUsedFont">
<property name="text">
<widget class="QPushButton" name="btnLastUsedFont" >
<property name="text" >
<string>Last used</string>
</property>
</widget>
@@ -82,28 +81,21 @@
</layout>
</item>
<item>
<widget class="QCheckBox" name="chkEject">
<property name="text">
<widget class="QCheckBox" name="chkEject" >
<property name="text" >
<string>Eject tray after finish</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkPreview">
<property name="text">
<string>Enable image preview in open dialog</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
@@ -118,11 +110,11 @@
<receiver>QDialogSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
@@ -134,11 +126,11 @@
<receiver>QDialogSettings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
+10 -25
View File
@@ -22,8 +22,8 @@
#include "ui_qdialogtext.h"
#include "qcdscene.h"
#include "qdialogsettings.h"
#include "qlighttextitem.h"
#include <QGraphicsSimpleTextItem>
#include <QFontDialog>
#include <QColorDialog>
@@ -55,48 +55,39 @@ void QDialogText::changeEvent(QEvent *e)
bool QDialogText::exec( QGraphicsItem *graphicsItem )
{
QLightTextItem *item = dynamic_cast< QLightTextItem * >( graphicsItem );
QGraphicsSimpleTextItem *item = dynamic_cast< QGraphicsSimpleTextItem * >( graphicsItem );
if( !item )
return false;
QCDScene scene;
m_ui->cdView->setScene( &scene );
m_item = new QLightTextItem;
m_item = new QGraphicsSimpleTextItem;
m_item->setPos( item->pos() );
m_item->setText( item->text() );
m_item->setFont( item->font() );
m_item->setColor( item->color() );
m_item->setBrush( item->brush() );
m_item->setTransform( item->transform() );
m_item->setAlignment( item->alignment() );
scene.addItem( m_item, true );
scene.addItem( m_item );
m_ui->spinX->setValue( m_item->pos().x() );
m_ui->spinY->setValue( m_item->pos().y() );
m_ui->textEdit->setPlainText( m_item->text() );
int index = 0;
if( m_item->alignment() == Qt::AlignRight ) index = 2;
else if( m_item->alignment() == Qt::AlignCenter ) index = 1;
m_ui->comboAlignment->setCurrentIndex( index );
colorChanged();
fontChanged();
connect( m_ui->textEdit, SIGNAL(textChanged()), this, SLOT(textChanged()) );
connect( m_ui->spinX, SIGNAL(valueChanged(double)), this, SLOT(posChanged()) );
connect( m_ui->spinY, SIGNAL(valueChanged(double)), this, SLOT(posChanged()) );
connect( m_ui->comboAlignment, SIGNAL(currentIndexChanged(int)),this, SLOT(alignChanged()) );
if( QDialog::exec() == Rejected ) return false;
item->setPos( m_item->pos() );
item->setText( m_item->text() );
item->setFont( m_item->font() );
item->setColor( m_item->color() );
item->setAlignment( m_item->alignment() );
item->setBrush( m_item->brush() );
return true;
}
@@ -114,11 +105,11 @@ void QDialogText::onFont()
void QDialogText::onColor()
{
QColor color = QColorDialog::getColor( m_item->color(), this );
QColor color = QColorDialog::getColor( m_item->brush().color(), this );
if( color.isValid() ){
m_item->setColor( color );
m_item->setBrush( color );
colorChanged();
}
}
}
void QDialogText::fontChanged()
@@ -129,7 +120,7 @@ void QDialogText::fontChanged()
void QDialogText::colorChanged()
{
QPixmap pixmap( m_ui->colorWidget->size() );
pixmap.fill( m_item->color() );
pixmap.fill( m_item->brush().color() );
m_ui->colorWidget->setPixmap( pixmap );
}
@@ -143,9 +134,3 @@ void QDialogText::posChanged()
m_item->setPos( m_ui->spinX->value(), m_ui->spinY->value() );
}
void QDialogText::alignChanged()
{
Qt::Alignment align[] = { Qt::AlignLeft, Qt::AlignCenter, Qt::AlignRight };
m_item->setAlignment( align[ m_ui->comboAlignment->currentIndex() ] );
}
+4 -5
View File
@@ -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 QDIALOGTEXT_H
#define QDIALOGTEXT_H
@@ -27,7 +27,7 @@ namespace Ui {
class QDialogText;
}
class QLightTextItem;
class QGraphicsSimpleTextItem;
class QDialogText : public QItemDialog {
Q_OBJECT
@@ -48,11 +48,10 @@ private slots:
void fontChanged();
void colorChanged();
void posChanged();
void alignChanged();
private:
Ui::QDialogText *m_ui;
QLightTextItem *m_item;
Ui::QDialogText *m_ui;
QGraphicsSimpleTextItem *m_item;
};
#endif // QDIALOGTEXT_H
+92 -127
View File
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<ui version="4.0" >
<class>QDialogText</class>
<widget class="QDialog" name="QDialogText">
<property name="enabled">
<widget class="QDialog" name="QDialogText" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="geometry">
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
@@ -13,70 +12,70 @@
<height>627</height>
</rect>
</property>
<property name="windowTitle">
<property name="windowTitle" >
<string>Text properties</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<property name="lineWidth" >
<number>3</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="sizeConstraint">
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="sizeConstraint" >
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="bottomMargin">
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>X:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="spinX">
<property name="decimals">
<item row="0" column="1" >
<widget class="QDoubleSpinBox" name="spinX" >
<property name="decimals" >
<number>1</number>
</property>
<property name="minimum">
<property name="minimum" >
<double>-61.000000000000000</double>
</property>
<property name="maximum">
<property name="maximum" >
<double>61.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Y:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="spinY">
<property name="decimals">
<item row="1" column="1" >
<widget class="QDoubleSpinBox" name="spinY" >
<property name="decimals" >
<number>1</number>
</property>
<property name="minimum">
<property name="minimum" >
<double>-61.000000000000000</double>
</property>
<property name="maximum">
<property name="maximum" >
<double>61.000000000000000</double>
</property>
</widget>
@@ -84,11 +83,11 @@
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint" stdset="0" >
<size>
<width>13</width>
<height>20</height>
@@ -97,104 +96,70 @@
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<layout class="QFormLayout" name="formLayout_3" >
<item row="0" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Font:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QFontComboBox" name="fontName">
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<item row="1" column="0" >
<widget class="QLabel" name="label_6" >
<property name="text" >
<string>Color:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="colorWidget">
<property name="minimumSize">
<item row="0" column="1" >
<widget class="QFontComboBox" name="fontName" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="editable" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="colorWidget" >
<property name="minimumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<property name="maximumSize" >
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="baseSize">
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="text">
</property>
<property name="text" >
<string/>
</property>
<property name="textFormat">
<property name="textFormat" >
<enum>Qt::PlainText</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboAlignment" >
<property name="currentIndex" >
<number>0</number>
</property>
<item>
<property name="text" >
<string>Left</string>
</property>
</item>
<item>
<property name="text" >
<string>Center</string>
</property>
</item>
<item>
<property name="text" >
<string>Right</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Alignment:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<property name="sizeHint" stdset="0" >
<size>
<width>17</width>
<height>20</height>
@@ -203,20 +168,20 @@
</spacer>
</item>
<item>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<layout class="QFormLayout" name="formLayout_4" >
<property name="fieldGrowthPolicy" >
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QPushButton" name="btnColor">
<property name="text">
<item row="1" column="0" >
<widget class="QPushButton" name="btnColor" >
<property name="text" >
<string>Color...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="btnFont">
<property name="text">
<item row="0" column="0" >
<widget class="QPushButton" name="btnFont" >
<property name="text" >
<string>Font...</string>
</property>
</widget>
@@ -226,26 +191,26 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_2" >
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Text</string>
</property>
<property name="alignment">
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="textEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<widget class="QPlainTextEdit" name="textEdit" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>50</height>
@@ -256,20 +221,20 @@
</layout>
</item>
<item>
<widget class="QCDView" name="cdView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<widget class="QCDView" name="cdView" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="interactive">
<property name="interactive" >
<bool>false</bool>
</property>
</widget>
@@ -278,11 +243,11 @@
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
@@ -313,11 +278,11 @@
<receiver>QDialogText</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<hint type="sourcelabel" >
<x>258</x>
<y>582</y>
</hint>
<hint type="destinationlabel">
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
@@ -329,11 +294,11 @@
<receiver>QDialogText</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<hint type="sourcelabel" >
<x>326</x>
<y>582</y>
</hint>
<hint type="destinationlabel">
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
-11
View File
@@ -29,17 +29,6 @@ QLightPixmapItem::QLightPixmapItem()
{
}
bool QLightPixmapItem::loadImage( const QString &name )
{
QPixmap pixmap( name );
if( pixmap.isNull() )
return false;
m_imageName = name;
setPixmap( pixmap );
return true;
}
QVariant QLightPixmapItem::itemChange( GraphicsItemChange change, const QVariant & value )
{
if( scene() && change == ItemPositionHasChanged )
+2 -2
View File
@@ -25,11 +25,11 @@
#include "qshapefactory.h"
class QLightPixmapItem : public QGraphicsPixmapItem {
class QLightPixmapItem : public QGraphicsPixmapItem
{
public:
QLightPixmapItem();
bool loadImage( const QString &name );
void imageName( const QString &name ) { m_imageName = name; }
const QString &imageName() const { return m_imageName; }
+5 -30
View File
@@ -29,7 +29,6 @@
#include <QMessageBox>
#include <QXmlStreamWriter>
#include <QTextLayout>
#include <QGraphicsSceneMouseEvent>
#include <math.h>
@@ -227,42 +226,18 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
painter->restore();
if (option->state & QStyle::State_Selected) {
painter->setPen( QPen( option->palette.windowText(), 0, Qt::DashLine ) );
painter->setBrush( Qt::NoBrush );
painter->setBrush(Qt::NoBrush);
painter->drawPath( shape() );
}
}
inline
double distance( const QPointF &p1, const QPointF &p2 )
QVariant QLightRoundTextItem::itemChange( GraphicsItemChange change, const QVariant & value )
{
QPointF d = p1 - p2;
return sqrt( d.x() * d.x() + d.y() * d.y() );
}
inline
double angle( const QPointF &p1, const QPointF &p2 )
{
QPointF d = p1 - p2;
return atan2( d.y(), d.x() ) * 180.0 / 3.14159;
}
void QLightRoundTextItem::mouseMoveEvent( QGraphicsSceneMouseEvent *event )
{
if( event->buttons() & Qt::LeftButton ) {
double dradi = distance( scenePos(), event->lastScenePos() ) - distance( scenePos(), event->scenePos() );
double dangle = ::angle( scenePos(), event->lastScenePos() ) - ::angle( scenePos(), event->scenePos() );
prepareGeometryChange();
m_radius -= dradi;
m_angle -= dangle;
if( m_angle > 360.0 ) m_angle -= 360.0;
if( m_angle < 0.0 ) m_angle += 360.0;
if( scene() && change == ItemPositionHasChanged )
static_cast<QCDScene *>( scene() )->itemMoved();
} else
event->ignore();
}
return value;
}
RegisterController< QShapeControllerRoundText > regControllerRoundText;
+2 -2
View File
@@ -28,7 +28,7 @@
class QLightRoundTextItem : public QAbstractGraphicsShapeItem {
public:
enum { Type = UserType + 1 };
enum { Type = UserType + 1 };
QLightRoundTextItem( QGraphicsItem * parent = 0 );
@@ -55,7 +55,7 @@ public:
virtual int type() const { return Type; }
protected:
virtual void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant & value );
private:
QFont m_font;
+5 -64
View File
@@ -25,7 +25,6 @@
#include <QXmlStreamWriter>
#include <QXmlStreamReader>
#include <QTextDocument>
QLightTextItem::QLightTextItem()
@@ -40,58 +39,6 @@ QVariant QLightTextItem::itemChange( GraphicsItemChange change, const QVariant &
return value;
}
QString QLightTextItem::text() const
{
return QGraphicsSimpleTextItem::text();
}
QColor QLightTextItem::color() const
{
return this->brush().color();
}
Qt::Alignment QLightTextItem::alignment() const
{
return m_alignment;
}
void QLightTextItem::setText( const QString &txt )
{
QGraphicsSimpleTextItem::setText( txt );
updateTrans();
}
void QLightTextItem::setFont( const QFont &font )
{
QGraphicsSimpleTextItem::setFont( font );
updateTrans();
}
void QLightTextItem::setColor( const QColor &color )
{
this->setBrush( color );
}
void QLightTextItem::setAlignment( Qt::Alignment align )
{
m_alignment = align;
updateTrans();
}
void QLightTextItem::updateTrans()
{
double size = this->boundingRect().width();
QTransform trans;
trans.scale( 0.5, 0.5 );
switch( m_alignment ) {
case Qt::AlignRight : trans.translate( -size, 0 ); break;
case Qt::AlignCenter : trans.translate( -size / 2.0, 0 ); break;
}
this->setTransform( trans );
}
RegisterController< QShapeControllerText > regControllerText;
@@ -122,21 +69,20 @@ QItemDialog *QShapeControllerText::createDialog( QWidget *parent ) const
void QShapeControllerText::writeData( QXmlStreamWriter &writer, const QGraphicsItem *item ) const
{
const QLightTextItem *textItem = static_cast< const QLightTextItem * >( item );
const QGraphicsSimpleTextItem *textItem = static_cast< const QGraphicsSimpleTextItem * >( 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( "font", textItem->font().toString() );
writer.writeTextElement( "color", textItem->color().name() );
writer.writeTextElement( "color", textItem->brush().color().name() );
writer.writeTextElement( "text", textItem->text() );
writer.writeTextElement( "alignment", QString::number( textItem->alignment() ) );
}
void QShapeControllerText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
{
QLightTextItem *textItem = static_cast< QLightTextItem * >( item );
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
bool placeHolder = textItem->text().left( 1 ) == "?" && textItem->text().right( 1 ) == "?";
@@ -156,7 +102,7 @@ void QShapeControllerText::readData( const QString &element,
const QString &data,
QGraphicsItem *item ) const
{
QLightTextItem *textItem = static_cast< QLightTextItem * >( item );
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
if( element == "pos" ) {
textItem->setPos( attrs.value( "x" ).toString().toDouble(),
@@ -173,7 +119,7 @@ void QShapeControllerText::readData( const QString &element,
}
if( element == "color" ) {
textItem->setColor( QColor( data ) );
textItem->setBrush( QColor( data ) );
return;
}
@@ -181,9 +127,4 @@ void QShapeControllerText::readData( const QString &element,
textItem->setText( data );
return;
}
if( element == "alignment" ) {
textItem->setAlignment( Qt::Alignment( data.toInt() ) );
return;
}
}
-13
View File
@@ -30,22 +30,9 @@ class QLightTextItem : public QGraphicsSimpleTextItem
public:
QLightTextItem();
QString text() const;
Qt::Alignment alignment() const;
QColor color() const;
void setText( const QString &txt );
void setColor( const QColor &color );
void setFont( const QFont &font );
void setAlignment( Qt::Alignment align );
protected:
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant & value );
private:
void updateTrans();
Qt::Alignment m_alignment;
};
class QShapeControllerText : public QShapeController {
-1
View File
@@ -67,7 +67,6 @@ const char * const DBusManagerPath = "@QLSCRIBE_DBUS_MANAGER_PATH@";
// config keys
const char * const cfgDefaultFont = "DefaultTextFont";
const char * const cfgEjectAfterFinish = "EjectAfterFinish";
const char * const cfgInjectPreview = "InjectPreview";
#endif // QLSCRIBE_H
+2 -4
View File
@@ -21,8 +21,7 @@ SOURCES += main.cpp \
qlightpixmapitem.cpp \
qdialogcdproperties.cpp \
qconsoleprintprogress.cpp \
qdialogsettings.cpp \
previewinjector.cpp
qdialogsettings.cpp
QMAKE_LIBS += -llightscribe
HEADERS += mainwindow.h \
qlightroundtextitem.h \
@@ -39,8 +38,7 @@ HEADERS += mainwindow.h \
qlightpixmapitem.h \
qdialogcdproperties.h \
qconsoleprintprogress.h \
qdialogsettings.h \
previewinjector.h
qdialogsettings.h
FORMS += qdialogtext.ui \
qdialogroundtext.ui \
qdialogpixmap.ui \
+1 -7
View File
@@ -118,13 +118,7 @@ QString QShapeFactory::name( int type ) const
QGraphicsItem *QShapeFactory::create( int type ) const
{
QShapeController *ctrl = getController( type );
if( !ctrl ) return 0;
QGraphicsItem *item = ctrl->create();
if( item ) {
item->setFlag( QGraphicsItem::ItemIsMovable, true );
item->setFlag( QGraphicsItem::ItemIsSelectable, true );
}
return item;
return ctrl ? ctrl->create() : 0;
}
bool QShapeFactory::edit( QGraphicsItem *item, QWidget *parent ) const