summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/acquireimages/acquireimagedialog.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-18 06:46:40 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-18 06:46:40 +0000
commit7c19562ad065b6729bac8eb9b40dfe0452a72272 (patch)
tree33325d1e02ecc9ca614c7209296f8f796a1c3478 /kipi-plugins/acquireimages/acquireimagedialog.cpp
parenta65baa328fac0a1ce12971fef8d998ce7bfbe237 (diff)
downloadkipi-plugins-7c19562ad065b6729bac8eb9b40dfe0452a72272.tar.gz
kipi-plugins-7c19562ad065b6729bac8eb9b40dfe0452a72272.zip
TQt4 port kipi-plugins
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/libraries/kipi-plugins@1232561 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kipi-plugins/acquireimages/acquireimagedialog.cpp')
-rw-r--r--kipi-plugins/acquireimages/acquireimagedialog.cpp196
1 files changed, 98 insertions, 98 deletions
diff --git a/kipi-plugins/acquireimages/acquireimagedialog.cpp b/kipi-plugins/acquireimages/acquireimagedialog.cpp
index 830b2ad..a8529e6 100644
--- a/kipi-plugins/acquireimages/acquireimagedialog.cpp
+++ b/kipi-plugins/acquireimages/acquireimagedialog.cpp
@@ -34,26 +34,26 @@ extern "C"
#include <fcntl.h>
}
-// Include files for Qt
+// Include files for TQt
#undef Unsorted // x headers suck - make qdir.h work with --enable-final
-#include <qvbox.h>
-#include <qlayout.h>
-#include <qdir.h>
-#include <qwidget.h>
-#include <qlabel.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qstring.h>
-#include <qwhatsthis.h>
-#include <qtextedit.h>
-#include <qimage.h>
-#include <qpixmap.h>
-#include <qcombobox.h>
-#include <qlistbox.h>
-#include <qfile.h>
-#include <qapplication.h>
-#include <qvgroupbox.h>
+#include <tqvbox.h>
+#include <tqlayout.h>
+#include <tqdir.h>
+#include <tqwidget.h>
+#include <tqlabel.h>
+#include <tqpushbutton.h>
+#include <tqgroupbox.h>
+#include <tqstring.h>
+#include <tqwhatsthis.h>
+#include <tqtextedit.h>
+#include <tqimage.h>
+#include <tqpixmap.h>
+#include <tqcombobox.h>
+#include <tqlistbox.h>
+#include <tqfile.h>
+#include <tqapplication.h>
+#include <tqvgroupbox.h>
// Include files for KDE
@@ -101,9 +101,9 @@ namespace KIPIAcquireImagesPlugin
#define NETACCESS_WIDGET
#endif
-AcquireImageDialog::AcquireImageDialog( KIPI::Interface* interface, QWidget *parent, const QImage &img)
+AcquireImageDialog::AcquireImageDialog( KIPI::Interface* interface, TQWidget *tqparent, const TQImage &img)
: KDialogBase( IconList, i18n("Save Target Image Options"), Help|Ok|Cancel,
- Ok, parent, "AcquireImageDialog", true, false ), m_interface( interface )
+ Ok, tqparent, "AcquireImageDialog", true, false ), m_interface( interface )
{
KImageIO::registerFormats();
m_qimageScanned = img;
@@ -129,7 +129,7 @@ AcquireImageDialog::AcquireImageDialog( KIPI::Interface* interface, QWidget *par
m_helpButton = actionButton( Help );
KHelpMenu* helpMenu = new KHelpMenu(this, m_about, false);
helpMenu->menu()->removeItemAt(0);
- helpMenu->menu()->insertItem(i18n("Plugin Handbook"), this, SLOT(slotHelp()), 0, -1, 0);
+ helpMenu->menu()->insertItem(i18n("Plugin Handbook"), this, TQT_SLOT(slotHelp()), 0, -1, 0);
m_helpButton->setPopup( helpMenu->menu() );
}
@@ -175,48 +175,48 @@ void AcquireImageDialog::writeSettings(void)
void AcquireImageDialog::setupImageOptions(void)
{
- QString whatsThis;
+ TQString whatsThis;
page_setupImageOptions = addPage( i18n("Target Image"),
i18n("Target Image Options"),
BarIcon("image", KIcon::SizeMedium ) );
- QVBoxLayout *vlay = new QVBoxLayout( page_setupImageOptions, 0, spacingHint() );
+ TQVBoxLayout *vlay = new TQVBoxLayout( page_setupImageOptions, 0, spacingHint() );
//---------------------------------------------
- QGroupBox * groupBox1 = new QGroupBox( page_setupImageOptions );
+ TQGroupBox * groupBox1 = new TQGroupBox( page_setupImageOptions );
groupBox1->setFlat(false);
groupBox1->setTitle(i18n("File Name && Caption"));
- QWhatsThis::add( groupBox1, i18n("<p>The target image preview with the file name and caption.") );
- QGridLayout* grid2 = new QGridLayout( groupBox1, 3, 3 , 20, 10);
+ TQWhatsThis::add( groupBox1, i18n("<p>The target image preview with the file name and caption.") );
+ TQGridLayout* grid2 = new TQGridLayout( groupBox1, 3, 3 , 20, 10);
- m_ImageFileName = new QLabel( i18n("File name (without suffix):"), groupBox1);
+ m_ImageFileName = new TQLabel( i18n("File name (without suffix):"), groupBox1);
grid2->addMultiCellWidget(m_ImageFileName, 0, 0, 0, 3);
- m_FileName = new QLineEdit(i18n("acquired_image"), groupBox1);
- QWhatsThis::add( m_FileName, i18n("<p>Enter here the target image file name without suffix "
+ m_FileName = new TQLineEdit(i18n("acquired_image"), groupBox1);
+ TQWhatsThis::add( m_FileName, i18n("<p>Enter here the target image file name without suffix "
"(that will be automatically added to the file name according "
"to the file-format option.)") );
m_ImageFileName->setBuddy(m_FileName);
grid2->addMultiCellWidget(m_FileName, 1, 1, 0, 3);
- m_ImageComments = new QLabel( i18n("Caption:"), groupBox1);
+ m_ImageComments = new TQLabel( i18n("Caption:"), groupBox1);
grid2->addMultiCellWidget(m_ImageComments, 2, 2, 0, 3);
- m_CommentsEdit = new QTextEdit(groupBox1);
+ m_CommentsEdit = new TQTextEdit(groupBox1);
m_CommentsEdit->setMaximumHeight( 200 );
- QWhatsThis::add( m_CommentsEdit, i18n("<p>Enter here the target image's caption.") );
+ TQWhatsThis::add( m_CommentsEdit, i18n("<p>Enter here the target image's caption.") );
grid2->addMultiCellWidget(m_CommentsEdit, 3, 3, 0, 2);
- m_preview = new QLabel( groupBox1, "preview" );
+ m_preview = new TQLabel( groupBox1, "preview" );
m_preview->setFixedHeight( 120 );
- m_preview->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter );
- m_preview->setSizePolicy( QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ) );
- QWhatsThis::add( m_preview, i18n( "<p>The preview of the target image." ) );
+ m_preview->tqsetAlignment( TQt::AlignHCenter | TQt::AlignVCenter );
+ m_preview->tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred ) );
+ TQWhatsThis::add( m_preview, i18n( "<p>The preview of the target image." ) );
m_preview->setScaledContents( false );
- QImage scanned = m_qimageScanned.smoothScale((m_qimageScanned.width() * 100) / m_qimageScanned.height(), 100);
- QPixmap pix;
+ TQImage scanned = m_qimageScanned.smoothScale((m_qimageScanned.width() * 100) / m_qimageScanned.height(), 100);
+ TQPixmap pix;
pix.convertFromImage(scanned);
m_preview->setPixmap(pix);
grid2->addMultiCellWidget(m_preview, 3, 3, 3, 3);
@@ -225,14 +225,14 @@ void AcquireImageDialog::setupImageOptions(void)
//---------------------------------------------
- QGroupBox * groupBox2 = new QGroupBox( i18n("Saving Options"), page_setupImageOptions );
+ TQGroupBox * groupBox2 = new TQGroupBox( i18n("Saving Options"), page_setupImageOptions );
groupBox2->setColumnLayout(0, Qt::Vertical );
- groupBox2->layout()->setSpacing( 6 );
- groupBox2->layout()->setMargin( 11 );
- QWhatsThis::add( groupBox2, i18n("<p>The saving options of the target image.") );
+ groupBox2->tqlayout()->setSpacing( 6 );
+ groupBox2->tqlayout()->setMargin( 11 );
+ TQWhatsThis::add( groupBox2, i18n("<p>The saving options of the target image.") );
- QVBoxLayout * groupBox2Layout = new QVBoxLayout( groupBox2->layout() );
- groupBox2Layout->setAlignment( Qt::AlignTop );
+ TQVBoxLayout * groupBox2Layout = new TQVBoxLayout( groupBox2->tqlayout() );
+ groupBox2Layout->tqsetAlignment( TQt::AlignTop );
m_imageCompression = new KIntNumInput(75, groupBox2);
m_imageCompression->setRange(1, 100, 1, true );
@@ -244,13 +244,13 @@ void AcquireImageDialog::setupImageOptions(void)
"<b>75</b>: low compression (default value)<p>"
"<b>100</b>: no compression");
- QWhatsThis::add( m_imageCompression, whatsThis);
+ TQWhatsThis::add( m_imageCompression, whatsThis);
groupBox2Layout->addWidget( m_imageCompression );
- QHBoxLayout *hlay12 = new QHBoxLayout( );
+ TQHBoxLayout *hlay12 = new TQHBoxLayout( );
groupBox2Layout->addLayout( hlay12 );
- m_imagesFormat = new QComboBox(false, groupBox2);
+ m_imagesFormat = new TQComboBox(false, groupBox2);
m_imagesFormat->insertItem("JPEG");
m_imagesFormat->insertItem("PNG");
m_imagesFormat->insertItem("TIFF");
@@ -279,9 +279,9 @@ void AcquireImageDialog::setupImageOptions(void)
"1-, 4-, 8-, or 24-bits in size. Data may be stored raw or compressed using a 4-bit or "
"8-bit RLE data compression algorithm. BMP is an excellent choice for a simple bitmap "
"format which supports a wide range of RGB image data.");
- QWhatsThis::add( m_imagesFormat, whatsThis );
+ TQWhatsThis::add( m_imagesFormat, whatsThis );
- m_labelImageFormat = new QLabel( i18n("Image file format:"), groupBox2);
+ m_labelImageFormat = new TQLabel( i18n("Image file format:"), groupBox2);
hlay12->addWidget( m_labelImageFormat );
m_labelImageFormat->setBuddy( m_imagesFormat );
hlay12->addStretch( 1 );
@@ -292,62 +292,62 @@ void AcquireImageDialog::setupImageOptions(void)
//---------------------------------------------
- connect(m_imagesFormat, SIGNAL(activated(const QString &)),
- this, SLOT(slotImageFormatChanged(const QString &)));
+ connect(m_imagesFormat, TQT_SIGNAL(activated(const TQString &)),
+ this, TQT_SLOT(slotImageFormatChanged(const TQString &)));
}
void AcquireImageDialog::setupAlbumsList(void)
{
- QString whatsThis;
+ TQString whatsThis;
page_setupAlbumsList = addPage( i18n("Selection"),
i18n("Album selection"),
BarIcon("folder_image", KIcon::SizeMedium ) );
- QVBoxLayout *vlay = new QVBoxLayout( page_setupAlbumsList, 0, spacingHint() );
+ TQVBoxLayout *vlay = new TQVBoxLayout( page_setupAlbumsList, 0, spacingHint() );
//---------------------------------------------
- QVGroupBox * groupBox1 = new QVGroupBox( i18n("Select Folder in Which to Save Target Image"),
+ TQVGroupBox * groupBox1 = new TQVGroupBox( i18n("Select Folder in Which to Save Target Image"),
page_setupAlbumsList );
m_uploadPath = new KIPI::UploadWidget( m_interface, groupBox1, "m_uploadPath" );
- QWidget* w = new QWidget( groupBox1 );
- QHBoxLayout* hlay = new QHBoxLayout( w, 6 );
+ TQWidget* w = new TQWidget( groupBox1 );
+ TQHBoxLayout* hlay = new TQHBoxLayout( w, 6 );
hlay->addStretch( 1 );
- m_addNewAlbumButton = new QPushButton (i18n( "&Add New Folder"), w, "PushButton_AddNewAlbum");
+ m_addNewAlbumButton = new TQPushButton (i18n( "&Add New Folder"), w, "PushButton_AddNewAlbum");
hlay->addWidget( m_addNewAlbumButton );
- QWhatsThis::add( m_addNewAlbumButton, i18n( "<p>Add a new folder."));
+ TQWhatsThis::add( m_addNewAlbumButton, i18n( "<p>Add a new folder."));
vlay->addWidget( groupBox1 );
//---------------------------------------------
- QGroupBox * groupBox2 = new QGroupBox( i18n("Album Description"), page_setupAlbumsList );
+ TQGroupBox * groupBox2 = new TQGroupBox( i18n("Album Description"), page_setupAlbumsList );
groupBox2->setColumnLayout(0, Qt::Vertical );
- groupBox2->layout()->setSpacing( 6 );
- groupBox2->layout()->setMargin( 11 );
- QWhatsThis::add( groupBox2, i18n("<p>The description of the current Album in the selection list.") );
+ groupBox2->tqlayout()->setSpacing( 6 );
+ groupBox2->tqlayout()->setMargin( 11 );
+ TQWhatsThis::add( groupBox2, i18n("<p>The description of the current Album in the selection list.") );
- QVBoxLayout * groupBox2Layout = new QVBoxLayout( groupBox2->layout() );
- groupBox2Layout->setAlignment( Qt::AlignTop );
+ TQVBoxLayout * groupBox2Layout = new TQVBoxLayout( groupBox2->tqlayout() );
+ groupBox2Layout->tqsetAlignment( TQt::AlignTop );
m_AlbumComments = new KSqueezedTextLabel( groupBox2 );
- m_AlbumComments->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
+ m_AlbumComments->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox2Layout->addWidget( m_AlbumComments );
m_AlbumCollection = new KSqueezedTextLabel( groupBox2 );
- m_AlbumCollection->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
+ m_AlbumCollection->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox2Layout->addWidget( m_AlbumCollection );
m_AlbumDate = new KSqueezedTextLabel( groupBox2 );
- m_AlbumDate->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
+ m_AlbumDate->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox2Layout->addWidget( m_AlbumDate );
m_AlbumItems = new KSqueezedTextLabel( groupBox2 );
- m_AlbumItems->setAlignment( int( QLabel::WordBreak | QLabel::AlignVCenter ) );
+ m_AlbumItems->tqsetAlignment( int( TQLabel::WordBreak | TQLabel::AlignVCenter ) );
groupBox2Layout->addWidget( m_AlbumItems );
vlay->addWidget( groupBox2 );
@@ -359,11 +359,11 @@ void AcquireImageDialog::setupAlbumsList(void)
//---------------------------------------------
- connect(m_addNewAlbumButton, SIGNAL(clicked()),
- m_uploadPath, SLOT(mkdir()));
+ connect(m_addNewAlbumButton, TQT_SIGNAL(clicked()),
+ m_uploadPath, TQT_SLOT(mkdir()));
- connect(m_uploadPath, SIGNAL( folderItemSelected( const KURL & ) ),
- this, SLOT( slotAlbumSelected( const KURL & )));
+ connect(m_uploadPath, TQT_SIGNAL( folderItemSelected( const KURL & ) ),
+ this, TQT_SLOT( slotAlbumSelected( const KURL & )));
//---------------------------------------------
@@ -372,9 +372,9 @@ void AcquireImageDialog::setupAlbumsList(void)
void AcquireImageDialog::slotAlbumSelected( const KURL &url )
{
- QString comments, category, date, items;
- QValueList<KIPI::ImageCollection> albums = m_interface->allAlbums();
- QValueList<KIPI::ImageCollection>::Iterator albumIt;
+ TQString comments, category, date, items;
+ TQValueList<KIPI::ImageCollection> albums = m_interface->allAlbums();
+ TQValueList<KIPI::ImageCollection>::Iterator albumIt;
for( albumIt = albums.begin() ; albumIt != albums.end() ; ++albumIt )
{
@@ -390,10 +390,10 @@ void AcquireImageDialog::slotAlbumSelected( const KURL &url )
items.setNum((*albumIt).images().count());
}
- m_AlbumComments->setText( i18n("Caption: %1").arg(comments) );
- m_AlbumCollection->setText( i18n("Collection: %1").arg(category) );
- m_AlbumDate->setText( i18n("Date: %1").arg(date) );
- m_AlbumItems->setText( i18n("Items: %1").arg( items ) );
+ m_AlbumComments->setText( i18n("Caption: %1").tqarg(comments) );
+ m_AlbumCollection->setText( i18n("Collection: %1").tqarg(category) );
+ m_AlbumDate->setText( i18n("Date: %1").tqarg(date) );
+ m_AlbumItems->setText( i18n("Items: %1").tqarg( items ) );
}
void AcquireImageDialog::slotOk()
@@ -419,20 +419,20 @@ void AcquireImageDialog::slotOk()
writeSettings();
// Get all scanned image information.
- QString imageFormat = m_imagesFormat->currentText();
+ TQString imageFormat = m_imagesFormat->currentText();
int imageCompression = m_imageCompression->value();
- QString Commentsimg = m_CommentsEdit->text();
+ TQString Commentsimg = m_CommentsEdit->text();
// Find an unique url
- QString fileName = m_FileName->text();
- QString ext = extension(imageFormat);
+ TQString fileName = m_FileName->text();
+ TQString ext = extension(imageFormat);
url.setFileName(fileName + ext);
if (KIO::NetAccess::exists(url, false NETACCESS_WIDGET))
{
for (int idx = 1; idx < 100 ; ++idx)
{
- url.setFileName(QString("%1_%2%3").arg(fileName).arg(idx).arg(ext));
+ url.setFileName(TQString("%1_%2%3").tqarg(fileName).tqarg(idx).tqarg(ext));
kdDebug(51001) << "File already exist. Try to fixed target Url to: " << url.prettyURL() << endl;
if (!KIO::NetAccess::exists(url, false NETACCESS_WIDGET))
@@ -445,7 +445,7 @@ void AcquireImageDialog::slotOk()
// Save file
KTempFile tmp;
tmp.setAutoDelete(true);
- QString imagePath;
+ TQString imagePath;
if (url.isLocalFile())
{
imagePath=url.path();
@@ -462,7 +462,7 @@ void AcquireImageDialog::slotOk()
}
else if (imageFormat=="TIFF")
{
- ok = QImageToTiff(m_qimageScanned, imagePath);
+ ok = TQImageToTiff(m_qimageScanned, imagePath);
}
else
{
@@ -471,7 +471,7 @@ void AcquireImageDialog::slotOk()
if ( !ok )
{
- KMessageBox::error(this, i18n("Cannot write image file \"%1\".").arg(imagePath));
+ KMessageBox::error(this, i18n("Cannot write image file \"%1\".").tqarg(imagePath));
return;
}
@@ -480,18 +480,18 @@ void AcquireImageDialog::slotOk()
{
if (!KIO::NetAccess::upload(imagePath, url NETACCESS_WIDGET))
{
- KMessageBox::error(this, i18n("Could not upload image to \"%1\".").arg(url.prettyURL()));
+ KMessageBox::error(this, i18n("Could not upload image to \"%1\".").tqarg(url.prettyURL()));
return;
}
}
// Save the comments for this image.
- QString err;
+ TQString err;
ok = m_interface->addImage( url, err );
if ( !ok )
{
KMessageBox::error(this, i18n("<qt>Error when informing the application about the new image. "
- "The error was: %1</qt>" ).arg( err ) );
+ "The error was: %1</qt>" ).tqarg( err ) );
return;
}
@@ -504,7 +504,7 @@ void AcquireImageDialog::slotOk()
delete this;
}
-void AcquireImageDialog::slotImageFormatChanged(const QString &string)
+void AcquireImageDialog::slotImageFormatChanged(const TQString &string)
{
if ( string == "JPEG" || string == "PNG" )
m_imageCompression->setEnabled(true);
@@ -512,7 +512,7 @@ void AcquireImageDialog::slotImageFormatChanged(const QString &string)
m_imageCompression->setEnabled(false);
}
-QString AcquireImageDialog::extension(const QString& imageFormat)
+TQString AcquireImageDialog::extension(const TQString& imageFormat)
{
if (imageFormat == "PNG")
return ".png";
@@ -533,14 +533,14 @@ QString AcquireImageDialog::extension(const QString& imageFormat)
return "";
}
-bool AcquireImageDialog::QImageToTiff(const QImage& image, const QString& dst)
+bool AcquireImageDialog::TQImageToTiff(const TQImage& image, const TQString& dst)
{
TIFF *tif;
unsigned char *data;
int x, y;
- QRgb rgb;
+ TQRgb rgb;
- tif = TIFFOpen(QFile::encodeName(dst).data(), "w");
+ tif = TIFFOpen(TQFile::encodeName(dst).data(), "w");
if ( tif )
{
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, image.width());
@@ -564,9 +564,9 @@ bool AcquireImageDialog::QImageToTiff(const QImage& image, const QString& dst)
for (x = 0 ; x < image.width() ; ++x)
{
rgb = *((uint *)image.scanLine(y) + x);
- *(dptr++) = qRed(rgb);
- *(dptr++) = qGreen(rgb);
- *(dptr++) = qBlue(rgb);
+ *(dptr++) = tqRed(rgb);
+ *(dptr++) = tqGreen(rgb);
+ *(dptr++) = tqBlue(rgb);
}
TIFFWriteScanline(tif, data, y, 0);