summaryrefslogtreecommitdiffstats
path: root/noatun/modules/excellent
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commite2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch)
tree9047cf9e6b5c43878d5bf82660adae77ceee097a /noatun/modules/excellent
downloadtdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.tar.gz
tdemultimedia-e2de64d6f1beb9e492daf5b886e19933c1fa41dd.zip
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
Diffstat (limited to 'noatun/modules/excellent')
-rw-r--r--noatun/modules/excellent/Makefile.am18
-rw-r--r--noatun/modules/excellent/excellent.plugin120
-rw-r--r--noatun/modules/excellent/excellentui.rc45
-rw-r--r--noatun/modules/excellent/noatunui.cpp32
-rw-r--r--noatun/modules/excellent/userinterface.cpp394
-rw-r--r--noatun/modules/excellent/userinterface.h101
6 files changed, 710 insertions, 0 deletions
diff --git a/noatun/modules/excellent/Makefile.am b/noatun/modules/excellent/Makefile.am
new file mode 100644
index 00000000..a2558676
--- /dev/null
+++ b/noatun/modules/excellent/Makefile.am
@@ -0,0 +1,18 @@
+INCLUDES= -I$(top_srcdir)/noatun/library $(all_includes)
+kde_module_LTLIBRARIES = noatun_excellent.la
+
+noatun_excellent_la_SOURCES = noatunui.cpp\
+ userinterface.cpp
+
+noatun_excellent_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
+noatun_excellent_la_LIBADD = $(LIB_KFILE) \
+ $(top_builddir)/noatun/library/libnoatun.la \
+ $(top_builddir)/noatun/library/libnoatuncontrols.la \
+ -lqtmcop -lkmedia2_idl -lsoundserver_idl
+
+noatun_excellent_la_METASOURCES = AUTO
+
+noinst_HEADERS = userinterface.h
+
+noatun_modules_excellent_DATA = excellent.plugin excellentui.rc
+noatun_modules_excellentdir = $(kde_datadir)/noatun
diff --git a/noatun/modules/excellent/excellent.plugin b/noatun/modules/excellent/excellent.plugin
new file mode 100644
index 00000000..89f747c0
--- /dev/null
+++ b/noatun/modules/excellent/excellent.plugin
@@ -0,0 +1,120 @@
+Filename=noatun_excellent.la
+Author=Neil Stevens
+Site=http://noatun.kde.org/plugins/excellent/
+Email=neil@qualityassistant.com
+Type=userinterface
+License=X11-like
+Name=Excellent
+Name[af]=Uitstekende
+Name[ar]=ممتاز
+Name[az]=Mükəmməl
+Name[ca]=Excel·lent
+Name[cs]=Vynikající
+Name[cy]=Ardderchog
+Name[de]=Hervorragend
+Name[el]=Έξοχο
+Name[eo]=Brila
+Name[es]=Excelente
+Name[et]=Suurepärane
+Name[eu]=Aparta
+Name[fa]=عالی
+Name[fi]=Erinomainen
+Name[ga]=Sármhaith
+Name[gl]=Excelente
+Name[he]=מעולה
+Name[hi]=एक्सेलेंट
+Name[hr]=Odlično
+Name[is]=Frábært
+Name[it]=Eccellente
+Name[ja]=エクセレント
+Name[km]=ល្អ​ឥត​ខ្ចោះ
+Name[lt]=Puikus
+Name[lv]=Lielisks
+Name[mk]=Одличен
+Name[mt]=Eċċellenti
+Name[nb]=Fantastisk
+Name[nds]=Goot
+Name[ne]=दक्ष
+Name[nn]=Fantastisk
+Name[pa]=ਸਰਵੋਤਮ
+Name[pl]=Doskonały
+Name[pt]=Excelente
+Name[pt_BR]=Excelente
+Name[ro]=Excelent
+Name[ru]=Превосходный
+Name[sk]=Fantastický
+Name[sv]=Utmärkt
+Name[ta]=அற்புதம்
+Name[tg]=Олиҷаноб
+Name[th]=ยอดเยี่ยม
+Name[tr]=Mükemmel
+Name[uk]=Чудовий
+Name[ven]=Zwavhudi
+Name[xh]=Hle kwaphela
+Name[zh_CN]=优秀的
+Name[zh_HK]=極佳的
+Name[zh_TW]=完美的
+Name[zu]=Kuhle kakhulu
+Comment=A very ordinary, and therefore very usable, interface
+Comment[af]='n baie gewone, en daarom baie bruikbaar, koppelvlak
+Comment[ar]=واجهة استخدام عادية ، و بالتالي ممتازة
+Comment[az]=Olduqca bəsit və istifadəli bir axtar üz
+Comment[bg]=Обикновен и поради това много полезен интерфейс
+Comment[bs]=Vrlo uobičajen i zato vrlo upotrebljiv interfejs
+Comment[ca]=Una interfície molt normal, i per tant, molt usable
+Comment[cs]=Velmi obvyklé, and proto velmi použitelné rozhraní
+Comment[cy]=Rhyngwyneb Cyffredin iawn, ac felly defnyddiol iawn
+Comment[da]=En meget ordinær, og derfor meget nyttig, grænseflade
+Comment[de]=Eine ganz normale und folglich sehr brauchbare Oberfläche
+Comment[el]=Ένα πολύ συνηθισμένο, και έτσι πολύ εύχρηστο περιβάλλον
+Comment[eo]=Ordinara kaj do tre uzebla interfaco
+Comment[es]=Una interfaz muy común y por tanto muy fácil de usar
+Comment[et]=Väga tavaline ja lihtsasti kasutatav kasutajaliides
+Comment[eu]=Interfaze arrunta eta oso erabilgarria
+Comment[fa]=یک واسط معمولی، و بنابراین بسیار مفید
+Comment[fi]=Hyvin tavallinen ja käyttökelpoinen käyttöliittymä
+Comment[fr]=Une interface très ordinaire et donc très utilisable
+Comment[ga]=Comhéadan an-choitianta, agus dá bharr sin, an-inúsáidte
+Comment[gl]=Unha interface moi usual e polo tanto moi usábel
+Comment[he]=ממשק מאוד פשוט, ועל כן מאוד שימושי
+Comment[hi]=एक बहुत साधारण, अतः बहुत उपयोगी इंटरफेस
+Comment[hr]=Vrlo obično, i prema tome vrlo upotrebljivo, sučelje
+Comment[hu]=Egy jól ismert, ezért jól használható felület
+Comment[is]=Mjög venjulegt og notanlegt viðmót
+Comment[it]=Un'interfaccia molto ordinaria e molto usabile
+Comment[ja]=非常にありふれているが、だからこそ使いやすいインターフェース
+Comment[kk]=Ең кәдімгі, сондықтан жиі қолданылатын интерфейс
+Comment[km]=ចំណុច​ប្រទាក់​សាមញ្ញ​បំផុត ហើយ​ក៏​ងាយស្រួល​ប្រើ​ដែរ
+Comment[ko]=아주 평범하고 쓸만한 인터페이스
+Comment[lt]=Labai paprasta ir dėlto labai naudinga sąsaja
+Comment[lv]=Ļoti vienkārša, un tādēļ ļoti izmantojama, starpseja
+Comment[mk]=Мошне обичен, и според тоа мошне корисен интерфејс
+Comment[ms]=Antaramuka yang sangat biasa tetapi berguna
+Comment[mt]=Interfaċċja ordijarja ħafna u għalhekk utli ħafna
+Comment[nb]=Et svært vanlig og brukervennlig grensesnitt
+Comment[nds]=En bannig normaal un dorüm bannig eenfach to bruken Böversiet
+Comment[ne]=साधारण भएकोले धेरै उपयोगि इन्टरफेस
+Comment[nl]=Een heel gewone, en daarom erg bruikbare, interface
+Comment[nn]=Eit svært normalt og difor lettbruka grensesnitt
+Comment[pl]=Bardzo zwyczajny, ale przez to bardzo użyteczny motyw
+Comment[pt]=Uma interface básica e, por isso, muito fácil de usar
+Comment[pt_BR]=Uma interface bem ordinária e portanto muito utilizável
+Comment[ro]=O interfaţă foarte simplă şi foarte utilă
+Comment[ru]=Самый обычный, а потому и очень полезный интерфейс
+Comment[se]=Hui dábálaš ja dannege geavahahtti lakta
+Comment[sk]=Veľmi obyčajné, a preto použiteľné, rozhranie
+Comment[sl]=Zelo običajen in zato zelo uporaben vmesnik
+Comment[sr]=Веома обичан, стога и веома лак за коришћење, интерфејс
+Comment[sr@Latn]=Veoma običan, stoga i veoma lak za korišćenje, interfejs
+Comment[sv]=Ett väldigt vanligt och därför väldigt användbart gränssnitt
+Comment[ta]=மிக எளிய, பயனுள்ள இடைமுகம்
+Comment[tg]=Интерфейси хеле содда ва бинобар бисёр фоиданок
+Comment[th]=ส่วนติดต่อแบบง่ายๆ และด้วยเหตุนั้นก็เลยมีประโยชน์อย่างมาก
+Comment[tr]=Oldukça basit ve kullanışlı bir arayüz
+Comment[uk]=Дуже звичний, і тому дуже зручний, інтерфейс
+Comment[ven]=Zwithu zwazwo, zwo ralo zwa vhuthogwa, interface
+Comment[xh]=Eqheleke kakhulu, neluncedo kakhulu, injongano
+Comment[zh_CN]=非常普通,因而也非常有用的接口
+Comment[zh_HK]=非常普通但是很實用的介面
+Comment[zh_TW]=非常普通但是很實用的介面
+Comment[zu]=Ejwayelekile ngakhoke esebenzisekayo,uxhumano olubhekeneyo
diff --git a/noatun/modules/excellent/excellentui.rc b/noatun/modules/excellent/excellentui.rc
new file mode 100644
index 00000000..f9c43c70
--- /dev/null
+++ b/noatun/modules/excellent/excellentui.rc
@@ -0,0 +1,45 @@
+<!DOCTYPE kpartgui>
+<!--
+vim: syntax=xml
+-->
+<kpartgui name="noatunexcellent" version="4">
+<MenuBar>
+ <Menu name="file" noMerge="1"><text>&amp;File</text>
+ <Action name="file_open"/>
+ <Separator lineSeparator="true"/>
+ <Action name="file_quit"/>
+ </Menu>
+ <Menu name="go_music" noMerge="1"><text>&amp;Go</text>
+ <Action name="back"/>
+ <Action name="stop"/>
+ <Action name="play"/>
+ <Action name="pause"/>
+ <Action name="forward"/>
+ </Menu>
+ <Menu name="settings" noMerge="1"><text>&amp;Settings</text>
+ <Merge name="StandardToolBarMenuHandler" />
+ <Action name="options_show_toolbar"/>
+ <Action name="options_show_menubar"/>
+ <Action name="show_playlist"/>
+ <Action name="show_volumecontrol"/>
+ <Separator lineSeparator="true"/>
+ <Action name="effects"/>
+ <Action name="equalizer"/>
+ <Action name="loop_style"/>
+ <Separator lineSeparator="true"/>
+ <Action name="options_configure"/>
+ </Menu>
+</MenuBar>
+<Toolbar name="main"><text>Main Toolbar</text>
+ <Action name="back"/>
+ <Action name="stop"/>
+ <Action name="play"/>
+ <Action name="pause"/>
+ <Action name="forward"/>
+ <Separator lineSeparator="true"/>
+ <Action name="file_open"/>
+ <Action name="show_playlist"/>
+ <Separator lineSeparator="true"/>
+ <Action name="loop_style"/>
+</Toolbar>
+</kpartgui>
diff --git a/noatun/modules/excellent/noatunui.cpp b/noatun/modules/excellent/noatunui.cpp
new file mode 100644
index 00000000..a103268d
--- /dev/null
+++ b/noatun/modules/excellent/noatunui.cpp
@@ -0,0 +1,32 @@
+// noatunui.cpp
+//
+// Copyright (C) 2000 Neil Stevens <multivac@fcmail.com>
+// Copyright (C) 1999 Charles Samuels <charles@kde.org>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#include "userinterface.h"
+
+extern "C" KDE_EXPORT Plugin *create_plugin()
+{
+ return new Excellent();
+}
diff --git a/noatun/modules/excellent/userinterface.cpp b/noatun/modules/excellent/userinterface.cpp
new file mode 100644
index 00000000..7f218e98
--- /dev/null
+++ b/noatun/modules/excellent/userinterface.cpp
@@ -0,0 +1,394 @@
+// userinterface.cpp
+//
+// Copyright (C) 2001 Neil Stevens <neil@qualityassistant.com>
+// Copyright (C) 1999 Charles Samuels <charles@kde.org>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <noatun/effects.h>
+#include <noatun/app.h>
+#include <noatun/controls.h>
+#include <noatun/pref.h>
+#include <noatun/player.h>
+
+#include "userinterface.h"
+
+#include <kbuttonbox.h>
+#include <kconfig.h>
+#include <kfiledialog.h>
+#include <kglobal.h>
+#include <kiconloader.h>
+#include <klocale.h>
+#include <kmenubar.h>
+#include <kmessagebox.h>
+#include <kpixmapeffect.h>
+#include <kpopupmenu.h>
+#include <kstatusbar.h>
+#include <kstdaction.h>
+#include <kwin.h>
+#include <kurldrag.h>
+
+#include <qbitmap.h>
+#include <qdragobject.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qobjectlist.h>
+#include <qobjectdict.h>
+#include <qpushbutton.h>
+#include <qtooltip.h>
+#include <qvbox.h>
+
+Excellent::Excellent()
+ : KMainWindow(0, "NoatunExcellent")
+ , UserInterface()
+{
+ setAcceptDrops(true);
+
+ KStdAction::quit(napp, SLOT(quit()), actionCollection());
+ KStdAction::open(napp, SLOT(fileOpen()), actionCollection());
+ setStandardToolBarMenuEnabled(true);
+
+ menubarAction = KStdAction::showMenubar(this, SLOT(showMenubar()), actionCollection());
+ KStdAction::preferences(napp, SLOT(preferences()), actionCollection());
+
+ // buttons
+ NoatunStdAction::back(actionCollection(), "back");
+ NoatunStdAction::stop(actionCollection(), "stop");
+ NoatunStdAction::play(actionCollection(), "play");
+ NoatunStdAction::pause(actionCollection(), "pause");
+ NoatunStdAction::forward(actionCollection(), "forward");
+ NoatunStdAction::playlist(actionCollection(), "show_playlist");
+
+ volumeAction = new KToggleAction(i18n("Show &Volume Control"), 0, this, SLOT(showVolumeControl()), actionCollection(), "show_volumecontrol");
+ volumeAction->setCheckedState(i18n("Hide &Volume Control"));
+ NoatunStdAction::effects(actionCollection(), "effects");
+ NoatunStdAction::equalizer(actionCollection(), "equalizer");
+
+ NoatunStdAction::loop(actionCollection(), "loop_style");
+
+ createGUI("excellentui.rc");
+
+ napp->pluginActionMenu()->plug(menuBar(),3);
+ toolBar("mainToolBar")->hide();
+
+ // Who needs Qt Designer?
+ mainFrame = new QHBox(this);
+ mainFrame->setSpacing(KDialog::spacingHint());
+ mainFrame->setMargin(0);
+ slider = new L33tSlider(0, 1000, 10, 0, L33tSlider::Horizontal, mainFrame);
+ slider->setTickmarks(QSlider::NoMarks);
+
+ elapsed = new QLabel(mainFrame);
+ QFont labelFont = elapsed->font();
+ labelFont.setPointSize(24);
+ labelFont.setBold(true);
+ QFontMetrics labelFontMetrics = labelFont;
+ elapsed->setFont(labelFont);
+ elapsed->setAlignment(AlignCenter | AlignVCenter | ExpandTabs);
+ elapsed->setText("--:--");
+ elapsed->setFixedHeight(labelFontMetrics.height());
+ elapsed->setMinimumWidth(elapsed->sizeHint().width());
+
+ // Doing this makes the slider the same heigh as the font. This is just plain wrong...
+ //slider->setFixedHeight(labelFontMetrics.height());
+
+ setCentralWidget(mainFrame);
+
+ total = new QLabel(statusBar());
+ labelFont = total->font();
+ labelFont.setBold(true);
+ total->setFont(labelFont);
+ total->setAlignment(AlignCenter | AlignVCenter | ExpandTabs);
+ total->setText("--:--");
+ total->setMinimumWidth(total->sizeHint().width());
+ total->setText("");
+
+ statusBar()->addWidget(total, 0, true);
+ statusBar()->show();
+
+ connect( napp, SIGNAL(hideYourself()), this, SLOT(hide()) );
+ connect( napp, SIGNAL(showYourself()), this, SLOT(show()) );
+
+ connect(napp->player(), SIGNAL(playing()), this, SLOT(slotPlaying()));
+ connect(napp->player(), SIGNAL(stopped()), this, SLOT(slotStopped()));
+ connect(napp->player(), SIGNAL(paused()), this, SLOT(slotPaused()));
+ napp->player()->handleButtons();
+
+ connect(napp->player(), SIGNAL(timeout()), this, SLOT(slotTimeout()));
+ connect(napp->player(), SIGNAL(loopTypeChange(int)), this, SLOT(slotLoopTypeChanged(int)));
+
+ /* This skipToWrapper is needed to pass milliseconds to Player() as everybody
+ * below the GUI is based on milliseconds instead of some unprecise thingy
+ * like seconds or mille */
+ connect(slider, SIGNAL(userChanged(int)), this, SLOT(skipToWrapper(int)));
+ connect(this, SIGNAL(skipTo(int)), napp->player(), SLOT(skipTo(int)));
+
+ connect(slider, SIGNAL(sliderMoved(int)), SLOT(sliderMoved(int)));
+
+ setCaption("Noatun");
+ setIcon(SmallIcon("noatun"));
+ //slotLoopTypeChanged(Player::None);
+ changeStatusbar();
+ handleLengthString("--:--/--:--");
+
+ setMinimumWidth(250);
+ resize(300, 75);
+
+ KConfig &config = *KGlobal::config();
+
+ toolBar("main")->applySettings(&config, "Excellent main");
+
+ config.setGroup("excellent");
+
+ volumeSlider = 0;
+ volumeAction->setChecked( config.readBoolEntry("volumeShown", false) );
+ showVolumeControl();
+
+ menubarAction->setChecked( config.readBoolEntry("menuShown", true) );
+ showMenubar();
+
+ applyMainWindowSettings(&config, "excellent");
+
+ switch((NET::MappingState)config.readNumEntry("mappingState", (int)NET::Visible))
+ {
+ case NET::Visible:
+ showNormal();
+ break;
+ case NET::Withdrawn:
+ if (napp->libraryLoader()->isLoaded("systray.plugin"))
+ hide();
+ break;
+ case NET::Iconic:
+ showMinimized();
+ break;
+ }
+
+ for (QPtrListIterator<QObject> i(*children()); i.current(); ++i)
+ (*i)->installEventFilter(this);
+}
+
+Excellent::~Excellent()
+{
+ KConfig &config = *KGlobal::config();
+ saveMainWindowSettings(&config, "excellent");
+ toolBar("main")->saveSettings(&config, "Excellent main");
+ config.setGroup("excellent");
+ config.writeEntry("volumeShown", volumeAction->isChecked());
+ config.writeEntry("menuShown", menubarAction->isChecked());
+ config.writeEntry("width", width());
+ config.writeEntry("height", height());
+ config.sync();
+}
+
+void Excellent::showEvent(QShowEvent *e)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("excellent");
+ config->writeEntry("mappingState", NET::Visible);
+ config->sync();
+
+ KMainWindow::showEvent(e);
+}
+
+void Excellent::hideEvent(QHideEvent *e)
+{
+ KConfig *config = KGlobal::config();
+ config->setGroup("excellent");
+ config->writeEntry("mappingState", NET::Withdrawn);
+ config->sync();
+
+ KMainWindow::hideEvent(e);
+}
+
+void Excellent::closeEvent(QCloseEvent *)
+{
+ unload();
+}
+
+void Excellent::dragEnterEvent(QDragEnterEvent *event)
+{
+ // accept uri drops only
+ event->accept(KURLDrag::canDecode(event));
+}
+
+void Excellent::dropEvent(QDropEvent *event)
+{
+ KURL::List uri;
+ if (KURLDrag::decode(event, uri))
+ {
+ for (KURL::List::Iterator i = uri.begin(); i != uri.end(); ++i)
+ napp->player()->openFile(*i, false);
+ }
+}
+
+bool Excellent::eventFilter(QObject *o, QEvent *e)
+{
+ if (e->type() == QEvent::Wheel)
+ {
+ wheelEvent(static_cast<QWheelEvent*>(e));
+ return true;
+ }
+ return QWidget::eventFilter(o, e);
+}
+
+void Excellent::wheelEvent(QWheelEvent *e)
+{
+ int delta=e->delta();
+ napp->player()->setVolume(napp->player()->volume() + delta/120*2);
+}
+
+void Excellent::slotPlaying()
+{
+ slider->setEnabled(true);
+ changeStatusbar();
+}
+
+void Excellent::slotStopped()
+{
+ slider->setEnabled(false);
+ if(!napp->player()->current()) return;
+ changeStatusbar();
+ slider->setValue(0);
+ handleLengthString("--:--/--:--");
+}
+
+void Excellent::slotPaused()
+{
+ slider->setEnabled(true);
+ changeStatusbar();
+}
+
+void Excellent::slotTimeout()
+{
+ if(volumeSlider) volumeSlider->setValue(100 - napp->player()->volume());
+
+ if (!slider->currentlyPressed())
+ handleLengthString(napp->player()->lengthString());
+
+ if(!napp->player()->current()) return;
+ if(slider->currentlyPressed()) return;
+
+ slider->setRange(0, (int)napp->player()->getLength() / 1000 );
+ slider->setValue((int)napp->player()->getTime() / 1000 );
+
+ changeStatusbar();
+}
+
+void Excellent::sliderMoved(int seconds)
+{
+ if(napp->player()->current())
+ handleLengthString(napp->player()->lengthString(seconds * 1000));
+}
+
+void Excellent::skipToWrapper(int second) // wrap int to int _and_ seconds to mseconds
+{
+ emit skipTo((int)(second*1000));
+}
+
+void Excellent::slotLoopTypeChanged(int type)
+{
+ static const int time = 2000;
+ switch (type)
+ {
+ case Player::None:
+ statusBar()->message(i18n("No looping"), time);
+ break;
+ case Player::Song:
+ statusBar()->message(i18n("Song looping"), time);
+ break;
+ case Player::Playlist:
+ statusBar()->message(i18n("Playlist looping"), time);
+ break;
+ case Player::Random:
+ statusBar()->message(i18n("Random play"), time);
+ }
+}
+
+void Excellent::showMenubar(void)
+{
+ if(menubarAction->isChecked())
+ {
+ menuBar()->show();
+ }
+ else
+ {
+ KMessageBox::information(this, i18n("<qt>Press %1 to show the menubar.</qt>").arg(menubarAction->shortcut().toString()), QString::null, "Hide Menu warning");
+ menuBar()->hide();
+ }
+}
+
+void Excellent::showVolumeControl(void)
+{
+ if(volumeAction->isChecked())
+ growVolumeControl();
+ else
+ shrinkVolumeControl();
+}
+
+void Excellent::changeStatusbar(void)
+{
+ if(!napp->player()->current().isNull())
+ statusBar()->message(napp->player()->current().title());
+}
+
+void Excellent::handleLengthString(const QString &text)
+{
+ if(text.right(5) == "00:00" && text.left(5) == "00:00")
+ {
+ elapsed->setText("--:--");
+ total->setText("--:--");
+ }
+ else
+ {
+ // Split the length string in to "current" and "elapsed"
+ QStringList tokens = QStringList::split("/", text);
+
+ elapsed->setText(tokens[0]);
+ total->setText(tokens[1]);
+ }
+}
+
+void Excellent::growVolumeControl(void)
+{
+ volumeSlider = new L33tSlider(0, 100, 10, 0, Vertical, mainFrame);
+ volumeSlider->setValue(100 - napp->player()->volume());
+ volumeSlider->show();
+ connect(volumeSlider, SIGNAL(sliderMoved(int)), SLOT(changeVolume(int)));
+ connect(volumeSlider, SIGNAL(userChanged(int)), SLOT(changeVolume(int)));
+}
+
+void Excellent::shrinkVolumeControl(void)
+{
+ delete volumeSlider;
+ volumeSlider = 0;
+}
+
+void Excellent::changeVolume(int slider)
+{
+ napp->player()->setVolume(100 - slider);
+}
+
+#include "userinterface.moc"
diff --git a/noatun/modules/excellent/userinterface.h b/noatun/modules/excellent/userinterface.h
new file mode 100644
index 00000000..588db6e4
--- /dev/null
+++ b/noatun/modules/excellent/userinterface.h
@@ -0,0 +1,101 @@
+// userinterface.h
+//
+// Copyright (C) 2000, 2001 Neil Stevens <multivac@fcmail.com>
+// Copyright (C) 1999 Charles Samuels <charles@kde.org>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+// AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Except as contained in this notice, the name(s) of the author(s) shall not be
+// used in advertising or otherwise to promote the sale, use or other dealings
+// in this Software without prior written authorization from the author(s).
+
+#ifndef USERINTERFACE_H
+#define USERINTERFACE_H
+
+#include <noatun/plugin.h>
+#include <noatun/app.h>
+#include <noatun/stdaction.h>
+#include <kmainwindow.h>
+
+class KAction;
+class KPopupMenu;
+class KStatusBar;
+class Player;
+class QHBox;
+class QLabel;
+class QSlider;
+class L33tSlider;
+class KToggleAction;
+
+/**
+ * @short Main window class
+ * @author Neil Stevens <multivac@fcmail.com>
+ * @author Charles Samuels <charles@kde.org>
+ */
+class Excellent : public KMainWindow, public UserInterface
+{
+Q_OBJECT
+
+public:
+ Excellent();
+ virtual ~Excellent();
+ void load(const QString& url);
+
+protected:
+ virtual void showEvent(QShowEvent *);
+ virtual void hideEvent(QHideEvent *);
+ virtual void closeEvent(QCloseEvent *);
+ virtual void dragEnterEvent(QDragEnterEvent *);
+ virtual void dropEvent(QDropEvent *);
+ void wheelEvent(QWheelEvent *e);
+ bool eventFilter(QObject *o, QEvent *e);
+
+public slots:
+ void slotPlaying();
+ void slotStopped();
+ void slotPaused();
+
+ void slotTimeout();
+ void sliderMoved(int seconds);
+ void slotLoopTypeChanged(int type);
+ void skipToWrapper(int second);
+
+signals:
+ // emitted by skipToWrapper()
+ void skipTo(int);
+
+private slots:
+ void showVolumeControl(void);
+ void showMenubar(void);
+ void changeStatusbar(void);
+ void changeVolume(int);
+
+ void handleLengthString(const QString &text);
+
+private:
+ void growVolumeControl(void);
+ void shrinkVolumeControl(void);
+
+ QHBox *mainFrame;
+
+ KToggleAction *volumeAction, *menubarAction;
+ L33tSlider *volumeSlider, *slider;
+ QLabel *elapsed, *total;
+};
+
+#endif