diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | e2de64d6f1beb9e492daf5b886e19933c1fa41dd (patch) | |
tree | 9047cf9e6b5c43878d5bf82660adae77ceee097a /noatun/modules/monoscope | |
download | tdemultimedia-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/monoscope')
-rw-r--r-- | noatun/modules/monoscope/Makefile.am | 16 | ||||
-rw-r--r-- | noatun/modules/monoscope/monoscope.cpp | 112 | ||||
-rw-r--r-- | noatun/modules/monoscope/monoscope.h | 34 | ||||
-rw-r--r-- | noatun/modules/monoscope/monoscope.plugin | 99 |
4 files changed, 261 insertions, 0 deletions
diff --git a/noatun/modules/monoscope/Makefile.am b/noatun/modules/monoscope/Makefile.am new file mode 100644 index 00000000..55c58a05 --- /dev/null +++ b/noatun/modules/monoscope/Makefile.am @@ -0,0 +1,16 @@ +INCLUDES= -I$(top_srcdir)/noatun/library $(all_includes) +kde_module_LTLIBRARIES = noatun_monoscope.la + +noatun_monoscope_la_SOURCES = monoscope.cpp +#prefs.cpp + +noatun_monoscope_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +noatun_monoscope_la_LIBADD = $(LIB_KFILE) $(top_builddir)/noatun/library/libnoatun.la -lm + +noatun_monoscope_la_METASOURCES = AUTO + +noinst_HEADERS = monoscope.h +#prefs.h + +noatun_modules_monoscope_DATA = monoscope.plugin +noatun_modules_monoscopedir = $(kde_datadir)/noatun diff --git a/noatun/modules/monoscope/monoscope.cpp b/noatun/modules/monoscope/monoscope.cpp new file mode 100644 index 00000000..5ab63ecc --- /dev/null +++ b/noatun/modules/monoscope/monoscope.cpp @@ -0,0 +1,112 @@ +#include "monoscope.h" +#include <noatun/player.h> +#include <noatun/app.h> +#include <math.h> +#include <qpainter.h> +#include <kactionclasses.h> +#include <noatun/stdaction.h> +#include <klocale.h> + +extern "C" +{ + KDE_EXPORT Plugin *create_plugin() + { + return new Monoscope(); + } +} + +Monoscope::Monoscope() : QWidget(0,0,WRepaintNoErase), MonoScope(30), Plugin() +{ + NOATUNPLUGINC(Monoscope); + + mAction=0L; + mLowColor=qRgb(0,0,0); + mHighColor=qRgb(238,238,238); + resize(320, 240); + MonoScope::start(); + setCaption(i18n("Monoscope")); + show(); + resizeEvent(0); + repaint(0,0, QWidget::width(), height(), false); + resizeEvent(0); + setBackgroundColor(mLowColor); +} + +Monoscope::~Monoscope() +{ + if(mAction) + napp->pluginActionMenu()->remove(mAction); +} + +void Monoscope::init() +{ + mAction = new KToggleAction(i18n("Toggle Monoscope"), 0, 0, + this, SLOT(toggle()), this, "togglemonoscope"); + mAction->setChecked(!isHidden()); + napp->pluginActionMenu()->insert(mAction); +} + +void Monoscope::toggle(void) +{ + if(isHidden()) + show(); + else + hide(); +} + +void Monoscope::closeEvent(QCloseEvent *) +{ + hide(); +} + +void Monoscope::resizeEvent(QResizeEvent *) +{ + setSamples(width()); +} + +void Monoscope::scopeEvent(float *d, int size) +{ + // save cpu + if(isHidden()) return; + + const bool line=false; + + int viewWidth =width(); + int viewHeight=height(); + + float *end=d+size; + int x=0; + int heightHalf=viewHeight/4; + int y=viewHeight/2; + // reduce flicker + QPixmap buffer(viewWidth, viewHeight, -1, QPixmap::BestOptim); + buffer.fill(mLowColor); + QPainter p(&buffer); + p.setPen(mHighColor); + repaint(rect()); + + if (line) + p.moveTo(0, y); + + while (d<=end) + { + float &n=*d; + + n *= heightHalf; + int amp=(int)n; + + if (line) // line + p.lineTo(x, y+amp); + else // fill + p.drawLine(x, y, x, y+amp); + d++; + x++; + + } + if (line) + p.drawLine(0, y, size, y); + bitBlt(this, 0, 0, &buffer, 0, 0, viewWidth, viewHeight, Qt::CopyROP); +} + +#include "monoscope.moc" + diff --git a/noatun/modules/monoscope/monoscope.h b/noatun/modules/monoscope/monoscope.h new file mode 100644 index 00000000..37031a4b --- /dev/null +++ b/noatun/modules/monoscope/monoscope.h @@ -0,0 +1,34 @@ +#ifndef MONOSCOPE_H +#define MONOSCOPE_H + +#include <noatun/plugin.h> + +class KToggleAction; + +class Monoscope : public QWidget, public MonoScope, public Plugin +{ +Q_OBJECT +NOATUNPLUGIND + +public: + Monoscope(); + virtual ~Monoscope(); + + void init(); + +public slots: + void toggle(void); + +protected: + virtual void closeEvent(QCloseEvent *); + virtual void scopeEvent(float *data, int bands); + + virtual void resizeEvent(QResizeEvent *); + +private: + QRgb mHighColor, mLowColor; + KToggleAction *mAction; +}; + +#endif + diff --git a/noatun/modules/monoscope/monoscope.plugin b/noatun/modules/monoscope/monoscope.plugin new file mode 100644 index 00000000..b4533c0f --- /dev/null +++ b/noatun/modules/monoscope/monoscope.plugin @@ -0,0 +1,99 @@ +Filename=noatun_monoscope.la +Author=Charles Samuels +Site=http://noatun.kde.org/ +Type=visualization +License=BSD +Name=Monoscope +Name[af]=Monoskoop +Name[ar]=مونوسكوب +Name[az]=Monoskop +Name[ca]=Monoscopi +Name[cs]=Monoskop +Name[da]=Monoskop +Name[eo]=Monoskopo +Name[es]=Monoscopio +Name[fa]=تک دامنهای +Name[gl]=Monoscopio +Name[hi]=मोनोस्कोप +Name[hu]=Monoszkóp +Name[it]=Monoscopio +Name[ja]=モノスコープ +Name[kk]=Осцилограф +Name[lv]=Monoskops +Name[mt]=Monoskopju +Name[ne]=मोमोस्कोप +Name[pa]=ਮੋਨੋਸਕੋਪ +Name[pl]=Monoskop +Name[ro]=Monoscop +Name[ru]=Моноскоп +Name[sk]=Monoskop +Name[sv]=Monoskop +Name[ta]=ஓரெல்லைப் பரப்பு +Name[tr]=Monoskop +Name[uk]=Моноскоп +Name[xh]=Isithuba esinye +Name[zh_CN]=单像管 +Name[zh_HK]=單像管 +Name[zh_TW]=單像管 +Name[zu]=Isithuba esinye +Comment=A neat waveform scope analyzer +Comment[af]='n netjiese golfvorm skoop analiseerder +Comment[az]=Dalğa şəklində analiz proqramı +Comment[bg]=Изящен осцилограф +Comment[bs]=Zgodan analizator talasne forme +Comment[ca]=Un analitzador pulcre de camps d'ones +Comment[cs]=Vkusný analyzátor vln +Comment[cy]=Dadansoddydd Twt ar gyfer Cwmpas Tonffurf +Comment[da]=En smart bølgeformsscope-analysator +Comment[de]=Ein Programm zur "Waveform/Scope"-Analyse +Comment[el]=Ένας θαυμάσιος αναλυτής φάσματος κυματομορφών +Comment[en_GB]=A neat waveform scope analyser +Comment[eo]=Uzinda ondo-analizilo +Comment[es]=Un analizador elegante de formas de onda +Comment[et]=Nunnu signaalikuju analüsaator +Comment[eu]=uhinforma esparruko analizatzailea +Comment[fa]=تحلیلکنندۀ دامنۀ موجی شکل ساده +Comment[fi]=Nätti oskilloskooppi +Comment[fr]=Un bel analyseur de spectre +Comment[gl]=Analizador suave da forma da onda +Comment[he]=מאבחן תחומי גל +Comment[hi]=एक साफ वेवफार्म स्कोप एनॉलाइजर +Comment[hr]=Simpatičan analizator zvuka +Comment[hu]=Egy kellemes hullámforma-analizáló program +Comment[is]=Flottur bylgjugreinir +Comment[it]=Un puro analizzatore di forme d'onda +Comment[ja]=かっこいい波形スコープアナライザ +Comment[kk]=Керемет бір осциллограф секілді аспап +Comment[km]=កម្មវិធីវិភាគវិសាលភាពទម្រង់ wave ហ្មត់ចត់ +Comment[ko]=파형을 관찰하고 분석하는 도구 +Comment[lt]=Gražus bangų formos vaizdo analizatorius +Comment[lv]=Vienkāršs viļņaformas analizators +Comment[mk]=Симпатичен осцилоскоп за анализа на бранови форми +Comment[ms]=Penganalisis skop bentuk gelombang +Comment[nb]=Et nett lite program for analysering av «waveform scope» +Comment[nds]=En smuck Bülgenformrebeetkieker +Comment[ne]=क्षेत्र विश्लेषकबाट निट तरङ +Comment[nl]=Een goed waveform scope-analyseprogramma +Comment[nn]=Analysering av «waveform scope» +Comment[pl]=Analizator fal dźwiękowych +Comment[pt]=Um analisador de formas de onda bonito +Comment[pt_BR]=Um analisador de formas de onda +Comment[ro]=Un analizor de formă de undă foarte bun +Comment[ru]=Симпатичный осциллограф +Comment[sk]=Milý analyzátor vĺn +Comment[sl]=Lep analizator zvoka +Comment[sr]=Уредан анализатор облика таласа +Comment[sr@Latn]=Uredan analizator oblika talasa +Comment[sv]=Elegant oscilloskop +Comment[ta]=ஒரு சீரான அலைவடிவ ஆய்வாளர் +Comment[tg]=Таҳлилгари намудсози шакли мавҷии шабакавӣ +Comment[th]=โปรแกรมวิเคราะห์รูปแบบคลื่นที่ปราณีต +Comment[tr]=Dalga formu analiz programı +Comment[uk]=Гарний аналізатор хвильових меж +Comment[ven]=Mugudi neat waveform scope +Comment[xh]=Umhlahleli wesithuba wendlela ecocekileyo yamaza +Comment[zh_CN]=一个小巧的波形范围分析器 +Comment[zh_HK]=小巧的波形範圍分析器 +Comment[zh_TW]=一個小巧的波形分析器 +Comment[zu]=Umhaziyi wesithuba wendlela ecehlanzekile |