|
From: <dom...@us...> - 2008-03-04 13:33:04
|
Revision: 32
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=32&view=rev
Author: domseichter
Date: 2008-03-04 05:33:09 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
A few fixes again, not very clean right now. But right now I am trying to get everything to compile as far as possible.
Modified Paths:
--------------
trunk/src/barcodecombo.cpp
trunk/src/barcodecombo.h
trunk/src/barcodegenerator.cpp
trunk/src/barcodeitem.cpp
trunk/src/barkode.cpp
trunk/src/barkode.h
trunk/src/barkodeengine.h
trunk/src/tcanvasitem.h
Modified: trunk/src/barcodecombo.cpp
===================================================================
--- trunk/src/barcodecombo.cpp 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barcodecombo.cpp 2008-03-04 13:33:09 UTC (rev 32)
@@ -101,7 +101,7 @@
{
}
-const char* BarcodeCombo::getEncodingType()
+const QString & BarcodeCombo::getEncodingType()
{
return Barkode::typeFromName( currentText() );
}
Modified: trunk/src/barcodecombo.h
===================================================================
--- trunk/src/barcodecombo.h 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barcodecombo.h 2008-03-04 13:33:09 UTC (rev 32)
@@ -61,7 +61,7 @@
BarcodeCombo(QWidget *parent=0);
~BarcodeCombo();
- const char* getEncodingType();
+ const QString & getEncodingType();
void setEncodingType( const QString & type );
};
Modified: trunk/src/barcodegenerator.cpp
===================================================================
--- trunk/src/barcodegenerator.cpp 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barcodegenerator.cpp 2008-03-04 13:33:09 UTC (rev 32)
@@ -172,7 +172,7 @@
if( d.isValid() )
return;
- QPrinter* printer = PrinterSettings::getInstance()->setupPrinter( "kbarcode", this );
+ QPrinter* printer = PrinterSettings::getInstance()->setupPrinter( KUrl("kfiledialog:///kbarcode"), this );
if( !printer )
return;
@@ -213,11 +213,7 @@
DocumentItemDrag* drag = new DocumentItemDrag();
drag->setDocumentItem( &list );
-#if QT_VERSION >= 0x030100
- kapp->clipboard()->setData( drag, QClipboard::Clipboard );
-#else
- kapp->clipboard()->setData( drag );
-#endif
+ kapp->clipboard()->setMimeData( drag, QClipboard::Clipboard );
}
#include "barcodegenerator.moc"
Modified: trunk/src/barcodeitem.cpp
===================================================================
--- trunk/src/barcodeitem.cpp 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barcodeitem.cpp 2008-03-04 13:33:09 UTC (rev 32)
@@ -156,37 +156,19 @@
void BarcodeItem::draw (QPainter* painter)
{
- if( DocumentItem::paintDevice() && DocumentItem::paintDevice()->isExtDev() )
+ painter->save();
+ drawBarcode( *painter, rect().x(), rect().y() );
+ painter->restore();
+
+ TCanvasItem* citem = canvasItem();
+ if( citem )
{
- painter->save();
-
- // FIXME: What's this?
- /*
- QPaintDeviceMetrics metrics( DocumentItem::paintDevice() );
- double scalex = (double)metrics.logicalDpiX() / (double)QPaintDevice::x11AppDpiX();
- double scaley = (double)metrics.logicalDpiY() / (double)QPaintDevice::x11AppDpiY();
- painter->scale( 1.0 / scalex, 1.0 / scaley );
- */
-
- //painter->drawPixmap( rect().x(), rect().y(), m_pixmap );
- drawBarcode( *painter, rect().x(), rect().y() );
- painter->restore();
+ citem->setSize( Barkode::size().width(), Barkode::size().height() );
}
- else
- {
- painter->save();
- drawBarcode( *painter, rect().x(), rect().y() );
- painter->restore();
+ // TODO: do a bitBlt when device is screen
+ //painter->drawPixmap( rect().x(), rect().y(), m_pixmap );
+ //bitBlt( painter->device(), rect().x(), rect().y(), &m_pixmap, 0, 0, rect().width(), rect().height(), Qt::CopyROP );
- TCanvasItem* citem = canvasItem();
- if( citem )
- {
- citem->setSize( Barkode::size().width(), Barkode::size().height() );
- }
- // TODO: do a bitBlt when device is screen
- //painter->drawPixmap( rect().x(), rect().y(), m_pixmap );
- //bitBlt( painter->device(), rect().x(), rect().y(), &m_pixmap, 0, 0, rect().width(), rect().height(), Qt::CopyROP );
- }
DocumentItem::drawBorder( painter );
}
Modified: trunk/src/barkode.cpp
===================================================================
--- trunk/src/barkode.cpp 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barkode.cpp 2008-03-04 13:33:09 UTC (rev 32)
@@ -603,7 +603,7 @@
return s_encoding;
}
-const char* Barkode::typeFromName( const QString & name )
+const QString & Barkode::typeFromName( const QString & name )
{
for( unsigned int i = 0; i < s_info.count(); i++ )
if( s_info[i].name == name )
@@ -612,7 +612,7 @@
return NULL;
}
-const char* Barkode::nameFromType( const QString & type )
+const QString & Barkode::nameFromType( const QString & type )
{
for( unsigned int i = 0; i < s_info.count(); i++ )
if( s_info[i].xml == type )
@@ -908,7 +908,7 @@
if( QFile::exists( rules ) )
path = rules;
else
- path = locate( "data", "kbarcode/rules.xml" );
+ path = KStandardDirs::locate( "data", "kbarcode/rules.xml" );
QFile xml( path );
QDomDocument doc;
@@ -920,7 +920,7 @@
if( !xml.open( QIODevice::ReadOnly ) )
{
- qDebug( "Cannot read validation rules from %s\n", path.toLatin1() );
+ qDebug( "Cannot read validation rules from %s\n", path.toLatin1().data() );
return;
}
Modified: trunk/src/barkode.h
===================================================================
--- trunk/src/barkode.h 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barkode.h 2008-03-04 13:33:09 UTC (rev 32)
@@ -188,11 +188,11 @@
/** Convert the uservisible encoding type @p name
* to the internal identifier
*/
- static const char* typeFromName( const QString & name );
+ static const QString & typeFromName( const QString & name );
/** Convert the internal identifier @p type
* to the user visible encoding name
*/
- static const char* nameFromType( const QString & type );
+ static const QString & nameFromType( const QString & type );
static QString* validatorFromType( const QString & type );
static QString* validatorNotFromType( const QString & type );
Modified: trunk/src/barkodeengine.h
===================================================================
--- trunk/src/barkodeengine.h 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/barkodeengine.h 2008-03-04 13:33:09 UTC (rev 32)
@@ -43,6 +43,8 @@
#include <qsize.h>
+class QPaintDevice;
+
/**
* Inherit from this class if you want to create a
* (barkode engine) for use with KBarcode.
Modified: trunk/src/tcanvasitem.h
===================================================================
--- trunk/src/tcanvasitem.h 2008-03-04 11:44:54 UTC (rev 31)
+++ trunk/src/tcanvasitem.h 2008-03-04 13:33:09 UTC (rev 32)
@@ -16,7 +16,7 @@
*
* The class is also ReferenceCounted!!!
*/
-class TCanvasItem : public QCanvasRectangle, public ReferenceCounted {
+class TCanvasItem : public Q3CanvasRectangle, public ReferenceCounted {
public:
TCanvasItem ( MyCanvasView* cv );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|