mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
Fixed height of Flash info widget if src is too long. WebSearchBar now
search dropped text
This commit is contained in:
parent
5853d72947
commit
9698146075
6
src/3rdparty/squeezelabelv2.cpp
vendored
6
src/3rdparty/squeezelabelv2.cpp
vendored
@ -5,6 +5,12 @@ SqueezeLabelV2::SqueezeLabelV2(QWidget *parent)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SqueezeLabelV2::SqueezeLabelV2(const QString &string)
|
||||||
|
: QLabel()
|
||||||
|
{
|
||||||
|
setText(string);
|
||||||
|
}
|
||||||
|
|
||||||
void SqueezeLabelV2::setText(const QString &txt)
|
void SqueezeLabelV2::setText(const QString &txt)
|
||||||
{
|
{
|
||||||
m_originalText = txt;
|
m_originalText = txt;
|
||||||
|
2
src/3rdparty/squeezelabelv2.h
vendored
2
src/3rdparty/squeezelabelv2.h
vendored
@ -41,6 +41,8 @@ class SqueezeLabelV2 : public QLabel
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SqueezeLabelV2(QWidget *parent = 0);
|
SqueezeLabelV2(QWidget *parent = 0);
|
||||||
|
SqueezeLabelV2(const QString &string);
|
||||||
|
|
||||||
QString originalText();
|
QString originalText();
|
||||||
void setText(const QString &txt);
|
void setText(const QString &txt);
|
||||||
|
|
||||||
|
@ -112,3 +112,15 @@ void WebSearchBar::focusInEvent(QFocusEvent* e)
|
|||||||
}
|
}
|
||||||
QLineEdit::focusInEvent(e);
|
QLineEdit::focusInEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebSearchBar::dropEvent(QDropEvent* event)
|
||||||
|
{
|
||||||
|
if (event->mimeData()->hasText()) {
|
||||||
|
QString dropText = event->mimeData()->text();
|
||||||
|
setText(dropText);
|
||||||
|
search();
|
||||||
|
QLineEdit::focusOutEvent(new QFocusEvent(QFocusEvent::FocusOut));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QLineEdit::dropEvent(event);
|
||||||
|
}
|
||||||
|
@ -45,6 +45,7 @@ private:
|
|||||||
void setupSearchTypes();
|
void setupSearchTypes();
|
||||||
void focusInEvent(QFocusEvent* e);
|
void focusInEvent(QFocusEvent* e);
|
||||||
void focusOutEvent(QFocusEvent* e);
|
void focusOutEvent(QFocusEvent* e);
|
||||||
|
void dropEvent(QDropEvent* event);
|
||||||
|
|
||||||
QupZilla* p_QupZilla;
|
QupZilla* p_QupZilla;
|
||||||
};
|
};
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "pluginproxy.h"
|
#include "pluginproxy.h"
|
||||||
#include "adblockmanager.h"
|
#include "adblockmanager.h"
|
||||||
#include "adblocksubscription.h"
|
#include "adblocksubscription.h"
|
||||||
|
#include "squeezelabelv2.h"
|
||||||
|
|
||||||
ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, QWidget* parent)
|
ClickToFlash::ClickToFlash(const QUrl &pluginUrl, const QStringList &argumentNames, const QStringList &argumentValues, QWidget* parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
@ -206,7 +207,7 @@ void ClickToFlash::showInfo()
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (QString name, m_argumentNames) {
|
foreach (QString name, m_argumentNames) {
|
||||||
QString value = m_argumentValues.at(i);
|
QString value = m_argumentValues.at(i);
|
||||||
lay->addRow(new QLabel(name), new QLabel(value));
|
lay->addRow(new SqueezeLabelV2(name), new SqueezeLabelV2(value));
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -214,5 +215,6 @@ void ClickToFlash::showInfo()
|
|||||||
if (i == 0)
|
if (i == 0)
|
||||||
lay->addRow(new QLabel(tr("No more informations available.")));
|
lay->addRow(new QLabel(tr("No more informations available.")));
|
||||||
|
|
||||||
|
widg->setMaximumHeight(500);
|
||||||
widg->show();
|
widg->show();
|
||||||
}
|
}
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* QupZilla - WebKit based browser
|
|
||||||
* Copyright (C) 2010-2011 nowrep
|
|
||||||
*
|
|
||||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#include "notification.h"
|
|
||||||
|
|
||||||
Notification::Notification(QWidget* parent) :
|
|
||||||
QWidget(parent)
|
|
||||||
,m_animation(0)
|
|
||||||
{
|
|
||||||
setMinimumHeight(1);
|
|
||||||
setMaximumHeight(1);
|
|
||||||
setUpdatesEnabled(false);
|
|
||||||
}
|
|
||||||
void Notification::startAnimation()
|
|
||||||
{
|
|
||||||
m_animation = new QTimeLine(300, this);
|
|
||||||
m_animation->setFrameRange(0, sizeHint().height());
|
|
||||||
setMinimumHeight(1);
|
|
||||||
setMaximumHeight(1);
|
|
||||||
setUpdatesEnabled(true);
|
|
||||||
connect(m_animation, SIGNAL(frameChanged(int)),this, SLOT(frameChanged(int)));
|
|
||||||
QTimer::singleShot(1, m_animation, SLOT(start()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Notification::hide()
|
|
||||||
{
|
|
||||||
if (!m_animation) {
|
|
||||||
close();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_animation->setDirection(QTimeLine::Backward);
|
|
||||||
|
|
||||||
m_animation->stop();
|
|
||||||
m_animation->start();
|
|
||||||
connect(m_animation, SIGNAL(finished()), this, SLOT(close()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void Notification::frameChanged(int frame)
|
|
||||||
{
|
|
||||||
setMinimumHeight(frame);
|
|
||||||
setMaximumHeight(frame);
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/* ============================================================
|
|
||||||
* QupZilla - WebKit based browser
|
|
||||||
* Copyright (C) 2010-2011 nowrep
|
|
||||||
*
|
|
||||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
* ============================================================ */
|
|
||||||
#ifndef NOTIFICATION_H
|
|
||||||
#define NOTIFICATION_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QTimeLine>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
class Notification : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit Notification(QWidget* parent = 0);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void hide();
|
|
||||||
void startAnimation();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void frameChanged(int frame);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QTimeLine* m_animation;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // NOTIFICATION_H
|
|
Loading…
Reference in New Issue
Block a user