|
From: <vz...@us...> - 2008-03-04 14:08:15
|
Revision: 34
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=34&view=rev
Author: vzsolt
Date: 2008-03-04 06:08:19 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
One step at a time: I've updated AdvancedBarcodeDialog.
Modified Paths:
--------------
trunk/src/dialogs/barcodedialogs.cpp
trunk/src/dialogs/barcodedialogs.h
Modified: trunk/src/dialogs/barcodedialogs.cpp
===================================================================
--- trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 14:00:48 UTC (rev 33)
+++ trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 14:08:19 UTC (rev 34)
@@ -44,42 +44,53 @@
AdvancedBarcodeDialog::AdvancedBarcodeDialog( QString type, QWidget* parent )
- : KDialogBase( KDialogBase::Tabbed, i18n("Barcode Settings"),
- KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent)
+ : KPageDialog( parent )
+
{
+ setFaceType( KPageDialog::Tabbed );
+ setCaption( i18n("Barcode Settings") );
+ setButtons( KDialog::Ok | KDialog::Cancel );
+ setDefaultButton( KDialog::Ok );
+
list.setAutoDelete( false );
if( Barkode::hasFeature( type, PDF417BARCODE ) ) {
- KVBox* box = addVBoxPage( i18n("PDF417") );
+ KVBox* box = nev KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("PDF417") );
PDF417BarcodeDlg* dlg = new PDF417BarcodeDlg( box );
list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, DATAMATRIX ) ) {
- KVBox* box = addVBoxPage( i18n("DataMatrix") );
+ KVBox* box = new KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("DataMatrix") );
DataMatrixDlg* dlg = new DataMatrixDlg( box );
- list.append( (BarcodeDlgBase*)dlg );
+ list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, TBARCODEADV ) ) {
- KVBox* box = addVBoxPage( i18n("TBarcode") );
+ KVBox* box = new KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("TBarcode") );
TBarcodeDlg* dlg = new TBarcodeDlg( box );
- list.append( (BarcodeDlgBase*)dlg );
+ list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, PUREADV ) ) {
- KVBox* box = addVBoxPage( i18n("Barcode Writer in Pure Postscript") );
+ KVBox* box = new KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("Barcode Writer in Pure Postscript") );
PurePostscriptDlg* dlg = new PurePostscriptDlg( box );
- list.append( (BarcodeDlgBase*)dlg );
+ list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, COLORED ) ) {
- KVBox* box = addVBoxPage( i18n("Colors") );
+ KVBox* box = new KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("Colors") );
ColorDlg* dlg = new ColorDlg( box );
- list.append( (BarcodeDlgBase*)dlg );
+ list.append( (BarcodeDlgBase*)dlg );
}
- KVBox* box = addVBoxPage( i18n("Sequence") );
+ KVBox* box = new KVBox();
+ KPageWidgetItem* item = addPage( box, i18n("Sequence") );
SequenceDlg* dlg = new SequenceDlg( box );
list.append( (BarcodeDlgBase*)dlg );
}
Modified: trunk/src/dialogs/barcodedialogs.h
===================================================================
--- trunk/src/dialogs/barcodedialogs.h 2008-03-04 14:00:48 UTC (rev 33)
+++ trunk/src/dialogs/barcodedialogs.h 2008-03-04 14:08:19 UTC (rev 34)
@@ -56,7 +56,7 @@
*
* @author Dominik Seichter
*/
-class AdvancedBarcodeDialog : public KDialogBase {
+class AdvancedBarcodeDialog : public KPageDialog {
Q_OBJECT
public:
AdvancedBarcodeDialog( QString type, QWidget* parent = 0 );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 14:12:11
|
Revision: 35
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=35&view=rev
Author: vzsolt
Date: 2008-03-04 06:12:04 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
Oops, I missed the QPtrList. Fixed.
Modified Paths:
--------------
trunk/src/dialogs/barcodedialogs.cpp
trunk/src/dialogs/barcodedialogs.h
Modified: trunk/src/dialogs/barcodedialogs.cpp
===================================================================
--- trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 14:08:19 UTC (rev 34)
+++ trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 14:12:04 UTC (rev 35)
@@ -51,8 +51,6 @@
setCaption( i18n("Barcode Settings") );
setButtons( KDialog::Ok | KDialog::Cancel );
setDefaultButton( KDialog::Ok );
-
- list.setAutoDelete( false );
if( Barkode::hasFeature( type, PDF417BARCODE ) ) {
KVBox* box = nev KVBox();
Modified: trunk/src/dialogs/barcodedialogs.h
===================================================================
--- trunk/src/dialogs/barcodedialogs.h 2008-03-04 14:08:19 UTC (rev 34)
+++ trunk/src/dialogs/barcodedialogs.h 2008-03-04 14:12:04 UTC (rev 35)
@@ -19,10 +19,12 @@
#define BARCODEDIALOGS_H
#include <qmap.h>
-#include <q3ptrlist.h>
+#include <QList>
#include <qwidget.h>
#include <q3vbox.h>
#include <kdialog.h>
+#include <kpagedialog.h>
+#include <kpagewidgetmodel.h>
class Barkode;
class KColorButton;
@@ -66,7 +68,7 @@
void getData( Barkode* b );
private:
- QPtrList<BarcodeDlgBase> list;
+ QList<BarcodeDlgBase*> list;
};
/** A configuration widget for TBarcode settings.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 15:34:08
|
Revision: 36
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=36&view=rev
Author: vzsolt
Date: 2008-03-04 07:34:11 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
Updated TBarcodeDlg.
Changes:
- Removed the GroupBox, as with the tabs, the title was redundant.
- Removed two of the three VBox layouts, as they didn't do anything.
- Rewritten the checksum combo box.
Modified Paths:
--------------
trunk/src/dialogs/barcodedialogs.cpp
trunk/src/dialogs/barcodedialogs.h
Modified: trunk/src/dialogs/barcodedialogs.cpp
===================================================================
--- trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 14:12:04 UTC (rev 35)
+++ trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 15:34:11 UTC (rev 36)
@@ -53,43 +53,37 @@
setDefaultButton( KDialog::Ok );
if( Barkode::hasFeature( type, PDF417BARCODE ) ) {
- KVBox* box = nev KVBox();
- KPageWidgetItem* item = addPage( box, i18n("PDF417") );
- PDF417BarcodeDlg* dlg = new PDF417BarcodeDlg( box );
+ PDF417BarcodeDlg* dlg = new PDF417BarcodeDlg( this );
+ addPage( dlg, i18n("PDF417") );
list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, DATAMATRIX ) ) {
- KVBox* box = new KVBox();
- KPageWidgetItem* item = addPage( box, i18n("DataMatrix") );
- DataMatrixDlg* dlg = new DataMatrixDlg( box );
+ DataMatrixDlg* dlg = new DataMatrixDlg( this );
+ addPage( dlg, i18n("DataMatrix") );
list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, TBARCODEADV ) ) {
- KVBox* box = new KVBox();
- KPageWidgetItem* item = addPage( box, i18n("TBarcode") );
- TBarcodeDlg* dlg = new TBarcodeDlg( box );
+ TBarcodeDlg* dlg = new TBarcodeDlg( this );
+ addPage( dlg, i18n("TBarcode") );
list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, PUREADV ) ) {
- KVBox* box = new KVBox();
- KPageWidgetItem* item = addPage( box, i18n("Barcode Writer in Pure Postscript") );
- PurePostscriptDlg* dlg = new PurePostscriptDlg( box );
+ PurePostscriptDlg* dlg = new PurePostscriptDlg( this );
+ addPage( dlg, i18n("Barcode Writer in Pure Postscript") );
list.append( (BarcodeDlgBase*)dlg );
}
if( Barkode::hasFeature( type, COLORED ) ) {
- KVBox* box = new KVBox();
- KPageWidgetItem* item = addPage( box, i18n("Colors") );
- ColorDlg* dlg = new ColorDlg( box );
+ ColorDlg* dlg = new ColorDlg( this );
+ addPage( dlg, i18n("Colors") );
list.append( (BarcodeDlgBase*)dlg );
}
- KVBox* box = new KVBox();
- KPageWidgetItem* item = addPage( box, i18n("Sequence") );
- SequenceDlg* dlg = new SequenceDlg( box );
+ SequenceDlg* dlg = new SequenceDlg( this );
+ addPage( dlg, i18n("Sequence") );
list.append( (BarcodeDlgBase*)dlg );
}
@@ -113,138 +107,134 @@
}
}
-TBarcodeDlg::TBarcodeDlg(QWidget *parent)
- : QWidget( parent )
+TBarcodeDlg::TBarcodeDlg( QWidget *parent )
+ : QWidget( parent )
{
- QVBoxLayout* layout = new QVBoxLayout( this, 6, 6 );
+ QVBoxLayout* layout = new QVBoxLayout( this );
+ layout -> setSpacing( 6 ); // TODO: should we hardcode the spacing and margin values?
- QGroupBox* gb = new QGroupBox( i18n("TBarcode"), this );
- gb->setColumnLayout(0, Qt::Vertical );
- gb->layout()->setSpacing( 6 );
- gb->layout()->setMargin( 11 );
- gb->setEnabled( Barkode::haveTBarcode() || Barkode::haveTBarcode2() );
- QVBoxLayout* gbLayout = new QVBoxLayout( gb->layout() );
+ setEnabled( Barkode::haveTBarcode() || Barkode::haveTBarcode2() );
- spinModule = new KDoubleNumInput( gb );
- spinModule->setLabel( i18n("Module width (mm):"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinModule = new KDoubleNumInput( layout );
+ spinModule->setLabel( i18n( "Module width (mm):" ), Qt::AlignLeft | Qt::AlignVCenter );
spinModule->setRange( 0.190, 1.500, 0.001, true );
- spinHeight = new KIntNumInput( gb );
- spinHeight->setLabel( i18n("Barcode Height (mm):"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinHeight = new KIntNumInput( layout );
+ spinHeight->setLabel( i18n( "Barcode Height (mm):" ), Qt::AlignLeft | Qt::AlignVCenter );
spinHeight->setRange( 1, 1000, 10, false );
- checkEscape = new QCheckBox( i18n("&Translate escape sequences"), gb );
- checkAbove = new QCheckBox( i18n("&Text above barcode"), gb );
- checkAutoCorrect = new QCheckBox( i18n("&Auto correction"), gb );
-
- comboCheckSum = new KComboBox( false, gb );
-
- QLabel* label = new QLabel( i18n("&Checksum calculation method:"), gb );
+ checkEscape = new QCheckBox( i18n( "&Translate escape sequences" ), layout );
+ checkAbove = new QCheckBox( i18n( "&Text above barcode" ), layout );
+ checkAutoCorrect = new QCheckBox( i18n( "&Auto correction" ), layout );
+
+ comboCheckSum = new KComboBox( false, layout );
+
+ QLabel* label = new QLabel( i18n( "&Checksum calculation method:" ), gb );
label->setBuddy( comboCheckSum );
- QHBoxLayout * hbox = new QHBoxLayout( 0, 6, 6 );
+ QHBoxLayout * hbox = new QHBoxLayout( layout );
+ hbox->setSpacing( 6 );
+ hbox->setMargins( 6 );
+
hbox->addWidget( label );
hbox->addWidget( comboCheckSum );
-
- gbLayout->addWidget( spinModule );
- gbLayout->addWidget( spinHeight );
- gbLayout->addWidget( checkEscape );
- gbLayout->addWidget( checkAbove );
- gbLayout->addWidget( checkAutoCorrect );
- gbLayout->addLayout( hbox );
-
- QToolTip::add( spinModule, i18n("<qt>Change the module with used by tbarcode. Take a look into the "
- "tbarcode documentation for details. Normaly you do not want to change "
- "this value.</qt>") );
-
- layout->addWidget( gb );
+
+ layout->addWidget( spinModule );
+ layout->addWidget( spinHeight );
+ layout->addWidget( checkEscape );
+ layout->addWidget( checkAbove );
+ layout->addWidget( checkAutoCorrect );
+ layout->addLayout( hbox );
+
+ QToolTip::add( spinModule, i18n( "<qt>Change the module width used by TBarcode. Take a look into the "
+ "TBarcode documentation for details. Normally you do not want to change "
+ "this value.</qt>" ) );
}
void TBarcodeDlg::setData( Barkode* b )
{
TBarcodeOptions* options = dynamic_cast<TBarcodeOptions*>( b->engine()->options() );
- if( options )
+ if ( options )
{
+ map.clear();
+
spinModule->setValue( options->moduleWidth() );
spinHeight->setValue( options->height() );
checkEscape->setChecked( options->escape() );
checkAbove->setChecked( options->above() );
checkAutoCorrect->setChecked( options->autocorrect() );
-
- map.insert( i18n("No Checksum"), 0 );
- map.insert( i18n("Default Checksum Method"), 1 );
- if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ||
- Barkode::hasFeature( b->type(), MODULO10CHECK ) )
- map.insert( i18n("Modulo 10 Checksum"), 2 );
-
- if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ||
- b->type() == "b13" || // EAN 13
- b->type() == "b14" || // EAN 13
- b->type() == "b15" || // EAN 13
- b->type() == "b18" ) // CodaBar (2 width)
- map.insert( i18n("Module 43 (suggested for Code39 and Logmars, 1 digit)"), 3 );
-
- if( Barkode::hasFeature( b->type(), MODULOALLCHECK ) )
- map.insert( i18n("Modula 47 (2 digits)"), 4 );
-
- if( b->type() == "b21" ) // Deutsche Post Leitcode
- map.insert( i18n("Deutsche Post Leitcode"), 5 );
-
- if( b->type() == "b22") // Deutsche Post Identcode
- map.insert( i18n("Deutsche Post Identcode"), 6 );
+ map.insert( 0, i18n( "No Checksum" ) );
+ map.insert( 1, i18n( "Default Checksum Method" ) );
- if( b->type() == "b1" ) { // Code11
- map.insert( i18n("Code 11 (1 digit)"), 7 );
- map.insert( i18n("Code 11 (2 digits)"), 8 );
+ if ( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ||
+ Barkode::hasFeature( b->type(), MODULO10CHECK ) )
+ map.insert( 2, i18n( "Modulo 10 Checksum" ) );
+
+ if ( Barkode::hasFeature( b->type(), MODULOALLCHECK ) ||
+ b->type() == "b13" || // EAN 13
+ b->type() == "b14" || // EAN 13
+ b->type() == "b15" || // EAN 13
+ b->type() == "b18" ) // CodaBar (2 width)
+ map.insert( 3, i18n( "Module 43 (suggested for Code39 and Logmars, 1 digit)" ) );
+
+ if ( Barkode::hasFeature( b->type(), MODULOALLCHECK ) )
+ map.insert( 4, i18n( "Modula 47 (2 digits)" ) );
+
+ if ( b->type() == "b21" ) // Deutsche Post Leitcode
+ map.insert( 5, i18n( "Deutsche Post Leitcode" ) );
+
+ if ( b->type() == "b22" ) // Deutsche Post Identcode
+ map.insert( 6, i18n( "Deutsche Post Identcode" ) );
+
+ if ( b->type() == "b1" ) // Code11
+ {
+ map.insert( 7, i18n( "Code 11 (1 digit)" ) );
+ map.insert( 8, i18n( "Code 11 (2 digits)" ) );
}
- if( Barkode::hasFeature( b->type(), POSTNETCHECK ) )
- map.insert( i18n("USPS Postnet"), 9 );
+ if ( Barkode::hasFeature( b->type(), POSTNETCHECK ) )
+ map.insert( 9, i18n( "USPS Postnet" ) );
- if( b->type() == "b47" ) { // MSI
- map.insert( i18n("MSI (1 digit)"), 10 );
- map.insert( i18n("MSI (2 digits)"), 11 );
+ if ( b->type() == "b47" ) // MSI
+ {
+ map.insert( 10, i18n( "MSI (1 digit)" ) );
+ map.insert( 11, i18n( "MSI (2 digits)" ) );
}
- if( b->type() == "b46" ) // Plessey
- map.insert( i18n("Plessey"), 12 );
+ if ( b->type() == "b46" ) // Plessey
+ map.insert( 12, i18n( "Plessey" ) );
- if( Barkode::hasFeature( b->type(), EAN8CHECK ) )
- map.insert( i18n("EAN 8"), 13 );
+ if ( Barkode::hasFeature( b->type(), EAN8CHECK ) )
+ map.insert( 13, i18n( "EAN 8" ) );
- if( Barkode::hasFeature( b->type(), EAN13CHECK ) )
- map.insert( i18n("EAN 13"), 14 );
+ if ( Barkode::hasFeature( b->type(), EAN13CHECK ) )
+ map.insert( 14, i18n( "EAN 13" ) );
- if( Barkode::hasFeature( b->type(), UPCACHECK ) )
- map.insert( i18n("UPC A"), 15 );
-
- if( Barkode::hasFeature( b->type(), UPCECHECK ) )
- map.insert( i18n("UPC E"), 16 );
+ if ( Barkode::hasFeature( b->type(), UPCACHECK ) )
+ map.insert( 15, i18n( "UPC A" ) );
- if( b->type() == "b16" ) // EAN 128
- map.insert( i18n("EAN 128"), 17 );
+ if ( Barkode::hasFeature( b->type(), UPCECHECK ) )
+ map.insert( 16, i18n( "UPC E" ) );
- if( Barkode::hasFeature( b->type(), CODE128CHECK ) )
- map.insert( i18n("Code 128"), 18 );
-
- if( b->type() == "b70" ) // Royal Mail 4 State
- map.insert( i18n("Royal Mail 4 State"), 19 );
+ if ( b->type() == "b16" ) // EAN 128
+ map.insert( 17, i18n( "EAN 128" ) );
- comboCheckSum->insertStringList( map.keys() );
-
- QMap<QString,int>::Iterator it;
- for ( it = map.begin(); it != map.end(); ++it ) {
- if( it.data() == options->checksum() ) {
- for( int i = 0; i < comboCheckSum->count(); i++ )
- if( comboCheckSum->text( i ) == it.key() ) {
- comboCheckSum->setCurrentItem( i );
- break;
- }
- break;
- }
- }
+ if ( Barkode::hasFeature( b->type(), CODE128CHECK ) )
+ map.insert( 18, i18n( "Code 128" ) );
+
+ if ( b->type() == "b70" ) // Royal Mail 4 State
+ map.insert( 19, i18n( "Royal Mail 4 State" ) );
+
+ comboCheckSum->clear();
+
+ comboCheckSum->insertItems( 0, map.values() );
+
+ int currentIndex = comboCheckSum->findText( map[options->checksum()] );
+
+ comboCheckSum->setCurrentItem( currentIndex );
+
}
}
@@ -252,13 +242,13 @@
{
TBarcodeOptions* options = dynamic_cast<TBarcodeOptions*>( b->engine()->options() );
- if( options )
+ if ( options )
{
options->setModuleWidth( spinModule->value() );
options->setEscape( checkEscape->isChecked() );
options->setAbove( checkAbove->isChecked() );
options->setAutocorrect( checkAutoCorrect->isChecked() );
- options->setCheckSum( map[comboCheckSum->currentText()] );
+ options->setCheckSum( map.key( comboCheckSum->currentText() ) );
options->setHeight( spinHeight->value() );
}
}
Modified: trunk/src/dialogs/barcodedialogs.h
===================================================================
--- trunk/src/dialogs/barcodedialogs.h 2008-03-04 14:12:04 UTC (rev 35)
+++ trunk/src/dialogs/barcodedialogs.h 2008-03-04 15:34:11 UTC (rev 36)
@@ -90,7 +90,7 @@
QCheckBox* checkAutoCorrect;
KComboBox* comboCheckSum;
- QMap<QString,int> map;
+ QMap<int, QString> map;
};
/** A configuration Dialog for PDF417 settings.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 16:16:54
|
Revision: 39
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=39&view=rev
Author: vzsolt
Date: 2008-03-04 08:16:56 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
ColorDlg done.
Modified Paths:
--------------
trunk/src/dialogs/barcodedialogs.cpp
trunk/src/dialogs/barcodedialogs.h
Modified: trunk/src/dialogs/barcodedialogs.cpp
===================================================================
--- trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 16:12:00 UTC (rev 38)
+++ trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 16:16:56 UTC (rev 39)
@@ -437,25 +437,22 @@
}
ColorDlg::ColorDlg(QWidget *parent)
- : QVBox( parent )
+ : QWidget( parent )
{
- QGroupBox* gb = new QGroupBox( i18n("Colors"), this );
- gb->setColumnLayout(0, Qt::Vertical );
- gb->layout()->setSpacing( 6 );
- gb->layout()->setMargin( 11 );
- gb->setEnabled( Barkode::havePurePostscriptBarcode() );
- QGridLayout* gbLayout = new QGridLayout( gb->layout() );
+ QVBoxLayout* layout = new QVBoxLayout( this );
+
+ buttonBarColor = new KColorButton( this );
+ buttonBackColor = new KColorButton( this );
+ buttonTextColor = new KColorButton( this );
- buttonBarColor = new KColorButton( gb );
- buttonBackColor = new KColorButton( gb );
- buttonTextColor = new KColorButton( gb );
-
- gbLayout->addWidget( new QLabel( i18n("Bar Color:"), gb ), 0, 0 );
- gbLayout->addWidget( new QLabel( i18n("Background Color:"), gb ), 1, 0 );
- gbLayout->addWidget( new QLabel( i18n("Text Color:"), gb ), 2, 0 );
- gbLayout->addWidget( buttonBarColor, 0, 1 );
- gbLayout->addWidget( buttonBackColor, 1, 1 );
- gbLayout->addWidget( buttonTextColor, 2, 1 );
+ layout->addWidget( new QLabel( i18n("Bar Color:"), this ), 0, 0 );
+ layout->addWidget( new QLabel( i18n("Background Color:"), this ), 1, 0 );
+ layout->addWidget( new QLabel( i18n("Text Color:"), this ), 2, 0 );
+ layout->addWidget( buttonBarColor, 0, 1 );
+ layout->addWidget( buttonBackColor, 1, 1 );
+ layout->addWidget( buttonTextColor, 2, 1 );
+
+ setLayout( layout );
}
void ColorDlg::setData( Barkode* b )
Modified: trunk/src/dialogs/barcodedialogs.h
===================================================================
--- trunk/src/dialogs/barcodedialogs.h 2008-03-04 16:12:00 UTC (rev 38)
+++ trunk/src/dialogs/barcodedialogs.h 2008-03-04 16:16:56 UTC (rev 39)
@@ -169,7 +169,7 @@
/** A configuration widget for colors in pure postscript barcodes
* @author Dominik Seichter
*/
-class PurePostscriptDlg : public QVBox, public BarcodeDlgBase {
+class PurePostscriptDlg : public QWidget, public BarcodeDlgBase {
Q_OBJECT
public:
PurePostscriptDlg(QWidget *parent=0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 16:23:51
|
Revision: 40
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=40&view=rev
Author: vzsolt
Date: 2008-03-04 08:23:56 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
Finished PurePostscriptDlg, cleaned up headers.
This one should be done, if not for compile errors.
I'll try compiling it soon :)
Modified Paths:
--------------
trunk/src/dialogs/barcodedialogs.cpp
trunk/src/dialogs/barcodedialogs.h
Modified: trunk/src/dialogs/barcodedialogs.cpp
===================================================================
--- trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 16:16:56 UTC (rev 39)
+++ trunk/src/dialogs/barcodedialogs.cpp 2008-03-04 16:23:56 UTC (rev 40)
@@ -21,19 +21,13 @@
#include "tbarcode2.h"
// Qt includes
-#include <q3buttongroup.h>
-#include <qcheckbox.h>
-#include <q3groupbox.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qmap.h>
-#include <qradiobutton.h>
-#include <qtooltip.h>
-#include <q3vbox.h>
-#include <q3vgroupbox.h>
-//Added by qt3to4:
+#include <QCheckBox>
+#include <QLabel>
+#include <QLayout>
+#include <QRadioButton>
+#include <QToolTip>
+
#include <QHBoxLayout>
-#include <QGridLayout>
#include <QVBoxLayout>
// KDE includes
@@ -44,47 +38,53 @@
AdvancedBarcodeDialog::AdvancedBarcodeDialog( QString type, QWidget* parent )
- : KPageDialog( parent )
+ : KPageDialog( parent )
{
setFaceType( KPageDialog::Tabbed );
- setCaption( i18n("Barcode Settings") );
+ setCaption( i18n( "Barcode Settings" ) );
setButtons( KDialog::Ok | KDialog::Cancel );
setDefaultButton( KDialog::Ok );
-
- if( Barkode::hasFeature( type, PDF417BARCODE ) ) {
+
+ if ( Barkode::hasFeature( type, PDF417BARCODE ) )
+ {
PDF417BarcodeDlg* dlg = new PDF417BarcodeDlg( this );
- addPage( dlg, i18n("PDF417") );
- list.append( (BarcodeDlgBase*)dlg );
+ addPage( dlg, i18n( "PDF417" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
- if( Barkode::hasFeature( type, DATAMATRIX ) ) {
+ if ( Barkode::hasFeature( type, DATAMATRIX ) )
+ {
DataMatrixDlg* dlg = new DataMatrixDlg( this );
- addPage( dlg, i18n("DataMatrix") );
- list.append( (BarcodeDlgBase*)dlg );
+ addPage( dlg, i18n( "DataMatrix" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
- if( Barkode::hasFeature( type, TBARCODEADV ) ) {
+ if ( Barkode::hasFeature( type, TBARCODEADV ) )
+ {
TBarcodeDlg* dlg = new TBarcodeDlg( this );
- addPage( dlg, i18n("TBarcode") );
- list.append( (BarcodeDlgBase*)dlg );
+ addPage( dlg, i18n( "TBarcode" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
- if( Barkode::hasFeature( type, PUREADV ) ) {
+ if ( Barkode::hasFeature( type, PUREADV ) )
+ {
PurePostscriptDlg* dlg = new PurePostscriptDlg( this );
- addPage( dlg, i18n("Barcode Writer in Pure Postscript") );
- list.append( (BarcodeDlgBase*)dlg );
+ addPage( dlg, i18n( "Barcode Writer in Pure Postscript" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
- if( Barkode::hasFeature( type, COLORED ) ) {
+ if ( Barkode::hasFeature( type, COLORED ) )
+ {
ColorDlg* dlg = new ColorDlg( this );
- addPage( dlg, i18n("Colors") );
- list.append( (BarcodeDlgBase*)dlg );
+ addPage( dlg, i18n( "Colors" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
SequenceDlg* dlg = new SequenceDlg( this );
- addPage( dlg, i18n("Sequence") );
- list.append( (BarcodeDlgBase*)dlg );
+
+ addPage( dlg, i18n( "Sequence" ) );
+ list.append(( BarcodeDlgBase* )dlg );
}
AdvancedBarcodeDialog::~AdvancedBarcodeDialog()
@@ -93,15 +93,17 @@
void AdvancedBarcodeDialog::setData( Barkode* b )
{
- for( unsigned int i = 0; i < list.count(); i++ ) {
+ for ( unsigned int i = 0; i < list.count(); i++ )
+ {
BarcodeDlgBase* bdb = list.at( i );
bdb->setData( b );
}
}
-void AdvancedBarcodeDialog::getData( Barkode* b )
+void AdvancedBarcodeDialog::getData( Barkode* b )
{
- for( unsigned int i = 0; i < list.count(); i++ ) {
+ for ( unsigned int i = 0; i < list.count(); i++ )
+ {
BarcodeDlgBase* bdb = list.at( i );
bdb->getData( b );
}
@@ -149,8 +151,8 @@
QToolTip::add( spinModule, i18n( "<qt>Change the module width used by TBarcode. Take a look into the "
"TBarcode documentation for details. Normally you do not want to change "
"this value.</qt>" ) );
-
- setLayout(layout);
+
+ setLayout( layout );
}
void TBarcodeDlg::setData( Barkode* b )
@@ -255,29 +257,29 @@
}
}
-PDF417BarcodeDlg::PDF417BarcodeDlg(QWidget *parent)
- : QWidget( parent )
+PDF417BarcodeDlg::PDF417BarcodeDlg( QWidget *parent )
+ : QWidget( parent )
{
QVBoxLayout* layout = new QVBoxLayout( this );
setEnabled( Barkode::haveTBarcode() || Barkode::havePDFBarcode() );
-
+
spinRow = new KIntNumInput( this );
- spinRow->setLabel( i18n("Rows:"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinRow->setLabel( i18n( "Rows:" ), Qt::AlignLeft | Qt::AlignVCenter );
spinRow->setRange( 0, 90, 1, true );
spinCol = new KIntNumInput( spinRow, 0, this );
- spinCol->setLabel( i18n("Columns:"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinCol->setLabel( i18n( "Columns:" ), Qt::AlignLeft | Qt::AlignVCenter );
spinCol->setRange( 0, 30, 1, true );
spinErr = new KIntNumInput( spinCol, 0, this );
- spinErr->setLabel( i18n("Error correction level:"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinErr->setLabel( i18n( "Error correction level:" ), Qt::AlignLeft | Qt::AlignVCenter );
spinErr->setRange( 1, 8, 1, true );
layout->addWidget( spinRow );
layout->addWidget( spinCol );
layout->addWidget( spinErr );
-
+
setLayout( layout );
}
@@ -285,7 +287,7 @@
{
PDF417Options* options = dynamic_cast<PDF417Options*>( b->engine()->options() );
- if( options )
+ if ( options )
{
spinRow->setValue( options->row() );
spinCol->setValue( options->col() );
@@ -297,7 +299,7 @@
{
PDF417Options* options = dynamic_cast<PDF417Options*>( b->engine()->options() );
- if( options )
+ if ( options )
{
options->setRow( spinRow->value() );
options->setCol( spinCol->value() );
@@ -305,18 +307,18 @@
}
}
-DataMatrixDlg::DataMatrixDlg(QWidget *parent )
- : QWidget( parent )
+DataMatrixDlg::DataMatrixDlg( QWidget *parent )
+ : QWidget( parent )
{
QHBoxLayout* datamLayout = new QHBoxLayout( this );
comboDataMatrix = new KComboBox( false, this );
- datamLayout->addWidget( new QLabel( i18n("Data Matrix symbol sizes (rows x cols):"), this ) );
+ datamLayout->addWidget( new QLabel( i18n( "Data Matrix symbol sizes (rows x cols):" ), this ) );
datamLayout->addWidget( comboDataMatrix );
datamLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Minimum ) );
- comboDataMatrix->addItem( i18n("Automatic calculation" ) );
+ comboDataMatrix->addItem( i18n( "Automatic calculation" ) );
comboDataMatrix->addItem( "10 x 10" );
comboDataMatrix->addItem( "12 x 12" );
comboDataMatrix->addItem( "14 x 14" );
@@ -347,13 +349,13 @@
comboDataMatrix->addItem( "12 x 36" );
comboDataMatrix->addItem( "16 x 36" );
comboDataMatrix->addItem( "16 x 48" );
-
+
setLayout( datamLayout );
}
void DataMatrixDlg::setData( Barkode* b )
{
- comboDataMatrix->setCurrentItem( b->datamatrixSize());
+ comboDataMatrix->setCurrentItem( b->datamatrixSize() );
}
void DataMatrixDlg::getData( Barkode* b ) const
@@ -362,31 +364,31 @@
}
SequenceDlg::SequenceDlg( QWidget *parent )
- : QWidget( parent )
+ : QWidget( parent )
{
QVBoxLayout* layout = new QVBoxLayout( this );
- checkSequence = new QCheckBox( i18n("&Enable sequence"), this );
-
- radioNumbers = new QRadioButton( i18n("Iterate over numbers 0-9"), this );
- radioAlpha = new QRadioButton( i18n("Iterate over characters A-Z"), this );
- radioAlphaNum = new QRadioButton( i18n("Iterate over A-Z, 0-9"), this );
+ checkSequence = new QCheckBox( i18n( "&Enable sequence" ), this );
+ radioNumbers = new QRadioButton( i18n( "Iterate over numbers 0-9" ), this );
+ radioAlpha = new QRadioButton( i18n( "Iterate over characters A-Z" ), this );
+ radioAlphaNum = new QRadioButton( i18n( "Iterate over A-Z, 0-9" ), this );
+
spinStep = new KIntNumInput( this );
- spinStep->setLabel( i18n("Step:"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinStep->setLabel( i18n( "Step:" ), Qt::AlignLeft | Qt::AlignVCenter );
spinStep->setRange( -100, 100, 1, false );
spinStart = new KIntNumInput( spinStep, 1, this );
- spinStart->setLabel( i18n("Start:"), Qt::AlignLeft | Qt::AlignVCenter );
+ spinStart->setLabel( i18n( "Start:" ), Qt::AlignLeft | Qt::AlignVCenter );
spinStart->setRange( -100000, 100000, 1, false );
-
+
layout->addWidget( checkSequence );
layout->addWidget( radioNumbers );
layout->addWidget( radioAlpha );
layout->addWidget( radioAlphaNum );
layout->addWidget( spinStep );
layout->addWidget( spinStart );
-
+
setLayout( layout );
connect( checkSequence, SIGNAL( clicked() ), this, SLOT( enableControls() ) );
@@ -400,29 +402,29 @@
checkSequence->setChecked( b->sequenceEnabled() );
spinStep->setValue( b->sequenceStep() );
spinStart->setValue( b->sequenceStart() );
-
- if( b->sequenceMode() == NUM )
+
+ if ( b->sequenceMode() == NUM )
radioNumbers->setChecked( true );
- else if( b->sequenceMode() == ALPHA )
+ else if ( b->sequenceMode() == ALPHA )
radioAlpha->setChecked( true );
- else if( b->sequenceMode() == ALPHANUM )
+ else if ( b->sequenceMode() == ALPHANUM )
radioAlphaNum->setChecked( true );
-
+
enableControls();
}
void SequenceDlg::getData( Barkode* b ) const
{
b->setSequenceEnabled( checkSequence->isChecked() );
-
+
b->setSequenceStep( spinStep->value() );
b->setSequenceStart( spinStart->value() );
-
- if( radioNumbers->isChecked() )
+
+ if ( radioNumbers->isChecked() )
b->setSequenceMode( NUM );
- else if( radioAlpha->isChecked() )
+ else if ( radioAlpha->isChecked() )
b->setSequenceMode( ALPHA );
- else if( radioAlphaNum->isChecked() )
+ else if ( radioAlphaNum->isChecked() )
b->setSequenceMode( ALPHANUM );
}
@@ -436,22 +438,22 @@
spinStart->setEnabled( checkSequence->isChecked() && radioNumbers->isChecked() );
}
-ColorDlg::ColorDlg(QWidget *parent)
- : QWidget( parent )
+ColorDlg::ColorDlg( QWidget *parent )
+ : QWidget( parent )
{
QVBoxLayout* layout = new QVBoxLayout( this );
-
+
buttonBarColor = new KColorButton( this );
buttonBackColor = new KColorButton( this );
buttonTextColor = new KColorButton( this );
- layout->addWidget( new QLabel( i18n("Bar Color:"), this ), 0, 0 );
- layout->addWidget( new QLabel( i18n("Background Color:"), this ), 1, 0 );
- layout->addWidget( new QLabel( i18n("Text Color:"), this ), 2, 0 );
+ layout->addWidget( new QLabel( i18n( "Bar Color:" ), this ), 0, 0 );
+ layout->addWidget( new QLabel( i18n( "Background Color:" ), this ), 1, 0 );
+ layout->addWidget( new QLabel( i18n( "Text Color:" ), this ), 2, 0 );
layout->addWidget( buttonBarColor, 0, 1 );
layout->addWidget( buttonBackColor, 1, 1 );
layout->addWidget( buttonTextColor, 2, 1 );
-
+
setLayout( layout );
}
@@ -469,20 +471,24 @@
b->setTextColor( buttonTextColor->color() );
}
-PurePostscriptDlg::PurePostscriptDlg(QWidget *parent)
- : QVBox( parent )
+PurePostscriptDlg::PurePostscriptDlg( QWidget *parent )
+ : QWidget( parent )
{
- QVGroupBox* gb = new QVGroupBox( i18n("Barcode Writer in Pure Postscript"), this );
- gb->setEnabled( Barkode::havePurePostscriptBarcode() );
-
- checkChecksum = new QCheckBox( i18n("Enable &Checksum"), gb );
+ QVBoxLayout* layout = new QVBoxLayout( this );
+
+ setEnabled( Barkode::havePurePostscriptBarcode() );
+ checkChecksum = new QCheckBox( i18n( "Enable &Checksum" ), this );
+
+ layout->addWidget( checkChecksum );
+
+ setLayout( layout );
}
void PurePostscriptDlg::setData( Barkode* b )
{
PurePostscriptOptions* options = dynamic_cast<PurePostscriptOptions*>( b->engine()->options() );
- if( options )
+ if ( options )
{
checkChecksum->setChecked( options->checksum() );
checkChecksum->setEnabled( Barkode::hasFeature( b->type(), MODULOALLCHECK ) );
@@ -492,8 +498,8 @@
void PurePostscriptDlg::getData( Barkode* b ) const
{
PurePostscriptOptions* options = dynamic_cast<PurePostscriptOptions*>( b->engine()->options() );
-
- if( options )
+
+ if ( options )
options->setChecksum( checkChecksum->isChecked() );
}
Modified: trunk/src/dialogs/barcodedialogs.h
===================================================================
--- trunk/src/dialogs/barcodedialogs.h 2008-03-04 16:16:56 UTC (rev 39)
+++ trunk/src/dialogs/barcodedialogs.h 2008-03-04 16:23:56 UTC (rev 40)
@@ -18,11 +18,10 @@
#ifndef BARCODEDIALOGS_H
#define BARCODEDIALOGS_H
-#include <qmap.h>
+#include <QMap>
#include <QList>
-#include <qwidget.h>
-#include <q3vbox.h>
-#include <kdialog.h>
+#include <QWidget>
+
#include <kpagedialog.h>
#include <kpagewidgetmodel.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 18:39:50
|
Revision: 43
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=43&view=rev
Author: vzsolt
Date: 2008-03-04 10:39:56 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
BarcodePrinterDlg is now complete.
Modified Paths:
--------------
trunk/src/dialogs/barcodeprinterdlg.cpp
trunk/src/dialogs/barcodeprinterdlg.h
Modified: trunk/src/dialogs/barcodeprinterdlg.cpp
===================================================================
--- trunk/src/dialogs/barcodeprinterdlg.cpp 2008-03-04 17:35:54 UTC (rev 42)
+++ trunk/src/dialogs/barcodeprinterdlg.cpp 2008-03-04 18:39:56 UTC (rev 43)
@@ -22,46 +22,51 @@
#include <klocale.h>
#include <kurlrequester.h>
-#include <qcheckbox.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qvbuttongroup.h>
-//Added by qt3to4:
+#include <QCheckBox>
+#include <QLabel>
+#include <QLayout>
#include <QGridLayout>
-BarcodePrinterDlg::BarcodePrinterDlg(QWidget *parent)
- : KDialogBase( KDialogBase::Plain, i18n("Barcode Printer"),
- KDialogBase::Ok | KDialogBase::Cancel, KDialogBase::Ok, parent)
+BarcodePrinterDlg::BarcodePrinterDlg( QWidget *parent )
+ : KDialog( parent )
{
- QGridLayout* layout = new QGridLayout( plainPage(), 6, 6 );
-
- QLabel* label = new QLabel( i18n("&Output Format:"), plainPage() );
- comboFormat = new KComboBox( false, plainPage() );
+ setCaption( i18n( "Barcode Printer" ) );
+ setButtons( KDialog::Ok | KDialog::Cancel );
+ setDefaultButton( KDialog::Ok );
+
+ QWidget* page = new QWidget( this );
+ setMainWidget( page );
+
+ QGridLayout* layout = new QGridLayout( page );
+
+ QLabel* label = new QLabel( i18n( "&Output Format:" ), page );
+ comboFormat = new KComboBox( false, page );
label->setBuddy( comboFormat );
-
- checkFile = new QCheckBox( i18n("&Print to File"), plainPage() );
-
- label2 = new QLabel( i18n("&Filename:"), plainPage() );
- requester = new KUrlRequester( plainPage() );
+
+ checkFile = new QCheckBox( i18n( "&Print to File" ), page );
+
+ label2 = new QLabel( i18n( "&Filename:" ), page );
+ requester = new KUrlRequester( page );
label2->setBuddy( requester );
- label3 = new QLabel( i18n("&Device:"), plainPage() );
- comboDevice = new KComboBox( true, plainPage() );
+ label3 = new QLabel( i18n( "&Device:" ), page );
+ comboDevice = new KComboBox( true, page );
label3->setBuddy( comboDevice );
-
+
layout->addWidget( label, 0, 0 );
- layout->addMultiCellWidget( comboFormat, 0, 0, 1, 2 );
- layout->addMultiCellWidget( checkFile, 1, 1, 1, 2 );
+ layout->addWidget( comboFormat, 0, 1, 1, 2 );
+
+ layout->addWidget( checkFile, 1, 1, 1, 2 );
layout->addWidget( label2, 2, 0 );
layout->addWidget( requester, 2, 1 );
layout->addWidget( label3, 3, 0 );
- layout->addMultiCellWidget( comboDevice, 3, 3, 1, 2 );
-
- comboFormat->addItem( i18n("TEC Printer (TEC)") );
- comboFormat->addItem( i18n("Zebra Printer (ZPL)") );
- comboFormat->addItem( i18n("Intermec Printer (IPL)") );
- comboFormat->addItem( i18n("EPCL Printer (EPCL)") );
-
+ layout->addWidget( comboDevice, 3, 1, 1, 2 );
+
+ comboFormat->addItem( i18n( "TEC Printer (TEC)" ) );
+ comboFormat->addItem( i18n( "Zebra Printer (ZPL)" ) );
+ comboFormat->addItem( i18n( "Intermec Printer (IPL)" ) );
+ comboFormat->addItem( i18n( "EPCL Printer (EPCL)" ) );
+
// do not translate unix devicenames...
comboDevice->addItem( "/dev/lp0" );
comboDevice->addItem( "/dev/lp1" );
@@ -69,11 +74,13 @@
comboDevice->addItem( "/dev/usb/lp0" );
comboDevice->addItem( "/dev/usb/lp1" );
comboDevice->addItem( "/dev/usb/lp2" );
-
+
+ page->setLayout( layout );
+
connect( checkFile, SIGNAL( clicked() ), this, SLOT( enableControls() ) );
// KFileDialog fd( QString::null, "*.zpl|Zebra Printer Language (*.zpl)\n*.ipl|Intermec Printer Language (*.ipl)", this, "fd", true );
-
+
enableControls();
}
@@ -87,23 +94,28 @@
bool b = checkFile->isChecked();
label2->setEnabled( b );
requester->setEnabled( b );
-
+
label3->setEnabled( !b );
comboDevice->setEnabled( !b );
}
int BarcodePrinterDlg::outputFormat() const
{
- switch( comboFormat->currentItem() )
+ switch ( comboFormat->currentIndex() )
{
+
case 0:
return PrinterSettings::TEC;
+
case 1:
return PrinterSettings::ZEBRA;
+
case 2:
return PrinterSettings::INTERMEC;
+
case 3:
return PrinterSettings::EPCL;
+
default:
return -1;
}
@@ -121,7 +133,7 @@
const QString BarcodePrinterDlg::fileName() const
{
- return requester->url();
+ return requester->url().url();
}
#include "barcodeprinterdlg.moc"
Modified: trunk/src/dialogs/barcodeprinterdlg.h
===================================================================
--- trunk/src/dialogs/barcodeprinterdlg.h 2008-03-04 17:35:54 UTC (rev 42)
+++ trunk/src/dialogs/barcodeprinterdlg.h 2008-03-04 18:39:56 UTC (rev 43)
@@ -17,8 +17,8 @@
#ifndef BARCODEPRINTERDLG_H
#define BARCODEPRINTERDLG_H
-#include <kdialogbase.h>
-//Added by qt3to4:
+#include <kdialog.h>
+
#include <QLabel>
class KComboBox;
@@ -29,7 +29,7 @@
/**
@author Dominik Seichter
*/
-class BarcodePrinterDlg : public KDialogBase
+class BarcodePrinterDlg : public KDialog
{
Q_OBJECT
public:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-04 20:02:31
|
Revision: 44
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=44&view=rev
Author: vzsolt
Date: 2008-03-04 12:02:37 -0800 (Tue, 04 Mar 2008)
Log Message:
-----------
ConfigDialog should be done.
I'll check for compile errors now.
Modified Paths:
--------------
trunk/src/dialogs/configdialog.cpp
trunk/src/dialogs/configdialog.h
Modified: trunk/src/dialogs/configdialog.cpp
===================================================================
--- trunk/src/dialogs/configdialog.cpp 2008-03-04 18:39:56 UTC (rev 43)
+++ trunk/src/dialogs/configdialog.cpp 2008-03-04 20:02:37 UTC (rev 44)
@@ -51,9 +51,14 @@
using namespace KABC;
ConfigDialog::ConfigDialog( QWidget* parent )
- : KDialogBase( IconList, i18n("Configure KBarcode"), KDialogBase::Ok|KDialogBase::Cancel,
- KDialogBase::Ok, parent, "", true, true )
+ : KDialog( parent )
{
+ setFaceType( List );
+ setCaption( i18n("Configure KBarcode") );
+ setButtons( KDialog::Ok|KDialog::Cancel );
+ setDefaultButton( KDialog::Ok );
+ setModal( true );
+
setupTab2(); // Printer
setupTab1(); // SQL
setupTab4(); // label editor
@@ -67,163 +72,177 @@
void ConfigDialog::setupTab1( )
{
- QFrame* box = addPage( i18n("SQL Settings"), "", BarIcon("connect_no") );
- QVBoxLayout* layout = new QVBoxLayout( box, 6, 6 );
- QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
+ KVBox* page = new KVBox();
+ KPageWidgetItem* item = addPage( page, i18n( "SQL Settings" ) );
+ item->setIcon( BarIcon( "connect_no" ) );
- sqlwidget = new SqlWidget( false, box, "sqlwidget" );
+ sqlwidget = new SqlWidget( false, page );
- layout->addWidget( sqlwidget );
- layout->addItem( spacer );
+ // TODO: test if it's needed here
+ // QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
}
void ConfigDialog::setupTab2()
{
labelprinterdata* lb = PrinterSettings::getInstance()->getData();
-
- QFrame* box = addPage( i18n("Print Settings"), "", BarIcon("fileprint") );
- QVBoxLayout* tabLayout = new QVBoxLayout( box, 11, 6 );
- QHBoxLayout* Layout0 = new QHBoxLayout( 0, 6, 6 );
- QHBoxLayout* Layout1 = new QHBoxLayout( 0, 6, 6 );
- QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
+ KVBox* page = new KVBox();
+ KPageWidgetItem* item = addPage( page, i18n( "Print Settings" ) );
+ item->setIcon( BarIcon( "fileprint" ) );
- printerQuality = new KComboBox( false, box );
- printerQuality->addItem( i18n("Medium Resolution (300dpi)") );
- printerQuality->addItem( i18n("High Resolution (600dpi)") );
- printerQuality->addItem( i18n("Very High Resolution (1200dpi)") );
+ QHBoxLayout* Layout0 = new QHBoxLayout( page );
+ QHBoxLayout* Layout1 = new QHBoxLayout( page );
- switch( lb->quality ) {
+ // QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding );
+
+ printerQuality = new KComboBox( false, this );
+ printerQuality->addItem( i18n( "Medium Resolution (300dpi)" ) );
+ printerQuality->addItem( i18n( "High Resolution (600dpi)" ) );
+ printerQuality->addItem( i18n( "Very High Resolution (1200dpi)" ) );
+
+ switch ( lb->quality )
+ {
+
case PrinterSettings::Middle:
- printerQuality->setCurrentItem( 0 );
+ printerQuality->setCurrentIndex( 0 );
break;
+
case PrinterSettings::High:
- printerQuality->setCurrentItem( 1 );
+ printerQuality->setCurrentIndex( 1 );
break;
+
case PrinterSettings::VeryHigh:
- printerQuality->setCurrentItem( 2 );
+ printerQuality->setCurrentIndex( 2 );
break;
+
default:
break;
}
- pageFormat = new KComboBox( false, box );
+ pageFormat = new KComboBox( false, this );
+
PrinterSettings::getInstance()->insertPageFormat( pageFormat );
- pageFormat->setCurrentItem( lb->format );
-
- Layout0->addWidget( new QLabel( i18n("Printer Resolution:"), box ) );
+ pageFormat->setCurrentIndex( lb->format );
+
+ Layout0->addWidget( new QLabel( i18n( "Printer Resolution:" ), this ) );
Layout0->addWidget( printerQuality );
- Layout1->addWidget( new QLabel( i18n("Preview Page Format:"), box ) );
+ Layout1->addWidget( new QLabel( i18n( "Preview Page Format:" ), this ) );
Layout1->addWidget( pageFormat );
- tabLayout->addLayout( Layout0 );
- tabLayout->addLayout( Layout1 );
- tabLayout->addItem( spacer );
}
void ConfigDialog::setupTab3()
{
labelprinterdata* lb = PrinterSettings::getInstance()->getData();
- QFrame* box = addPage( i18n("Import"), "", BarIcon("fileimport") );
+ QWidget* page = new QWidget( this );
+ KPageWidgetItem* item = addPage( page, i18n( "Import" ) );
+ item->setIcon( BarIcon( "fileimport" ) );
+
QGridLayout* grid = new QGridLayout( box, 2, 2 );
- QLabel* label = new QLabel( box );
+ QLabel* label = new QLabel( page );
label->setText( i18n("Comment:") );
grid->addWidget( label, 0, 0 );
- comment = new KLineEdit( lb->comment, box );
+ comment = new KLineEdit( lb->comment, page );
grid->addWidget( comment, 0, 1 );
- label = new QLabel( box );
+ label = new QLabel( page );
label->setText( i18n( "Separator:" ) );
grid->addWidget( label, 1, 0 );
- separator = new KLineEdit( lb->separator, box );
+ separator = new KLineEdit( lb->separator, page );
grid->addWidget( separator, 1, 1 );
- label = new QLabel( box );
+ label = new QLabel( page );
label->setText( i18n("Quote Character:") );
grid->addWidget( label, 2, 0 );
- quote = new KLineEdit( lb->quote, box );
+ quote = new KLineEdit( lb->quote, page );
grid->addWidget( quote, 2, 1 );
- checkUseCustomNo = new QCheckBox( i18n("&Use customer article no. for import"), box );
+ checkUseCustomNo = new QCheckBox( i18n("&Use customer article no. for import"), page );
checkUseCustomNo->setChecked( lb->useCustomNo );
- grid->addMultiCellWidget( checkUseCustomNo, 3, 3, 0, 2 );
+ grid->addWidget( checkUseCustomNo, 3, 0, 1, 2 );
- QHBoxLayout* Layout1 = new QHBoxLayout( 0, 6, 6 );
- Layout1->addWidget( new QLabel( i18n("File Format:"), box ) );
+ QHBoxLayout* Layout1 = new QHBoxLayout( 0 );
+ Layout1->addWidget( new QLabel( i18n("File Format:"), page ) );
- combo1 = new KComboBox( box );
+ combo1 = new KComboBox( page );
combo1->addItem( i18n("Quantity") );
combo1->addItem( i18n("Article Number") );
combo1->addItem( i18n("Group") );
Layout1->addWidget( combo1 );
- combo2 = new KComboBox( box );
+ combo2 = new KComboBox( page );
combo2->addItem( i18n("Quantity") );
combo2->addItem( i18n("Article Number") );
combo2->addItem( i18n("Group") );
Layout1->addWidget( combo2 );
- combo3 = new KComboBox( box );
+ combo3 = new KComboBox( page );
combo3->addItem( i18n("Quantity") );
combo3->addItem( i18n("Article Number") );
combo3->addItem( i18n("Group") );
Layout1->addWidget( combo3 );
- grid->addMultiCellLayout( Layout1, 4, 4, 0, 2 );
+ grid->addLayout( Layout1, 4, 0, 1, 2 );
QSpacerItem* spacer = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum );
- grid->addItem( spacer, 5, 0 );
+ grid->addItem( spacer, 5, 0 );
+
+ KConfigGroup config = KGlobal::config()->group("FileFormat");
+ combo1->setCurrentIndex( config.readEntry("Data0", 0 ) );
+ combo2->setCurrentIndex( config.readEntry("Data1", 1 ) );
+ combo3->setCurrentIndex( config.readEntry("Data2", 2 ) );
- KConfig* config = KGlobal::config();
- config->setGroup("FileFormat");
- combo1->setCurrentItem( config->readNumEntry("Data0", 0 ) );
- combo2->setCurrentItem( config->readNumEntry("Data1", 1 ) );
- combo3->setCurrentItem( config->readNumEntry("Data2", 2 ) );
+ page->setLayout( grid );
}
void ConfigDialog::setupTab4()
{
- QFrame* box = addPage( i18n("Label Editor"), "", BarIcon("kbarcode") );
+ QWidget* page = new QWidget( this );
+ KPageWidgetItem* item = addPage( page, i18n( "Label Editor" ) );
+ item->setIcon( BarIcon( "kbarcode" ) );
+
QGridLayout* tabLayout = new QGridLayout( box, 11, 6 );
- checkNewDlg = new QCheckBox( box );
+ checkNewDlg = new QCheckBox( page );
checkNewDlg->setText( i18n("&Create a new label on startup") );
- date = new KLineEdit( box );
- labelDate = new QLabel( box );
+ date = new KLineEdit( page );
+ labelDate = new QLabel( page );
connect( date, SIGNAL( textChanged( const QString & ) ), this, SLOT( updateDatePreview() ) );
- spinGrid = new KIntNumInput( 0, box );
+ spinGrid = new KIntNumInput( 0, page );
spinGrid->setLabel( i18n("Grid:" ), Qt::AlignLeft | Qt::AlignVCenter );
- spinGrid->setRange(2, 100, 1, false );
+ spinGrid->setRange(2, 100, 1 );
+ spinGrid->setSliderEnabled( false );
+
+ colorGrid = new KColorButton( page );
- colorGrid = new KColorButton( box );
-
tabLayout->addWidget( checkNewDlg, 0, 0 );
- tabLayout->addMultiCellWidget( spinGrid, 1, 1, 0, 2 );
- tabLayout->addWidget( new QLabel( i18n("Grid Color:"), box ), 2, 0 );
+ tabLayout->addWidget( spinGrid, 1, 0, 1, 2 );
+ tabLayout->addWidget( new QLabel( i18n("Grid Color:"), page ), 2, 0 );
tabLayout->addWidget( colorGrid, 2, 1 );
- tabLayout->addWidget( new QLabel( i18n("Date Format:"), box ), 3, 0 );
+ tabLayout->addWidget( new QLabel( i18n("Date Format:"), page ), 3, 0 );
tabLayout->addWidget( date, 3, 1 );
tabLayout->addWidget( labelDate, 3, 2 );
+
+ page.setLayout( tabLayout );
}
void ConfigDialog::setupTab5()
{
labelprinterdata* lb = PrinterSettings::getInstance()->getData();
- QFrame* box = addPage( i18n("On New"), "", BarIcon("filenew") );
-
- QVBoxLayout* tabLayout = new QVBoxLayout( box, 11, 6 );
-
- QButtonGroup* bg = new QButtonGroup( i18n("On New Article"), box );
+
+ KVBox* page = new KVBox();
+ KPageWidgetItem* item = addPage( page, i18n( "On New" ) );
+ item->setIcon( BarIcon( "filenew" ) );
+
+ QButtonGroup* bg = new QButtonGroup( i18n("On New Article"), page );
bg->setColumnLayout(0, Qt::Vertical );
- bg->layout()->setSpacing( 6 );
- bg->layout()->setMargin( 11 );
QGridLayout* bgLayout = new QGridLayout( bg->layout() );
QStringList alist, glist;
@@ -249,7 +268,7 @@
onNewArticle3->insertStringList( alist );
onNewArticle4->insertStringList( alist );
- bgLayout->setColStretch( 1, 3 );
+ bgLayout->setColumnStretch( 1, 3 );
bgLayout->addWidget( new QLabel( "1.", bg ), 0, 0 );
bgLayout->addWidget( new QLabel( "2.", bg ), 1, 0 );
@@ -261,10 +280,8 @@
bgLayout->addWidget( onNewArticle3, 2, 1 );
bgLayout->addWidget( onNewArticle4, 3, 1 );
- QButtonGroup* bg2 = new QButtonGroup( i18n("On New Group"), box );
+ QButtonGroup* bg2 = new QButtonGroup( i18n("On New Group"), page );
bg2->setColumnLayout(0, Qt::Vertical );
- bg2->layout()->setSpacing( 6 );
- bg2->layout()->setMargin( 11 );
QGridLayout* bg2Layout = new QGridLayout( bg2->layout() );
onNewGroup1 = new KComboBox( false, bg2 );
@@ -277,7 +294,7 @@
onNewGroup3->insertStringList( glist );
onNewGroup4->insertStringList( glist );
- bg2Layout->setColStretch( 1, 3 );
+ bg2Layout->setColumnStretch( 1, 3 );
bg2Layout->addWidget( new QLabel( "1.", bg2 ), 0, 0 );
bg2Layout->addWidget( new QLabel( "2.", bg2 ), 1, 0 );
@@ -289,27 +306,24 @@
bg2Layout->addWidget( onNewGroup3, 2, 1 );
bg2Layout->addWidget( onNewGroup4, 3, 1 );
- tabLayout->addWidget( bg );
- tabLayout->addWidget( bg2 );
+ onNewArticle1->setCurrentIndex( lb->articleEvent1 );
+ onNewArticle2->setCurrentIndex( lb->articleEvent2 );
+ onNewArticle3->setCurrentIndex( lb->articleEvent3 );
+ onNewArticle4->setCurrentIndex( lb->articleEvent4 );
- onNewArticle1->setCurrentItem( lb->articleEvent1 );
- onNewArticle2->setCurrentItem( lb->articleEvent2 );
- onNewArticle3->setCurrentItem( lb->articleEvent3 );
- onNewArticle4->setCurrentItem( lb->articleEvent4 );
-
- onNewGroup1->setCurrentItem( lb->groupEvent1 );
- onNewGroup2->setCurrentItem( lb->groupEvent2 );
- onNewGroup3->setCurrentItem( lb->groupEvent3 );
- onNewGroup4->setCurrentItem( lb->groupEvent4 );
+ onNewGroup1->setCurrentIndex( lb->groupEvent1 );
+ onNewGroup2->setCurrentIndex( lb->groupEvent2 );
+ onNewGroup3->setCurrentIndex( lb->groupEvent3 );
+ onNewGroup4->setCurrentIndex( lb->groupEvent4 );
}
void ConfigDialog::accept()
{
- KConfig* config = KGlobal::config();
- config->setGroup("FileFormat");
- config->writeEntry("Data0", combo1->currentItem() );
- config->writeEntry("Data1", combo2->currentItem() );
- config->writeEntry("Data2", combo3->currentItem() );
+ KConfigGroup config = KGlobal::config()->group("FileFormat");
+
+ config.writeEntry("Data0", combo1->currentIndex() );
+ config.writeEntry("Data1", combo2->currentIndex() );
+ config.writeEntry("Data2", combo3->currentIndex() );
sqlwidget->save();
@@ -317,20 +331,20 @@
lpdata->comment = comment->text();
lpdata->separator = separator->text();
lpdata->quote = quote->text();
- lpdata->format = pageFormat->currentItem();
+ lpdata->format = pageFormat->currentIndex();
- lpdata->articleEvent1 = onNewArticle1->currentItem();
- lpdata->articleEvent2 = onNewArticle2->currentItem();
- lpdata->articleEvent3 = onNewArticle3->currentItem();
- lpdata->articleEvent4 = onNewArticle4->currentItem();
+ lpdata->articleEvent1 = onNewArticle1->currentIndex();
+ lpdata->articleEvent2 = onNewArticle2->currentIndex();
+ lpdata->articleEvent3 = onNewArticle3->currentIndex();
+ lpdata->articleEvent4 = onNewArticle4->currentIndex();
- lpdata->groupEvent1 = onNewGroup1->currentItem();
- lpdata->groupEvent2 = onNewGroup2->currentItem();
- lpdata->groupEvent3 = onNewGroup3->currentItem();
- lpdata->groupEvent4 = onNewGroup4->currentItem();
+ lpdata->groupEvent1 = onNewGroup1->currentIndex();
+ lpdata->groupEvent2 = onNewGroup2->currentIndex();
+ lpdata->groupEvent3 = onNewGroup3->currentIndex();
+ lpdata->groupEvent4 = onNewGroup4->currentIndex();
lpdata->useCustomNo = checkUseCustomNo->isChecked();
- switch( printerQuality->currentItem() ) {
+ switch( printerQuality->currentIndex() ) {
case 0:
lpdata->quality = PrinterSettings::Middle;
break;
Modified: trunk/src/dialogs/configdialog.h
===================================================================
--- trunk/src/dialogs/configdialog.h 2008-03-04 18:39:56 UTC (rev 43)
+++ trunk/src/dialogs/configdialog.h 2008-03-04 20:02:37 UTC (rev 44)
@@ -18,9 +18,7 @@
#ifndef CONFIGDIALOG_H
#define CONFIGDIALOG_H
-#include <kdialogbase.h>
-//Added by qt3to4:
-#include <QLabel>
+#include <kdialog.h>
struct labelprinterdata;
struct mysqldata;
@@ -39,7 +37,7 @@
/** KBarcodes configuration dialog for advanced settings.
*/
-class ConfigDialog : public KDialogBase {
+class ConfigDialog : public KDialog {
Q_OBJECT
public:
ConfigDialog( QWidget* parent );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <vz...@us...> - 2008-03-05 16:20:33
|
Revision: 47
http://kbarcode.svn.sourceforge.net/kbarcode/?rev=47&view=rev
Author: vzsolt
Date: 2008-03-05 08:20:31 -0800 (Wed, 05 Mar 2008)
Log Message:
-----------
I've started rewriting the CSV Import dialog, but I don't feel like it today.
Modified Paths:
--------------
trunk/src/dialogs/csvimportdlg.cpp
trunk/src/dialogs/csvimportdlg.h
Modified: trunk/src/dialogs/csvimportdlg.cpp
===================================================================
--- trunk/src/dialogs/csvimportdlg.cpp 2008-03-04 23:29:33 UTC (rev 46)
+++ trunk/src/dialogs/csvimportdlg.cpp 2008-03-05 16:20:31 UTC (rev 47)
@@ -60,10 +60,16 @@
const char* NOFIELD = "<NONE>";
CSVImportDlg::CSVImportDlg(QWidget *parent )
- : KDialogBase( KDialogBase::Tabbed, i18n("Import"),
- KDialogBase::Ok | KDialogBase::Close, KDialogBase::Ok, parent,false,true)
+ : KPageDialog( parent )
{
- setButtonOK( i18n("&Import"), i18n("Import the selected file into your tables.") );
+ setFaceType( KPageDialog::Tabbed );
+ setCaption( i18n("Import") );
+ setButtons( KDialog::Ok | KDialog::Close );
+ setDefaultButton( KDialog::Ok );
+ setModal( false );
+ showButtonSeparator( true );
+ setButtonText( KDialog::Ok, i18n("&Import") );
+ setButtonToolTip( KDialog::Ok, i18n("Import the selected file into your tables.") );
createPage1();
createPage2();
Modified: trunk/src/dialogs/csvimportdlg.h
===================================================================
--- trunk/src/dialogs/csvimportdlg.h 2008-03-04 23:29:33 UTC (rev 46)
+++ trunk/src/dialogs/csvimportdlg.h 2008-03-05 16:20:31 UTC (rev 47)
@@ -22,7 +22,7 @@
//Added by qt3to4:
#include <QFrame>
#include <QList>
-#include <kdialogbase.h>
+#include <kpagedialog.h>
class CSVFile;
class EncodingCombo;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|