From e2de64d6f1beb9e492daf5b886e19933c1fa41dd Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdemultimedia@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- noatun/modules/simple/Makefile.am | 16 ++ noatun/modules/simple/back.xpm | 21 ++ noatun/modules/simple/forward.xpm | 21 ++ noatun/modules/simple/noatunui.cpp | 17 ++ noatun/modules/simple/pause.xpm | 21 ++ noatun/modules/simple/play.xpm | 21 ++ noatun/modules/simple/playlist.xpm | 21 ++ noatun/modules/simple/propertiesdialog.ui | 348 +++++++++++++++++++++++++ noatun/modules/simple/propertiesdialog.ui.h | 58 +++++ noatun/modules/simple/simple.plugin | 126 +++++++++ noatun/modules/simple/simpleui.rc | 37 +++ noatun/modules/simple/stop.xpm | 21 ++ noatun/modules/simple/userinterface.cpp | 379 ++++++++++++++++++++++++++++ noatun/modules/simple/userinterface.h | 80 ++++++ noatun/modules/simple/volume.xpm | 21 ++ 15 files changed, 1208 insertions(+) create mode 100644 noatun/modules/simple/Makefile.am create mode 100644 noatun/modules/simple/back.xpm create mode 100644 noatun/modules/simple/forward.xpm create mode 100644 noatun/modules/simple/noatunui.cpp create mode 100644 noatun/modules/simple/pause.xpm create mode 100644 noatun/modules/simple/play.xpm create mode 100644 noatun/modules/simple/playlist.xpm create mode 100644 noatun/modules/simple/propertiesdialog.ui create mode 100644 noatun/modules/simple/propertiesdialog.ui.h create mode 100644 noatun/modules/simple/simple.plugin create mode 100644 noatun/modules/simple/simpleui.rc create mode 100644 noatun/modules/simple/stop.xpm create mode 100644 noatun/modules/simple/userinterface.cpp create mode 100644 noatun/modules/simple/userinterface.h create mode 100644 noatun/modules/simple/volume.xpm (limited to 'noatun/modules/simple') diff --git a/noatun/modules/simple/Makefile.am b/noatun/modules/simple/Makefile.am new file mode 100644 index 00000000..de5a7aa8 --- /dev/null +++ b/noatun/modules/simple/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES= -I$(top_srcdir)/noatun/library -I$(kde_includes)/arts $(all_includes) + +kde_module_LTLIBRARIES = noatunsimple.la + +noatunsimple_la_SOURCES = propertiesdialog.ui noatunui.cpp userinterface.cpp +noatunsimple_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) -module +noatunsimple_la_LIBADD = $(top_builddir)/noatun/library/libnoatun.la \ + $(top_builddir)/noatun/library/libnoatuncontrols.la \ + -lkmedia2_idl -lsoundserver_idl -lartskde + +noatunsimple_la_METASOURCES = AUTO + +noinst_HEADERS = propertiesdialog.h userinterface.h + +noatun_modules_simple_DATA = simple.plugin simpleui.rc +noatun_modules_simpledir = $(kde_datadir)/noatun diff --git a/noatun/modules/simple/back.xpm b/noatun/modules/simple/back.xpm new file mode 100644 index 00000000..bd433e5e --- /dev/null +++ b/noatun/modules/simple/back.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * back_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" .... .. ", +" .... ... ", +" .... .... ", +" .... ..... ", +" .... ...... ", +" .... ...... ", +" .... ..... ", +" .... .... ", +" .... ... ", +" .... .. ", +" ", +" ", +" "}; diff --git a/noatun/modules/simple/forward.xpm b/noatun/modules/simple/forward.xpm new file mode 100644 index 00000000..c4e95ccc --- /dev/null +++ b/noatun/modules/simple/forward.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * forward_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" .. .... ", +" ... .... ", +" .... .... ", +" ..... .... ", +" ...... .... ", +" ...... .... ", +" ..... .... ", +" .... .... ", +" ... .... ", +" .. .... ", +" ", +" ", +" "}; diff --git a/noatun/modules/simple/noatunui.cpp b/noatun/modules/simple/noatunui.cpp new file mode 100644 index 00000000..3b647e42 --- /dev/null +++ b/noatun/modules/simple/noatunui.cpp @@ -0,0 +1,17 @@ +/* + This file is part of KDE/aRts (Noatun) - xine integration + Copyright (C) 2002 Ewald Snel + + 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. +*/ + +#include "userinterface.h" + + +extern "C" +{ + KDE_EXPORT Plugin *create_plugin() { return new SimpleUI(); } +} diff --git a/noatun/modules/simple/pause.xpm b/noatun/modules/simple/pause.xpm new file mode 100644 index 00000000..48d37568 --- /dev/null +++ b/noatun/modules/simple/pause.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * pause_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" .... .... ", +" ", +" ", +" "}; diff --git a/noatun/modules/simple/play.xpm b/noatun/modules/simple/play.xpm new file mode 100644 index 00000000..7cb55a88 --- /dev/null +++ b/noatun/modules/simple/play.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * play_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" .. ", +" ... ", +" .... ", +" ..... ", +" ...... ", +" ...... ", +" ..... ", +" .... ", +" ... ", +" .. ", +" ", +" ", +" "}; diff --git a/noatun/modules/simple/playlist.xpm b/noatun/modules/simple/playlist.xpm new file mode 100644 index 00000000..80b622ac --- /dev/null +++ b/noatun/modules/simple/playlist.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * playlist_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" .. ", +" .... ", +" ...... ", +" ........ ", +" .......... ", +" .......... ", +" ", +" ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" ", +" "}; diff --git a/noatun/modules/simple/propertiesdialog.ui b/noatun/modules/simple/propertiesdialog.ui new file mode 100644 index 00000000..08f4f71c --- /dev/null +++ b/noatun/modules/simple/propertiesdialog.ui @@ -0,0 +1,348 @@ + +PropertiesDialog +Ewald Snel + + + PropertiesDialog + + + + 0 + 0 + 320 + 261 + + + + Properties + + + + unnamed + + + 11 + + + 6 + + + + TabWidget2 + + + + details + + + &Details + + + + unnamed + + + 16 + + + 6 + + + + nameField + + + + 180 + 0 + + + + + + + true + + + + + Line1 + + + HLine + + + Sunken + + + Horizontal + + + + + iconLabel + + + AlignVCenter|AlignLeft + + + + + typeLabel + + + + 7 + 5 + 0 + 0 + + + + + + Spacer3 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + Line1_2 + + + HLine + + + Sunken + + + Horizontal + + + + + TextLabel7_2 + + + Type: + + + + + TextLabel2_2 + + + + 25 + 0 + + + + + 25 + 32767 + + + + + + TextLabel5 + + + Length: + + + + + lengthLabel + + + + 7 + 5 + 0 + 0 + + + + + + TextLabel6 + + + Audio: + + + + + audioLabel + + + + 7 + 5 + 0 + 0 + + + + + + TextLabel7 + + + Video: + + + + + videoLabel + + + + 7 + 5 + 0 + 0 + + + + + + + + playobject + + + &PlayObject + + + + unnamed + + + 16 + + + 6 + + + + TextLabel2 + + + + 80 + 0 + + + + + 80 + 32767 + + + + Description: + + + + + descriptionLabel + + + + + + Capabilities + + + true + + + true + + + + capsList + + + + + + + + buttonLayout + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + okButton + + + &OK + + + true + + + + + + + + + okButton + clicked() + PropertiesDialog + accept() + + + + noatun/playlist.h + kmedia2.h + kmimetype.h + propertiesdialog.ui.h + + + setPlayObject( PlaylistItem pi, Arts::PlayObject po ) + + + diff --git a/noatun/modules/simple/propertiesdialog.ui.h b/noatun/modules/simple/propertiesdialog.ui.h new file mode 100644 index 00000000..a712d776 --- /dev/null +++ b/noatun/modules/simple/propertiesdialog.ui.h @@ -0,0 +1,58 @@ +/* + This file is part of KDE/aRts (Noatun) - xine integration + Copyright (C) 2002 Ewald Snel + + 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. +*/ + +#include + +void PropertiesDialog::setPlayObject( PlaylistItem pi, Arts::PlayObject po ) +{ + // Arts::PlayObject properties + if (!po.isNull()) + { + Arts::poCapabilities ncaps = po.capabilities(); + QCheckListItem *item; + + descriptionLabel->setText( po.description().c_str() ); + + // Determine capabilities + if (!(item = (QCheckListItem *)capsList->findItem( "capSeek", 0 ))) + { + item = new QCheckListItem( capsList, "capSeek", + QCheckListItem::CheckBox ); + } + item->setOn( (ncaps & Arts::capSeek) ); + + if (!(item = (QCheckListItem *)capsList->findItem( "capPause", 0 ))) + { + item = new QCheckListItem( capsList, "capPause", + QCheckListItem::CheckBox ); + } + item->setOn( (ncaps & Arts::capPause) ); + + // Defaults + nameField->setText( i18n("unknown") ); + typeLabel->setText( i18n("unknown") ); + lengthLabel->setText( i18n("unknown") ); + audioLabel->setText( i18n("unknown") ); + videoLabel->setText( i18n("unknown") ); + } + + // PlaylistItem properties (name and mimetype) + if (!pi.isNull()) + { + setCaption( i18n("Properties for %1").arg(pi.url().fileName()) ); + + KSharedPtr mime = KMimeType::mimeType( pi.mimetype() ); + iconLabel->setPixmap( mime->pixmap( KIcon::Desktop, KIcon::SizeMedium ) ); + + nameField->setText( pi.url().fileName() ); + typeLabel->setText( pi.mimetype() ); + lengthLabel->setText( pi.lengthString() ); + } +} diff --git a/noatun/modules/simple/simple.plugin b/noatun/modules/simple/simple.plugin new file mode 100644 index 00000000..9d7e4beb --- /dev/null +++ b/noatun/modules/simple/simple.plugin @@ -0,0 +1,126 @@ +Filename=noatunsimple.la +Author=Ewald Snel +Site=http://rambo.its.tudelft.nl/xine/ +Email=ewald@rambo.its.tudelft.nl +Type=userinterface +License=LGPL +Name=Simple +Name[af]=Eenvoudige +Name[ar]=بسيط +Name[az]=Bəsit +Name[bn]=সরল +Name[br]=Eeun +Name[bs]=Jednostavno +Name[ca]=Senzill +Name[cs]=Jednoduchý +Name[cy]=Syml +Name[da]=Simpel +Name[de]=Einfach +Name[el]=Απλό +Name[eo]=Simpla +Name[et]=Lihtne +Name[eu]=Sinplea +Name[fa]=ساده +Name[fi]=Yksinkertainen +Name[ga]=Simplí +Name[he]=פשוט +Name[hi]=साधारण +Name[hr]=Jednostavno +Name[hu]=Egyszerű +Name[id]=Sederhana +Name[is]=Einfalt +Name[it]=Semplice +Name[km]=សាមញ្ញ +Name[ko]=간단 +Name[lt]=Paprastas +Name[lv]=Vienkāršs +Name[mk]=Едноставен +Name[mt]=Sempliċi +Name[nb]=Enkel +Name[nds]=Eenfach +Name[ne]=साधारण +Name[nl]=Eenvoudig +Name[nn]=Enkel +Name[pa]=ਸਧਾਰਨ +Name[pl]=Prosty +Name[pt]=Simples +Name[pt_BR]=Simples +Name[ro]=Simplu +Name[ru]=Простой +Name[se]=Oktageardanis +Name[sk]=Jednoduchý +Name[sl]=Preprosto +Name[sr]=Једноставан +Name[sr@Latn]=Jednostavan +Name[sv]=Enkel +Name[ta]=எளிய +Name[tg]=Содда +Name[th]=เรียบง่าย +Name[tr]=Basit +Name[uk]=Простий +Name[uz]=Oddiy +Name[uz@cyrillic]=Оддий +Name[ven]=Zwoleluwa +Name[wa]=Simpe +Name[xh]=Lula +Name[zh_CN]=简单 +Name[zh_HK]=簡單 +Name[zh_TW]=簡單 +Name[zu]=Okulula +Comment=Simple GUI (embedded video) +Comment[af]=Eenvoudige Gui (ingebedde video) +Comment[bg]=Семпъл графичен интерфейс за Noatun +Comment[bs]=Jednostavan GUI (uključen video) +Comment[ca]=IGU senzill (vídeo incrustat) +Comment[cs]=Jednoduché GUI (vnořené video) +Comment[cy]=GUI Syml (fideo mewnol) +Comment[da]=Simpel GUI (indlejret video) +Comment[de]=Einfache Oberfläche (eingebettetes Video) +Comment[el]=Απλό περιβάλλον χρήσης (ενσωματωμένο βίντεο) +Comment[es]=Interfaz gráfica simple (vídeo empotrado) +Comment[et]=Lihtne kasutajaliides (põimitud video) +Comment[eu]=GUI sinplea (bideo kapsulatua) +Comment[fa]=ونک ساده )ویدیوی نهفته( +Comment[fi]=Yksinkertainen käyttöliittymä (upotettu video) +Comment[fr]=Interface graphique simple (video incorporée) +Comment[ga]=Comhéadan simplí (fís leabaithe) +Comment[gl]=GUI Sinxela (video incrustado) +Comment[he]=ממשק משתמש גרפי פשוט (וידאו מוטבע) +Comment[hi]=साधारण जीयूआई (एम्बेडेड वीडियो) +Comment[hu]=Egyszerű kezelőfelület (beágyazott videó) +Comment[is]=Einföld myndræn skil (innbyggt) +Comment[it]=Semplice GUI (video integrato) +Comment[ja]=シンプルな GUI (埋め込みビデオ) +Comment[kk]=Қарапайым инерфейсі (ендірілген бейне) +Comment[km]=ចំណុច​ប្រទាក់​ក្រាហ្វិក​សាមញ្ញ (វីដេអូ​បង្កប់) +Comment[ko]=간단한 GUI (내장된 비디오) +Comment[lt]=Paprastas GUI (įdedamas video) +Comment[mk]=Едноставен графички интерфејс (вградено видео) +Comment[ms]=GUI Ringkas (video diselitkan) +Comment[nb]=Enkel GUI (innebygget video) +Comment[nds]=Eenfach Böversiet (inbett Video) +Comment[ne]=साधारण GUI (सम्मिलित भिडियो) +Comment[nl]=Eenvoudige GUI (inbedbare video) +Comment[nn]=Enkelt grensesnitt (innebygd video) +Comment[pa]=ਸਧਾਰਨ GUI (ਸ਼ਾਮਲ ਵੀਡਿਓ) +Comment[pl]=Zwykły motyw (osadzone wideo) +Comment[pt]=Interface Simples (vídeo embebido) +Comment[pt_BR]=Interface Simples (vídeo integrado) +Comment[ro]=Interfaţă grafică simplă (video integrat) +Comment[ru]=Простой интерфейс (встроенное видео) +Comment[se]=Oktageardánis lakta (vuojuhuvvon video) +Comment[sk]=Jednoduché rozhranie (vložené video) +Comment[sl]=Preprost uporabniški vmesnik (vključen video) +Comment[sr]=Једноставан GUI (уграђен видео) +Comment[sr@Latn]=Jednostavan GUI (ugrađen video) +Comment[sv]=Enkelt grafiskt gränssnitt (inbäddad video) +Comment[ta]=எளிய GUI (உட்பொதிந்த தாரை) +Comment[tg]=Интерфейси Графикии содда (видеои дарунгузошта) +Comment[th]=ส่วนติดต่อผู้ใช้แบบกราฟิกแบบเรียบง่าย (วิดีโอแบบฝัง) +Comment[tr]=Basit arayüz (gömülü video) +Comment[uk]=Простий інтерфейс (вмонтоване відео) +Comment[xh]=GUI Elula (video ebekiweyo) +Comment[zh_CN]=简单图形用户界面 (嵌入式视频) +Comment[zh_HK]=簡單圖形用戶(嵌入式視訊) +Comment[zh_TW]=簡單圖形使用者界面(嵌入式視訊) +Comment[zu]=I-GUI Elula (ividiyo ehlanganiselwe) diff --git a/noatun/modules/simple/simpleui.rc b/noatun/modules/simple/simpleui.rc new file mode 100644 index 00000000..6e5fb86a --- /dev/null +++ b/noatun/modules/simple/simpleui.rc @@ -0,0 +1,37 @@ + + + + + &File + + + + + + + + + + + + + + + + &Settings + + + + + + + + + + + + + + diff --git a/noatun/modules/simple/stop.xpm b/noatun/modules/simple/stop.xpm new file mode 100644 index 00000000..6b080e94 --- /dev/null +++ b/noatun/modules/simple/stop.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * stop_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" .......... ", +" ", +" ", +" "}; diff --git a/noatun/modules/simple/userinterface.cpp b/noatun/modules/simple/userinterface.cpp new file mode 100644 index 00000000..6e7b486f --- /dev/null +++ b/noatun/modules/simple/userinterface.cpp @@ -0,0 +1,379 @@ +/* + This file is part of KDE/aRts (Noatun) - xine integration + Copyright (C) 2002 Ewald Snel + + 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. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "userinterface.h" + +#include "back.xpm" +#include "forward.xpm" +#include "pause.xpm" +#include "play.xpm" +#include "playlist.xpm" +#include "stop.xpm" +#include "volume.xpm" + +SimpleUI::SimpleUI() + : KMainWindow(0, "NoatunSimpleUI"), UserInterface() +{ + setAcceptDrops( true ); + setCaption( i18n("Noatun") ); + setIcon( SmallIcon( "noatun" ) ); + + setupCentralWidget(); + setupActions(); + + contextMenu = video->popupMenu( this ); + + setupGUI( StatusBar|Create, "simpleui.rc" ); + + connect( napp->player(), SIGNAL(playing()), SLOT(slotPlaying()) ); + connect( napp->player(), SIGNAL(stopped()), SLOT(slotStopped()) ); + connect( napp->player(), SIGNAL(paused()), SLOT(slotPaused()) ); + connect( napp->player(), SIGNAL(timeout()), SLOT(slotTimeout()) ); + connect( napp->player(), SIGNAL(newSong()), SLOT(slotChanged()) ); + connect( napp->player(), SIGNAL(volumeChanged(int)), SLOT(slotVolumeChanged(int)) ); + connect( napp, SIGNAL(hideYourself()), SLOT(hide()) ); + connect( napp, SIGNAL(showYourself()), SLOT(show()) ); + + napp->player()->handleButtons(); + + resize( minimumSize() ); + + // Show UI and calculate video widget frame + show(); + + extra_width = (width() - video->width()); + extra_height = (height() - video->height()); + + // Load configuration + KConfig &config = *KGlobal::config(); + config.setGroup( "Simple" ); + QString str = config.readEntry( "View", "NormalSize" ); + + if (str == "HalfSize") + video->setHalfSize(); + else if (str == "NormalSize") + video->setNormalSize(); + else if (str == "DoubleSize") + video->setDoubleSize(); + else + applyMainWindowSettings( &config, "Simple" ); + + // PlayObject could be running, update video widget + slotChanged(); + + video->give(); +} + +SimpleUI::~SimpleUI() +{ + KConfig &config = *KGlobal::config(); + saveMainWindowSettings( &config, "Simple" ); + config.setGroup( "Simple" ); + QString str; + + if (video->isHalfSize()) + str = "HalfSize"; + else if (video->isNormalSize()) + str = "NormalSize"; + else if (video->isDoubleSize()) + str = "DoubleSize"; + else + str = "CustomSize"; + + config.writeEntry( "View", str ); + config.sync(); +} + + + +void SimpleUI::setupActions() +{ + KStdAction::open( napp, SLOT(fileOpen()), actionCollection(), "_file_open" ); + new KAction( i18n("&Properties"), 0, propertiesDialog, SLOT(show()), + actionCollection(), "_file_properties" ); + KStdAction::quit( napp, SLOT(quit()), actionCollection(), "_file_quit"); + + NoatunStdAction::playlist( actionCollection(), "view_playlist" ); + actionCollection()->insert(video->action( "half_size" )); + actionCollection()->insert(video->action( "normal_size" )); + actionCollection()->insert(video->action( "double_size" )); + actionCollection()->insert(video->action( "fullscreen_mode" )); + + actionCollection()->insert(napp->pluginActionMenu()); + + menubarAction = KStdAction::showMenubar(this, SLOT(showMenubar()), + actionCollection()); + statusbarAction = KStdAction::showStatusbar(this, SLOT(showStatusbar()), + actionCollection()); + NoatunStdAction::effects( actionCollection(), "effects" ); + NoatunStdAction::equalizer( actionCollection(), "equalizer" ); + NoatunStdAction::loop( actionCollection(), "loop_style" ); + KStdAction::preferences( napp, SLOT(preferences()), actionCollection() ); +} + +void SimpleUI::showMenubar() +{ + if(menubarAction->isChecked()) + menuBar()->show(); + else + menuBar()->hide(); +} + +void SimpleUI::showStatusbar() +{ + if(statusbarAction->isChecked()) + statusBar()->show(); + else + statusBar()->hide(); +} + + +void SimpleUI::setupCentralWidget() +{ + QVBox *npWidget = new QVBox( this ); + npWidget->setMargin( 0 ); + npWidget->setSpacing( 0 ); + + positionLabel = new QLabel( statusBar() ); + positionLabel->setAlignment( AlignVCenter | AlignCenter ); + positionLabel->setFixedSize( fontMetrics().size( 0, " 00:00/00:00 " ) ); + statusBar()->addWidget( positionLabel, 0, true ); + + video = new VideoFrame( npWidget ); + connect( video, SIGNAL(adaptSize(int,int)), + SLOT(slotAdaptSize(int,int)) ); + connect( video, SIGNAL(rightButtonPressed(const QPoint &)), + SLOT(slotContextMenu(const QPoint &)) ); + + QHBox *ctlFrame = new QHBox( npWidget ); + ctlFrame->setFixedHeight( 38 ); + ctlFrame->setFrameShape( QFrame::StyledPanel ); + ctlFrame->setFrameShadow( QFrame::Raised ); + ctlFrame->setMargin( 6 ); + ctlFrame->setSpacing( 6 ); + + QPushButton *backButton = new QPushButton( ctlFrame ); + backButton->setFixedSize( 24, 24 ); + backButton->setPixmap( QPixmap( back_xpm ) ); + QToolTip::add( backButton, i18n("Back") ); + connect( backButton, SIGNAL(clicked()), napp->player(), SLOT(back()) ); + + stopButton = new QPushButton( ctlFrame ); + stopButton->setFixedSize( 24, 24 ); + stopButton->setPixmap( QPixmap( stop_xpm ) ); + QToolTip::add( stopButton, i18n("Stop") ); + connect( stopButton, SIGNAL(clicked()), napp->player(), SLOT(stop()) ); + + playButton = new QPushButton( ctlFrame ); + playButton->setFixedSize( 24, 24 ); + playButton->setPixmap( QPixmap( play_xpm ) ); + QToolTip::add( playButton, i18n("Play / Pause") ); + connect( playButton, SIGNAL(clicked()), napp->player(), SLOT(playpause()) ); + + QPushButton *forwButton = new QPushButton( ctlFrame ); + forwButton->setFixedSize( 24, 24 ); + forwButton->setPixmap( QPixmap( forward_xpm ) ); + QToolTip::add( forwButton, i18n("Forward") ); + connect( forwButton, SIGNAL(clicked()), napp->player(), SLOT(forward()) ); + + slider = new L33tSlider( 0, 1000, 10, 0, L33tSlider::Horizontal, ctlFrame ); + slider->setFixedHeight( 24 ); + slider->setMinimumWidth( 100 ); + slider->setTickmarks( QSlider::NoMarks ); + connect( slider, SIGNAL(userChanged(int)), SLOT(slotSkipTo(int)) ); + connect( slider, SIGNAL(sliderMoved(int)), SLOT(slotSliderMoved(int)) ); + + QPushButton *playlistButton = new QPushButton( ctlFrame ); + playlistButton->setFixedSize( 24, 24 ); + playlistButton->setPixmap( QPixmap( playlist_xpm ) ); + QToolTip::add( playlistButton, i18n("Playlist") ); + connect( playlistButton, SIGNAL(clicked()), napp->player(), SLOT(toggleListView()) ); + + volumeButton = new QPushButton( ctlFrame ); + volumeButton->setFixedSize( 24, 24 ); + volumeButton->setPixmap( QPixmap( volume_xpm ) ); + QToolTip::add( volumeButton, i18n("Volume") ); + + volumeFrame = new QVBox( this, "Volume", WStyle_Customize | WType_Popup ); + volumeFrame->setFrameStyle( QFrame::PopupPanel ); + volumeFrame->setMargin( 4 ); + + volumeLabel = new QLabel( volumeFrame ); + volumeLabel->setText( "100%" ); + volumeLabel->setAlignment( AlignCenter ); + volumeLabel->setFixedSize( volumeLabel->sizeHint() ); + + QHBox *volumeSubFrame = new QHBox( volumeFrame ); + volumeSlider = new L33tSlider( 0, 100, 10, 0, Vertical, volumeSubFrame ); + volumeSlider->setValue( 100 - napp->player()->volume() ); + volumeSlider->setFixedSize( volumeSlider->sizeHint() ); + + volumeFrame->resize( volumeFrame->sizeHint() ); + + connect( volumeSlider, SIGNAL(sliderMoved(int)), SLOT(slotVolumeSliderMoved(int)) ); + connect( volumeSlider, SIGNAL(userChanged(int)), SLOT(slotVolumeSliderMoved(int)) ); + connect( volumeButton, SIGNAL(clicked()), SLOT(slotVolumeFrame()) ); + + setCentralWidget( npWidget ); + + video->setMinimumSize( minimumSizeHint().width(), 1 ); + + // Create properties dialog + propertiesDialog = new PropertiesDialog( this ); + propertiesDialog->resize( 375, 285 ); +} + +void SimpleUI::closeEvent( QCloseEvent * ) +{ + unload(); +} + +void SimpleUI::dragEnterEvent( QDragEnterEvent *event ) +{ + event->accept( KURLDrag::canDecode( event ) ); +} + +void SimpleUI::dropEvent( QDropEvent *event ) +{ + KURL::List uri; + if (KURLDrag::decode( event, uri )) + napp->player()->openFile( uri, false ); +} + +void SimpleUI::slotAdaptSize( int width, int height ) +{ + resize( width + extra_width, height + extra_height ); +} + +void SimpleUI::slotPlaying() +{ + playButton->setPixmap( QPixmap( pause_xpm ) ); + stopButton->setEnabled( true ); + slider->setEnabled( true ); + + if (napp->player()->current()) + statusBar()->message( napp->player()->current().title() ); +} + +void SimpleUI::slotStopped() +{ + playButton->setPixmap( QPixmap( play_xpm ) ); + stopButton->setEnabled( false ); + slider->setEnabled( false ); + slider->setValue( 0 ); + positionLabel->setText( "" ); + statusBar()->message( "" ); +} + +void SimpleUI::slotPaused() +{ + playButton->setPixmap( QPixmap( play_xpm ) ); + slider->setEnabled( true ); +} + +void SimpleUI::slotTimeout() +{ + if (napp->player()->current() && !slider->currentlyPressed()) + { + positionLabel->setText( napp->player()->lengthString() ); + slider->setRange( 0, (int)napp->player()->getLength() / 1000 ); + slider->setValue( (int)napp->player()->getTime() / 1000 ); + } +} + +void SimpleUI::slotSkipTo( int sec ) +{ + napp->player()->skipTo( sec * 1000 ); +} + +void SimpleUI::slotChanged() +{ + propertiesDialog->setPlayObject( napp->player()->current(), + napp->player()->engine()->playObject() ); +} + +void SimpleUI::slotContextMenu( const QPoint &pos ) +{ + contextMenu->exec( pos ); +} + +void SimpleUI::slotSliderMoved( int sec ) +{ + if (napp->player()->current()) + positionLabel->setText( napp->player()->lengthString( sec * 1000 ) ); +} + +void SimpleUI::slotVolumeChanged( int volume ) +{ + volumeLabel->setText( QString::number( volume ) + "%" ); + volumeSlider->setValue( 100 - volume ); +} + +void SimpleUI::slotVolumeFrame() +{ + if (volumeFrame->isVisible()) + { + volumeFrame->hide(); + } + else + { + int x = (volumeButton->width() - volumeFrame->width()) / 2; + int y = -(volumeFrame->height() + 5); + + QPoint point( volumeButton->mapToGlobal( QPoint( x, y ) ) ); + QRect deskRect = KGlobalSettings::desktopGeometry( point ); + + bool bottom = (point.y() + volumeFrame->height()) > (deskRect.y() + deskRect.height()); + bool right = (point.x() + volumeFrame->width()) > (deskRect.x() + deskRect.width()); + + volumeFrame->move( + right ? (deskRect.x() + deskRect.width()) - volumeFrame->width() : ( point.x() < 0 ? 0 : point.x() ), + bottom ? (deskRect.y() + deskRect.height()) - volumeFrame->height() : ( point.y() < 0 ? 0 : point.y() ) ); + volumeFrame->show(); + } +} + +void SimpleUI::slotVolumeSliderMoved( int slider ) +{ + napp->player()->setVolume( 100 - slider ); +} + +#include "userinterface.moc" diff --git a/noatun/modules/simple/userinterface.h b/noatun/modules/simple/userinterface.h new file mode 100644 index 00000000..c545fd2c --- /dev/null +++ b/noatun/modules/simple/userinterface.h @@ -0,0 +1,80 @@ +/* + This file is part of KDE/aRts (Noatun) - xine integration + Copyright (C) 2002 Ewald Snel + + 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. +*/ + +#ifndef __USERINTERFACE_H +#define __USERINTERFACE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "propertiesdialog.h" + + +class SimpleUI : public KMainWindow, public UserInterface +{ + Q_OBJECT + +public: + SimpleUI(); + ~SimpleUI(); + +protected: + void setupActions(); + void setupCentralWidget(); + + virtual void closeEvent( QCloseEvent * ); + virtual void dragEnterEvent( QDragEnterEvent *event ); + virtual void dropEvent( QDropEvent *event ); + +public slots: + void slotAdaptSize( int width, int height ); + void slotPlaying(); + void slotStopped(); + void slotPaused(); + void slotTimeout(); + void slotSkipTo( int sec ); + void slotChanged(); + void slotContextMenu( const QPoint &pos ); + +private slots: + void slotSliderMoved( int sec ); + void slotVolumeSliderMoved( int volume ); + void slotVolumeFrame(); + void slotVolumeChanged( int volume ); + void showMenubar(); + void showStatusbar(); + +private: + PropertiesDialog *propertiesDialog; + QPopupMenu *contextMenu; + QPushButton *stopButton; + QPushButton *playButton; + QPushButton *volumeButton; + QVBox *volumeFrame; + QLabel *volumeLabel; + QLabel *positionLabel; + VideoFrame *video; + L33tSlider *volumeSlider; + L33tSlider *slider; + int extra_width; + int extra_height; + KToggleAction *menubarAction; + KToggleAction *statusbarAction; +}; + +#endif diff --git a/noatun/modules/simple/volume.xpm b/noatun/modules/simple/volume.xpm new file mode 100644 index 00000000..fa240d42 --- /dev/null +++ b/noatun/modules/simple/volume.xpm @@ -0,0 +1,21 @@ +/* XPM */ +const char * volume_xpm[] = { +"16 16 2 1", +" c None", +". c #000000", +" ", +" ", +" . .. ", +" .. . . ", +" .... . . ", +" .... . . ", +" .. .. . ", +" . ... . ", +" .... . ", +" ..... . ", +" ...... . ", +" ....... . ", +" ........ . ", +" ............ ", +" ", +" "}; -- cgit v1.2.1