From c8ff4b62a919f512fae8f8b8b39655843cc9b661 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Fri, 8 Oct 2010 14:23:40 +0000 Subject: change fileName --- examples/GuiClient/GuiClient.pro | 4 +- examples/GuiClient/avatarWidget.cpp | 65 ------------------------------- examples/GuiClient/avatarWidget.h | 38 ------------------ examples/GuiClient/statusAvatarWidget.cpp | 65 +++++++++++++++++++++++++++++++ examples/GuiClient/statusAvatarWidget.h | 38 ++++++++++++++++++ examples/GuiClient/statusWidget.ui | 6 +-- 6 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 examples/GuiClient/avatarWidget.cpp delete mode 100644 examples/GuiClient/avatarWidget.h create mode 100644 examples/GuiClient/statusAvatarWidget.cpp create mode 100644 examples/GuiClient/statusAvatarWidget.h (limited to 'examples/GuiClient') diff --git a/examples/GuiClient/GuiClient.pro b/examples/GuiClient/GuiClient.pro index 6633f51a..47419d2e 100644 --- a/examples/GuiClient/GuiClient.pro +++ b/examples/GuiClient/GuiClient.pro @@ -18,7 +18,7 @@ SOURCES += main.cpp \ statusWidget.cpp \ customPushButton.cpp \ customLabel.cpp \ - avatarWidget.cpp \ + statusAvatarWidget.cpp \ statusTextWidget.cpp \ statusToolButton.cpp \ vCardCache.cpp \ @@ -40,7 +40,7 @@ HEADERS += messageGraphicsItem.h \ statusWidget.h \ customPushButton.h \ customLabel.h \ - avatarWidget.h \ + statusAvatarWidget.h \ statusTextWidget.h \ statusToolButton.h \ vCardCache.h \ diff --git a/examples/GuiClient/avatarWidget.cpp b/examples/GuiClient/avatarWidget.cpp deleted file mode 100644 index 4312a5c5..00000000 --- a/examples/GuiClient/avatarWidget.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2008-2010 The QXmpp developers - * - * Author: - * Manjeet Dahiya - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - - -#include "avatarWidget.h" -#include - -avatarWidget::avatarWidget(QWidget* parent) - : QPushButton(parent) -{ -} - -void avatarWidget::paintEvent(QPaintEvent* event) -{ - Q_UNUSED(event); - QPainter painter(this); - - QRect r = rect(); - - QPixmap pixmap = icon().pixmap(sizeHint(), QIcon::Normal, QIcon::On); - if(pixmap.isNull()) - pixmap = QPixmap(":/icons/resource/avatar.png"); - QRect pixRect(0, 0, 32, 32); - pixRect.moveCenter(r.center()); - painter.drawPixmap(pixRect, pixmap); - - if(underMouse() && !isDown()) - { - painter.drawRect(pixRect.adjusted(0, 0, -1, -1)); - QColor col(Qt::white); - col.setAlpha(80); - painter.fillRect(pixRect.adjusted(0, 0, -1, -1), col); - } - if(isDown()) - { - QColor col(Qt::white); - col.setAlpha(50); - painter.drawRect(pixRect.adjusted(1, 1, -2, -2)); - } -} - -QSize avatarWidget::sizeHint() const -{ - return QSize(32, 32); -} diff --git a/examples/GuiClient/avatarWidget.h b/examples/GuiClient/avatarWidget.h deleted file mode 100644 index 26fc7b80..00000000 --- a/examples/GuiClient/avatarWidget.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2008-2010 The QXmpp developers - * - * Author: - * Manjeet Dahiya - * - * Source: - * http://code.google.com/p/qxmpp - * - * This file is a part of QXmpp library. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - */ - - -#ifndef AVATARWIDGET_H -#define AVATARWIDGET_H - -#include - -class avatarWidget : public QPushButton -{ -public: - avatarWidget(QWidget* parent = 0); - void paintEvent(QPaintEvent* event); - QSize sizeHint() const; -}; - -#endif // AVATARWIDGET_H diff --git a/examples/GuiClient/statusAvatarWidget.cpp b/examples/GuiClient/statusAvatarWidget.cpp new file mode 100644 index 00000000..6b90a0b1 --- /dev/null +++ b/examples/GuiClient/statusAvatarWidget.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008-2010 The QXmpp developers + * + * Author: + * Manjeet Dahiya + * + * Source: + * http://code.google.com/p/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + + +#include "statusAvatarWidget.h" +#include + +statusAvatarWidget::statusAvatarWidget(QWidget* parent) + : QPushButton(parent) +{ +} + +void statusAvatarWidget::paintEvent(QPaintEvent* event) +{ + Q_UNUSED(event); + QPainter painter(this); + + QRect r = rect(); + + QPixmap pixmap = icon().pixmap(sizeHint(), QIcon::Normal, QIcon::On); + if(pixmap.isNull()) + pixmap = QPixmap(":/icons/resource/avatar.png"); + QRect pixRect(0, 0, 32, 32); + pixRect.moveCenter(r.center()); + painter.drawPixmap(pixRect, pixmap); + + if(underMouse() && !isDown()) + { + painter.drawRect(pixRect.adjusted(0, 0, -1, -1)); + QColor col(Qt::white); + col.setAlpha(80); + painter.fillRect(pixRect.adjusted(0, 0, -1, -1), col); + } + if(isDown()) + { + QColor col(Qt::white); + col.setAlpha(50); + painter.drawRect(pixRect.adjusted(1, 1, -2, -2)); + } +} + +QSize statusAvatarWidget::sizeHint() const +{ + return QSize(32, 32); +} diff --git a/examples/GuiClient/statusAvatarWidget.h b/examples/GuiClient/statusAvatarWidget.h new file mode 100644 index 00000000..a24848fc --- /dev/null +++ b/examples/GuiClient/statusAvatarWidget.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008-2010 The QXmpp developers + * + * Author: + * Manjeet Dahiya + * + * Source: + * http://code.google.com/p/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + + +#ifndef STATUSAVATARWIDGET_H +#define STATUSAVATARWIDGET_H + +#include + +class statusAvatarWidget : public QPushButton +{ +public: + statusAvatarWidget(QWidget* parent = 0); + void paintEvent(QPaintEvent* event); + QSize sizeHint() const; +}; + +#endif // STATUSAVATARWIDGET_H diff --git a/examples/GuiClient/statusWidget.ui b/examples/GuiClient/statusWidget.ui index 2b8771ca..abd9ce35 100644 --- a/examples/GuiClient/statusWidget.ui +++ b/examples/GuiClient/statusWidget.ui @@ -125,7 +125,7 @@ - + @@ -190,9 +190,9 @@ - avatarWidget + statusAvatarWidget QPushButton -
avatarWidget.h
+
statusAvatarWidget.h
statusTextWidget -- cgit v1.2.3