KIcon -> QIcon::fromTheme in kwin effects

This commit is contained in:
Martin Gräßlin 2013-09-05 10:29:33 +02:00
parent 5e29cc24dc
commit de59774190
4 changed files with 14 additions and 22 deletions

View file

@ -23,12 +23,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kwinconfig.h>
#include <QFont>
#include <QIcon>
#include <QMatrix4x4>
#include <QMouseEvent>
#include <KDE/KLocalizedString>
#include <kapplication.h>
#include <kcolorscheme.h>
#include <KDE/KIcon>
#include <kwinglutils.h>
#include <kwinglplatform.h>
@ -1008,7 +1008,7 @@ void CoverSwitchEffect::updateCaption()
if (selected_window->isDesktop()) {
captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
static QPixmap pix = KIcon(QStringLiteral("user-desktop")).pixmap(captionFrame->iconSize());
static QPixmap pix = QIcon::fromTheme(QStringLiteral("user-desktop")).pixmap(captionFrame->iconSize());
captionFrame->setIcon(pix);
} else {
captionFrame->setText(selected_window->caption());

View file

@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <KActionCollection>
#include <KDE/KGlobalAccel>
#include <KDE/KIcon>
#include <KDE/KLocalizedString>
#include <kwinglutils.h>
@ -952,7 +951,7 @@ void FlipSwitchEffect::updateCaption()
if (m_selectedWindow->isDesktop()) {
m_captionFrame->setText(i18nc("Special entry in alt+tab list for minimizing all windows",
"Show Desktop"));
static QPixmap pix = KIcon(QStringLiteral("user-desktop")).pixmap(m_captionFrame->iconSize());
static QPixmap pix = QIcon::fromTheme(QStringLiteral("user-desktop")).pixmap(m_captionFrame->iconSize());
m_captionFrame->setIcon(pix);
} else {
m_captionFrame->setText(m_selectedWindow->caption());

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QAction>
#include <kactioncollection.h>
#include <KDE/KGlobalAccel>
#include <KDE/KIcon>
#include <KDE/KLocalizedString>
#include <KDE/KStandardDirs>
#include <QDebug>
@ -575,8 +574,7 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
m_dragInProgress = false;
m_dragWindow = NULL;
if (m_highlightedDropTarget) {
KIcon icon(QStringLiteral("user-trash"));
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")).pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
}
effects->addRepaintFull();
@ -615,8 +613,7 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
m_dragWindow = NULL;
if (m_highlightedDropTarget) {
effects->addRepaint(m_highlightedDropTarget->geometry());
KIcon icon(QStringLiteral("user-trash"));
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")).pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
}
effects->defineCursor(Qt::PointingHandCursor);
@ -649,14 +646,12 @@ void PresentWindowsEffect::windowInputMouseEvent(QEvent *e)
}
if (target && !m_highlightedDropTarget) {
m_highlightedDropTarget = target;
KIcon icon(QStringLiteral("user-trash"));
effects->addRepaint(m_highlightedDropTarget->geometry());
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Active));
m_highlightedDropTarget->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")).pixmap(QSize(128, 128), QIcon::Active));
effects->defineCursor(Qt::DragMoveCursor);
} else if (!target && m_highlightedDropTarget) {
KIcon icon(QStringLiteral("user-trash"));
effects->addRepaint(m_highlightedDropTarget->geometry());
m_highlightedDropTarget->setIcon(icon.pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")).pixmap(QSize(128, 128), QIcon::Normal));
m_highlightedDropTarget = NULL;
effects->defineCursor(Qt::ForbiddenCursor);
}
@ -1938,8 +1933,7 @@ void PresentWindowsEffect::screenCountChanged()
if (m_dragToClose) {
const QRect screenRect = effects->clientArea(FullScreenArea, i, 1);
EffectFrame *frame = effects->effectFrame(EffectFrameNone, false);
KIcon icon(QStringLiteral("user-trash"));
frame->setIcon(icon.pixmap(QSize(128, 128)));
frame->setIcon(QIcon::fromTheme(QStringLiteral("user-trash")).pixmap(QSize(128, 128)));
frame->setPosition(QPoint(screenRect.x() + screenRect.width(), screenRect.y()));
frame->setAlignment(Qt::AlignRight | Qt::AlignTop);
m_dropTargets.append(frame);

View file

@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KDE/KLocalizedString>
#include <KActionCollection>
#include <KDE/KAboutData>
#include <KDE/KIcon>
#include <QVBoxLayout>
@ -78,42 +77,42 @@ ZoomEffectConfig::ZoomEffectConfig(QWidget* parent, const QVariantList& args) :
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_0);
a = actionCollection->addAction(QStringLiteral("MoveZoomLeft"));
a->setIcon(KIcon(QStringLiteral("go-previous")));
a->setIcon(QIcon::fromTheme(QStringLiteral("go-previous")));
a->setText(i18n("Move Left"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Left);
a = actionCollection->addAction(QStringLiteral("MoveZoomRight"));
a->setIcon(KIcon(QStringLiteral("go-next")));
a->setIcon(QIcon::fromTheme(QStringLiteral("go-next")));
a->setText(i18n("Move Right"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Right);
a = actionCollection->addAction(QStringLiteral("MoveZoomUp"));
a->setIcon(KIcon(QStringLiteral("go-up")));
a->setIcon(QIcon::fromTheme(QStringLiteral("go-up")));
a->setText(i18n("Move Up"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Up);
a = actionCollection->addAction(QStringLiteral("MoveZoomDown"));
a->setIcon(KIcon(QStringLiteral("go-down")));
a->setIcon(QIcon::fromTheme(QStringLiteral("go-down")));
a->setText(i18n("Move Down"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_Down);
a = actionCollection->addAction(QStringLiteral("MoveMouseToFocus"));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setIcon(QIcon::fromTheme(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Focus"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
KGlobalAccel::self()->setShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F5);
a = actionCollection->addAction(QStringLiteral("MoveMouseToCenter"));
a->setIcon(KIcon(QStringLiteral("view-restore")));
a->setIcon(QIcon::fromTheme(QStringLiteral("view-restore")));
a->setText(i18n("Move Mouse to Center"));
a->setProperty("isConfigurationAction", true);
KGlobalAccel::self()->setDefaultShortcut(a, QList<QKeySequence>() << Qt::META + Qt::Key_F6);