diff options
Diffstat (limited to 'src/linklabel.cpp')
-rw-r--r-- | src/linklabel.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/linklabel.cpp b/src/linklabel.cpp index c2060f7..5b66097 100644 --- a/src/linklabel.cpp +++ b/src/linklabel.cpp @@ -20,7 +20,7 @@ #include <tqlabel.h> #include <kurl.h> -#include <tqlayout.h> +#include <layout.h> #include <kiconloader.h> #include <tqcursor.h> #include <klocale.h> @@ -132,7 +132,7 @@ LinkLook* LinkLook::lookForURL(const KURL &url) TQString LinkLook::toCSS(const TQString &cssClass, const TQColor &defaultTextColor) const { // Set the link class: - TQString css = TQString(" .%1 a { display: block; width: 100%;").tqarg(cssClass); + TQString css = TQString(" .%1 a { display: block; width: 100%;").arg(cssClass); if (underlineOutside()) css += " text-decoration: underline;"; else @@ -142,7 +142,7 @@ TQString LinkLook::toCSS(const TQString &cssClass, const TQColor &defaultTextCol if (m_bold == true) css += " font-weight: bold;"; TQColor textColor = (color().isValid() || m_useLinkColor ? effectiveColor() : defaultTextColor); - css += TQString(" color: %1; }\n").tqarg(textColor.name()); + css += TQString(" color: %1; }\n").arg(textColor.name()); // Set the hover state class: TQString hover; @@ -153,12 +153,12 @@ TQString LinkLook::toCSS(const TQString &cssClass, const TQColor &defaultTextCol if (effectiveHoverColor() != effectiveColor()) { if (!hover.isEmpty()) hover += " "; - hover += TQString("color: %4;").tqarg(effectiveHoverColor().name()); + hover += TQString("color: %4;").arg(effectiveHoverColor().name()); } // But include it only if it contain a different style than non-hover state: if (!hover.isEmpty()) - css += TQString(" .%1 a:hover { %2 }\n").tqarg(cssClass, hover); + css += TQString(" .%1 a:hover { %2 }\n").arg(cssClass, hover); return css; } @@ -231,7 +231,7 @@ void LinkLabel::setLook(LinkLook *look) // FIXME: called externaly (so, without font.setUnderline(look->underlineOutside()); font.setItalic(look->italic()); m_title->setFont(font); - m_title->setPaletteForegroundColor( m_isSelected ? KApplication::tqpalette().active().highlightedText() : look->effectiveColor() ); + m_title->setPaletteForegroundColor( m_isSelected ? KApplication::palette().active().highlightedText() : look->effectiveColor() ); m_icon->setShown( m_icon->pixmap() && ! m_icon->pixmap()->isNull() ); @@ -246,7 +246,7 @@ void LinkLabel::setAlign(int hAlign, int vAlign) if (!m_look) return; - // Define tqalignment flags : + // Define alignment flags : //FIXME TODO: Use directly flags ! int hFlag, vFlag, wBreak; switch (hAlign) { @@ -269,19 +269,19 @@ void LinkLabel::setAlign(int hAlign, int vAlign) m_layout->remove(m_title); m_layout->removeItem(m_spacer2); - // Otherwise, tqminimumSize will be incoherent (last size ? ) + // Otherwise, minimumSize will be incoherent (last size ? ) m_layout->setResizeMode(TQLayout::Minimum); // And re-populate the widget with the appropriates things and order bool addSpacers = hAlign == 1; m_layout->setDirection(TQBoxLayout::LeftToRight); - //m_title->tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Maximum/*Expanding*/, 0, 0, false) ); - m_icon->tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Preferred/*Expanding*/, 0, 0, false) ); + //m_title->setSizePolicy( TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Maximum/*Expanding*/, 0, 0, false) ); + m_icon->setSizePolicy( TQSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Preferred/*Expanding*/, 0, 0, false) ); m_spacer1->changeSize( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Preferred/*Expanding*/ ); m_spacer2->changeSize( 0, 0, TQSizePolicy::Expanding, TQSizePolicy::Preferred/*Expanding*/ ); - m_icon->tqsetAlignment( hFlag | vFlag ); - m_title->tqsetAlignment( hFlag | vFlag | wBreak ); + m_icon->setAlignment( hFlag | vFlag ); + m_title->setAlignment( hFlag | vFlag | wBreak ); if ( addSpacers && (vAlign != 0) || (m_title->text().isEmpty() && hAlign == 2) ) m_layout->addItem(m_spacer1); @@ -323,7 +323,7 @@ void LinkLabel::setSelected(bool selected) { m_isSelected = selected; if (selected) - m_title->setPaletteForegroundColor(KApplication::tqpalette().active().highlightedText()); + m_title->setPaletteForegroundColor(KApplication::palette().active().highlightedText()); else if (m_isHovered) m_title->setPaletteForegroundColor(m_look->effectiveHoverColor()); else @@ -392,7 +392,7 @@ void LinkDisplay::setLink(const TQString &title, const TQString &icon, const TQP m_font = font; // "Constants": - int BUTTON_MARGIN = kapp->tqstyle().tqpixelMetric(TQStyle::PM_ButtonMargin); + int BUTTON_MARGIN = kapp->tqstyle().pixelMetric(TQStyle::PM_ButtonMargin); int LINK_MARGIN = BUTTON_MARGIN + 2; // Recompute m_minWidth: @@ -422,15 +422,15 @@ void LinkDisplay::setWidth(int width) /** Paint on @p painter * in (@p x, @p y, @p width, @p height) - * using @p tqcolorGroup for the button drawing (if @p isHovered) + * using @p colorGroup for the button drawing (if @p isHovered) * and the LinkLook color() for the text, - * unless [the LinkLook !color.isValid() and it does not useLinkColor()] or [@p isDefaultColor is false]: in this case it will use @p tqcolorGroup.text(). + * unless [the LinkLook !color.isValid() and it does not useLinkColor()] or [@p isDefaultColor is false]: in this case it will use @p colorGroup.text(). * It will draw the button if @p isIconButtonHovered. */ -void LinkDisplay::paint(TQPainter *painter, int x, int y, int width, int height, const TQColorGroup &tqcolorGroup, +void LinkDisplay::paint(TQPainter *painter, int x, int y, int width, int height, const TQColorGroup &colorGroup, bool isDefaultColor, bool isSelected, bool isHovered, bool isIconButtonHovered) const { - int BUTTON_MARGIN = kapp->tqstyle().tqpixelMetric(TQStyle::PM_ButtonMargin); + int BUTTON_MARGIN = kapp->tqstyle().pixelMetric(TQStyle::PM_ButtonMargin); int LINK_MARGIN = BUTTON_MARGIN + 2; TQPixmap pixmap; @@ -450,7 +450,7 @@ void LinkDisplay::paint(TQPainter *painter, int x, int y, int width, int height, // Draw the button (if any) and the icon: if (isHovered) kapp->tqstyle().tqdrawPrimitive(TQStyle::PE_ButtonCommand, painter, TQRect(-1, -1, iconPreviewWidth + 2*BUTTON_MARGIN, height + 2), - tqcolorGroup, TQStyle::Style_Enabled | (isIconButtonHovered ? TQStyle::Style_MouseOver : 0)); + colorGroup, TQStyle::Style_Enabled | (isIconButtonHovered ? TQStyle::Style_MouseOver : 0)); painter->drawPixmap(x + BUTTON_MARGIN - 1 + pixmapX, y + pixmapY, pixmap); // Figure out the text color: @@ -459,7 +459,7 @@ void LinkDisplay::paint(TQPainter *painter, int x, int y, int width, int height, else if (isIconButtonHovered) painter->setPen(m_look->effectiveHoverColor()); else if (!isDefaultColor || (!m_look->color().isValid() && !m_look->useLinkColor())) // If the color is FORCED or if the link color default to the text color: - painter->setPen(tqcolorGroup.text()); + painter->setPen(colorGroup.text()); else painter->setPen(m_look->effectiveColor()); // Draw the text: @@ -468,14 +468,14 @@ void LinkDisplay::paint(TQPainter *painter, int x, int y, int width, int height, TQt::AlignAuto | TQt::AlignVCenter | TQt::WordBreak, m_title); } -TQPixmap LinkDisplay::feedbackPixmap(int width, int height, const TQColorGroup &tqcolorGroup, bool isDefaultColor) +TQPixmap LinkDisplay::feedbackPixmap(int width, int height, const TQColorGroup &colorGroup, bool isDefaultColor) { int theWidth = TQMIN(width, maxWidth()); int theHeight = TQMIN(height, heightForWidth(theWidth)); TQPixmap pixmap(theWidth, theHeight); - pixmap.fill(tqcolorGroup.background()); + pixmap.fill(colorGroup.background()); TQPainter painter(&pixmap); - paint(&painter, 0, 0, theWidth, theHeight, tqcolorGroup, isDefaultColor, + paint(&painter, 0, 0, theWidth, theHeight, colorGroup, isDefaultColor, /*isSelected=*/false, /*isHovered=*/false, /*isIconButtonHovered=*/false); painter.end(); return pixmap; @@ -483,7 +483,7 @@ TQPixmap LinkDisplay::feedbackPixmap(int width, int height, const TQColorGroup & bool LinkDisplay::iconButtonAt(const TQPoint &pos) const { - int BUTTON_MARGIN = kapp->tqstyle().tqpixelMetric(TQStyle::PM_ButtonMargin); + int BUTTON_MARGIN = kapp->tqstyle().pixelMetric(TQStyle::PM_ButtonMargin); // int LINK_MARGIN = BUTTON_MARGIN + 2; int iconPreviewWidth = TQMAX(m_look->iconSize(), (m_look->previewEnabled() ? m_preview.width() : 0)); @@ -492,7 +492,7 @@ bool LinkDisplay::iconButtonAt(const TQPoint &pos) const TQRect LinkDisplay::iconButtonRect() const { - int BUTTON_MARGIN = kapp->tqstyle().tqpixelMetric(TQStyle::PM_ButtonMargin); + int BUTTON_MARGIN = kapp->tqstyle().pixelMetric(TQStyle::PM_ButtonMargin); // int LINK_MARGIN = BUTTON_MARGIN + 2; int iconPreviewWidth = TQMAX(m_look->iconSize(), (m_look->previewEnabled() ? m_preview.width() : 0)); @@ -517,7 +517,7 @@ TQFont LinkDisplay::labelFont(TQFont font, bool isIconButtonHovered) const int LinkDisplay::heightForWidth(int width) const { - int BUTTON_MARGIN = kapp->tqstyle().tqpixelMetric(TQStyle::PM_ButtonMargin); + int BUTTON_MARGIN = kapp->tqstyle().pixelMetric(TQStyle::PM_ButtonMargin); int LINK_MARGIN = BUTTON_MARGIN + 2; int iconPreviewWidth = TQMAX(m_look->iconSize(), (m_look->previewEnabled() ? m_preview.width() : 0)); int iconPreviewHeight = TQMAX(m_look->iconSize(), (m_look->previewEnabled() ? m_preview.height() : 0)); @@ -540,16 +540,16 @@ TQString LinkDisplay::toHtml(HTMLExporter *exporter, const KURL &url, const TQSt TQString fullPath = exporter->iconsFolderPath + fileName; m_preview.save(fullPath, "PNG"); linkIcon = TQString("<img src=\"%1\" width=\"%2\" height=\"%3\" alt=\"\">") - .tqarg(exporter->iconsFolderName + fileName, TQString::number(m_preview.width()), TQString::number(m_preview.height())); + .arg(exporter->iconsFolderName + fileName, TQString::number(m_preview.width()), TQString::number(m_preview.height())); } else { linkIcon = exporter->iconsFolderName + exporter->copyIcon(m_icon, m_look->iconSize()); linkIcon = TQString("<img src=\"%1\" width=\"%2\" height=\"%3\" alt=\"\">") - .tqarg(linkIcon, TQString::number(m_look->iconSize()), TQString::number(m_look->iconSize())); + .arg(linkIcon, TQString::number(m_look->iconSize()), TQString::number(m_look->iconSize())); } TQString linkTitle = Tools::textToHTMLWithoutP(title.isEmpty() ? m_title : title); - return TQString("<a href=\"%1\">%2 %3</a>").tqarg(url.prettyURL(), linkIcon, linkTitle); + return TQString("<a href=\"%1\">%2 %3</a>").arg(url.prettyURL(), linkIcon, linkTitle); } /** LinkLookEditWidget **/ @@ -559,15 +559,15 @@ LinkLookEditWidget::LinkLookEditWidget(KCModule *module, const TQString exTitle, : TQWidget(parent, name, fl) { TQLabel *label; - TQVBoxLayout *tqlayout = new TQVBoxLayout(this, KDialogBase::marginHint(), KDialogBase::spacingHint()); + TQVBoxLayout *layout = new TQVBoxLayout(this, KDialogBase::marginHint(), KDialogBase::spacingHint()); m_italic = new TQCheckBox(i18n("I&talic"), this); - tqlayout->addWidget(m_italic); + layout->addWidget(m_italic); m_bold = new TQCheckBox(i18n("&Bold"), this); - tqlayout->addWidget(m_bold); + layout->addWidget(m_bold); - TQGridLayout *gl = new TQGridLayout(tqlayout, /*rows=*//*(look->canPreview() ? 5 : 4)*/5, /*columns=*//*3*/4); + TQGridLayout *gl = new TQGridLayout(layout, /*rows=*//*(look->canPreview() ? 5 : 4)*/5, /*columns=*//*3*/4); gl->addItem(new TQSpacerItem(0, 0, TQSizePolicy::Expanding), 1, /*2*/3); m_underlining = new TQComboBox(false, this); @@ -614,7 +614,7 @@ LinkLookEditWidget::LinkLookEditWidget(KCModule *module, const TQString exTitle, "<p>If you do not want the application to create notes depending on the content of the files you drop, " "go to the \"General\" page and uncheck \"Image or animation\" in the \"View Content of Added Files for the Following Types\" group.</p>") // TODO: Note: you can resize down maximum size of images... - .tqarg(kapp->aboutData()->programName(), kapp->aboutData()->programName()), + .arg(kapp->aboutData()->programName(), kapp->aboutData()->programName()), this); gl->addWidget(m_label, 4, 0); gl->addWidget(m_preview, 4, 1); @@ -623,9 +623,9 @@ LinkLookEditWidget::LinkLookEditWidget(KCModule *module, const TQString exTitle, TQGroupBox *gb = new TQHGroupBox(i18n("Example"), this); m_exLook = new LinkLook; m_example = new LinkLabel(exTitle, exIcon, m_exLook, 1, 1, gb); - m_example->tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); + m_example->setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Expanding); m_example->setCursor(TQCursor(TQt::PointingHandCursor)); - tqlayout->addWidget(gb); + layout->addWidget(gb); m_exTitle = exTitle; m_exIcon = exIcon; |