summaryrefslogtreecommitdiff
path: root/src/old
diff options
context:
space:
mode:
authorMateusz Łukasik <mati75@linuxmint.pl>2014-04-21 11:53:35 +0200
committerMateusz Łukasik <mati75@linuxmint.pl>2014-04-21 11:53:35 +0200
commit2a117cc570574099839da41a5ae9fbb2a5ca9e55 (patch)
tree6107da409f9c7f07c0ffa0869a26a161b097aea7 /src/old
parentaa68b7bd585a157e8952881e87e2c09de6ec742f (diff)
Imported Upstream version 14.3.0
Diffstat (limited to 'src/old')
-rw-r--r--src/old/floatingwidget.cpp171
-rw-r--r--src/old/floatingwidget.h95
-rw-r--r--src/old/videoequalizer.cpp140
-rw-r--r--src/old/videoequalizer.h65
4 files changed, 471 insertions, 0 deletions
diff --git a/src/old/floatingwidget.cpp b/src/old/floatingwidget.cpp
new file mode 100644
index 0000000..4fddc5f
--- /dev/null
+++ b/src/old/floatingwidget.cpp
@@ -0,0 +1,171 @@
+/* smplayer, GUI front-end for mplayer.
+ Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
+
+ 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 "floatingwidget.h"
+#include "editabletoolbar.h"
+#include <QTimer>
+#include <QHBoxLayout>
+
+#ifndef OLD_ANIMATION
+#include <QPropertyAnimation>
+#endif
+
+FloatingWidget::FloatingWidget( QWidget * parent )
+ : QWidget( parent, Qt::Window | Qt::FramelessWindowHint |
+ Qt::WindowStaysOnTopHint )
+{
+#ifndef OLD_ANIMATION
+ animation = 0;
+#endif
+
+ setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
+
+ tb = new EditableToolbar;
+ tb->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->setSpacing(2);
+ layout->setMargin(2);
+ layout->addWidget(tb);
+
+ setLayout(layout);
+
+ _margin = 0;
+ _animated = false;
+#ifdef OLD_ANIMATION
+ animation_timer = new QTimer(this);
+ animation_timer->setInterval(2);
+ connect( animation_timer, SIGNAL(timeout()), this, SLOT(animate()) );
+#endif
+ connect( &auto_hide_timer, SIGNAL(timeout()),
+ this, SLOT(checkUnderMouse()) );
+ setAutoHide(true);
+}
+
+FloatingWidget::~FloatingWidget() {
+#ifndef OLD_ANIMATION
+ if (animation) delete animation;
+#endif
+}
+
+#ifndef Q_OS_WIN
+void FloatingWidget::setBypassWindowManager(bool b) {
+ if (b) {
+ setWindowFlags(windowFlags() | Qt::X11BypassWindowManagerHint);
+ }
+ else {
+ setWindowFlags(windowFlags() & ~Qt::X11BypassWindowManagerHint);
+ }
+}
+#endif
+
+void FloatingWidget::setAutoHide(bool b) {
+ auto_hide = b;
+
+ if (b)
+ auto_hide_timer.start(5000);
+ else
+ auto_hide_timer.stop();
+}
+
+
+void FloatingWidget::showOver(QWidget * widget, int size, Place place) {
+ qDebug("FloatingWidget::showOver");
+
+ int w = widget->width() * size / 100;
+ int h = height();
+ resize( w, h );
+
+ //qDebug("widget x: %d, y: %d, h: %d, w: %d", widget->x(), widget->y(), widget->width(), widget->height());
+
+ int x = (widget->width() - width() ) / 2;
+ int y;
+ if (place == Top)
+ y = 0 + _margin;
+ else
+ y = widget->height() - height() - _margin;
+
+ QPoint p = widget->mapToGlobal(QPoint(x, y));
+
+ //qDebug("FloatingWidget::showOver: x: %d, y: %d, w: %d, h: %d", x, y, w, h);
+ //qDebug("FloatingWidget::showOver: global x: %d global y: %d", p.x(), p.y());
+ move(p);
+
+ if (isAnimated()) {
+ Movement m = Upward;
+ if (place == Top) m = Downward;
+ showAnimated(p, m);
+ } else {
+ show();
+ }
+}
+
+void FloatingWidget::showAnimated(QPoint final_position, Movement movement) {
+#ifndef OLD_ANIMATION
+ show();
+ if (!animation) {
+ animation = new QPropertyAnimation(this, "pos");
+ }
+ animation->setDuration(300);
+ animation->setEasingCurve(QEasingCurve::OutBounce);
+ animation->setEndValue(final_position);
+ QPoint initial_position = final_position;
+ if (movement == Upward) {
+ initial_position.setY( initial_position.y() + height() );
+ } else {
+ initial_position.setY( initial_position.y() - height() );
+ }
+ animation->setStartValue(initial_position);
+
+ animation->start();
+#else
+ current_movement = movement;
+ final_y = final_position.y();
+
+ if (movement == Upward) {
+ current_y = final_position.y() + height();
+ } else {
+ current_y = final_position.y() - height();
+ }
+
+ move(x(), current_y);
+ show();
+
+ animation_timer->start();
+#endif
+}
+
+#ifdef OLD_ANIMATION
+void FloatingWidget::animate() {
+ if (current_y == final_y) {
+ animation_timer->stop();
+ } else {
+ if (current_movement == Upward) current_y--; else current_y++;
+ move(x(), current_y);
+ }
+}
+#endif
+
+void FloatingWidget::checkUnderMouse() {
+ if (auto_hide) {
+ //qDebug("FloatingWidget::checkUnderMouse");
+ if ((isVisible()) && (!underMouse())) hide();
+ }
+}
+
+#include "moc_floatingwidget.cpp"
diff --git a/src/old/floatingwidget.h b/src/old/floatingwidget.h
new file mode 100644
index 0000000..48c8811
--- /dev/null
+++ b/src/old/floatingwidget.h
@@ -0,0 +1,95 @@
+/* smplayer, GUI front-end for mplayer.
+ Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
+
+ 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
+*/
+
+#ifndef _FLOATING_WIDGET_H_
+#define _FLOATING_WIDGET_H_
+
+#include <QWidget>
+#include <QTimer>
+
+class EditableToolbar;
+
+#if QT_VERSION < 0x040600
+#define OLD_ANIMATION
+#endif
+
+#ifndef OLD_ANIMATION
+class QPropertyAnimation;
+#endif
+
+class FloatingWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ enum Place { Top = 0, Bottom = 1 };
+ enum Movement { Upward = 0, Downward = 1 };
+
+ FloatingWidget(QWidget * parent = 0);
+ ~FloatingWidget();
+
+ //! Show the floating widget over the specified widget.
+ void showOver(QWidget * widget, int size = 100, Place place = Bottom);
+
+ void showAnimated(QPoint final_position, Movement movement);
+
+ EditableToolbar * toolbar() { return tb; };
+
+ bool isAnimated() { return _animated; };
+ bool autoHide() { return auto_hide; };
+ int margin() { return _margin; };
+
+public slots:
+ void setAnimated(bool b) { _animated = b; };
+ void setAutoHide(bool b);
+ void setMargin(int margin) { _margin = margin; };
+#ifndef Q_OS_WIN
+ void setBypassWindowManager(bool b);
+#endif
+
+protected:
+ EditableToolbar * tb;
+
+private slots:
+#ifdef OLD_ANIMATION
+ void animate();
+#endif
+ void checkUnderMouse();
+
+private:
+ // Animation variables
+ bool _animated;
+#ifdef OLD_ANIMATION
+ QTimer * animation_timer;
+#endif
+ int final_y;
+ int current_y;
+ Movement current_movement;
+
+ bool auto_hide;
+ QTimer auto_hide_timer;
+
+ int _margin;
+
+#ifndef OLD_ANIMATION
+ QPropertyAnimation * animation;
+#endif
+
+};
+
+#endif
diff --git a/src/old/videoequalizer.cpp b/src/old/videoequalizer.cpp
new file mode 100644
index 0000000..dc3315e
--- /dev/null
+++ b/src/old/videoequalizer.cpp
@@ -0,0 +1,140 @@
+/* smplayer, GUI front-end for mplayer.
+ Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
+
+ 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 "videoequalizer.h"
+#include "eqslider.h"
+#include "images.h"
+#include "preferences.h"
+#include "global.h"
+#include <QLayout>
+#include <QPushButton>
+#include <QMessageBox>
+
+using namespace Global;
+
+VideoEqualizer::VideoEqualizer( QWidget* parent, Qt::WindowFlags f)
+ : QWidget(parent, f)
+{
+ contrast = new EqSlider(this);
+ brightness = new EqSlider(this);
+ hue = new EqSlider(this);
+ saturation = new EqSlider(this);
+ gamma = new EqSlider(this);
+
+ QBoxLayout *bl = new QHBoxLayout; //(0, 4, 2);
+ bl->addWidget(contrast);
+ bl->addWidget(brightness);
+ bl->addWidget(hue);
+ bl->addWidget(saturation);
+ bl->addWidget(gamma);
+
+ reset_button = new QPushButton( "&Reset", this);
+ connect( reset_button, SIGNAL(clicked()), this, SLOT(reset()) );
+ set_default_button = new QPushButton( "&Set as default values", this );
+ connect( set_default_button, SIGNAL(clicked()), this, SLOT(setDefaults()) );
+
+ QBoxLayout *button_layout = new QVBoxLayout; //(0, 4, 2);
+ button_layout->addWidget(set_default_button);
+ button_layout->addWidget(reset_button);
+
+ QBoxLayout *layout = new QVBoxLayout(this); //, 4, 2);
+ layout->addLayout(bl);
+ layout->addLayout(button_layout);
+
+ retranslateStrings();
+
+ adjustSize();
+ //setFixedSize( sizeHint() );
+}
+
+VideoEqualizer::~VideoEqualizer() {
+}
+
+void VideoEqualizer::retranslateStrings() {
+ setWindowTitle( tr("Video Equalizer") );
+ setWindowIcon( Images::icon("logo") );
+
+ contrast->setLabel( tr("Contrast") );
+ contrast->setToolTip( tr("Contrast") );
+ contrast->setIcon( Images::icon("contrast") );
+
+ brightness->setLabel( tr("Brightness") );
+ brightness->setToolTip( tr("Brightness") );
+ brightness->setIcon( Images::icon("brightness") );
+
+ hue->setLabel( tr("Hue") );
+ hue->setToolTip( tr("Hue") );
+ hue->setIcon( Images::icon("hue") );
+
+ saturation->setLabel( tr("Saturation") );
+ saturation->setToolTip( tr("Saturation") );
+ saturation->setIcon( Images::icon("saturation") );
+
+ gamma->setLabel( tr("Gamma") );
+ gamma->setToolTip( tr("Gamma") );
+ gamma->setIcon( Images::icon("gamma") );
+
+ reset_button->setText( tr("&Reset") );
+ set_default_button->setText( tr("&Set as default values") );
+
+ // What's this help:
+ set_default_button->setWhatsThis(
+ tr("Use the current values as default values for new videos.") );
+
+ reset_button->setWhatsThis( tr("Set all controls to zero.") );
+
+}
+
+void VideoEqualizer::reset() {
+ contrast->setValue(0);
+ brightness->setValue(0);
+ hue->setValue(0);
+ saturation->setValue(0);
+ gamma->setValue(0);
+}
+
+void VideoEqualizer::setDefaults() {
+ pref->initial_contrast = contrast->value();
+ pref->initial_brightness = brightness->value();
+ pref->initial_hue = hue->value();
+ pref->initial_saturation = saturation->value();
+ pref->initial_gamma = gamma->value();
+
+ QMessageBox::information(this, tr("Information"),
+ tr("The current values have been stored to be "
+ "used as default.") );
+}
+
+void VideoEqualizer::hideEvent( QHideEvent * ) {
+ emit visibilityChanged();
+}
+
+void VideoEqualizer::showEvent( QShowEvent * ) {
+ emit visibilityChanged();
+}
+
+// Language change stuff
+void VideoEqualizer::changeEvent(QEvent *e) {
+ if (e->type() == QEvent::LanguageChange) {
+ retranslateStrings();
+ } else {
+ QWidget::changeEvent(e);
+ }
+}
+
+#include "moc_videoequalizer.cpp"
diff --git a/src/old/videoequalizer.h b/src/old/videoequalizer.h
new file mode 100644
index 0000000..48fe4d6
--- /dev/null
+++ b/src/old/videoequalizer.h
@@ -0,0 +1,65 @@
+/* smplayer, GUI front-end for mplayer.
+ Copyright (C) 2006-2013 Ricardo Villalba <rvm@users.sourceforge.net>
+
+ 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
+*/
+
+
+#ifndef _VIDEOEQUALIZER_H_
+#define _VIDEOEQUALIZER_H_
+
+#include <QWidget>
+#include <QHideEvent>
+#include <QShowEvent>
+
+class QPushButton;
+class EqSlider;
+
+class VideoEqualizer : public QWidget
+{
+ Q_OBJECT
+
+public:
+ VideoEqualizer( QWidget* parent = 0, Qt::WindowFlags f = Qt::Dialog );
+ ~VideoEqualizer();
+
+ EqSlider * brightness;
+ EqSlider * contrast;
+ EqSlider * hue;
+ EqSlider * saturation;
+ EqSlider * gamma;
+
+signals:
+ void visibilityChanged();
+
+public slots:
+ void reset();
+ void setDefaults();
+
+protected slots:
+ virtual void hideEvent( QHideEvent * );
+ virtual void showEvent( QShowEvent * );
+
+protected:
+ virtual void retranslateStrings();
+ virtual void changeEvent ( QEvent * event ) ;
+
+protected:
+ QPushButton * reset_button;
+ QPushButton * set_default_button;
+};
+
+
+#endif