diff options
Diffstat (limited to 'src/gui/imagewidget.cpp')
-rw-r--r-- | src/gui/imagewidget.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/gui/imagewidget.cpp b/src/gui/imagewidget.cpp index 92f75c3..575c734 100644 --- a/src/gui/imagewidget.cpp +++ b/src/gui/imagewidget.cpp @@ -24,12 +24,12 @@ #include <kurldrag.h> #include <kmessagebox.h> -#include <qwmatrix.h> -#include <qlayout.h> -#include <qlabel.h> -#include <qcheckbox.h> -#include <qdragobject.h> -#include <qapplication.h> // needed for drag distance +#include <tqwmatrix.h> +#include <tqlayout.h> +#include <tqlabel.h> +#include <tqcheckbox.h> +#include <tqdragobject.h> +#include <tqapplication.h> // needed for drag distance namespace { static const uint IMAGE_WIDGET_BUTTON_MARGIN = 8; @@ -40,28 +40,28 @@ namespace { using Tellico::GUI::ImageWidget; -ImageWidget::ImageWidget(QWidget* parent_, const char* name_) : QWidget(parent_, name_) { - QHBoxLayout* l = new QHBoxLayout(this); +ImageWidget::ImageWidget(TQWidget* tqparent_, const char* name_) : TQWidget(tqparent_, name_) { + TQHBoxLayout* l = new TQHBoxLayout(this); l->setMargin(IMAGE_WIDGET_BUTTON_MARGIN); - m_label = new QLabel(this); - m_label->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored)); - m_label->setFrameStyle(QFrame::Panel | QFrame::Sunken); - m_label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); + m_label = new TQLabel(this); + m_label->tqsetSizePolicy(TQSizePolicy(TQSizePolicy::Ignored, TQSizePolicy::Ignored)); + m_label->setFrameStyle(TQFrame::Panel | TQFrame::Sunken); + m_label->tqsetAlignment(TQt::AlignHCenter | TQt::AlignVCenter); l->addWidget(m_label, 1); l->addSpacing(IMAGE_WIDGET_BUTTON_MARGIN); - QVBoxLayout* boxLayout = new QVBoxLayout(l); + TQVBoxLayout* boxLayout = new TQVBoxLayout(l); boxLayout->addStretch(1); - KButtonBox* box = new KButtonBox(this, Vertical); - box->addButton(i18n("Select Image..."), this, SLOT(slotGetImage())); - box->addButton(i18n("Clear"), this, SLOT(slotClear())); - box->layout(); + KButtonBox* box = new KButtonBox(this,Qt::Vertical); + box->addButton(i18n("Select Image..."), TQT_TQOBJECT(this), TQT_SLOT(slotGetImage())); + box->addButton(i18n("Clear"), TQT_TQOBJECT(this), TQT_SLOT(slotClear())); + box->tqlayout(); boxLayout->addWidget(box); boxLayout->addSpacing(8); - m_cbLinkOnly = new QCheckBox(i18n("Save link only"), this); - connect(m_cbLinkOnly, SIGNAL(clicked()), SLOT(slotLinkOnlyClicked())); + m_cbLinkOnly = new TQCheckBox(i18n("Save link only"), this); + connect(m_cbLinkOnly, TQT_SIGNAL(clicked()), TQT_SLOT(slotLinkOnlyClicked())); boxLayout->addWidget(m_cbLinkOnly); boxLayout->addStretch(1); @@ -71,7 +71,7 @@ ImageWidget::ImageWidget(QWidget* parent_, const char* name_) : QWidget(parent_, setAcceptDrops(true); } -void ImageWidget::setImage(const QString& id_) { +void ImageWidget::setImage(const TQString& id_) { if(id_.isEmpty()) { slotClear(); return; @@ -83,7 +83,7 @@ void ImageWidget::setImage(const QString& id_) { m_cbLinkOnly->setEnabled(link); // if we're using a link, then the original URL _is_ the id m_originalURL = link ? id_ : KURL(); - m_scaled = QPixmap(); + m_scaled = TQPixmap(); scale(); update(); @@ -95,8 +95,8 @@ void ImageWidget::setLinkOnlyChecked(bool link_) { void ImageWidget::slotClear() { // m_image = Data::Image(); - m_imageID = QString(); - m_pixmap = QPixmap(); + m_imageID = TQString(); + m_pixmap = TQPixmap(); m_scaled = m_pixmap; m_originalURL = KURL(); @@ -123,7 +123,7 @@ void ImageWidget::scale() { newHeight = static_cast<int>(static_cast<double>(ph)*ww/static_cast<double>(pw)); } - QWMatrix wm; + TQWMatrix wm; wm.scale(static_cast<double>(newWidth)/pw, static_cast<double>(newHeight)/ph); m_scaled = m_pixmap.xForm(wm); } else { @@ -132,7 +132,7 @@ void ImageWidget::scale() { m_label->setPixmap(m_scaled); } -void ImageWidget::resizeEvent(QResizeEvent *) { +void ImageWidget::resizeEvent(TQResizeEvent *) { if(m_pixmap.isNull()) { return; } @@ -142,7 +142,7 @@ void ImageWidget::resizeEvent(QResizeEvent *) { } void ImageWidget::slotGetImage() { - KURL url = KFileDialog::getImageOpenURL(QString::null, this); + KURL url = KFileDialog::getImageOpenURL(TQString(), this); if(url.isEmpty() || !url.isValid()) { return; } @@ -168,53 +168,53 @@ void ImageWidget::slotLinkOnlyClicked() { // so it needs to be added to the cache all over again // probably could do this without downloading the image all over again, // but I'm not going to do that right now - const QString& id = ImageFactory::addImage(m_originalURL, false, KURL(), link); + const TQString& id = ImageFactory::addImage(m_originalURL, false, KURL(), link); // same image, so no need to call setImage m_imageID = id; emit signalModified(); } -void ImageWidget::mousePressEvent(QMouseEvent* event_) { +void ImageWidget::mousePressEvent(TQMouseEvent* event_) { // Only interested in LMB if(event_->button() == Qt::LeftButton) { // Store the position of the mouse press. // check if position is inside the label - if(m_label->geometry().contains(event_->pos())) { + if(m_label->tqgeometry().tqcontains(event_->pos())) { m_dragStart = event_->pos(); } else { - m_dragStart = QPoint(); + m_dragStart = TQPoint(); } } } -void ImageWidget::mouseMoveEvent(QMouseEvent* event_) { - int delay = QApplication::startDragDistance(); +void ImageWidget::mouseMoveEvent(TQMouseEvent* event_) { + int delay = TQApplication::startDragDistance(); // Only interested in LMB if(event_->state() & Qt::LeftButton) { // only allow drag is the image is non-null, and the drag start point isn't null and the user dragged far enough if(!m_imageID.isEmpty() && !m_dragStart.isNull() && (m_dragStart - event_->pos()).manhattanLength() > delay) { const Data::Image& img = ImageFactory::imageById(m_imageID); if(!img.isNull()) { - QImageDrag* drag = new QImageDrag(img, this); + TQImageDrag* drag = new TQImageDrag(img, this); drag->dragCopy(); } } } } -void ImageWidget::dragEnterEvent(QDragEnterEvent* event_) { - event_->accept(KURLDrag::canDecode(event_) || QImageDrag::canDecode(event_) || QTextDrag::canDecode(event_)); +void ImageWidget::dragEnterEvent(TQDragEnterEvent* event_) { + event_->accept(KURLDrag::canDecode(event_) || TQImageDrag::canDecode(event_) || TQTextDrag::canDecode(event_)); } -void ImageWidget::dropEvent(QDropEvent* event_) { - QImage image; +void ImageWidget::dropEvent(TQDropEvent* event_) { + TQImage image; KURL::List urls; - QString text; + TQString text; - GUI::CursorSaver cs(Qt::busyCursor); - if(QImageDrag::decode(event_, image)) { - // Qt reads PNG data by default - const QString& id = ImageFactory::addImage(image, QString::fromLatin1("PNG")); + GUI::CursorSaver cs(TQt::busyCursor); + if(TQImageDrag::decode(event_, image)) { + // TQt reads PNG data by default + const TQString& id = ImageFactory::addImage(image, TQString::tqfromLatin1("PNG")); if(!id.isEmpty() && id != m_imageID) { setImage(id); emit signalModified(); @@ -230,7 +230,7 @@ void ImageWidget::dropEvent(QDropEvent* event_) { } // kdDebug() << "ImageWidget::dropEvent() - " << url.prettyURL() << endl; loadImage(url); - } else if(QTextDrag::decode(event_, text)) { + } else if(TQTextDrag::decode(event_, text)) { KURL url(text); if(url.isEmpty() || !url.isValid()) { return; @@ -244,7 +244,7 @@ void ImageWidget::loadImage(const KURL& url_) { GUI::CursorSaver cs; // if we're linking only, then we want the image id to be the same as the url - const QString& id = ImageFactory::addImage(url_, false, KURL(), link); + const TQString& id = ImageFactory::addImage(url_, false, KURL(), link); if(id != m_imageID) { setImage(id); emit signalModified(); |