📄 evatipwindow.cpp
字号:
/*************************************************************************** * Copyright (C) 2004 by yunfan * * yunfan_zg@163.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program 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 General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/#include "evatipwindow.h"#include "evaresource.h"#include "evahtmlparser.h"#include <qlabel.h>#include <klocale.h>#include <kapplication.h>#include <qtimer.h>#include <qpixmap.h>EvaTipWindow::EvaTipWindow(EvaImageResource *res, const QString nick, const unsigned int id, const short face, const QString &message) : EvaTipUIBase(0, 0, WStyle_Customize | WStyle_NoBorder | WStyle_StaysOnTop | WStyle_Tool | WX11BypassWM | WDestructiveClose){ images = res; qqNum = id; EvaHtmlParser parser; parser.setAbsImagePath(images->getSmileyPath()); QString htmlNick = nick; parser.convertToHtml( htmlNick, false, true); lblNick->setText("<qt>" +htmlNick + "</qt>"); QString msg = message; if(msg.stripWhiteSpace().length() > 30 ){ msg = message.left(27) + i18n("..."); } parser.convertToHtml(msg, false, true); lblMessage->setText("<qt>" +msg+"</qt>"); QPixmap *pic = images->getQQShow(qqNum); lblPixmap->setScaledContents(true); if(!pic){ pic = images->getUserHeadPixmap(qqNum); if(!pic) pic = images->getFace(images->getFaceFileIndex(face)); lblPixmap->setScaledContents(false); } lblPixmap->setPixmap(*pic); scr = KApplication::desktop()->screenGeometry(); setGeometry(scr.right()- width(), scr.bottom(), width(), height()); timelast=0; timer = new QTimer(this); QObject::connect(timer, SIGNAL(timeout()), this,SLOT(slotTimeout())); timer->start(70, false); show();}EvaTipWindow::~EvaTipWindow(){}void EvaTipWindow::mousePressEvent(QMouseEvent *e){ if(timer->isActive()) timer->stop(); if( (e->button() & LeftButton)==LeftButton){ emit requestChat(qqNum); } close();}void EvaTipWindow::slotTimeout(){ if(timelast > 100) { timer->stop(); close(); }else timelast+=2; if(y() > (scr.height()- height()-35) ){ move(scr.right()- width(), scr.height()-(height()/6)*timelast); };}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -