From 91abca7d30fa1516efbaa6f6caa6da40512e9f3b Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Fri, 30 Nov 2012 13:55:34 +0100 Subject: [PATCH 1/2] - icons: introduce new icons backward, forward, pause and play --- data/icons/Makefile.am | 4 ++++ data/icons/btn_backward.png | Bin 0 -> 572 bytes data/icons/btn_forward.png | Bin 0 -> 620 bytes data/icons/btn_pause.png | Bin 0 -> 566 bytes data/icons/btn_play.png | Bin 0 -> 580 bytes src/gui/widget/icons.h | 4 ++++ 6 files changed, 8 insertions(+) create mode 100644 data/icons/btn_backward.png create mode 100644 data/icons/btn_forward.png create mode 100644 data/icons/btn_pause.png create mode 100644 data/icons/btn_play.png diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am index 4b256a96e..b8b41539d 100644 --- a/data/icons/Makefile.am +++ b/data/icons/Makefile.am @@ -46,6 +46,10 @@ install_DATA += \ bookmarkmanager.png \ border_lr.png \ border_ul.png \ + btn_backward.png \ + btn_forward.png \ + btn_pause.png \ + btn_play.png \ btn_record_active.png \ btn_record_inactive.png \ btn_stop.png \ diff --git a/data/icons/btn_backward.png b/data/icons/btn_backward.png new file mode 100644 index 0000000000000000000000000000000000000000..962e71c844cad566117abca0ed551ecce160e956 GIT binary patch literal 572 zcmV-C0>k}@P)&xpfnI=6S2%}m=d=X=;#aqBwi}ftldU!={JgjH%J)fu+kxY}&0*DBz3V<$Pj9CDT z&2wuF##oFshzI}{Ad?J5L31cdy;0}*<1zEu97%=O(JQ*$F0=WJR8lg@{t!r-PvD$G zRoQ>D&%xUR0Iq&su@~)8Z!`cH$1!*FJ0!g~K_Nj=n$0GyR%>Zir_-VRuDyKU{<=j( zmJ)mb$pp<5#nEoJSKKZNi*U~2RFO27|$};pFoP{eFLq(rpst><-`eiQ{-lQYw}C{^Nqv;VA$H1Int2St>Z^@=ddb zt*wCZ<(T1@A={OwJbv_q$z;N4G@??eV2mM4?-8UTprFp-0P9(Ta=`OvFF=(b2(X^V zZgm%@8Rc?0?^zJsWRiv3JKO&}Ag@%S*xceGec&jWCjWcRpMC@MT=x#q|Kr^N0000< KMNUMnLSTY+Z34^y literal 0 HcmV?d00001 diff --git a/data/icons/btn_forward.png b/data/icons/btn_forward.png new file mode 100644 index 0000000000000000000000000000000000000000..cad43950b4e18dc11a5166a666f53ba142591738 GIT binary patch literal 620 zcmV-y0+aoTP)3loZ&8}ymQrXuO&^2BkBGZt}z8UCSQVnL9kNwpU>R!S=gt~{?$ zC=`g}pIB>eTQJrjR*UMj#@WuBFuCE8v z790-u7sKBE9xu1H61-pEPae8$!5G9zGRjGD6J=2*-w5Qbq=qpF)#dGxr*)zuHQ=P~H_X@C7fYG#J)d={-W ztyYV4I!!*8CzVPOgaP6lpFg$m0fxqafH+4OhAb^TB=7_7MG;ylO3NkuARvk&P=d7< zYeyf+2QIC#nc4fZ|6H6Xijv$6Ent(4^nvY8yYs*6{Q5T~#rw|VNFT%i0000B literal 0 HcmV?d00001 diff --git a/data/icons/btn_pause.png b/data/icons/btn_pause.png new file mode 100644 index 0000000000000000000000000000000000000000..c18fafa40af1986e5d09fc04263c41c14bcf9496 GIT binary patch literal 566 zcmV-60?GY}P))M_=Rvnk$tyz_quT((dU zLZH=Z0dV@^l*jLnr1O+UqX9s(+2q^91L-WqWg7}s76i$!`RAB)KF`gbo_>&~>Dqz? zaNZ$a5JK*AmSqs~q`$Ka9|F$1T?-;xSqX%lAt180U{@9b0Yq)%LBbYR2qO6uoO4K! zb(EVF;co&6y95jNK)>GypwsDKjRoL#a0|e7_nLyWC{%ulK68W+(8@3v47mAx!}G6a zN~IFTf@Sz+NUzspGMP{=M_6m|n>)yy0|5yEV+@r_g>tD(VXufW7Gn&DhgA+L2kgBm zVy#_ZmIPz(e6;^||DVTWtzGx41c0#xE|O95zvq1Q0+Jf==ZYee<^TWy07*qoM6N<$ Ef)jK36aWAK literal 0 HcmV?d00001 diff --git a/data/icons/btn_play.png b/data/icons/btn_play.png new file mode 100644 index 0000000000000000000000000000000000000000..e1baa70cab5893783650108ea7d482272dffbc9f GIT binary patch literal 580 zcmV-K0=xZ*P)}w<}2qLm>Bp0Nxuq9-r;w5+haFAaI#|1G@;mTDC za6#+B4XtTnL*d<-6xViwtOSvjMth{$Ju~Nw#+-gRZ30~&;%(;vI17R9?*48RSK~MR zz8~I4U99aP89I6U{F2WeI z2rxFm)*6hl7;A9O0bl{V^C$|cd_Fp&)oKxcig|u|PI96kimIX{w|D+Gftx2ChzPY> z4S@P_op!rTrBY$`G{bqHbSa98;^u#Ju#}+anpurTgUhd%d^|j4I-B8r^7e%U=N;-5 z75S^{$MrfF=jTiwADKIc^KM;&>g(gX8xEOHf38aq1o;O;=Ua!9<_RncEhU624@6P3 zPH@$^qIc6HpUZRb;egW44%uvGod7^p==b|Hn@u{M4%gqW$>nnF@9j}6M&$E(vY8Cl z+Lr`=?hp~I2^b6p^lo}gCKJl#GKE5ct^5|7=` Date: Fri, 30 Nov 2012 22:06:27 +0100 Subject: [PATCH 2/2] - add keys to control the audioplayer from pictureviewer decode and view pictures in a seperate thread. --- data/locale/deutsch.locale | 6 +++ data/locale/english.locale | 6 +++ src/gui/audioplayer.h | 11 ++-- src/gui/pictureviewer.cpp | 100 ++++++++++++++++++++++++++++++++++--- src/gui/pictureviewer.h | 8 +++ src/system/locals.h | 6 +++ src/system/locals_intern.h | 6 +++ 7 files changed, 131 insertions(+), 12 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 3b3930340..068d6e85f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1452,6 +1452,12 @@ pictureviewer.help20 Sortierung andern pictureviewer.help21 Bild unskaliert einlesen pictureviewer.help22 Modus verlassen pictureviewer.help3 Sortierung andern +pictureviewer.help30 Audioplayer-Modus +pictureviewer.help31 Startet die Wiedergabe +pictureviewer.help32 Pausiert die Wiedergabe +pictureviewer.help33 Stoppt die Wiedergabe +pictureviewer.help34 nächster Titel +pictureviewer.help35 vorheriger Titel pictureviewer.help4 Bild unskaliert einlesen pictureviewer.help5 Diashow-Modus pictureviewer.help6 vorheriges Bild diff --git a/data/locale/english.locale b/data/locale/english.locale index 45aa2db2f..dea61a864 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1452,6 +1452,12 @@ pictureviewer.help20 change sort order pictureviewer.help21 reread image (no scaling) pictureviewer.help22 exit pictureviewer.help3 change sort order +pictureviewer.help30 audioplayer mode +pictureviewer.help31 starts the playback +pictureviewer.help32 pauses the playback +pictureviewer.help33 stops the playback +pictureviewer.help34 next title +pictureviewer.help35 previous title pictureviewer.help4 do not scale picture pictureviewer.help5 diashow mode pictureviewer.help6 previous image diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 6a73378e3..daba3d8a9 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -159,9 +159,6 @@ class CAudioPlayerGui : public CMenuTarget CFileFilter audiofilefilter; void paintItemID3DetailsLine (int pos); void clearItemID3DetailsLine (); - void play(unsigned int pos); - void stop(); - void pause(); void ff(unsigned int seconds=0); void rev(unsigned int seconds=0); int getNext(); @@ -248,8 +245,6 @@ class CAudioPlayerGui : public CMenuTarget bool openSCbrowser(void); bool clearPlaylist(void); bool shufflePlaylist(void); - bool playNext(bool allow_rotate = false); - bool playPrev(bool allow_rotate = false); bool pictureviewer; @@ -260,6 +255,12 @@ class CAudioPlayerGui : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); void wantNextPlay(); + void pause(); + void play(unsigned int pos); + void stop(); + bool playNext(bool allow_rotate = false); + bool playPrev(bool allow_rotate = false); + int getAdioPayerM_currend() {return m_current;} }; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 3165df49b..866f2813a 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -101,6 +101,9 @@ CPictureViewerGui::CPictureViewerGui() picture_filter.addFilter("jpeg"); picture_filter.addFilter("gif"); picture_filter.addFilter("crw"); + + decodeT = 0; + decodeTflag = false; } //------------------------------------------------------------------------ @@ -109,6 +112,12 @@ CPictureViewerGui::~CPictureViewerGui() { playlist.clear(); delete m_viewer; + + if (decodeT) + { + pthread_cancel(decodeT); + decodeT = 0; + } } //------------------------------------------------------------------------ @@ -225,6 +234,9 @@ int CPictureViewerGui::show() bool loop=true; bool update=true; + if (audioplayer) + m_currentTitle = m_audioPlayer->getAdioPayerM_currend(); + while (loop) { if (update) @@ -544,6 +556,35 @@ int CPictureViewerGui::show() CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, g_Locale->getText(LOCALE_PICTUREVIEWER_HEAD)); } } + else if (((msg==CRCInput::RC_plus) || (msg==CRCInput::RC_minus)) && decodeTflag) + { + // FIXME: do not accept volume-keys while decoding + } + // control keys for audioplayer + else if (audioplayer && msg==CRCInput::RC_pause) + { + m_currentTitle = m_audioPlayer->getAdioPayerM_currend(); + m_audioPlayer->pause(); + } + else if (audioplayer && msg==CRCInput::RC_stop) + { + m_currentTitle = m_audioPlayer->getAdioPayerM_currend(); + m_audioPlayer->stop(); + } + else if (audioplayer && msg==CRCInput::RC_play) + { + m_currentTitle = m_audioPlayer->getAdioPayerM_currend(); + if (m_currentTitle > -1) + m_audioPlayer->play((unsigned int)m_currentTitle); + } + else if (audioplayer && msg==CRCInput::RC_forward) + { + m_audioPlayer->playNext(); + } + else if (audioplayer && msg==CRCInput::RC_rewind) + { + m_audioPlayer->playPrev(); + } else if (msg == NeutrinoMessages::CHANGEMODE) { if ((data & NeutrinoMessages::mode_mask) !=NeutrinoMessages::mode_pic) @@ -726,6 +767,10 @@ void CPictureViewerGui::paint() void CPictureViewerGui::view(unsigned int index, bool unscaled) { + if (decodeTflag) + return; + + m_unscaled = unscaled; selected=index; CVFD::getInstance()->showMenuText(0, playlist[index].Name.c_str()); @@ -733,26 +778,59 @@ void CPictureViewerGui::view(unsigned int index, bool unscaled) strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[index].Date)); //CVFD::getInstance()->showMenuText(1, timestring); //FIXME - if (unscaled) - m_viewer->DecodeImage(playlist[index].Filename, true, unscaled); - m_viewer->ShowImage(playlist[index].Filename, unscaled); + if (m_state==MENU) + m_state=VIEW; + //decode and view in a seperate thread + if (!decodeTflag) { + decodeTflag=true; + pthread_create(&decodeT, NULL, decodeThread, (void*) this); + pthread_detach(decodeT); + } +} + +void* CPictureViewerGui::decodeThread(void *arg) +{ + CPictureViewerGui *PictureViewerGui = (CPictureViewerGui*) arg; + + pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, NULL); + + PictureViewerGui->thrView(); + + PictureViewerGui->decodeTflag=false; + pthread_exit(NULL); +} + +void CPictureViewerGui::thrView() +{ + if (m_unscaled) + m_viewer->DecodeImage(playlist[selected].Filename, true, m_unscaled); + + m_viewer->ShowImage(playlist[selected].Filename, m_unscaled); + +#if 0 //Decode next unsigned int next=selected+1; if (next > playlist.size()-1) next=0; - if (m_state==MENU) - m_state=VIEW; if (m_state==VIEW) m_viewer->DecodeImage(playlist[next].Filename,true); else m_viewer->DecodeImage(playlist[next].Filename,false); +#endif } void CPictureViewerGui::endView() { if (m_state != MENU) m_state=MENU; + + if (decodeTflag) + { + decodeTflag=false; + pthread_cancel(decodeT); + } } void CPictureViewerGui::deletePicFile(unsigned int index, bool mode) @@ -798,8 +876,16 @@ void CPictureViewerGui::showHelp() helpbox.addLine(NEUTRINO_ICON_BUTTON_5, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP20)); helpbox.addLine(NEUTRINO_ICON_BUTTON_0, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP21)); helpbox.addLine(NEUTRINO_ICON_BUTTON_HOME, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP22)); - - helpbox.addLine("Version: $Revision: 1.57 $"); + if(audioplayer) + { + helpbox.addPagebreak(); + helpbox.addLine(g_Locale->getText(LOCALE_PICTUREVIEWER_HELP30)); + helpbox.addLine(NEUTRINO_ICON_BUTTON_PLAY, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP31)); + helpbox.addLine(NEUTRINO_ICON_BUTTON_PAUSE, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP32)); + helpbox.addLine(NEUTRINO_ICON_BUTTON_STOP, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP33)); + helpbox.addLine(NEUTRINO_ICON_BUTTON_FORWARD, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP34)); + helpbox.addLine(NEUTRINO_ICON_BUTTON_BACKWARD, g_Locale->getText(LOCALE_PICTUREVIEWER_HELP35)); + } hide(); helpbox.show(LOCALE_MESSAGEBOX_INFO); } diff --git a/src/gui/pictureviewer.h b/src/gui/pictureviewer.h index 0909d6ef4..4e98071ae 100644 --- a/src/gui/pictureviewer.h +++ b/src/gui/pictureviewer.h @@ -111,6 +111,14 @@ class CPictureViewerGui : public CMenuTarget void deletePicFile(unsigned int index, bool mode); bool audioplayer; + int m_currentTitle; + + pthread_t decodeT; + static void* decodeThread(void *arg); + bool decodeTflag; + + void thrView(); + bool m_unscaled; public: CPictureViewerGui(); diff --git a/src/system/locals.h b/src/system/locals.h index 92fa4c9b3..eb94a4ceb 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1479,6 +1479,12 @@ typedef enum LOCALE_PICTUREVIEWER_HELP21, LOCALE_PICTUREVIEWER_HELP22, LOCALE_PICTUREVIEWER_HELP3, + LOCALE_PICTUREVIEWER_HELP30, + LOCALE_PICTUREVIEWER_HELP31, + LOCALE_PICTUREVIEWER_HELP32, + LOCALE_PICTUREVIEWER_HELP33, + LOCALE_PICTUREVIEWER_HELP34, + LOCALE_PICTUREVIEWER_HELP35, LOCALE_PICTUREVIEWER_HELP4, LOCALE_PICTUREVIEWER_HELP5, LOCALE_PICTUREVIEWER_HELP6, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 55c0a402b..b4431b571 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1479,6 +1479,12 @@ const char * locale_real_names[] = "pictureviewer.help21", "pictureviewer.help22", "pictureviewer.help3", + "pictureviewer.help30", + "pictureviewer.help31", + "pictureviewer.help32", + "pictureviewer.help33", + "pictureviewer.help34", + "pictureviewer.help35", "pictureviewer.help4", "pictureviewer.help5", "pictureviewer.help6",