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
29 changed files with 81 additions and 310 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 )
-16
View File
@@ -1,21 +1,5 @@
NEWS - list of user-visible changes between releases of qlscribe
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 -4
View File
@@ -1,7 +1,4 @@
qlscribe (0.14-0ubuntu1) unstable; urgency=low
* 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>
+14 -116
View File
@@ -40,9 +40,6 @@
#include <QCloseEvent>
#include <QApplication>
#include <QClipboard>
#include <QSettings>
#include <QImageReader>
#include <QPicture>
MainWindow::MainWindow( bool enablePrint )
@@ -176,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()
@@ -200,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();
@@ -267,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();
}
@@ -324,23 +305,18 @@ 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)\nImages ( ") );
QList<QByteArray> list = QImageReader::supportedImageFormats();
foreach( QByteArray arr, list ) {
filter += QString( "*." ) + arr.data() + " ";
}
filter += tr( ")\nAll Files (*)" );
QString fileName = QFileDialog::getOpenFileName( this,
tr( "Open:" ),
QString(),
filter );
tr("qlscribe document (*.qlx)") );
if( fileName.isNull() )
return;
@@ -381,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 );
@@ -407,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 );
}
}
@@ -539,7 +437,7 @@ void MainWindow::onMenuAbout()
QMessageBox::about( this,
tr( "About" ),
tr( "<h3>qlscribe - Qt lisghtScribe</h3>"
"<p>release 0.14 $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>" ) );
}
+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 );
}
+1 -1
View File
@@ -68,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() );
+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();
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ bool QDialogText::exec( QGraphicsItem *graphicsItem )
m_item->setBrush( item->brush() );
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() );
-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; }
+4 -29
View File
@@ -29,7 +29,6 @@
#include <QMessageBox>
#include <QXmlStreamWriter>
#include <QTextLayout>
#include <QGraphicsSceneMouseEvent>
#include <math.h>
@@ -232,37 +231,13 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
}
}
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;
+1 -1
View File
@@ -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;
+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