diff options
Diffstat (limited to 'src/kmplayercontrolpanel.cpp')
-rw-r--r-- | src/kmplayercontrolpanel.cpp | 208 |
1 files changed, 104 insertions, 104 deletions
diff --git a/src/kmplayercontrolpanel.cpp b/src/kmplayercontrolpanel.cpp index ce5d617..7f9a171 100644 --- a/src/kmplayercontrolpanel.cpp +++ b/src/kmplayercontrolpanel.cpp @@ -16,13 +16,13 @@ * Boston, MA 02110-1301, USA. **/ -#include <qlayout.h> -#include <qpixmap.h> -#include <qslider.h> -#include <qlabel.h> -#include <qtooltip.h> -#include <qpainter.h> -#include <qstringlist.h> +#include <tqlayout.h> +#include <tqpixmap.h> +#include <tqslider.h> +#include <tqlabel.h> +#include <tqtooltip.h> +#include <tqpainter.h> +#include <tqstringlist.h> #include <kiconloader.h> #include <klocale.h> @@ -255,46 +255,46 @@ static const char * blue_xpm[] = { //----------------------------------------------------------------------------- -static QPushButton * ctrlButton (QWidget * w, QBoxLayout * l, const char ** p, int key = 0) { - QPushButton * b = new QPushButton (QIconSet (QPixmap(p)), QString (), w); - b->setFocusPolicy (QWidget::NoFocus); +static TQPushButton * ctrlButton (TQWidget * w, TQBoxLayout * l, const char ** p, int key = 0) { + TQPushButton * b = new TQPushButton (TQIconSet (TQPixmap(p)), TQString (), w); + b->setFocusPolicy (TQ_NoFocus); b->setFlat (true); if (key) - b->setAccel (QKeySequence (key)); + b->setAccel (TQKeySequence (key)); l->addWidget (b); return b; } KDE_NO_CDTOR_EXPORT -KMPlayerMenuButton::KMPlayerMenuButton (QWidget * parent, QBoxLayout * l, const char ** p, int key) - : QPushButton (QIconSet (QPixmap(p)), QString (), parent, "kde_kmplayer_control_button") { - setFocusPolicy (QWidget::NoFocus); +KMPlayerMenuButton::KMPlayerMenuButton (TQWidget * tqparent, TQBoxLayout * l, const char ** p, int key) + : TQPushButton (TQIconSet (TQPixmap(p)), TQString (), tqparent, "kde_kmplayer_control_button") { + setFocusPolicy (TQ_NoFocus); setFlat (true); if (key) - setAccel (QKeySequence (key)); + setAccel (TQKeySequence (key)); l->addWidget (this); } -KDE_NO_EXPORT void KMPlayerMenuButton::enterEvent (QEvent *) { +KDE_NO_EXPORT void KMPlayerMenuButton::enterEvent (TQEvent *) { emit mouseEntered (); } //----------------------------------------------------------------------------- -KDE_NO_CDTOR_EXPORT KMPlayerPopupMenu::KMPlayerPopupMenu (QWidget * parent) - : KPopupMenu (parent, "kde_kmplayer_popupmenu") {} +KDE_NO_CDTOR_EXPORT KMPlayerPopupMenu::KMPlayerPopupMenu (TQWidget * tqparent) + : KPopupMenu (tqparent, "kde_kmplayer_popupmenu") {} -KDE_NO_EXPORT void KMPlayerPopupMenu::leaveEvent (QEvent *) { +KDE_NO_EXPORT void KMPlayerPopupMenu::leaveEvent (TQEvent *) { emit mouseLeft (); } //----------------------------------------------------------------------------- -KDE_NO_CDTOR_EXPORT VolumeBar::VolumeBar (QWidget * parent, View * view) - : QWidget (parent), m_view (view), m_value (100) { - setSizePolicy( QSizePolicy (QSizePolicy::Minimum, QSizePolicy::Fixed)); - setMinimumSize (QSize (51, button_height_only_buttons + 2)); - QToolTip::add (this, i18n ("Volume is %1").arg (m_value)); +KDE_NO_CDTOR_EXPORT VolumeBar::VolumeBar (TQWidget * tqparent, View * view) + : TQWidget (tqparent), m_view (view), m_value (100) { + tqsetSizePolicy( TQSizePolicy (TQSizePolicy::Minimum, TQSizePolicy::Fixed)); + setMinimumSize (TQSize (51, button_height_only_buttons + 2)); + TQToolTip::add (this, i18n ("Volume is %1").arg (m_value)); } KDE_NO_CDTOR_EXPORT VolumeBar::~VolumeBar () { @@ -304,22 +304,22 @@ void VolumeBar::setValue (int v) { m_value = v; if (m_value < 0) m_value = 0; if (m_value > 100) m_value = 100; - QToolTip::remove (this); - QToolTip::add (this, i18n ("Volume is %1").arg (m_value)); - repaint (true); + TQToolTip::remove (this); + TQToolTip::add (this, i18n ("Volume is %1").arg (m_value)); + tqrepaint (true); emit volumeChanged (m_value); } -void VolumeBar::wheelEvent (QWheelEvent * e) { +void VolumeBar::wheelEvent (TQWheelEvent * e) { setValue (m_value + (e->delta () > 0 ? 2 : -2)); e->accept (); } -void VolumeBar::paintEvent (QPaintEvent * e) { - QWidget::paintEvent (e); - QPainter p; +void VolumeBar::paintEvent (TQPaintEvent * e) { + TQWidget::paintEvent (e); + TQPainter p; p.begin (this); - QColor color = paletteForegroundColor (); + TQColor color = paletteForegroundColor (); p.setPen (color); int w = width () - 6; int vx = m_value * w / 100; @@ -329,20 +329,20 @@ void VolumeBar::paintEvent (QPaintEvent * e) { //kdDebug () << "w=" << w << " vx=" << vx << endl; } -void VolumeBar::mousePressEvent (QMouseEvent * e) { +void VolumeBar::mousePressEvent (TQMouseEvent * e) { setValue (100 * (e->x () - 3) / (width () - 6)); e->accept (); } -void VolumeBar::mouseMoveEvent (QMouseEvent * e) { +void VolumeBar::mouseMoveEvent (TQMouseEvent * e) { setValue (100 * (e->x () - 3) / (width () - 6)); e->accept (); } //----------------------------------------------------------------------------- -KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(QWidget * parent, View * view) - : QWidget (parent), +KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(TQWidget * tqparent, View * view) + : TQWidget (tqparent), m_progress_mode (progress_playing), m_progress_length (0), m_popup_timer (0), @@ -350,17 +350,17 @@ KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(QWidget * parent, View * view) m_view (view), m_auto_controls (true), m_popup_clicked (false) { - m_buttonbox = new QHBoxLayout (this, 5, 4); - QColor c = paletteForegroundColor (); - strncpy (xpm_fg_color, QString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue()).ascii(), 31); + m_buttonbox = new TQHBoxLayout (this, 5, 4); + TQColor c = paletteForegroundColor (); + strncpy (xpm_fg_color, TQString(TQString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue())).ascii(), 31); xpm_fg_color[31] = 0; m_buttons[button_config] = new KMPlayerMenuButton (this, m_buttonbox, config_xpm); m_buttons[button_playlist] = ctrlButton (this, m_buttonbox, playlist_xpm); m_buttons[button_back] = ctrlButton (this, m_buttonbox, back_xpm); - m_buttons[button_play] = ctrlButton(this, m_buttonbox, play_xpm, Qt::Key_R); + m_buttons[button_play] = ctrlButton(this, m_buttonbox, play_xpm, TQt::Key_R); m_buttons[button_forward] = ctrlButton (this, m_buttonbox, forward_xpm); - m_buttons[button_stop] = ctrlButton(this, m_buttonbox, stop_xpm, Qt::Key_S); - m_buttons[button_pause]=ctrlButton(this, m_buttonbox, pause_xpm, Qt::Key_P); + m_buttons[button_stop] = ctrlButton(this, m_buttonbox, stop_xpm, TQt::Key_S); + m_buttons[button_pause]=ctrlButton(this, m_buttonbox, pause_xpm, TQt::Key_P); m_buttons[button_record] = ctrlButton (this, m_buttonbox, record_xpm); m_buttons[button_broadcast] = ctrlButton (this, m_buttonbox, broadcast_xpm); m_buttons[button_language] = new KMPlayerMenuButton (this, m_buttonbox, language_xpm); @@ -372,7 +372,7 @@ KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(QWidget * parent, View * view) m_buttons[button_stop]->setToggleButton (true); m_buttons[button_record]->setToggleButton (true); m_buttons[button_broadcast]->setToggleButton (true); - m_posSlider = new QSlider (0, 100, 1, 0, Qt::Horizontal, this); + m_posSlider = new TQSlider (0, 100, 1, 0, Qt::Horizontal, this); m_posSlider->setEnabled (false); m_buttonbox->addWidget (m_posSlider); setupPositionSlider (true); @@ -383,81 +383,81 @@ KDE_NO_CDTOR_EXPORT ControlPanel::ControlPanel(QWidget * parent, View * view) m_popupMenu->insertItem (i18n ("&Play with"), m_playerMenu, menu_player); m_bookmarkMenu = new KMPlayerPopupMenu (this); m_popupMenu->insertItem (i18n("&Bookmarks"), m_bookmarkMenu, menu_bookmark); - m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("konsole"), KIcon::Small, 0, true), i18n ("Con&sole"), menu_video); - m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("player_playlist"), KIcon::Small, 0, true), i18n ("Play&list"), menu_playlist); + m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("konsole"), KIcon::Small, 0, true), i18n ("Con&sole"), menu_video); + m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("player_playlist"), KIcon::Small, 0, true), i18n ("Play&list"), menu_playlist); m_zoomMenu = new KMPlayerPopupMenu (this); m_zoomMenu->insertItem (i18n ("50%"), menu_zoom50); m_zoomMenu->insertItem (i18n ("100%"), menu_zoom100); m_zoomMenu->insertItem (i18n ("150%"), menu_zoom150); - m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("viewmag"), KIcon::Small, 0, false), i18n ("&Zoom"), m_zoomMenu, menu_zoom); - m_popupMenu->insertItem (KGlobal::iconLoader()->loadIconSet (QString ("window_fullscreen"), KIcon::Small, 0, true), i18n ("&Full Screen"), menu_fullscreen); - m_popupMenu->setAccel (QKeySequence (Qt::Key_F), menu_fullscreen); + m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("viewmag"), KIcon::Small, 0, false), i18n ("&Zoom"), m_zoomMenu, menu_zoom); + m_popupMenu->insertItem (KGlobal::iconLoader()->loadIconSet (TQString ("window_fullscreen"), KIcon::Small, 0, true), i18n ("&Full Screen"), menu_fullscreen); + m_popupMenu->setAccel (TQKeySequence (TQt::Key_F), menu_fullscreen); m_popupMenu->insertSeparator (); m_colorMenu = new KMPlayerPopupMenu (this); m_languageMenu = new KMPlayerPopupMenu (this); m_audioMenu = new KMPlayerPopupMenu (this); m_subtitleMenu = new KMPlayerPopupMenu (this); - m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("mime-sound"), KIcon::Small, 0, true), i18n ("&Audio languages"), m_audioMenu); - m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("view_text"), KIcon::Small, 0, true), i18n ("&Subtitles"), m_subtitleMenu); - QLabel * label = new QLabel (i18n ("Contrast:"), m_colorMenu); + m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("mime-sound"), KIcon::Small, 0, true), i18n ("&Audio languages"), m_audioMenu); + m_languageMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("view_text"), KIcon::Small, 0, true), i18n ("&Subtitles"), m_subtitleMenu); + TQLabel * label = new TQLabel (i18n ("Contrast:"), m_colorMenu); m_colorMenu->insertItem (label); - m_contrastSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); + m_contrastSlider = new TQSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); m_colorMenu->insertItem (m_contrastSlider); - label = new QLabel (i18n ("Brightness:"), m_colorMenu); + label = new TQLabel (i18n ("Brightness:"), m_colorMenu); m_colorMenu->insertItem (label); - m_brightnessSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); + m_brightnessSlider = new TQSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); m_colorMenu->insertItem (m_brightnessSlider); - label = new QLabel (i18n ("Hue:"), m_colorMenu); + label = new TQLabel (i18n ("Hue:"), m_colorMenu); m_colorMenu->insertItem (label); - m_hueSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); + m_hueSlider = new TQSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); m_colorMenu->insertItem (m_hueSlider); - label = new QLabel (i18n ("Saturation:"), m_colorMenu); + label = new TQLabel (i18n ("Saturation:"), m_colorMenu); m_colorMenu->insertItem (label); - m_saturationSlider = new QSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); + m_saturationSlider = new TQSlider (-100, 100, 10, 0, Qt::Horizontal, m_colorMenu); m_colorMenu->insertItem (m_saturationSlider); - m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("colorize"), KIcon::Small, 0, true), i18n ("Co&lors"), m_colorMenu); + m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("colorize"), KIcon::Small, 0, true), i18n ("Co&lors"), m_colorMenu); m_popupMenu->insertSeparator (); - m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (QString ("configure"), KIcon::Small, 0, true), i18n ("&Configure KMPlayer..."), menu_config); + m_popupMenu->insertItem (KGlobal::iconLoader ()->loadIconSet (TQString ("configure"), KIcon::Small, 0, true), i18n ("&Configure KMPlayer..."), menu_config); setAutoControls (true); - connect (m_buttons [button_config], SIGNAL (clicked ()), - this, SLOT (buttonClicked ())); - connect (m_buttons [button_language], SIGNAL (clicked ()), - this, SLOT (buttonClicked ())); - connect (m_buttons [button_config], SIGNAL (mouseEntered ()), - this, SLOT (buttonMouseEntered ())); - connect (m_buttons [button_language], SIGNAL (mouseEntered ()), - this, SLOT (buttonMouseEntered ())); - connect (m_popupMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ())); - connect (m_playerMenu, SIGNAL (mouseLeft ()), this, SLOT(menuMouseLeft ())); - connect (m_zoomMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ())); - connect (m_colorMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ())); - connect (m_languageMenu, SIGNAL(mouseLeft ()), this, SLOT(menuMouseLeft())); - connect (m_subtitleMenu, SIGNAL(mouseLeft ()), this, SLOT(menuMouseLeft())); - connect (m_audioMenu, SIGNAL (mouseLeft ()), this, SLOT (menuMouseLeft ())); -} - -KDE_NO_EXPORT void ControlPanel::setPalette (const QPalette & pal) { - QWidget::setPalette (pal); - QColor c = paletteForegroundColor (); - strncpy (xpm_fg_color, QString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue()).ascii(), 31); + connect (m_buttons [button_config], TQT_SIGNAL (clicked ()), + this, TQT_SLOT (buttonClicked ())); + connect (m_buttons [button_language], TQT_SIGNAL (clicked ()), + this, TQT_SLOT (buttonClicked ())); + connect (m_buttons [button_config], TQT_SIGNAL (mouseEntered ()), + this, TQT_SLOT (buttonMouseEntered ())); + connect (m_buttons [button_language], TQT_SIGNAL (mouseEntered ()), + this, TQT_SLOT (buttonMouseEntered ())); + connect (m_popupMenu, TQT_SIGNAL (mouseLeft ()), this, TQT_SLOT (menuMouseLeft ())); + connect (m_playerMenu, TQT_SIGNAL (mouseLeft ()), this, TQT_SLOT(menuMouseLeft ())); + connect (m_zoomMenu, TQT_SIGNAL (mouseLeft ()), this, TQT_SLOT (menuMouseLeft ())); + connect (m_colorMenu, TQT_SIGNAL (mouseLeft ()), this, TQT_SLOT (menuMouseLeft ())); + connect (m_languageMenu, TQT_SIGNAL(mouseLeft ()), this, TQT_SLOT(menuMouseLeft())); + connect (m_subtitleMenu, TQT_SIGNAL(mouseLeft ()), this, TQT_SLOT(menuMouseLeft())); + connect (m_audioMenu, TQT_SIGNAL (mouseLeft ()), this, TQT_SLOT (menuMouseLeft ())); +} + +KDE_NO_EXPORT void ControlPanel::setPalette (const TQPalette & pal) { + TQWidget::setPalette (pal); + TQColor c = paletteForegroundColor (); + strncpy (xpm_fg_color, TQString(TQString().sprintf(". c #%02x%02x%02x", c.red(), c.green(),c.blue())).ascii(), 31); xpm_fg_color[31] = 0; - m_buttons[button_config]->setIconSet (QIconSet (QPixmap (config_xpm))); - m_buttons[button_playlist]->setIconSet (QIconSet (QPixmap (playlist_xpm))); - m_buttons[button_back]->setIconSet (QIconSet (QPixmap (back_xpm))); - m_buttons[button_play]->setIconSet (QIconSet (QPixmap (play_xpm))); - m_buttons[button_forward]->setIconSet (QIconSet (QPixmap (forward_xpm))); - m_buttons[button_stop]->setIconSet (QIconSet (QPixmap (stop_xpm))); - m_buttons[button_pause]->setIconSet (QIconSet (QPixmap (pause_xpm))); - m_buttons[button_record]->setIconSet (QIconSet (QPixmap (record_xpm))); - m_buttons[button_broadcast]->setIconSet (QIconSet (QPixmap (broadcast_xpm))); - m_buttons[button_language]->setIconSet (QIconSet (QPixmap (language_xpm))); - m_buttons[button_red]->setIconSet (QIconSet (QPixmap (red_xpm))); - m_buttons[button_green]->setIconSet (QIconSet (QPixmap (green_xpm))); - m_buttons[button_yellow]->setIconSet (QIconSet (QPixmap (yellow_xpm))); - m_buttons[button_blue]->setIconSet (QIconSet (QPixmap (blue_xpm))); -} - -KDE_NO_EXPORT void ControlPanel::timerEvent (QTimerEvent * e) { + m_buttons[button_config]->setIconSet (TQIconSet (TQPixmap (config_xpm))); + m_buttons[button_playlist]->setIconSet (TQIconSet (TQPixmap (playlist_xpm))); + m_buttons[button_back]->setIconSet (TQIconSet (TQPixmap (back_xpm))); + m_buttons[button_play]->setIconSet (TQIconSet (TQPixmap (play_xpm))); + m_buttons[button_forward]->setIconSet (TQIconSet (TQPixmap (forward_xpm))); + m_buttons[button_stop]->setIconSet (TQIconSet (TQPixmap (stop_xpm))); + m_buttons[button_pause]->setIconSet (TQIconSet (TQPixmap (pause_xpm))); + m_buttons[button_record]->setIconSet (TQIconSet (TQPixmap (record_xpm))); + m_buttons[button_broadcast]->setIconSet (TQIconSet (TQPixmap (broadcast_xpm))); + m_buttons[button_language]->setIconSet (TQIconSet (TQPixmap (language_xpm))); + m_buttons[button_red]->setIconSet (TQIconSet (TQPixmap (red_xpm))); + m_buttons[button_green]->setIconSet (TQIconSet (TQPixmap (green_xpm))); + m_buttons[button_yellow]->setIconSet (TQIconSet (TQPixmap (yellow_xpm))); + m_buttons[button_blue]->setIconSet (TQIconSet (TQPixmap (blue_xpm))); +} + +KDE_NO_EXPORT void ControlPanel::timerEvent (TQTimerEvent * e) { if (e->timerId () == m_popup_timer) { m_popup_timer = 0; if (m_button_monitored == button_config) { @@ -477,7 +477,7 @@ KDE_NO_EXPORT void ControlPanel::timerEvent (QTimerEvent * e) { !m_colorMenu->hasMouse () && !m_bookmarkMenu->hasMouse ()) { if (!(m_bookmarkMenu->isVisible () && - static_cast <QWidget *> (m_bookmarkMenu) != QWidget::keyboardGrabber ())) { + static_cast <TQWidget *> (m_bookmarkMenu) != TQWidget::keyboardGrabber ())) { // not if user entered the bookmark sub menu or if I forgot one m_popupMenu->hide (); if (m_buttons [button_config]->isOn ()) @@ -517,11 +517,11 @@ void ControlPanel::setAutoControls (bool b) { KDE_NO_EXPORT void ControlPanel::showPopupMenu () { m_view->updateVolume (); - m_popupMenu->exec (m_buttons [button_config]->mapToGlobal (QPoint (0, maximumSize ().height ()))); + m_popupMenu->exec (m_buttons [button_config]->mapToGlobal (TQPoint (0, tqmaximumSize ().height ()))); } KDE_NO_EXPORT void ControlPanel::showLanguageMenu () { - m_languageMenu->exec (m_buttons [button_language]->mapToGlobal (QPoint (0, maximumSize ().height ()))); + m_languageMenu->exec (m_buttons [button_language]->mapToGlobal (TQPoint (0, tqmaximumSize ().height ()))); } void ControlPanel::showPositionSlider (bool show) { @@ -540,12 +540,12 @@ KDE_NO_EXPORT void ControlPanel::setupPositionSlider (bool show) { m_posSlider->show (); m_buttonbox->setMargin (4); m_buttonbox->setSpacing (4); - setEraseColor (m_view->topLevelWidget ()->paletteBackgroundColor ()); + setEraseColor (m_view->tqtopLevelWidget ()->paletteBackgroundColor ()); } else { m_posSlider->hide (); m_buttonbox->setMargin (1); m_buttonbox->setSpacing (1); - setEraseColor (QColor (0, 0, 0)); + setEraseColor (TQColor (0, 0, 0)); } for (int i = 0; i < (int) button_last; i++) { m_buttons[i]->setMinimumSize (15, h-1); @@ -656,7 +656,7 @@ KDE_NO_EXPORT void ControlPanel::menuMouseLeft () { m_popdown_timer = startTimer (400); } -KDE_NO_EXPORT void ControlPanel::setLanguages (const QStringList & alang, const QStringList & slang) { +KDE_NO_EXPORT void ControlPanel::setLanguages (const TQStringList & alang, const TQStringList & slang) { int sz = (int) alang.size (); bool showbutton = (sz > 0); m_audioMenu->clear (); |